aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells
diff options
context:
space:
mode:
authorSubv <subv2112@gmail.com>2014-06-01 22:27:29 -0500
committerSubv <subv2112@gmail.com>2014-06-01 22:27:29 -0500
commit48ec2df81fa8f88cd32d7a79b587603aedbd89e0 (patch)
tree1a6404c63979ee20a39f8b577db21541b37739c5 /src/server/game/Spells
parent6bc62d730ed08e6e12d9b57d4914e98019298781 (diff)
Core/Phases: Preliminary work with correctly implementing the phase system in 4.3.4
Put here for peer review.
Diffstat (limited to 'src/server/game/Spells')
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp52
-rw-r--r--src/server/game/Spells/SpellEffects.cpp18
-rw-r--r--src/server/game/Spells/SpellInfo.cpp1
3 files changed, 43 insertions, 28 deletions
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index 61a1ea40120..8c80c7687d5 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -1606,31 +1606,23 @@ void AuraEffect::HandlePhase(AuraApplication const* aurApp, uint8 mode, bool app
Unit* target = aurApp->GetTarget();
- if (Player* player = target->ToPlayer())
+ 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();
+
+ if (!newPhase)
{
- if (apply)
- player->GetPhaseMgr().RegisterPhasingAuraEffect(this);
- else
- player->GetPhaseMgr().UnRegisterPhasingAuraEffect(this);
+ newPhase = PHASEMASK_NORMAL;
+ if (Creature* creature = target->ToCreature())
+ if (CreatureData const* data = sObjectMgr->GetCreatureData(creature->GetDBTableGUIDLow()))
+ newPhase = data->phaseMask;
}
- else
- {
- 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();
- if (!newPhase)
- {
- newPhase = PHASEMASK_NORMAL;
- if (Creature* creature = target->ToCreature())
- if (CreatureData const* data = sObjectMgr->GetCreatureData(creature->GetDBTableGUIDLow()))
- newPhase = data->phaseMask;
- }
+ target->SetPhaseMask(newPhase, false);
- target->SetPhaseMask(newPhase, false);
- }
+ target->SetInPhase(GetMiscValueB(), false, apply);
// call functions which may have additional effects after chainging state of unit
// phase auras normally not expected at BG but anyway better check
@@ -1640,6 +1632,8 @@ void AuraEffect::HandlePhase(AuraApplication const* aurApp, uint8 mode, bool app
target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION);
}
+ if (Player* player = target->ToPlayer())
+ player->UpdatePhasing();
// need triggering visibility update base at phase update of not GM invisible (other GMs anyway see in any phases)
if (target->IsVisible())
target->UpdateObjectVisibility();
@@ -1652,13 +1646,12 @@ void AuraEffect::HandlePhaseGroup(AuraApplication const* aurApp, uint8 mode, boo
Unit* target = aurApp->GetTarget();
- if (Player* player = target->ToPlayer())
- {
- if (apply)
- player->GetPhaseMgr().RegisterPhasingAuraEffect(this);
- else
- player->GetPhaseMgr().UnRegisterPhasingAuraEffect(this);
- }
+ if (target->GetTypeId() != TYPEID_PLAYER)
+ return;
+
+ std::set<uint32> const& phases = GetPhasesForGroup(GetMiscValueB());
+ for (auto phase : phases)
+ target->SetInPhase(phase, false, apply);
// call functions which may have additional effects after chainging state of unit
// phase auras normally not expected at BG but anyway better check
@@ -1668,6 +1661,9 @@ void AuraEffect::HandlePhaseGroup(AuraApplication const* aurApp, uint8 mode, boo
target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION);
}
+ if (Player* player = target->ToPlayer())
+ player->UpdatePhasing();
+
// need triggering visibility update base at phase update of not GM invisible (other GMs anyway see in any phases)
if (target->IsVisible())
target->UpdateObjectVisibility();
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 8dfa017467a..ab05cd235eb 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -3200,6 +3200,9 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex)
return;
}
+ for (auto phase : m_caster->GetPhases())
+ pGameObj->SetInPhase(phase, false, true);
+
int32 duration = m_spellInfo->GetDuration();
pGameObj->SetRespawnTime(duration > 0 ? duration/IN_MILLISECONDS : 0);
@@ -3221,6 +3224,9 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex)
if (linkedGO->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), linkedEntry, map,
m_caster->GetPhaseMask(), x, y, z, target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY))
{
+ for (auto phase : m_caster->GetPhases())
+ linkedGO->SetInPhase(phase, false, true);
+
linkedGO->SetRespawnTime(duration > 0 ? duration/IN_MILLISECONDS : 0);
linkedGO->SetSpellId(m_spellInfo->Id);
@@ -3872,6 +3878,9 @@ void Spell::EffectDuel(SpellEffIndex effIndex)
return;
}
+ for (auto phase : m_caster->GetPhases())
+ pGameObj->SetInPhase(phase, false, true);
+
pGameObj->SetUInt32Value(GAMEOBJECT_FACTION, m_caster->getFaction());
pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel()+1);
int32 duration = m_spellInfo->GetDuration();
@@ -4228,6 +4237,9 @@ void Spell::EffectSummonObject(SpellEffIndex effIndex)
return;
}
+ for (auto phase : m_caster->GetPhases())
+ go->SetInPhase(phase, false, true);
+
//pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel());
int32 duration = m_spellInfo->GetDuration();
go->SetRespawnTime(duration > 0 ? duration/IN_MILLISECONDS : 0);
@@ -4857,6 +4869,9 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex)
return;
}
+ for (auto phase : m_caster->GetPhases())
+ pGameObj->SetInPhase(phase, false, true);
+
int32 duration = m_spellInfo->GetDuration();
switch (goinfo->type)
@@ -4919,6 +4934,9 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex)
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))
{
+ for (auto phase : m_caster->GetPhases())
+ linkedGO->SetInPhase(phase, false, true);
+
linkedGO->SetRespawnTime(duration > 0 ? duration/IN_MILLISECONDS : 0);
//linkedGO->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel());
linkedGO->SetSpellId(m_spellInfo->Id);
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp
index 7491920c36a..03076b003be 100644
--- a/src/server/game/Spells/SpellInfo.cpp
+++ b/src/server/game/Spells/SpellInfo.cpp
@@ -17,6 +17,7 @@
#include "SpellInfo.h"
#include "SpellAuraDefines.h"
+#include "SpellAuraEffects.h"
#include "SpellMgr.h"
#include "Spell.h"
#include "DBCStores.h"