diff --git a/doc/EventAI.txt b/doc/EventAI.txt index f1cbd540f..615441349 100644 --- a/doc/EventAI.txt +++ b/doc/EventAI.txt @@ -108,9 +108,9 @@ For all ACTION_T_RANDOM Actions, When a Particular Param is selected for the Eve 3 ACTION_T_MORPH_TO_ENTRY_OR_MODEL CreatureEntry, ModelId Sets either model from creature_template.entry (Param1) OR explicit modelId (Param2) for the NPC. If (Param1) AND (Param2) are both 0, NPC will demorph and revert to the default model (as specified in creature_template). 4 ACTION_T_SOUND SoundId NPC Plays a specified Sound ID. 5 ACTION_T_EMOTE EmoteId NPC Does a specified Emote ID. -6 UNUSED UNUSED UNUSED -7 UNUSED UNUSED UNUSED -8 UNUSED UNUSED UNUSED +6 UNUSED UNUSED UNUSED +7 UNUSED UNUSED UNUSED +8 UNUSED UNUSED UNUSED 9 ACTION_T_RANDOM_SOUND SoundId1, SoundId2, SoundId3 NPC Plays a Random Sound ID (Random Selects Param1, Param2 or Param3) * 10 ACTION_T_RANDOM_EMOTE EmoteId1, EmoteId2, EmoteId3 NPC Emotes a Random Emote ID (Random Selects Param1, Param2 or Param3) * 11 ACTION_T_CAST SpellId, Target, CastFlags Casts spell (Param1) on a target (Param2) using cast flags (Param3) --> Specified Below diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index ac1a57550..faa0b9a73 100755 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -5714,12 +5714,16 @@ AreaTrigger const* ObjectMgr::GetGoBackTrigger(uint32 map_id) const if (!mapEntry || mapEntry->ghost_entrance_map < 0) return NULL; + // Try to find one that teleports to the map we want to enter + std::list ghostTrigger; AreaTrigger const* compareTrigger = NULL; for (AreaTriggerMap::const_iterator itr = mAreaTriggers.begin(); itr != mAreaTriggers.end(); ++itr) { if (itr->second.target_mapId == uint32(mapEntry->ghost_entrance_map)) { - if (!compareTrigger || itr->second.IsLessOrEqualThan(compareTrigger)) + ghostTrigger.push_back(&itr->second); + // First run, only consider AreaTrigger that teleport in the proper map + if ((!compareTrigger || itr->second.IsLessOrEqualThan(compareTrigger)) && sAreaTriggerStore.LookupEntry(itr->first)->mapid == map_id) { if (itr->second.IsMinimal()) return &itr->second; @@ -5728,6 +5732,20 @@ AreaTrigger const* ObjectMgr::GetGoBackTrigger(uint32 map_id) const } } } + if (compareTrigger) + return compareTrigger; + + // Second attempt: take one fitting + for (std::list::const_iterator itr = ghostTrigger.begin(); itr != ghostTrigger.end(); ++itr) + { + if (!compareTrigger || (*itr)->IsLessOrEqualThan(compareTrigger)) + { + if ((*itr)->IsMinimal()) + return *itr; + + compareTrigger = *itr; + } + } return compareTrigger; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 044112a18..af4ddd023 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "12209" + #define REVISION_NR "12210" #endif // __REVISION_NR_H__