mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[7801] Apply damage mods from scripts or target state not in DealDamage but in new function before send data to client.
* Fixed bug with health decrease (client side visual bug) at spell damage by target with AI::DamageTaken damage set to 0 * Fixed bug with ignore .die command and instant kill damage in some cases.
This commit is contained in:
parent
b9cd3ffd0d
commit
f53d06ad70
8 changed files with 80 additions and 31 deletions
|
|
@ -3418,31 +3418,34 @@ bool ChatHandler::HandleDamageCommand(const char * args)
|
|||
|
||||
Unit* target = getSelectedUnit();
|
||||
|
||||
if(!target || !m_session->GetPlayer()->GetSelection())
|
||||
if (!target || !m_session->GetPlayer()->GetSelection())
|
||||
{
|
||||
SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if( !target->isAlive() )
|
||||
if (!target->isAlive())
|
||||
return true;
|
||||
|
||||
char* damageStr = strtok((char*)args, " ");
|
||||
if(!damageStr)
|
||||
if (!damageStr)
|
||||
return false;
|
||||
|
||||
int32 damage = atoi((char*)damageStr);
|
||||
if(damage <=0)
|
||||
int32 damage_int = atoi((char*)damageStr);
|
||||
if(damage_int <=0)
|
||||
return true;
|
||||
|
||||
uint32 damage = damage_int;
|
||||
|
||||
char* schoolStr = strtok((char*)NULL, " ");
|
||||
|
||||
// flat melee damage without resistence/etc reduction
|
||||
if(!schoolStr)
|
||||
if (!schoolStr)
|
||||
{
|
||||
m_session->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
|
||||
m_session->GetPlayer()->SendAttackStateUpdate (HITINFO_NORMALSWING2, target, 1, SPELL_SCHOOL_MASK_NORMAL, damage, 0, 0, VICTIMSTATE_NORMAL, 0);
|
||||
if (target != m_session->GetPlayer())
|
||||
m_session->GetPlayer()->SendAttackStateUpdate (HITINFO_NORMALSWING2, target, 1, SPELL_SCHOOL_MASK_NORMAL, damage, 0, 0, VICTIMSTATE_NORMAL, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -3458,7 +3461,7 @@ bool ChatHandler::HandleDamageCommand(const char * args)
|
|||
char* spellStr = strtok((char*)NULL, " ");
|
||||
|
||||
// melee damage by specific school
|
||||
if(!spellStr)
|
||||
if (!spellStr)
|
||||
{
|
||||
uint32 absorb = 0;
|
||||
uint32 resist = 0;
|
||||
|
|
@ -3470,6 +3473,7 @@ bool ChatHandler::HandleDamageCommand(const char * args)
|
|||
|
||||
damage -= absorb + resist;
|
||||
|
||||
m_session->GetPlayer()->DealDamageMods(target,damage,&absorb);
|
||||
m_session->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, schoolmask, NULL, false);
|
||||
m_session->GetPlayer()->SendAttackStateUpdate (HITINFO_NORMALSWING2, target, 1, schoolmask, damage, absorb, resist, VICTIMSTATE_NORMAL, 0);
|
||||
return true;
|
||||
|
|
@ -3479,7 +3483,7 @@ bool ChatHandler::HandleDamageCommand(const char * args)
|
|||
|
||||
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
|
||||
uint32 spellid = extractSpellIdFromLink((char*)args);
|
||||
if(!spellid || !sSpellStore.LookupEntry(spellid))
|
||||
if (!spellid || !sSpellStore.LookupEntry(spellid))
|
||||
return false;
|
||||
|
||||
m_session->GetPlayer()->SpellNonMeleeDamageLog(target, spellid, damage);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue