mirror of
https://github.com/FlourishingWorld/hk4e.git
synced 2026-02-12 12:52:27 +08:00
实现主线任务[异常的权柄]
This commit is contained in:
@@ -42,16 +42,8 @@ func (g *Game) SceneRegionTriggerCheck(player *model.Player, scene *Scene, oldPo
|
||||
shape.NewPolygon(&alg.Vector3{X: regionConfig.Pos.X, Y: regionConfig.Pos.Y, Z: regionConfig.Pos.Z},
|
||||
vector2PointArray, regionConfig.Height)
|
||||
}
|
||||
oldPosInRegion := shape.Contain(&alg.Vector3{
|
||||
X: float32(oldPos.X),
|
||||
Y: float32(oldPos.Y),
|
||||
Z: float32(oldPos.Z),
|
||||
})
|
||||
newPosInRegion := shape.Contain(&alg.Vector3{
|
||||
X: float32(newPos.X),
|
||||
Y: float32(newPos.Y),
|
||||
Z: float32(newPos.Z),
|
||||
})
|
||||
oldPosInRegion := shape.Contain(&alg.Vector3{X: float32(oldPos.X), Y: float32(oldPos.Y), Z: float32(oldPos.Z)})
|
||||
newPosInRegion := shape.Contain(&alg.Vector3{X: float32(newPos.X), Y: float32(newPos.Y), Z: float32(newPos.Z)})
|
||||
if !oldPosInRegion && newPosInRegion {
|
||||
logger.Debug("player enter region: %v, uid: %v", regionConfig, player.PlayerID)
|
||||
for _, triggerName := range suiteConfig.TriggerNameList {
|
||||
@@ -150,3 +142,46 @@ func (g *Game) MonsterDieTriggerCheck(player *model.Player, groupId uint32, grou
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// QuestStartTriggerCheck 任务开始触发器检测
|
||||
func (g *Game) QuestStartTriggerCheck(player *model.Player, questId uint32) {
|
||||
world := WORLD_MANAGER.GetWorldByID(player.WorldId)
|
||||
if world == nil {
|
||||
return
|
||||
}
|
||||
scene := world.GetSceneById(player.SceneId)
|
||||
for groupId, group := range scene.GetAllGroup() {
|
||||
groupConfig := gdconf.GetSceneGroup(int32(groupId))
|
||||
if groupConfig == nil {
|
||||
logger.Error("get group config is nil, groupId: %v, uid: %v", groupId, player.PlayerID)
|
||||
continue
|
||||
}
|
||||
for suiteId := range group.GetAllSuite() {
|
||||
suiteConfig := groupConfig.SuiteList[suiteId-1]
|
||||
for _, triggerName := range suiteConfig.TriggerNameList {
|
||||
triggerConfig := groupConfig.TriggerMap[triggerName]
|
||||
if triggerConfig.Event != constant.LUA_EVENT_QUEST_START {
|
||||
continue
|
||||
}
|
||||
if triggerConfig.Condition != "" {
|
||||
cond := CallLuaFunc(groupConfig.GetLuaState(), triggerConfig.Condition,
|
||||
&LuaCtx{uid: player.PlayerID},
|
||||
&LuaEvt{param1: int32(questId)})
|
||||
if !cond {
|
||||
continue
|
||||
}
|
||||
}
|
||||
logger.Debug("scene group trigger fire, trigger: %+v, uid: %v", triggerConfig, player.PlayerID)
|
||||
if triggerConfig.Action != "" {
|
||||
logger.Debug("scene group trigger do action, trigger: %+v, uid: %v", triggerConfig, player.PlayerID)
|
||||
ok := CallLuaFunc(groupConfig.GetLuaState(), triggerConfig.Action,
|
||||
&LuaCtx{uid: player.PlayerID, groupId: groupId},
|
||||
&LuaEvt{})
|
||||
if !ok {
|
||||
logger.Error("trigger action fail, trigger: %+v, uid: %v", triggerConfig, player.PlayerID)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user