mirror of
https://github.com/FlourishingWorld/hk4e.git
synced 2026-02-04 14:22:26 +08:00
修复任务接取
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 任务开始执行触发操作
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user