Add expedition event loot api

Add SetLootEventByNPCTypeID and SetLootEventBySpawnID quest apis

These associate events with npcs or entities inside the dz to prevent
them from being looted by characters that didn't receive the event
lockout from the current expedition.

This fixes an exploit that allowed a player that already had a lockout
from another expedition being added to loot after the event is complete
This commit is contained in:
hg
2020-06-14 19:21:46 -04:00
parent 06d84b83de
commit f97cc7cdec
9 changed files with 143 additions and 28 deletions
+15
View File
@@ -38,6 +38,7 @@ Child of the Mob class.
#include "corpse.h"
#include "entity.h"
#include "expedition.h"
#include "groups.h"
#include "mob.h"
#include "raids.h"
@@ -1275,6 +1276,20 @@ void Corpse::LootItem(Client *client, const EQApplicationPacket *app)
return;
}
if (zone && zone->GetInstanceID() != 0)
{
// expeditions may prevent looting based on client's lockouts
auto expedition = Expedition::FindCachedExpeditionByInstanceID(zone->GetInstanceID());
if (expedition && !expedition->CanClientLootCorpse(client, GetNPCTypeID(), GetID()))
{
client->MessageString(Chat::Red, LOOT_NOT_ALLOWED, inst->GetItem()->Name);
client->QueuePacket(app);
SendEndLootErrorPacket(client);
ResetLooter();
delete inst;
return;
}
}
// do we want this to have a fail option too?
parse->EventItem(EVENT_LOOT, client, inst, this, buf, 0);