Advertisement
Foereaper

Eluna Tabled Teleporter

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