mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 16:51:29 +00:00
[Quest API] Add Additional XP Events EVENT_AA_EXP_GAIN, EVENT_EXP_GAIN (#2865)
* Add XP Events * Tweak * Formatting * Additional tweak * Adjustment * Update export naming * Formatting * Indenting * Finalizing formatting * Indenting adjustments * Use tab character setting * Remove double tabs * Update exp.cpp --------- Co-authored-by: Alex King <89047260+Kinglykrab@users.noreply.github.com>
This commit is contained in:
parent
fc7c30977a
commit
e57979c3a8
@ -161,6 +161,8 @@ const char *QuestEventSubroutines[_LargestEventID] = {
|
||||
"EVENT_TASK_BEFORE_UPDATE",
|
||||
"EVENT_AA_BUY",
|
||||
"EVENT_AA_GAIN",
|
||||
"EVENT_AA_EXP_GAIN",
|
||||
"EVENT_EXP_GAIN",
|
||||
"EVENT_PAYLOAD",
|
||||
"EVENT_LEVEL_DOWN",
|
||||
"EVENT_GM_COMMAND",
|
||||
@ -2084,6 +2086,16 @@ void PerlembParser::ExportEventVariables(
|
||||
break;
|
||||
}
|
||||
|
||||
case EVENT_AA_EXP_GAIN: {
|
||||
ExportVar(package_name.c_str(), "aa_exp_gained", data);
|
||||
break;
|
||||
}
|
||||
|
||||
case EVENT_EXP_GAIN: {
|
||||
ExportVar(package_name.c_str(), "exp_gained", data);
|
||||
break;
|
||||
}
|
||||
|
||||
case EVENT_INSPECT: {
|
||||
ExportVar(package_name.c_str(), "target_id", extradata);
|
||||
if (extra_pointers && extra_pointers->size() == 1) {
|
||||
|
||||
@ -106,6 +106,8 @@ typedef enum {
|
||||
EVENT_TASK_BEFORE_UPDATE,
|
||||
EVENT_AA_BUY,
|
||||
EVENT_AA_GAIN,
|
||||
EVENT_AA_EXP_GAIN,
|
||||
EVENT_EXP_GAIN,
|
||||
EVENT_PAYLOAD,
|
||||
EVENT_LEVEL_DOWN,
|
||||
EVENT_GM_COMMAND,
|
||||
|
||||
13
zone/exp.cpp
13
zone/exp.cpp
@ -804,14 +804,23 @@ void Client::SetEXP(uint64 set_exp, uint64 set_aaxp, bool isrezzexp) {
|
||||
}
|
||||
}
|
||||
|
||||
if (parse->PlayerHasQuestSub(EVENT_EXP_GAIN) && m_pp.exp != set_exp) {
|
||||
parse->EventPlayer(EVENT_EXP_GAIN, this, std::to_string(set_exp - m_pp.exp), 0);
|
||||
}
|
||||
|
||||
if (parse->PlayerHasQuestSub(EVENT_AA_EXP_GAIN) && m_pp.expAA != set_aaxp) {
|
||||
parse->EventPlayer(EVENT_AA_EXP_GAIN, this, std::to_string(set_aaxp - m_pp.expAA), 0);
|
||||
}
|
||||
|
||||
//set the client's EXP and AAEXP
|
||||
m_pp.exp = set_exp;
|
||||
m_pp.expAA = set_aaxp;
|
||||
|
||||
if (GetLevel() < 51) {
|
||||
m_epp.perAA = 0; // turn off aa exp if they drop below 51
|
||||
} else
|
||||
SendAlternateAdvancementStats(); //otherwise, send them an AA update
|
||||
} else {
|
||||
SendAlternateAdvancementStats(); //otherwise, send them an AA update
|
||||
}
|
||||
|
||||
//send the expdata in any case so the xp bar isnt stuck after leveling
|
||||
uint32 tmpxp1 = GetEXPForLevel(GetLevel()+1);
|
||||
|
||||
@ -4736,7 +4736,9 @@ luabind::scope lua_register_events() {
|
||||
luabind::value("inspect", static_cast<int>(EVENT_INSPECT)),
|
||||
luabind::value("task_before_update", static_cast<int>(EVENT_TASK_BEFORE_UPDATE)),
|
||||
luabind::value("aa_buy", static_cast<int>(EVENT_AA_BUY)),
|
||||
luabind::value("aa_gain", static_cast<int>(EVENT_AA_GAIN)),
|
||||
luabind::value("aa_gained", static_cast<int>(EVENT_AA_GAIN)),
|
||||
luabind::value("aa_exp_gained", static_cast<int>(EVENT_AA_EXP_GAIN)),
|
||||
luabind::value("exp_gain", static_cast<int>(EVENT_EXP_GAIN)),
|
||||
luabind::value("payload", static_cast<int>(EVENT_PAYLOAD)),
|
||||
luabind::value("level_down", static_cast<int>(EVENT_LEVEL_DOWN)),
|
||||
luabind::value("gm_command", static_cast<int>(EVENT_GM_COMMAND)),
|
||||
|
||||
@ -148,6 +148,8 @@ const char *LuaEvents[_LargestEventID] = {
|
||||
"event_task_before_update",
|
||||
"event_aa_buy",
|
||||
"event_aa_gain",
|
||||
"event_aa_exp_gain",
|
||||
"event_exp_gain",
|
||||
"event_payload",
|
||||
"event_level_down",
|
||||
"event_gm_command",
|
||||
@ -275,6 +277,8 @@ LuaParser::LuaParser() {
|
||||
PlayerArgumentDispatch[EVENT_INSPECT] = handle_player_inspect;
|
||||
PlayerArgumentDispatch[EVENT_AA_BUY] = handle_player_aa_buy;
|
||||
PlayerArgumentDispatch[EVENT_AA_GAIN] = handle_player_aa_gain;
|
||||
PlayerArgumentDispatch[EVENT_AA_EXP_GAIN] = handle_player_aa_exp_gain;
|
||||
PlayerArgumentDispatch[EVENT_EXP_GAIN] = handle_player_exp_gain;
|
||||
PlayerArgumentDispatch[EVENT_PAYLOAD] = handle_player_payload;
|
||||
PlayerArgumentDispatch[EVENT_LEVEL_UP] = handle_player_level_up;
|
||||
PlayerArgumentDispatch[EVENT_LEVEL_DOWN] = handle_player_level_down;
|
||||
|
||||
@ -1181,6 +1181,30 @@ void handle_player_aa_gain(
|
||||
lua_setfield(L, -2, "aa_gained");
|
||||
}
|
||||
|
||||
void handle_player_aa_exp_gain(
|
||||
QuestInterface *parse,
|
||||
lua_State* L,
|
||||
Client* client,
|
||||
std::string data,
|
||||
uint32 extra_data,
|
||||
std::vector<std::any> *extra_pointers
|
||||
) {
|
||||
lua_pushinteger(L, std::stoull(data));
|
||||
lua_setfield(L, -2, "aa_exp_gained");
|
||||
}
|
||||
|
||||
void handle_player_exp_gain(
|
||||
QuestInterface *parse,
|
||||
lua_State* L,
|
||||
Client* client,
|
||||
std::string data,
|
||||
uint32 extra_data,
|
||||
std::vector<std::any> *extra_pointers
|
||||
) {
|
||||
lua_pushinteger(L, std::stoull(data));
|
||||
lua_setfield(L, -2, "exp_gained");
|
||||
}
|
||||
|
||||
void handle_player_level_up(
|
||||
QuestInterface *parse,
|
||||
lua_State* L,
|
||||
|
||||
@ -608,6 +608,24 @@ void handle_player_aa_gain(
|
||||
std::vector<std::any> *extra_pointers
|
||||
);
|
||||
|
||||
void handle_player_aa_exp_gain(
|
||||
QuestInterface *parse,
|
||||
lua_State* L,
|
||||
Client* client,
|
||||
std::string data,
|
||||
uint32 extra_data,
|
||||
std::vector<std::any> *extra_pointers
|
||||
);
|
||||
|
||||
void handle_player_exp_gain(
|
||||
QuestInterface *parse,
|
||||
lua_State* L,
|
||||
Client* client,
|
||||
std::string data,
|
||||
uint32 extra_data,
|
||||
std::vector<std::any> *extra_pointers
|
||||
);
|
||||
|
||||
void handle_player_payload(
|
||||
QuestInterface *parse,
|
||||
lua_State* L,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user