Core/Spells: Phaseshift auras can now be stacked

--HG--
branch : trunk
This commit is contained in:
Shauren
2010-11-24 16:58:57 +01:00
parent ce989d701a
commit 3fa97ad538
2 changed files with 35 additions and 21 deletions
+8 -4
View File
@@ -2496,18 +2496,22 @@ void Player::SetGameMaster(bool on)
getHostileRefManager().setOnlineOfflineState(false); getHostileRefManager().setOnlineOfflineState(false);
CombatStopWithPets(); CombatStopWithPets();
SetPhaseMask(PHASEMASK_ANYWHERE,false); // see and visible in all phases SetPhaseMask(PHASEMASK_ANYWHERE, false); // see and visible in all phases
m_serverSideVisibilityDetect.SetValue(SERVERSIDE_VISIBILITY_GM, GetSession()->GetSecurity()); m_serverSideVisibilityDetect.SetValue(SERVERSIDE_VISIBILITY_GM, GetSession()->GetSecurity());
} }
else else
{ {
// restore phase // restore phase
uint32 newPhase = 0;
AuraEffectList const& phases = GetAuraEffectsByType(SPELL_AURA_PHASE); AuraEffectList const& phases = GetAuraEffectsByType(SPELL_AURA_PHASE);
if (!phases.empty()) if (!phases.empty())
SetPhaseMask(phases.front()->GetMiscValue(), false); for (AuraEffectList::const_iterator itr = phases.begin(); itr != phases.end(); ++itr)
else newPhase |= (*itr)->GetMiscValue();
SetPhaseMask(PHASEMASK_NORMAL, false);
if (!newPhase)
newPhase = PHASEMASK_NORMAL;
SetPhaseMask(newPhase, false);
m_ExtraFlags &= ~ PLAYER_EXTRA_GM_ON; m_ExtraFlags &= ~ PLAYER_EXTRA_GM_ON;
setFactionForRace(getRace()); setFactionForRace(getRace());
@@ -2901,33 +2901,43 @@ void AuraEffect::HandlePhase(AuraApplication const * aurApp, uint8 mode, bool ap
Unit * target = aurApp->GetTarget(); Unit * target = aurApp->GetTarget();
// no-phase is also phase state so same code for apply and remove // no-phase is also phase state so same code for apply and remove
uint32 newPhase = 0;
Unit::AuraEffectList const& phases = target->GetAuraEffectsByType(SPELL_AURA_PHASE);
if (!phases.empty())
for (Unit::AuraEffectList::const_iterator itr = phases.begin(); itr != phases.end(); ++itr)
newPhase |= (*itr)->GetMiscValue();
// phase auras normally not expected at BG but anyway better check // phase auras normally not expected at BG but anyway better check
if (target->GetTypeId() == TYPEID_PLAYER) if (Player* player = target->ToPlayer())
{ {
if (!newPhase)
newPhase = PHASEMASK_NORMAL;
// drop flag at invisible in bg // drop flag at invisible in bg
if (target->ToPlayer()->InBattleground()) if (player->InBattleground())
if (Battleground *bg = target->ToPlayer()->GetBattleground()) if (Battleground *bg = player->GetBattleground())
bg->EventPlayerDroppedFlag(target->ToPlayer()); bg->EventPlayerDroppedFlag(player);
// GM-mode have mask 0xFFFFFFFF // GM-mode have mask 0xFFFFFFFF
if (!target->ToPlayer()->isGameMaster()) if (player->isGameMaster())
{ newPhase = 0xFFFFFFFF;
if (apply)
target->SetPhaseMask(GetMiscValue(), false); player->SetPhaseMask(newPhase, false);
player->GetSession()->SendSetPhaseShift(newPhase);
}
else else
target->SetPhaseMask(PHASEMASK_NORMAL, false); {
if (!newPhase)
{
newPhase = PHASEMASK_NORMAL;
if (Creature* creature = target->ToCreature())
if (CreatureData const* data = sObjectMgr.GetCreatureData(creature->GetDBTableGUIDLow()))
newPhase = data->phaseMask;
} }
if (apply) target->SetPhaseMask(newPhase, false);
target->ToPlayer()->GetSession()->SendSetPhaseShift(GetMiscValue());
else
target->ToPlayer()->GetSession()->SendSetPhaseShift(PHASEMASK_NORMAL);
} }
else if (apply)
target->SetPhaseMask(GetMiscValue(), false);
else
target->SetPhaseMask(PHASEMASK_NORMAL, false);
// need triggering visibility update base at phase update of not GM invisible (other GMs anyway see in any phases) // need triggering visibility update base at phase update of not GM invisible (other GMs anyway see in any phases)
if (!target->IsVisible()) if (!target->IsVisible())