EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Archive::Development (https://www.eqemulator.org/forums/forumdisplay.php?f=621)
-   -   Code: Exp from pet kills and a pointer check (https://www.eqemulator.org/forums/showthread.php?t=4782)

IASoveraign 01-13-2003 05:17 PM

Code: Exp from pet kills and a pointer check
 
Small changes to attack.cpp.

NPC::Attack
Added a pointer check that keeps the zone from crashing in one instance.

NPC::Death
Adjusted the death code exp to be like eqlive (i.e. gives exp if PC pet gets last hit and you are "killer" but not if last hit was NPC or NPC pet).

Diff against attack.cpp 1.1.1.10
Code:

--- attack.cpp.orig        2003-01-13 20:54:10.000000000 -0600
+++ attack.cpp        2003-01-13 22:48:50.000000000 -0600
@@ -735,6 +735,11 @@
    if (!target)
        SetTarget(other);
 
+        // "other" can be NULL here it seems on the second attack if the first one
+        // killed its target.  -- Soveraign
+        if (!other)
+                return false;
+
    SetAttackTimer();
    if((other->GetHP() <= -11) || (other->IsClient() && other->CastToClient()->dead) || (zone->IsGuildWars() && (CastToNPC()->IsCityController()) || (target->IsNPC() && target->CastToNPC()->IsCityController())))
        {
@@ -1067,7 +1072,13 @@
                hate_list.Add(other, damage);
        }
       
-        if (killer && killer->IsClient() && other && other->IsClient())
+
+        // Killer gets EXP if mob getting last hit was a PC or a PC's pet. -- Soveraign
+        if ( (killer && killer->IsClient()) &&
+                ( (other && other->IsClient()) ||
+                  (other && other->IsNPC() && other->GetOwner() && other->GetOwner()->IsClient())
+                )
+          )
        {
                if (killer->CastToClient()->isgrouped && entity_list.GetGroupByClient(killer->CastToClient()) != 0)
                        entity_list.GetGroupByClient(killer->CastToClient())->SplitExp(level*level*75*3.5f, GetLevel());



All times are GMT -4. The time now is 03:25 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.