[Feature] Add player /inspect quest event (#2508)

Returning non-zero from EVENT_INSPECT will prevent default message
This commit is contained in:
hg 2022-10-29 19:49:48 -04:00 committed by GitHub
parent 3bc5d4b125
commit 9e836a9780
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 29 additions and 4 deletions

View File

@ -9155,7 +9155,13 @@ void Client::Handle_OP_LDoNInspect(const EQApplicationPacket *app)
{ {
Mob * target = GetTarget(); Mob * target = GetTarget();
if (target && target->GetClass() == LDON_TREASURE && !target->IsAura()) if (target && target->GetClass() == LDON_TREASURE && !target->IsAura())
Message(Chat::Yellow, "%s", target->GetCleanName()); {
std::vector<std::any> args = { target };
if (parse->EventPlayer(EVENT_INSPECT, this, "", target->GetID(), &args) == 0)
{
Message(Chat::Yellow, "%s", target->GetCleanName());
}
}
} }
void Client::Handle_OP_LDoNOpen(const EQApplicationPacket *app) void Client::Handle_OP_LDoNOpen(const EQApplicationPacket *app)

View File

@ -158,7 +158,8 @@ const char *QuestEventSubroutines[_LargestEventID] = {
"EVENT_ALT_CURRENCY_MERCHANT_BUY", "EVENT_ALT_CURRENCY_MERCHANT_BUY",
"EVENT_ALT_CURRENCY_MERCHANT_SELL", "EVENT_ALT_CURRENCY_MERCHANT_SELL",
"EVENT_MERCHANT_BUY", "EVENT_MERCHANT_BUY",
"EVENT_MERCHANT_SELL" "EVENT_MERCHANT_SELL",
"EVENT_INSPECT",
}; };
PerlembParser::PerlembParser() : perl(nullptr) PerlembParser::PerlembParser() : perl(nullptr)
@ -1734,6 +1735,11 @@ void PerlembParser::ExportEventVariables(
break; break;
} }
case EVENT_INSPECT: {
ExportVar(package_name.c_str(), "target_id", extradata);
break;
}
default: { default: {
break; break;
} }

View File

@ -102,6 +102,7 @@ typedef enum {
EVENT_ALT_CURRENCY_MERCHANT_SELL, EVENT_ALT_CURRENCY_MERCHANT_SELL,
EVENT_MERCHANT_BUY, EVENT_MERCHANT_BUY,
EVENT_MERCHANT_SELL, EVENT_MERCHANT_SELL,
EVENT_INSPECT,
_LargestEventID _LargestEventID
} QuestEventID; } QuestEventID;

View File

@ -4306,7 +4306,8 @@ luabind::scope lua_register_events() {
luabind::value("alt_currency_merchant_buy", static_cast<int>(EVENT_ALT_CURRENCY_MERCHANT_BUY)), luabind::value("alt_currency_merchant_buy", static_cast<int>(EVENT_ALT_CURRENCY_MERCHANT_BUY)),
luabind::value("alt_currency_merchant_sell", static_cast<int>(EVENT_ALT_CURRENCY_MERCHANT_SELL)), luabind::value("alt_currency_merchant_sell", static_cast<int>(EVENT_ALT_CURRENCY_MERCHANT_SELL)),
luabind::value("merchant_buy", static_cast<int>(EVENT_MERCHANT_BUY)), luabind::value("merchant_buy", static_cast<int>(EVENT_MERCHANT_BUY)),
luabind::value("merchant_sell", static_cast<int>(EVENT_MERCHANT_SELL)) luabind::value("merchant_sell", static_cast<int>(EVENT_MERCHANT_SELL)),
luabind::value("inspect", static_cast<int>(EVENT_INSPECT))
]; ];
} }

View File

@ -145,7 +145,8 @@ const char *LuaEvents[_LargestEventID] = {
"event_alt_currency_merchant_buy", "event_alt_currency_merchant_buy",
"event_alt_currency_merchant_sell", "event_alt_currency_merchant_sell",
"event_merchant_buy", "event_merchant_buy",
"event_merchant_sell" "event_merchant_sell",
"event_inspect",
}; };
extern Zone *zone; extern Zone *zone;
@ -245,6 +246,7 @@ LuaParser::LuaParser() {
PlayerArgumentDispatch[EVENT_ALT_CURRENCY_MERCHANT_SELL] = handle_player_alt_currency_merchant; PlayerArgumentDispatch[EVENT_ALT_CURRENCY_MERCHANT_SELL] = handle_player_alt_currency_merchant;
PlayerArgumentDispatch[EVENT_MERCHANT_BUY] = handle_player_merchant; PlayerArgumentDispatch[EVENT_MERCHANT_BUY] = handle_player_merchant;
PlayerArgumentDispatch[EVENT_MERCHANT_SELL] = handle_player_merchant; PlayerArgumentDispatch[EVENT_MERCHANT_SELL] = handle_player_merchant;
PlayerArgumentDispatch[EVENT_INSPECT] = handle_player_inspect;
ItemArgumentDispatch[EVENT_ITEM_CLICK] = handle_item_click; ItemArgumentDispatch[EVENT_ITEM_CLICK] = handle_item_click;
ItemArgumentDispatch[EVENT_ITEM_CLICK_CAST] = handle_item_click; ItemArgumentDispatch[EVENT_ITEM_CLICK_CAST] = handle_item_click;

View File

@ -619,6 +619,13 @@ void handle_player_consider_corpse(QuestInterface* parse, lua_State* L, Client*
lua_setfield(L, -2, "corpse_entity_id"); lua_setfield(L, -2, "corpse_entity_id");
} }
void handle_player_inspect(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, std::vector<std::any>* extra_pointers) {
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");
}
//Item //Item
void handle_item_click(QuestInterface *parse, lua_State* L, Client* client, EQ::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data, void handle_item_click(QuestInterface *parse, lua_State* L, Client* client, EQ::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data,
std::vector<std::any> *extra_pointers) { std::vector<std::any> *extra_pointers) {

View File

@ -123,6 +123,8 @@ void handle_player_alt_currency_merchant(QuestInterface* parse, lua_State* L, Cl
std::vector<std::any>* extra_pointers); std::vector<std::any>* extra_pointers);
void handle_player_merchant(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, void handle_player_merchant(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
std::vector<std::any>* extra_pointers); std::vector<std::any>* extra_pointers);
void handle_player_inspect(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
std::vector<std::any> *extra_pointers);
//Item //Item
void handle_item_click(QuestInterface *parse, lua_State* L, Client* client, EQ::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data, void handle_item_click(QuestInterface *parse, lua_State* L, Client* client, EQ::ItemInstance* item, Mob *mob, std::string data, uint32 extra_data,