mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-07 15:28:02 +00:00
fix(Core/Combat): drop dangling current victim on phase change crash (#26020)
Co-authored-by: blinkysc <blinkysc@users.noreply.github.com>
This commit is contained in:
@@ -15321,30 +15321,10 @@ void Unit::SetPhaseMask(uint32 newPhaseMask, bool update)
|
||||
|
||||
if (!sScriptMgr->CanSetPhaseMask(this, newPhaseMask, update))
|
||||
return;
|
||||
|
||||
// Phase-related threat updates are done AFTER the phase change below
|
||||
}
|
||||
|
||||
WorldObject::SetPhaseMask(newPhaseMask, false);
|
||||
|
||||
// Now update threat online states with the new phase mask applied
|
||||
if (IsCreature() || (IsPlayer() && !ToPlayer()->IsGameMaster() && !ToPlayer()->GetSession()->PlayerLogout()))
|
||||
{
|
||||
// Update online state for units that have me on their threat list
|
||||
for (auto const& pair : GetThreatMgr().GetThreatenedByMeList())
|
||||
{
|
||||
if (ThreatReference* ref = pair.second)
|
||||
ref->UpdateOffline();
|
||||
}
|
||||
|
||||
// Update online state for units on my threat list
|
||||
if (!IsPlayer())
|
||||
{
|
||||
for (ThreatReference* ref : GetThreatMgr().GetModifiableThreatList())
|
||||
ref->UpdateOffline();
|
||||
}
|
||||
}
|
||||
|
||||
if (!IsInWorld())
|
||||
{
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user