[Quest API] Add EVENT_TASKACCEPTED to Player scope (#2822)

* Add EVENT_TASKACCEPTED to player scope

* Formatting
This commit is contained in:
Vayle 2023-02-05 22:53:37 -05:00 committed by GitHub
parent c1584da9cc
commit 8031bf0bcb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 0 deletions

View File

@ -242,6 +242,7 @@ LuaParser::LuaParser() {
PlayerArgumentDispatch[EVENT_DUEL_LOSE] = handle_player_duel_loss; PlayerArgumentDispatch[EVENT_DUEL_LOSE] = handle_player_duel_loss;
PlayerArgumentDispatch[EVENT_LOOT] = handle_player_loot; PlayerArgumentDispatch[EVENT_LOOT] = handle_player_loot;
PlayerArgumentDispatch[EVENT_TASK_STAGE_COMPLETE] = handle_player_task_stage_complete; 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_COMPLETE] = handle_player_task_update;
PlayerArgumentDispatch[EVENT_TASK_UPDATE] = handle_player_task_update; PlayerArgumentDispatch[EVENT_TASK_UPDATE] = handle_player_task_update;
PlayerArgumentDispatch[EVENT_TASK_BEFORE_UPDATE] = handle_player_task_update; PlayerArgumentDispatch[EVENT_TASK_BEFORE_UPDATE] = handle_player_task_update;

View File

@ -836,6 +836,18 @@ void handle_player_task_stage_complete(
lua_setfield(L, -2, "activity_id"); 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<std::any>* extra_pointers
) {
lua_pushinteger(L, std::stoi(data));
lua_setfield(L, -2, "task_id");
}
void handle_player_task_update( void handle_player_task_update(
QuestInterface *parse, QuestInterface *parse,
lua_State* L, lua_State* L,

View File

@ -383,6 +383,15 @@ void handle_player_task_stage_complete(
std::vector<std::any> *extra_pointers std::vector<std::any> *extra_pointers
); );
void handle_player_task_accepted(
QuestInterface* parse,
lua_State* L,
Client* client,
std::string data,
uint32 extra_data,
std::vector<std::any>* extra_pointers
);
void handle_player_task_update( void handle_player_task_update(
QuestInterface *parse, QuestInterface *parse,
lua_State* L, lua_State* L,

View File

@ -2125,6 +2125,7 @@ void ClientTaskState::AcceptNewTask(
if (npc) { if (npc) {
parse->EventNPC(EVENT_TASK_ACCEPTED, npc, client, export_string, 0); 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) void ClientTaskState::ProcessTaskProximities(Client *client, float x, float y, float z)