Add Inventory methods to Perl.

- Add $client->GetInventory() to Perl.
- Export Lua Inventory methods to Perl.
 - Add quest::createitem(item_id, charges, augment_one, augment_two, augment_three, augment_four, augment_five, augment_six, attuned) to Perl so you can return a ItemInstance for testing purposes.
This commit is contained in:
Kinglykrab 2021-02-01 00:00:40 -05:00
parent 9713d62849
commit 36bfebfe6a
8 changed files with 585 additions and 0 deletions

View File

@ -109,6 +109,7 @@ SET(zone_sources
perl_expedition.cpp
perl_groups.cpp
perl_hateentry.cpp
perl_inventory.cpp
perl_mob.cpp
perl_npc.cpp
perl_object.cpp

View File

@ -959,6 +959,9 @@ void PerlembParser::MapFunctions()
"package Raid;"
"&boot_Raid;" //load our Raid XS
"package Inventory;"
"&boot_Inventory;" // load inventory XS
"package QuestItem;"
"&boot_QuestItem;" // load quest Item XS

View File

@ -104,6 +104,23 @@ XS(XS_EntityList_new) {
XSRETURN(1);
}
//Any creation of new inventory gets the curreny inventory
XS(XS_Inventory_new);
XS(XS_Inventory_new) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: quest::Inventory::new()");
EQ::InventoryProfile* RETVAL;
RETVAL = quest_manager.GetInventory();
ST(0) = sv_newmortal();
if (RETVAL)
sv_setref_pv(ST(0), "Inventory", (void *) RETVAL);
XSRETURN(1);
}
//Any creation of new quest items gets the current quest item
XS(XS_QuestItem_new);
XS(XS_QuestItem_new) {
@ -6342,6 +6359,51 @@ XS(XS__remove_all_expedition_lockouts_by_char_id) {
XSRETURN_EMPTY;
}
XS(XS__createitem);
XS(XS__createitem) {
dXSARGS;
if (items < 1 || items > 9) {
Perl_croak(aTHX_ "Usage: quest::createitem(uint32 item_id, [int16 charges = 0, uint32 augment_one = 0, uint32 augment_two = 0, uint32 augment_three = 0, uint32 augment_four = 0, uint32 augment_five = 0, uint32 augment_six = 0, bool attuned = false])");
}
EQ::ItemInstance* RETVAL = nullptr;
uint32 item_id = (uint32)SvUV(ST(0));
int16 charges = 0;
uint32 augment_one = 0;
uint32 augment_two = 0;
uint32 augment_three = 0;
uint32 augment_four = 0;
uint32 augment_five = 0;
uint32 augment_six = 0;
bool attuned = false;
if (items > 1)
charges = (int16)SvIV(ST(1));
if (items > 2)
augment_one = (uint32)SvUV(ST(2));
if (items > 3)
augment_two = (uint32)SvUV(ST(3));
if (items > 4)
augment_three = (uint32)SvUV(ST(4));
if (items > 5)
augment_four = (uint32)SvUV(ST(5));
if (items > 6)
augment_five = (uint32)SvUV(ST(6));
if (items > 7)
augment_six = (uint32)SvUV(ST(7));
if (items > 8)
attuned = (bool)SvNV(ST(8));
if (database.GetItem(item_id)) {
RETVAL = database.CreateItem(item_id, charges, augment_one, augment_two, augment_three, augment_four, augment_five, augment_six, attuned);
}
ST(0) = sv_newmortal();
if (RETVAL) {
sv_setref_pv(ST(0), "QuestItem", (void*)RETVAL);
}
XSRETURN(1);
}
/*
This is the callback perl will look for to setup the
quest package's XSUBs
@ -6438,6 +6500,7 @@ EXTERN_C XS(boot_quest) {
newXS(strcpy(buf, "creategroundobject"), XS__CreateGroundObject, file);
newXS(strcpy(buf, "creategroundobjectfrommodel"), XS__CreateGroundObjectFromModel, file);
newXS(strcpy(buf, "createguild"), XS__createguild, file);
newXS(strcpy(buf, "createitem"), XS__createitem, file);
newXS(strcpy(buf, "crosszoneassigntaskbycharid"), XS__crosszoneassigntaskbycharid, file);
newXS(strcpy(buf, "crosszoneassigntaskbygroupid"), XS__crosszoneassigntaskbygroupid, file);
newXS(strcpy(buf, "crosszoneassigntaskbyraidid"), XS__crosszoneassigntaskbyraidid, file);

View File

@ -32,6 +32,7 @@ EXTERN_C XS(boot_Corpse);
EXTERN_C XS(boot_EntityList);
EXTERN_C XS(boot_Group);
EXTERN_C XS(boot_Raid);
EXTERN_C XS(boot_Inventory);
EXTERN_C XS(boot_QuestItem);
EXTERN_C XS(boot_HateEntry);
EXTERN_C XS(boot_Object);
@ -84,6 +85,7 @@ EXTERN_C void xs_init(pTHX)
newXS(strcpy(buf, "PerlPacket::boot_PerlPacket"), boot_PerlPacket, file);
newXS(strcpy(buf, "Group::boot_Group"), boot_Group, file);
newXS(strcpy(buf, "Raid::boot_Raid"), boot_Raid, file);
newXS(strcpy(buf, "Inventory::boot_Inventory"), boot_Inventory, file);
newXS(strcpy(buf, "QuestItem::boot_QuestItem"), boot_QuestItem, file);
newXS(strcpy(buf, "HateEntry::boot_HateEntry"), boot_HateEntry, file);
newXS(strcpy(buf, "Object::boot_Object"), boot_Object, file);

View File

@ -7288,6 +7288,22 @@ XS(XS_Client_GetScribedSpells) {
XSRETURN(1);
}
XS(XS_Client_GetInventory);
XS(XS_Client_GetInventory) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Client::GetInventory(THIS)");
{
Client* THIS;
EQ::InventoryProfile* RETVAL;
VALIDATE_THIS_IS_CLIENT;
RETVAL = &THIS->GetInv();
ST(0) = sv_newmortal();
sv_setref_pv(ST(0), "Inventory", (void *) RETVAL);
}
XSRETURN(1);
}
#ifdef __cplusplus
extern "C"
#endif
@ -7404,6 +7420,7 @@ XS(boot_Client) {
newXSproto(strcpy(buf, "GetHunger"), XS_Client_GetHunger, file, "$$");
newXSproto(strcpy(buf, "GetInstanceID"), XS_Client_GetInstanceID, file, "$$");
newXSproto(strcpy(buf, "GetInstrumentMod"), XS_Client_GetInstrumentMod, file, "$$");
newXSproto(strcpy(buf, "GetInventory"), XS_Client_GetInventory, file, "$");
newXSproto(strcpy(buf, "GetIP"), XS_Client_GetIP, file, "$");
newXSproto(strcpy(buf, "GetItemAt"), XS_Client_GetItemAt, file, "$$");
newXSproto(strcpy(buf, "GetItemIDAt"), XS_Client_GetItemIDAt, file, "$$");

481
zone/perl_inventory.cpp Normal file
View File

@ -0,0 +1,481 @@
/*
* This file was generated automatically by xsubpp version 1.9508 from the
* contents of tmp. Do not edit this file, edit tmp instead.
*
* ANY CHANGES MADE HERE WILL BE LOST!
*
*/
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/features.h"
#include "client.h"
#ifdef EMBPERL_XS_CLASSES
#include "../common/global_define.h"
#include "embperl.h"
#ifdef seed
#undef seed
#endif
#include "../common/inventory_profile.h"
#ifdef THIS /* this macro seems to leak out on some systems */
#undef THIS
#endif
#define VALIDATE_THIS_IS_INVENTORY \
do { \
if (sv_derived_from(ST(0), "Inventory")) { \
IV tmp = SvIV((SV*)SvRV(ST(0))); \
THIS = INT2PTR(EQ::InventoryProfile*, tmp); \
} else { \
Perl_croak(aTHX_ "THIS is not of type EQ::InventoryProfile"); \
} \
if (THIS == nullptr) { \
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); \
} \
} while (0);
XS(XS_Inventory_CanItemFitInContainer);
XS(XS_Inventory_CanItemFitInContainer) {
dXSARGS;
if (items != 3)
Perl_croak(aTHX_ "Usage: Inventory::CanItemFitInContainer(THIS, ItemInstance item_to_check, ItemInstance container_to_check)");
{
EQ::InventoryProfile* THIS;
bool can_fit = false;
EQ::ItemInstance* item_to_check = (EQ::ItemInstance*)SvIV((SV*)SvRV(ST(1)));
EQ::ItemInstance* container_to_check = (EQ::ItemInstance*)SvIV((SV*)SvRV(ST(2)));
const EQ::ItemData* item_data = item_to_check->GetItem();
const EQ::ItemData* container_data = container_to_check->GetItem();
VALIDATE_THIS_IS_INVENTORY;
can_fit = THIS->CanItemFitInContainer(item_data, container_data);
ST(0) = boolSV(can_fit);
sv_2mortal(ST(0));
}
XSRETURN(1);
}
XS(XS_Inventory_CheckNoDrop);
XS(XS_Inventory_CheckNoDrop) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Inventory::CheckNoDrop(THIS, int16 slot_id)");
{
EQ::InventoryProfile* THIS;
bool no_drop = false;
int16 slot_id = (int16)SvIV(ST(1));
VALIDATE_THIS_IS_INVENTORY;
no_drop = THIS->CheckNoDrop(slot_id);
ST(0) = boolSV(no_drop);
sv_2mortal(ST(0));
}
XSRETURN(1);
}
XS(XS_Inventory_DeleteItem);
XS(XS_Inventory_DeleteItem) {
dXSARGS;
if (items < 2 || items > 3)
Perl_croak(aTHX_ "Usage: Inventory::DeleteItem(THIS, int16 slot_id, [uint8 quantity = 0])");
{
EQ::InventoryProfile* THIS;
bool item_deleted = false;
int16 slot_id = (int16)SvIV(ST(1));
uint8 quantity = 0;
VALIDATE_THIS_IS_INVENTORY;
if (items > 2)
quantity = (uint8)SvUV(ST(2));
item_deleted = THIS->DeleteItem(slot_id, quantity);
ST(0) = boolSV(item_deleted);
sv_2mortal(ST(0));
}
XSRETURN(1);
}
XS(XS_Inventory_FindFreeSlot);
XS(XS_Inventory_FindFreeSlot) {
dXSARGS;
if (items < 3 || items > 5)
Perl_croak(aTHX_ "Usage: Inventory::FindFreeSlot(THIS, bool is_for_bag, bool try_cursor, [uint8 min_size = 0, bool is_arrow = false])");
{
EQ::InventoryProfile* THIS;
int16 free_slot;
bool is_for_bag = (bool)SvNV(ST(1));
bool try_cursor = (bool)SvNV(ST(2));
uint8 min_size = 0;
bool is_arrow = false;
dXSTARG;
VALIDATE_THIS_IS_INVENTORY;
if (items > 3)
min_size = (uint8)SvUV(ST(3));
if (items > 4)
is_arrow = (bool)SvNV(ST(4));
free_slot = THIS->FindFreeSlot(is_for_bag, try_cursor, min_size, is_arrow);
XSprePUSH;
PUSHi((IV)free_slot);
}
XSRETURN(1);
}
XS(XS_Inventory_GetBagIndex);
XS(XS_Inventory_GetBagIndex) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Inventory::GetBagIndex(THIS, int16 slot_id)");
{
EQ::InventoryProfile* THIS;
uint8 bag_index;
int16 slot_id = (int16)SvIV(ST(1));
dXSTARG;
VALIDATE_THIS_IS_INVENTORY;
bag_index = THIS->CalcBagIdx(slot_id);
XSprePUSH;
PUSHu((UV)bag_index);
}
XSRETURN(1);
}
XS(XS_Inventory_GetItem);
XS(XS_Inventory_GetItem) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Inventory::GetItem(THIS, int16 slot_id)");
{
EQ::InventoryProfile* THIS;
EQ::ItemInstance* item;
int16 slot_id = (int16)SvIV(ST(1));
dXSTARG;
VALIDATE_THIS_IS_INVENTORY;
item = THIS->GetItem(slot_id);
ST(0) = sv_newmortal();
sv_setref_pv(ST(0), "QuestItem", (void*)item);
}
XSRETURN(1);
}
XS(XS_Inventory_GetMaterialFromSlot);
XS(XS_Inventory_GetMaterialFromSlot) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Inventory::GetMaterialFromSlot(THIS, int16 slot_id)");
{
EQ::InventoryProfile* THIS;
uint8 material;
int16 slot_id = (int16)SvIV(ST(1));
dXSTARG;
VALIDATE_THIS_IS_INVENTORY;
material = THIS->CalcMaterialFromSlot(slot_id);
XSprePUSH;
PUSHu((UV)material);
}
XSRETURN(1);
}
XS(XS_Inventory_GetSlotByItemInst);
XS(XS_Inventory_GetSlotByItemInst) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Inventory::GetSlotByItemInst(THIS, ItemInstance item)");
{
EQ::InventoryProfile* THIS;
int slot_id;
EQ::ItemInstance* item = (EQ::ItemInstance*)SvIV((SV*)SvRV(ST(1)));
dXSTARG;
VALIDATE_THIS_IS_INVENTORY;
slot_id = THIS->GetSlotByItemInst(item);
XSprePUSH;
PUSHi((IV)slot_id);
}
XSRETURN(1);
}
XS(XS_Inventory_GetSlotFromMaterial);
XS(XS_Inventory_GetSlotFromMaterial) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Inventory::GetSlotFromMaterial(THIS, uint8 material)");
{
EQ::InventoryProfile* THIS;
int16 slot_id;
uint8 material = (uint8)SvUV(ST(1));
dXSTARG;
VALIDATE_THIS_IS_INVENTORY;
slot_id = THIS->CalcSlotFromMaterial(material);
XSprePUSH;
PUSHi((IV)slot_id);
}
XSRETURN(1);
}
XS(XS_Inventory_GetSlotID);
XS(XS_Inventory_GetSlotID) {
dXSARGS;
if (items < 2 || items > 3)
Perl_croak(aTHX_ "Usage: Inventory::GetSlotID(THIS, int16 slot_id, [uint8 bag_index])");
{
EQ::InventoryProfile* THIS;
int16 slot_id = (int16)SvIV(ST(1));
dXSTARG;
VALIDATE_THIS_IS_INVENTORY;
if (items == 2)
slot_id = THIS->CalcSlotId(slot_id);
if (items == 3) {
uint8 bag_index = (uint8)SvUV(ST(2));
slot_id = THIS->CalcSlotId(slot_id, bag_index);
}
XSprePUSH;
PUSHi((IV)slot_id);
}
XSRETURN(1);
}
XS(XS_Inventory_HasItem);
XS(XS_Inventory_HasItem) {
dXSARGS;
if (items < 2 || items > 4)
Perl_croak(aTHX_ "Usage: Inventory::HasItem(THIS, uint32 item_id, [uint8 quantity, uint8 where])");
{
EQ::InventoryProfile* THIS;
int16 slot_id;
uint32 item_id = (uint32)SvUV(ST(1));
uint8 quantity = 0;
uint8 where_to_look = 0xFF;
dXSTARG;
VALIDATE_THIS_IS_INVENTORY;
if (items > 2)
quantity = (uint8)SvUV(ST(2));
if (items > 3)
where_to_look = (uint8)SvUV(ST(3));
slot_id = THIS->HasItem(item_id, quantity, where_to_look);
XSprePUSH;
PUSHi((IV)slot_id);
}
XSRETURN(1);
}
XS(XS_Inventory_HasItemByLoreGroup);
XS(XS_Inventory_HasItemByLoreGroup) {
dXSARGS;
if (items < 2 || items > 3)
Perl_croak(aTHX_ "Usage: Inventory::HasItemByLoreGroup(THIS, uint32 loregroup, [uint8 where])");
{
EQ::InventoryProfile* THIS;
int16 slot_id;
uint32 loregroup = (uint32)SvUV(ST(1));
uint8 where_to_look = 0xFF;
dXSTARG;
VALIDATE_THIS_IS_INVENTORY;
if (items > 2)
where_to_look = (uint8)SvUV(ST(2));
slot_id = THIS->HasItemByLoreGroup(loregroup, where_to_look);
XSprePUSH;
PUSHi((IV)slot_id);
}
XSRETURN(1);
}
XS(XS_Inventory_HasItemByUse);
XS(XS_Inventory_HasItemByUse) {
dXSARGS;
if (items < 3 || items > 4)
Perl_croak(aTHX_ "Usage: Inventory::HasItemByUse(THIS, uint8 use, uint8 quantity, [uint8 where])");
{
EQ::InventoryProfile* THIS;
int16 slot_id;
uint8 item_use = (uint8)SvUV(ST(1));
uint8 quantity = (uint8)SvUV(ST(2));
uint8 where_to_look = 0xFF;
dXSTARG;
VALIDATE_THIS_IS_INVENTORY;
if (items > 3)
where_to_look = (uint8)SvUV(ST(3));
slot_id = THIS->HasItemByUse(item_use, quantity, where_to_look);
XSprePUSH;
PUSHi((IV)slot_id);
}
XSRETURN(1);
}
XS(XS_Inventory_HasSpaceForItem);
XS(XS_Inventory_HasSpaceForItem) {
dXSARGS;
if (items != 3)
Perl_croak(aTHX_ "Usage: Inventory::HasSpaceForItem(THIS, ItemInstance item_to_check, uint8 quantity)");
{
EQ::InventoryProfile* THIS;
bool has_space = false;
EQ::ItemInstance* item_to_check = (EQ::ItemInstance*)SvIV((SV*)SvRV(ST(1)));
uint8 quantity = (uint8)SvUV(ST(2));
const EQ::ItemData* item_data = item_to_check->GetItem();
VALIDATE_THIS_IS_INVENTORY;
has_space = THIS->HasSpaceForItem(item_data, quantity);
ST(0) = boolSV(has_space);
sv_2mortal(ST(0));
}
XSRETURN(1);
}
XS(XS_Inventory_PopItem);
XS(XS_Inventory_PopItem) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Inventory::PopItem(THIS, int16 slot_id)");
{
EQ::InventoryProfile* THIS;
EQ::ItemInstance* item;
int16 slot_id = (int16)SvIV(ST(1));
dXSTARG;
VALIDATE_THIS_IS_INVENTORY;
item = THIS->PopItem(slot_id);
ST(0) = sv_newmortal();
sv_setref_pv(ST(0), "QuestItem", (void*)item);
}
XSRETURN(1);
}
XS(XS_Inventory_SupportsContainers);
XS(XS_Inventory_SupportsContainers) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Inventory::SupportsContainers(THIS, int16 slot_id)");
{
EQ::InventoryProfile* THIS;
bool supports_containers = false;
int16 slot_id = (int16)SvIV(ST(1));
VALIDATE_THIS_IS_INVENTORY;
supports_containers = THIS->SupportsContainers(slot_id);
ST(0) = boolSV(supports_containers);
sv_2mortal(ST(0));
}
XSRETURN(1);
}
XS(XS_Inventory_SwapItem);
XS(XS_Inventory_SwapItem) {
dXSARGS;
if (items != 3)
Perl_croak(aTHX_ "Usage: Inventory::SwapItem(THIS, int16 source_slot_id, int16 destination_slot_id)");
{
EQ::InventoryProfile* THIS;
bool item_swapped = false;
int16 source_slot_id = (int16)SvIV(ST(1));
int16 destination_slot_id = (int16)SvIV(ST(2));
EQ::InventoryProfile::SwapItemFailState fail_state = EQ::InventoryProfile::swapInvalid;
VALIDATE_THIS_IS_INVENTORY;
item_swapped = THIS->SwapItem(source_slot_id, destination_slot_id, fail_state);
ST(0) = boolSV(item_swapped);
sv_2mortal(ST(0));
}
XSRETURN(1);
}
XS(XS_Inventory_PushCursor);
XS(XS_Inventory_PushCursor) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Inventory::PushCursor(THIS, ItemInstance item)");
{
EQ::InventoryProfile* THIS;
int16 slot_id;
EQ::ItemInstance* item = (EQ::ItemInstance*)SvIV((SV*)SvRV(ST(1)));
dXSTARG;
VALIDATE_THIS_IS_INVENTORY;
if (item)
slot_id = THIS->PushCursor(*item);
else
slot_id = 0;
XSprePUSH;
PUSHi((IV)slot_id);
}
XSRETURN(1);
}
XS(XS_Inventory_PutItem);
XS(XS_Inventory_PutItem) {
dXSARGS;
if (items != 3)
Perl_croak(aTHX_ "Usage: Inventory::PutItem(THIS, int16 slot_id, ItemInstance item)");
{
EQ::InventoryProfile* THIS;
int16 slot_id = (int16)SvUV(ST(1));
EQ::ItemInstance* item = (EQ::ItemInstance*)SvIV((SV*)SvRV(ST(2)));
dXSTARG;
VALIDATE_THIS_IS_INVENTORY;
if (item)
slot_id = THIS->PutItem(slot_id, *item);
else
slot_id = 0;
XSprePUSH;
PUSHi((IV)slot_id);
}
XSRETURN(1);
}
#ifdef __cplusplus
extern "C"
#endif
XS(boot_Inventory);
XS(boot_Inventory) {
dXSARGS;
char file[256];
strncpy(file, __FILE__, 256);
file[255] = 0;
if (items != 1)
fprintf(stderr, "boot_quest does not take any arguments.");
char buf[128];
XS_VERSION_BOOTCHECK;
newXSproto(strcpy(buf, "CanItemFitInContainer"), XS_Inventory_CanItemFitInContainer, file, "$$$");
newXSproto(strcpy(buf, "CheckNoDrop"), XS_Inventory_CheckNoDrop, file, "$$");
newXSproto(strcpy(buf, "DeleteItem"), XS_Inventory_DeleteItem, file, "$$;$");
newXSproto(strcpy(buf, "FindFreeSlot"), XS_Inventory_FindFreeSlot, file, "$$$;$$");
newXSproto(strcpy(buf, "GetBagIndex"), XS_Inventory_GetBagIndex, file, "$$");
newXSproto(strcpy(buf, "GetItem"), XS_Inventory_GetItem, file, "$$;$");
newXSproto(strcpy(buf, "GetMaterialFromSlot"), XS_Inventory_GetMaterialFromSlot, file, "$$");
newXSproto(strcpy(buf, "GetSlotByItemInst"), XS_Inventory_GetSlotByItemInst, file, "$$");
newXSproto(strcpy(buf, "GetSlotFromMaterial"), XS_Inventory_GetSlotFromMaterial, file, "$$");
newXSproto(strcpy(buf, "GetSlotID"), XS_Inventory_GetSlotID, file, "$$;$");
newXSproto(strcpy(buf, "HasItem"), XS_Inventory_HasItem, file, "$$;$$");
newXSproto(strcpy(buf, "HasItemByLoreGroup"), XS_Inventory_HasItemByLoreGroup, file, "$$;$");
newXSproto(strcpy(buf, "HasItemByUse"), XS_Inventory_HasItemByUse, file, "$$;$$");
newXSproto(strcpy(buf, "HasSpaceForItem"), XS_Inventory_HasSpaceForItem, file, "$$$");
newXSproto(strcpy(buf, "PopItem"), XS_Inventory_PopItem, file, "$$");
newXSproto(strcpy(buf, "PushCursor"), XS_Inventory_PushCursor, file, "$$");
newXSproto(strcpy(buf, "PutItem"), XS_Inventory_PutItem, file, "$$$");
newXSproto(strcpy(buf, "SupportsContainers"), XS_Inventory_SupportsContainers, file, "$$");
newXSproto(strcpy(buf, "SwapItem"), XS_Inventory_SwapItem, file, "$$$");
XSRETURN_YES;
}
#endif //EMBPERL_XS_CLASSES

