local menunum = 33310
local menuicon = 4
local teleicon = 2
local menu =
{
{"Cities",
{
{"Stormwind", 0, -8913, 554, 94},
{"Orgrimmar", 1, 1502, -4414, 22},
{"Ironforge", 0, -4981, -881,502},
{"Silvermoon", 530, 9411, -7278, 15},
{"Darnassus", 1, 8776, 950, 33},
{"Undercity ", 0, 1831, 238, 61},
{"The Exodar ", 530, -4014, -11896, -1},
{"Thunderbluff", 1, -1285, 176, 131},
}
},
{"Raids",
{
{"Mount Hyjal", 1, -8187, -4224, -175},
{"Black Temple", 530, -3631, 314, 39},
{"Sunwell", 530, 12583, -6775, 16},
{"The Eye", 530, 3098, 1519, 190},
{"Serpent Shrine Cavern", 530, 792, 6865, -63},
{"Karazhan", 0, -11121, -2012, 48},
{"Zul'aman", 530, 6850, 7950, 170},
{"Zul'Gurub", 0, 11915, 1132, 78},
{"Gates of Ahn'Qiraj", 1, -8175, 1534, 5},
{"Caverns of Time", 1, -8469, -4311,-207},
{"Magtheridon's Lair", 530, -339, 3141, -97},
{"Gruul's Lair", 530, 3675, 5279, 18},
{"Naxxramas", 533, 3005, -3435, 295},
}
},
{"Eastern Kingdom Instances",
{
{"The Temple of Atal'hakkar", 0, -10446, 3823, 19},
{"The deadmines", 0, -11156, 1528, 20},
{"The Stockades", 0, -8773, 839, 91},
{"Uldamon", 0, -6108, -3295, 257},
{"Gnomeregan", 0, -5183, 601, 409},
{"Shadowfang Keep", 0, -243, 1537, 78},
{"Stratholme", 0, 3176, -4039, 106},
{"Scholomance", 0, 1268, -2564, 95},
{"Scarlot Monastery", 0, 2843, -692, 146},
}
},
{"Kalimdor Instances",
{
{"Zul'Ferrak", 1, -6816, -2883, 10},
{"Dire Maul", 1, -3520, 1088, 161},
{"Razorfen", 1, -4411, -1880, 88},
{"Wailing Caverns", 1, -739, -2217, 17},
{"Maraudon", 349, 419, 11, -131},
{"Ragefire Chasm", 1, 1810, -4406, -17},
{"Blackfathom Dephs", 1, 4246, 736, -22},
}
},
{"Outland Instances",
{
{"Auchindoun", 530, -3363, 4893, -98},
{"Hellfire Citadel", 530, -272, 3101, 33},
}
},
{"Outland Locations",
{
{"Shadowmoon Valley", 530, -2848, 3190, 8},
{"Hellfire Peninsula", 530, -272, 3101, 33},
{"Zangarmarsh", 530, 48, 6878, 23},
{"Nagrand", 530, -2152, 7831, -12},
{"Terrokkar Forest", 530, -1947, 4741, -1},
{"Blade's Edge Mountins", 530, 3047, 5983, -9},
{"Netherstorm", 530, 2313, 2522, 117},
}
},
{"Free for all Pvp locations",
{
{"Gurubashi Arena", 0, -13268, 157, 43},
{"The Maul", 1, -3753, 1095, 132},
{"Nagrand Arena", 530, -2051, 6657, 13},
{"Halaa", 530, -1573, 7958, -17},
}
},
}
function TeleNPC_MainMenu(Unit, Player)
local i = 0
Unit:GossipCreateMenu(menunum, Player, 0)
for k,v in pairs(menu) do
i = i + 1
if type(v[2]) == "table" then
Unit:GossipMenuAddItem(menuicon, v[1], i, 0)
i = i + #(v[2])
else
Unit:GossipMenuAddItem(teleicon, v[1], i, 0)
end
end
Unit:GossipSendMenu(Player)
end
function TeleNPC_SubMenu(Unit, Player, i, Submenu)
Unit:GossipCreateMenu(menunum-i, Player, 0)
Unit:GossipMenuAddItem(7, "<--Back", 0, 0)
for k,v in pairs(Submenu) do
i = i + 1
Unit:GossipMenuAddItem(teleicon, v[1], i, 0)
end
Unit:GossipSendMenu(Player)
end
function TeleNPC_OnGossipTalk(Unit, Event, Player)
TeleNPC_MainMenu(Unit, Player)
end
function TeleNPC_OnGossipSelect(Unit, Event, Player, MenuId, Id, Code)
local i = 0
if(Id == 0) then
TeleNPC_MainMenu(Unit,Player)
else
for k,v in pairs(menu) do
i = i + 1
if (Id == i) then
if type(v[2]) == "table" then
TeleNPC_SubMenu(Unit, Player, i, v[2])
else
if Player:IsInCombat() then
Unit:SendChatMessage(12, 0, "You can't teleport while in combat!")
else
Player:Teleport(v[2], v[3], v[4], v[5])
end
Unit:GossipComplete(Player)
end
return
elseif (type(v[2]) == "table") then
for j,w in pairs(v[2]) do
i = i + 1
if (Id == i) then
if Player:IsInCombat() then
Unit:SendChatMessage(12, 0, "You can't teleport while in combat!")
else
Player:Teleport(w[2], w[3], w[4], w[5])
end
Unit:GossipComplete(Player)
return
end
end
end
end
end
end
RegisterUnitGossipEvent(50, 1, "TeleNPC_OnGossipTalk")
RegisterUnitGossipEvent(50, 2, "TeleNPC_OnGossipSelect")