mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 10:31:29 +00:00
Move PetHoTT to NPC::SetTarget for charmed pets
This commit is contained in:
parent
df0004c1b0
commit
37bedfe9ba
20
zone/npc.cpp
20
zone/npc.cpp
@ -436,6 +436,26 @@ void NPC::SetTarget(Mob* mob) {
|
||||
//attack_timer.Disable();
|
||||
attack_dw_timer.Disable();
|
||||
}
|
||||
|
||||
// either normal pet and owner is client or charmed pet and owner is client
|
||||
Mob *owner = nullptr;
|
||||
if (IsPet() && IsPetOwnerClient()) {
|
||||
owner = GetOwner();
|
||||
} else if (IsCharmed()) {
|
||||
owner = GetOwner();
|
||||
if (owner && !owner->IsClient())
|
||||
owner = nullptr;
|
||||
}
|
||||
|
||||
if (owner) {
|
||||
auto client = owner->CastToClient();
|
||||
if (client->ClientVersionBit() & EQEmu::versions::bit_UFAndLater) {
|
||||
auto app = new EQApplicationPacket(OP_PetHoTT, sizeof(ClientTarget_Struct));
|
||||
auto ct = (ClientTarget_Struct *)app->pBuffer;
|
||||
ct->new_target = mob ? mob->GetID() : 0;
|
||||
client->FastQueuePacket(&app);
|
||||
}
|
||||
}
|
||||
Mob::SetTarget(mob);
|
||||
}
|
||||
|
||||
|
||||
@ -475,22 +475,6 @@ 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()->ClientVersionBit() & EQEmu::versions::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);
|
||||
}
|
||||
|
||||
@ -7,7 +7,6 @@ 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);
|
||||
virtual bool CheckSpellLevelRestriction(uint16 spell_id);
|
||||
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user