[9898] Implement redundent values check in spell_bonus_data

Also do table content cleanup base at added feature.

Original check code provided by nos4r2zod.
This commit is contained in:
VladimirMangos 2010-05-15 11:21:24 +04:00
parent 6e92d43237
commit 1f741a16b3
4 changed files with 104 additions and 29 deletions

View file

@ -14225,36 +14225,26 @@ INSERT INTO `spell_bonus_data` VALUES
(8921, 0.1515, 0.13, 0, 'Druid - Moonfire'),
(50464, 0.6611, 0, 0, 'Druid - Nourish'),
(8936, 0.539, 0.188, 0, 'Druid - Regrowth'),
(774, 0, 0.37604, 0, 'Druid - Rejuvenation'),
(50288, 0.05, 0, 0, 'Druid - Starfall'),
(50294, 0.012, 0, 0, 'Druid - Starfall AOE'),
(2912, 1, 0, 0, 'Druid - Starfire'),
(18562, 0, 0, 0, 'Druid - Swiftmend'),
(44203, 0.538, 0, 0, 'Druid - Tranquility Triggered'),
(61391, 0.193, 0, 0, 'Druid - Typhoon'),
(48438, 0, 0.11505, 0, 'Druid - Wild Growth'),
(5176, 0.5714, 0, 0, 'Druid - Wrath'),
/* Generic */
(54757, 0, 0, 0, 'Generic - Pyro Rocket'),
/* Mage */
(44425, 0.714286,0, 0, 'Mage - Arcane Barrage'),
(30451, 0.7143, 0, 0, 'Mage - Arcane Blast'),
(1449, 0.2128, 0, 0, 'Mage - Arcane Explosion'),
(7268, 0.2857, 0, 0, 'Mage - Arcane Missiles Triggered Spell'),
(42208, 0.1437, 0, 0, 'Mage - Blizzard Triggered'),
(2136, 0.4286, 0, 0, 'Mage - Fire Blast'),
(133, 1, 0, 0, 'Mage - Fire Ball'),
(2120, 0.2357, 0.122, 0, 'Mage - Flamestrike'),
(122, 0.193, 0, 0, 'Mage - Frost Nova'),
(116, 0.8143, 0, 0, 'Mage - Frost Bolt'),
(44614, 0.8571, 0, 0, 'Mage - Frostfire Bolt'),
(11426, 0.8053, 0, 0, 'Mage - Ice Barrier'),
(30455, 0.1429, 0, 0, 'Mage - Ice Lance'),
(44457, 0.4, 0.2, 0, 'Mage - Living Bomb'),
(1463, 0.8053, 0, 0, 'Mage - Mana Shield'),
(34913, 0, 0, 0, 'Mage - Molten Armor Triggered'),
(11366, 1.15, 0.05, 0, 'Mage - Pyroblast'),
(2948, 0.4286, 0, 0, 'Mage - Scorch'),
/* Paladin */
(26573, 0, 0.04, 0.04, 'Paladin - Consecration'),
(879, 0.15, 0, 0.15, 'Paladin - Exorcism'),
@ -14262,7 +14252,6 @@ INSERT INTO `spell_bonus_data` VALUES
(19750, 1, 0, 0, 'Paladin - Flash of Light'),
(53595, 0, 0, 0, 'Paladin - Hammer of the Righteous'),
(635, 1.66, 0, 0, 'Paladin - Holy Light'),
(25912, 0.4286, 0, 0, 'Paladin - Holy Shock Triggered Hurt'),
(20925, 0.09, 0, 0.056, 'Paladin - Holy Shield'),
(2812, 0.07, 0, 0.07, 'Paladin - Holy Wrath'),
(54158, 0.25, 0, 0, 'Paladin - Judgement'),
@ -14271,34 +14260,24 @@ INSERT INTO `spell_bonus_data` VALUES
(20267, 0.1, 0, 0.1, 'Paladin - Judgement of Light Proc'),
(31804, 0, 0, 0, 'Paladin - Judgement of Vengeance'),
(20424, 0, 0, 0, 'Paladin - Seal of Command Proc'),
(53739, 0, 0.00156, 0.003, 'Paladin - Seal of Corruption (full stack proc)'),
(53739, 0, 0, 0.003, 'Paladin - Seal of Corruption (full stack proc)'),
(25742, 0.07, 0, 0.039, 'Paladin - Seal of Righteousness Dummy Proc'),
(42463, 0, 0.00156, 0.003, 'Paladin - Seal of Vengeance (full stack proc)'),
(42463, 0, 0, 0.003, 'Paladin - Seal of Vengeance (full stack proc)'),
(53600, 0, 0, 0, 'Paladin - Shield of Righteousness'),
/* Priest */
(32546, 0.8068, 0, 0, 'Priest - Binding Heal'),
(27813, 0, 0, 0, 'Priest - Blessed Recovery'),
(34861, 0.402, 0, 0, 'Priest - Circle of Healing'),
(19236, 0.8068, 0, 0, 'Priest - Desperate Prayer'),
(2944, 0, 0.1849, 0, 'Priest - Devouring Plague'),
(63544, 0, 0, 0, 'Priest - Empowered Renew Triggered'),
(14914, 0.5711, 0.024, 0, 'Priest - Holy Fire'),
(15237, 0.1606, 0, 0, 'Priest - Holy Nova Damage'),
(2061, 0.8068, 0, 0, 'Priest - Flash Heal'),
(2060, 1.6135, 0, 0, 'Priest - Greater Heal'),
(23455, 0.3035, 0, 0, 'Priest - Holy Nova Heal'),
(63675, 0, 0, 0, 'Priest - Improved Devouring Plague Triggered'),
(8129, 0, 0, 0, 'Priest - Mana Burn'),
(58381, 0.257143,0, 0, 'Priest - Mind Flay Triggered'),
(49821, 0.14286,0, 0, 'Priest - Mind Sear Trigger'),
(49821, 0.2857, 0, 0, 'Priest - Mind Sear Trigger'),
(47666, 0.229, 0, 0, 'Priest - Penance dmg effect'),
(47750, 0.537, 0, 0, 'Priest - Penance heal effect'),
(17, 0.8068, 0, 0, 'Priest - Power Word: Shield'),
(33110, 0.8068, 0, 0, 'Priest - Prayer of Mending Heal Proc'),
(33619, 0, 0, 0, 'Priest - Reflective Shield'),
(139, 0, 0.376, 0, 'Priest - Renew'),
(32379, 0.4296, 0, 0, 'Priest - Shadow Word: Death'),
(589, 0, 0.1829, 0, 'Priest - Shadow Word: Pain'),
(34433, 0.65, 0, 0, 'Priest - Shadowfiend'),
(585, 0.714, 0, 0, 'Priest - Smite'),
(34914, 0, 0.4, 0, 'Priest - Vampiric Touch'),
@ -14306,8 +14285,6 @@ INSERT INTO `spell_bonus_data` VALUES
/* Shaman */
(974, 0.4762, 0, 0, 'Shaman - Earth Shield'),
(379, 0, 0, 0, 'Shaman - Earth Shield Triggered'),
(1064, 1.34, 0, 0, 'Shaman - Chain Heal'),
(421, 0.57, 0, 0, 'Shaman - Chain Lightning'),
(8042, 0.3858, 0, 0, 'Shaman - Earth Shock'),
(8050, 0.2142, 0.1, 0, 'Shaman - Flame Shock'),
(8026, 0.1, 0, 0, 'Shaman - Flametongue Weapon Proc'),
@ -14315,8 +14292,6 @@ INSERT INTO `spell_bonus_data` VALUES
(8034, 0.1, 0, 0, 'Shaman - Frostbrand Attack Rank 1'),
(52042, 0.045, 0, 0, 'Shaman - Healing Stream Totem Triggered Heal'),
(331, 1.6106, 0, 0, 'Shaman - Healing Wave'),
(51505, 0.5714, 0, 0, 'Shaman - Lava Burst'),
(8004, 0.8082, 0, 0, 'Shaman - Lesser Healing Wave'),
(403, 0.7143, 0, 0, 'Shaman - Lightning Bolt'),
(26364, 0.33, 0, 0, 'Shaman - Lightning Shield Proc'),
(8188, 0.1, 0, 0, 'Shaman - Magma Totam Passive'),

