Code cleanup, add chat command

This commit is contained in:
郑佩茹
2022-09-15 14:26:20 -06:00
parent 2f1d419ee4
commit 58b2dc67b4
6 changed files with 363 additions and 287 deletions

View File

@@ -0,0 +1,51 @@
#include "Chat.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "Tokenize.h"
#include "IndividualProgression.h"
using namespace Acore::ChatCommands;
class individualProgression_commandscript : public CommandScript
{
public:
individualProgression_commandscript() : CommandScript("individualProgression_commandscript") { }
ChatCommandTable GetCommands() const override
{
static ChatCommandTable individualProgressionTable =
{
{ "set", HandleSetIndividualProgressionCommand, SEC_GAMEMASTER, Console::Yes },
};
static ChatCommandTable commandTable =
{
{ "individualProgression", individualProgressionTable },
};
return commandTable;
}
static bool HandleSetIndividualProgressionCommand(ChatHandler* handler, Optional<PlayerIdentifier> player, uint32 progressionLevel)
{
if (progressionLevel > PROGRESSION_WOTLK_TIER_5)
{
handler->SendSysMessage("Invalid progression level.");
return false;
}
Player* target = player->GetConnectedPlayer();
if (target)
{
sIndividualProgression->UpdateProgressionState(target, static_cast<ProgressionState>(progressionLevel));
handler->SendSysMessage("Progression state updated successfully");
}
return true;
}
};
void AddSC_individualProgression_commandscript()
{
new individualProgression_commandscript();
}