aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game/SpellAuras.cpp3
-rw-r--r--src/game/SpellEffects.cpp12
-rw-r--r--src/game/Unit.cpp7
-rw-r--r--src/game/Unit.h1
4 files changed, 13 insertions, 10 deletions
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 053221147b4..7b92d6c924b 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -1750,8 +1750,7 @@ void AuraEffect::TriggerSpell()
if (mana)
{
mana /= 10;
- caster->SendEnergizeSpellLog(caster, 23493, mana, POWER_MANA);
- caster->ModifyPower( POWER_MANA, mana );
+ caster->EnergizeBySpell(caster, 23493, mana, POWER_MANA);
}
return;
}
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 549f79ab5f4..35e52f2208c 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -2443,10 +2443,8 @@ void Spell::EffectPowerDrain(uint32 i)
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_MULTIPLE_VALUE, manaMultiplier);
int32 gain = int32(new_damage * manaMultiplier);
-
- //send log
- m_caster->SendEnergizeSpellLog(m_caster, m_spellInfo->Id, gain, POWER_MANA);
- m_caster->ModifyPower(POWER_MANA,gain);
+
+ m_caster->EnergizeBySpell(m_caster, m_spellInfo->Id, gain, POWER_MANA);
}
}
@@ -2873,8 +2871,7 @@ void Spell::EffectEnergize(uint32 i)
if(unitTarget->GetMaxPower(power) == 0)
return;
- m_caster->SendEnergizeSpellLog(unitTarget, m_spellInfo->Id, damage, power);
- unitTarget->ModifyPower(power,damage);
+ m_caster->EnergizeBySpell(unitTarget, m_spellInfo->Id, damage, power);
// Mad Alchemist's Potion
if (m_spellInfo->Id == 45051)
@@ -2936,8 +2933,7 @@ void Spell::EffectEnergizePct(uint32 i)
return;
uint32 gain = damage * maxPower / 100;
- m_caster->SendEnergizeSpellLog(unitTarget, m_spellInfo->Id, gain, power);
- unitTarget->ModifyPower(power, gain);
+ m_caster->EnergizeBySpell(unitTarget, m_spellInfo->Id, gain, power);
}
void Spell::SendLoot(uint64 guid, LootType loottype)
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 3628b956a54..285fa93ef90 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -8943,6 +8943,13 @@ void Unit::SendEnergizeSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage, Po
SendMessageToSet(&data, true);
}
+void Unit::EnergizeBySpell(Unit *pVictim, uint32 SpellID, uint32 Damage, Powers powertype)
+{
+ SendEnergizeSpellLog(pVictim, SpellID, Damage, powertype);
+ // needs to be called after sending spell log
+ ModifyPower(powertype, Damage);
+}
+
uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack)
{
if(!spellProto || !pVictim || damagetype==DIRECT_DAMAGE )
diff --git a/src/game/Unit.h b/src/game/Unit.h
index 4be68c99354..65492676175 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -1275,6 +1275,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
void SendHealSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage, uint32 OverHeal, bool critical = false);
void SendEnergizeSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage,Powers powertype);
+ void EnergizeBySpell(Unit *pVictim, uint32 SpellID, uint32 Damage, Powers powertype);
uint32 SpellNonMeleeDamageLog(Unit *pVictim, uint32 spellID, uint32 damage);
void CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item *castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0);
void CastSpell(Unit* Victim, SpellEntry const *spellInfo, bool triggered, Item *castItem= NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0);