eqemu-server/zone/lua_corpse.h
Kinglykrab 26299354b6
[Quest API] Adds new methods to NPCs and Corpses (#1510)
- Add $npc->HasItem(item_id) to Perl.
- Add $npc->CountItem(item_id) to Perl.
- Add $npc->GetItemIDBySlot(loot_slot) to Perl.
- Add $npc->GetFirstSlotByItemID(item_id) to Perl.
- Add $corpse->HasItem(item_id) to Perl.
- Add $corpse->CountItem(item_id) to Perl.
- Add $corpse->GetItemIDBySlot(loot_slot) to Perl.
- Add $corpse->GetFirstSlotByItemID(item_id) to Perl.
- Add npc:HasItem(item_id) to Lua.
- Add npc:CountItem(item_id) to Lua.
- Add npc:GetItemIDBySlot(loot_slot) to Lua.
- Add npc:GetFirstSlotByItemID(item_id) to Lua.
- Add corpse:HasItem(item_id) to Lua.
- Add corpse:CountItem(item_id) to Lua.
- Add corpse:GetItemIDBySlot(loot_slot) to Lua.
- Add corpse:GetFirstSlotByItemID(item_id) to Lua.

These methods will allow server operators to view the loot a current has in a slot, the first slot found by item ID, count the item by ID, and see if the NPC has the item.

With that functionality you could build a custom loot system and modify loot more dynamically.
2021-08-31 00:42:08 -05:00

65 lines
1.5 KiB
C++

#ifndef EQEMU_LUA_CORPSE_H
#define EQEMU_LUA_CORPSE_H
#ifdef LUA_EQEMU
#include "lua_mob.h"
class Corpse;
class Lua_Client;
namespace luabind {
struct scope;
}
luabind::scope lua_register_corpse();
class Lua_Corpse : public Lua_Mob
{
typedef Corpse NativeType;
public:
Lua_Corpse() { SetLuaPtrData(nullptr); }
Lua_Corpse(Corpse *d) { SetLuaPtrData(reinterpret_cast<Entity*>(d)); }
virtual ~Lua_Corpse() { }
operator Corpse*() {
return reinterpret_cast<Corpse*>(GetLuaPtrData());
}
uint32 GetCharID();
uint32 GetDecayTime();
void Lock();
void UnLock();
bool IsLocked();
void ResetLooter();
uint32 GetDBID();
bool IsRezzed();
const char *GetOwnerName();
bool Save();
void Delete();
void Bury();
void Depop();
uint32 CountItems();
void AddItem(uint32 itemnum, uint16 charges, int16 slot, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5);
uint32 GetWornItem(int16 equipSlot);
void RemoveItem(uint16 lootslot);
void SetCash(uint32 copper, uint32 silver, uint32 gold, uint32 platinum);
void RemoveCash();
bool IsEmpty();
void SetDecayTimer(uint32 decaytime);
bool CanMobLoot(int charid);
void AllowMobLoot(Lua_Mob them, uint8 slot);
bool Summon(Lua_Client client, bool spell, bool checkdistance);
uint32 GetCopper();
uint32 GetSilver();
uint32 GetGold();
uint32 GetPlatinum();
void AddLooter(Lua_Mob who);
bool HasItem(uint32 item_id);
uint16 CountItem(uint32 item_id);
uint32 GetItemIDBySlot(uint16 loot_slot);
uint16 GetFirstSlotByItemID(uint32 item_id);
};
#endif
#endif