mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +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
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue