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())
|
if(IsInWorld())
|
||||||
{
|
{
|
||||||
///- Release charmed creatures, unsummon totems and remove pets/guardians
|
///- Release charmed creatures, unsummon totems and remove pets/guardians
|
||||||
Uncharm();
|
|
||||||
UnsummonAllTotems();
|
UnsummonAllTotems();
|
||||||
RemoveMiniPet();
|
RemoveMiniPet();
|
||||||
}
|
}
|
||||||
|
|
@ -16446,16 +16445,6 @@ Pet* Player::GetMiniPet()
|
||||||
return GetMap()->GetPet(m_miniPet);
|
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
|
void Player::BuildPlayerChat(WorldPacket *data, uint8 msgtype, const std::string& text, uint32 language) const
|
||||||
{
|
{
|
||||||
*data << (uint8)msgtype;
|
*data << (uint8)msgtype;
|
||||||
|
|
|
||||||
|
|
@ -1123,7 +1123,6 @@ class MANGOS_DLL_SPEC Player : public Unit
|
||||||
void RemoveMiniPet();
|
void RemoveMiniPet();
|
||||||
Pet* GetMiniPet();
|
Pet* GetMiniPet();
|
||||||
void SetMiniPet(Pet* pet) { m_miniPet = pet->GetGUID(); }
|
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
|
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);
|
void Say(const std::string& text, const uint32 language);
|
||||||
|
|
|
||||||
|
|
@ -3487,6 +3487,12 @@ void Aura::HandleModCharm(bool apply, bool Real)
|
||||||
|
|
||||||
if( apply )
|
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->SetCharmerGUID(GetCasterGUID());
|
||||||
m_target->setFaction(caster->getFaction());
|
m_target->setFaction(caster->getFaction());
|
||||||
m_target->CastStop(m_target == caster ? GetId() : 0);
|
m_target->CastStop(m_target == caster ? GetId() : 0);
|
||||||
|
|
|
||||||
|
|
@ -7977,7 +7977,7 @@ Pet* Unit::GetPet() const
|
||||||
|
|
||||||
Unit* Unit::GetCharm() const
|
Unit* Unit::GetCharm() const
|
||||||
{
|
{
|
||||||
if(uint64 charm_guid = GetCharmGUID())
|
if (uint64 charm_guid = GetCharmGUID())
|
||||||
{
|
{
|
||||||
if(Unit* pet = ObjectAccessor::GetUnit(*this, charm_guid))
|
if(Unit* pet = ObjectAccessor::GetUnit(*this, charm_guid))
|
||||||
return pet;
|
return pet;
|
||||||
|
|
@ -7989,6 +7989,15 @@ Unit* Unit::GetCharm() const
|
||||||
return NULL;
|
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 Unit::GetCombatDistance( const Unit* target ) const
|
||||||
{
|
{
|
||||||
float radius = target->GetFloatValue(UNIT_FIELD_COMBATREACH) + GetFloatValue(UNIT_FIELD_COMBATREACH);
|
float radius = target->GetFloatValue(UNIT_FIELD_COMBATREACH) + GetFloatValue(UNIT_FIELD_COMBATREACH);
|
||||||
|
|
@ -11090,6 +11099,7 @@ void Unit::RemoveFromWorld()
|
||||||
// cleanup
|
// cleanup
|
||||||
if(IsInWorld())
|
if(IsInWorld())
|
||||||
{
|
{
|
||||||
|
Uncharm();
|
||||||
RemoveNotOwnSingleTargetAuras();
|
RemoveNotOwnSingleTargetAuras();
|
||||||
RemoveGuardians();
|
RemoveGuardians();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1194,6 +1194,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
|
||||||
Pet* GetPet() const;
|
Pet* GetPet() const;
|
||||||
Unit* GetCharmer() const;
|
Unit* GetCharmer() const;
|
||||||
Unit* GetCharm() const;
|
Unit* GetCharm() const;
|
||||||
|
void Uncharm();
|
||||||
Unit* GetCharmerOrOwner() const { return GetCharmerGUID() ? GetCharmer() : GetOwner(); }
|
Unit* GetCharmerOrOwner() const { return GetCharmerGUID() ? GetCharmer() : GetOwner(); }
|
||||||
Unit* GetCharmerOrOwnerOrSelf()
|
Unit* GetCharmerOrOwnerOrSelf()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "8815"
|
#define REVISION_NR "8816"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue