From 4f5824b4a199efddebd8faa3d381b5981cf2e04d Mon Sep 17 00:00:00 2001 From: Dencelle Date: Wed, 16 Jun 2021 10:04:34 -0500 Subject: [PATCH] [Feature] Add lua and perl event for test buff (#1403) * [Feature] Add lua and perl event for test buff * added EnableTestBuff --- common/ruletypes.h | 1 + zone/client_packet.cpp | 4 ++++ zone/embparser.cpp | 3 ++- zone/event_codes.h | 1 + zone/lua_general.cpp | 3 ++- zone/lua_parser.cpp | 4 +++- zone/lua_parser_events.cpp | 3 +++ zone/lua_parser_events.h | 2 ++ 8 files changed, 18 insertions(+), 3 deletions(-) diff --git a/common/ruletypes.h b/common/ruletypes.h index 9047d0d66..d045b44c4 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -165,6 +165,7 @@ RULE_BOOL(Character, ProcessFearedProximity, false, "Processes proximity checks RULE_BOOL(Character, EnableCharacterEXPMods, false, "Enables character zone-based experience modifiers.") RULE_BOOL(Character, PVPEnableGuardFactionAssist, true, "Enables faction based assisting against the aggresor in pvp.") RULE_BOOL(Character, SkillUpFromItems, true, "Allow Skill ups from clickable items") +RULE_BOOL(Character, EnableTestBuff, false, "Allow the use of /testbuff") RULE_CATEGORY_END() RULE_CATEGORY(Mercs) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index ea7ad932a..92b3080c7 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -14059,6 +14059,10 @@ void Client::Handle_OP_Taunt(const EQApplicationPacket *app) void Client::Handle_OP_TestBuff(const EQApplicationPacket *app) { + if (!RuleB(Character, EnableTestBuff)) { + return; + } + parse->EventPlayer(EVENT_TEST_BUFF, this, "", 0); return; } diff --git a/zone/embparser.cpp b/zone/embparser.cpp index db37a58e7..22e4b3234 100644 --- a/zone/embparser.cpp +++ b/zone/embparser.cpp @@ -119,7 +119,8 @@ const char *QuestEventSubroutines[_LargestEventID] = { "EVENT_DEATH_ZONE", "EVENT_USE_SKILL", "EVENT_COMBINE_VALIDATE", - "EVENT_BOT_COMMAND" + "EVENT_BOT_COMMAND", + "EVENT_TEST_BUFF" }; PerlembParser::PerlembParser() : perl(nullptr) diff --git a/zone/event_codes.h b/zone/event_codes.h index 110101cf9..5765c56ff 100644 --- a/zone/event_codes.h +++ b/zone/event_codes.h @@ -88,6 +88,7 @@ typedef enum { EVENT_USE_SKILL, EVENT_COMBINE_VALIDATE, EVENT_BOT_COMMAND, + EVENT_TEST_BUFF, _LargestEventID } QuestEventID; diff --git a/zone/lua_general.cpp b/zone/lua_general.cpp index 7b6c5bcdb..f83fd76d9 100644 --- a/zone/lua_general.cpp +++ b/zone/lua_general.cpp @@ -3203,7 +3203,8 @@ luabind::scope lua_register_events() { luabind::value("tick", static_cast(EVENT_TICK)), luabind::value("spawn_zone", static_cast(EVENT_SPAWN_ZONE)), luabind::value("death_zone", static_cast(EVENT_DEATH_ZONE)), - luabind::value("use_skill", static_cast(EVENT_USE_SKILL)) + luabind::value("use_skill", static_cast(EVENT_USE_SKILL)), + luabind::value("test_buff", static_cast(EVENT_TEST_BUFF)) ]; } diff --git a/zone/lua_parser.cpp b/zone/lua_parser.cpp index 1fc0fc47a..1342c719e 100644 --- a/zone/lua_parser.cpp +++ b/zone/lua_parser.cpp @@ -130,7 +130,8 @@ const char *LuaEvents[_LargestEventID] = { "event_death_zone", "event_use_skill", "event_combine_validate", - "event_bot_command" + "event_bot_command", + "event_test_buff" }; extern Zone *zone; @@ -213,6 +214,7 @@ LuaParser::LuaParser() { PlayerArgumentDispatch[EVENT_RESPAWN] = handle_player_respawn; PlayerArgumentDispatch[EVENT_UNHANDLED_OPCODE] = handle_player_packet; PlayerArgumentDispatch[EVENT_USE_SKILL] = handle_player_use_skill; + PlayerArgumentDispatch[EVENT_TEST_BUFF] = handle_test_buff; PlayerArgumentDispatch[EVENT_COMBINE_VALIDATE] = handle_player_combine_validate; PlayerArgumentDispatch[EVENT_BOT_COMMAND] = handle_player_bot_command; diff --git a/zone/lua_parser_events.cpp b/zone/lua_parser_events.cpp index 9a1a2c67f..73acd9232 100644 --- a/zone/lua_parser_events.cpp +++ b/zone/lua_parser_events.cpp @@ -514,6 +514,9 @@ void handle_player_use_skill(QuestInterface *parse, lua_State* L, Client* client lua_setfield(L, -2, "skill_level"); } +void handle_test_buff(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, std::vector* extra_pointers) { +} + void handle_player_combine_validate(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, std::vector* extra_pointers) { Seperator sep(data.c_str()); diff --git a/zone/lua_parser_events.h b/zone/lua_parser_events.h index 0f826a421..47e7883ae 100644 --- a/zone/lua_parser_events.h +++ b/zone/lua_parser_events.h @@ -97,6 +97,8 @@ void handle_player_null(QuestInterface *parse, lua_State* L, Client* client, std std::vector *extra_pointers); void handle_player_use_skill(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data, std::vector *extra_pointers); +void handle_test_buff(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, + std::vector* extra_pointers); void handle_player_combine_validate(QuestInterface* parse, lua_State* L, Client* client, std::string data, uint32 extra_data, std::vector* extra_pointers); void handle_player_bot_command(QuestInterface *parse, lua_State* L, Client* client, std::string data, uint32 extra_data,