mirror of
https://github.com/NathanHandley/mod-ah-bot-plus.git
synced 2026-01-13 09:17:21 +00:00
added chat commands for GMs
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user