summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/Entities/Player/Player.cpp20
-rw-r--r--src/game/Entities/Unit/Unit.cpp11
-rw-r--r--src/game/Entities/Unit/Unit.h1
-rw-r--r--src/game/Spells/Auras/SpellAuraEffects.cpp10
4 files changed, 19 insertions, 23 deletions
diff --git a/src/game/Entities/Player/Player.cpp b/src/game/Entities/Player/Player.cpp
index cb3a972197..88d23acf80 100644
--- a/src/game/Entities/Player/Player.cpp
+++ b/src/game/Entities/Player/Player.cpp
@@ -3029,11 +3029,7 @@ void Player::SetGameMaster(bool on)
else
{
// restore phase
- uint32 newPhase = 0;
- AuraEffectList const& phases = GetAuraEffectsByType(SPELL_AURA_PHASE);
- if (!phases.empty())
- for (AuraEffectList::const_iterator itr = phases.begin(); itr != phases.end(); ++itr)
- newPhase |= (*itr)->GetMiscValue();
+ uint32 newPhase = GetPhaseByAuras();
if (!newPhase)
newPhase = PHASEMASK_NORMAL;
@@ -25241,22 +25237,14 @@ void Player::_LoadSkills(PreparedQueryResult result)
}
uint32 Player::GetPhaseMaskForSpawn() const
-{
- uint32 phase = PHASEMASK_NORMAL;
- if (!IsGameMaster())
- phase = GetPhaseMask();
- else
- {
- AuraEffectList const& phases = GetAuraEffectsByType(SPELL_AURA_PHASE);
- if (!phases.empty())
- phase = phases.front()->GetMiscValue();
- }
+{
+ uint32 phase = IsGameMaster() ? GetPhaseByAuras() : GetPhaseMask();
// some aura phases include 1 normal map in addition to phase itself
if (uint32 n_phase = phase & ~PHASEMASK_NORMAL)
return n_phase;
- return PHASEMASK_NORMAL;
+ return phase;
}
InventoryResult Player::CanEquipUniqueItem(Item* pItem, uint8 eslot, uint32 limit_count) const
diff --git a/src/game/Entities/Unit/Unit.cpp b/src/game/Entities/Unit/Unit.cpp
index d6e453c5a5..40cc595000 100644
--- a/src/game/Entities/Unit/Unit.cpp
+++ b/src/game/Entities/Unit/Unit.cpp
@@ -17556,6 +17556,17 @@ float Unit::MeleeSpellMissChance(const Unit* victim, WeaponAttackType attType, i
return missChance;
}
+uint32 Unit::GetPhaseByAuras() const
+{
+ uint32 currentPhase = 0;
+ AuraEffectList const& phases = GetAuraEffectsByType(SPELL_AURA_PHASE);
+ if (!phases.empty())
+ for (AuraEffectList::const_iterator itr = phases.begin(); itr != phases.end(); ++itr)
+ currentPhase |= (*itr)->GetMiscValue();
+
+ return currentPhase;
+}
+
void Unit::SetPhaseMask(uint32 newPhaseMask, bool update)
{
if (newPhaseMask == GetPhaseMask())
diff --git a/src/game/Entities/Unit/Unit.h b/src/game/Entities/Unit/Unit.h
index a1883fc298..bb8dca9134 100644
--- a/src/game/Entities/Unit/Unit.h
+++ b/src/game/Entities/Unit/Unit.h
@@ -2125,6 +2125,7 @@ class Unit : public WorldObject
void SetModelVisible(bool on);
// common function for visibility checks for player/creatures with detection code
+ uint32 GetPhaseByAuras() const;
void SetPhaseMask(uint32 newPhaseMask, bool update);// overwrite WorldObject::SetPhaseMask
void UpdateObjectVisibility(bool forced = true, bool fromUpdate = false);
diff --git a/src/game/Spells/Auras/SpellAuraEffects.cpp b/src/game/Spells/Auras/SpellAuraEffects.cpp
index 134fbbef9f..793776e393 100644
--- a/src/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/game/Spells/Auras/SpellAuraEffects.cpp
@@ -1711,20 +1711,16 @@ void AuraEffect::HandlePhase(AuraApplication const* aurApp, uint8 mode, bool app
Unit* target = aurApp->GetTarget();
// 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();
+ uint32 newPhase = target->GetPhaseByAuras();
if (Player* player = target->ToPlayer())
{
if (!newPhase)
newPhase = PHASEMASK_NORMAL;
- // GM-mode have mask 0xFFFFFFFF
+ // do not change phase to GM with all phases enabled
if (player->IsGameMaster())
- newPhase = 0xFFFFFFFF;
+ newPhase = PHASEMASK_ANYWHERE;
player->SetPhaseMask(newPhase, false);
player->GetSession()->SendSetPhaseShift(newPhase);