Advertisement
julienanid

[Trinity] V.I.P. Commands

Sep 18th, 2013
457
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.69 KB | None | 0 0
  1. /*
  2. <--------------------------------------------------------------------------->
  3. - Developer(s): Ghostcrawler336,Parranoia.
  4. - Updated by: Synth
  5. - Complete: %100
  6. - ScriptName: 'vipcommands'
  7. - Comment: Tested.
  8. <--------------------------------------------------------------------------->
  9. */
  10.  
  11. #include "ScriptMgr.h"
  12. #include "ObjectMgr.h"
  13. #include "MapManager.h"
  14. #include "Chat.h"
  15. #include "Common.h"
  16. #include "Language.h"
  17.  
  18. class vipcommands : public CommandScript
  19. {
  20. public:
  21.     vipcommands() : CommandScript("vipcommands") { }
  22.  
  23.     ChatCommand* GetCommands() const
  24.     {
  25.         static ChatCommand vipCommandTable[] =
  26.  
  27.         {
  28.             { "mall",       1,     true, &HandleVipMallCommand,         "", NULL },
  29.             { "changerace",    1,  false, &HandleChangeRaceCommand,             "", NULL },
  30.         { "changefaction"1,  false, &HandleChangeFactionCommand,     "", NULL },
  31.         { "customize"1,  false, &HandleCustomizeCommand,     "", NULL },
  32.         { "tele",           1,  false, &HandleTeleCommand,      "", NULL },
  33.  
  34.             { NULL,             0,                     false, NULL,                                           "", NULL }
  35.         };
  36.         static ChatCommand commandTable[] =
  37.         {
  38.             { "vip",        1,   true, NULL,      "",  vipCommandTable},
  39.            { NULL,             0,                  false, NULL,                               "", NULL }
  40.         };
  41.         return commandTable;
  42.     }
  43.  
  44.  
  45.  
  46. static bool HandleTeleCommand(ChatHandler* handler, const char* args)
  47.     {
  48.         if (!*args)
  49.             return false;
  50.  
  51.         Player* me = handler->GetSession()->GetPlayer();
  52.  
  53.         // id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r
  54.         GameTele const* tele = handler->extractGameTeleFromLink((char*)args);
  55.  
  56.         if (!tele)
  57.         {
  58.             handler->SendSysMessage(LANG_COMMAND_TELE_NOTFOUND);
  59.             handler->SetSentErrorMessage(true);
  60.             return false;
  61.         }
  62.  
  63.         if (me->IsInCombat())
  64.         {
  65.             handler->SendSysMessage(LANG_YOU_IN_COMBAT);
  66.             handler->SetSentErrorMessage(true);
  67.             return false;
  68.         }
  69.  
  70.         MapEntry const* map = sMapStore.LookupEntry(tele->mapId);
  71.         if (!map || map->IsBattlegroundOrArena())
  72.         {
  73.             handler->SendSysMessage(LANG_CANNOT_TELE_TO_BG);
  74.             handler->SetSentErrorMessage(true);
  75.             return false;
  76.         }
  77.  
  78.         // stop flight if need
  79.         if (me->IsInFlight())
  80.         {
  81.             me->GetMotionMaster()->MovementExpired();
  82.             me->CleanupAfterTaxiFlight();
  83.         }
  84.         // save only in non-flight case
  85.         else
  86.             me->SaveRecallPosition();
  87.  
  88.         me->TeleportTo(tele->mapId, tele->position_x, tele->position_y, tele->position_z, tele->orientation);
  89.         return true;
  90.         }
  91.  
  92. static bool HandlevipCommand(ChatHandler* handler, const char* args)
  93.     {
  94.  
  95.         Player* me = handler->GetSession()->GetPlayer();
  96.  
  97.             me->Say("vip command?", LANG_UNIVERSAL);
  98.             return true;
  99.     }
  100.  
  101. static bool HandleChangeRaceCommand(ChatHandler* handler, const char* args)
  102.     {
  103.  
  104.         Player* me = handler->GetSession()->GetPlayer();
  105.         me->SetAtLoginFlag(AT_LOGIN_CHANGE_RACE);
  106.         handler->PSendSysMessage("Relog to change race of your character.");
  107.         return true;
  108.     }
  109.  
  110. static bool HandleChangeFactionCommand(ChatHandler* handler, const char* args)
  111.     {
  112.  
  113.         Player* me = handler->GetSession()->GetPlayer();
  114.         me->SetAtLoginFlag(AT_LOGIN_CHANGE_FACTION);
  115.         handler->PSendSysMessage("Relog to change faction of your character.");
  116.         return true;
  117.     }
  118.  
  119.  
  120. static bool HandleCustomizeCommand(ChatHandler* handler, const char* args)
  121.     {
  122.  
  123.         Player* me = handler->GetSession()->GetPlayer();
  124.         me->SetAtLoginFlag(AT_LOGIN_CUSTOMIZE);
  125.         handler->PSendSysMessage("Relog to customize your character.");
  126.         return true;
  127.     }
  128.  
  129. static bool HandleVipMallCommand(ChatHandler* handler, const char* args)
  130.     {
  131.  
  132.         Player* me = handler->GetSession()->GetPlayer();
  133.  
  134.         if (me->IsInCombat())
  135.         {
  136.             handler->SendSysMessage(LANG_YOU_IN_COMBAT);
  137.             handler->SetSentErrorMessage(true);
  138.             return false;
  139.         }
  140.  
  141.         // stop flight if need
  142.         if (me->IsInFlight())
  143.         {
  144.             me->GetMotionMaster()->MovementExpired();
  145.             me->CleanupAfterTaxiFlight();
  146.         }
  147.         // save only in non-flight case
  148.         else
  149.             me->SaveRecallPosition();
  150.  
  151.         me->TeleportTo(0,   23.8378f,   -1588.85f195.419f,   4.54306f); // MapId, X, Y, Z, O
  152.                 return true;
  153.     }
  154.  
  155.    
  156.    
  157. };
  158.  
  159. void AddSC_vipcommands()
  160. {
  161.     new vipcommands();
  162. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement