added chat commands for GMs

This commit is contained in:
zeb
2025-10-04 14:48:54 -04:00
parent 8fcf697d37
commit 2a6d228f86
3 changed files with 75 additions and 0 deletions

View File

@@ -2,6 +2,7 @@
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
*/
#include "Chat.h"
#include "ScriptMgr.h"
#include "AuctionHouseBot.h"
#include "Log.h"
@@ -118,9 +119,59 @@ public:
}
};
class AHBot_CommandScript : public CommandScript
{
public:
AHBot_CommandScript() : CommandScript("AHBot_CommandScript") { }
Acore::ChatCommands::ChatCommandTable GetCommands() const override
{
static Acore::ChatCommands::ChatCommandTable AHBotCommandTable = {
{"update", HandleAHBotUpdateCommand, SEC_GAMEMASTER, Acore::ChatCommands::Console::Yes},
{"reload", HandleAHBotReloadCommand, SEC_GAMEMASTER, Acore::ChatCommands::Console::Yes},
{"empty", HandleAHBotEmptyCommand, SEC_GAMEMASTER, Acore::ChatCommands::Console::Yes}
};
static Acore::ChatCommands::ChatCommandTable commandTable = {
{"ahbot", AHBotCommandTable},
};
return commandTable;
}
static bool HandleAHBotUpdateCommand(ChatHandler* handler, const char* /*args*/)
{
LOG_INFO("module", "AuctionHouseBot: Updating Auction House...");
handler->PSendSysMessage("AuctionHouseBot: Updating Auction House...");
AuctionHouseBot::instance()->Update();
return true;
}
static bool HandleAHBotReloadCommand(ChatHandler* handler, char const* /*args*/)
{
LOG_INFO("module", "AuctionHouseBot: Reloading Config...");
handler->PSendSysMessage("AuctionHouseBot: Reloading Config...");
// Reload config file with isReload = true
sConfigMgr->LoadModulesConfigs(true, false);
AuctionHouseBot::instance()->InitializeConfiguration();
AuctionHouseBot::instance()->PopulateItemCandidatesAndProportions();
return true;
}
static bool HandleAHBotEmptyCommand(ChatHandler* handler, char const* /*args*/)
{
LOG_INFO("module", "AuctionHouseBot: Emptying Auction House...");
handler->PSendSysMessage("AuctionHouseBot: Emptying Auction House...");
AuctionHouseBot::instance()->EmptyAuctionHouses();
return true;
}
};
void AddAHBotScripts()
{
new AHBot_WorldScript();
new AHBot_AuctionHouseScript();
new AHBot_MailScript();
new AHBot_CommandScript();
}