diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 7c770d87a..418544abc 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -4854,6 +4854,10 @@ void Client::Handle_OP_Consider(const EQApplicationPacket *app) if (tmob == 0) return; + if (parse->EventPlayer(EVENT_CONSIDER, this, fmt::format("{}", conin->targetid), 0) == 1) { + return; + } + if (tmob->GetClass() == LDON_TREASURE) { Message(Chat::Yellow, "%s", tmob->GetCleanName()); @@ -4977,7 +4981,10 @@ void Client::Handle_OP_ConsiderCorpse(const EQApplicationPacket *app) Consider_Struct* conin = (Consider_Struct*)app->pBuffer; Corpse* tcorpse = entity_list.GetCorpseByID(conin->targetid); if (tcorpse && tcorpse->IsNPCCorpse()) { - parse->EventPlayer(EVENT_CONSIDER_CORPSE, this, fmt::format("{}", conin->targetid), 0); + if (parse->EventPlayer(EVENT_CONSIDER_CORPSE, this, fmt::format("{}", conin->targetid), 0) == 1) { + return; + } + uint32 min; uint32 sec; uint32 ttime; if ((ttime = tcorpse->GetDecayTime()) != 0) { sec = (ttime / 1000) % 60; // Total seconds @@ -4991,7 +4998,10 @@ void Client::Handle_OP_ConsiderCorpse(const EQApplicationPacket *app) } } else if (tcorpse && tcorpse->IsPlayerCorpse()) { - parse->EventPlayer(EVENT_CONSIDER_CORPSE, this, fmt::format("{}", conin->targetid), 0); + if (parse->EventPlayer(EVENT_CONSIDER_CORPSE, this, fmt::format("{}", conin->targetid), 0) == 1) { + return; + } + uint32 day, hour, min, sec, ttime; if ((ttime = tcorpse->GetDecayTime()) != 0) { sec = (ttime / 1000) % 60; // Total seconds diff --git a/zone/embparser.cpp b/zone/embparser.cpp index 56f21444e..535e3c356 100644 --- a/zone/embparser.cpp +++ b/zone/embparser.cpp @@ -122,6 +122,7 @@ const char *QuestEventSubroutines[_LargestEventID] = { "EVENT_BOT_COMMAND", "EVENT_WARP", "EVENT_TEST_BUFF", + "EVENT_CONSIDER", "EVENT_CONSIDER_CORPSE" }; @@ -1645,6 +1646,12 @@ void PerlembParser::ExportEventVariables( ExportVar(package_name.c_str(), "from_z", sep.arg[2]); break; } + + case EVENT_CONSIDER: { + ExportVar(package_name.c_str(), "entity_id", std::stoi(data)); + break; + } + case EVENT_CONSIDER_CORPSE: { ExportVar(package_name.c_str(), "corpse_entity_id", std::stoi(data)); break; diff --git a/zone/event_codes.h b/zone/event_codes.h index 7d9de29ef..87143d11e 100644 --- a/zone/event_codes.h +++ b/zone/event_codes.h @@ -90,6 +90,7 @@ typedef enum { EVENT_BOT_COMMAND, EVENT_WARP, EVENT_TEST_BUFF, + EVENT_CONSIDER, EVENT_CONSIDER_CORPSE, _LargestEventID } QuestEventID; diff --git a/zone/lua_general.cpp b/zone/lua_general.cpp index dc574be27..1992b78eb 100644 --- a/zone/lua_general.cpp +++ b/zone/lua_general.cpp @@ -3242,6 +3242,7 @@ luabind::scope lua_register_events() { luabind::value("use_skill", static_cast(EVENT_USE_SKILL)), luabind::value("warp", static_cast(EVENT_WARP)), luabind::value("test_buff", static_cast(EVENT_TEST_BUFF)), + luabind::value("consider", static_cast(EVENT_CONSIDER)), luabind::value("consider_corpse", static_cast(EVENT_CONSIDER_CORPSE)) ]; } diff --git a/zone/lua_parser.cpp b/zone/lua_parser.cpp index 060e53c1d..3a01c643f 100644 --- a/zone/lua_parser.cpp +++ b/zone/lua_parser.cpp @@ -133,6 +133,7 @@ const char *LuaEvents[_LargestEventID] = { "event_bot_command", "event_warp", "event_test_buff", + "event_consider", "event_consider_corpse" }; @@ -221,6 +222,7 @@ LuaParser::LuaParser() { PlayerArgumentDispatch[EVENT_COMBINE_VALIDATE] = handle_player_combine_validate; PlayerArgumentDispatch[EVENT_BOT_COMMAND] = handle_player_bot_command; PlayerArgumentDispatch[EVENT_WARP] = handle_player_warp; + PlayerArgumentDispatch[EVENT_CONSIDER] = handle_player_consider; PlayerArgumentDispatch[EVENT_CONSIDER_CORPSE] = handle_player_consider_corpse; ItemArgumentDispatch[EVENT_ITEM_CLICK] = handle_item_click; diff --git a/zone/lua_parser_events.cpp b/zone/lua_parser_events.cpp index 6ec7ed35a..4a0c154ca 100644 --- a/zone/lua_parser_events.cpp +++ b/zone/lua_parser_events.cpp @@ -573,6 +573,11 @@ void handle_player_warp(QuestInterface* parse, lua_State* L, Client* client, std lua_setfield(L, -2, "from_z"); } +void handle_player_consider(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, std::vector* extra_pointers) { + lua_pushinteger(L, std::stoi(data)); + lua_setfield(L, -2, "entity_id"); +} + void handle_player_consider_corpse(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, std::vector* extra_pointers) { lua_pushinteger(L, std::stoi(data)); lua_setfield(L, -2, "corpse_entity_id"); diff --git a/zone/lua_parser_events.h b/zone/lua_parser_events.h index aac4ea3d1..2b6512c15 100644 --- a/zone/lua_parser_events.h +++ b/zone/lua_parser_events.h @@ -105,6 +105,8 @@ void handle_player_bot_command(QuestInterface *parse, lua_State* L, Client* clie std::vector *extra_pointers); void handle_player_warp(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, std::vector* extra_pointers); +void handle_player_consider(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, + std::vector* extra_pointers); void handle_player_consider_corpse(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, std::vector* extra_pointers);