Logo

index : nswa

WoW addon which removes annoyances and adds QoL (for me)

  • summary
  • about
  • tree
  • log
  • branches
<< path: root/public/nswa.git/html/nswa_portals.lua blob: f261b63a82be93a55896c2906c6ecbf13548b2de [raw] [clear marker]

        
0
1local N = nswa
2
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
12}
13
14-- mapID from GetActivityInfoTable
15-- -------------------------------
16-- Triumvirat 1753
17-- Xenas 2915
18-- Mördergasse 2813
19-- Windspire 2805
20-- Blendendes Tal 2859
21-- Nalorakks Bau 2825
22-- Leerennarbe 2923
23-- Magister 2811
24-- Kavernen 2874
25-- Skyreach 1209
26-- Saron 658
27-- Akademie 2526
28
29
30local buttons = {}
31local index = 0
32local size = 36
33local spacing = 4
34local current_id = nil
35
36
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)
40
41 if index == 0 then
42 button:SetPoint("BOTTOMLEFT", parent_frame, "BOTTOMLEFT", 30, -80)
43 else
44 button:SetPoint("LEFT", buttons[index-1], "RIGHT", spacing, 0)
45 end
46
47 button:RegisterForClicks("AnyUp", "AnyDown")
48 button:SetAttribute("type", "spell")
49 button:SetAttribute("spell", spell_id)
50
51 local icon = button:CreateTexture(nil, "BACKGROUND")
52 icon:SetAllPoints()
53 icon:SetTexture(C_Spell.GetSpellTexture(spell_id))
54
55 local text = button:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
56 text:SetPoint("TOP", button, "BOTTOM", 0, -2)
57 text:SetText(label)
58
59 button.icon = icon
60 button.label = text
61 buttons[index] = button
62end
63
64local function buttons_clear()
65 for _, button in ipairs(buttons) do
66 if button and button:IsShown() then
67 button:Hide()
68 button:SetParent(nil)
69 end
70 end
71 buttons = {}
72 index = 0
73end
74
75local function button_glow(id, index)
76 if not current_id then return end
77 if not id then
78 local _, id, _, _, name = GetLFGProposal()
79 print("INFO: Maybe unknown id: " .. id .. ", name: " .. name)
80 return
81 end
82
83 if id == current_id then
84 local button = buttons[index]
85 ActionButtonSpellAlertManager:ShowAlert(button)
86 end
87end
88
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
94
95 if IsSpellKnown(spell_id) then
96 button_create(spell_id, label, parent_frame)
97 button_glow(data.map_id, index)
98 index = index + 1
99 end
100 end
101end
102
103local function wait_for_pve_frame()
104 local frame = CreateFrame("Frame")
105 frame:RegisterEvent("LFG_LOCK_INFO_RECEIVED")
106
107 frame:SetScript("OnEvent", function(self, event, ...)
108 if event == "LFG_LOCK_INFO_RECEIVED" then
109 frame:UnregisterEvent("LFG_LOCK_INFO_RECEIVED")
110
111 PVEFrame:HookScript("OnShow", function()
112 buttons_clear()
113 buttons_build(PVEFrame)
114 end)
115 end
116 end)
117end
118
119function N.portals_info_create(map_id)
120 current_id = map_id
121end
122
123function N.portals_info_destroy()
124 current_id = nil
125end
126
127function N.init_portals()
128 wait_for_pve_frame()
129end
130
131
Copyright 2026  E766CB298A6D1E64 | Git-Thing heavily inspired by cgit