From 67b3ac442a1078abac2aa1bb12af73bb6c1b1a17 Mon Sep 17 00:00:00 2001 From: Kargatum Date: Sat, 30 Oct 2021 00:38:06 +0700 Subject: [PATCH] fix(Core/Chat): add missing Eluna chat api (#8821) --- .../game/Chat/ChatCommands/ChatCommand.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/server/game/Chat/ChatCommands/ChatCommand.cpp b/src/server/game/Chat/ChatCommands/ChatCommand.cpp index ea647c865..bbaced351 100644 --- a/src/server/game/Chat/ChatCommands/ChatCommand.cpp +++ b/src/server/game/Chat/ChatCommands/ChatCommand.cpp @@ -21,13 +21,16 @@ #include "DBCStores.h" #include "DatabaseEnv.h" #include "Log.h" -#include "Map.h" #include "Player.h" #include "ScriptMgr.h" #include "StringFormat.h" #include "Tokenize.h" #include "WorldSession.h" +#ifdef ELUNA +#include "LuaEngine.h" +#endif + using ChatSubCommandMap = std::map; void Acore::Impl::ChatCommands::ChatCommandNode::LoadFromBuilder(ChatCommandBuilder const& builder) @@ -333,12 +336,26 @@ namespace Acore::Impl::ChatCommands } else if (!handler.HasSentErrorMessage()) { /* invocation failed, we should show usage */ +#ifdef ELUNA + if (!sEluna->OnCommand(handler.IsConsole() ? nullptr : handler.GetSession()->GetPlayer(), std::string(cmdStr).c_str())) + { + return true; + } +#endif + cmd->SendCommandHelp(handler); handler.SetSentErrorMessage(true); } return true; } +#ifdef ELUNA + if (!sEluna->OnCommand(handler.IsConsole() ? nullptr : handler.GetSession()->GetPlayer(), std::string(cmdStr).c_str())) + { + return true; + } +#endif + return false; }