diff options
-rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 54 | ||||
-rw-r--r-- | src/server/game/Spells/SpellEffects.cpp | 10 |
2 files changed, 35 insertions, 29 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 7d9a2e6ca1d..e559b7738e0 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -725,34 +725,8 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa } Kill(pVictim, durabilityLoss); - - //Hook for OnPVPKill Event - if (this->GetTypeId() == TYPEID_PLAYER) - { - if (pVictim->GetTypeId() == TYPEID_PLAYER) - { - Player *killer = this->ToPlayer(); - Player *killed = pVictim->ToPlayer(); - sScriptMgr.OnPVPKill(killer, killed); - } - else if (pVictim->GetTypeId() == TYPEID_UNIT) - { - Player *killer = this->ToPlayer(); - Creature *killed = pVictim->ToCreature(); - sScriptMgr.OnCreatureKill(killer, killed); - } - } - else if (this->GetTypeId() == TYPEID_UNIT) - { - if (pVictim->GetTypeId() == TYPEID_PLAYER) - { - Creature *killer = this->ToCreature(); - Player *killed = pVictim->ToPlayer(); - sScriptMgr.OnPlayerKilledByCreature(killer, killed); - } - } } - else // if (health <= damage) + else // if (health > damage) { sLog.outStaticDebug("DealDamageAlive"); @@ -15295,6 +15269,32 @@ void Unit::Kill(Unit *pVictim, bool durabilityLoss) else if (GetTypeId() == TYPEID_PLAYER && pVictim != this) pVictim->ToPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_PLAYER, 1, this->ToPlayer()->GetTeam()); } + + //Hook for OnPVPKill Event + if (this->GetTypeId() == TYPEID_PLAYER) + { + if (pVictim->GetTypeId() == TYPEID_PLAYER) + { + Player *killer = this->ToPlayer(); + Player *killed = pVictim->ToPlayer(); + sScriptMgr.OnPVPKill(killer, killed); + } + else if (pVictim->GetTypeId() == TYPEID_UNIT) + { + Player *killer = this->ToPlayer(); + Creature *killed = pVictim->ToCreature(); + sScriptMgr.OnCreatureKill(killer, killed); + } + } + else if (this->GetTypeId() == TYPEID_UNIT) + { + if (pVictim->GetTypeId() == TYPEID_PLAYER) + { + Creature *killer = this->ToCreature(); + Player *killed = pVictim->ToPlayer(); + sScriptMgr.OnPlayerKilledByCreature(killer, killed); + } + } } void Unit::SetControlled(bool apply, UnitState state) diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 3de0b5258b7..dd56072298d 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -293,7 +293,13 @@ void Spell::EffectInstaKill(SpellEffIndex /*effIndex*/) if (m_caster == unitTarget) // prevent interrupt message finish(); - m_caster->DealDamage(unitTarget, unitTarget->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + WorldPacket data(SMSG_SPELLINSTAKILLLOG, 8+8+4); + data << uint64(m_caster->GetGUID()); + data << uint64(unitTarget->GetGUID()); + data << uint32(m_spellInfo->Id); + m_caster->SendMessageToSet(&data, true); + + m_caster->DealDamage(unitTarget, unitTarget->GetHealth(), NULL, NODAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); } void Spell::EffectEnvirinmentalDMG(SpellEffIndex effIndex) @@ -1268,7 +1274,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex) if (!unitTarget && unitTarget->GetEntry() != 26452 && unitTarget->HealthAbovePct(95)) return; - m_caster->DealDamage(unitTarget, unitTarget->CountPctFromMaxHealth(93)); + m_caster->DealDamage(unitTarget, unitTarget->CountPctFromMaxHealth(93)); return; } case 49357: // Brewfest Mount Transformation |