aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrobinsch <robinsch@users.noreply.github.com>2016-08-14 17:26:03 +0200
committerjoschiwald <joschiwald.trinity@gmail.com>2017-02-12 15:11:20 +0100
commitd94f0f34277680b5c7c33797851a78450b6e4ac7 (patch)
tree32e2246f892edcb58b508aac71e2ce9ef8662a90
parenta71aa14d3ed72f92cbd58bebbd224b648271c0c9 (diff)
Core/Spell: Remove all raid auras on party leave (#17663)
(cherry picked from commit dd67f4ed966875e6e68f6b0a8d56cdf190d0f352)
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp14
-rw-r--r--src/server/game/Entities/Unit/Unit.h1
-rw-r--r--src/server/game/Groups/Group.cpp18
-rw-r--r--src/server/game/Spells/SpellInfo.cpp22
-rw-r--r--src/server/game/Spells/SpellInfo.h1
5 files changed, 55 insertions, 1 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 705660f95a4..b0c89960fa8 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -4088,6 +4088,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);
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index ae969cc8800..2ffb78a4fc8 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -1856,6 +1856,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();
diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp
index b6a1903da95..6b522cea06a 100644
--- a/src/server/game/Groups/Group.cpp
+++ b/src/server/game/Groups/Group.cpp
@@ -35,6 +35,7 @@
#include "Util.h"
#include "LFGMgr.h"
#include "UpdateFieldFlags.h"
+#include "SpellAuras.h"
#include "PartyPackets.h"
#include "LootPackets.h"
@@ -536,6 +537,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();
@@ -543,7 +560,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
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp
index c08a0c43374..2ddd12fc376 100644
--- a/src/server/game/Spells/SpellInfo.cpp
+++ b/src/server/game/Spells/SpellInfo.cpp
@@ -1446,6 +1446,28 @@ 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
+{
+ SpellEffectInfoVector effects = GetEffectsForDifficulty(DIFFICULTY_NONE);
+ for (SpellEffectInfo const* effect : effects)
+ {
+ if (!effect)
+ continue;
+
+ switch (effect->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);
diff --git a/src/server/game/Spells/SpellInfo.h b/src/server/game/Spells/SpellInfo.h
index 2c5049dd4ae..f4861bac64f 100644
--- a/src/server/game/Spells/SpellInfo.h
+++ b/src/server/game/Spells/SpellInfo.h
@@ -460,6 +460,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;