From 15f3697df166295ef3e7aa27fce73a0df7013868 Mon Sep 17 00:00:00 2001 From: Ali Date: Fri, 17 Apr 2020 10:56:43 +0300 Subject: [PATCH] Fix edge case with NPC pet owners charming PCs * Addresses #1036 * Cleaned up if statement formatting * Using Mob::GetOwnerOrSelf() now, which accounts for the edge case NB: The Mob::SpellOnTarget() and Mob::CommonDamage() methods really should be looked at and spell logic combined somehow. Both have if statements that dodge around the other's conditions to decide which method sends the CombatDamage_Struct packet --- zone/spells.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/zone/spells.cpp b/zone/spells.cpp index be1419caa..d9378a23c 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -3979,6 +3979,8 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob *spelltar, bool reflect, bool use_r cd->hit_heading = action->hit_heading; cd->hit_pitch = action->hit_pitch; cd->damage = 0; + + auto spellOwner = GetOwnerOrSelf(); if(!IsEffectInSpell(spell_id, SE_BindAffinity) && !is_damage_or_lifetap_spell){ entity_list.QueueCloseClients( spelltar, /* Sender */ @@ -3989,14 +3991,8 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob *spelltar, bool reflect, bool use_r true, /* Packet ACK */ (spelltar->IsClient() ? FilterPCSpells : FilterNPCSpells) /* Message Filter Type: (8 or 9) */ ); - } else if (is_damage_or_lifetap_spell && - (IsClient() || - (HasOwner() && - GetOwner()->IsClient() - ) - ) - ) { - (HasOwner() ? GetOwner() : this)->CastToClient()->QueuePacket( + } else if (is_damage_or_lifetap_spell && spellOwner->IsClient()) { + spellOwner->CastToClient()->QueuePacket( message_packet, true, Mob::CLIENT_CONNECTINGALL,