mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-09 22:20:24 +00:00
[Quest API] Add EVENT_ITEM_CLICK_CLIENT and EVENT_ITEM_CLICK_CAST_CLIENT to Perl/Lua. (#2810)
* [Quest API] Add EVENT_ITEM_CLICK_CLIENT and EVENT_ITEM_CLICK_CAST_CLIENT to Perl/Lua. # Perl - Add `EVENT_ITEM_CLICK_CLIENT`. - Add `EVENT_ITEM_CLICK_CAST_CLIENT`. - Both events export `$item_id`, `$item_name`, `$slot_id`, and `$spell_id`. # Lua - Add `event_item_click_client`. - Add `event_item_click_cast_client`. - Both events export `e.item_id`, `e.item_name`, `e.slot_id`, `e.spell_id`, and `e.item`. # Notes - Allows operators to handle item clicks in player scripts instead of item-specific scripts. * Update lua_parser_events.cpp * Remove optional bool.
This commit is contained in:
@@ -1235,13 +1235,41 @@ void handle_player_damage(
|
||||
lua_setfield(L, -2, "special_attack");
|
||||
|
||||
if (extra_pointers && extra_pointers->size() >= 1) {
|
||||
Lua_Mob l_mob(std::any_cast<Mob*>(extra_pointers->at(1)));
|
||||
Lua_Mob l_mob(std::any_cast<Mob*>(extra_pointers->at(0)));
|
||||
luabind::adl::object l_mob_o = luabind::adl::object(L, l_mob);
|
||||
l_mob_o.push(L);
|
||||
lua_setfield(L, -2, "other");
|
||||
}
|
||||
}
|
||||
|
||||
void handle_player_item_click(
|
||||
QuestInterface *parse,
|
||||
lua_State* L,
|
||||
Client* client,
|
||||
const std::string& data,
|
||||
uint32 extra_data,
|
||||
std::vector<std::any> *extra_pointers
|
||||
) {
|
||||
lua_pushnumber(L, std::stoi(data));
|
||||
lua_setfield(L, -2, "slot_id");
|
||||
|
||||
if (extra_pointers && extra_pointers->size() >= 1) {
|
||||
lua_pushnumber(L, std::any_cast<EQ::ItemInstance*>(extra_pointers->at(0))->GetID());
|
||||
lua_setfield(L, -2, "item_id");
|
||||
|
||||
lua_pushstring(L, std::any_cast<EQ::ItemInstance*>(extra_pointers->at(0))->GetItem()->Name);
|
||||
lua_setfield(L, -2, "item_name");
|
||||
|
||||
lua_pushnumber(L, std::any_cast<EQ::ItemInstance*>(extra_pointers->at(0))->GetItem()->Click.Effect);
|
||||
lua_setfield(L, -2, "spell_id");
|
||||
|
||||
Lua_ItemInst l_item(std::any_cast<EQ::ItemInstance*>(extra_pointers->at(0)));
|
||||
luabind::adl::object l_item_o = luabind::adl::object(L, l_item);
|
||||
l_item_o.push(L);
|
||||
lua_setfield(L, -2, "item");
|
||||
}
|
||||
}
|
||||
|
||||
// Item
|
||||
void handle_item_click(
|
||||
QuestInterface *parse,
|
||||
|
||||
Reference in New Issue
Block a user