From 8031bf0bcb7c4fe61c8b1adb5a62da09a2b90b40 Mon Sep 17 00:00:00 2001 From: Vayle <76063792+Valorith@users.noreply.github.com> Date: Sun, 5 Feb 2023 22:53:37 -0500 Subject: [PATCH] [Quest API] Add EVENT_TASKACCEPTED to Player scope (#2822) * Add EVENT_TASKACCEPTED to player scope * Formatting --- zone/lua_parser.cpp | 1 + zone/lua_parser_events.cpp | 12 ++++++++++++ zone/lua_parser_events.h | 9 +++++++++ zone/task_client_state.cpp | 1 + 4 files changed, 23 insertions(+) diff --git a/zone/lua_parser.cpp b/zone/lua_parser.cpp index 67ac78255..737543d4b 100644 --- a/zone/lua_parser.cpp +++ b/zone/lua_parser.cpp @@ -242,6 +242,7 @@ LuaParser::LuaParser() { PlayerArgumentDispatch[EVENT_DUEL_LOSE] = handle_player_duel_loss; PlayerArgumentDispatch[EVENT_LOOT] = handle_player_loot; PlayerArgumentDispatch[EVENT_TASK_STAGE_COMPLETE] = handle_player_task_stage_complete; + PlayerArgumentDispatch[EVENT_TASK_ACCEPTED] = handle_player_task_accepted; PlayerArgumentDispatch[EVENT_TASK_COMPLETE] = handle_player_task_update; PlayerArgumentDispatch[EVENT_TASK_UPDATE] = handle_player_task_update; PlayerArgumentDispatch[EVENT_TASK_BEFORE_UPDATE] = handle_player_task_update; diff --git a/zone/lua_parser_events.cpp b/zone/lua_parser_events.cpp index bda084f13..a4f3c55e2 100644 --- a/zone/lua_parser_events.cpp +++ b/zone/lua_parser_events.cpp @@ -836,6 +836,18 @@ void handle_player_task_stage_complete( lua_setfield(L, -2, "activity_id"); } +void handle_player_task_accepted( + 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, "task_id"); +} + void handle_player_task_update( QuestInterface *parse, lua_State* L, diff --git a/zone/lua_parser_events.h b/zone/lua_parser_events.h index 085733537..327f90a7e 100644 --- a/zone/lua_parser_events.h +++ b/zone/lua_parser_events.h @@ -383,6 +383,15 @@ void handle_player_task_stage_complete( std::vector *extra_pointers ); +void handle_player_task_accepted( + QuestInterface* parse, + lua_State* L, + Client* client, + std::string data, + uint32 extra_data, + std::vector* extra_pointers +); + void handle_player_task_update( QuestInterface *parse, lua_State* L, diff --git a/zone/task_client_state.cpp b/zone/task_client_state.cpp index ca7456f04..795c8808e 100644 --- a/zone/task_client_state.cpp +++ b/zone/task_client_state.cpp @@ -2125,6 +2125,7 @@ void ClientTaskState::AcceptNewTask( if (npc) { parse->EventNPC(EVENT_TASK_ACCEPTED, npc, client, export_string, 0); } + parse->EventPlayer(EVENT_TASK_ACCEPTED, client, export_string, 0); } void ClientTaskState::ProcessTaskProximities(Client *client, float x, float y, float z)