Core/Phases: Removed more of the old phasemasks
This commit is contained in:
1 parent
402b9b055c
commit
bbe51bbd13
8 files changed
+17
-83
No files matched your search
@@ -14576,63 +14576,6 @@ void Unit::SetInPhase(uint32 id, bool update, bool apply)
|
||||
summon->SetInPhase(id, true, apply);
|
||||
}
|
||||
|
||||
void Unit::SetPhaseMask(uint32 newPhaseMask, bool update)
|
||||
{
|
||||
if (newPhaseMask == GetPhaseMask())
|
||||
return;
|
||||
|
||||
if (IsInWorld())
|
||||
{
|
||||
RemoveNotOwnSingleTargetAuras(newPhaseMask); // we can lost access to caster or target
|
||||
|
||||
// modify hostile references for new phasemask, some special cases deal with hostile references themselves
|
||||
if (GetTypeId() == TYPEID_UNIT || (!ToPlayer()->IsGameMaster() && !ToPlayer()->GetSession()->PlayerLogout()))
|
||||
{
|
||||
HostileRefManager& refManager = getHostileRefManager();
|
||||
HostileReference* ref = refManager.getFirst();
|
||||
|
||||
while (ref)
|
||||
{
|
||||
if (Unit* unit = ref->GetSource()->GetOwner())
|
||||
if (Creature* creature = unit->ToCreature())
|
||||
refManager.setOnlineOfflineState(creature, creature->InSamePhase(newPhaseMask));
|
||||
|
||||
ref = ref->next();
|
||||
}
|
||||
|
||||
// modify threat lists for new phasemask
|
||||
if (GetTypeId() != TYPEID_PLAYER)
|
||||
{
|
||||
std::list<HostileReference*> threatList = getThreatManager().getThreatList();
|
||||
std::list<HostileReference*> offlineThreatList = getThreatManager().getOfflineThreatList();
|
||||
|
||||
// merge expects sorted lists
|
||||
threatList.sort();
|
||||
offlineThreatList.sort();
|
||||
threatList.merge(offlineThreatList);
|
||||
|
||||
for (std::list<HostileReference*>::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
|
||||
if (Unit* unit = (*itr)->getTarget())
|
||||
unit->getHostileRefManager().setOnlineOfflineState(ToCreature(), unit->InSamePhase(newPhaseMask));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WorldObject::SetPhaseMask(newPhaseMask, update);
|
||||
|
||||
if (!IsInWorld())
|
||||
return;
|
||||
|
||||
for (ControlList::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
|
||||
if ((*itr)->GetTypeId() == TYPEID_UNIT)
|
||||
(*itr)->SetPhaseMask(newPhaseMask, true);
|
||||
|
||||
for (uint8 i = 0; i < MAX_SUMMON_SLOT; ++i)
|
||||
if (m_SummonSlot[i])
|
||||
if (Creature* summon = GetMap()->GetCreature(m_SummonSlot[i]))
|
||||
summon->SetPhaseMask(newPhaseMask, true);
|
||||
}
|
||||
|
||||
void Unit::UpdateObjectVisibility(bool forced)
|
||||
{
|
||||
if (!forced)
|
||||
|
||||
Reference in new issue
Block a user