diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 128d01c1f..efa68798c 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -1879,7 +1879,6 @@ void Player::RemoveFromWorld() if(IsInWorld()) { ///- Release charmed creatures, unsummon totems and remove pets/guardians - Uncharm(); UnsummonAllTotems(); RemoveMiniPet(); } @@ -16446,16 +16445,6 @@ Pet* Player::GetMiniPet() return GetMap()->GetPet(m_miniPet); } -void Player::Uncharm() -{ - Unit* charm = GetCharm(); - if(!charm) - return; - - charm->RemoveSpellsCausingAura(SPELL_AURA_MOD_CHARM); - charm->RemoveSpellsCausingAura(SPELL_AURA_MOD_POSSESS); -} - void Player::BuildPlayerChat(WorldPacket *data, uint8 msgtype, const std::string& text, uint32 language) const { *data << (uint8)msgtype; diff --git a/src/game/Player.h b/src/game/Player.h index 79014e91d..c3b64691d 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1123,7 +1123,6 @@ class MANGOS_DLL_SPEC Player : public Unit void RemoveMiniPet(); Pet* GetMiniPet(); void SetMiniPet(Pet* pet) { m_miniPet = pet->GetGUID(); } - void Uncharm(); uint32 GetPhaseMaskForSpawn() const; // used for proper set phase for DB at GM-mode creature/GO spawn void Say(const std::string& text, const uint32 language); diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 4975fe1fb..a1cb8d774 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -3487,6 +3487,12 @@ void Aura::HandleModCharm(bool apply, bool Real) if( apply ) { + if (m_target->GetCharmerGUID()) + { + m_target->RemoveSpellsCausingAura(SPELL_AURA_MOD_CHARM); + m_target->RemoveSpellsCausingAura(SPELL_AURA_MOD_POSSESS); + } + m_target->SetCharmerGUID(GetCasterGUID()); m_target->setFaction(caster->getFaction()); m_target->CastStop(m_target == caster ? GetId() : 0); diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 166cbaa73..6ccb6f0ad 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -7977,7 +7977,7 @@ Pet* Unit::GetPet() const Unit* Unit::GetCharm() const { - if(uint64 charm_guid = GetCharmGUID()) + if (uint64 charm_guid = GetCharmGUID()) { if(Unit* pet = ObjectAccessor::GetUnit(*this, charm_guid)) return pet; @@ -7989,6 +7989,15 @@ Unit* Unit::GetCharm() const return NULL; } +void Unit::Uncharm() +{ + if (Unit* charm = GetCharm()) + { + charm->RemoveSpellsCausingAura(SPELL_AURA_MOD_CHARM); + charm->RemoveSpellsCausingAura(SPELL_AURA_MOD_POSSESS); + } +} + float Unit::GetCombatDistance( const Unit* target ) const { float radius = target->GetFloatValue(UNIT_FIELD_COMBATREACH) + GetFloatValue(UNIT_FIELD_COMBATREACH); @@ -11090,6 +11099,7 @@ void Unit::RemoveFromWorld() // cleanup if(IsInWorld()) { + Uncharm(); RemoveNotOwnSingleTargetAuras(); RemoveGuardians(); } diff --git a/src/game/Unit.h b/src/game/Unit.h index 619df4a83..cfba59cd7 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1194,6 +1194,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject Pet* GetPet() const; Unit* GetCharmer() const; Unit* GetCharm() const; + void Uncharm(); Unit* GetCharmerOrOwner() const { return GetCharmerGUID() ? GetCharmer() : GetOwner(); } Unit* GetCharmerOrOwnerOrSelf() { diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index f075979b6..a726dbc06 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8815" + #define REVISION_NR "8816" #endif // __REVISION_NR_H__