(RicardoCampos) End looting before zoning.

This commit is contained in:
JJ 2014-11-02 00:10:19 -04:00
parent 3620ac4eaf
commit 5decde0af9
4 changed files with 34 additions and 9 deletions

View File

@ -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)
{

View File

@ -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;

View File

@ -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;

View File

@ -549,7 +549,33 @@ 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) {
EQApplicationPacket* outapp = new EQApplicationPacket(OP_ZonePlayerToBind, sizeof(ZonePlayerToBind_Struct) + iZoneNameLength);