[Quest API] Add EVENT_EQUIP_ITEM_CLIENT and EVENT_UNEQUIP_ITEM_CLIENT to Perl/Lua. (#2015)

- These events allow more customization beyond forcing operators to use a script file for each and every item they want to have some sort of functionality for these events.
- Perl event exports $item_id, $item_quantity, and $slot_id.
- Lua event exports item_id, item_quantity, slot_id, and item.
This commit is contained in:
Kinglykrab
2022-02-22 20:04:08 -05:00
committed by GitHub
parent 3c35e9bbc8
commit bfd1cf9379
7 changed files with 74 additions and 4 deletions
+32
View File
@@ -2205,20 +2205,52 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
if (src_slot_id <= EQ::invslot::EQUIPMENT_END) {
if(src_inst) {
parse->EventItem(EVENT_UNEQUIP_ITEM, this, src_inst, nullptr, "", src_slot_id);
std::string export_string = fmt::format(
"{} {}",
src_inst->IsStackable() ? src_inst->GetCharges() : 1,
src_slot_id
);
parse->EventPlayer(EVENT_UNEQUIP_ITEM_CLIENT, this, export_string, src_inst->GetItem()->ID);
}
if(dst_inst) {
parse->EventItem(EVENT_EQUIP_ITEM, this, dst_inst, nullptr, "", src_slot_id);
std::string export_string = fmt::format(
"{} {}",
dst_inst->IsStackable() ? dst_inst->GetCharges() : 1,
src_slot_id
);
parse->EventPlayer(EVENT_EQUIP_ITEM_CLIENT, this, export_string, dst_inst->GetItem()->ID);
}
}
if (dst_slot_id <= EQ::invslot::EQUIPMENT_END) {
if(dst_inst) {
parse->EventItem(EVENT_UNEQUIP_ITEM, this, dst_inst, nullptr, "", dst_slot_id);
std::string export_string = fmt::format(
"{} {}",
dst_inst->IsStackable() ? dst_inst->GetCharges() : 1,
dst_slot_id
);
parse->EventPlayer(EVENT_UNEQUIP_ITEM_CLIENT, this, export_string, dst_inst->GetItem()->ID);
}
if(src_inst) {
parse->EventItem(EVENT_EQUIP_ITEM, this, src_inst, nullptr, "", dst_slot_id);
std::string export_string = fmt::format(
"{} {}",
src_inst->IsStackable() ? src_inst->GetCharges() : 1,
dst_slot_id
);
parse->EventPlayer(EVENT_EQUIP_ITEM_CLIENT, this, export_string, src_inst->GetItem()->ID);
}
}
}