Advertisement
tok124

Teleporter

Aug 16th, 2015
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.46 KB | None | 0 0
  1. --[[    How to add new locations!
  2.                
  3.                 Example:
  4.                
  5.                 The first line will be the main menu ID (Here [1],
  6.                 increment this for each main menu option!),
  7.                 the main menu gossip title (Here "Horde Cities"),
  8.                 as well as which faction can use the said menu (Here 1 (Horde)).
  9.                 0 = Alliance, 1 = Horde, 2 = Both
  10.                
  11.                 The second line is the name of the main menu's sub menus,
  12.                 separated by name (Here "Orgrimmar") and teleport coordinates
  13.                 using Map, X, Y, Z, O (Here 1, 1503, -4415.5, 22, 0)
  14.                
  15.                 [1] = { "Horde Cities", 1,      --  
  16.                         {"Orgrimmar", 1, 1503, -4415.5, 22, 0},
  17.                 },
  18.                
  19.                 You can copy paste the above into the script and change the values as informed.
  20. ]]
  21.  
  22.  
  23. local UnitEntry = 50000
  24.  
  25. local Icons = {};
  26.  
  27. local Icons = {
  28.          PvP = "|TInterface\\icons\\Ability_DualWield.png:13|t",
  29.               }
  30.  
  31. local T = {
  32.         [1] = { "Horde Cities", 1,
  33.                 {"Orgrimmar", 1, 1503, -4415.5, 22, 0},
  34.                 {"Undercity", 0, 1831, 238.5, 61.6, 0},
  35.                 {"Thunderbluff", 1, -1278, 122, 132, 0},
  36.                 {"Silvermoon", 530, 9484, -7294, 15, 0},
  37.                 {"Dalaran", 571, 5814.065918, 449.315735, 658.752014, 1.168765},
  38.         },
  39.         [2] = { "Alliance Cities", 0,
  40.                 {"Stormwind", 0, -8905, 560, 94, 0.62},
  41.                 {"Ironforge", 0, -4795, -1117, 499, 0},
  42.                 {"Darnassus", 1, 9952, 2280.5, 1342, 1.6},
  43.                 {"The Exodar", 530, -3863, -11736, -106, 2},
  44.                 {"Dalaran", 571, 5814.065918, 449.315735, 658.752014, 1.168765},
  45.         },
  46.         [3] = {"Instances",2,
  47.                 {"The Underbog", 530, 778.323303, 6762.750000, -72.444656, 5.094841},
  48.         },
  49.         [4] = {"Start Zone",2,
  50.                 {"Quest Road |cFF66032ELevel 1", 530, 8224.049805, -6684.983887, 86.188210, 1.284633},
  51.                 {"Quest Road |cFF66032ELevel 80", 530, 8044.58, -6874.44, 60, 1.284633},
  52.                 {"Quest Road |cFF66032ELevel 150", 530, 7793.713379, -6821.125488, 64.315292, 2.912474},
  53.         },
  54.         [5] = {"Malls",2,
  55.                 {"Global Mall <Sanctuary Zone>", 530, 8743.809570, -6103.910156, 20.048491, 6.181090},
  56.                 {"PvP Mall <Free for All PvP Zone>"},
  57.         },
  58.         [6] = {"Events",2,
  59.                 {"Stair Event 1", 1, 482.908020, -604.248901, 68.750114, 4.564351},
  60.                 {"Stair Event 2", 1, -7564.262695, -4874.627930, 0.567777, 4.571697},
  61.         },
  62.         [7] = {"Chill Places",2,
  63.                 {"Chillplace 1", 0, 4187.950195, -2707.389893, 27.608400, 6.072800},
  64.                 {"ChillPlace 2|cFF434f7b<Comming Soon>"},
  65.         },
  66.         [8] = {Icons.PvP.."PVP Areas",2,
  67.                 {"Custom Duel Area", 0, 4323.049805, -2871.030029, 1.476470, 2.266450},
  68.                 {"Gurubashi Arena", 0, -13277.400391, 127.372002, 26.141800, 1.118780},
  69.         },
  70. };
  71.  
  72. --[[ CODE STUFFS! DO NOT EDIT BELOW ]]--
  73. --[[ UNLESS YOU KNOW WHAT YOU'RE DOING! ]]--
  74.  
  75. function Teleporter_Gossip(event, player, unit)
  76.         if (#T <= 10) then
  77.                 for i, v in ipairs(T) do
  78.                         if(v[2] == 2 or v[2] == player:GetTeam()) then
  79.                                 player:GossipMenuAddItem(0, v[1], 0, i)
  80.                         end
  81.                 end
  82.                 player:GossipSendMenu(1, unit)
  83.         else
  84.                 print("This teleporter only supports 10 different menus.")
  85.         end
  86. end    
  87.  
  88. function Teleporter_Event(event, player, unit, sender, intid, code)
  89.         if(intid == 0) then
  90.                 Teleporter_Gossip(event, player, unit)
  91.         elseif(intid <= 10) then
  92.                 for i, v in ipairs(T[intid]) do
  93.                         if (i > 2) then
  94.                                 player:GossipMenuAddItem(0, v[1], 0, intid..i)
  95.                         end
  96.                 end
  97.                 player:GossipMenuAddItem(0, "Back", 0, 0)
  98.                 player:GossipSendMenu(1, unit)
  99.         elseif(intid > 10) then
  100.                 for i = 1, #T do
  101.                         for j, v in ipairs(T[i]) do
  102.                                 if(intid == tonumber(i..j)) then
  103.                                         player:GossipComplete()
  104.                                         player:Teleport(v[2], v[3], v[4], v[5], v[6])
  105.                                 end
  106.                         end
  107.                 end
  108.         end
  109. end
  110.  
  111. RegisterCreatureGossipEvent(UnitEntry, 1, Teleporter_Gossip)
  112. RegisterCreatureGossipEvent(UnitEntry, 2, Teleporter_Event)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement