mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[8251] Store in some DB tables only data for first rank.
* 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`.
This commit is contained in:
parent
fd2eb3cfee
commit
7ac4dc6f13
10 changed files with 440 additions and 225 deletions
|
|
@ -700,6 +700,13 @@ bool SpellMgr::IsAffectedByMod(SpellEntry const *spellInfo, SpellModifier *mod)
|
|||
return false;
|
||||
}
|
||||
|
||||
struct DoSpellProcEvent
|
||||
{
|
||||
DoSpellProcEvent(SpellProcEventEntry const& _spe) : spe(_spe) {}
|
||||
void operator() (uint32 spell_id) { spellmgr.mSpellProcEventMap[spell_id] = spe; }
|
||||
SpellProcEventEntry const& spe;
|
||||
};
|
||||
|
||||
void SpellMgr::LoadSpellProcEvents()
|
||||
{
|
||||
mSpellProcEventMap.clear(); // need for reload case
|
||||
|
|
@ -734,6 +741,15 @@ void SpellMgr::LoadSpellProcEvents()
|
|||
continue;
|
||||
}
|
||||
|
||||
uint32 first_id = GetFirstSpellInChain(entry);
|
||||
|
||||
if ( first_id != entry )
|
||||
{
|
||||
sLog.outErrorDb("Spell %u listed in `spell_proc_event` is not first rank (%u) in chain", entry, first_id);
|
||||
// prevent loading since it won't have an effect anyway
|
||||
continue;
|
||||
}
|
||||
|
||||
SpellProcEventEntry spe;
|
||||
|
||||
spe.schoolMask = fields[1].GetUInt32();
|
||||
|
|
@ -748,6 +764,10 @@ void SpellMgr::LoadSpellProcEvents()
|
|||
|
||||
mSpellProcEventMap[entry] = spe;
|
||||
|
||||
// also add to high ranks
|
||||
DoSpellProcEvent worker(spe);
|
||||
doForHighRanks(entry,worker);
|
||||
|
||||
if (spell->procFlags==0)
|
||||
{
|
||||
if (spe.procFlags == 0)
|
||||
|
|
@ -769,6 +789,13 @@ void SpellMgr::LoadSpellProcEvents()
|
|||
sLog.outString( ">> Loaded %u extra spell proc event conditions", count );
|
||||
}
|
||||
|
||||
struct DoSpellProcItemEnchant
|
||||
{
|
||||
DoSpellProcItemEnchant(float _ppm) : ppm(_ppm) {}
|
||||
void operator() (uint32 spell_id) { spellmgr.mSpellProcItemEnchantMap[spell_id] = ppm; }
|
||||
float ppm;
|
||||
};
|
||||
|
||||
void SpellMgr::LoadSpellProcItemEnchant()
|
||||
{
|
||||
mSpellProcItemEnchantMap.clear(); // need for reload case
|
||||
|
|
@ -808,15 +835,21 @@ void SpellMgr::LoadSpellProcItemEnchant()
|
|||
continue;
|
||||
}
|
||||
|
||||
if ( GetFirstSpellInChain(entry) != entry )
|
||||
uint32 first_id = GetFirstSpellInChain(entry);
|
||||
|
||||
if ( first_id != entry )
|
||||
{
|
||||
sLog.outErrorDb("Spell %u listed in `spell_proc_item_enchant` is not first rank in chain", entry);
|
||||
sLog.outErrorDb("Spell %u listed in `spell_proc_item_enchant` is not first rank (%u) in chain", entry, first_id);
|
||||
// prevent loading since it won't have an effect anyway
|
||||
continue;
|
||||
}
|
||||
|
||||
mSpellProcItemEnchantMap[entry] = ppmRate;
|
||||
|
||||
// also add to high ranks
|
||||
DoSpellProcItemEnchant worker(ppmRate);
|
||||
doForHighRanks(entry,worker);
|
||||
|
||||
++count;
|
||||
} while( result->NextRow() );
|
||||
|
||||
|
|
@ -826,6 +859,13 @@ void SpellMgr::LoadSpellProcItemEnchant()
|
|||
sLog.outString( ">> Loaded %u proc item enchant definitions", count );
|
||||
}
|
||||
|
||||
struct DoSpellBonusess
|
||||
{
|
||||
DoSpellBonusess(SpellBonusEntry const& _spellBonus) : spellBonus(_spellBonus) {}
|
||||
void operator() (uint32 spell_id) { spellmgr.mSpellBonusMap[spell_id] = spellBonus; }
|
||||
SpellBonusEntry const& spellBonus;
|
||||
};
|
||||
|
||||
void SpellMgr::LoadSpellBonusess()
|
||||
{
|
||||
mSpellBonusMap.clear(); // need for reload case
|
||||
|
|
@ -848,13 +888,22 @@ void SpellMgr::LoadSpellBonusess()
|
|||
bar.step();
|
||||
uint32 entry = fields[0].GetUInt32();
|
||||
|
||||
const SpellEntry *spell = sSpellStore.LookupEntry(entry);
|
||||
SpellEntry const* spell = sSpellStore.LookupEntry(entry);
|
||||
if (!spell)
|
||||
{
|
||||
sLog.outErrorDb("Spell %u listed in `spell_bonus_data` does not exist", entry);
|
||||
continue;
|
||||
}
|
||||
|
||||
uint32 first_id = GetFirstSpellInChain(entry);
|
||||
|
||||
if ( first_id != entry )
|
||||
{
|
||||
sLog.outErrorDb("Spell %u listed in `spell_bonus_data` is not first rank (%u) in chain", entry, first_id);
|
||||
// prevent loading since it won't have an effect anyway
|
||||
continue;
|
||||
}
|
||||
|
||||
SpellBonusEntry sbe;
|
||||
|
||||
sbe.direct_damage = fields[1].GetFloat();
|
||||
|
|
@ -862,6 +911,11 @@ void SpellMgr::LoadSpellBonusess()
|
|||
sbe.ap_bonus = fields[3].GetFloat();
|
||||
|
||||
mSpellBonusMap[entry] = sbe;
|
||||
|
||||
// also add to high ranks
|
||||
DoSpellBonusess worker(sbe);
|
||||
doForHighRanks(entry,worker);
|
||||
|
||||
} while( result->NextRow() );
|
||||
|
||||
delete result;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue