mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-17 16:10:49 +01:00
Core/Spell: Remove all raid auras on party leave (#17663)
Core/Spell: Remove all raid auras on party leave
This commit is contained in:
@@ -4289,6 +4289,20 @@ void Unit::RemoveAllAurasExceptType(AuraType type1, AuraType type2)
|
||||
}
|
||||
}
|
||||
|
||||
void Unit::RemoveAllGroupBuffsFromCaster(ObjectGuid casterGUID)
|
||||
{
|
||||
for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
|
||||
{
|
||||
Aura* aura = iter->second;
|
||||
if (aura->GetCasterGUID() == casterGUID && aura->GetSpellInfo()->IsGroupBuff())
|
||||
{
|
||||
RemoveOwnedAura(iter);
|
||||
continue;
|
||||
}
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
void Unit::DelayOwnedAuras(uint32 spellId, ObjectGuid caster, int32 delaytime)
|
||||
{
|
||||
AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);
|
||||
|
||||
@@ -1760,6 +1760,7 @@ class TC_GAME_API Unit : public WorldObject
|
||||
void RemoveAllAurasRequiringDeadTarget();
|
||||
void RemoveAllAurasExceptType(AuraType type);
|
||||
void RemoveAllAurasExceptType(AuraType type1, AuraType type2); /// @todo: once we support variadic templates use them here
|
||||
void RemoveAllGroupBuffsFromCaster(ObjectGuid casterGUID);
|
||||
void DelayOwnedAuras(uint32 spellId, ObjectGuid caster, int32 delaytime);
|
||||
|
||||
void _RemoveAllAuraStatMods();
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "Util.h"
|
||||
#include "LFGMgr.h"
|
||||
#include "UpdateFieldFlags.h"
|
||||
#include "SpellAuras.h"
|
||||
|
||||
Roll::Roll(ObjectGuid _guid, LootItem const& li) : itemGUID(_guid), itemid(li.itemid),
|
||||
itemRandomPropId(li.randomPropertyId), itemRandomSuffix(li.randomSuffix), itemCount(li.count),
|
||||
@@ -484,6 +485,22 @@ bool Group::RemoveMember(ObjectGuid guid, const RemoveMethod& method /*= GROUP_R
|
||||
|
||||
sScriptMgr->OnGroupRemoveMember(this, guid, method, kicker, reason);
|
||||
|
||||
Player* player = ObjectAccessor::FindConnectedPlayer(guid);
|
||||
if (player)
|
||||
{
|
||||
for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
|
||||
{
|
||||
if (Player* groupMember = itr->GetSource())
|
||||
{
|
||||
if (groupMember->GetGUID() == guid)
|
||||
continue;
|
||||
|
||||
groupMember->RemoveAllGroupBuffsFromCaster(guid);
|
||||
player->RemoveAllGroupBuffsFromCaster(groupMember->GetGUID());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// LFG group vote kick handled in scripts
|
||||
if (isLFGGroup() && method == GROUP_REMOVEMETHOD_KICK)
|
||||
return !m_memberSlots.empty();
|
||||
@@ -491,7 +508,6 @@ bool Group::RemoveMember(ObjectGuid guid, const RemoveMethod& method /*= GROUP_R
|
||||
// remove member and change leader (if need) only if strong more 2 members _before_ member remove (BG/BF allow 1 member group)
|
||||
if (GetMembersCount() > ((isBGGroup() || isLFGGroup() || isBFGroup()) ? 1u : 2u))
|
||||
{
|
||||
Player* player = ObjectAccessor::FindConnectedPlayer(guid);
|
||||
if (player)
|
||||
{
|
||||
// Battleground group handling
|
||||
|
||||
@@ -1131,6 +1131,24 @@ bool SpellInfo::IsAllowingDeadTarget() const
|
||||
return HasAttribute(SPELL_ATTR2_CAN_TARGET_DEAD) || Targets & (TARGET_FLAG_CORPSE_ALLY | TARGET_FLAG_CORPSE_ENEMY | TARGET_FLAG_UNIT_DEAD);
|
||||
}
|
||||
|
||||
bool SpellInfo::IsGroupBuff() const
|
||||
{
|
||||
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
|
||||
{
|
||||
switch (Effects[i].TargetA.GetCheckType())
|
||||
{
|
||||
case TARGET_CHECK_PARTY:
|
||||
case TARGET_CHECK_RAID:
|
||||
case TARGET_CHECK_RAID_CLASS:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SpellInfo::CanBeUsedInCombat() const
|
||||
{
|
||||
return !HasAttribute(SPELL_ATTR0_CANT_USED_IN_COMBAT);
|
||||
|
||||
@@ -413,6 +413,7 @@ public:
|
||||
bool IsDeathPersistent() const;
|
||||
bool IsRequiringDeadTarget() const;
|
||||
bool IsAllowingDeadTarget() const;
|
||||
bool IsGroupBuff() const;
|
||||
bool CanBeUsedInCombat() const;
|
||||
bool IsPositive() const;
|
||||
bool IsPositiveEffect(uint8 effIndex) const;
|
||||
|
||||
Reference in New Issue
Block a user