From 87b1d32ce84bd021426d3907004c511f67d15fa7 Mon Sep 17 00:00:00 2001 From: Uleat Date: Mon, 8 Jul 2019 21:58:47 -0400 Subject: [PATCH] Updated PerlembParser::ExportItemVariables to new inventory standard --- zone/embparser.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/zone/embparser.cpp b/zone/embparser.cpp index 848299580..759fe5931 100644 --- a/zone/embparser.cpp +++ b/zone/embparser.cpp @@ -1099,10 +1099,6 @@ void PerlembParser::ExportZoneVariables(std::string &package_name) { } } -#define HASITEM_FIRST 0 -#define HASITEM_LAST 29 // this includes worn plus 8 base slots -#define HASITEM_ISNULLITEM(item) ((item==-1) || (item==0)) - void PerlembParser::ExportItemVariables(std::string &package_name, Mob *mob) { if(mob && mob->IsClient()) { @@ -1111,11 +1107,11 @@ void PerlembParser::ExportItemVariables(std::string &package_name, Mob *mob) { //start with an empty hash perl->eval(std::string("%").append(hashname).append(" = ();").c_str()); - for(int slot = HASITEM_FIRST; slot <= HASITEM_LAST; slot++) + for(int slot = EQEmu::invslot::EQUIPMENT_BEGIN; slot <= EQEmu::invslot::GENERAL_END; slot++) { char *hi_decl=nullptr; int itemid = mob->CastToClient()->GetItemIDAt(slot); - if(!HASITEM_ISNULLITEM(itemid)) + if(itemid != -1 && itemid != 0) { MakeAnyLenString(&hi_decl, "push (@{$%s{%d}},%d);", hashname.c_str(), itemid, slot); perl->eval(hi_decl); @@ -1129,7 +1125,7 @@ void PerlembParser::ExportItemVariables(std::string &package_name, Mob *mob) { perl->eval(std::string("%").append(hashname).append(" = ();").c_str()); char *hi_decl = nullptr; int itemid = mob->CastToClient()->GetItemIDAt(EQEmu::invslot::slotCursor); - if(!HASITEM_ISNULLITEM(itemid)) { + if(itemid != -1 && itemid != 0) { MakeAnyLenString(&hi_decl, "push (@{$%s{%d}},%d);",hashname.c_str(), itemid, EQEmu::invslot::slotCursor); perl->eval(hi_decl); safe_delete_array(hi_decl); @@ -1137,10 +1133,6 @@ void PerlembParser::ExportItemVariables(std::string &package_name, Mob *mob) { } } -#undef HASITEM_FIRST -#undef HASITEM_LAST -#undef HASITEM_ISNULLITEM - void PerlembParser::ExportEventVariables(std::string &package_name, QuestEventID event, uint32 objid, const char * data, NPC* npcmob, EQEmu::ItemInstance* item_inst, Mob* mob, uint32 extradata, std::vector *extra_pointers) {