Core/Objects: SetZoneScript will now use map zone coordinates instead of using the cached zone id

This commit is contained in:
Ovahlord
2019-02-25 00:39:28 +01:00
parent 0c358c9a0b
commit 4474655779
2 changed files with 6 additions and 4 deletions

View File

@@ -1047,6 +1047,8 @@ bool Creature::Create(ObjectGuid::LowType guidlow, Map* map, uint32 /*phaseMask*
//! Need to be called after LoadCreaturesAddon - MOVEMENTFLAG_HOVER is set there
m_positionZ += GetHoverOffset();
UpdatePositionData();
LastUsedScriptID = GetScriptId();
if (IsSpiritHealer() || IsSpiritGuide() || (GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_GHOST_VISIBILITY))
@@ -1064,8 +1066,6 @@ bool Creature::Create(ObjectGuid::LowType guidlow, Map* map, uint32 /*phaseMask*
ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK_DEST, true);
}
UpdatePositionData();
return true;
}

View File

@@ -2168,10 +2168,12 @@ void WorldObject::SetZoneScript()
m_zoneScript = (ZoneScript*)((InstanceMap*)map)->GetInstanceScript();
else if (!map->IsBattlegroundOrArena())
{
if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId()))
uint32 zoneId = GetMap()->GetZoneId(GetPhaseShift(), GetPosition());
if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(zoneId))
m_zoneScript = bf;
else
m_zoneScript = sOutdoorPvPMgr->GetZoneScript(GetZoneId());
m_zoneScript = sOutdoorPvPMgr->GetZoneScript(zoneId);
}
}
}