diff options
Diffstat (limited to 'src/game/SpellMgr.h')
| -rw-r--r-- | src/game/SpellMgr.h | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index f1d551298f0..be34f4af2eb 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -729,6 +729,10 @@ inline bool IsProfessionOrRidingSkill(uint32 skill) class SpellMgr { + friend struct DoSpellBonusess; + friend struct DoSpellProcEvent; + friend struct DoSpellProcItemEnchant; + // Constructors public: SpellMgr(); @@ -798,13 +802,7 @@ class SpellMgr SpellBonusMap::const_iterator itr = mSpellBonusMap.find(spellId); if( itr != mSpellBonusMap.end( ) ) return &itr->second; - // Not found, try lookup for 1 spell rank if exist - if (uint32 rank_1 = GetFirstSpellInChain(spellId)) - { - SpellBonusMap::const_iterator itr2 = mSpellBonusMap.find(rank_1); - if( itr2 != mSpellBonusMap.end( ) ) - return &itr2->second; - } + return NULL; } @@ -862,6 +860,26 @@ class SpellMgr SpellsRequiringSpellMap const& GetSpellsRequiringSpell() const { return mSpellsReqSpell; } + template<typename Worker> + void doForThisAndHighRanks(uint32 spellid, Worker& worker) + { + worker(spellid); + if(uint32 nextSpellId = GetNextSpellInChain(spellid)) + doForThisAndHighRanks(nextSpellId, worker); + } + + template<typename Worker> + void doForHighRanks(uint32 spellid, Worker& worker) + { + if(uint32 nextSpellId = GetNextSpellInChain(spellid)) + { + worker(nextSpellId); + doForHighRanks(nextSpellId, worker); + } + } + + // Note: not use rank for compare to spell ranks: spell chains isn't linear order + // Use IsHighRankOfSpell instead uint8 GetSpellRank(uint32 spell_id) const { if(SpellChainNode const* node = GetSpellChainNode(spell_id)) |
