diff options
| author | megamage <none@none> | 2009-04-23 22:02:41 -0500 |
|---|---|---|
| committer | megamage <none@none> | 2009-04-23 22:02:41 -0500 |
| commit | 892053938ee612588b7662e681cedf8c758b469a (patch) | |
| tree | 5b8c1f1c4e329ae81d29eace39683ef3dc7b2f73 /src/game/Unit.cpp | |
| parent | bd56af12949ac649fea185e3481d7ca05bb25660 (diff) | |
[7701] Move explicit healing repeating code to DealHeal functions. Author: Trazom
--HG--
branch : trunk
Diffstat (limited to 'src/game/Unit.cpp')
| -rw-r--r-- | src/game/Unit.cpp | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index fe89baacaf1..e1a37aec703 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -8141,6 +8141,21 @@ void Unit::SetCharm(Unit* charm, bool apply) } } +int32 Unit::DealHeal(Unit *pVictim, uint32 addhealth, SpellEntry const *spellProto, bool critical) +{ + int32 gain = pVictim->ModifyHealth(int32(addhealth)); + + if (GetTypeId()==TYPEID_PLAYER) + { + SendHealSpellLog(pVictim, spellProto->Id, addhealth, critical, gain); + + if (BattleGround *bg = ((Player*)this)->GetBattleGround()) + bg->UpdatePlayerScore((Player*)this, SCORE_HEALING_DONE, gain); + } + + return gain; +} + Unit* Unit::SelectMagnetTarget(Unit *victim, SpellEntry const *spellInfo) { if(!victim) @@ -8324,21 +8339,15 @@ void Unit::UnsummonAllTotems() } } -void Unit::SendHealSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage, bool critical, int32 * Gain ) +void Unit::SendHealSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage, bool critical, int32 gain) { // we guess size WorldPacket data(SMSG_SPELLHEALLOG, (8+8+4+4+1)); data.append(pVictim->GetPackGUID()); data.append(GetPackGUID()); data << uint32(SpellID); - int32 gainAmount; - if (!Gain) - gainAmount = pVictim->GetHealthGain(Damage); - else - gainAmount = *Gain; - data << uint32(Damage); - data << uint32(Damage-gainAmount >0 ? Damage-gainAmount : 0); // overheal + data << uint32((int32)Damage > gain ? (int32)Damage - gain : 0); // overheal data << uint8(critical ? 1 : 0); data << uint8(0); // unused in client? SendMessageToSet(&data, true); |
