Advertisement
EmuDevs

TrinityCore CommandScript Cleanup

Oct 27th, 2013
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.30 KB | None | 0 0
  1. #include "Chat.h"
  2.  
  3. class utility_commandscript : public CommandScript
  4. {
  5. public:
  6.     utility_commandscript() : CommandScript("utility_commandscript") { }
  7.  
  8.     ChatCommand* GetCommands() const
  9.     {
  10.         static ChatCommand utilityCommandTable[] =
  11.         {
  12.             { "changerace",            SEC_PLAYER,  false, &HandleChangeRaceCommand,             "", NULL },
  13.             { "changefaction",                      SEC_PLAYER,  false, &HandleChangeFactionCommand,                "", NULL },
  14.             { "maxskills",                  SEC_PLAYER,  false, &HandleMaxSkillsCommand,            "", NULL },
  15.             { "customize",                  SEC_PLAYER,  false, &HandleCustomizeCommand,            "", NULL },
  16.             { NULL,             0,                  false, NULL,                              "", NULL }
  17.         };
  18.  
  19.         static ChatCommand commandTable[] =
  20.         {
  21.             { "utility",           SEC_PLAYER,      true, NULL,                   "", utilityCommandTable },
  22.             { NULL,             0,                  false, NULL,                               "", NULL }
  23.         };
  24.         return commandTable;
  25.     }
  26.  
  27.     static bool HandleChangeRaceCommand(ChatHandler* handler, const char* args)
  28.     {
  29.         handler->GetSession()->GetPlayer()->SetAtLoginFlag(AT_LOGIN_CHANGE_RACE);
  30.         handler->SendSysMessage("Relog to change race of your character.");
  31.         return true;
  32.     }
  33.  
  34.     static bool HandleChangeFactionCommand(ChatHandler* handler, const char* args)
  35.     {
  36.         handler->GetSession()->GetPlayer()->SetAtLoginFlag(AT_LOGIN_CHANGE_FACTION);
  37.         handler->SendSysMessage("Relog to change faction of your character.");
  38.         return true;
  39.     }
  40.  
  41.     static bool HandleMaxSkillsCommand(ChatHandler* handler, const char* args)
  42.     {
  43.         handler->GetSession()->GetPlayer()->UpdateSkillsForLevel();
  44.         handler->SendSysMessage("Your weapon skills are now maximized.");
  45.         return true;
  46.     }
  47.  
  48.     static bool HandleCustomizeCommand(ChatHandler* handler, const char* args)
  49.     {
  50.         handler->GetSession()->GetPlayer()->SetAtLoginFlag(AT_LOGIN_CUSTOMIZE);
  51.         handler->SendSysMessage("Relog to customize your character.");
  52.         return true;
  53.     }
  54. };
  55.  
  56. void AddSC_utility_commandscript()
  57. {
  58.     new utility_commandscript();
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement