From 33767aeb912f9234b5eb8f1426865275f9c8dcd9 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Tue, 3 Feb 2015 07:59:29 -0500 Subject: [PATCH] Improvements to the pet type (5) code. --- zone/attack.cpp | 6 ------ zone/mob.cpp | 1 + zone/mob.h | 3 +++ zone/npc.cpp | 10 ++++++++++ zone/pets.cpp | 1 + 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/zone/attack.cpp b/zone/attack.cpp index 280eda918..25dc88688 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -1508,9 +1508,6 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes att } } } - - if (killerMob && killerMob->IsPet() && killerMob->GetPetType() == petTargetLock && killerMob->GetID() != GetID()) - killerMob->Kill(); } entity_list.RemoveFromTargets(this); @@ -2381,9 +2378,6 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack } } - if (killerMob && killerMob->IsPet() && killerMob->GetPetType() == petTargetLock && killerMob->GetID() != GetID()) - killerMob->Kill(); - WipeHateList(); p_depop = true; if(killerMob && killerMob->GetTarget() == this) //we can kill things without having them targeted diff --git a/zone/mob.cpp b/zone/mob.cpp index a54881298..68ed1e35d 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -300,6 +300,7 @@ Mob::Mob(const char* in_name, focused = false; _IsTempPet = false; pet_owner_client = false; + pet_targetlock_id = 0; attacked_count = 0; mezzed = false; diff --git a/zone/mob.h b/zone/mob.h index c2f57ff9c..c37eae706 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -676,6 +676,8 @@ public: bool IsAnimation() const { return(typeofpet == petAnimation); } bool IsCharmed() const { return(typeofpet == petCharmed); } bool IsTargetLockPet() const { return(typeofpet == petTargetLock); } + inline uint32 GetPetTargetLockID() { return pet_targetlock_id; }; + inline void SetPetTargetLockID(uint32 value) { pet_targetlock_id = value; }; void SetOwnerID(uint16 NewOwnerID); inline uint16 GetOwnerID() const { return ownerid; } inline virtual bool HasOwner() { if(GetOwnerID()==0){return false;} return( entity_list.GetMob(GetOwnerID()) != 0); } @@ -1245,6 +1247,7 @@ protected: bool _IsTempPet; int16 count_TempPet; bool pet_owner_client; //Flags regular and pets as belonging to a client + uint32 pet_targetlock_id; EGNode *_egnode; //the EG node we are in glm::vec3 m_TargetLocation; diff --git a/zone/npc.cpp b/zone/npc.cpp index 9a142f128..5d180e994 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -2419,4 +2419,14 @@ void NPC::DepopSwarmPets() } } } + + if (IsPet() && GetPetType() == petTargetLock && GetPetTargetLockID()){ + + Mob *targMob = entity_list.GetMob(GetPetTargetLockID()); + + if(!targMob || (targMob && targMob->IsCorpse())){ + Kill(); + return; + } + } } diff --git a/zone/pets.cpp b/zone/pets.cpp index 38cd16a2a..871e9bc6c 100644 --- a/zone/pets.cpp +++ b/zone/pets.cpp @@ -434,6 +434,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, if (target){ npc->AddToHateList(target, 1); + npc->SetPetTargetLockID(target->GetID()); npc->SetSpecialAbility(IMMUNE_AGGRO, 1); } else