Core/Entities: Phasing rewrite

* Optimized phase visibility checking
* Handle all phase flags

Closes #16758
Closes #21119
This commit is contained in:
Shauren
2018-01-28 11:37:20 +01:00
parent 1e62b53c66
commit 91be2332e2
80 changed files with 1802 additions and 885 deletions

View File

@@ -34,6 +34,7 @@
#include "MotionMaster.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "PhasingHandler.h"
#include "Random.h"
#include "SmartAI.h"
#include "SpellAuras.h"
@@ -1246,7 +1247,12 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
break;
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
(*itr)->SetInPhase(e.action.ingamePhaseId.id, true, e.action.ingamePhaseId.apply == 1);
{
if (e.action.ingamePhaseId.apply == 1)
PhasingHandler::AddPhase(*itr, e.action.ingamePhaseId.id, true);
else
PhasingHandler::RemovePhase(*itr, e.action.ingamePhaseId.id, true);
}
delete targets;
break;
@@ -1258,11 +1264,13 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (!targets)
break;
std::set<uint32> phases = sDB2Manager.GetPhasesForGroup(e.action.ingamePhaseGroup.groupId);
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
for (auto phase : phases)
(*itr)->SetInPhase(phase, true, e.action.ingamePhaseGroup.apply == 1);
{
if (e.action.ingamePhaseGroup.apply == 1)
PhasingHandler::AddPhaseGroup(*itr, e.action.ingamePhaseGroup.groupId, true);
else
PhasingHandler::RemovePhaseGroup(*itr, e.action.ingamePhaseGroup.groupId, true);
}
delete targets;
break;