[Quest API] Add EVENT_LEVEL_DOWN to Perl/Lua. (#2620)

* [Quest API] Add EVENT_LEVEL_DOWN to Perl/Lua.

# Perl
- Add `EVENT_LEVEL_DOWN`, exports `$levels_lost`.
- Add `$levels_gained` export to `EVENT_LEVEL_UP`.

# Lua
- Add `event_level_down`, exports `e.levels_lost`.
- Add `e.levels_gained` export to `event_level_up`.

# Notes
- Allows operators to perform actions on level down.
- Allows operators to tell how many levels were lost or gained in case people are gaining/losing multiple levels and they want to keep track or use this as a mechanic in their code somewhere.

* Update exp.cpp

* Update embparser.cpp
This commit is contained in:
Alex King
2022-12-10 19:22:31 -05:00
committed by GitHub
parent 8c707f9fe5
commit d3fac8a0cb
7 changed files with 126 additions and 37 deletions
+24
View File
@@ -1092,6 +1092,30 @@ void handle_player_aa_gain(
lua_setfield(L, -2, "aa_gained");
}
void handle_player_level_up(
QuestInterface *parse,
lua_State* L,
Client* client,
std::string data,
uint32 extra_data,
std::vector<std::any> *extra_pointers
) {
lua_pushinteger(L, std::stoul(data));
lua_setfield(L, -2, "levels_gained");
}
void handle_player_level_down(
QuestInterface *parse,
lua_State* L,
Client* client,
std::string data,
uint32 extra_data,
std::vector<std::any> *extra_pointers
) {
lua_pushinteger(L, std::stoul(data));
lua_setfield(L, -2, "levels_lost");
}
// Item
void handle_item_click(
QuestInterface *parse,