View file

@ -0,0 +1,9 @@
DELETE FROM `spell_bonus_data` WHERE `entry` IN (
17,122,139,421,589,774,1064,1449,2060,2061,2136,2912,2948,8004,
11426,19236,25912,30451,32379,32546,33110,34861,42463,44457,
49821,51505,53739,61391);
INSERT INTO `spell_bonus_data` VALUES
(53739, 0, 0, 0.003, 'Paladin - Seal of Corruption (full stack proc)'),
(42463, 0, 0, 0.003, 'Paladin - Seal of Vengeance (full stack proc)');
(49821, 0.2857,0, 0, 'Priest - Mind Sear Trigger'),

View file

@ -1215,6 +1215,97 @@ void SpellMgr::LoadSpellBonuses()
sbe.dot_damage = fields[2].GetFloat();
sbe.ap_bonus = fields[3].GetFloat();
bool need_dot = false;
bool need_direct = false;
uint32 x = 0; // count all, including empty, meaning: not all existed effect is DoTs/HoTs
for(int i = 0; i < MAX_EFFECT_INDEX; ++i)
{
if (!spell->Effect[i])
{
++x;
continue;
}
// DoTs/HoTs
switch(spell->EffectApplyAuraName[i])
{
case SPELL_AURA_PERIODIC_DAMAGE:
case SPELL_AURA_PERIODIC_DAMAGE_PERCENT:
case SPELL_AURA_PERIODIC_LEECH:
case SPELL_AURA_PERIODIC_HEAL:
case SPELL_AURA_OBS_MOD_HEALTH:
case SPELL_AURA_PERIODIC_MANA_LEECH:
case SPELL_AURA_OBS_MOD_MANA:
case SPELL_AURA_POWER_BURN_MANA:
need_dot = true;
++x;
break;
default:
break;
}
}
//TODO: maybe add explicit list possible direct damage spell effects...
if (x < MAX_EFFECT_INDEX)
need_direct = true;
// Check if direct_bonus is needed in `spell_bonus_data`
float direct_calc;
float direct_diff = 1000.0f; // for have big diff if no DB field value
if (sbe.direct_damage)
{
bool isHeal = false;
for(int i = 0; i < 3; ++i)
{
// Heals (Also count Mana Shield and Absorb effects as heals)
if (spell->Effect[i] == SPELL_EFFECT_HEAL || spell->Effect[i] == SPELL_EFFECT_HEAL_MAX_HEALTH ||
(spell->Effect[i] == SPELL_EFFECT_APPLY_AURA && (spell->EffectApplyAuraName[i] == SPELL_AURA_SCHOOL_ABSORB || spell->EffectApplyAuraName[i] == SPELL_AURA_PERIODIC_HEAL)) )
{
isHeal = true;
break;
}
}
direct_calc = CalculateDefaultCoefficient(spell, SPELL_DIRECT_DAMAGE) * (isHeal ? 1.88f : 1.0f);
direct_diff = std::abs(sbe.direct_damage - direct_calc);
}
// Check if dot_bonus is needed in `spell_bonus_data`
float dot_calc;
float dot_diff = 1000.0f; // for have big diff if no DB field value
if (sbe.dot_damage)
{
bool isHeal = false;
for(int i = 0; i < 3; ++i)
{
// Periodic Heals
if (spell->Effect[i] == SPELL_EFFECT_APPLY_AURA && spell->EffectApplyAuraName[i] == SPELL_AURA_PERIODIC_HEAL)
{
isHeal = true;
break;
}
}
dot_calc = CalculateDefaultCoefficient(spell, DOT) * (isHeal ? 1.88f : 1.0f);
dot_diff = std::abs(sbe.dot_damage - dot_calc);
}
if (direct_diff < 0.02f && !need_dot && !sbe.ap_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)
{
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)
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)
sLog.outErrorDb("`spell_bonus_data` entry for spell %u `direct_bonus` not used (spell not have non-periodic affects)", entry);
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);
mSpellBonusMap[entry] = sbe;
// also add to high ranks

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "9897"
#define REVISION_NR "9898"
#endif // __REVISION_NR_H__