mirror of
https://github.com/FlourishingWorld/hk4e.git
synced 2026-03-01 00:35:36 +08:00
修复开场任务
This commit is contained in:
@@ -17,7 +17,7 @@ import (
|
||||
func (g *GameManager) GetAllAvatarDataConfig() map[int32]*gdconf.AvatarData {
|
||||
allAvatarDataConfig := make(map[int32]*gdconf.AvatarData)
|
||||
for avatarId, avatarData := range gdconf.GetAvatarDataMap() {
|
||||
if avatarId < 10000002 || avatarId >= 11000000 {
|
||||
if avatarId <= 10000001 || avatarId >= 11000000 {
|
||||
// 跳过无效角色
|
||||
continue
|
||||
}
|
||||
@@ -25,10 +25,6 @@ func (g *GameManager) GetAllAvatarDataConfig() map[int32]*gdconf.AvatarData {
|
||||
// 跳过主角
|
||||
continue
|
||||
}
|
||||
if avatarId >= 10000079 {
|
||||
// 跳过后续版本的角色
|
||||
continue
|
||||
}
|
||||
allAvatarDataConfig[avatarId] = avatarData
|
||||
}
|
||||
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.AddSceneEntityNotify(player, proto.VisionType_VISION_MEET, addEntityIdList, false, false)
|
||||
// 场景区域触发器
|
||||
dbQuest := player.GetDbQuest()
|
||||
updateQuest := false
|
||||
for _, group := range newVisionGroupMap {
|
||||
for _, region := range group.RegionList {
|
||||
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)
|
||||
}
|
||||
}
|
||||
updateQuest = g.TriggerFire(dbQuest, trigger)
|
||||
g.TriggerFire(player, trigger)
|
||||
}
|
||||
} else if oldPosInRegion && !newPosInRegion {
|
||||
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 {
|
||||
// TODO 这一块写得太炸裂了需要优化
|
||||
updateQuest := false
|
||||
func (g *GameManager) TriggerFire(player *model.Player, trigger *gdconf.Trigger) {
|
||||
for _, triggerDataConfig := range gdconf.GetTriggerDataMap() {
|
||||
if triggerDataConfig.TriggerName == trigger.Name {
|
||||
for _, quest := range dbQuest.GetQuestMap() {
|
||||
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
|
||||
}
|
||||
}
|
||||
g.TriggerQuest(player, constant.QUEST_FINISH_COND_TYPE_TRIGGER_FIRE, triggerDataConfig.TriggerId)
|
||||
}
|
||||
}
|
||||
return updateQuest
|
||||
}
|
||||
|
||||
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)
|
||||
world := WORLD_MANAGER.GetWorldByID(player.WorldId)
|
||||
if world == nil {
|
||||
logger.Error("world is nil, WorldId: %v", player.WorldId)
|
||||
return
|
||||
}
|
||||
scene := world.GetSceneById(player.SceneId)
|
||||
if scene == nil {
|
||||
logger.Error("scene is nil, sceneId: %v", player.SceneId)
|
||||
if req.InitPos == nil {
|
||||
return
|
||||
}
|
||||
scene.CreateEntityGadgetClient(&model.Vector{
|
||||
|
||||
@@ -24,25 +24,6 @@ func (g *GameManager) GetAllItemDataConfig() map[int32]*gdconf.ItemData {
|
||||
// 排除圣遗物
|
||||
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
|
||||
}
|
||||
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))
|
||||
return
|
||||
}
|
||||
SELF = player
|
||||
|
||||
player.OnlineTime = uint32(time.Now().UnixMilli())
|
||||
player.Online = true
|
||||
@@ -80,6 +81,9 @@ func (g *GameManager) OnLoginOk(userId uint32, player *model.Player, clientSeq u
|
||||
return
|
||||
}
|
||||
|
||||
// TODO DEBUG DEL
|
||||
g.AcceptQuest(player, false)
|
||||
|
||||
g.LoginNotify(userId, player, clientSeq)
|
||||
|
||||
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)
|
||||
|
||||
atomic.AddInt32(&ONLINE_PLAYER_NUM, 1)
|
||||
|
||||
SELF = nil
|
||||
}
|
||||
|
||||
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 {
|
||||
continue
|
||||
}
|
||||
canAccept := true
|
||||
acceptCondResultList := make([]bool, 0)
|
||||
for _, acceptCond := range questData.AcceptCondList {
|
||||
result := false
|
||||
switch acceptCond.Type {
|
||||
case constant.QUEST_ACCEPT_COND_TYPE_STATE_EQUAL:
|
||||
// 某个任务状态等于 参数1:任务id 参数2:任务状态
|
||||
if len(acceptCond.Param) != 2 {
|
||||
logger.Error("quest accept cond config format error, questId: %v", questData.QuestId)
|
||||
canAccept = false
|
||||
break
|
||||
}
|
||||
quest := dbQuest.GetQuestById(uint32(acceptCond.Param[0]))
|
||||
if quest == nil {
|
||||
canAccept = false
|
||||
break
|
||||
}
|
||||
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
|
||||
break
|
||||
}
|
||||
default:
|
||||
canAccept = false
|
||||
break
|
||||
}
|
||||
case constant.QUEST_LOGIC_TYPE_OR:
|
||||
canAccept = false
|
||||
for _, acceptCondResult := range acceptCondResultList {
|
||||
if acceptCondResult {
|
||||
canAccept = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
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 打包一个任务
|
||||
func (g *GameManager) PacketQuest(player *model.Player, questId uint32) *proto.Quest {
|
||||
dbQuest := player.GetDbQuest()
|
||||
|
||||
@@ -15,12 +15,6 @@ func (g *GameManager) GetAllReliquaryDataConfig() map[int32]*gdconf.ItemData {
|
||||
if itemData.Type != constant.ITEM_TYPE_RELIQUARY {
|
||||
continue
|
||||
}
|
||||
if (itemId >= 20002 && itemId <= 20004) ||
|
||||
itemId == 23334 ||
|
||||
(itemId >= 23300 && itemId <= 23340) {
|
||||
// 跳过无效圣遗物
|
||||
continue
|
||||
}
|
||||
allReliquaryDataConfig[itemId] = itemData
|
||||
}
|
||||
return allReliquaryDataConfig
|
||||
|
||||
@@ -20,24 +20,6 @@ func (g *GameManager) GetAllWeaponDataConfig() map[int32]*gdconf.ItemData {
|
||||
if itemData.Type != constant.ITEM_TYPE_WEAPON {
|
||||
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
|
||||
}
|
||||
return allWeaponDataConfig
|
||||
|
||||
@@ -3,6 +3,7 @@ package game
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"hk4e/common/constant"
|
||||
"hk4e/gdconf"
|
||||
"hk4e/gs/model"
|
||||
"hk4e/pkg/logger"
|
||||
@@ -15,12 +16,22 @@ import (
|
||||
func (g *GameManager) SceneTransToPointReq(player *model.Player, payloadMsg pb.Message) {
|
||||
req := payloadMsg.(*proto.SceneTransToPointReq)
|
||||
|
||||
pointDataConfig := gdconf.GetScenePointBySceneIdAndPointId(int32(req.SceneId), int32(req.PointId))
|
||||
if pointDataConfig == nil {
|
||||
g.SendError(cmd.SceneTransToPointRsp, player, &proto.SceneTransToPointRsp{})
|
||||
dbWorld := player.GetDbWorld()
|
||||
dbScene := dbWorld.GetSceneById(req.SceneId)
|
||||
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
|
||||
}
|
||||
|
||||
// 传送玩家
|
||||
sceneId := req.SceneId
|
||||
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)
|
||||
}
|
||||
|
||||
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) {
|
||||
req := payloadMsg.(*proto.MarkMapReq)
|
||||
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 传送玩家至地图上的某个位置
|
||||
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)
|
||||
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.TowerAllDataReq, GAME_MANAGER.TowerAllDataReq)
|
||||
r.registerRouter(cmd.SceneTransToPointReq, GAME_MANAGER.SceneTransToPointReq)
|
||||
r.registerRouter(cmd.UnlockTransPointReq, GAME_MANAGER.UnlockTransPointReq)
|
||||
r.registerRouter(cmd.MarkMapReq, GAME_MANAGER.MarkMapReq)
|
||||
r.registerRouter(cmd.ChangeAvatarReq, GAME_MANAGER.ChangeAvatarReq)
|
||||
r.registerRouter(cmd.SetUpAvatarTeamReq, GAME_MANAGER.SetUpAvatarTeamReq)
|
||||
|
||||
Reference in New Issue
Block a user