mirror of
https://github.com/FlourishingWorld/hk4e.git
synced 2026-02-17 01:32:26 +08:00
修复开场任务
This commit is contained in:
@@ -8,6 +8,18 @@ const (
|
|||||||
QUEST_STATE_FAILED = 4
|
QUEST_STATE_FAILED = 4
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
QUEST_LOGIC_TYPE_NONE = 0
|
||||||
|
QUEST_LOGIC_TYPE_AND = 1
|
||||||
|
QUEST_LOGIC_TYPE_OR = 2
|
||||||
|
QUEST_LOGIC_TYPE_NOT = 3
|
||||||
|
QUEST_LOGIC_TYPE_A_AND_ETCOR = 4
|
||||||
|
QUEST_LOGIC_TYPE_A_AND_B_AND_ETCOR = 5
|
||||||
|
QUEST_LOGIC_TYPE_A_OR_ETCAND = 6
|
||||||
|
QUEST_LOGIC_TYPE_A_OR_B_OR_ETCAND = 7
|
||||||
|
QUEST_LOGIC_TYPE_A_AND_B_OR_ETCAND = 8
|
||||||
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
QUEST_ACCEPT_COND_TYPE_NONE = 0
|
QUEST_ACCEPT_COND_TYPE_NONE = 0
|
||||||
QUEST_ACCEPT_COND_TYPE_STATE_EQUAL = 1
|
QUEST_ACCEPT_COND_TYPE_STATE_EQUAL = 1
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ func (c *Controller) gateTokenVerify(context *gin.Context) {
|
|||||||
verifyFail(account.PlayerID)
|
verifyFail(account.PlayerID)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if time.Now().UnixMilli()-int64(account.ComboTokenCreateTime) > time.Minute.Milliseconds()*5 {
|
if time.Now().UnixMilli()-int64(account.ComboTokenCreateTime) > time.Hour.Milliseconds()*24 {
|
||||||
verifyFail(account.PlayerID)
|
verifyFail(account.PlayerID)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import (
|
|||||||
func (g *GameManager) GetAllAvatarDataConfig() map[int32]*gdconf.AvatarData {
|
func (g *GameManager) GetAllAvatarDataConfig() map[int32]*gdconf.AvatarData {
|
||||||
allAvatarDataConfig := make(map[int32]*gdconf.AvatarData)
|
allAvatarDataConfig := make(map[int32]*gdconf.AvatarData)
|
||||||
for avatarId, avatarData := range gdconf.GetAvatarDataMap() {
|
for avatarId, avatarData := range gdconf.GetAvatarDataMap() {
|
||||||
if avatarId < 10000002 || avatarId >= 11000000 {
|
if avatarId <= 10000001 || avatarId >= 11000000 {
|
||||||
// 跳过无效角色
|
// 跳过无效角色
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@@ -25,10 +25,6 @@ func (g *GameManager) GetAllAvatarDataConfig() map[int32]*gdconf.AvatarData {
|
|||||||
// 跳过主角
|
// 跳过主角
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if avatarId >= 10000079 {
|
|
||||||
// 跳过后续版本的角色
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
allAvatarDataConfig[avatarId] = avatarData
|
allAvatarDataConfig[avatarId] = avatarData
|
||||||
}
|
}
|
||||||
return allAvatarDataConfig
|
return allAvatarDataConfig
|
||||||
|
|||||||
@@ -386,8 +386,6 @@ func (g *GameManager) AoiPlayerMove(player *model.Player, oldPos *model.Vector,
|
|||||||
g.RemoveSceneEntityNotifyToPlayer(player, proto.VisionType_VISION_MISS, delEntityIdList)
|
g.RemoveSceneEntityNotifyToPlayer(player, proto.VisionType_VISION_MISS, delEntityIdList)
|
||||||
g.AddSceneEntityNotify(player, proto.VisionType_VISION_MEET, addEntityIdList, false, false)
|
g.AddSceneEntityNotify(player, proto.VisionType_VISION_MEET, addEntityIdList, false, false)
|
||||||
// 场景区域触发器
|
// 场景区域触发器
|
||||||
dbQuest := player.GetDbQuest()
|
|
||||||
updateQuest := false
|
|
||||||
for _, group := range newVisionGroupMap {
|
for _, group := range newVisionGroupMap {
|
||||||
for _, region := range group.RegionList {
|
for _, region := range group.RegionList {
|
||||||
shape := alg.NewShape()
|
shape := alg.NewShape()
|
||||||
@@ -443,7 +441,7 @@ func (g *GameManager) AoiPlayerMove(player *model.Player, oldPos *model.Vector,
|
|||||||
logger.Error("trigger action fail, trigger: %v, uid: %v", trigger, player.PlayerID)
|
logger.Error("trigger action fail, trigger: %v, uid: %v", trigger, player.PlayerID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateQuest = g.TriggerFire(dbQuest, trigger)
|
g.TriggerFire(player, trigger)
|
||||||
}
|
}
|
||||||
} else if oldPosInRegion && !newPosInRegion {
|
} else if oldPosInRegion && !newPosInRegion {
|
||||||
logger.Debug("player leave region: %v, uid: %v", region, player.PlayerID)
|
logger.Debug("player leave region: %v, uid: %v", region, player.PlayerID)
|
||||||
@@ -473,38 +471,14 @@ func (g *GameManager) AoiPlayerMove(player *model.Player, oldPos *model.Vector,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if updateQuest {
|
|
||||||
g.AcceptQuest(player, true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GameManager) TriggerFire(dbQuest *model.DbQuest, trigger *gdconf.Trigger) bool {
|
func (g *GameManager) TriggerFire(player *model.Player, trigger *gdconf.Trigger) {
|
||||||
// TODO 这一块写得太炸裂了需要优化
|
|
||||||
updateQuest := false
|
|
||||||
for _, triggerDataConfig := range gdconf.GetTriggerDataMap() {
|
for _, triggerDataConfig := range gdconf.GetTriggerDataMap() {
|
||||||
if triggerDataConfig.TriggerName == trigger.Name {
|
if triggerDataConfig.TriggerName == trigger.Name {
|
||||||
for _, quest := range dbQuest.GetQuestMap() {
|
g.TriggerQuest(player, constant.QUEST_FINISH_COND_TYPE_TRIGGER_FIRE, triggerDataConfig.TriggerId)
|
||||||
questDataConfig := gdconf.GetQuestDataById(int32(quest.QuestId))
|
|
||||||
if questDataConfig == nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
for _, questCond := range questDataConfig.FinishCondList {
|
|
||||||
if questCond.Type != constant.QUEST_FINISH_COND_TYPE_TRIGGER_FIRE {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if len(questCond.Param) != 1 {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if questCond.Param[0] != triggerDataConfig.TriggerId {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
dbQuest.ForceFinishQuest(quest.QuestId)
|
|
||||||
updateQuest = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return updateQuest
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GameManager) AbilityInvocationsNotify(player *model.Player, payloadMsg pb.Message) {
|
func (g *GameManager) AbilityInvocationsNotify(player *model.Player, payloadMsg pb.Message) {
|
||||||
@@ -713,9 +687,12 @@ func (g *GameManager) EvtCreateGadgetNotify(player *model.Player, payloadMsg pb.
|
|||||||
}
|
}
|
||||||
logger.Debug("EvtCreateGadgetNotify: %v", req)
|
logger.Debug("EvtCreateGadgetNotify: %v", req)
|
||||||
world := WORLD_MANAGER.GetWorldByID(player.WorldId)
|
world := WORLD_MANAGER.GetWorldByID(player.WorldId)
|
||||||
|
if world == nil {
|
||||||
|
logger.Error("world is nil, WorldId: %v", player.WorldId)
|
||||||
|
return
|
||||||
|
}
|
||||||
scene := world.GetSceneById(player.SceneId)
|
scene := world.GetSceneById(player.SceneId)
|
||||||
if scene == nil {
|
if req.InitPos == nil {
|
||||||
logger.Error("scene is nil, sceneId: %v", player.SceneId)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
scene.CreateEntityGadgetClient(&model.Vector{
|
scene.CreateEntityGadgetClient(&model.Vector{
|
||||||
|
|||||||
@@ -24,25 +24,6 @@ func (g *GameManager) GetAllItemDataConfig() map[int32]*gdconf.ItemData {
|
|||||||
// 排除圣遗物
|
// 排除圣遗物
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if itemId == 100086 ||
|
|
||||||
itemId == 100087 ||
|
|
||||||
(itemId >= 100100 && itemId <= 101000) ||
|
|
||||||
(itemId >= 101106 && itemId <= 101110) ||
|
|
||||||
itemId == 101306 ||
|
|
||||||
(itemId >= 101500 && itemId <= 104000) ||
|
|
||||||
itemId == 105001 ||
|
|
||||||
itemId == 105004 ||
|
|
||||||
(itemId >= 106000 && itemId <= 107000) ||
|
|
||||||
itemId == 107011 ||
|
|
||||||
itemId == 108000 ||
|
|
||||||
(itemId >= 109000 && itemId <= 110000) ||
|
|
||||||
(itemId >= 115000 && itemId <= 130000) ||
|
|
||||||
(itemId >= 200200 && itemId <= 200899) ||
|
|
||||||
itemId == 220050 ||
|
|
||||||
itemId == 220054 {
|
|
||||||
// 排除无效道具
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
allItemDataConfig[itemId] = itemData
|
allItemDataConfig[itemId] = itemData
|
||||||
}
|
}
|
||||||
return allItemDataConfig
|
return allItemDataConfig
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ func (g *GameManager) OnLoginOk(userId uint32, player *model.Player, clientSeq u
|
|||||||
g.SendMsgToGate(cmd.DoSetPlayerBornDataNotify, userId, clientSeq, gateAppId, new(proto.DoSetPlayerBornDataNotify))
|
g.SendMsgToGate(cmd.DoSetPlayerBornDataNotify, userId, clientSeq, gateAppId, new(proto.DoSetPlayerBornDataNotify))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
SELF = player
|
||||||
|
|
||||||
player.OnlineTime = uint32(time.Now().UnixMilli())
|
player.OnlineTime = uint32(time.Now().UnixMilli())
|
||||||
player.Online = true
|
player.Online = true
|
||||||
@@ -80,6 +81,9 @@ func (g *GameManager) OnLoginOk(userId uint32, player *model.Player, clientSeq u
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO DEBUG DEL
|
||||||
|
g.AcceptQuest(player, false)
|
||||||
|
|
||||||
g.LoginNotify(userId, player, clientSeq)
|
g.LoginNotify(userId, player, clientSeq)
|
||||||
|
|
||||||
MESSAGE_QUEUE.SendToAll(&mq.NetMsg{
|
MESSAGE_QUEUE.SendToAll(&mq.NetMsg{
|
||||||
@@ -95,6 +99,8 @@ func (g *GameManager) OnLoginOk(userId uint32, player *model.Player, clientSeq u
|
|||||||
TICK_MANAGER.CreateUserTimer(userId, UserTimerActionTest, 100)
|
TICK_MANAGER.CreateUserTimer(userId, UserTimerActionTest, 100)
|
||||||
|
|
||||||
atomic.AddInt32(&ONLINE_PLAYER_NUM, 1)
|
atomic.AddInt32(&ONLINE_PLAYER_NUM, 1)
|
||||||
|
|
||||||
|
SELF = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GameManager) OnReg(userId uint32, clientSeq uint32, gateAppId string, payloadMsg pb.Message) {
|
func (g *GameManager) OnReg(userId uint32, clientSeq uint32, gateAppId string, payloadMsg pb.Message) {
|
||||||
|
|||||||
@@ -69,28 +69,60 @@ func (g *GameManager) AcceptQuest(player *model.Player, notifyClient bool) {
|
|||||||
if dbQuest.GetQuestById(uint32(questData.QuestId)) != nil {
|
if dbQuest.GetQuestById(uint32(questData.QuestId)) != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
canAccept := true
|
acceptCondResultList := make([]bool, 0)
|
||||||
for _, acceptCond := range questData.AcceptCondList {
|
for _, acceptCond := range questData.AcceptCondList {
|
||||||
|
result := false
|
||||||
switch acceptCond.Type {
|
switch acceptCond.Type {
|
||||||
case constant.QUEST_ACCEPT_COND_TYPE_STATE_EQUAL:
|
case constant.QUEST_ACCEPT_COND_TYPE_STATE_EQUAL:
|
||||||
// 某个任务状态等于 参数1:任务id 参数2:任务状态
|
// 某个任务状态等于 参数1:任务id 参数2:任务状态
|
||||||
if len(acceptCond.Param) != 2 {
|
if len(acceptCond.Param) != 2 {
|
||||||
logger.Error("quest accept cond config format error, questId: %v", questData.QuestId)
|
|
||||||
canAccept = false
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
quest := dbQuest.GetQuestById(uint32(acceptCond.Param[0]))
|
quest := dbQuest.GetQuestById(uint32(acceptCond.Param[0]))
|
||||||
if quest == nil {
|
if quest == nil {
|
||||||
canAccept = false
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if quest.State != uint8(acceptCond.Param[1]) {
|
if quest.State != uint8(acceptCond.Param[1]) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
result = true
|
||||||
|
case constant.QUEST_ACCEPT_COND_TYPE_STATE_NOT_EQUAL:
|
||||||
|
// 某个任务状态不等于 参数1:任务id 参数2:任务状态
|
||||||
|
if len(acceptCond.Param) != 2 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
quest := dbQuest.GetQuestById(uint32(acceptCond.Param[0]))
|
||||||
|
if quest == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if quest.State == uint8(acceptCond.Param[1]) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
result = true
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
acceptCondResultList = append(acceptCondResultList, result)
|
||||||
|
}
|
||||||
|
canAccept := false
|
||||||
|
switch questData.AcceptCondCompose {
|
||||||
|
case constant.QUEST_LOGIC_TYPE_NONE:
|
||||||
|
fallthrough
|
||||||
|
case constant.QUEST_LOGIC_TYPE_AND:
|
||||||
|
canAccept = true
|
||||||
|
for _, acceptCondResult := range acceptCondResultList {
|
||||||
|
if !acceptCondResult {
|
||||||
canAccept = false
|
canAccept = false
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
default:
|
}
|
||||||
canAccept = false
|
case constant.QUEST_LOGIC_TYPE_OR:
|
||||||
break
|
canAccept = false
|
||||||
|
for _, acceptCondResult := range acceptCondResultList {
|
||||||
|
if acceptCondResult {
|
||||||
|
canAccept = true
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if canAccept {
|
if canAccept {
|
||||||
@@ -115,6 +147,68 @@ func (g *GameManager) AcceptQuest(player *model.Player, notifyClient bool) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TriggerQuest 触发任务
|
||||||
|
func (g *GameManager) TriggerQuest(player *model.Player, cond int32, param ...int32) {
|
||||||
|
dbQuest := player.GetDbQuest()
|
||||||
|
updateQuestIdList := make([]uint32, 0)
|
||||||
|
for _, quest := range dbQuest.GetQuestMap() {
|
||||||
|
questDataConfig := gdconf.GetQuestDataById(int32(quest.QuestId))
|
||||||
|
if questDataConfig == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
for _, questCond := range questDataConfig.FinishCondList {
|
||||||
|
if questCond.Type != cond {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
switch cond {
|
||||||
|
case constant.QUEST_FINISH_COND_TYPE_TRIGGER_FIRE:
|
||||||
|
// 场景触发器跳了 参数1:触发器id
|
||||||
|
if len(questCond.Param) != 1 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if len(param) != 1 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if questCond.Param[0] != param[0] {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
dbQuest.ForceFinishQuest(quest.QuestId)
|
||||||
|
updateQuestIdList = append(updateQuestIdList, quest.QuestId)
|
||||||
|
case constant.QUEST_FINISH_COND_TYPE_UNLOCK_TRANS_POINT:
|
||||||
|
// 解锁传送锚点 参数1:场景id 参数2:传送锚点id
|
||||||
|
if len(questCond.Param) != 2 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if len(param) != 2 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if questCond.Param[0] != param[0] {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if questCond.Param[1] != param[1] {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
dbQuest.ForceFinishQuest(quest.QuestId)
|
||||||
|
updateQuestIdList = append(updateQuestIdList, quest.QuestId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(updateQuestIdList) > 0 {
|
||||||
|
ntf := &proto.QuestListUpdateNotify{
|
||||||
|
QuestList: make([]*proto.Quest, 0),
|
||||||
|
}
|
||||||
|
for _, questId := range updateQuestIdList {
|
||||||
|
pbQuest := g.PacketQuest(player, questId)
|
||||||
|
if pbQuest == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
ntf.QuestList = append(ntf.QuestList, pbQuest)
|
||||||
|
}
|
||||||
|
g.SendMsg(cmd.QuestListUpdateNotify, player.PlayerID, player.ClientSeq, ntf)
|
||||||
|
g.AcceptQuest(player, true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// PacketQuest 打包一个任务
|
// PacketQuest 打包一个任务
|
||||||
func (g *GameManager) PacketQuest(player *model.Player, questId uint32) *proto.Quest {
|
func (g *GameManager) PacketQuest(player *model.Player, questId uint32) *proto.Quest {
|
||||||
dbQuest := player.GetDbQuest()
|
dbQuest := player.GetDbQuest()
|
||||||
|
|||||||
@@ -15,12 +15,6 @@ func (g *GameManager) GetAllReliquaryDataConfig() map[int32]*gdconf.ItemData {
|
|||||||
if itemData.Type != constant.ITEM_TYPE_RELIQUARY {
|
if itemData.Type != constant.ITEM_TYPE_RELIQUARY {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if (itemId >= 20002 && itemId <= 20004) ||
|
|
||||||
itemId == 23334 ||
|
|
||||||
(itemId >= 23300 && itemId <= 23340) {
|
|
||||||
// 跳过无效圣遗物
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
allReliquaryDataConfig[itemId] = itemData
|
allReliquaryDataConfig[itemId] = itemData
|
||||||
}
|
}
|
||||||
return allReliquaryDataConfig
|
return allReliquaryDataConfig
|
||||||
|
|||||||
@@ -20,24 +20,6 @@ func (g *GameManager) GetAllWeaponDataConfig() map[int32]*gdconf.ItemData {
|
|||||||
if itemData.Type != constant.ITEM_TYPE_WEAPON {
|
if itemData.Type != constant.ITEM_TYPE_WEAPON {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if (itemId >= 10000 && itemId <= 10008) ||
|
|
||||||
itemId == 11411 ||
|
|
||||||
(itemId >= 11506 && itemId <= 11508) ||
|
|
||||||
itemId == 12505 ||
|
|
||||||
itemId == 12506 ||
|
|
||||||
itemId == 12508 ||
|
|
||||||
itemId == 12509 ||
|
|
||||||
itemId == 13503 ||
|
|
||||||
itemId == 13506 ||
|
|
||||||
itemId == 14411 ||
|
|
||||||
itemId == 14503 ||
|
|
||||||
itemId == 14505 ||
|
|
||||||
itemId == 14508 ||
|
|
||||||
(itemId >= 15504 && itemId <= 15506) ||
|
|
||||||
itemId == 20001 || itemId == 15306 || itemId == 14306 || itemId == 13304 || itemId == 12304 {
|
|
||||||
// 跳过无效武器
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
allWeaponDataConfig[itemId] = itemData
|
allWeaponDataConfig[itemId] = itemData
|
||||||
}
|
}
|
||||||
return allWeaponDataConfig
|
return allWeaponDataConfig
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package game
|
|||||||
import (
|
import (
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"hk4e/common/constant"
|
||||||
"hk4e/gdconf"
|
"hk4e/gdconf"
|
||||||
"hk4e/gs/model"
|
"hk4e/gs/model"
|
||||||
"hk4e/pkg/logger"
|
"hk4e/pkg/logger"
|
||||||
@@ -15,12 +16,22 @@ import (
|
|||||||
func (g *GameManager) SceneTransToPointReq(player *model.Player, payloadMsg pb.Message) {
|
func (g *GameManager) SceneTransToPointReq(player *model.Player, payloadMsg pb.Message) {
|
||||||
req := payloadMsg.(*proto.SceneTransToPointReq)
|
req := payloadMsg.(*proto.SceneTransToPointReq)
|
||||||
|
|
||||||
pointDataConfig := gdconf.GetScenePointBySceneIdAndPointId(int32(req.SceneId), int32(req.PointId))
|
dbWorld := player.GetDbWorld()
|
||||||
if pointDataConfig == nil {
|
dbScene := dbWorld.GetSceneById(req.SceneId)
|
||||||
g.SendError(cmd.SceneTransToPointRsp, player, &proto.SceneTransToPointRsp{})
|
if dbScene == nil {
|
||||||
|
g.SendError(cmd.SceneTransToPointRsp, player, &proto.SceneTransToPointRsp{}, proto.Retcode_RET_POINT_NOT_UNLOCKED)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
unlock := dbScene.CheckPointUnlock(req.PointId)
|
||||||
|
if !unlock {
|
||||||
|
g.SendError(cmd.SceneTransToPointRsp, player, &proto.SceneTransToPointRsp{}, proto.Retcode_RET_POINT_NOT_UNLOCKED)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
pointDataConfig := gdconf.GetScenePointBySceneIdAndPointId(int32(req.SceneId), int32(req.PointId))
|
||||||
|
if pointDataConfig == nil {
|
||||||
|
g.SendError(cmd.SceneTransToPointRsp, player, &proto.SceneTransToPointRsp{}, proto.Retcode_RET_POINT_NOT_UNLOCKED)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 传送玩家
|
// 传送玩家
|
||||||
sceneId := req.SceneId
|
sceneId := req.SceneId
|
||||||
g.TeleportPlayer(player, uint16(proto.EnterReason_ENTER_REASON_TRANS_POINT), sceneId, &model.Vector{
|
g.TeleportPlayer(player, uint16(proto.EnterReason_ENTER_REASON_TRANS_POINT), sceneId, &model.Vector{
|
||||||
@@ -40,6 +51,65 @@ func (g *GameManager) SceneTransToPointReq(player *model.Player, payloadMsg pb.M
|
|||||||
g.SendMsg(cmd.SceneTransToPointRsp, player.PlayerID, player.ClientSeq, sceneTransToPointRsp)
|
g.SendMsg(cmd.SceneTransToPointRsp, player.PlayerID, player.ClientSeq, sceneTransToPointRsp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (g *GameManager) UnlockTransPointReq(player *model.Player, payloadMsg pb.Message) {
|
||||||
|
req := payloadMsg.(*proto.UnlockTransPointReq)
|
||||||
|
|
||||||
|
dbWorld := player.GetDbWorld()
|
||||||
|
dbScene := dbWorld.GetSceneById(req.SceneId)
|
||||||
|
if dbScene == nil {
|
||||||
|
g.SendError(cmd.UnlockTransPointRsp, player, &proto.UnlockTransPointRsp{}, proto.Retcode_RET_POINT_NOT_UNLOCKED)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
unlock := dbScene.CheckPointUnlock(req.PointId)
|
||||||
|
if unlock {
|
||||||
|
g.SendError(cmd.UnlockTransPointRsp, player, &proto.UnlockTransPointRsp{}, proto.Retcode_RET_POINT_ALREAY_UNLOCKED)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
dbScene.UnlockPoint(req.PointId)
|
||||||
|
|
||||||
|
g.TriggerQuest(player, constant.QUEST_FINISH_COND_TYPE_UNLOCK_TRANS_POINT, int32(req.SceneId), int32(req.PointId))
|
||||||
|
|
||||||
|
g.SendMsg(cmd.ScenePointUnlockNotify, player.PlayerID, player.ClientSeq, &proto.ScenePointUnlockNotify{
|
||||||
|
SceneId: req.SceneId,
|
||||||
|
PointList: []uint32{req.PointId},
|
||||||
|
UnhidePointList: nil,
|
||||||
|
})
|
||||||
|
g.SendSucc(cmd.UnlockTransPointRsp, player, &proto.UnlockTransPointRsp{})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GameManager) GetScenePointReq(player *model.Player, payloadMsg pb.Message) {
|
||||||
|
req := payloadMsg.(*proto.GetScenePointReq)
|
||||||
|
|
||||||
|
dbWorld := player.GetDbWorld()
|
||||||
|
dbScene := dbWorld.GetSceneById(req.SceneId)
|
||||||
|
if dbScene == nil {
|
||||||
|
g.SendError(cmd.GetScenePointRsp, player, &proto.GetScenePointRsp{})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
getScenePointRsp := &proto.GetScenePointRsp{
|
||||||
|
SceneId: req.SceneId,
|
||||||
|
}
|
||||||
|
areaIdMap := make(map[uint32]bool)
|
||||||
|
for _, worldAreaData := range gdconf.GetWorldAreaDataMap() {
|
||||||
|
if uint32(worldAreaData.SceneId) == req.SceneId {
|
||||||
|
areaIdMap[uint32(worldAreaData.AreaId1)] = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
areaList := make([]uint32, 0)
|
||||||
|
for areaId := range areaIdMap {
|
||||||
|
areaList = append(areaList, areaId)
|
||||||
|
}
|
||||||
|
getScenePointRsp.UnlockAreaList = areaList
|
||||||
|
for _, pointId := range dbScene.GetUnlockPointList() {
|
||||||
|
pointData := gdconf.GetScenePointBySceneIdAndPointId(int32(req.SceneId), int32(pointId))
|
||||||
|
if pointData.IsModelHidden {
|
||||||
|
getScenePointRsp.HidePointList = append(getScenePointRsp.HidePointList, pointId)
|
||||||
|
}
|
||||||
|
getScenePointRsp.UnlockedPointList = append(getScenePointRsp.UnlockedPointList, pointId)
|
||||||
|
}
|
||||||
|
g.SendMsg(cmd.GetScenePointRsp, player.PlayerID, player.ClientSeq, getScenePointRsp)
|
||||||
|
}
|
||||||
|
|
||||||
func (g *GameManager) MarkMapReq(player *model.Player, payloadMsg pb.Message) {
|
func (g *GameManager) MarkMapReq(player *model.Player, payloadMsg pb.Message) {
|
||||||
req := payloadMsg.(*proto.MarkMapReq)
|
req := payloadMsg.(*proto.MarkMapReq)
|
||||||
operation := req.Op
|
operation := req.Op
|
||||||
@@ -61,6 +131,51 @@ func (g *GameManager) MarkMapReq(player *model.Player, payloadMsg pb.Message) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (g *GameManager) GetSceneAreaReq(player *model.Player, payloadMsg pb.Message) {
|
||||||
|
req := payloadMsg.(*proto.GetSceneAreaReq)
|
||||||
|
|
||||||
|
getSceneAreaRsp := &proto.GetSceneAreaRsp{
|
||||||
|
SceneId: req.SceneId,
|
||||||
|
}
|
||||||
|
areaIdMap := make(map[uint32]bool)
|
||||||
|
for _, worldAreaData := range gdconf.GetWorldAreaDataMap() {
|
||||||
|
if uint32(worldAreaData.SceneId) == req.SceneId {
|
||||||
|
areaIdMap[uint32(worldAreaData.AreaId1)] = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
areaList := make([]uint32, 0)
|
||||||
|
for areaId := range areaIdMap {
|
||||||
|
areaList = append(areaList, areaId)
|
||||||
|
}
|
||||||
|
getSceneAreaRsp.AreaIdList = areaList
|
||||||
|
if req.SceneId == 3 {
|
||||||
|
getSceneAreaRsp.CityInfoList = []*proto.CityInfo{
|
||||||
|
{CityId: 1, Level: 10},
|
||||||
|
{CityId: 2, Level: 10},
|
||||||
|
{CityId: 3, Level: 10},
|
||||||
|
{CityId: 4, Level: 10},
|
||||||
|
{CityId: 99, Level: 1},
|
||||||
|
{CityId: 100, Level: 1},
|
||||||
|
{CityId: 101, Level: 1},
|
||||||
|
{CityId: 102, Level: 1},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
g.SendMsg(cmd.GetSceneAreaRsp, player.PlayerID, player.ClientSeq, getSceneAreaRsp)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GameManager) EnterWorldAreaReq(player *model.Player, payloadMsg pb.Message) {
|
||||||
|
logger.Debug("player enter world area, uid: %v", player.PlayerID)
|
||||||
|
req := payloadMsg.(*proto.EnterWorldAreaReq)
|
||||||
|
|
||||||
|
logger.Debug("EnterWorldAreaReq: %v", req)
|
||||||
|
|
||||||
|
enterWorldAreaRsp := &proto.EnterWorldAreaRsp{
|
||||||
|
AreaType: req.AreaType,
|
||||||
|
AreaId: req.AreaId,
|
||||||
|
}
|
||||||
|
g.SendMsg(cmd.EnterWorldAreaRsp, player.PlayerID, player.ClientSeq, enterWorldAreaRsp)
|
||||||
|
}
|
||||||
|
|
||||||
// TeleportPlayer 传送玩家至地图上的某个位置
|
// TeleportPlayer 传送玩家至地图上的某个位置
|
||||||
func (g *GameManager) TeleportPlayer(player *model.Player, enterReason uint16, sceneId uint32, pos, rot *model.Vector, dungeonId uint32) {
|
func (g *GameManager) TeleportPlayer(player *model.Player, enterReason uint16, sceneId uint32, pos, rot *model.Vector, dungeonId uint32) {
|
||||||
// 传送玩家
|
// 传送玩家
|
||||||
@@ -122,79 +237,3 @@ func (g *GameManager) TeleportPlayer(player *model.Player, enterReason uint16, s
|
|||||||
playerEnterSceneNotify := g.PacketPlayerEnterSceneNotifyTp(player, enterType, uint32(enterReason), oldSceneId, oldPos, dungeonId)
|
playerEnterSceneNotify := g.PacketPlayerEnterSceneNotifyTp(player, enterType, uint32(enterReason), oldSceneId, oldPos, dungeonId)
|
||||||
g.SendMsg(cmd.PlayerEnterSceneNotify, player.PlayerID, player.ClientSeq, playerEnterSceneNotify)
|
g.SendMsg(cmd.PlayerEnterSceneNotify, player.PlayerID, player.ClientSeq, playerEnterSceneNotify)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GameManager) GetScenePointReq(player *model.Player, payloadMsg pb.Message) {
|
|
||||||
req := payloadMsg.(*proto.GetScenePointReq)
|
|
||||||
|
|
||||||
scenePointMapConfig := gdconf.GetScenePointMapBySceneId(int32(req.SceneId))
|
|
||||||
if scenePointMapConfig == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
getScenePointRsp := &proto.GetScenePointRsp{
|
|
||||||
SceneId: req.SceneId,
|
|
||||||
}
|
|
||||||
areaIdMap := make(map[uint32]bool)
|
|
||||||
for _, worldAreaData := range gdconf.GetWorldAreaDataMap() {
|
|
||||||
if uint32(worldAreaData.SceneId) == req.SceneId {
|
|
||||||
areaIdMap[uint32(worldAreaData.AreaId1)] = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
areaList := make([]uint32, 0)
|
|
||||||
for areaId := range areaIdMap {
|
|
||||||
areaList = append(areaList, areaId)
|
|
||||||
}
|
|
||||||
getScenePointRsp.UnlockAreaList = areaList
|
|
||||||
for _, pointData := range scenePointMapConfig {
|
|
||||||
if pointData.PointType == gdconf.PointTypeOther {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
getScenePointRsp.UnlockedPointList = append(getScenePointRsp.UnlockedPointList, uint32(pointData.Id))
|
|
||||||
}
|
|
||||||
g.SendMsg(cmd.GetScenePointRsp, player.PlayerID, player.ClientSeq, getScenePointRsp)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (g *GameManager) GetSceneAreaReq(player *model.Player, payloadMsg pb.Message) {
|
|
||||||
req := payloadMsg.(*proto.GetSceneAreaReq)
|
|
||||||
|
|
||||||
getSceneAreaRsp := &proto.GetSceneAreaRsp{
|
|
||||||
SceneId: req.SceneId,
|
|
||||||
}
|
|
||||||
areaIdMap := make(map[uint32]bool)
|
|
||||||
for _, worldAreaData := range gdconf.GetWorldAreaDataMap() {
|
|
||||||
if uint32(worldAreaData.SceneId) == req.SceneId {
|
|
||||||
areaIdMap[uint32(worldAreaData.AreaId1)] = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
areaList := make([]uint32, 0)
|
|
||||||
for areaId := range areaIdMap {
|
|
||||||
areaList = append(areaList, areaId)
|
|
||||||
}
|
|
||||||
getSceneAreaRsp.AreaIdList = areaList
|
|
||||||
if req.SceneId == 3 {
|
|
||||||
getSceneAreaRsp.CityInfoList = []*proto.CityInfo{
|
|
||||||
{CityId: 1, Level: 10},
|
|
||||||
{CityId: 2, Level: 10},
|
|
||||||
{CityId: 3, Level: 10},
|
|
||||||
{CityId: 4, Level: 10},
|
|
||||||
{CityId: 99, Level: 1},
|
|
||||||
{CityId: 100, Level: 1},
|
|
||||||
{CityId: 101, Level: 1},
|
|
||||||
{CityId: 102, Level: 1},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
g.SendMsg(cmd.GetSceneAreaRsp, player.PlayerID, player.ClientSeq, getSceneAreaRsp)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (g *GameManager) EnterWorldAreaReq(player *model.Player, payloadMsg pb.Message) {
|
|
||||||
logger.Debug("player enter world area, uid: %v", player.PlayerID)
|
|
||||||
req := payloadMsg.(*proto.EnterWorldAreaReq)
|
|
||||||
|
|
||||||
logger.Debug("EnterWorldAreaReq: %v", req)
|
|
||||||
|
|
||||||
enterWorldAreaRsp := &proto.EnterWorldAreaRsp{
|
|
||||||
AreaType: req.AreaType,
|
|
||||||
AreaId: req.AreaId,
|
|
||||||
}
|
|
||||||
g.SendMsg(cmd.EnterWorldAreaRsp, player.PlayerID, player.ClientSeq, enterWorldAreaRsp)
|
|
||||||
}
|
|
||||||
@@ -69,6 +69,7 @@ func (r *RouteManager) initRoute() {
|
|||||||
r.registerRouter(cmd.PostEnterSceneReq, GAME_MANAGER.PostEnterSceneReq)
|
r.registerRouter(cmd.PostEnterSceneReq, GAME_MANAGER.PostEnterSceneReq)
|
||||||
r.registerRouter(cmd.TowerAllDataReq, GAME_MANAGER.TowerAllDataReq)
|
r.registerRouter(cmd.TowerAllDataReq, GAME_MANAGER.TowerAllDataReq)
|
||||||
r.registerRouter(cmd.SceneTransToPointReq, GAME_MANAGER.SceneTransToPointReq)
|
r.registerRouter(cmd.SceneTransToPointReq, GAME_MANAGER.SceneTransToPointReq)
|
||||||
|
r.registerRouter(cmd.UnlockTransPointReq, GAME_MANAGER.UnlockTransPointReq)
|
||||||
r.registerRouter(cmd.MarkMapReq, GAME_MANAGER.MarkMapReq)
|
r.registerRouter(cmd.MarkMapReq, GAME_MANAGER.MarkMapReq)
|
||||||
r.registerRouter(cmd.ChangeAvatarReq, GAME_MANAGER.ChangeAvatarReq)
|
r.registerRouter(cmd.ChangeAvatarReq, GAME_MANAGER.ChangeAvatarReq)
|
||||||
r.registerRouter(cmd.SetUpAvatarTeamReq, GAME_MANAGER.SetUpAvatarTeamReq)
|
r.registerRouter(cmd.SetUpAvatarTeamReq, GAME_MANAGER.SetUpAvatarTeamReq)
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ type Avatar struct {
|
|||||||
Promote uint8 // 突破等阶
|
Promote uint8 // 突破等阶
|
||||||
Satiation uint32 // 饱食度
|
Satiation uint32 // 饱食度
|
||||||
SatiationPenalty uint32 // 饱食度溢出
|
SatiationPenalty uint32 // 饱食度溢出
|
||||||
CurrHP float32 // 当前生命值
|
CurrHP float64 // 当前生命值
|
||||||
CurrEnergy float32 // 当前元素能量值
|
CurrEnergy float64 // 当前元素能量值
|
||||||
FetterList []uint32 // 资料解锁条目
|
FetterList []uint32 // 资料解锁条目
|
||||||
SkillLevelMap map[uint32]uint32 // 技能等级数据
|
SkillLevelMap map[uint32]uint32 // 技能等级数据
|
||||||
SkillDepotId uint32 // 技能库id
|
SkillDepotId uint32 // 技能库id
|
||||||
@@ -85,7 +85,7 @@ func (a *DbAvatar) InitAvatarFightProp(avatar *Avatar) {
|
|||||||
avatar.FightPropMap[constant.FIGHT_PROP_CUR_DEFENSE] = avatarDataConfig.GetBaseDefenseByLevel(avatar.Level)
|
avatar.FightPropMap[constant.FIGHT_PROP_CUR_DEFENSE] = avatarDataConfig.GetBaseDefenseByLevel(avatar.Level)
|
||||||
avatar.FightPropMap[constant.FIGHT_PROP_MAX_HP] = avatarDataConfig.GetBaseHpByLevel(avatar.Level)
|
avatar.FightPropMap[constant.FIGHT_PROP_MAX_HP] = avatarDataConfig.GetBaseHpByLevel(avatar.Level)
|
||||||
// 当前血量
|
// 当前血量
|
||||||
avatar.FightPropMap[constant.FIGHT_PROP_CUR_HP] = avatar.CurrHP
|
avatar.FightPropMap[constant.FIGHT_PROP_CUR_HP] = float32(avatar.CurrHP)
|
||||||
// 双暴
|
// 双暴
|
||||||
avatar.FightPropMap[constant.FIGHT_PROP_CRITICAL] = avatarDataConfig.Critical
|
avatar.FightPropMap[constant.FIGHT_PROP_CRITICAL] = avatarDataConfig.Critical
|
||||||
avatar.FightPropMap[constant.FIGHT_PROP_CRITICAL_HURT] = avatarDataConfig.CriticalHurt
|
avatar.FightPropMap[constant.FIGHT_PROP_CRITICAL_HURT] = avatarDataConfig.CriticalHurt
|
||||||
@@ -147,7 +147,7 @@ func (a *DbAvatar) AddAvatar(player *Player, avatarId uint32) {
|
|||||||
// 小技能1级
|
// 小技能1级
|
||||||
avatar.SkillLevelMap[uint32(skillId)] = 1
|
avatar.SkillLevelMap[uint32(skillId)] = 1
|
||||||
}
|
}
|
||||||
avatar.CurrHP = avatarDataConfig.GetBaseHpByLevel(avatar.Level)
|
avatar.CurrHP = float64(avatarDataConfig.GetBaseHpByLevel(avatar.Level))
|
||||||
|
|
||||||
// 角色突破奖励领取状态
|
// 角色突破奖励领取状态
|
||||||
for promoteLevel := range avatarDataConfig.PromoteRewardMap {
|
for promoteLevel := range avatarDataConfig.PromoteRewardMap {
|
||||||
@@ -158,7 +158,7 @@ func (a *DbAvatar) AddAvatar(player *Player, avatarId uint32) {
|
|||||||
a.AvatarMap[avatarId] = avatar
|
a.AvatarMap[avatarId] = avatar
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *DbAvatar) SetCurrEnergy(avatar *Avatar, value float32, max bool) {
|
func (a *DbAvatar) SetCurrEnergy(avatar *Avatar, value float64, max bool) {
|
||||||
var avatarSkillDataConfig *gdconf.AvatarSkillData = nil
|
var avatarSkillDataConfig *gdconf.AvatarSkillData = nil
|
||||||
if avatar.AvatarId == 10000005 || avatar.AvatarId == 10000007 {
|
if avatar.AvatarId == 10000005 || avatar.AvatarId == 10000007 {
|
||||||
avatarSkillDepotDataConfig := gdconf.GetAvatarSkillDepotDataById(int32(avatar.SkillDepotId))
|
avatarSkillDepotDataConfig := gdconf.GetAvatarSkillDepotDataById(int32(avatar.SkillDepotId))
|
||||||
@@ -185,7 +185,7 @@ func (a *DbAvatar) SetCurrEnergy(avatar *Avatar, value float32, max bool) {
|
|||||||
if max {
|
if max {
|
||||||
avatar.FightPropMap[uint32(elementType.CurrEnergyProp)] = float32(avatarSkillDataConfig.CostElemVal)
|
avatar.FightPropMap[uint32(elementType.CurrEnergyProp)] = float32(avatarSkillDataConfig.CostElemVal)
|
||||||
} else {
|
} else {
|
||||||
avatar.FightPropMap[uint32(elementType.CurrEnergyProp)] = value
|
avatar.FightPropMap[uint32(elementType.CurrEnergyProp)] = float32(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
package model
|
package model
|
||||||
|
|
||||||
|
type DbGacha struct {
|
||||||
|
GachaPoolInfo map[uint32]*GachaPoolInfo
|
||||||
|
}
|
||||||
|
|
||||||
type GachaPoolInfo struct {
|
type GachaPoolInfo struct {
|
||||||
GachaType uint32 // 卡池类型
|
GachaType uint32 // 卡池类型
|
||||||
OrangeTimes uint32 // 5星保底计数
|
OrangeTimes uint32 // 5星保底计数
|
||||||
@@ -8,10 +12,6 @@ type GachaPoolInfo struct {
|
|||||||
MustGetUpPurple bool // 是否4星大保底
|
MustGetUpPurple bool // 是否4星大保底
|
||||||
}
|
}
|
||||||
|
|
||||||
type DbGacha struct {
|
|
||||||
GachaPoolInfo map[uint32]*GachaPoolInfo
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *Player) GetDbGacha() *DbGacha {
|
func (p *Player) GetDbGacha() *DbGacha {
|
||||||
if p.DbGacha == nil {
|
if p.DbGacha == nil {
|
||||||
p.DbGacha = NewDbGacha()
|
p.DbGacha = NewDbGacha()
|
||||||
|
|||||||
72
gs/model/db_world.go
Normal file
72
gs/model/db_world.go
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"hk4e/gdconf"
|
||||||
|
)
|
||||||
|
|
||||||
|
type DbScene struct {
|
||||||
|
SceneId uint32
|
||||||
|
UnlockPointMap map[uint32]bool
|
||||||
|
}
|
||||||
|
|
||||||
|
type DbWorld struct {
|
||||||
|
SceneMap map[uint32]*DbScene
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *Player) GetDbWorld() *DbWorld {
|
||||||
|
if p.DbWorld == nil {
|
||||||
|
p.DbWorld = NewDbWorld()
|
||||||
|
}
|
||||||
|
return p.DbWorld
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewDbWorld() *DbWorld {
|
||||||
|
r := &DbWorld{
|
||||||
|
SceneMap: make(map[uint32]*DbScene),
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewScene(sceneId uint32) *DbScene {
|
||||||
|
r := &DbScene{
|
||||||
|
SceneId: sceneId,
|
||||||
|
UnlockPointMap: make(map[uint32]bool),
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *DbWorld) GetSceneById(sceneId uint32) *DbScene {
|
||||||
|
scene, exist := w.SceneMap[sceneId]
|
||||||
|
// 不存在自动创建场景
|
||||||
|
if !exist {
|
||||||
|
// 拒绝创建配置表中不存在的非法场景
|
||||||
|
sceneDataConfig := gdconf.GetSceneDataById(int32(sceneId))
|
||||||
|
if sceneDataConfig == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
scene = NewScene(sceneId)
|
||||||
|
w.SceneMap[sceneId] = scene
|
||||||
|
}
|
||||||
|
return scene
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *DbScene) GetUnlockPointList() []uint32 {
|
||||||
|
unlockPointList := make([]uint32, 0)
|
||||||
|
for pointId := range s.UnlockPointMap {
|
||||||
|
unlockPointList = append(unlockPointList, pointId)
|
||||||
|
}
|
||||||
|
return unlockPointList
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *DbScene) UnlockPoint(pointId uint32) {
|
||||||
|
pointDataConfig := gdconf.GetScenePointBySceneIdAndPointId(int32(s.SceneId), int32(pointId))
|
||||||
|
if pointDataConfig == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
s.UnlockPointMap[pointId] = true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *DbScene) CheckPointUnlock(pointId uint32) bool {
|
||||||
|
_, exist := s.UnlockPointMap[pointId]
|
||||||
|
return exist
|
||||||
|
}
|
||||||
@@ -53,6 +53,7 @@ type Player struct {
|
|||||||
DbAvatar *DbAvatar // 角色
|
DbAvatar *DbAvatar // 角色
|
||||||
DbGacha *DbGacha // 卡池
|
DbGacha *DbGacha // 卡池
|
||||||
DbQuest *DbQuest // 任务
|
DbQuest *DbQuest // 任务
|
||||||
|
DbWorld *DbWorld // 大世界
|
||||||
// 在线数据 请随意 记得加忽略字段的tag
|
// 在线数据 请随意 记得加忽略字段的tag
|
||||||
LastSaveTime uint32 `bson:"-" msgpack:"-"` // 上一次保存时间
|
LastSaveTime uint32 `bson:"-" msgpack:"-"` // 上一次保存时间
|
||||||
EnterSceneToken uint32 `bson:"-" msgpack:"-"` // 世界进入令牌
|
EnterSceneToken uint32 `bson:"-" msgpack:"-"` // 世界进入令牌
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
package cmd
|
|
||||||
|
|
||||||
const (
|
|
||||||
GCGDSBanCardNotify uint16 = 65501
|
|
||||||
)
|
|
||||||
@@ -68,8 +68,9 @@ func (c *CmdProtoMap) registerAllMessage() {
|
|||||||
c.registerMessage(EnterWorldAreaRsp, &proto.EnterWorldAreaRsp{}) // 进入世界区域响应
|
c.registerMessage(EnterWorldAreaRsp, &proto.EnterWorldAreaRsp{}) // 进入世界区域响应
|
||||||
c.registerMessage(SceneTransToPointReq, &proto.SceneTransToPointReq{}) // 场景传送点传送请求
|
c.registerMessage(SceneTransToPointReq, &proto.SceneTransToPointReq{}) // 场景传送点传送请求
|
||||||
c.registerMessage(SceneTransToPointRsp, &proto.SceneTransToPointRsp{}) // 场景传送点传送响应
|
c.registerMessage(SceneTransToPointRsp, &proto.SceneTransToPointRsp{}) // 场景传送点传送响应
|
||||||
c.registerMessage(PathfindingEnterSceneReq, &proto.PathfindingEnterSceneReq{}) // 寻路进入场景请求
|
c.registerMessage(UnlockTransPointReq, &proto.UnlockTransPointReq{}) // 解锁场景传送点请求
|
||||||
c.registerMessage(PathfindingEnterSceneRsp, &proto.PathfindingEnterSceneRsp{}) // 寻路进入场景响应
|
c.registerMessage(UnlockTransPointRsp, &proto.UnlockTransPointRsp{}) // 解锁场景传送点响应
|
||||||
|
c.registerMessage(ScenePointUnlockNotify, &proto.ScenePointUnlockNotify{}) // 场景传送点解锁通知
|
||||||
c.registerMessage(QueryPathReq, &proto.QueryPathReq{}) // 寻路请求
|
c.registerMessage(QueryPathReq, &proto.QueryPathReq{}) // 寻路请求
|
||||||
c.registerMessage(QueryPathRsp, &proto.QueryPathRsp{}) // 寻路响应
|
c.registerMessage(QueryPathRsp, &proto.QueryPathRsp{}) // 寻路响应
|
||||||
c.registerMessage(GetScenePointReq, &proto.GetScenePointReq{}) // 获取场景传送点请求
|
c.registerMessage(GetScenePointReq, &proto.GetScenePointReq{}) // 获取场景传送点请求
|
||||||
@@ -95,8 +96,10 @@ func (c *CmdProtoMap) registerAllMessage() {
|
|||||||
c.registerMessage(WorldDataNotify, &proto.WorldDataNotify{}) // 世界数据通知 世界等级、是否多人世界等
|
c.registerMessage(WorldDataNotify, &proto.WorldDataNotify{}) // 世界数据通知 世界等级、是否多人世界等
|
||||||
c.registerMessage(WorldPlayerInfoNotify, &proto.WorldPlayerInfoNotify{}) // 世界玩家信息通知
|
c.registerMessage(WorldPlayerInfoNotify, &proto.WorldPlayerInfoNotify{}) // 世界玩家信息通知
|
||||||
c.registerMessage(HostPlayerNotify, &proto.HostPlayerNotify{}) // 世界房主玩家信息通知
|
c.registerMessage(HostPlayerNotify, &proto.HostPlayerNotify{}) // 世界房主玩家信息通知
|
||||||
c.registerMessage(ToTheMoonEnterSceneReq, &proto.ToTheMoonEnterSceneReq{}) // 进入场景请求
|
c.registerMessage(PathfindingEnterSceneReq, &proto.PathfindingEnterSceneReq{}) // 寻路服务器进入场景请求
|
||||||
c.registerMessage(ToTheMoonEnterSceneRsp, &proto.ToTheMoonEnterSceneRsp{}) // 进入场景响应
|
c.registerMessage(PathfindingEnterSceneRsp, &proto.PathfindingEnterSceneRsp{}) // 寻路服务器进入场景响应
|
||||||
|
c.registerMessage(ToTheMoonEnterSceneReq, &proto.ToTheMoonEnterSceneReq{}) // 寻路服务器进入场景请求
|
||||||
|
c.registerMessage(ToTheMoonEnterSceneRsp, &proto.ToTheMoonEnterSceneRsp{}) // 寻路服务器进入场景响应
|
||||||
c.registerMessage(SetEntityClientDataNotify, &proto.SetEntityClientDataNotify{}) // 通知
|
c.registerMessage(SetEntityClientDataNotify, &proto.SetEntityClientDataNotify{}) // 通知
|
||||||
c.registerMessage(LeaveWorldNotify, &proto.LeaveWorldNotify{}) // 删除客户端世界通知
|
c.registerMessage(LeaveWorldNotify, &proto.LeaveWorldNotify{}) // 删除客户端世界通知
|
||||||
c.registerMessage(SceneAvatarStaminaStepReq, &proto.SceneAvatarStaminaStepReq{}) // 缓慢游泳或缓慢攀爬时消耗耐力请求
|
c.registerMessage(SceneAvatarStaminaStepReq, &proto.SceneAvatarStaminaStepReq{}) // 缓慢游泳或缓慢攀爬时消耗耐力请求
|
||||||
@@ -278,9 +281,9 @@ func (c *CmdProtoMap) registerAllMessage() {
|
|||||||
c.registerMessage(VehicleStaminaNotify, &proto.VehicleStaminaNotify{}) // 载具耐力消耗通知
|
c.registerMessage(VehicleStaminaNotify, &proto.VehicleStaminaNotify{}) // 载具耐力消耗通知
|
||||||
|
|
||||||
// 七圣召唤
|
// 七圣召唤
|
||||||
c.registerMessage(GCGBasicDataNotify, &proto.GCGBasicDataNotify{}) // GCG基本数据通知
|
c.registerMessage(GCGBasicDataNotify, &proto.GCGBasicDataNotify{}) // GCG基本数据通知
|
||||||
c.registerMessage(GCGLevelChallengeNotify, &proto.GCGLevelChallengeNotify{}) // GCG等级挑战通知
|
c.registerMessage(GCGLevelChallengeNotify, &proto.GCGLevelChallengeNotify{}) // GCG等级挑战通知
|
||||||
c.registerMessage(GCGDSBanCardNotify, &proto.GCGDSBanCardNotify{}) // GCG禁止的卡牌通知
|
// c.registerMessage(GCGDSBanCardNotify, &proto.GCGDSBanCardNotify{}) // GCG禁止的卡牌通知
|
||||||
c.registerMessage(GCGDSDataNotify, &proto.GCGDSDataNotify{}) // GCG数据通知 (解锁的内容)
|
c.registerMessage(GCGDSDataNotify, &proto.GCGDSDataNotify{}) // GCG数据通知 (解锁的内容)
|
||||||
c.registerMessage(GCGTCTavernChallengeDataNotify, &proto.GCGTCTavernChallengeDataNotify{}) // GCG酒馆挑战数据通知
|
c.registerMessage(GCGTCTavernChallengeDataNotify, &proto.GCGTCTavernChallengeDataNotify{}) // GCG酒馆挑战数据通知
|
||||||
c.registerMessage(GCGTCTavernInfoNotify, &proto.GCGTCTavernInfoNotify{}) // GCG酒馆信息通知
|
c.registerMessage(GCGTCTavernInfoNotify, &proto.GCGTCTavernInfoNotify{}) // GCG酒馆信息通知
|
||||||
|
|||||||
Reference in New Issue
Block a user