/* * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see . */ #include "Chat.h" #include "GuildTaskMgr.h" #include "PerformanceMonitor.h" #include "PlayerbotMgr.h" #include "RandomPlayerbotMgr.h" #include "ScriptMgr.h" class playerbots_commandscript : public CommandScript { public: playerbots_commandscript() : CommandScript("playerbots_commandscript") { } std::vector GetCommands() const override { static std::vector playerbotsCommandTable = { { "bot", SEC_PLAYER, false, &HandlePlayerbotCommand, nullptr }, { "gtask", SEC_GAMEMASTER, true, &HandleGuildTaskCommand, nullptr }, { "pmon", SEC_GAMEMASTER, true, &HandlePerfMonCommand, nullptr }, { "rndbot", SEC_GAMEMASTER, true, &HandleRandomPlayerbotCommand, nullptr } }; static std::vector commandTable = { { "playerbots", SEC_PLAYER, true, nullptr, "", playerbotsCommandTable }, }; return commandTable; } static bool HandlePlayerbotCommand(ChatHandler* handler, char const* args) { return PlayerbotMgr::HandlePlayerbotMgrCommand(handler, args); } static bool HandleRandomPlayerbotCommand(ChatHandler* handler, char const* args) { return RandomPlayerbotMgr::HandlePlayerbotConsoleCommand(handler, args); } static bool HandleGuildTaskCommand(ChatHandler* handler, char const* args) { return GuildTaskMgr::HandleConsoleCommand(handler, args); } static bool HandlePerfMonCommand(ChatHandler* handler, char const* args) { if (!strcmp(args, "reset")) { sPerformanceMonitor->Reset(); return true; } if (!strcmp(args, "tick")) { sPerformanceMonitor->PrintStats(true, false); return true; } if (!strcmp(args, "stack")) { sPerformanceMonitor->PrintStats(false, true); return true; } sPerformanceMonitor->PrintStats(); return true; } }; void AddSC_playerbots_commandscript() { new playerbots_commandscript(); }