aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShauren <none@none>2010-12-21 11:40:20 +0100
committerShauren <none@none>2010-12-21 11:40:20 +0100
commit5809c1fa3b6b6d8ff1a46ccbaadd142d92bebe48 (patch)
treef3dea39c2be5df428e47f0611d93c75ae5c8a750
parent5180ed0383c1e5b19147adbe2e5f10bca50636e4 (diff)
Core/Auras: Fixed auras incorrectly stacking with different item casters introduced in r19f21916a940
Closes issue #5218. --HG-- branch : trunk
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.cpp2
-rwxr-xr-xsrc/server/game/Spells/Auras/SpellAuras.cpp4
-rwxr-xr-xsrc/server/game/Spells/SpellMgr.cpp27
-rwxr-xr-xsrc/server/game/Spells/SpellMgr.h44
4 files changed, 54 insertions, 23 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index a3757827b6d..bf786ba8620 100755
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -3763,7 +3763,7 @@ bool Unit::_IsNoStackAuraDueToAura(Aura * appliedAura, Aura * existingAura) cons
if (is_triggered_by_spell)
return false;
- if (sSpellMgr.CanAurasStack(spellProto, i_spellProto, sameCaster) || (sameCaster && appliedAura->GetCastItemGUID() && existingAura->GetCastItemGUID() != appliedAura->GetCastItemGUID()))
+ if (sSpellMgr.CanAurasStack(appliedAura, existingAura, sameCaster))
return false;
return true;
}
diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp
index fab20a8634d..d462fcdbdaa 100755
--- a/src/server/game/Spells/Auras/SpellAuras.cpp
+++ b/src/server/game/Spells/Auras/SpellAuras.cpp
@@ -527,7 +527,7 @@ void Aura::UpdateTargetMap(Unit * caster, bool apply)
for (Unit::AuraApplicationMap::iterator iter = itr->first->GetAppliedAuras().begin(); iter != itr->first->GetAppliedAuras().end(); ++iter)
{
Aura const * aura = iter->second->GetBase();
- if (!sSpellMgr.CanAurasStack(GetSpellProto(), aura->GetSpellProto(), aura->GetCasterGUID() == GetCasterGUID()))
+ if (!sSpellMgr.CanAurasStack(this, aura, aura->GetCasterGUID() == GetCasterGUID()))
{
addUnit = false;
break;
@@ -549,10 +549,8 @@ void Aura::UpdateTargetMap(Unit * caster, bool apply)
// remove auras from units no longer needing them
for (UnitList::iterator itr = targetsToRemove.begin(); itr != targetsToRemove.end();++itr)
- {
if (AuraApplication * aurApp = GetApplicationOfTarget((*itr)->GetGUID()))
(*itr)->_UnapplyAura(aurApp, AURA_REMOVE_BY_DEFAULT);
- }
if (!apply)
return;
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp
index 76175ada22a..d329ddffcf8 100755
--- a/src/server/game/Spells/SpellMgr.cpp
+++ b/src/server/game/Spells/SpellMgr.cpp
@@ -18,6 +18,7 @@
#include "SpellMgr.h"
#include "ObjectMgr.h"
+#include "SpellAuras.h"
#include "SpellAuraDefines.h"
#include "ProgressBar.h"
#include "DBCStores.h"
@@ -3142,8 +3143,10 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32
//-----------TRINITY-------------
-bool SpellMgr::CanAurasStack(SpellEntry const *spellInfo_1, SpellEntry const *spellInfo_2, bool sameCaster) const
+bool SpellMgr::CanAurasStack(Aura const *aura1, Aura const *aura2, bool sameCaster) const
{
+ SpellEntry const *spellInfo_1 = aura1->GetSpellProto();
+ SpellEntry const *spellInfo_2 = aura2->GetSpellProto();
SpellSpecific spellSpec_1 = GetSpellSpecific(spellInfo_1);
SpellSpecific spellSpec_2 = GetSpellSpecific(spellInfo_2);
if (spellSpec_1 && spellSpec_2)
@@ -3205,6 +3208,9 @@ bool SpellMgr::CanAurasStack(SpellEntry const *spellInfo_1, SpellEntry const *sp
// Hack for Incanter's Absorption
if (spellId_1 == 44413)
return true;
+ if (aura1->GetCastItemGUID() && aura2->GetCastItemGUID())
+ if (aura1->GetCastItemGUID() != aura2->GetCastItemGUID() && (sSpellMgr.GetSpellCustomAttr(spellId_1) & SPELL_ATTR0_CU_ENCHANT_PROC))
+ return true;
// same spell with same caster should not stack
return false;
}
@@ -4042,6 +4048,25 @@ void SpellMgr::LoadSpellCustomAttr()
}
}
+ for (uint32 i = 0; i < sSpellItemEnchantmentStore.GetNumRows(); ++i)
+ {
+ SpellItemEnchantmentEntry const *enchant = sSpellItemEnchantmentStore.LookupEntry(i);
+ if (!enchant)
+ continue;
+
+ for (uint8 s = 0; s < MAX_ITEM_ENCHANTMENT_EFFECTS; ++s)
+ {
+ if (enchant->type[s] != ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL)
+ continue;
+
+ SpellEntry const *spellInfo = sSpellStore.LookupEntry(enchant->spellid[s]);
+ if (!spellInfo)
+ continue;
+
+ mSpellCustomAttr[enchant->spellid[s]] |= SPELL_ATTR0_CU_ENCHANT_PROC;
+ }
+ }
+
SummonPropertiesEntry *properties = const_cast<SummonPropertiesEntry*>(sSummonPropertiesStore.LookupEntry(121));
properties->Type = SUMMON_TYPE_TOTEM;
properties = const_cast<SummonPropertiesEntry*>(sSummonPropertiesStore.LookupEntry(647)); // 52893
diff --git a/src/server/game/Spells/SpellMgr.h b/src/server/game/Spells/SpellMgr.h
index acea5e068e7..7e4d51b5a99 100755
--- a/src/server/game/Spells/SpellMgr.h
+++ b/src/server/game/Spells/SpellMgr.h
@@ -876,23 +876,31 @@ inline bool IsProfessionSkill(uint32 skill)
return IsPrimaryProfessionSkill(skill) || skill == SKILL_FISHING || skill == SKILL_COOKING || skill == SKILL_FIRST_AID;
}
-#define SPELL_ATTR0_CU_CONE_BACK 0x00000002
-#define SPELL_ATTR0_CU_CONE_LINE 0x00000004
-#define SPELL_ATTR0_CU_SHARE_DAMAGE 0x00000008
-#define SPELL_ATTR0_CU_AURA_CC 0x00000040
-#define SPELL_ATTR0_CU_DIRECT_DAMAGE 0x00000100
-#define SPELL_ATTR0_CU_CHARGE 0x00000200
-#define SPELL_ATTR0_CU_LINK_CAST 0x00000400
-#define SPELL_ATTR0_CU_LINK_HIT 0x00000800
-#define SPELL_ATTR0_CU_LINK_AURA 0x00001000
-#define SPELL_ATTR0_CU_LINK_REMOVE 0x00002000
-#define SPELL_ATTR0_CU_PICKPOCKET 0x00004000
-#define SPELL_ATTR0_CU_EXCLUDE_SELF 0x00008000
-#define SPELL_ATTR0_CU_NEGATIVE_EFF0 0x00010000
-#define SPELL_ATTR0_CU_NEGATIVE_EFF1 0x00020000
-#define SPELL_ATTR0_CU_NEGATIVE_EFF2 0x00040000
-#define SPELL_ATTR0_CU_NEGATIVE 0x00070000
-#define SPELL_ATTR0_CU_IGNORE_ARMOR 0x00080000
+enum SpellCustomAttributes
+{
+ SPELL_ATTR0_CU_ENCHANT_PROC = 0x00000001,
+ SPELL_ATTR0_CU_CONE_BACK = 0x00000002,
+ SPELL_ATTR0_CU_CONE_LINE = 0x00000004,
+ SPELL_ATTR0_CU_SHARE_DAMAGE = 0x00000008,
+ SPELL_ATTR0_CU_NONE1 = 0x00000010, // UNUSED
+ SPELL_ATTR0_CU_NONE2 = 0x00000020, // UNUSED
+ SPELL_ATTR0_CU_AURA_CC = 0x00000040,
+ SPELL_ATTR0_CU_DIRECT_DAMAGE = 0x00000100,
+ SPELL_ATTR0_CU_CHARGE = 0x00000200,
+ SPELL_ATTR0_CU_LINK_CAST = 0x00000400,
+ SPELL_ATTR0_CU_LINK_HIT = 0x00000800,
+ SPELL_ATTR0_CU_LINK_AURA = 0x00001000,
+ SPELL_ATTR0_CU_LINK_REMOVE = 0x00002000,
+ SPELL_ATTR0_CU_PICKPOCKET = 0x00004000,
+ SPELL_ATTR0_CU_EXCLUDE_SELF = 0x00008000,
+ SPELL_ATTR0_CU_NEGATIVE_EFF0 = 0x00010000,
+ SPELL_ATTR0_CU_NEGATIVE_EFF1 = 0x00020000,
+ SPELL_ATTR0_CU_NEGATIVE_EFF2 = 0x00040000,
+ SPELL_ATTR0_CU_IGNORE_ARMOR = 0x00080000,
+
+ SPELL_ATTR0_CU_NEGATIVE = SPELL_ATTR0_CU_NEGATIVE_EFF0 | SPELL_ATTR0_CU_NEGATIVE_EFF1 | SPELL_ATTR0_CU_NEGATIVE_EFF2,
+};
+
typedef std::vector<uint32> SpellCustomAttribute;
typedef std::vector<bool> EnchantCustomAttribute;
@@ -1208,7 +1216,7 @@ class SpellMgr
bool IsRankSpellDueToSpell(SpellEntry const *spellInfo_1,uint32 spellId_2) const;
static bool canStackSpellRanks(SpellEntry const *spellInfo);
- bool CanAurasStack(SpellEntry const *spellInfo_1, SpellEntry const *spellInfo_2, bool sameCaster) const;
+ bool CanAurasStack(Aura const *aura1, Aura const *aura2, bool sameCaster) const;
SpellEntry const* SelectAuraRankForPlayerLevel(SpellEntry const* spellInfo, uint32 playerLevel) const;