From 7011395d4c7df74e95ca0d6b394f91699e750207 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sun, 31 May 2015 00:09:59 -0400 Subject: [PATCH] Pet target in UF+ I think older clients might have something like this that sets some spawn data, but these are the only clients that display something --- common/emu_oplist.h | 1 + utils/patches/patch_RoF.conf | 1 + utils/patches/patch_RoF2.conf | 1 + utils/patches/patch_UF.conf | 1 + zone/pets.cpp | 16 ++++++++++++++++ zone/pets.h | 1 + 6 files changed, 21 insertions(+) diff --git a/common/emu_oplist.h b/common/emu_oplist.h index c51e4b600..e4793826e 100644 --- a/common/emu_oplist.h +++ b/common/emu_oplist.h @@ -348,6 +348,7 @@ N(OP_OpenTributeMaster), N(OP_PDeletePetition), N(OP_PetBuffWindow), N(OP_PetCommands), +N(OP_PetHoTT), N(OP_Petition), N(OP_PetitionBug), N(OP_PetitionCheckIn), diff --git a/utils/patches/patch_RoF.conf b/utils/patches/patch_RoF.conf index 02d7c9bb8..6e3f0ab1a 100644 --- a/utils/patches/patch_RoF.conf +++ b/utils/patches/patch_RoF.conf @@ -194,6 +194,7 @@ OP_Consent=0x400e OP_ConsentDeny=0x34c1 OP_AutoFire=0x314e OP_PetCommands=0x0093 +OP_PetHoTT=0x0df4 OP_DeleteSpell=0x305c OP_Surname=0x1a87 OP_ClearSurname=0x17b6 diff --git a/utils/patches/patch_RoF2.conf b/utils/patches/patch_RoF2.conf index 312f725fe..1ebf05442 100644 --- a/utils/patches/patch_RoF2.conf +++ b/utils/patches/patch_RoF2.conf @@ -193,6 +193,7 @@ OP_Consent=0x1fd1 OP_ConsentDeny=0x7a45 OP_AutoFire=0x241e OP_PetCommands=0x0159 +OP_PetHoTT=0x794a OP_DeleteSpell=0x3358 OP_Surname=0x0423 OP_ClearSurname=0x3fb0 diff --git a/utils/patches/patch_UF.conf b/utils/patches/patch_UF.conf index cbe57e399..6f94c92db 100644 --- a/utils/patches/patch_UF.conf +++ b/utils/patches/patch_UF.conf @@ -197,6 +197,7 @@ OP_Consent=0x6bb9 # C OP_ConsentDeny=0x4cd1 # C OP_AutoFire=0x5db5 # C OP_PetCommands=0x7706 # C +OP_PetHoTT=0x2528 OP_DeleteSpell=0x0698 # C OP_Surname=0x44ae # C OP_ClearSurname=0x6705 # C diff --git a/zone/pets.cpp b/zone/pets.cpp index 908b756d4..e096328b9 100644 --- a/zone/pets.cpp +++ b/zone/pets.cpp @@ -457,6 +457,22 @@ Pet::Pet(NPCType *type_data, Mob *owner, PetType type, uint16 spell_id, int16 po // Class should use npc constructor to set light properties } +void Pet::SetTarget(Mob *mob) +{ + if (mob == GetTarget()) + return; + + auto owner = GetOwner(); + if (owner && owner->IsClient() && owner->CastToClient()->GetClientVersionBit() & BIT_UFAndLater) { + auto app = new EQApplicationPacket(OP_PetHoTT, sizeof(ClientTarget_Struct)); + auto ct = (ClientTarget_Struct *)app->pBuffer; + ct->new_target = mob ? mob->GetID() : 0; + owner->CastToClient()->QueuePacket(app); + safe_delete(app); + } + NPC::SetTarget(mob); +} + bool ZoneDatabase::GetPetEntry(const char *pet_type, PetRecord *into) { return GetPoweredPetEntry(pet_type, 0, into); } diff --git a/zone/pets.h b/zone/pets.h index f0c71fbe7..32ca00eac 100644 --- a/zone/pets.h +++ b/zone/pets.h @@ -39,6 +39,7 @@ struct NPCType; class Pet : public NPC { public: Pet(NPCType *type_data, Mob *owner, PetType type, uint16 spell_id, int16 power); + virtual void SetTarget(Mob *mob); };