mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 07:18:37 +00:00
[Quest API] Add EVENT_DESTROY_ITEM_CLIENT to Perl/Lua. (#2871)
* [Quest API] Add EVENT_DESTROY_ITEM_CLIENT to Perl/Lua. - Add `EVENT_DESTROY_ITEM_CLIENT`, exports `$item_id`, `$item_name`, `$quantity`, and `$item`. - Add `event_destroy_item_client`, exports `e.item_id`, `e.item_name`, `e.quantity`, and `e.item`. - Allows operators to use player scripts for item destroys. * Update lua_parser_events.h * Update inventory.cpp
This commit is contained in:
@@ -175,6 +175,7 @@ const char *QuestEventSubroutines[_LargestEventID] = {
|
||||
"EVENT_DAMAGE_TAKEN",
|
||||
"EVENT_ITEM_CLICK_CLIENT",
|
||||
"EVENT_ITEM_CLICK_CAST_CLIENT",
|
||||
"EVENT_DESTROY_ITEM_CLIENT",
|
||||
// Add new events before these or Lua crashes
|
||||
"EVENT_SPELL_EFFECT_BOT",
|
||||
"EVENT_SPELL_EFFECT_BUFF_TIC_BOT"
|
||||
@@ -2133,6 +2134,17 @@ void PerlembParser::ExportEventVariables(
|
||||
break;
|
||||
}
|
||||
|
||||
case EVENT_DESTROY_ITEM_CLIENT: {
|
||||
if (extra_pointers && extra_pointers->size() == 1) {
|
||||
EQ::ItemInstance* inst = std::any_cast<EQ::ItemInstance*>(extra_pointers->at(0));
|
||||
ExportVar(package_name.c_str(), "item_id", inst->GetID());
|
||||
ExportVar(package_name.c_str(), "item_name", inst->GetItem()->Name);
|
||||
ExportVar(package_name.c_str(), "quantity", inst->IsStackable() ? inst->GetCharges() : 1);
|
||||
ExportVar(package_name.c_str(), "item", "QuestItem", inst);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user