From d8fcff624b6a7feb1ddec6b13c82279909e19074 Mon Sep 17 00:00:00 2001 From: flswld Date: Fri, 31 Mar 2023 16:39:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BB=BB=E5=8A=A1=E6=8E=A5?= =?UTF-8?q?=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gs/game/player_login.go | 2 ++ gs/game/player_quest.go | 32 ++++++++++++++++++-------------- gs/game/player_scene.go | 2 ++ 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/gs/game/player_login.go b/gs/game/player_login.go index c46f6885..e93b0616 100644 --- a/gs/game/player_login.go +++ b/gs/game/player_login.go @@ -116,6 +116,8 @@ func (g *Game) OnLoginOk(userId uint32, clientSeq uint32, gateAppId string, isRe TICK_MANAGER.CreateUserGlobalTick(userId) TICK_MANAGER.CreateUserTimer(userId, UserTimerActionTest, 100, player.NickName) + g.AcceptQuest(player, true) + atomic.AddInt32(&ONLINE_PLAYER_NUM, 1) SELF = nil diff --git a/gs/game/player_quest.go b/gs/game/player_quest.go index 8eee4447..1df43033 100644 --- a/gs/game/player_quest.go +++ b/gs/game/player_quest.go @@ -145,28 +145,32 @@ func (g *Game) AcceptQuest(player *model.Player, notifyClient bool) { ntf.QuestList = append(ntf.QuestList, pbQuest) } g.SendMsg(cmd.QuestListUpdateNotify, player.PlayerID, player.ClientSeq, ntf) - // TODO 判断任务是否能开始 - for _, questId := range addQuestIdList { - g.StartQuest(player, questId) - } + } + // TODO 判断任务是否能开始 + for _, questId := range addQuestIdList { + g.StartQuest(player, questId, notifyClient) } } // StartQuest 开始一个任务 -func (g *Game) StartQuest(player *model.Player, questId uint32) { +func (g *Game) StartQuest(player *model.Player, questId uint32, notifyClient bool) { dbQuest := player.GetDbQuest() dbQuest.StartQuest(questId) - ntf := &proto.QuestListUpdateNotify{ - QuestList: make([]*proto.Quest, 0), - } - pbQuest := g.PacketQuest(player, questId) - if pbQuest == nil { - return - } - ntf.QuestList = append(ntf.QuestList, pbQuest) - g.SendMsg(cmd.QuestListUpdateNotify, player.PlayerID, player.ClientSeq, ntf) + g.QuestExec(player, questId) g.QuestStartTriggerCheck(player, questId) + + if notifyClient { + ntf := &proto.QuestListUpdateNotify{ + QuestList: make([]*proto.Quest, 0), + } + pbQuest := g.PacketQuest(player, questId) + if pbQuest == nil { + return + } + ntf.QuestList = append(ntf.QuestList, pbQuest) + g.SendMsg(cmd.QuestListUpdateNotify, player.PlayerID, player.ClientSeq, ntf) + } } // QuestExec 任务开始执行触发操作 diff --git a/gs/game/player_scene.go b/gs/game/player_scene.go index 4d650801..3c78b25e 100644 --- a/gs/game/player_scene.go +++ b/gs/game/player_scene.go @@ -681,6 +681,8 @@ func (g *Game) RemoveSceneGroup(player *model.Player, scene *Scene, groupConfig g.SendMsg(cmd.GroupUnloadNotify, player.PlayerID, player.ClientSeq, ntf) } +// TODO Group和Suite的初始化和加载卸载逻辑还没完全理清 所以现在这里写得略答辩 + func (g *Game) AddSceneGroupSuite(player *model.Player, groupId uint32, suiteId uint8) { groupConfig := gdconf.GetSceneGroup(int32(groupId)) if groupConfig == nil {