From 45da3a2efa610c897a7570b67e9f38bda2a31580 Mon Sep 17 00:00:00 2001 From: Niam5 Date: Wed, 13 Nov 2024 19:21:18 -0800 Subject: [PATCH] Add RunCommand for player objects --- methods/CMangos/PlayerMethods.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/methods/CMangos/PlayerMethods.h b/methods/CMangos/PlayerMethods.h index 1cde36ebea..673ac31600 100644 --- a/methods/CMangos/PlayerMethods.h +++ b/methods/CMangos/PlayerMethods.h @@ -3733,6 +3733,19 @@ namespace LuaPlayer return 0; } #endif + + /** + * Runs a command as the [Player]. + * + * @param string command : the command to run + */ + int RunCommand(Eluna* E, Player* player) + { + const char* command = E->CHECKVAL(2); + if (std::string(command).length() > 0) + ChatHandler(player->GetSession()).ExecuteCommand(command); + return 0; + } ElunaRegister PlayerMethods[] = { @@ -4028,6 +4041,8 @@ namespace LuaPlayer { "ResetAchievements", METHOD_REG_NONE }, { "SendMovieStart", METHOD_REG_NONE }, #endif + { "RunCommand", &LuaPlayer::RunCommand }, + // Not implemented methods { "GetChampioningFaction", METHOD_REG_NONE }, // ACore & TC only { "GetRecruiterId", METHOD_REG_NONE }, // not implemented @@ -4062,8 +4077,7 @@ namespace LuaPlayer { "ResetHonor", METHOD_REG_NONE }, // classic only { "ClearHonorInfo", METHOD_REG_NONE }, // classic only { "GetXP", METHOD_REG_NONE }, // not implemented - { "GetXPForNextLevel", METHOD_REG_NONE }, // not implemented - { "RunCommand", METHOD_REG_NONE } // not implemented + { "GetXPForNextLevel", METHOD_REG_NONE } // not implemented }; }; #endif