Found original script here https://www.ac-web.org/forums/showth...f-command-help and updated it to work with TrinityCore rev. 4b309f7ee558+
Script copies shell from cs_cast.cpp and modifies methods used by it pretty much. If you have any problems with your specific revision of TrinityCore then just copy the shell from cs_cast.cpp and modify the handler so it matches mine, or something similar. Enjoy!
Thanks to Alistar for constructive criticism.
Code:
/* ScriptData
Name: cs_buff
%Complete: 100
Comment: Custom buff command.
Created by unknown, updated by MrSolid.
Tested with TrinityCore rev. 4b309f7ee558+
Category: commandscripts
EndScriptData */
#include "Chat.h"
#include "RBAC.h"
#include "WorldSession.h"
using namespace Trinity::ChatCommands;
class buff_commandscript : public CommandScript
{
public:
buff_commandscript() : CommandScript("buff_commandscript") { }
ChatCommandTable GetCommands() const override
{
static ChatCommandTable commandTable =
{
{ "buff", HandleBuffCommand, rbac::RBAC_ROLE_PLAYER, Console::No },
};
return commandTable;
}
static bool HandleBuffCommand(ChatHandler* handler, const char* /**/)
{
Player* player = handler->GetSession()->GetPlayer();
if (player->InArena())
player->GetSession()->SendNotification("You can't use that item in an arena match!");
else
{
player->RemoveAurasByType(SPELL_AURA_MOUNTED);
for (int i = 0; i < (sizeof(m_Auras) / sizeof(m_Auras[0])); i++)
player->AddAura(m_Auras[i], player);
handler->PSendSysMessage("|cffB400B4You have been buffed, enjoy!");
}
return true;
}
private:
static constexpr std::array<uint32, 7> m_Auras{ 48162, 48074, 48170, 43223, 36880, 467, 48469 };
};
void AddSC_buff_commandscript()
{
new buff_commandscript();
}