View File

@ -4129,6 +4129,15 @@ Mob *QuestManager::GetOwner() const {
return nullptr;
}
EQ::InventoryProfile *QuestManager::GetInventory() const {
if(!quests_running_.empty()) {
running_quest e = quests_running_.top();
return &e.initiator->GetInv();
}
return nullptr;
}
EQ::ItemInstance *QuestManager::GetQuestItem() const {
if(!quests_running_.empty()) {
running_quest e = quests_running_.top();
@ -4218,3 +4227,10 @@ void QuestManager::UpdateZoneHeader(std::string type, std::string value) {
entity_list.QueueClients(0, outapp);
safe_delete(outapp);
}
EQ::ItemInstance *QuestManager::CreateItem(uint32 item_id, int16 charges, uint32 augment_one, uint32 augment_two, uint32 augment_three, uint32 augment_four, uint32 augment_five, uint32 augment_six, bool attuned) const {
if (database.GetItem(item_id)) {
return database.CreateItem(item_id, charges, augment_one, augment_two, augment_three, augment_four, augment_five, augment_six, attuned);
}
return nullptr;
}

View File

@ -65,6 +65,7 @@ public:
void say(const char *str, Journal::Options &opts);
void me(const char *str);
void summonitem(uint32 itemid, int16 charges = -1);
EQ::ItemInstance* CreateItem(uint32 item_id, int16 charges = 0, uint32 augment_one = 0, uint32 augment_two = 0, uint32 augment_three = 0, uint32 augment_four = 0, uint32 augment_five = 0, uint32 augment_six = 0, bool attuned = false) const;
void write(const char *file, const char *str);
Mob* spawn2(int npc_type, int grid, int unused, const glm::vec4& position);
Mob* unique_spawn(int npc_type, int grid, int unused, const glm::vec4& position);
@ -372,6 +373,7 @@ public:
Client *GetInitiator() const;
NPC *GetNPC() const;
Mob *GetOwner() const;
EQ::InventoryProfile* GetInventory() const;
EQ::ItemInstance *GetQuestItem() const;
std::string GetEncounter() const;
inline bool ProximitySayInUse() { return HaveProximitySays; }