[10742] Add spell_bonus_data.spell_bonus_data field and support for RAP bonuses use for spells damage from table.

Thanks to insider42 for prepering patch for mangos repo.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>

Also added loading check for redundant ap/ap_dot data in table.
This commit is contained in:
QAston 2010-11-19 05:15:22 +03:00 committed by VladimirMangos
parent 21d63d491b
commit f27741460f
8 changed files with 157 additions and 133 deletions

View file

@ -1343,7 +1343,7 @@ void SpellMgr::LoadSpellBonuses()
mSpellBonusMap.clear(); // need for reload case
uint32 count = 0;
// 0 1 2 3
QueryResult *result = WorldDatabase.Query("SELECT entry, direct_bonus, dot_bonus, ap_bonus FROM spell_bonus_data");
QueryResult *result = WorldDatabase.Query("SELECT entry, direct_bonus, dot_bonus, ap_bonus, ap_dot_bonus FROM spell_bonus_data");
if( !result )
{
barGoLink bar( 1 );
@ -1381,6 +1381,7 @@ void SpellMgr::LoadSpellBonuses()
sbe.direct_damage = fields[1].GetFloat();
sbe.dot_damage = fields[2].GetFloat();
sbe.ap_bonus = fields[3].GetFloat();
sbe.ap_dot_bonus = fields[4].GetFloat();
bool need_dot = false;
bool need_direct = false;
@ -1455,17 +1456,17 @@ void SpellMgr::LoadSpellBonuses()
dot_diff = std::abs(sbe.dot_damage - dot_calc);
}
if (direct_diff < 0.02f && !need_dot && !sbe.ap_bonus)
if (direct_diff < 0.02f && !need_dot && !sbe.ap_bonus && !sbe.ap_dot_bonus)
sLog.outErrorDb("`spell_bonus_data` entry for spell %u `direct_bonus` not needed (data from table: %f, calculated %f, difference of %f) and `dot_bonus` also not used",
entry, sbe.direct_damage, direct_calc, direct_diff);
else if (direct_diff < 0.02f && dot_diff < 0.02f && !sbe.ap_bonus)
else if (direct_diff < 0.02f && dot_diff < 0.02f && !sbe.ap_bonus && !sbe.ap_dot_bonus)
{
sLog.outErrorDb("`spell_bonus_data` entry for spell %u `direct_bonus` not needed (data from table: %f, calculated %f, difference of %f) and ",
entry, sbe.direct_damage, direct_calc, direct_diff);
sLog.outErrorDb(" ... `dot_bonus` not needed (data from table: %f, calculated %f, difference of %f)",
sbe.dot_damage, dot_calc, dot_diff);
}
else if (!need_direct && dot_diff < 0.02f && !sbe.ap_bonus)
else if (!need_direct && dot_diff < 0.02f && !sbe.ap_bonus && !sbe.ap_dot_bonus)
sLog.outErrorDb("`spell_bonus_data` entry for spell %u `dot_bonus` not needed (data from table: %f, calculated %f, difference of %f) and direct also not used",
entry, sbe.dot_damage, dot_calc, dot_diff);
else if (!need_direct && sbe.direct_damage)
@ -1473,6 +1474,11 @@ void SpellMgr::LoadSpellBonuses()
else if (!need_dot && sbe.dot_damage)
sLog.outErrorDb("`spell_bonus_data` entry for spell %u `dot_bonus` not used (spell not have periodic affects)", entry);
if (!need_direct && sbe.ap_bonus)
sLog.outErrorDb("`spell_bonus_data` entry for spell %u `ap_bonus` not used (spell not have non-periodic affects)", entry);
else if (!need_dot && sbe.ap_dot_bonus)
sLog.outErrorDb("`spell_bonus_data` entry for spell %u `ap_dot_bonus` not used (spell not have periodic affects)", entry);
mSpellBonusMap[entry] = sbe;
// also add to high ranks