fix(Core/Units): charmed creatures do not need to check hostility to attacked creature (#7043)

Properly remove channelled charm auras on demand.
- Closes #5447
This commit is contained in:
UltraNix
2021-07-23 09:31:04 +02:00
committed by GitHub
parent da392517cb
commit e450fd6f68
2 changed files with 17 additions and 6 deletions

View File

@@ -462,9 +462,11 @@ void WorldSession::HandleCancelAuraOpcode(WorldPacket& recvPacket)
if (!spellInfo)
return;
// not allow remove non positive spells and spells with attr SPELL_ATTR0_NO_AURA_CANCEL
if ((!spellInfo->IsPositive() || spellInfo->HasAttribute(SPELL_ATTR0_NO_AURA_CANCEL) || spellInfo->IsPassive()) && spellId != 605)
// not allow remove spells with attr SPELL_ATTR0_CANT_CANCEL
if (spellInfo->HasAttribute(SPELL_ATTR0_NO_AURA_CANCEL))
{
return;
}
// channeled spell case (it currently casted then)
if (spellInfo->IsChanneled())
@@ -475,6 +477,14 @@ void WorldSession::HandleCancelAuraOpcode(WorldPacket& recvPacket)
return;
}
// non channeled case:
// don't allow remove non positive spells
// don't allow cancelling passive auras (some of them are visible)
if (!spellInfo->IsPositive() || spellInfo->IsPassive())
{
return;
}
// maybe should only remove one buff when there are multiple?
_player->RemoveOwnedAura(spellId, ObjectGuid::Empty, 0, AURA_REMOVE_BY_CANCEL);
}