mirror of
https://github.com/ZhengPeiRu21/mod-individual-progression
synced 2025-11-29 23:44:51 +08:00
Code cleanup, add chat command
This commit is contained in:
51
src/cs_individualProgression.cpp
Normal file
51
src/cs_individualProgression.cpp
Normal 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();
|
||||
}
|
||||
Reference in New Issue
Block a user