Advertisement
Guest User

Teleporter

a guest
Aug 10th, 2019
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.67 KB | None | 0 0
  1. #include "Bag.h"
  2. #include "Common.h"
  3. #include "Config.h"
  4. #include "Creature.h"
  5. #include "DatabaseEnv.h"
  6. #include "DBCStructure.h"
  7. #include "Define.h"
  8. #include "Field.h"
  9. #include "GameEventMgr.h"
  10. #include "GossipDef.h"
  11. #include "Item.h"
  12. #include "ItemTemplate.h"
  13. #include "Language.h"
  14. #include "Log.h"
  15. #include "Player.h"
  16. #include "ObjectGuid.h"
  17. #include "ObjectMgr.h"
  18. #include "QueryResult.h"
  19. #include "ScriptedCreature.h"
  20. #include "ScriptedGossip.h"
  21. #include "ScriptMgr.h"
  22. #include "SharedDefines.h"
  23. #include "Transaction.h"
  24. #include "WorldSession.h"
  25. #include "Define.h"
  26. #include "GossipDef.h"
  27. #include "Item.h"
  28. #include "Player.h"
  29. #include "ScriptedGossip.h"
  30. #include "ScriptMgr.h"
  31. #include "Spell.h"
  32. #include "ScriptMgr.h"
  33. #include "ScriptedCreature.h"
  34. #include "GameEventMgr.h"
  35. #include "Player.h"
  36. #include "WorldSession.h"
  37. #include <sstream>
  38. #include <string>
  39. //====== Defined Locations =======
  40.  
  41. // Mall Currently: River's Heart
  42. #define MallX 5505.55f
  43. #define MallY 4748.57f
  44. #define MallZ -194.433f
  45. #define MallO 2.5689f
  46. #define MallM 571
  47.  
  48. // PvP Currently: Dire Maul
  49. #define PvPX -3761.47f
  50. #define PvPY 1137.59f
  51. #define PvPZ 131.099f
  52. #define PvPO 4.7281f
  53. #define PvPM 1
  54.  
  55. class Teleporter : public  CreatureScript
  56. {
  57. public:
  58.     Teleporter() : CreatureScript("Teleporter")
  59.     {
  60.     }
  61.  
  62.     bool OnGossipHello(Player* player, Creature* creature)
  63.     {
  64.         //AddGossipItemFor(Player* player, uint32 icon, std::string const& text, uint32 sender, uint32 action);
  65.         if (player->IsInCombat())
  66.         {
  67.             creature->Whisper("You're in combat.", LANG_UNIVERSAL, player);
  68.             return true;
  69.         }
  70.         AddGossipItemFor(player, 1, "|TInterface/ICONS/achievement_zone_westfall_01:35:35:-23:0|t Moonbrook", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
  71.         AddGossipItemFor(player, 1, "|TInterface/ICONS/achievement_zone_sholazar_01:35:35:-23:0|t [Mall] River's Heart", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3);
  72.         AddGossipItemFor(player, 1, "|TInterface/ICONS/achievement_arena_2v2_7:35:35:-23:0|t [PvP] Dire Maul Arena", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4);
  73.         AddGossipItemFor(player, 1, "Nevermind ..", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
  74.         player->PlayerTalkClass->SendGossipMenu(1, creature->GetGUID());
  75.         return true;
  76.     }
  77.  
  78.     bool OnGossipSelect(Player * player, Creature * creature, uint32 Sender, uint32 action)
  79.     {
  80.         player->PlayerTalkClass->ClearMenus();
  81.         if (player->IsInCombat())
  82.         {
  83.             creature->Whisper("You're in combat.", LANG_UNIVERSAL, player);
  84.             return true;
  85.         }
  86.  
  87.         if(Sender == GOSSIP_SENDER_MAIN)
  88.             switch (action)
  89.             {
  90.             case GOSSIP_ACTION_INFO_DEF +1:
  91.                 break;
  92.             case GOSSIP_ACTION_INFO_DEF + 2:
  93.                 player->TeleportTo(0, -10936.608398f, 1424.476196f, 42.965355f, 2.962100f);
  94.                 creature->Whisper("You've been teleported to Moonbrook.", LANG_UNIVERSAL, player);
  95.                 break;
  96.             case GOSSIP_ACTION_INFO_DEF + 3:
  97.                 player->TeleportTo(MallM, MallX, MallY, MallZ, MallO);
  98.                 creature->Whisper("You've been teleported to the Mall.", LANG_UNIVERSAL, player);
  99.                 break;
  100.             case GOSSIP_ACTION_INFO_DEF + 4:
  101.                 player->TeleportTo(PvPM, PvPX, PvPY, PvPZ, PvPO);
  102.                 creature->Whisper("You've been teleported to the PvP Arena.", LANG_UNIVERSAL, player);
  103.                 break;
  104.             }
  105.         player->PlayerTalkClass->SendCloseGossip();
  106.         return true;
  107.     }
  108. };
  109.  
  110. void AddSC_Teleporter()
  111. {
  112.     new Teleporter();
  113. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement