[8251] Store in some DB tables only data for first rank. Author: VladimirMangos
* Allow add to DB data only for first rank in table `mangos_spell_bonus_data` and `mangos_spell_proc_event`.
* Copy data for other ranks for speedup use at loading for this data and data from `spell_proc_item_enchant`.
--HG--
branch : trunk
This commit is contained in:
+25
-7
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user