diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 207468825..7a1d36a4e 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -5501,7 +5501,7 @@ void Client::Handle_OP_EndLootRequest(const EQApplicationPacket *app) return; } - SetLooting(false); + SetLooting(0); Entity* entity = entity_list.GetID(*((uint16*)app->pBuffer)); if (entity == 0) { @@ -9343,8 +9343,6 @@ void Client::Handle_OP_LootRequest(const EQApplicationPacket *app) return; } - SetLooting(true); - Entity* ent = entity_list.GetID(*((uint32*)app->pBuffer)); if (ent == 0) { Message(13, "Error: OP_LootRequest: Corpse not found (ent = 0)"); @@ -9353,6 +9351,7 @@ void Client::Handle_OP_LootRequest(const EQApplicationPacket *app) } if (ent->IsCorpse()) { + SetLooting(ent->GetID()); //store the entity we are looting Corpse *ent_corpse = ent->CastToCorpse(); if (DistNoRootNoZ(ent_corpse->GetX(), ent_corpse->GetY()) > 625) { diff --git a/zone/mob.cpp b/zone/mob.cpp index 9fb113392..a56a29c05 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -264,7 +264,7 @@ Mob::Mob(const char* in_name, logging_enabled = false; isgrouped = false; israidgrouped = false; - islooting = false; + entity_id_being_looted = 0; _appearance = eaStanding; pRunAnimSpeed = 0; diff --git a/zone/mob.h b/zone/mob.h index dc43f8349..61e51a0a9 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -801,8 +801,8 @@ public: void SetGrouped(bool v); inline bool IsRaidGrouped() const { return israidgrouped; } void SetRaidGrouped(bool v); - inline bool IsLooting() const { return islooting; } - void SetLooting(bool val) { islooting = val; } + inline bool IsLooting() const { return entity_id_being_looted; } + void SetLooting(uint16 val) { entity_id_being_looted = val; } bool CheckWillAggro(Mob *mob); @@ -927,7 +927,7 @@ protected: bool isgrouped; bool israidgrouped; bool pendinggroup; - bool islooting; + uint16 entity_id_being_looted; //the id of the entity being looted, 0 if not looting. uint8 texture; uint8 helmtexture; diff --git a/zone/zoning.cpp b/zone/zoning.cpp index 6a8abb6d4..42d07810a 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -549,9 +549,35 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z break; } - if(ReadyToZone) { + if (ReadyToZone) + { + //if client is looting, we need to send an end loot + if (IsLooting()) + { + Entity* entity = entity_list.GetID(entity_id_being_looted); + if (entity == 0) + { + Message(13, "Error: OP_EndLootRequest: Corpse not found (ent = 0)"); + if (GetClientVersion() >= EQClientSoD) + Corpse::SendEndLootErrorPacket(this); + else + Corpse::SendLootReqErrorPacket(this); + } + else if (!entity->IsCorpse()) + { + Message(13, "Error: OP_EndLootRequest: Corpse not found (!entity->IsCorpse())"); + Corpse::SendLootReqErrorPacket(this); + } + else + { + Corpse::SendEndLootErrorPacket(this); + entity->CastToCorpse()->EndLoot(this, nullptr); + } + SetLooting(0); + } + zone_mode = zm; - if(zm == ZoneToBindPoint) { + if (zm == ZoneToBindPoint) { EQApplicationPacket* outapp = new EQApplicationPacket(OP_ZonePlayerToBind, sizeof(ZonePlayerToBind_Struct) + iZoneNameLength); ZonePlayerToBind_Struct* gmg = (ZonePlayerToBind_Struct*) outapp->pBuffer;