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
@@ -2068,13 +2068,6 @@ void GameObject::SetInPhase(uint32 id, bool update, bool apply)
|
||||
EnableCollision(true);
|
||||
}
|
||||
|
||||
void GameObject::SetPhaseMask(uint32 newPhaseMask, bool update)
|
||||
{
|
||||
WorldObject::SetPhaseMask(newPhaseMask, update);
|
||||
if (m_model && m_model->isEnabled())
|
||||
EnableCollision(true);
|
||||
}
|
||||
|
||||
void GameObject::EnableCollision(bool enable)
|
||||
{
|
||||
if (!m_model)
|
||||
|
||||
@@ -726,7 +726,6 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map
|
||||
void SetGoAnimProgress(uint8 animprogress) { SetByteValue(GAMEOBJECT_BYTES_1, 3, animprogress); }
|
||||
static void SetGoArtKit(uint8 artkit, GameObject* go, uint32 lowguid = 0);
|
||||
|
||||
void SetPhaseMask(uint32 newPhaseMask, bool update);
|
||||
void SetInPhase(uint32 id, bool update, bool apply);
|
||||
void EnableCollision(bool enable);
|
||||
|
||||
|
||||
@@ -2329,13 +2329,9 @@ TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropert
|
||||
}
|
||||
}
|
||||
|
||||
uint32 phase = PHASEMASK_NORMAL;
|
||||
std::set<uint32> phases;
|
||||
if (summoner)
|
||||
{
|
||||
phase = summoner->GetPhaseMask();
|
||||
phases = summoner->GetPhases();
|
||||
}
|
||||
|
||||
TempSummon* summon = NULL;
|
||||
switch (mask)
|
||||
@@ -2357,7 +2353,7 @@ TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropert
|
||||
break;
|
||||
}
|
||||
|
||||
if (!summon->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), this, phase, entry, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), nullptr, vehId))
|
||||
if (!summon->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), this, 0, entry, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), nullptr, vehId))
|
||||
{
|
||||
delete summon;
|
||||
return NULL;
|
||||
|
||||
@@ -283,6 +283,15 @@ Creature* Transport::CreateNPCPassenger(uint32 guid, CreatureData const* data)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (data->phaseid)
|
||||
creature->SetInPhase(data->phaseid, false, true);
|
||||
else if (data->phaseGroup)
|
||||
for (auto phase : GetPhasesForGroup(data->phaseGroup))
|
||||
creature->SetInPhase(phase, false, true);
|
||||
else
|
||||
for (auto phase : GetPhases()) // Set the creature to the transport's phases
|
||||
creature->SetInPhase(phase, false, true);
|
||||
|
||||
if (!map->AddToMap(creature))
|
||||
{
|
||||
delete creature;
|
||||
@@ -387,15 +396,10 @@ TempSummon* Transport::SummonPassenger(uint32 entry, Position const& pos, TempSu
|
||||
}
|
||||
}
|
||||
|
||||
uint32 phase = PHASEMASK_NORMAL;
|
||||
std::set<uint32> phases;
|
||||
if (summoner)
|
||||
{
|
||||
phase = summoner->GetPhaseMask();
|
||||
phases = summoner->GetPhases();
|
||||
}
|
||||
|
||||
if (phases.empty())
|
||||
else
|
||||
phases = GetPhases(); // If there was no summoner, try to use the transport phases
|
||||
|
||||
TempSummon* summon = NULL;
|
||||
@@ -422,7 +426,7 @@ TempSummon* Transport::SummonPassenger(uint32 entry, Position const& pos, TempSu
|
||||
pos.GetPosition(x, y, z, o);
|
||||
CalculatePassengerPosition(x, y, z, &o);
|
||||
|
||||
if (!summon->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, phase, entry, x, y, z, o, nullptr, vehId))
|
||||
if (!summon->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, 0, entry, x, y, z, o, nullptr, vehId))
|
||||
{
|
||||
delete summon;
|
||||
return NULL;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -1928,7 +1928,6 @@ class Unit : public WorldObject
|
||||
void SetVisible(bool x);
|
||||
|
||||
// common function for visibility checks for player/creatures with detection code
|
||||
void SetPhaseMask(uint32 newPhaseMask, bool update);// overwrite WorldObject::SetPhaseMask
|
||||
void SetInPhase(uint32 id, bool update, bool apply);
|
||||
void UpdateObjectVisibility(bool forced = true);
|
||||
|
||||
|
||||
@@ -3868,7 +3868,7 @@ void Spell::EffectDuel(SpellEffIndex effIndex)
|
||||
|
||||
Map* map = m_caster->GetMap();
|
||||
if (!pGameObj->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), gameobject_id,
|
||||
map, m_caster->GetPhaseMask(),
|
||||
map, 0,
|
||||
m_caster->GetPositionX()+(unitTarget->GetPositionX()-m_caster->GetPositionX())/2,
|
||||
m_caster->GetPositionY()+(unitTarget->GetPositionY()-m_caster->GetPositionY())/2,
|
||||
m_caster->GetPositionZ(),
|
||||
@@ -4231,7 +4231,7 @@ void Spell::EffectSummonObject(SpellEffIndex effIndex)
|
||||
|
||||
Map* map = m_caster->GetMap();
|
||||
if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), go_id, map,
|
||||
m_caster->GetPhaseMask(), x, y, z, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY))
|
||||
0, x, y, z, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY))
|
||||
{
|
||||
delete go;
|
||||
return;
|
||||
@@ -4863,7 +4863,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex)
|
||||
GameObject* pGameObj = new GameObject;
|
||||
|
||||
if (!pGameObj->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), name_id, cMap,
|
||||
m_caster->GetPhaseMask(), fx, fy, fz, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY))
|
||||
0, fx, fy, fz, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY))
|
||||
{
|
||||
delete pGameObj;
|
||||
return;
|
||||
@@ -4932,7 +4932,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex)
|
||||
{
|
||||
GameObject* linkedGO = new GameObject;
|
||||
if (linkedGO->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), linkedEntry, cMap,
|
||||
m_caster->GetPhaseMask(), fx, fy, fz, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY))
|
||||
0, fx, fy, fz, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY))
|
||||
{
|
||||
for (auto phase : m_caster->GetPhases())
|
||||
linkedGO->SetInPhase(phase, false, true);
|
||||
|
||||
@@ -152,7 +152,7 @@ public:
|
||||
GameObject* object = new GameObject;
|
||||
uint32 guidLow = sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT);
|
||||
|
||||
if (!object->Create(guidLow, objectInfo->entry, map, player->GetPhaseMask(), x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY))
|
||||
if (!object->Create(guidLow, objectInfo->entry, map, 0, x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY))
|
||||
{
|
||||
delete object;
|
||||
return false;
|
||||
|
||||
Reference in new issue
Block a user