Advertisement
uDev

[Eluna] 100% Dynamic Teleporter - Fixed

Dec 14th, 2013
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.65 KB | None | 0 0
  1. local UnitEntry = 65000 -- Change this number with NPC id
  2.  
  3. local T = {
  4.         [1] = { "Horde Cities",
  5.                 {"Orgrimmar", 1, 1503, -4415.5, 22, 0},
  6.                 {"Undercity", 0, 1831, 238.5, 61.6, 0},
  7.                 {"Thunderbluff", 1, -1278, 122, 132, 0},
  8.                 {"Silvermoon", 530, 9484, -7294, 15, 0},
  9.         },
  10.         [2] = { "Alliance Cities",
  11.                 {"Stormwind", 0, -8905, 560, 94, 0.62},
  12.                 {"Ironforge", 0, -4795, -1117, 499, 0},
  13.                 {"Darnassus", 1, 9952, 2280.5, 1342, 1.6},
  14.                 {"The Exodar", 530, -3863, -11736, -106, 2},
  15.         },
  16.         [3] = { "Outlands Locations",
  17.                 {"Blade's Edge Mountains", 530, 1481, 6829, 107, 6},
  18.                 {"Hellfire Peninsula", 530, -249, 947, 85, 2},
  19.                 {"Nagrand", 530, -1769, 7150, -9, 2},
  20.                 {"Netherstorm", 530, 3043, 3645, 143, 2},
  21.                 {"Shadowmoon Valley", 530, -3034, 2937, 87, 5},
  22.                 {"Terokkar Forest", 530, -1942, 4689, -2, 5},
  23.                 {"Zangarmarsh", 530, -217, 5488, 23, 2},
  24.                 {"Shattrath", 530, -1822, 5417, 1, 3},
  25.         },
  26.         [4] = { "Northrend Locations",
  27.                 {"Borean Tundra", 571, 3230, 5279, 47, 3},
  28.                 {"Crystalsong Forest", 571, 5732, 1016, 175, 3.6},
  29.                 {"Dragonblight", 571, 3547, 274, 46, 1.6},
  30.                 {"Grizzly Hills", 571, 3759, -2672, 177, 3},
  31.                 {"Howling Fjord", 571, 772, -2905, 7, 5},
  32.                 {"Icecrown Glaicer", 571, 8517, 676, 559, 4.7},
  33.                 {"Sholazar Basin", 571, 5571, 5739, -75, 2},
  34.                 {"Storm Peaks", 571, 6121, -1025, 409, 4.7},
  35.                 {"Wintergrasp", 571, 5135, 2840, 408, 3},
  36.                 {"Zul'Drak", 571, 5761, -3547, 387, 5},
  37.                 {"Dalaran", 571, 5826, 470, 659, 1.4},
  38.         },
  39.         [5] = { "PvP Locations",
  40.                 {"Gurubashi Arena", 0, -13229, 226, 33, 1},
  41.                 {"Dire Maul Arena", 1, -3669, 1094, 160, 3},
  42.                 {"Nagrand Arena", 530, -1983, 6562, 12, 2},
  43.                 {"Blade's Edge Arena", 530, 2910, 5976, 2, 4},
  44.         },
  45. };
  46.  
  47. --[[ CODE STUFFS! DO NOT EDIT BELOW ]]--
  48. --[[ UNLESS YOU KNOW WHAT YOU'RE DOING! ]]--
  49.  
  50. function Teleporter_Gossip(event, player, unit)
  51.         if (#T <= 10) then
  52.                 for i, v in ipairs(T) do
  53.                         player:GossipMenuAddItem(0, v[1], 0, i)
  54.                 end
  55.                 player:GossipSendMenu(1, unit)
  56.         else
  57.                 print("This teleporter only supports 10 different menus.")
  58.         end
  59. end    
  60.  
  61. function Teleporter_Event(event, player, unit, sender, intid, code)
  62.         if(intid == 0) then
  63.                 Teleporter_Gossip(event, player, unit)
  64.         elseif(intid <= 10) then
  65.                 for i, v in ipairs(T[intid]) do
  66.                         if (i > 1) then
  67.                                 player:GossipMenuAddItem(0, v[1], 0, intid..i)
  68.                         end
  69.                 end
  70.                 player:GossipMenuAddItem(0, "Back", 0, 0)
  71.                 player:GossipSendMenu(1, unit)
  72.         elseif(intid > 10) then
  73.                 for i = 1, #T do
  74.                         for j, v in ipairs(T[i]) do
  75.                                 if(intid == tonumber(i..j)) then
  76.                                         player:GossipComplete()
  77.                                         player:Teleport(v[2], v[3], v[4], v[5], v[6])
  78.                                 end
  79.                         end
  80.                 end
  81.         end
  82. end
  83.  
  84. RegisterCreatureGossipEvent(UnitEntry, 1, Teleporter_Gossip)
  85. RegisterCreatureGossipEvent(UnitEntry, 2, Teleporter_Event)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement