Advertisement
Sinistah

[TrinityCore] VIP Commands

Oct 14th, 2012
516
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. * Made By ???
  3. * Error Fixed By Rochet2
  4. * Released By Ghostcrawler
  5. * Edited By Sinistah
  6. */
  7.  
  8. /* Insert Into World Database
  9. INSERT INTO `command` VALUES ('vip mall', '1', '');
  10. INSERT INTO `command` VALUES ('vip changerace', '1', '');
  11. INSERT INTO `command` VALUES ('vip changefaction', '1', '');
  12. INSERT INTO `command` VALUES ('vip maxskills', '1', '');
  13. INSERT INTO `command` VALUES ('vip customize', '1', '');
  14. INSERT INTO `command` VALUES ('vip tele', '1', '');
  15. INSERT INTO `command` VALUES ('vip morph', '1', '');
  16. INSERT INTO `command` VALUES ('vip demorph', '1', '')
  17. */
  18.  
  19. #include "ScriptMgr.h"
  20. #include "ObjectMgr.h"
  21. #include "MapManager.h"
  22. #include "Chat.h"
  23. #include "Common.h"
  24.  
  25. class vipcommands : public CommandScript
  26. {
  27. public:
  28.     vipcommands() : CommandScript("vipcommands") { }
  29.  
  30.     ChatCommand* GetCommands() const
  31.     {
  32.         static ChatCommand vipCommandTable[] =
  33.  
  34.         {
  35.             { "mall",       SEC_PLAYER,     true, &HandleVipMallCommand,         "", NULL },
  36.             { "changerace",    SEC_PLAYER,  false, &HandleChangeRaceCommand,             "", NULL },
  37.             { "changefaction",  SEC_PLAYER,  false, &HandleChangeFactionCommand,        "", NULL },
  38.             { "maxskills",  SEC_PLAYER,  false, &HandleMaxSkillsCommand,        "", NULL },
  39.             { "customize",  SEC_PLAYER,  false, &HandleCustomizeCommand,        "", NULL },
  40.             { "tele",           SEC_PLAYER,  false, &HandleTeleCommand,     "", NULL },
  41.             { "morph",           SEC_PLAYER,  false, &HandleMorphCommand,       "", NULL },
  42.             { "demorph",           SEC_PLAYER,  false, &HandleDemorphCommand,       "", NULL },
  43.  
  44.             { NULL,             0,                     false, NULL,                                           "", NULL }
  45.         };
  46.         static ChatCommand commandTable[] =
  47.         {
  48.             { "vip",        SEC_PLAYER,   true, NULL,      "",  vipCommandTable},
  49.            { NULL,             0,                  false, NULL,                               "", NULL }
  50.         };
  51.         return commandTable;
  52.     }
  53.  
  54.  
  55. static bool HandleTeleCommand(ChatHandler* handler, const char* args)
  56.     {
  57.         if (!*args)
  58.             return false;
  59.  
  60.         Player* me = handler->GetSession()->GetPlayer();
  61.  
  62.         // id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r
  63.         GameTele const* tele = handler->extractGameTeleFromLink((char*)args);
  64.  
  65.         if (!tele)
  66.         {
  67.             handler->SendSysMessage(LANG_COMMAND_TELE_NOTFOUND);
  68.             handler->SetSentErrorMessage(true);
  69.             return false;
  70.         }
  71.  
  72.         if (me->isInCombat())
  73.         {
  74.             handler->SendSysMessage(LANG_YOU_IN_COMBAT);
  75.             handler->SetSentErrorMessage(true);
  76.             return false;
  77.         }
  78.  
  79.         MapEntry const* map = sMapStore.LookupEntry(tele->mapId);
  80.         if (!map || map->IsBattlegroundOrArena())
  81.         {
  82.             handler->SendSysMessage(LANG_CANNOT_TELE_TO_BG);
  83.             handler->SetSentErrorMessage(true);
  84.             return false;
  85.         }
  86.  
  87.         // stop flight if need
  88.         if (me->isInFlight())
  89.         {
  90.             me->GetMotionMaster()->MovementExpired();
  91.             me->CleanupAfterTaxiFlight();
  92.         }
  93.         // save only in non-flight case
  94.         else
  95.             me->SaveRecallPosition();
  96.  
  97.         me->TeleportTo(tele->mapId, tele->position_x, tele->position_y, tele->position_z, tele->orientation);
  98.         return true;
  99.         }
  100.  
  101. static bool HandlevipCommand(ChatHandler* handler, const char* args)
  102.     {
  103.  
  104.         Player* me = handler->GetSession()->GetPlayer();
  105.  
  106.             me->Say("vip command?", LANG_UNIVERSAL);
  107.             return true;
  108.     }
  109.  
  110. static bool HandleMorphCommand(ChatHandler* handler, const char* args)
  111.     {
  112.         handler->GetSession()->GetPlayer()->SetDisplayId((uint32)atol((char*)args));
  113.         return true;
  114.     }
  115.  
  116. static bool HandleChangeRaceCommand(ChatHandler* handler, const char* args)
  117.     {
  118.  
  119.         Player* me = handler->GetSession()->GetPlayer();
  120.         me->SetAtLoginFlag(AT_LOGIN_CHANGE_RACE);
  121.         handler->PSendSysMessage("Relog to change race of your character.");
  122.         return true;
  123.     }
  124.  
  125. static bool HandleChangeFactionCommand(ChatHandler* handler, const char* args)
  126.     {
  127.  
  128.         Player* me = handler->GetSession()->GetPlayer();
  129.         me->SetAtLoginFlag(AT_LOGIN_CHANGE_FACTION);
  130.         handler->PSendSysMessage("Relog to change faction of your character.");
  131.         return true;
  132.     }
  133.  
  134. static bool HandleMaxSkillsCommand(ChatHandler* handler, const char* args)
  135.     {
  136.  
  137.         Player* me = handler->GetSession()->GetPlayer();
  138.         me->UpdateSkillsToMaxSkillsForLevel();
  139.         handler->PSendSysMessage("Your weapon skills are now maximized.");
  140.         return true;
  141.     }
  142.  
  143. static bool HandleCustomizeCommand(ChatHandler* handler, const char* args)
  144.     {
  145.  
  146.         Player* me = handler->GetSession()->GetPlayer();
  147.         me->SetAtLoginFlag(AT_LOGIN_CUSTOMIZE);
  148.         handler->PSendSysMessage("Relog to customize your character.");
  149.         return true;
  150.     }
  151.  
  152. static bool HandleVipMallCommand(ChatHandler* handler, const char* args)
  153.     {
  154.  
  155.         Player* me = handler->GetSession()->GetPlayer();
  156.  
  157.         if (me->isInCombat())
  158.         {
  159.             handler->SendSysMessage(LANG_YOU_IN_COMBAT);
  160.             handler->SetSentErrorMessage(true);
  161.             return false;
  162.         }
  163.  
  164.         // stop flight if need
  165.         if (me->isInFlight())
  166.         {
  167.             me->GetMotionMaster()->MovementExpired();
  168.             me->CleanupAfterTaxiFlight();
  169.         }
  170.         // save only in non-flight case
  171.         else
  172.             me->SaveRecallPosition();
  173.  
  174.         me->TeleportTo(0,   23.8378f,   -1588.85f195.419f,   4.54306f); // MapId, X, Y, Z, O
  175.                 return true;
  176.     }
  177.  
  178. static bool HandleDemorphCommand(ChatHandler* handler, const char* args)
  179.     {
  180.         Player* me = handler->GetSession()->GetPlayer();
  181.         me->DeMorph();
  182.         me->SetFloatValue(OBJECT_FIELD_SCALE_X, 1.0);
  183.         return true;
  184.     }
  185.    
  186. };
  187.  
  188. void AddSC_vipcommands()
  189. {
  190.     new vipcommands();
  191. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement