Advertisement
Guest User

Untitled

a guest
Jun 18th, 2016
419
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.50 KB | None | 0 0
  1. /*
  2. <--------------------------------------------------------------------------->
  3.  Made by : Buxbunny
  4.  Description : User stone (Teleport / Repair / Reset talents ).
  5.  Script name to be used in the SQL query : user_stone
  6.  Before you compile please change TeleportTo(Z, X, Y, Z, O) with the right
  7.  coords to match your starter / duel area if you have any.
  8. <--------------------------------------------------------------------------->
  9. */
  10.  
  11. #include "ScriptMgr.h"
  12. #include "ScriptedCreature.h"
  13. #include "Spell.h"
  14.  
  15.  
  16. class user_stone : public ItemScript
  17. {
  18. public:
  19.     user_stone() : ItemScript("user_stone") { }
  20.  
  21.     bool OnUse(Player* player, Item* item, const SpellCastTargets &)
  22.     {
  23.         if (player->IsInCombat())
  24.         {  
  25.             player->GetSession()->SendNotification("You can't use this item in combat!");
  26.             return false;
  27.         }
  28.        
  29.         player->PlayerTalkClass->ClearMenus();
  30.         player->ADD_GOSSIP_ITEM(0, "Starter Area", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
  31.         player->ADD_GOSSIP_ITEM(0, "Duel Zone", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
  32.         player->ADD_GOSSIP_ITEM(0, "Teleport me to Dalaran", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3);
  33.         player->ADD_GOSSIP_ITEM(0, "Repair my gear", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4);
  34.         player->ADD_GOSSIP_ITEM(0, "Reset my talents", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5);
  35.         player->ADD_GOSSIP_ITEM(0, "Remove sickness", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6);
  36.  
  37.         player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, item->GetGUID());
  38.         return false;
  39.     }
  40.     void OnGossipSelect(Player* player, Item* /*item*/, uint32 /*sender*/, uint32 action) override
  41.     {
  42.         player->PlayerTalkClass->ClearMenus();
  43.  
  44.         switch (action)
  45.         {
  46.         case GOSSIP_ACTION_INFO_DEF + 1:
  47.             player->TeleportTo(Z, X, Y, Z, O);
  48.             break;
  49.         case GOSSIP_ACTION_INFO_DEF + 2:
  50.             player->TeleportTo(Z, X, Y, Z, O);
  51.             break;
  52.         case GOSSIP_ACTION_INFO_DEF + 3:
  53.             player->TeleportTo(571, 5804.149902, 624.770996, 647.767029, 1.640000);
  54.             break;
  55.         case GOSSIP_ACTION_INFO_DEF + 4:
  56.             player->DurabilityRepairAll(false, 0, false);
  57.             player->CLOSE_GOSSIP_MENU();
  58.             break;
  59.         case GOSSIP_ACTION_INFO_DEF + 5:
  60.             player->ResetTalents(true);
  61.             player->SendTalentsInfoData(false);
  62.             player->CLOSE_GOSSIP_MENU();
  63.             break;
  64.         case GOSSIP_ACTION_INFO_DEF + 6:
  65.             if (player->HasAura(15007))
  66.                 player->RemoveAura(15007);
  67.             player->CLOSE_GOSSIP_MENU();
  68.             break;
  69.         }
  70.         player->CLOSE_GOSSIP_MENU();
  71.     }
  72.  
  73. };
  74.  
  75. void AddSC_user_stone()
  76. {
  77.     new user_stone();
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement