mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 19:37:02 +00:00
[8816] call uncharm for all units at delete
currently it was only done for players - but units also can have charms which must be removed
This commit is contained in:
parent
ef26908948
commit
c3c7ab2f63
6 changed files with 19 additions and 14 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "8815"
|
||||
#define REVISION_NR "8816"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue