<<
path:
root/public/nswa.git/html/nswa_portals.lua
blob: f261b63a82be93a55896c2906c6ecbf13548b2de
[raw]
[clear marker]
3local season_portals = {
4 { id = 393273, label = "AA", map_id = 2526 }, -- Algeth'ar Academy
5 { id = 1254400, label = "WS", map_id = 2805 }, -- Windrunner Spire
6 { id = 1254572, label = "MT", map_id = 2811 }, -- Magisters' Terrace
7 { id = 1254563, label = "NPX", map_id = 2915 }, -- Nexus-Point Xenas
8 { id = 1254559, label = "MC", map_id = 2874 }, -- Maisara Caverns
9 { id = 159898, label = "SKYR", map_id = 1209 }, -- Skyreach
10 { id = 1254555, label = "POS", map_id = 658 }, -- Pit of Saron
11 { id = 1254551, label = "SOT", map_id = 1753 }, -- Seat of Triumvirate
14-- mapID from GetActivityInfoTable
15-- -------------------------------
37local function button_create(spell_id, label, parent_frame)
38 local button = CreateFrame("Button", "Nswa_portals_button"..index, parent_frame, "SecureActionButtonTemplate")
39 button:SetSize(size, size)
42 button:SetPoint("BOTTOMLEFT", parent_frame, "BOTTOMLEFT", 30, -80)
44 button:SetPoint("LEFT", buttons[index-1], "RIGHT", spacing, 0)
47 button:RegisterForClicks("AnyUp", "AnyDown")
48 button:SetAttribute("type", "spell")
49 button:SetAttribute("spell", spell_id)
51 local icon = button:CreateTexture(nil, "BACKGROUND")
53 icon:SetTexture(C_Spell.GetSpellTexture(spell_id))
55 local text = button:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
56 text:SetPoint("TOP", button, "BOTTOM", 0, -2)
61 buttons[index] = button
64local function buttons_clear()
65 for _, button in ipairs(buttons) do
66 if button and button:IsShown() then
75local function button_glow(id, index)
76 if not current_id then return end
78 local _, id, _, _, name = GetLFGProposal()
79 print("INFO: Maybe unknown id: " .. id .. ", name: " .. name)
83 if id == current_id then
84 local button = buttons[index]
85 ActionButtonSpellAlertManager:ShowAlert(button)
89local function buttons_build(parent_frame)
90 index = 0 -- maybe redundant
91 for _, data in ipairs(season_portals) do
92 local spell_id = data.id
93 local label = data.label
95 if IsSpellKnown(spell_id) then
96 button_create(spell_id, label, parent_frame)
97 button_glow(data.map_id, index)
103local function wait_for_pve_frame()
104 local frame = CreateFrame("Frame")
105 frame:RegisterEvent("LFG_LOCK_INFO_RECEIVED")
107 frame:SetScript("OnEvent", function(self, event, ...)
108 if event == "LFG_LOCK_INFO_RECEIVED" then
109 frame:UnregisterEvent("LFG_LOCK_INFO_RECEIVED")
111 PVEFrame:HookScript("OnShow", function()
113 buttons_build(PVEFrame)
119function N.portals_info_create(map_id)
123function N.portals_info_destroy()
127function N.init_portals()