[Quest API] Add EVENT_COMBINE to Perl and Lua. (#1536)

- Exports $container_slot in Perl.
- Exports e.container_slot in Lua.

Allows you to perform events when clicking combine in a tradeskill container.
This commit is contained in:
Kinglykrab 2021-09-19 16:22:51 -04:00 committed by GitHub
parent 80493719f2
commit 8eef7bb283
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 0 deletions

View File

@ -122,6 +122,7 @@ const char *QuestEventSubroutines[_LargestEventID] = {
"EVENT_BOT_COMMAND", "EVENT_BOT_COMMAND",
"EVENT_WARP", "EVENT_WARP",
"EVENT_TEST_BUFF", "EVENT_TEST_BUFF",
"EVENT_COMBINE",
"EVENT_CONSIDER", "EVENT_CONSIDER",
"EVENT_CONSIDER_CORPSE" "EVENT_CONSIDER_CORPSE"
}; };
@ -1657,6 +1658,11 @@ void PerlembParser::ExportEventVariables(
break; break;
} }
case EVENT_COMBINE: {
ExportVar(package_name.c_str(), "container_slot", std::stoi(data));
break;
}
default: { default: {
break; break;
} }

View File

@ -90,6 +90,7 @@ typedef enum {
EVENT_BOT_COMMAND, EVENT_BOT_COMMAND,
EVENT_WARP, EVENT_WARP,
EVENT_TEST_BUFF, EVENT_TEST_BUFF,
EVENT_COMBINE,
EVENT_CONSIDER, EVENT_CONSIDER,
EVENT_CONSIDER_CORPSE, EVENT_CONSIDER_CORPSE,
_LargestEventID _LargestEventID

View File

@ -133,6 +133,7 @@ const char *LuaEvents[_LargestEventID] = {
"event_bot_command", "event_bot_command",
"event_warp", "event_warp",
"event_test_buff", "event_test_buff",
"event_combine",
"event_consider", "event_consider",
"event_consider_corpse" "event_consider_corpse"
}; };
@ -222,6 +223,7 @@ LuaParser::LuaParser() {
PlayerArgumentDispatch[EVENT_COMBINE_VALIDATE] = handle_player_combine_validate; PlayerArgumentDispatch[EVENT_COMBINE_VALIDATE] = handle_player_combine_validate;
PlayerArgumentDispatch[EVENT_BOT_COMMAND] = handle_player_bot_command; PlayerArgumentDispatch[EVENT_BOT_COMMAND] = handle_player_bot_command;
PlayerArgumentDispatch[EVENT_WARP] = handle_player_warp; PlayerArgumentDispatch[EVENT_WARP] = handle_player_warp;
PlayerArgumentDispatch[EVENT_COMBINE] = handle_player_quest_combine;
PlayerArgumentDispatch[EVENT_CONSIDER] = handle_player_consider; PlayerArgumentDispatch[EVENT_CONSIDER] = handle_player_consider;
PlayerArgumentDispatch[EVENT_CONSIDER_CORPSE] = handle_player_consider_corpse; PlayerArgumentDispatch[EVENT_CONSIDER_CORPSE] = handle_player_consider_corpse;

View File

@ -573,6 +573,11 @@ void handle_player_warp(QuestInterface* parse, lua_State* L, Client* client, std
lua_setfield(L, -2, "from_z"); lua_setfield(L, -2, "from_z");
} }
void handle_player_quest_combine(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, std::vector<EQ::Any>* extra_pointers) {
lua_pushinteger(L, std::stoi(data));
lua_setfield(L, -2, "container_slot");
}
void handle_player_consider(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, std::vector<EQ::Any>* extra_pointers) { void handle_player_consider(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, std::vector<EQ::Any>* extra_pointers) {
lua_pushinteger(L, std::stoi(data)); lua_pushinteger(L, std::stoi(data));
lua_setfield(L, -2, "entity_id"); lua_setfield(L, -2, "entity_id");

View File

@ -105,6 +105,8 @@ void handle_player_bot_command(QuestInterface *parse, lua_State* L, Client* clie
std::vector<EQ::Any> *extra_pointers); std::vector<EQ::Any> *extra_pointers);
void handle_player_warp(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, void handle_player_warp(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
std::vector<EQ::Any>* extra_pointers); std::vector<EQ::Any>* extra_pointers);
void handle_player_quest_combine(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
std::vector<EQ::Any>* extra_pointers);
void handle_player_consider(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, void handle_player_consider(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data,
std::vector<EQ::Any>* extra_pointers); std::vector<EQ::Any>* extra_pointers);
void handle_player_consider_corpse(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, void handle_player_consider_corpse(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data,

View File

@ -375,6 +375,14 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob
} }
DBTradeskillRecipe_Struct spec; DBTradeskillRecipe_Struct spec;
if (parse->EventPlayer(EVENT_COMBINE, user, std::to_string(in_combine->container_slot), 0) == 1) {
auto outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0);
user->QueuePacket(outapp);
safe_delete(outapp);
return;
}
if (!content_db.GetTradeRecipe(container, c_type, some_id, user->CharacterID(), &spec)) { if (!content_db.GetTradeRecipe(container, c_type, some_id, user->CharacterID(), &spec)) {
LogTradeskillsDetail("[HandleCombine] Check 2"); LogTradeskillsDetail("[HandleCombine] Check 2");