mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 10:37:02 +00:00
[12210] Improve ObjectMgr::GetGoBackTrigger to get back to a trigger that actually ports into the map that could not be entered
This commit is contained in:
parent
832f9b1a46
commit
9690f8d80d
3 changed files with 23 additions and 5 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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<AreaTrigger const*> 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<AreaTrigger const*>::const_iterator itr = ghostTrigger.begin(); itr != ghostTrigger.end(); ++itr)
|
||||
{
|
||||
if (!compareTrigger || (*itr)->IsLessOrEqualThan(compareTrigger))
|
||||
{
|
||||
if ((*itr)->IsMinimal())
|
||||
return *itr;
|
||||
|
||||
compareTrigger = *itr;
|
||||
}
|
||||
}
|
||||
return compareTrigger;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "12209"
|
||||
#define REVISION_NR "12210"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue