mirror of
https://github.com/FlourishingWorld/hk4e.git
synced 2026-02-17 02:42:28 +08:00
新增任务触发条件
This commit is contained in:
@@ -79,7 +79,7 @@ func (g *Game) SceneRegionTriggerCheck(player *model.Player, scene *Scene, oldPo
|
|||||||
}
|
}
|
||||||
for _, triggerDataConfig := range gdconf.GetTriggerDataMap() {
|
for _, triggerDataConfig := range gdconf.GetTriggerDataMap() {
|
||||||
if triggerDataConfig.TriggerName == triggerConfig.Name {
|
if triggerDataConfig.TriggerName == triggerConfig.Name {
|
||||||
g.TriggerQuest(player, constant.QUEST_FINISH_COND_TYPE_TRIGGER_FIRE, triggerDataConfig.TriggerId)
|
g.TriggerQuest(player, constant.QUEST_FINISH_COND_TYPE_TRIGGER_FIRE, "", triggerDataConfig.TriggerId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -436,6 +436,7 @@ func (g *Game) EvtDoSkillSuccNotify(player *model.Player, payloadMsg pb.Message)
|
|||||||
logger.Debug("EvtDoSkillSuccNotify: %v", req)
|
logger.Debug("EvtDoSkillSuccNotify: %v", req)
|
||||||
// 处理技能开始的耐力消耗
|
// 处理技能开始的耐力消耗
|
||||||
g.SkillStartStamina(player, req.CasterId, req.SkillId)
|
g.SkillStartStamina(player, req.CasterId, req.SkillId)
|
||||||
|
g.TriggerQuest(player, constant.QUEST_FINISH_COND_TYPE_SKILL, "", int32(req.SkillId))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *Game) EvtAvatarEnterFocusNotify(player *model.Player, payloadMsg pb.Message) {
|
func (g *Game) EvtAvatarEnterFocusNotify(player *model.Player, payloadMsg pb.Message) {
|
||||||
|
|||||||
@@ -147,8 +147,20 @@ func (g *Game) AcceptQuest(player *model.Player, notifyClient bool) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func matchParamEqual(param1 []int32, param2 []int32, num int) bool {
|
||||||
|
if len(param1) != num || len(param2) != num {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
for i := 0; i < num; i++ {
|
||||||
|
if param1[i] != param2[i] {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
// TriggerQuest 触发任务
|
// TriggerQuest 触发任务
|
||||||
func (g *Game) TriggerQuest(player *model.Player, cond int32, param ...int32) {
|
func (g *Game) TriggerQuest(player *model.Player, cond int32, complexParam string, param ...int32) {
|
||||||
dbQuest := player.GetDbQuest()
|
dbQuest := player.GetDbQuest()
|
||||||
updateQuestIdList := make([]uint32, 0)
|
updateQuestIdList := make([]uint32, 0)
|
||||||
for _, quest := range dbQuest.GetQuestMap() {
|
for _, quest := range dbQuest.GetQuestMap() {
|
||||||
@@ -163,29 +175,31 @@ func (g *Game) TriggerQuest(player *model.Player, cond int32, param ...int32) {
|
|||||||
switch cond {
|
switch cond {
|
||||||
case constant.QUEST_FINISH_COND_TYPE_TRIGGER_FIRE:
|
case constant.QUEST_FINISH_COND_TYPE_TRIGGER_FIRE:
|
||||||
// 场景触发器跳了 参数1:触发器id
|
// 场景触发器跳了 参数1:触发器id
|
||||||
if len(questCond.Param) != 1 {
|
ok := matchParamEqual(questCond.Param, param, 1)
|
||||||
continue
|
if !ok {
|
||||||
}
|
|
||||||
if len(param) != 1 {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if questCond.Param[0] != param[0] {
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
dbQuest.ForceFinishQuest(quest.QuestId)
|
dbQuest.ForceFinishQuest(quest.QuestId)
|
||||||
updateQuestIdList = append(updateQuestIdList, quest.QuestId)
|
updateQuestIdList = append(updateQuestIdList, quest.QuestId)
|
||||||
case constant.QUEST_FINISH_COND_TYPE_UNLOCK_TRANS_POINT:
|
case constant.QUEST_FINISH_COND_TYPE_UNLOCK_TRANS_POINT:
|
||||||
// 解锁传送锚点 参数1:场景id 参数2:传送锚点id
|
// 解锁传送锚点 参数1:场景id 参数2:传送锚点id
|
||||||
if len(questCond.Param) != 2 {
|
ok := matchParamEqual(questCond.Param, param, 2)
|
||||||
|
if !ok {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if len(param) != 2 {
|
dbQuest.ForceFinishQuest(quest.QuestId)
|
||||||
|
updateQuestIdList = append(updateQuestIdList, quest.QuestId)
|
||||||
|
case constant.QUEST_FINISH_COND_TYPE_COMPLETE_TALK:
|
||||||
|
// 与NPC对话 参数1:对话id
|
||||||
|
ok := matchParamEqual(questCond.Param, param, 1)
|
||||||
|
if !ok {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if questCond.Param[0] != param[0] {
|
dbQuest.ForceFinishQuest(quest.QuestId)
|
||||||
continue
|
updateQuestIdList = append(updateQuestIdList, quest.QuestId)
|
||||||
}
|
case constant.QUEST_FINISH_COND_TYPE_LUA_NOTIFY:
|
||||||
if questCond.Param[1] != param[1] {
|
// LUA侧通知 复杂参数
|
||||||
|
if questCond.ComplexParam != complexParam {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
dbQuest.ForceFinishQuest(quest.QuestId)
|
dbQuest.ForceFinishQuest(quest.QuestId)
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ func (g *Game) UnlockTransPointReq(player *model.Player, payloadMsg pb.Message)
|
|||||||
}
|
}
|
||||||
dbScene.UnlockPoint(req.PointId)
|
dbScene.UnlockPoint(req.PointId)
|
||||||
|
|
||||||
g.TriggerQuest(player, constant.QUEST_FINISH_COND_TYPE_UNLOCK_TRANS_POINT, int32(req.SceneId), int32(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{
|
g.SendMsg(cmd.ScenePointUnlockNotify, player.PlayerID, player.ClientSeq, &proto.ScenePointUnlockNotify{
|
||||||
SceneId: req.SceneId,
|
SceneId: req.SceneId,
|
||||||
@@ -206,6 +206,7 @@ func (g *Game) ChangeGameTimeReq(player *model.Player, payloadMsg pb.Message) {
|
|||||||
|
|
||||||
func (g *Game) NpcTalkReq(player *model.Player, payloadMsg pb.Message) {
|
func (g *Game) NpcTalkReq(player *model.Player, payloadMsg pb.Message) {
|
||||||
req := payloadMsg.(*proto.NpcTalkReq)
|
req := payloadMsg.(*proto.NpcTalkReq)
|
||||||
|
g.TriggerQuest(player, constant.QUEST_FINISH_COND_TYPE_COMPLETE_TALK, "", int32(req.TalkId))
|
||||||
rsp := &proto.NpcTalkRsp{
|
rsp := &proto.NpcTalkRsp{
|
||||||
CurTalkId: req.TalkId,
|
CurTalkId: req.TalkId,
|
||||||
NpcEntityId: req.NpcEntityId,
|
NpcEntityId: req.NpcEntityId,
|
||||||
|
|||||||
Reference in New Issue
Block a user