mirror of
https://github.com/EQEmu/Server.git
synced 2026-08-28 20:07:56 +00:00
[Quest API] Add corpse->GetLootList() and npc->GetLootList() to Perl and Lua. (#1529)
* [Quest API] Add corpse->GetLootList() and npc->GetLootList() to Perl and Lua. - Add $corpse->GetLootList() to Perl. - Add $npc->GetLootList() to Perl. - Add corpse:GetLootList() to Lua. - Add npc:GetLootList() to Lua. Returns an array of item IDs for use with corpse and NPC methods such as HasItem(item_id), CountItem(item_id), and GetFirstSlotByItemID(item_id). * Categories. * Modify Lua to use classes.
This commit is contained in:
@@ -1846,6 +1846,29 @@ XS(XS_NPC_GetSpellScale) {
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS_NPC_GetLootList);
|
||||
XS(XS_NPC_GetLootList) {
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: NPC::GetLootList(THIS)"); // @categories Script Utility
|
||||
{
|
||||
NPC *THIS;
|
||||
VALIDATE_THIS_IS_NPC;
|
||||
auto npc_items = THIS->GetLootList();
|
||||
auto item_count = npc_items.size();
|
||||
if (item_count > 0) {
|
||||
EXTEND(sp, item_count);
|
||||
for (int index = 0; index < item_count; ++index) {
|
||||
ST(index) = sv_2mortal(newSVuv(npc_items[index]));
|
||||
}
|
||||
XSRETURN(item_count);
|
||||
}
|
||||
SV* return_value = &PL_sv_undef;
|
||||
ST(0) = return_value;
|
||||
XSRETURN(1);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
@@ -1970,6 +1993,7 @@ XS(boot_NPC) {
|
||||
newXSproto(strcpy(buf, "GetFirstSlotByItemID"), XS_NPC_GetFirstSlotByItemID, file, "$$");
|
||||
newXSproto(strcpy(buf, "GetHealScale"), XS_NPC_GetHealScale, file, "$");
|
||||
newXSproto(strcpy(buf, "GetSpellScale"), XS_NPC_GetSpellScale, file, "$");
|
||||
newXSproto(strcpy(buf, "GetLootList"), XS_NPC_GetLootList, file, "$");
|
||||
XSRETURN_YES;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user