Advertisement
Rochet2

TimedTeleport

May 19th, 2013
370
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.27 KB | None | 0 0
  1. #include "ScriptPCH.h"
  2. #include "AccountMgr.h"
  3.  
  4. class vipnpc : public CreatureScript
  5. {
  6. public:
  7.     vipnpc() : CreatureScript("vipnpc") { }
  8.  
  9.     bool OnGossipHello(Player * player, Creature * creature)
  10.     {
  11.         player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Teleport", GOSSIP_SENDER_MAIN, 101);
  12.         player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Vendors", GOSSIP_SENDER_MAIN, 102);
  13.         player->SEND_GOSSIP_MENU(1, creature->GetGUID());
  14.         return true;
  15.     }
  16.  
  17.     bool OnGossipSelect(Player * player, Creature * creature, uint32 sender, uint32 uiAction)
  18.     {
  19.         player->PlayerTalkClass->ClearMenus();
  20.         switch(uiAction)
  21.         {
  22.         case 101:
  23.             player->ADD_GOSSIP_ITEM(11, "Premium Mall", GOSSIP_SENDER_MAIN, 901);
  24.             player->PlayerTalkClass->SendGossipMenu(1, creature->GetGUID());
  25.             break; 
  26.  
  27.         case 102:
  28.             player->ADD_GOSSIP_ITEM(11, "Gems", GOSSIP_SENDER_MAIN, 901);
  29.             player->ADD_GOSSIP_ITEM(11, "Glyphs", GOSSIP_SENDER_MAIN, 901);
  30.             player->ADD_GOSSIP_ITEM(11, "Profession Materials", GOSSIP_SENDER_MAIN, 901);
  31.             player->PlayerTalkClass->SendGossipMenu(1, creature->GetGUID());
  32.             break;
  33.  
  34.         case 901:
  35.             player->PlayerTalkClass->SendCloseGossip();
  36.             player->CastSpell(player, 19484, true);
  37.             new TimedTeleport(player, 0, -8855.95f, 599.54f, 92.06f, 0.0f, 10000);
  38.             break;
  39.  
  40.         case 9:
  41.             OnGossipHello(player, creature);
  42.             break;
  43.         }
  44.         return true;
  45.     }
  46.  
  47.     class TimedTeleport : public BasicEvent
  48.     {
  49.     public:
  50.         TimedTeleport(Player* player, uint32 map, float x, float y, float z, float o, uint32 delay) : _player(player), _map(map), _x(x), _y(y), _z(z), _o(o)
  51.         {
  52.             player->m_Events.AddEvent(this, player->m_Events.CalculateTime(delay));
  53.         }
  54.         bool Execute(uint64 /*time*/, uint32 /*diff*/)
  55.         {
  56.             _player->TeleportTo(_map, _x, _y, _z, _o);
  57.             return true;
  58.         }
  59.         Player* _player;
  60.         uint32 _map;
  61.         float _x;
  62.         float _y;
  63.         float _z;
  64.         float _o;
  65.     };
  66. };
  67.  
  68. void AddSC_vipnpc()
  69. {
  70.     new vipnpc;
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement