aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/updates/world/2012_11_30_00_world_spell_script_names.sql4
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp2
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp22
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp56
4 files changed, 68 insertions, 16 deletions
diff --git a/sql/updates/world/2012_11_30_00_world_spell_script_names.sql b/sql/updates/world/2012_11_30_00_world_spell_script_names.sql
new file mode 100644
index 00000000000..cedee2fe51d
--- /dev/null
+++ b/sql/updates/world/2012_11_30_00_world_spell_script_names.sql
@@ -0,0 +1,4 @@
+DELETE FROM `spell_script_names` WHERE `spell_id` IN (57669,61782);
+INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
+(57669,'spell_gen_replenishment'),
+(61782,'spell_gen_replenishment');
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 686b944d967..9e19a717790 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -6022,9 +6022,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
{
// Replenishment - roll chance
if (roll_chance_i(aurEff->GetAmount()))
- {
CastSpell(this, 57669, true, castItem, triggeredByAura);
- }
}
break;
}
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index 816f9399221..0dbadb7f6d2 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -661,20 +661,14 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
case SPELL_AURA_PERIODIC_ENERGIZE:
switch (m_spellInfo->Id)
{
- case 57669: // Replenishment (0.2% from max)
- amount = GetBase()->GetUnitOwner()->GetMaxPower(POWER_MANA) * 0.002f;
- break;
- case 61782: // Infinite Replenishment
- amount = GetBase()->GetUnitOwner()->GetMaxPower(POWER_MANA) * 0.0025f;
- break;
- case 29166: // Innervate
- ApplyPct(amount, float(GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA)) / GetTotalTicks());
- break;
- case 48391: // Owlkin Frenzy
- ApplyPct(amount, GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA));
- break;
- default:
- break;
+ case 29166: // Innervate
+ ApplyPct(amount, float(GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA)) / GetTotalTicks());
+ break;
+ case 48391: // Owlkin Frenzy
+ ApplyPct(amount, GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA));
+ break;
+ default:
+ break;
}
break;
case SPELL_AURA_PERIODIC_HEAL:
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index 026a0c7b280..2e36d3811f6 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -3305,6 +3305,61 @@ class spell_gen_gift_of_naaru : public SpellScriptLoader
}
};
+enum Replenishment
+{
+ SPELL_REPLENISHMENT = 57669,
+ SPELL_INFINITE_REPLENISHMENT = 61782
+};
+
+class spell_gen_replenishment : public SpellScriptLoader
+{
+ public:
+ spell_gen_replenishment() : SpellScriptLoader("spell_gen_replenishment") { }
+
+ class spell_gen_replenishment_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_gen_replenishment_AuraScript);
+
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_REPLENISHMENT) ||
+ !sSpellMgr->GetSpellInfo(SPELL_INFINITE_REPLENISHMENT))
+ return false;
+ return true;
+ }
+
+ bool Load()
+ {
+ return GetUnitOwner()->GetPower(POWER_MANA);
+ }
+
+ void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ switch (GetSpellInfo()->Id)
+ {
+ case SPELL_REPLENISHMENT:
+ amount = GetUnitOwner()->GetMaxPower(POWER_MANA) * 0.002f;
+ break;
+ case SPELL_INFINITE_REPLENISHMENT:
+ amount = GetUnitOwner()->GetMaxPower(POWER_MANA) * 0.0025f;
+ break;
+ default:
+ break;
+ }
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_replenishment_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_PERIODIC_ENERGIZE);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_gen_replenishment_AuraScript();
+ }
+};
+
void AddSC_generic_spell_scripts()
{
new spell_gen_absorb0_hitlimit1();
@@ -3381,4 +3436,5 @@ void AddSC_generic_spell_scripts()
new spell_gen_upper_deck_create_foam_sword();
new spell_gen_bonked();
new spell_gen_gift_of_naaru();
+ new spell_gen_replenishment();
}