local N = nswa local season_portals = { { id = 393273, label = "AA", map_id = 2526 }, -- Algeth'ar Academy { id = 1254400, label = "WS", map_id = 2805 }, -- Windrunner Spire { id = 1254572, label = "MT", map_id = 2811 }, -- Magisters' Terrace { id = 1254563, label = "NPX", map_id = 2915 }, -- Nexus-Point Xenas { id = 1254559, label = "MC", map_id = 2874 }, -- Maisara Caverns { id = 159898, label = "SKYR", map_id = 1209 }, -- Skyreach { id = 1254555, label = "POS", map_id = 658 }, -- Pit of Saron { id = 1254551, label = "SOT", map_id = 1753 }, -- Seat of Triumvirate } -- mapID from GetActivityInfoTable -- ------------------------------- -- Triumvirat 1753 -- Xenas 2915 -- Mördergasse 2813 -- Windspire 2805 -- Blendendes Tal 2859 -- Nalorakks Bau 2825 -- Leerennarbe 2923 -- Magister 2811 -- Kavernen 2874 -- Skyreach 1209 -- Saron 658 -- Akademie 2526 local buttons = {} local index = 0 local size = 36 local spacing = 4 local current_id = nil local function button_create(spell_id, label, parent_frame) local button = CreateFrame("Button", "Nswa_portals_button"..index, parent_frame, "SecureActionButtonTemplate") button:SetSize(size, size) if index == 0 then button:SetPoint("BOTTOMLEFT", parent_frame, "BOTTOMLEFT", 30, -80) else button:SetPoint("LEFT", buttons[index-1], "RIGHT", spacing, 0) end button:RegisterForClicks("AnyUp", "AnyDown") button:SetAttribute("type", "spell") button:SetAttribute("spell", spell_id) local icon = button:CreateTexture(nil, "BACKGROUND") icon:SetAllPoints() icon:SetTexture(C_Spell.GetSpellTexture(spell_id)) local text = button:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall") text:SetPoint("TOP", button, "BOTTOM", 0, -2) text:SetText(label) button.icon = icon button.label = text buttons[index] = button end local function buttons_clear() for _, button in ipairs(buttons) do if button and button:IsShown() then button:Hide() button:SetParent(nil) end end buttons = {} index = 0 end local function button_glow(id, index) if not current_id then return end if not id then local _, id, _, _, name = GetLFGProposal() print("INFO: Maybe unknown id: " .. id .. ", name: " .. name) return end if id == current_id then local button = buttons[index] ActionButtonSpellAlertManager:ShowAlert(button) end end local function buttons_build(parent_frame) index = 0 -- maybe redundant for _, data in ipairs(season_portals) do local spell_id = data.id local label = data.label if IsSpellKnown(spell_id) then button_create(spell_id, label, parent_frame) button_glow(data.map_id, index) index = index + 1 end end end local function wait_for_pve_frame() local frame = CreateFrame("Frame") frame:RegisterEvent("LFG_LOCK_INFO_RECEIVED") frame:SetScript("OnEvent", function(self, event, ...) if event == "LFG_LOCK_INFO_RECEIVED" then frame:UnregisterEvent("LFG_LOCK_INFO_RECEIVED") PVEFrame:HookScript("OnShow", function() buttons_clear() buttons_build(PVEFrame) end) end end) end function N.portals_info_create(map_id) current_id = map_id end function N.portals_info_destroy() current_id = nil end function N.init_portals() wait_for_pve_frame() end