From 379219aff162b75eed8e98fed926bd5c5aec10b3 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Tue, 3 Feb 2015 06:40:51 -0500 Subject: [PATCH 1/2] Implemented new pet type (5) which summons a regular pet that locks onto the casters target exclusively until the target dies, when target dies the pet is killed. (Pets don't respond to commands except get lost). This does not stack with regular pets. Note: On live these pets cast an actual spell (Unsummon) that kills them for 20k damage, due to how limiting that is to be hard coded, the pets will simply just kill themselves instead. Pending, will needd to add an optional SQL to update pet tables to convert known live spells that use this. --- zone/attack.cpp | 6 ++++++ zone/client_packet.cpp | 3 +++ zone/common.h | 2 +- zone/mob.h | 1 + zone/pets.cpp | 13 +++++++++++++ 5 files changed, 24 insertions(+), 1 deletion(-) diff --git a/zone/attack.cpp b/zone/attack.cpp index 25dc88688..280eda918 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -1508,6 +1508,9 @@ 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); @@ -2378,6 +2381,9 @@ 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/client_packet.cpp b/zone/client_packet.cpp index a3062891b..6f307c2d9 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -9863,6 +9863,9 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) return; } + if (mypet->GetPetType() == petTargetLock && (pet->command != PET_HEALTHREPORT && pet->command != PET_GETLOST)) + return; + if (mypet->GetPetType() == petAnimation && (pet->command != PET_HEALTHREPORT && pet->command != PET_GETLOST) && !GetAA(aaAnimationEmpathy)) return; diff --git a/zone/common.h b/zone/common.h index 19237d99c..20d19e94d 100644 --- a/zone/common.h +++ b/zone/common.h @@ -505,7 +505,7 @@ typedef enum { petOther, petCharmed, petNPCFollow, - petHatelist //remain active as long something is on the hatelist. Don't listen to any commands + petTargetLock //remain active as long something is on the hatelist. Don't listen to any commands } PetType; typedef enum { diff --git a/zone/mob.h b/zone/mob.h index 9641a2ffb..c2f57ff9c 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -675,6 +675,7 @@ public: bool IsFamiliar() const { return(typeofpet == petFamiliar); } bool IsAnimation() const { return(typeofpet == petAnimation); } bool IsCharmed() const { return(typeofpet == petCharmed); } + bool IsTargetLockPet() const { return(typeofpet == petTargetLock); } 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); } diff --git a/zone/pets.cpp b/zone/pets.cpp index 117b466a7..38cd16a2a 100644 --- a/zone/pets.cpp +++ b/zone/pets.cpp @@ -426,6 +426,19 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, entity_list.AddNPC(npc, true, true); SetPetID(npc->GetID()); // We need to handle PetType 5 (petHatelist), add the current target to the hatelist of the pet + + + if (record.petcontrol == petTargetLock) + { + Mob* target = GetTarget(); + + if (target){ + npc->AddToHateList(target, 1); + npc->SetSpecialAbility(IMMUNE_AGGRO, 1); + } + else + npc->Kill(); //On live casts spell 892 Unsummon (Kayen - Too limiting to use that for emu since pet can have more than 20k HP) + } } /* This is why the pets ghost - pets were being spawned too far away from its npc owner and some into walls or objects (+10), this sometimes creates the "ghost" effect. I changed to +2 (as close as I From 356316db8483f65be0b4a197e9039a7fce1007bf Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Tue, 3 Feb 2015 07:09:24 -0500 Subject: [PATCH 2/2] Optional SQL to convert all(?) live pets that should use the new pet type (5). --- .../optional/2015_02_15_UpdatePetTypes.sql | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 utils/sql/git/optional/2015_02_15_UpdatePetTypes.sql diff --git a/utils/sql/git/optional/2015_02_15_UpdatePetTypes.sql b/utils/sql/git/optional/2015_02_15_UpdatePetTypes.sql new file mode 100644 index 000000000..29ba3b03e --- /dev/null +++ b/utils/sql/git/optional/2015_02_15_UpdatePetTypes.sql @@ -0,0 +1,50 @@ +-- Updates live pets who should be type (5) - Pet locks onto target until dead. +UPDATE pets SET petcontrol = 5 WHERE type LIKE "WizSwarmSword99Rk3"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "WizSwarmSword99Rk2"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "WizSwarmSword99Rk1"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "WizSwarmSword94Rk3"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "WizSwarmSword94Rk2"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "WizSwarmSword94Rk1"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "WizSwarmSword89Rk3"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "WizSwarmSword89Rk2"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "WizSwarmSword89Rk1"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "wizard_sword_84_Rk3"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "wizard_sword_84_Rk2"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "wizard_sword_84_Rk1"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "wizard_sword_79_Rk3"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "wizard_sword_79_Rk2"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "wizard_sword_79_Rk1"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "wizard_sword_74_"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "wizard_sword_67_"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "SumSword"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "SUMHammer4"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "SUMHammer3"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "SUMHammer2"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "SUMHammer1"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "SumHammer"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "Burnout"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "SumSword"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "SumHammer"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "cleric_hammer_67_"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "cleric_hammer_73_"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "cleric_hammer_73_Rk1"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "cleric_hammer_73_Rk2"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "cleric_hammer_73_Rk3"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "cleric_hammer_78_Rk1"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "cleric_hammer_78_Rk2"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "cleric_hammer_78_Rk3"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "cleric_hammer_83_Rk1"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "cleric_hammer_83_Rk2"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "cleric_hammer_83_Rk3"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "wizard_sword_84_Rk1"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "wizard_sword_84_Rk2"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "wizard_sword_84_Rk3"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "cleric_hammer_88_Rk1"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "cleric_hammer_88_Rk2"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "cleric_hammer_88_Rk3"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "cleric_hammer_94_Rk1"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "cleric_hammer_94_Rk2"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "cleric_hammer_94_Rk3"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "cleric_hammer_99_Rk1"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "cleric_hammer_99_Rk2"; +UPDATE pets SET petcontrol = 5 WHERE type LIKE "cleric_hammer_99_Rk3";