Core/Phases: Removed more SetPhaseMask uses

This commit is contained in:
Subv
2014-06-05 13:05:29 -05:00
parent 74be070d1c
commit 2086f18f7b
8 changed files with 76 additions and 27 deletions
@@ -1043,7 +1043,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
delete targets;
break;
}
case SMART_ACTION_SET_INGAME_PHASE_MASK:
case SMART_ACTION_SET_INGAME_PHASE_ID:
{
ObjectList* targets = GetTargets(e, unit);
@@ -1051,12 +1051,23 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
break;
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
{
if (IsUnit(*itr))
(*itr)->ToUnit()->SetPhaseMask(e.action.ingamePhaseMask.mask, true);
else if (IsGameObject(*itr))
(*itr)->ToGameObject()->SetPhaseMask(e.action.ingamePhaseMask.mask, true);
}
(*itr)->SetInPhase(e.action.ingamePhaseId.id, true, e.action.ingamePhaseId.apply == 1);
delete targets;
break;
}
case SMART_ACTION_SET_INGAME_PHASE_GROUP:
{
ObjectList* targets = GetTargets(e, unit);
if (!targets)
break;
std::set<uint32> const& phases = GetPhasesForGroup(e.action.ingamePhaseGroup.id);
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
for (auto phase : phases)
(*itr)->SetInPhase(phase, true, e.action.ingamePhaseGroup.apply == 1);
delete targets;
break;