diff --git a/TeleportSelector/TeleportSelectorClient.lua b/TeleportSelector/TeleportSelectorClient.lua new file mode 100644 index 0000000..c1acfec --- /dev/null +++ b/TeleportSelector/TeleportSelectorClient.lua @@ -0,0 +1,376 @@ +local AIO = AIO or require("AIO") +if AIO.AddAddon() then return end + +local TeleportSelectorHandlers = AIO.AddHandlers("TeleportSelectorClient", {}) + +local teleportFrame +local locationFrame +local selectedCategory = "Capital Cities" +local currentPage = 1 +local locationsPerPage = 6 + +-- Category & location data (client side; your real server decides where you go) +local teleportCategories = { +["Capital Cities"] = { + {id = 1, name = "Stormwind City", image = "Interface\\Buttons\\Teleport\\StormwindCity"}, + {id = 2, name = "Orgrimmar", image = "Interface\\Buttons\\Teleport\\Orgrimmar"}, + {id = 3, name = "Shattrath City", image = "Interface\\Buttons\\Teleport\\ShattrathCity"}, + {id = 4, name = "Dalaran", image = "Interface\\Buttons\\Teleport\\Dalaran"}, + {id = 5, name = "Ironforge", image = "Interface\\Buttons\\Teleport\\Ironforge"}, + {id = 6, name = "Undercity", image = "Interface\\Buttons\\Teleport\\Undercity"}, + {id = 7, name = "Thunder Bluff", image = "Interface\\Buttons\\Teleport\\ThunderBluff"}, + {id = 8, name = "Darnassus", image = "Interface\\Buttons\\Teleport\\Darnassus"}, + {id = 9, name = "Silvermoon City", image = "Interface\\Buttons\\Teleport\\SilvermoonCity"}, + {id = 10, name = "The Exodar", image = "Interface\\Buttons\\Teleport\\TheExodar"}, +}, + +["Kalimdor"] = { + {id = 11, name = "Ashenvale", image = "Interface\\Buttons\\Teleport\\Ashenvale"}, + {id = 12, name = "Azshara", image = "Interface\\Buttons\\Teleport\\Azshara"}, + {id = 13, name = "The Barrens", image = "Interface\\Buttons\\Teleport\\Barrens"}, + {id = 14, name = "Camp Narache", image = "Interface\\Buttons\\Teleport\\CampNarache"}, + {id = 15, name = "Darkshore", image = "Interface\\Buttons\\Teleport\\Darkshore"}, + {id = 16, name = "Desolace", image = "Interface\\Buttons\\Teleport\\Desolace"}, + {id = 17, name = "Durotar", image = "Interface\\Buttons\\Teleport\\Durotar"}, + {id = 18, name = "Dustwallow Marsh", image = "Interface\\Buttons\\Teleport\\DustwallowMarsh"}, + {id = 19, name = "Everlook", image = "Interface\\Buttons\\Teleport\\Everlook"}, + {id = 20, name = "Felwood", image = "Interface\\Buttons\\Teleport\\Felwood"}, + {id = 21, name = "Feralas", image = "Interface\\Buttons\\Teleport\\Feralas"}, + {id = 22, name = "Gadgetzan", image = "Interface\\Buttons\\Teleport\\Gadgetzan"}, + {id = 23, name = "Mulgore", image = "Interface\\Buttons\\Teleport\\Mulgore"}, + {id = 24, name = "Ratchet", image = "Interface\\Buttons\\Teleport\\Ratchet"}, + {id = 25, name = "Sen'jin Village", image = "Interface\\Buttons\\Teleport\\SenjinVillage"}, + {id = 26, name = "Shadowglen", image = "Interface\\Buttons\\Teleport\\Shadowglen"}, + {id = 27, name = "Stonetalon Mountains", image = "Interface\\Buttons\\Teleport\\Stonetalon"}, + {id = 28, name = "Tanaris", image = "Interface\\Buttons\\Teleport\\Tanaris"}, + {id = 29, name = "Teldrassil", image = "Interface\\Buttons\\Teleport\\Teldrassil"}, + {id = 30, name = "Theramore", image = "Interface\\Buttons\\Teleport\\Theramore"}, + {id = 31, name = "Thousand Needles", image = "Interface\\Buttons\\Teleport\\Needles"}, + {id = 32, name = "Un'Goro Crater", image = "Interface\\Buttons\\Teleport\\UnGoro"}, + {id = 33, name = "Valley of Trials", image = "Interface\\Buttons\\Teleport\\ValleyofTrials"}, + {id = 34, name = "Winterspring", image = "Interface\\Buttons\\Teleport\\Winterspring"}, +}, + +["Eastern Kingdoms"] = { + {id = 35, name = "Alterac Mountains", image = "Interface\\Buttons\\Teleport\\AlteracMountains"}, + {id = 36, name = "Arathi Highlands", image = "Interface\\Buttons\\Teleport\\ArathiHighlands"}, + {id = 37, name = "Badlands", image = "Interface\\Buttons\\Teleport\\Badlands"}, + {id = 38, name = "Blasted Lands", image = "Interface\\Buttons\\Teleport\\BlastedLands"}, + {id = 39, name = "Booty Bay", image = "Interface\\Buttons\\Teleport\\BootyBay"}, + {id = 40, name = "Burning Steppes", image = "Interface\\Buttons\\Teleport\\BurningSteppes"}, + {id = 41, name = "Coldridge Valley", image = "Interface\\Buttons\\Teleport\\Coldridge"}, + {id = 42, name = "Deathknell", image = "Interface\\Buttons\\Teleport\\Deathknell"}, + {id = 43, name = "Dun Morogh", image = "Interface\\Buttons\\Teleport\\DunMorogh"}, + {id = 44, name = "Duskwood", image = "Interface\\Buttons\\Teleport\\Duskwood"}, + {id = 45, name = "Eastern Plaguelands", image = "Interface\\Buttons\\Teleport\\EasternPlaguelands"}, + {id = 46, name = "Elwynn Forest", image = "Interface\\Buttons\\Teleport\\ElwynnForest"}, + {id = 47, name = "Ghostlands", image = "Interface\\Buttons\\Teleport\\Ghostlands"}, + {id = 48, name = "Hillsbrad Foothills", image = "Interface\\Buttons\\Teleport\\HillsbradFoothills"}, + {id = 49, name = "Loch Modan", image = "Interface\\Buttons\\Teleport\\LochModan"}, + {id = 50, name = "Northshire Abbey", image = "Interface\\Buttons\\Teleport\\NorthshireAbbey"}, + {id = 51, name = "Redridge Mountains", image = "Interface\\Buttons\\Teleport\\RedridgeMountains"}, + {id = 52, name = "Searing Gorge", image = "Interface\\Buttons\\Teleport\\SearingGorge"}, + {id = 53, name = "Silverpine Forest", image = "Interface\\Buttons\\Teleport\\SilverpineForest"}, + {id = 54, name = "Stonard", image = "Interface\\Buttons\\Teleport\\Stonard"}, + {id = 55, name = "Stranglethorn Vale", image = "Interface\\Buttons\\Teleport\\StranglethornVale"}, + {id = 56, name = "Swamp of Sorrows", image = "Interface\\Buttons\\Teleport\\SwampOfSorrows"}, + {id = 57, name = "The Hinterlands", image = "Interface\\Buttons\\Teleport\\TheHinterlands"}, + {id = 58, name = "Tirisfal Glades", image = "Interface\\Buttons\\Teleport\\TirisfalGlades"}, + {id = 59, name = "Western Plaguelands", image = "Interface\\Buttons\\Teleport\\WesternPlaguelands"}, + {id = 60, name = "Westfall", image = "Interface\\Buttons\\Teleport\\Westfall"}, + {id = 61, name = "Wetlands", image = "Interface\\Buttons\\Teleport\\Wetlands"}, +}, + +["Outland"] = { + {id = 62, name = "Ammen Vale", image = "Interface\\Buttons\\Teleport\\AmmenVale"}, + {id = 63, name = "Azuremyst Isle", image = "Interface\\Buttons\\Teleport\\Azuremyst"}, + {id = 64, name = "Bloodmyst Isle", image = "Interface\\Buttons\\Teleport\\Bloodmyst"}, + {id = 65, name = "Blade's Edge Mountains", image = "Interface\\Buttons\\Teleport\\BladesEdgeMountains"}, + {id = 66, name = "Eversong Woods", image = "Interface\\Buttons\\Teleport\\Eversong"}, + {id = 67, name = "Hellfire Peninsula", image = "Interface\\Buttons\\Teleport\\HellfirePeninsula"}, + {id = 68, name = "Nagrand", image = "Interface\\Buttons\\Teleport\\Nagrand"}, + {id = 69, name = "Netherstorm", image = "Interface\\Buttons\\Teleport\\Netherstorm"}, + {id = 70, name = "Terokkar Forest", image = "Interface\\Buttons\\Teleport\\TerokkarForest"}, + {id = 71, name = "Sunstrider Isle", image = "Interface\\Buttons\\Teleport\\SunstriderIsle"}, + {id = 72, name = "Zangarmarsh", image = "Interface\\Buttons\\Teleport\\Zangarmarsh"}, +}, + +["Northrend"] = { + {id = 73, name = "Borean Tundra", image = "Interface\\Buttons\\Teleport\\BoreanTundra"}, + {id = 74, name = "Crystalsong Forest", image = "Interface\\Buttons\\Teleport\\CrystalsongForest"}, + {id = 75, name = "Dragonblight", image = "Interface\\Buttons\\Teleport\\Dragonblight"}, + {id = 76, name = "Grizzly Hills", image = "Interface\\Buttons\\Teleport\\GrizzlyHills"}, + {id = 77, name = "Howling Fjord", image = "Interface\\Buttons\\Teleport\\HowlingFjord"}, + {id = 78, name = "Icecrown", image = "Interface\\Buttons\\Teleport\\Icecrown"}, + {id = 79, name = "Sholazar Basin", image = "Interface\\Buttons\\Teleport\\SholazarBasin"}, + {id = 80, name = "Storm Peaks", image = "Interface\\Buttons\\Teleport\\StormPeaks"}, + {id = 81, name = "Valiance Keep", image = "Interface\\Buttons\\Teleport\\ValianceKeep"}, + {id = 82, name = "Warsong Hold", image = "Interface\\Buttons\\Teleport\\WarsongHold"}, + {id = 83, name = "Wintergrasp", image = "Interface\\Buttons\\Teleport\\Wintergrasp"}, +}, + +["Dungeons"] = { + {id = 84, name = "Blackfathom Deeps", image = "Interface\\Buttons\\Teleport\\BlackfathomDeeps"}, + {id = 85, name = "Blackrock Depths", image = "Interface\\Buttons\\Teleport\\BlackrockDepths"}, + {id = 86, name = "Blackrock Spire", image = "Interface\\Buttons\\Teleport\\BlackrockSpire"}, + {id = 87, name = "Gnomeregan", image = "Interface\\Buttons\\Teleport\\Gnomeregan"}, + {id = 88, name = "Maraudon", image = "Interface\\Buttons\\Teleport\\Maraudon"}, + {id = 89, name = "Ragefire Chasm", image = "Interface\\Buttons\\Teleport\\RagefireChasm"}, + {id = 90, name = "Razorfen Downs", image = "Interface\\Buttons\\Teleport\\RazorfenDowns"}, + {id = 91, name = "Razorfen Kraul", image = "Interface\\Buttons\\Teleport\\RazorfenKraul"}, + {id = 92, name = "Scarlet Monastery", image = "Interface\\Buttons\\Teleport\\ScarletMonastery"}, + {id = 93, name = "Scholomance", image = "Interface\\Buttons\\Teleport\\Scholomance"}, + {id = 94, name = "Shadowfang Keep", image = "Interface\\Buttons\\Teleport\\ShadowFangKeep"}, + {id = 95, name = "Stratholme", image = "Interface\\Buttons\\Teleport\\Stratholme"}, + {id = 96, name = "Sunken Temple", image = "Interface\\Buttons\\Teleport\\SunkenTemple"}, + {id = 97, name = "The Deadmines", image = "Interface\\Buttons\\Teleport\\TheDeadmines"}, + {id = 98, name = "The Stockade", image = "Interface\\Buttons\\Teleport\\TheStockade"}, + {id = 99, name = "Uldaman", image = "Interface\\Buttons\\Teleport\\Uldaman"}, + {id = 100, name = "Wailing Caverns", image = "Interface\\Buttons\\Teleport\\WailingCaverns"}, + {id = 101, name = "Zul'Farrak", image = "Interface\\Buttons\\Teleport\\ZulFarrak"}, +}, + +["BC Dungeons"] = { + {id = 102, name = "Auchenai Crypts", image = "Interface\\Buttons\\Teleport\\AuchenaiCrypts"}, + {id = 103, name = "Hellfire Ramparts", image = "Interface\\Buttons\\Teleport\\HellfireRamparts"}, + {id = 104, name = "Magisters' Terrace", image = "Interface\\Buttons\\Teleport\\MagistersTerrace"}, + {id = 105, name = "Mana-Tombs", image = "Interface\\Buttons\\Teleport\\ManaTombs"}, + {id = 106, name = "Old Hillsbrad Foothills", image = "Interface\\Buttons\\Teleport\\HillsbradFoothills"}, + {id = 107, name = "Sethekk Halls", image = "Interface\\Buttons\\Teleport\\SethekkHalls"}, + {id = 108, name = "Shadow Labyrinth", image = "Interface\\Buttons\\Teleport\\ShadowLabyrinth"}, + {id = 109, name = "The Arcatraz", image = "Interface\\Buttons\\Teleport\\TheArcatraz"}, + {id = 110, name = "The Black Morass", image = "Interface\\Buttons\\Teleport\\TheBlackMorass"}, + {id = 111, name = "The Blood Furnace", image = "Interface\\Buttons\\Teleport\\TheBloodFurnace"}, + {id = 112, name = "The Botanica", image = "Interface\\Buttons\\Teleport\\TheBotanica"}, + {id = 113, name = "The Mechanar", image = "Interface\\Buttons\\Teleport\\TheMechanar"}, + {id = 114, name = "The Shattered Halls", image = "Interface\\Buttons\\Teleport\\TheShatteredHalls"}, + {id = 115, name = "The Slave Pens", image = "Interface\\Buttons\\Teleport\\TheSlavePens"}, + {id = 116, name = "The Steamvault", image = "Interface\\Buttons\\Teleport\\TheSteamvault"}, + {id = 117, name = "The Underbog", image = "Interface\\Buttons\\Teleport\\TheUnderbog"}, +}, + +["WOTLK Dungeons"] = { + {id = 118, name = "Azjol-Nerub", image = "Interface\\Buttons\\Teleport\\AzjolNerub"}, + {id = 119, name = "The Culling of Stratholme", image = "Interface\\Buttons\\Teleport\\TheCullingOfStratholme"}, + {id = 120, name = "Drak'Tharon Keep", image = "Interface\\Buttons\\Teleport\\DrakTharonKeep"}, + {id = 121, name = "The Forge of Souls", image = "Interface\\Buttons\\Teleport\\ForgeOfSouls"}, + {id = 122, name = "Halls of Stone", image = "Interface\\Buttons\\Teleport\\HallsOfStone"}, + {id = 123, name = "Halls of Lightning", image = "Interface\\Buttons\\Teleport\\HallsOfLightning"}, + {id = 124, name = "Halls of Reflection", image = "Interface\\Buttons\\Teleport\\HallsOfReflection"}, + {id = 125, name = "Gundrak", image = "Interface\\Buttons\\Teleport\\GundrakDungeon"}, + {id = 126, name = "Pit of Saron", image = "Interface\\Buttons\\Teleport\\PitOfSaron"}, + {id = 127, name = "Trial of the Champion", image = "Interface\\Buttons\\Teleport\\TrialOfTheChampion"}, + {id = 128, name = "Utgarde Keep", image = "Interface\\Buttons\\Teleport\\UtgardeKeep"}, + {id = 129, name = "Utgarde Pinnacle", image = "Interface\\Buttons\\Teleport\\UtgardePinnacle"}, + {id = 130, name = "The Violet Hold", image = "Interface\\Buttons\\Teleport\\VioletHold"}, +}, + +["Raids"] = { + {id = 131, name = "Battle for Mount Hyjal", image = "Interface\\Buttons\\Teleport\\HyjalSummit"}, + {id = 132, name = "Black Temple", image = "Interface\\Buttons\\Teleport\\BlackTemple"}, + {id = 133, name = "Blackwing Lair", image = "Interface\\Buttons\\Teleport\\BlackwingLair"}, + {id = 134, name = "Eye of Eternity", image = "Interface\\Buttons\\Teleport\\EyeOfEternity"}, + {id = 135, name = "Gruul's Lair", image = "Interface\\Buttons\\Teleport\\GruulsLair"}, + {id = 136, name = "Icecrown Citadel", image = "Interface\\Buttons\\Teleport\\IcecrownCitadelRaid"}, + {id = 137, name = "Karazhan", image = "Interface\\Buttons\\Teleport\\Karazhan"}, + {id = 138, name = "Magtheridon's Lair", image = "Interface\\Buttons\\Teleport\\MagtheridonsLair"}, + {id = 139, name = "Molten Core", image = "Interface\\Buttons\\Teleport\\MoltenCore"}, + {id = 140, name = "Naxxramas", image = "Interface\\Buttons\\Teleport\\Naxxramas"}, + {id = 141, name = "Obsidian Sanctum", image = "Interface\\Buttons\\Teleport\\ObsidianSanctum"}, + {id = 142, name = "Onyxia's Lair (Vanilla)", image = "Interface\\Buttons\\Teleport\\OnyxiasLair"}, + {id = 143, name = "Onyxia's Lair (WOTLK)", image = "Interface\\Buttons\\Teleport\\OnyxiasLairWOTLK"}, + {id = 144, name = "Ruby Sanctum", image = "Interface\\Buttons\\Teleport\\RubySanctum"}, + {id = 145, name = "Serpentshrine Cavern", image = "Interface\\Buttons\\Teleport\\SerpentshrineCavern"}, + {id = 146, name = "Sunwell Plateau", image = "Interface\\Buttons\\Teleport\\SunwellPlateau"}, + {id = 147, name = "Tempest Keep", image = "Interface\\Buttons\\Teleport\\TempestKeep"}, + {id = 148, name = "The Ruins of Ahn'Qiraj", image = "Interface\\Buttons\\Teleport\\RuinsOfAhnQiraj"}, + {id = 149, name = "The Temple of Ahn'Qiraj", image = "Interface\\Buttons\\Teleport\\TempleOfAhnQiraj"}, + {id = 150, name = "Trial of the Crusader", image = "Interface\\Buttons\\Teleport\\TrialOfTheCrusader"}, + {id = 151, name = "Ulduar", image = "Interface\\Buttons\\Teleport\\Ulduar"}, + {id = 152, name = "Vault of Archavon", image = "Interface\\Buttons\\Teleport\\VaultOfArchavon"}, +}, + +["Araxia"] = { + {id = 153, name = "Guild Hall", image = "Interface\\Buttons\\Teleport\\GuildHall"}, + {id = 154, name = "Isle of Giants", image = "Interface\\Buttons\\Teleport\\IsleGiants"}, + {id = 155, name = "Morza Island", image = "Interface\\Buttons\\Teleport\\MorzaIsland"}, + {id = 156, name = "Silithus Camp", image = "Interface\\Buttons\\Teleport\\SilithusCamp"}, + {id = 157, name = "Windpeak Island", image = "Interface\\Buttons\\Teleport\\Windpeak"}, +}, + +} + +function TeleportSelectorHandlers.ShowTeleportUI() + if teleportFrame then + teleportFrame:Show() + ShowTeleportButtons() + return + end + + teleportFrame = CreateFrame("Frame", "TeleportSelectorFrame", UIParent, BackdropTemplateMixin and "BackdropTemplate") + teleportFrame:SetSize(1000, 800) + teleportFrame:SetPoint("CENTER") + teleportFrame:SetBackdrop({ + bgFile = "Interface/DialogFrame/UI-DialogBox-Background-Dark", + edgeFile = "Interface/DialogFrame/UI-DialogBox-Border", + tile = true, tileSize = 32, edgeSize = 32, + insets = { left = 8, right = 8, top = 8, bottom = 8 }, + }) + teleportFrame:SetFrameStrata("FULLSCREEN_DIALOG") + teleportFrame:SetMovable(true) + teleportFrame:EnableMouse(true) + teleportFrame:RegisterForDrag("LeftButton") + teleportFrame:SetScript("OnDragStart", teleportFrame.StartMoving) + teleportFrame:SetScript("OnDragStop", teleportFrame.StopMovingOrSizing) + tinsert(UISpecialFrames, teleportFrame:GetName()) + + -- Close button + local closeButton = CreateFrame("Button", nil, teleportFrame, "UIPanelCloseButton") + closeButton:SetPoint("TOPRIGHT", teleportFrame, "TOPRIGHT", -5, -5) + + -- Title + local titleFont = CreateFont("TitleFont") + titleFont:SetFont("Interface/Fonts/friz-quadrata-regular.ttf", 28, "OUTLINE") + titleFont:SetShadowOffset(1, -1) + titleFont:SetShadowColor(0, 0, 0, 0.5) + + local title = teleportFrame:CreateFontString(nil, "OVERLAY") + title:SetPoint("TOP", 0, -30) + title:SetFontObject(titleFont) + title:SetText("Choose Your Destination") + title:SetTextColor(209 / 255, 163 / 255, 14 / 255) + + -- Hardcoded categories + local categories = { + "Capital Cities", + "Kalimdor", + "Eastern Kingdoms", + "Outland", + "Northrend", + "Dungeons", + "BC Dungeons", + "WOTLK Dungeons", + "Raids", + "Araxia", + } + + for i, category in ipairs(categories) do + local btn = CreateFrame("Button", nil, teleportFrame, "UIPanelButtonTemplate") + btn:SetSize(150, 30) + btn:SetPoint("TOPLEFT", 10, -50 - (i - 1) * 40) + btn:SetText(category) + btn:SetScript("OnClick", function() + selectedCategory = category + currentPage = 1 + ShowTeleportButtons() + end) + end + + -- Location button container + locationFrame = CreateFrame("Frame", nil, teleportFrame) + locationFrame:SetSize(560, 500) + locationFrame:SetPoint("TOPLEFT", 200, -60) + + -- Page label + pageLabel = teleportFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal") + pageLabel:SetPoint("BOTTOM", teleportFrame, "BOTTOM", 0, 20) + pageLabel:SetTextColor(1, 1, 1) + + -- Pagination buttons +local prevButton = CreateFrame("Button", nil, teleportFrame, "UIPanelButtonTemplate") +prevButton:SetSize(100, 25) +prevButton:SetText("Previous") +prevButton:SetPoint("BOTTOM", teleportFrame, "BOTTOM", -200, 20) + prevButton:SetScript("OnClick", function() + currentPage = math.max(1, currentPage - 1) + ShowTeleportButtons() + end) + + local nextButton = CreateFrame("Button", nil, teleportFrame, "UIPanelButtonTemplate") +nextButton:SetSize(100, 25) +nextButton:SetText("Next") +nextButton:SetPoint("BOTTOM", teleportFrame, "BOTTOM", 200, 20) + nextButton:SetScript("OnClick", function() + local locs = teleportCategories[selectedCategory] + if not locs then return end + local maxPage = math.ceil(#locs / locationsPerPage) + currentPage = math.min(maxPage, currentPage + 1) + ShowTeleportButtons() + end) + + ShowTeleportButtons() +end + +function ShowTeleportButtons() + for _, child in ipairs({ locationFrame:GetChildren() }) do + child:Hide() + end + + local locs = teleportCategories[selectedCategory] + if not locs then return end + + local totalPages = math.ceil(#locs / locationsPerPage) + pageLabel:SetText("Page " .. currentPage .. " of " .. totalPages) + + local buttonWidth, buttonHeight = 300, 150 + local spacingX, spacingY = 10, 40 + local cols = 2 + + local startIndex = (currentPage - 1) * locationsPerPage + 1 + local endIndex = math.min(startIndex + locationsPerPage - 1, #locs) + + for i = startIndex, endIndex do + local loc = locs[i] + local row = math.floor((i - startIndex) / cols) + local col = (i - startIndex) % cols + + local button = CreateFrame("Button", nil, locationFrame) + button:SetSize(buttonWidth, buttonHeight) + button:SetPoint("TOPLEFT", col * (buttonWidth + spacingX), -row * (buttonHeight + spacingY)) + button:SetNormalTexture(loc.image or "Interface\\Icons\\INV_Misc_QuestionMark") + button:SetHighlightTexture(nil) + + -- Glowing border (golden) + local glow = CreateFrame("Frame", nil, button, BackdropTemplateMixin and "BackdropTemplate") + glow:SetPoint("TOPLEFT", -6, 6) + glow:SetPoint("BOTTOMRIGHT", 6, -6) + glow:SetBackdrop({ + edgeFile = "Interface/Tooltips/UI-Tooltip-Border", + edgeSize = 16, + }) + glow:SetBackdropBorderColor(1, 0.82, 0, 1) + glow:SetAlpha(0) + button.glow = glow + + -- Border + local border = CreateFrame("Frame", nil, button, BackdropTemplateMixin and "BackdropTemplate") + border:SetPoint("TOPLEFT", -3, 3) + border:SetPoint("BOTTOMRIGHT", 3, -3) + border:SetBackdrop({ + edgeFile = "Interface/Tooltips/UI-Tooltip-Border", + edgeSize = 15, + }) + + button:SetScript("OnEnter", function(self) + self.glow:SetAlpha(0.8) + GameTooltip:SetOwner(self, "ANCHOR_RIGHT") + GameTooltip:SetText(loc.name, 1, 1, 1) + end) + + button:SetScript("OnLeave", function(self) + self.glow:SetAlpha(0) + GameTooltip:Hide() + end) + + button:SetScript("OnClick", function() + AIO.Handle("TeleportSelectorServer", "TeleportTo", loc.id) + teleportFrame:Hide() + end) + + local label = button:CreateFontString(nil, "OVERLAY", "GameFontHighlight") + label:SetPoint("TOP", button, "BOTTOM", 0, -10) + label:SetFont("Interface/Fonts/friz-quadrata-regular.ttf", 14) + label:SetText(loc.name) + label:SetTextColor(209 / 255, 163 / 255, 14 / 255) + end +end diff --git a/TeleportSelector/TeleportSelectorServer.lua b/TeleportSelector/TeleportSelectorServer.lua new file mode 100644 index 0000000..e4715e7 --- /dev/null +++ b/TeleportSelector/TeleportSelectorServer.lua @@ -0,0 +1,198 @@ +local AIO = AIO or require("AIO") +local TeleportSelectorServer = AIO.AddHandlers("TeleportSelectorServer", {}) + +local locations = { + -- Capital Cities + [1] = {map = 0, x = -8833.38, y = 628.628, z = 94.0066, o = 1.06535}, -- Stormwind City + [2] = {map = 1, x = 1629.85, y = -4373.64, z = 31.5573, o = 3.69762}, -- Orgrimmar + [3] = {map = 530, x = -1904.76, y = 5443.43, z = -12.42721, o = 5.93}, -- Shattrath City + [4] = {map = 571, x = 5807.75, y = 588.346, z = 660.93915, o = 1.663}, -- Dalaran + [5] = {map = 0, x = -4918.88, y = -940.406, z = 501.564, o = 5.42347}, -- Ironforge + [6] = {map = 0, x = 1584.14, y = 240.308, z = -52.1534, o = 0.041793}, -- Undercity + [7] = {map = 1, x = -1277.37, y = 124.804, z = 131.287, o = 5.22274}, -- Thunder Bluff + [8] = {map = 1, x = 9949.56, y = 2284.21, z = 1341.4, o = 1.59587}, -- Darnassus + [9] = {map = 530, x = 9998.490234, y = -7106.779785, z = 47.705502, o = 2.44}, -- Silvermoon City + [10] = {map = 530, x = -3965.7, y = -11653.6, z = -138.844, o = 0.852154}, -- The Exodar + +-- Kalimdor + [11] = {map = 1, x = 1928.34, y = -2165.95, z = 93.7896, o = 0.205731}, -- Ashenvale + [12] = {map = 1, x = 3341.36, y = -4603.79, z = 92.5027, o = 5.28142}, -- Azshara + [13] = {map = 1, x = 48.9976, y = -2715.55, z = 91.6677, o = 0.158612}, -- The Barrens + [14] = {map = 1, x = -2918.9114, y = -263.6406, z = 53.5418, o = 0.200739},-- Camp Narache + [15] = {map = 1, x = 5756.25, y = 298.505, z = 20.6049, o = 5.96504}, -- Darkshore + [16] = {map = 1, x = -606.395, y = 2211.75, z = 92.9818, o = 0.809746}, -- Desolace + [17] = {map = 1, x = 1007.78, y = -4446.22, z = 11.2022, o = 0.20797}, -- Durotar + [18] = {map = 1, x = -4043.65, y = -2991.32, z = 36.3984, o = 3.37443}, -- Dustwallow Marsh + [19] = {map = 1, x = 6725.69, y = -4619.44, z = 720.909, o = 4.66802}, -- Everlook + [20] = {map = 1, x = 4102.25, y = -1006.79, z = 272.717, o = 0.790048}, -- Felwood + [21] = {map = 1, x = -4841.19, y = 1309.44, z = 81.3937, o = 1.48501}, -- Feralas + [22] = {map = 1, x = -7177.15, y = -3785.34, z = 8.36981, o = 6.081007}, -- Gadgetzan + [23] = {map = 1, x = -2192.62, y = -736.317, z = -13.3274, o = 0.487569}, -- Mulgore + [24] = {map = 1, x = -956.664, y = -3754.71, z = 5.33239, o = 0.996637}, -- Ratchet + [25] = {map = 1, x = -813.097, y = -4880.08, z = 18.995, o = 4.42647}, -- Sen'jin Village + [26] = {map = 1, x = 10334.0, y = 833.902, z = 1326.11, o = 3.62142}, -- Shadowglen + [27] = {map = 1, x = 1570.92, y = 1031.52, z = 137.959, o = 3.33006}, -- Stonetalon Mountains + [28] = {map = 1, x = -7931.2, y = -3414.28, z = 80.7365, o = 0.66522}, -- Tanaris + [29] = {map = 1, x = 10111.3, y = 1557.73, z = 1324.33, o = 4.04239}, -- Teldrassil + [30] = {map = 1, x = -3730.72, y = -4422.21, z = 30.48361, o = 0.810732}, -- Theramore + [31] = {map = 1, x = -4969.02, y = -1726.89, z = -62.1269, o = 3.7933}, -- Thousand Needles + [32] = {map = 1, x = -7943.22, y = -2119.09, z = -218.343, o = 6.0727}, -- Un'Goro Crater + [33] = {map = 1, x = -601.294, y = -4296.76, z = 37.8115, o = 1.65401}, -- Valley of Trials + [34] = {map = 1, x = 6759.18, y = -4419.63, z = 763.214, o = 4.43476}, -- Winterspring + +-- Eastern Kingdoms + [35] = {map = 0, x = 370.763, y = -491.355, z = 175.361, o = 5.37858}, -- Alterac Mountains + [36] = {map = 0, x = -1508.51, y = -2732.06, z = 32.4986, o = 3.35708}, -- Arathi Highlands + [37] = {map = 0, x = -6779.2, y = -3423.64, z = 241.667, o = 0.647481}, -- Badlands + [38] = {map = 0, x = -11182.5, y = -3016.67, z = 7.42235, o = 4.0004}, -- Blasted Lands + [39] = {map = 0, x = -14297.2, y = 530.993, z = 8.77916, o = 3.98863}, -- Booty Bay + [40] = {map = 0, x = -8118.54, y = -1633.83, z = 132.996, o = 0.089067}, -- Burning Steppes + [41] = {map = 0, x = -6231.77, y = 332.993, z = 383.171, o = 0.480178}, -- Coldridge Valley + [42] = {map = 0, x = 1843.5, y = 1590.0, z = 93.2971, o = 3.08757}, -- Deathknell + [43] = {map = 0, x = -5451.55, y = -656.992, z = 392.675, o = 0.66789}, -- Dun Morogh + [44] = {map = 0, x = -10898.3, y = -364.784, z = 39.2681, o = 3.04614}, -- Duskwood + [45] = {map = 0, x = 2300.97, y = -4613.36, z = 73.6231, o = 0.367722}, -- Eastern Plaguelands + [46] = {map = 0, x = -9617.06, y = -288.949, z = 57.3053, o = 4.72687}, -- Elwynn Forest + [47] = {map = 530, x = 7360.86, y = -6803.3, z = 44.2942, o = 5.83679}, -- Ghostlands + [48] = {map = 0, x = -436.657, y = -581.254, z = 53.5944, o = 1.25917}, -- Hillsbrad Foothills + [49] = {map = 0, x = -5202.94, y = -2855.18, z = 336.822, o = 0.37651}, -- Loch Modan + [50] = {map = 0, x = -8921.0898, y = -119.135, z = 82.195, o = 2.958306}, -- Northshire Abbey + [51] = {map = 0, x = -9551.81, y = -2204.73, z = 93.473, o = 5.47141}, -- Redridge Mountains + [52] = {map = 0, x = -7012.47, y = -1065.13, z = 241.786, o = 5.63162}, -- Searing Gorge + [53] = {map = 0, x = 878.74, y = 1359.33, z = 50.355, o = 5.89929}, -- Silverpine Forest + [54] = {map = 0, x = -10446.9, y = -3261.91, z = 20.1795, o = 5.02142}, -- Stonard + [55] = {map = 0, x = -12644.3, y = -377.411, z = 10.1021, o = 6.09978}, -- Stranglethorn Vale + [56] = {map = 0, x = -10345.4, y = -2773.42, z = 21.99, o = 5.08426}, -- Swamp of Sorrows + [57] = {map = 0, x = 119.387, y = -3190.37, z = 117.331, o = 2.34064}, -- The Hinterlands + [58] = {map = 0, x = 2036.02, y = 161.331, z = 33.8674, o = 0.143896}, -- Tirisfal Glades + [59] = {map = 0, x = 1728.65, y = -1602.25, z = 63.429, o = 1.6558}, -- Western Plaguelands + [60] = {map = 0, x = -10235.2, y = 1222.47, z = 43.6252, o = 6.2427}, -- Westfall + [61] = {map = 0, x = -3242.81, y = -2469.04, z = 15.9226, o = 6.03924}, -- Wetlands + +-- Outland + [62] = {map = 530, x = -4021.4, y = -13582.1, z = 54.7153, o = 2.06953}, -- Ammen Vale + [63] = {map = 530, x = -4216.87, y = -12336.9, z = 4.34247, o = 6.02008}, -- Azuremyst Isle + [64] = {map = 530, x = -1993.62, y = -11475.8, z = 63.9657, o = 5.29437}, -- Bloodmyst Isle + [65] = {map = 530, x = 3037.67, y = 5962.86, z = 130.774, o = 1.27253}, -- Blade's Edge Mountains + [66] = {map = 530, x = 9079.92, y = -7193.23, z = 55.6013, o = 5.94597}, -- Eversong Woods + [67] = {map = 530, x = -211.237, y = 4278.54, z = 86.5678, o = 4.59776}, -- Hellfire Peninsula + [68] = {map = 530, x = -1145.95, y = 8182.35, z = 3.60249, o = 6.13478}, -- Nagrand + [69] = {map = 530, x = 3830.23, y = 3426.5, z = 88.6145, o = 5.16677}, -- Netherstorm + [70] = {map = 530, x = -2000.47, y = 4451.54, z = 8.37917, o = 4.40447}, -- Terokkar Forest + [71] = {map = 530, x = 10331.1, y = -6235.42, z = 26.7759, o = 1.94594}, -- Sunstrider Isle + [72] = {map = 530, x = -54.8621, y = 5813.44, z = 20.9764, o = 0.081722}, -- Zangarmarsh + + +-- Northrend + [73] = {map = 571, x = 3256.57, y = 5278.23, z = 40.8046, o = 0.246367}, -- Borean Tundra + [74] = {map = 571, x = 5474.07, y = 39.7615, z = 149.546, o = 6.27193}, -- Crystalsong Forest + [75] = {map = 571, x = 4103.36, y = 264.478, z = 50.5019, o = 3.09349}, -- Dragonblight + [76] = {map = 571, x = 4391.73, y = -3587.92, z = 238.531, o = 3.57526}, -- Grizzly Hills + [77] = {map = 571, x = 1902.15, y = -4883.91, z = 171.363, o = 3.11537}, -- Howling Fjord + [78] = {map = 571, x = 7253.64, y = 1644.78, z = 433.68, o = 4.83412}, -- Icecrown + [79] = {map = 571, x = 5323.0, y = 4942.0, z = -133.5, o = 2.17}, -- Sholazar Basin + [80] = {map = 571, x = 7527.14, y = -1260.89, z = 919.049, o = 2.0696}, -- Storm Peaks + [81] = {map = 571, x = 2213.95, y = 5273.15, z = 11.2565, o = 5.89294}, -- Valiance Keep + [82] = {map = 571, x = 2741.29, y = 6097.16, z = 76.9055, o = 0.731543}, -- Warsong Hold + [83] = {map = 571, x = 4760.7, y = 2143.7, z = 423.0, o = 1.13}, -- Wintergrasp + +-- Dungeons + [84] = {map = 1, x = 4249.99, y = 740.102, z = -25.671, o = 1.34062}, -- Blackfathom Deeps + [85] = {map = 0, x = -7179.34, y = -921.212, z = 165.821, o = 5.09599}, -- Blackrock Depths + [86] = {map = 0, x = -7527.05, y = -1226.77, z = 285.732, o = 5.29626}, -- Blackrock Spire + [87] = {map = 0, x = -5163.54, y = 925.423, z = 257.181, o = 1.57423}, -- Gnomeregan + [88] = {map = 1, x = -1419.13, y = 2908.14, z = 137.464, o = 1.57366}, -- Maraudon + [89] = {map = 1, x = 1811.78, y = -4410.5, z = -18.4704, o = 5.20165}, -- Ragefire Chasm + [90] = {map = 1, x = -4657.3, y = -2519.35, z = 81.0529, o = 4.54808}, -- Razorfen Downs + [91] = {map = 1, x = -4470.28, y = -1677.77, z = 81.3925, o = 1.16302}, -- Razorfen Kraul + [92] = {map = 0, x = 2872.6, y = -764.398, z = 160.332, o = 5.05735}, -- Scarlet Monastery + [93] = {map = 0, x = 1269.64, y = -2556.21, z = 93.6088, o = 0.620623}, -- Scholomance + [94] = {map = 0, x = -234.675, y = 1561.63, z = 76.8921, o = 1.24031}, -- Shadowfang Keep + [95] = {map = 0, x = 3352.92, y = -3379.03, z = 144.782, o = 6.25978}, -- Stratholme + [96] = {map = 0, x = -10449.5, y = -3827.47, z = 18.0675, o = 6.04945}, -- Sunken Temple + [97] = {map = 0, x = -11208.7, y = 1673.52, z = 24.6361, o = 1.51067}, -- The Deadmines + [98] = {map = 0, x = -8779.9, y = 834.349, z = 94.6801, o = 0.653013}, -- The Stockade + [99] = {map = 0, x = -6071.37, y = -2955.16, z = 209.782, o = 0.015708}, -- Uldaman + [100] = {map = 1, x = -731.607, y = -2218.39, z = 17.0281, o = 2.78486}, -- Wailing Caverns + [101] = {map = 1, x = -6801.19, y = -2893.02, z = 9.00388, o = 0.158639}, -- Zul'Farrak + +-- BC Dungeons + [102] = {map = 530, x = -3362.04, y = 5209.85, z = -101.05, o = 1.60924}, -- Auchenai Crypts + [103] = {map = 530, x = -360.671, y = 3071.9, z = -15.0977, o = 1.89389}, -- Hellfire Ramparts + [104] = {map = 530, x = 12884.6, y = -7317.69, z = 65.5023, o = 4.799}, -- Magisters' Terrace + [105] = {map = 530, x = -3104.18, y = 4945.52, z = -101.507, o = 6.22344}, -- Mana-Tombs + [106] = {map = 1, x = -8404.3, y = -4070.62, z = -208.586, o = 0.237038}, -- Old Hillsbrad Foothills + [107] = {map = 530, x = -3362.2, y = 4664.12, z = -101.049, o = 4.6605}, -- Sethekk Halls + [108] = {map = 530, x = -3627.9, y = 4941.98, z = -101.049, o = 3.16039}, -- Shadow Labyrinth + [109] = {map = 530, x = 3308.92, y = 1340.72, z = 505.56, o = 4.94686}, -- The Arcatraz + [110] = {map = 1, x = -8734.3, y = -4230.11, z = -209.5, o = 2.16212}, -- The Black Morass + [111] = {map = 530, x = -291.324, y = 3149.1, z = 31.5541, o = 2.27147}, -- The Blood Furnace + [112] = {map = 530, x = 3407.11, y = 1488.48, z = 182.838, o = 5.59559}, -- The Botanica + [113] = {map = 530, x = 2867.12, y = 1549.42, z = 252.159, o = 3.82218}, -- The Mechanar + [114] = {map = 530, x = -305.79, y = 3061.63, z = -2.53847, o = 1.88888}, -- The Shattered Halls + [115] = {map = 530, x = 717.282, y = 6979.87, z = -73.0281, o = 1.50287}, -- The Slave Pens + [116] = {map = 530, x = 794.537, y = 6927.81, z = -80.4757, o = 0.159089}, -- The Steamvault + [117] = {map = 530, x = 763.307, y = 6767.81, z = -67.7695, o = 5.99726}, -- The Underbog + +-- WOTLK Dungeons + [118] = {map = 571, x = 3677.53, y = 2166.7, z = 35.808, o = 2.30108}, -- Azjol-Nerub + [119] = {map = 1, x = -8750.76, y = -4442.2, z = -199.26, o = 4.37694}, -- The Culling of Stratholme + [120] = {map = 571, x = 4774.6, y = -2032.92, z = 229.15, o = 1.59}, -- Drak'Tharon Keep + [121] = {map = 571, x = 5666.25, y = 2009.2, z = 798.041, o = 5.43184}, -- The Forge of Souls + [122] = {map = 571, x = 8921.91, y = -993.503, z = 1039.41, o = 1.55263}, -- Halls of Stone + [123] = {map = 571, x = 9182.92, y = -1384.82, z = 1110.21, o = 5.57779}, -- Halls of Lightning + [124] = {map = 571, x = 5630.44, y = 1994.01, z = 798.059, o = 4.58756}, -- Halls of Reflection + [125] = {map = 571, x = 6952.3, y = -4419.98, z = 450.078, o = 0.807518}, -- Gundrak + [126] = {map = 571, x = 5598.74, y = 2015.85, z = 798.042, o = 3.81001}, -- Pit of Saron + [127] = {map = 571, x = 8588.42, y = 791.888, z = 558.236, o = 3.23819}, -- Trial of the Champion + [128] = {map = 571, x = 1219.72, y = -4865.28, z = 41.2479, o = 0.313228}, -- Utgarde Keep + [129] = {map = 571, x = 1259.33, y = -4852.02, z = 215.763, o = 3.48293}, -- Utgarde Pinnacle + [130] = {map = 571, x = 5696.73, y = 507.4, z = 652.97, o = 4.03}, -- The Violet Hold + +-- Raids + [131] = {map = 571, x = -8177.89, y = -4181.23, z = -167.552, o = 0.913338}, -- Battle for Mount Hyjal + [132] = {map = 530, x = -3649.92, y = 317.469, z = 35.2827, o = 2.94285}, -- Black Temple + [133] = {map = 229, x = 164.789, y = -475.305, z = 116.842, o = 0.022714}, -- Blackwing Lair + [134] = {map = 571, x = 3859.44, y = 6989.85, z = 152.041, o = 5.79635}, -- Eye of Eternity + [135] = {map = 530, x = 3530.06, y = 5104.08, z = 3.50861, o = 5.51117}, -- Gruul's Lair + [136] = {map = 571, x = 5873.82, y = 2110.98, z = 636.011, o = 3.5523}, -- Icecrown Citadel + [137] = {map = 0, x = -11118.9, y = -2010.33, z = 47.0819, o = 0.649895}, -- Karazhan + [138] = {map = 530, x = -312.7, y = 3087.26, z = -116.52, o = 5.19026}, -- Magtheridon's Lair + [139] = {map = 230, x = 1126.64, y = -459.94, z = -102.535, o = 3.46095}, -- Molten Core + [140] = {map = 571, x = 3668.72, y = -1262.46, z = 243.622, o = 4.785}, -- Naxxramas + [141] = {map = 571, x = 3457.11, y = 262.394, z = -113.819, o = 3.28258}, -- Obsidian Sanctum + [142] = {map = 1, x = -4708.27, y = -3727.64, z = 54.5589, o = 3.72786}, -- Onyxia's Lair (Vanilla) + [143] = {map = 249, x = 29.1607, y = -71.3372, z = -8.18032, o = 4.43584}, -- Onyxia's Lair (WOTLK) + [144] = {map = 571, x = 3600.5, y = 197.34, z = -113.76, o = 5.29905}, -- Ruby Sanctum + [145] = {map = 530, x = 820.025, y = 6864.93, z = -66.7556, o = 6.28127}, -- Serpentshrine Cavern + [146] = {map = 530, x = 12574.1, y = -6774.81, z = 15.0904, o = 3.13788}, -- Sunwell Plateau + [147] = {map = 530, x = 3099.36, y = 1518.73, z = 190.3, o = 4.72592}, -- Tempest Keep + [148] = {map = 1, x = -8409.82, y = 1499.06, z = 27.7179, o = 2.51868}, -- The Ruins of Ahn'Qiraj + [149] = {map = 1, x = -8240.09, y = 1991.32, z = 129.072, o = 0.941603}, -- The Temple of Ahn'Qiraj + [150] = {map = 571, x = 8515.68, y = 716.982, z = 558.248, o = 1.57315}, -- Trial of the Crusader + [151] = {map = 571, x = 9049.37, y = -1282.35, z = 1060.19, o = 5.8395}, -- Ulduar + [152] = {map = 571, x = 5453.72, y = 2840.79, z = 421.28, o = 0.0}, -- Vault of Archavon + +-- Custom + [153] = {map = 1, x = 16225.988, y = 16248.773, z = 14.061647, o = 1.7947958}, -- Guild Hall + [154] = {map = 800, x = 6012.925, y = 1603.3754, z = 34.00426, o = 4.637557}, -- Isle of Giants + [155] = {map = 5000, x = -13950, y = 2877, z = 9, o = 1.276430}, -- Morza Island + [156] = {map = 1, x = -10737.604,y = 2468.4258, z = 6.3820477, o = 5.7822013}, -- Silithus Camp + [157] = {map = 0, x = -5119.211, y = 4028.4114, z = 51.434544, o = 0.31480914}, -- Windpeak Island + +} + + +function TeleportSelectorServer.TeleportTo(player, locationId) + local loc = locations[locationId] + if loc then + player:Teleport(loc.map, loc.x, loc.y, loc.z, loc.o or 0) + else + player:SendBroadcastMessage("Invalid teleport location.") + end +end + +RegisterCreatureGossipEvent(300300, 1, function(_, player, creature) + AIO.Handle(player, "TeleportSelectorClient", "ShowTeleportUI") + player:GossipComplete() +end)