Core/Auras: Fixed auras incorrectly stacking with different item casters introduced in r19f21916a940

Closes issue #5218.

--HG--
branch : trunk
This commit is contained in:
Shauren
2010-12-21 11:40:20 +01:00
parent 5180ed0383
commit 5809c1fa3b
4 changed files with 54 additions and 23 deletions
+1 -1
View File
@@ -3763,7 +3763,7 @@ bool Unit::_IsNoStackAuraDueToAura(Aura * appliedAura, Aura * existingAura) cons
if (is_triggered_by_spell) if (is_triggered_by_spell)
return false; 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 false;
return true; return true;
} }
+1 -3
View File
@@ -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) for (Unit::AuraApplicationMap::iterator iter = itr->first->GetAppliedAuras().begin(); iter != itr->first->GetAppliedAuras().end(); ++iter)
{ {
Aura const * aura = iter->second->GetBase(); 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; addUnit = false;
break; break;
@@ -549,10 +549,8 @@ void Aura::UpdateTargetMap(Unit * caster, bool apply)
// remove auras from units no longer needing them // remove auras from units no longer needing them
for (UnitList::iterator itr = targetsToRemove.begin(); itr != targetsToRemove.end();++itr) for (UnitList::iterator itr = targetsToRemove.begin(); itr != targetsToRemove.end();++itr)
{
if (AuraApplication * aurApp = GetApplicationOfTarget((*itr)->GetGUID())) if (AuraApplication * aurApp = GetApplicationOfTarget((*itr)->GetGUID()))
(*itr)->_UnapplyAura(aurApp, AURA_REMOVE_BY_DEFAULT); (*itr)->_UnapplyAura(aurApp, AURA_REMOVE_BY_DEFAULT);
}
if (!apply) if (!apply)
return; return;
+26 -1
View File
@@ -18,6 +18,7 @@
#include "SpellMgr.h" #include "SpellMgr.h"
#include "ObjectMgr.h" #include "ObjectMgr.h"
#include "SpellAuras.h"
#include "SpellAuraDefines.h" #include "SpellAuraDefines.h"
#include "ProgressBar.h" #include "ProgressBar.h"
#include "DBCStores.h" #include "DBCStores.h"
@@ -3142,8 +3143,10 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32
//-----------TRINITY------------- //-----------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_1 = GetSpellSpecific(spellInfo_1);
SpellSpecific spellSpec_2 = GetSpellSpecific(spellInfo_2); SpellSpecific spellSpec_2 = GetSpellSpecific(spellInfo_2);
if (spellSpec_1 && spellSpec_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 // Hack for Incanter's Absorption
if (spellId_1 == 44413) if (spellId_1 == 44413)
return true; 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 // same spell with same caster should not stack
return false; 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)); SummonPropertiesEntry *properties = const_cast<SummonPropertiesEntry*>(sSummonPropertiesStore.LookupEntry(121));
properties->Type = SUMMON_TYPE_TOTEM; properties->Type = SUMMON_TYPE_TOTEM;
properties = const_cast<SummonPropertiesEntry*>(sSummonPropertiesStore.LookupEntry(647)); // 52893 properties = const_cast<SummonPropertiesEntry*>(sSummonPropertiesStore.LookupEntry(647)); // 52893
+26 -18
View File
@@ -876,23 +876,31 @@ inline bool IsProfessionSkill(uint32 skill)
return IsPrimaryProfessionSkill(skill) || skill == SKILL_FISHING || skill == SKILL_COOKING || skill == SKILL_FIRST_AID; return IsPrimaryProfessionSkill(skill) || skill == SKILL_FISHING || skill == SKILL_COOKING || skill == SKILL_FIRST_AID;
} }
#define SPELL_ATTR0_CU_CONE_BACK 0x00000002 enum SpellCustomAttributes
#define SPELL_ATTR0_CU_CONE_LINE 0x00000004 {
#define SPELL_ATTR0_CU_SHARE_DAMAGE 0x00000008 SPELL_ATTR0_CU_ENCHANT_PROC = 0x00000001,
#define SPELL_ATTR0_CU_AURA_CC 0x00000040 SPELL_ATTR0_CU_CONE_BACK = 0x00000002,
#define SPELL_ATTR0_CU_DIRECT_DAMAGE 0x00000100 SPELL_ATTR0_CU_CONE_LINE = 0x00000004,
#define SPELL_ATTR0_CU_CHARGE 0x00000200 SPELL_ATTR0_CU_SHARE_DAMAGE = 0x00000008,
#define SPELL_ATTR0_CU_LINK_CAST 0x00000400 SPELL_ATTR0_CU_NONE1 = 0x00000010, // UNUSED
#define SPELL_ATTR0_CU_LINK_HIT 0x00000800 SPELL_ATTR0_CU_NONE2 = 0x00000020, // UNUSED
#define SPELL_ATTR0_CU_LINK_AURA 0x00001000 SPELL_ATTR0_CU_AURA_CC = 0x00000040,
#define SPELL_ATTR0_CU_LINK_REMOVE 0x00002000 SPELL_ATTR0_CU_DIRECT_DAMAGE = 0x00000100,
#define SPELL_ATTR0_CU_PICKPOCKET 0x00004000 SPELL_ATTR0_CU_CHARGE = 0x00000200,
#define SPELL_ATTR0_CU_EXCLUDE_SELF 0x00008000 SPELL_ATTR0_CU_LINK_CAST = 0x00000400,
#define SPELL_ATTR0_CU_NEGATIVE_EFF0 0x00010000 SPELL_ATTR0_CU_LINK_HIT = 0x00000800,
#define SPELL_ATTR0_CU_NEGATIVE_EFF1 0x00020000 SPELL_ATTR0_CU_LINK_AURA = 0x00001000,
#define SPELL_ATTR0_CU_NEGATIVE_EFF2 0x00040000 SPELL_ATTR0_CU_LINK_REMOVE = 0x00002000,
#define SPELL_ATTR0_CU_NEGATIVE 0x00070000 SPELL_ATTR0_CU_PICKPOCKET = 0x00004000,
#define SPELL_ATTR0_CU_IGNORE_ARMOR 0x00080000 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<uint32> SpellCustomAttribute;
typedef std::vector<bool> EnchantCustomAttribute; typedef std::vector<bool> EnchantCustomAttribute;
@@ -1208,7 +1216,7 @@ class SpellMgr
bool IsRankSpellDueToSpell(SpellEntry const *spellInfo_1,uint32 spellId_2) const; bool IsRankSpellDueToSpell(SpellEntry const *spellInfo_1,uint32 spellId_2) const;
static bool canStackSpellRanks(SpellEntry const *spellInfo); 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; SpellEntry const* SelectAuraRankForPlayerLevel(SpellEntry const* spellInfo, uint32 playerLevel) const;