Core/Entities: Phasing rewrite

* Optimized phase visibility checking
* Handle all phase flags

Closes #16758
Closes #21119
This commit is contained in:
Shauren
2018-03-25 19:28:36 +03:00
parent 1e62b53c66
commit 91be2332e2
80 changed files with 1802 additions and 885 deletions
+8 -19
View File
@@ -38,6 +38,7 @@ EndScriptData */
#include "MapManager.h"
#include "MovementPackets.h"
#include "ObjectMgr.h"
#include "PhasingHandler.h"
#include "RBAC.h"
#include "SpellPackets.h"
#include "Transport.h"
@@ -945,7 +946,7 @@ public:
if (!v)
return false;
v->CopyPhaseFrom(handler->GetSession()->GetPlayer());
PhasingHandler::InheritPhaseShift(v, handler->GetSession()->GetPlayer());
map->AddToMap(v);
@@ -974,22 +975,20 @@ public:
if (!t)
return false;
std::set<uint32> terrainswap;
std::set<uint32> phaseId;
std::set<uint32> worldMapSwap;
PhaseShift phaseShift;
if (uint32 ut = (uint32)atoi(t))
terrainswap.insert(ut);
phaseShift.AddVisibleMapId(ut, nullptr);
if (p)
if (uint32 up = (uint32)atoi(p))
phaseId.insert(up);
phaseShift.AddPhase(up, PhaseFlags::None, nullptr);
if (m)
if (uint32 um = (uint32)atoi(m))
worldMapSwap.insert(um);
phaseShift.AddUiWorldMapAreaIdSwap(um);
handler->GetSession()->SendSetPhaseShift(phaseId, terrainswap, worldMapSwap);
PhasingHandler::SendToPlayer(handler->GetSession()->GetPlayer(), phaseShift);
return true;
}
@@ -1472,17 +1471,7 @@ public:
else if (target->GetDBPhase() < 0)
handler->PSendSysMessage("Target creature's PhaseGroup in DB: %d", abs(target->GetDBPhase()));
std::stringstream phases;
for (uint32 phase : target->GetPhases())
{
phases << phase << " ";
}
if (!phases.str().empty())
handler->PSendSysMessage("Target's current phases: %s", phases.str().c_str());
else
handler->SendSysMessage("Target is not phased");
PhasingHandler::PrintToChat(handler, target->GetPhaseShift());
return true;
}