任务系统优化
This commit is contained in:
1 parent
8c660281e7
commit
9a78027a83
11 files changed
+256
-172
No files matched your search
+27
-1
@@ -260,7 +260,7 @@ func (g *Game) GadgetCreateTriggerCheck(player *model.Player, group *Group, enti
|
||||
}
|
||||
|
||||
// GadgetStateChangeTriggerCheck 物件状态变更触发器检测
|
||||
func (g *Game) GadgetStateChangeTriggerCheck(player *model.Player, group *Group, entity IEntity, state uint8) {
|
||||
func (g *Game) GadgetStateChangeTriggerCheck(player *model.Player, group *Group, entity IEntity, state uint32) {
|
||||
forEachGroupTrigger(player, group, func(triggerConfig *gdconf.Trigger, groupConfig *gdconf.Group) {
|
||||
if triggerConfig.Event != constant.LUA_EVENT_GADGET_STATE_CHANGE {
|
||||
return
|
||||
@@ -367,3 +367,29 @@ func (g *Game) TimerEventTriggerCheck(player *model.Player, group *Group, source
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// SelectOptionTriggerCheck 操作台选择触发器检测
|
||||
func (g *Game) SelectOptionTriggerCheck(player *model.Player, group *Group, entity IEntity, option uint32) {
|
||||
forEachGroupTrigger(player, group, func(triggerConfig *gdconf.Trigger, groupConfig *gdconf.Group) {
|
||||
if triggerConfig.Event != constant.LUA_EVENT_SELECT_OPTION {
|
||||
return
|
||||
}
|
||||
if triggerConfig.Condition != "" {
|
||||
cond := CallSceneLuaFunc(groupConfig.GetLuaState(), triggerConfig.Condition,
|
||||
&LuaCtx{uid: player.PlayerId, groupId: uint32(groupConfig.Id)},
|
||||
&LuaEvt{param1: int32(entity.GetConfigId()), param2: int32(option)})
|
||||
if !cond {
|
||||
return
|
||||
}
|
||||
}
|
||||
if triggerConfig.Action != "" {
|
||||
logger.Debug("scene group trigger do action, trigger: %+v, uid: %v", triggerConfig, player.PlayerId)
|
||||
ok := CallSceneLuaFunc(groupConfig.GetLuaState(), triggerConfig.Action,
|
||||
&LuaCtx{uid: player.PlayerId, groupId: uint32(groupConfig.Id), targetEntityId: entity.GetId()},
|
||||
&LuaEvt{})
|
||||
if !ok {
|
||||
logger.Error("trigger action fail, trigger: %+v, uid: %v", triggerConfig, player.PlayerId)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user