aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/SpellMgr.cpp43
-rw-r--r--src/game/SpellMgr.h12
-rw-r--r--src/game/Unit.cpp3
3 files changed, 31 insertions, 27 deletions
diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp
index a41c181b1d4..f13523011ba 100644
--- a/src/game/SpellMgr.cpp
+++ b/src/game/SpellMgr.cpp
@@ -137,6 +137,14 @@ SpellSpecific GetSpellSpecific(uint32 spellId)
{
case SPELLFAMILY_GENERIC:
{
+ //food/drink
+ if (spellInfo->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED)
+ for(int i = 0; i < 3; i++)
+ if( spellInfo->EffectApplyAuraName[i]==SPELL_AURA_MOD_POWER_REGEN)
+ return SPELL_DRINK;
+ else if ( spellInfo->EffectApplyAuraName[i]==SPELL_AURA_MOD_REGEN)
+ return SPELL_FOOD;
+
// this may be a hack
if((spellInfo->AttributesEx2 & SPELL_ATTR_EX2_FOOD)
&& !spellInfo->Category)
@@ -271,6 +279,8 @@ bool IsSingleFromSpellSpecificPerTarget(uint32 spellSpec1,uint32 spellSpec2)
case SPELL_ELEMENTAL_SHIELD:
case SPELL_MAGE_POLYMORPH:
case SPELL_WELL_FED:
+ case SPELL_DRINK:
+ case SPELL_FOOD:
return spellSpec1==spellSpec2;
case SPELL_BATTLE_ELIXIR:
return spellSpec2==SPELL_BATTLE_ELIXIR
@@ -1146,6 +1156,10 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2, bool
//if(spellId_1 == spellId_2) // auras due to the same spell
// return false;
+ //use data of highest rank spell(needed for spells which ranks have different effects)
+ spellId_1=GetLastSpellInChain(spellId_1);
+ spellId_2=GetLastSpellInChain(spellId_2);
+
SpellEntry const *spellInfo_1 = sSpellStore.LookupEntry(spellId_1);
SpellEntry const *spellInfo_2 = sSpellStore.LookupEntry(spellId_2);
@@ -1159,31 +1173,21 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2, bool
||(IsSingleFromSpellSpecificPerCaster(spellId_spec_1, spellId_spec_2) && sameCaster))
return true;
+ // spells with different specific always stack
+ if(spellId_spec_1 || spellId_spec_2)
+ return false;
+
if(spellInfo_1->SpellFamilyName != spellInfo_2->SpellFamilyName)
return false;
// generic spells
if(!spellInfo_1->SpellFamilyName)
{
- if(spellInfo_1->Category && spellInfo_1->Category == spellInfo_2->Category)
- {
- if(spellInfo_1->Category == SPELL_CATEGORY_FOOD ||
- spellInfo_1->Category == SPELL_CATEGORY_DRINK)
- return true;
- }
-
if(!spellInfo_1->SpellIconID
|| spellInfo_1->SpellIconID != spellInfo_2->SpellIconID)
return false;
}
- // if both elixirs are not battle/guardian/potions/flasks then always stack
- else if(spellInfo_1->SpellFamilyName == SPELLFAMILY_POTION)
- {
- if(spellId_spec_1 || spellId_spec_2)
- return false;
- }
-
// check for class spells
else
{
@@ -1212,16 +1216,6 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2, bool
}
}
- //not sure if this is correct. maybe some talent buff have same icons?
- //maybe some creature spells have same visual and same icon but should stack?
- //spells with the same icon (check needed when spell has different effects in other ranks example:Mark of the wild)
- //if(spellInfo_1->SpellIconID
- // && spellInfo_1->SpellIconID == spellInfo_2->SpellIconID)
- // return true; // maybe change this to IsRankSpellDueToSpell?
-
- if(spellInfo_1->SpellFamilyName && IsRankSpellDueToSpell(spellInfo_1, spellId_2))
- return true;
-
//if spells have exactly the same effect they cannot stack
for(uint32 i = 0; i < 3; ++i)
if(spellInfo_1->Effect[i] != spellInfo_2->Effect[i]
@@ -1231,7 +1225,6 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2, bool
return true;
}
-
bool SpellMgr::IsProfessionSpell(uint32 spellId)
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h
index c13d3a25989..638f93d534b 100644
--- a/src/game/SpellMgr.h
+++ b/src/game/SpellMgr.h
@@ -265,6 +265,8 @@ enum SpellSpecific
SPELL_FLASK_ELIXIR = 16,
SPELL_WARLOCK_CORRUPTION= 17,
SPELL_WELL_FED = 18,
+ SPELL_DRINK = 19,
+ SPELL_FOOD = 20
};
SpellSpecific GetSpellSpecific(uint32 spellId);
@@ -791,6 +793,16 @@ class SpellMgr
return 0;
}
+ uint32 GetLastSpellInChain(uint32 spell_id) const
+ {
+ if (!GetSpellChainNode(spell_id))
+ return spell_id;
+ SpellChainMapNext const& nextMap = GetSpellChainNext();
+ for(SpellChainMapNext::const_iterator itr = nextMap.lower_bound(spell_id); itr != nextMap.upper_bound(spell_id); ++itr)
+ spell_id=itr->second;
+ return spell_id;
+ }
+
uint8 IsHighRankOfSpell(uint32 spell1,uint32 spell2) const
{
SpellChainMap::const_iterator itr = mSpellChains.find(spell1);
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index c7538a12774..b7d805a437d 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -4339,8 +4339,7 @@ bool Unit::RemoveNoStackAurasDueToAura(Aura *Aur)
bool sameCaster = Aur->GetCasterGUID() == (*i).second->GetCasterGUID();
if( spellmgr.IsNoStackSpellDueToSpell(spellId, i_spellId, sameCaster) )
{
- //some spells should be not removed by lower rank of them
- // what is this spell?
+ //some spells should be not removed by lower rank of them (totem, paladin aura)
if (!sameCaster
&&(spellProto->Effect[effIndex]==SPELL_EFFECT_APPLY_AREA_AURA_PARTY)
&&(spellProto->DurationIndex==21)