Advertisement
yvoms

Vip system

Feb 25th, 2013
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 9.06 KB | None | 0 0
  1. /*
  2. * Made By ???
  3. * Error Fixed By Rochet2
  4. * Released By Ghostcrawler
  5. *EDITED BY yvoms
  6.  
  7. U got to add a Item with itemID ; 313370
  8. If it was me i would make it soulbound, Couse u will be able to .vip activate <- gives u GM level 1 Meaning VIP.
  9. */
  10.  
  11.  
  12. #include "ScriptMgr.h"
  13. #include "ObjectMgr.h"
  14. #include "MapManager.h"
  15. #include "Chat.h"
  16. #include "Common.h"
  17. #include "Language.h"
  18. #include "CellImpl.h"
  19. #include "GridNotifiers.h"
  20.  
  21. class vipcommands : public CommandScript
  22. {
  23. public:
  24.     vipcommands() : CommandScript("vipcommands") { }
  25.  
  26.     ChatCommand* GetCommands() const
  27.     {
  28.         static ChatCommand vipCommandTable[] =
  29.  
  30.         {
  31.             { "island",     SEC_PLAYER,     true, &HandleVipMallCommand,         "", NULL },
  32.             { "changerace",    SEC_PLAYER,  false, &HandleChangeRaceCommand,             "", NULL },
  33.         { "changefaction",  SEC_PLAYER,  false, &HandleChangeFactionCommand,        "", NULL },
  34.         { "maxskills",  SEC_PLAYER,  false, &HandleMaxSkillsCommand,        "", NULL },
  35.         { "customize",  SEC_PLAYER,  false, &HandleCustomizeCommand,        "", NULL },
  36.         { "tele",           SEC_PLAYER,  false, &HandleTeleCommand,     "", NULL },
  37.         { "morph",           SEC_PLAYER,  false, &HandleMorphCommand,       "", NULL },
  38.         { "buffs",           SEC_PLAYER,  false, &HandleBuffCommand,        "", NULL },
  39.         { "activate",           SEC_PLAYER,  false, &HandleActivateCommand,     "", NULL },
  40.         { "getdrunk",       SEC_PLAYER,     false, &HandleGetDrunkCommand,         "", NULL },
  41.         { "soberup",       SEC_PLAYER,     false, &HandleSoberUpCommand,         "", NULL },
  42.         { "respawn",            SEC_PLAYER,      false, &HandleRespawnCommand,               "", 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. static bool HandleActivateCommand(ChatHandler * handler, const char * args)
  55. {
  56.     Player* player = handler->GetSession()->GetPlayer();
  57.  
  58.     if(player->GetSession()->GetSecurity() >= 1)
  59.     {
  60.         handler->PSendSysMessage("You already got VIP rank.");
  61.         handler->SetSentErrorMessage(true);
  62.         return false;
  63.     }
  64.  
  65.     if(player->HasItemCount(313370, 1, false)) // Token ID, Count.
  66.     {
  67.                   PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_ACCOUNT_ACCESS);
  68.                   stmt->setUInt32(0, player->GetSession()->GetAccountId());
  69.                   stmt->setUInt8(1, 1);
  70.                   stmt->setInt32(2, -1);
  71.              LoginDatabase.Execute(stmt);
  72.         player->DestroyItemCount(313370, 1, true, false); // Token ID, Count.
  73.         handler->PSendSysMessage("Your VIP rank has been updated.Login to get it active");
  74.         return true;
  75.     }
  76.     return true;
  77. }
  78.  
  79. static bool HandleTeleCommand(ChatHandler* handler, const char* args)
  80.     {
  81.         if (!*args)
  82.             return false;
  83.  
  84.         Player* me = handler->GetSession()->GetPlayer();
  85.  
  86.         // id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r
  87.         GameTele const* tele = handler->extractGameTeleFromLink((char*)args);
  88.  
  89.         if (!tele)
  90.         {
  91.             handler->SendSysMessage(LANG_COMMAND_TELE_NOTFOUND);
  92.             handler->SetSentErrorMessage(true);
  93.             return false;
  94.         }
  95.  
  96.         if (me->isInCombat())
  97.         {
  98.             handler->SendSysMessage(LANG_YOU_IN_COMBAT);
  99.             handler->SetSentErrorMessage(true);
  100.             return false;
  101.         }
  102.  
  103.         MapEntry const* map = sMapStore.LookupEntry(tele->mapId);
  104.         if (!map || map->IsBattlegroundOrArena())
  105.         {
  106.             handler->SendSysMessage(LANG_CANNOT_TELE_TO_BG);
  107.             handler->SetSentErrorMessage(true);
  108.             return false;
  109.         }
  110.  
  111.         // stop flight if need
  112.         if (me->isInFlight())
  113.         {
  114.             me->GetMotionMaster()->MovementExpired();
  115.             me->CleanupAfterTaxiFlight();
  116.         }
  117.         // save only in non-flight case
  118.         else
  119.             me->SaveRecallPosition();
  120.  
  121.         me->TeleportTo(tele->mapId, tele->position_x, tele->position_y, tele->position_z, tele->orientation);
  122.         return true;
  123.         }
  124.  
  125.  
  126. static bool HandleBuffCommand(ChatHandler * handler, const char * args)
  127.     {
  128.         Player * pl = handler->GetSession()->GetPlayer();
  129.         if(pl->isInCombat())
  130.         {
  131.             pl->GetSession()->SendNotification("You can't use this in combat!");
  132.             return false;
  133.         }
  134.         if(pl->InArena())
  135.         {
  136.             pl->GetSession()->SendNotification("You can't use that item in an arena match!");
  137.             return false;
  138.         }
  139.         else
  140.         pl->AddAura(48162, pl);
  141.         pl->AddAura(48074, pl);
  142.         pl->AddAura(48170, pl);
  143.         pl->AddAura(43223, pl);
  144.         pl->AddAura(36880, pl);
  145.         pl->AddAura(467, pl);
  146.         pl->AddAura(69994, pl);
  147.         pl->AddAura(48469, pl);
  148.         handler->PSendSysMessage("You have been buffed, enjoy!");
  149.         return true;
  150.  
  151.     }
  152.  
  153.  
  154. static bool HandlevipCommand(ChatHandler* handler, const char* args)
  155.     {
  156.  
  157.         Player* me = handler->GetSession()->GetPlayer();
  158.  
  159.             me->Say("vip command?", LANG_UNIVERSAL);
  160.             return true;
  161.     }
  162.  
  163. static bool HandleMorphCommand(ChatHandler* handler, const char* args)
  164.     {
  165.         handler->GetSession()->GetPlayer()->SetDisplayId((uint32)atol((char*)args));
  166.         return true;
  167.     }
  168.  
  169. static bool HandleChangeRaceCommand(ChatHandler* handler, const char* args)
  170.     {
  171.  
  172.         Player* me = handler->GetSession()->GetPlayer();
  173.         me->SetAtLoginFlag(AT_LOGIN_CHANGE_RACE);
  174.         handler->PSendSysMessage("Relog to change race of your character.");
  175.         return true;
  176.     }
  177.  
  178. static bool HandleChangeFactionCommand(ChatHandler* handler, const char* args)
  179.     {
  180.  
  181.         Player* me = handler->GetSession()->GetPlayer();
  182.         me->SetAtLoginFlag(AT_LOGIN_CHANGE_FACTION);
  183.         handler->PSendSysMessage("Relog to change faction of your character.");
  184.         return true;
  185.     }
  186.  
  187. static bool HandleMaxSkillsCommand(ChatHandler* handler, const char* args)
  188.     {
  189.  
  190.         Player* me = handler->GetSession()->GetPlayer();
  191.         me->UpdateSkillsForLevel();
  192.         handler->PSendSysMessage("Your weapon skills are now maximized.");
  193.         return true;
  194.     }
  195.  
  196. static bool HandleCustomizeCommand(ChatHandler* handler, const char* args)
  197.     {
  198.  
  199.         Player* me = handler->GetSession()->GetPlayer();
  200.         me->SetAtLoginFlag(AT_LOGIN_CUSTOMIZE);
  201.         handler->PSendSysMessage("Relog to customize your character.");
  202.         return true;
  203.     }
  204.  
  205. static bool HandleVipMallCommand(ChatHandler* handler, const char* args)
  206.     {
  207.  
  208.         Player* me = handler->GetSession()->GetPlayer();
  209.  
  210.         if (me->isInCombat())
  211.         {
  212.             handler->SendSysMessage(LANG_YOU_IN_COMBAT);
  213.             handler->SetSentErrorMessage(true);
  214.             return false;
  215.         }
  216.  
  217.         // stop flight if need
  218.         if (me->isInFlight())
  219.         {
  220.             me->GetMotionMaster()->MovementExpired();
  221.             me->CleanupAfterTaxiFlight();
  222.         }
  223.         // save only in non-flight case
  224.         else
  225.             me->SaveRecallPosition();
  226.  
  227.         me->TeleportTo(1,   -11851.820313f, -4769.585449f22.753876f, 6.053061f); // MapId, X, Y, Z, O
  228.                 return true;
  229.     }
  230.  
  231. static bool HandleRespawnCommand(ChatHandler* handler, char const* /*args*/)
  232.     {
  233.         Player* player = handler->GetSession()->GetPlayer();
  234.  
  235.         Unit* target = handler->getSelectedUnit();
  236.         if (player->GetSelection() && target)
  237.         {
  238.             if (target->GetTypeId() != TYPEID_UNIT || target->isPet())
  239.             {
  240.                 handler->SendSysMessage(LANG_SELECT_CREATURE);
  241.                 handler->SetSentErrorMessage(true);
  242.                 return false;
  243.             }
  244.             if(player->GetAreaId() == 4723)
  245.                 return false;
  246.  
  247.             if (target->isDead())
  248.                 target->ToCreature()->Respawn();
  249.             return true;
  250.         }
  251.  
  252.         CellCoord p(Trinity::ComputeCellCoord(player->GetPositionX(), player->GetPositionY()));
  253.         Cell cell(p);
  254.         cell.SetNoCreate();
  255.  
  256.         Trinity::RespawnDo u_do;
  257.         Trinity::WorldObjectWorker<Trinity::RespawnDo> worker(player, u_do);
  258.  
  259.         TypeContainerVisitor<Trinity::WorldObjectWorker<Trinity::RespawnDo>, GridTypeMapContainer > obj_worker(worker);
  260.         cell.Visit(p, obj_worker, *player->GetMap(), *player, player->GetGridActivationRange());
  261.  
  262.         return true;
  263.     }
  264.  
  265. static bool HandleGetDrunkCommand(ChatHandler* handler, const char* args)
  266.         {
  267.            
  268.             Player* me = handler->GetSession()->GetPlayer();
  269.                 me->SetDrunkValue(100);
  270.                 handler->PSendSysMessage("You're now drunk!");
  271.             return true;
  272.         }
  273.  
  274. static bool HandleSoberUpCommand(ChatHandler* handler, const char* args)
  275.         {
  276.            
  277.             Player* me = handler->GetSession()->GetPlayer();
  278.                 me->SetDrunkValue(1);
  279.                 handler->PSendSysMessage("It's about time you sober up.");
  280.             return true;
  281. }
  282.    
  283. };
  284.  
  285. void AddSC_vipcommands()
  286. {
  287.     new vipcommands();
  288. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement