4 local GetSpecialization = GetSpecialization;
5 local UnitExists = UnitExists;
6 local UnitAura = UnitAura;
7 local GetTotemInfo = GetTotemInfo;
9 -- character specific frames
15 spec = 3, -- Retribution
17 auraFilter = "PLAYER HARMFUL",
18 x = 570, -- placed over Innervate frame
25 spec = 3, -- Retribution
26 auras = {"Divine Purpose"},
27 auraFilter = "PLAYER HELPFUL",
35 spec = 2, -- Protection
36 auras = {"Shield of the Righteous"},
37 auraFilter = "PLAYER HELPFUL",
45 auras = {"Divine Shield"},
46 auraFilter = "PLAYER HELPFUL",
66 -- unit = unitID where to check auras, not required for totem checkers
67 -- spec = player spec index to show frame, if nil show always
68 -- auras = list of auras to track, in priority order
69 -- auraFilter = filter for UnitAura
70 -- totems = list of totem slots to track, in priority order, only checked if auras is nil
71 -- x = x position relative to UIParent bottom left
72 -- y = y position relative to UIParent bottom left
76 -- global frames' settings
80 auras = {"Innervate"},
81 auraFilter = "HELPFUL",
90 "Delusions", "Entropic Blast", "Necrotic Embrace", "Flametouched", "Shadowtouched",
91 "Blazing Eruption", "Shattering Scream", "Consuming Hunger", "Unstable Soul",
92 "Time Bomb", "Broken Shard",
94 auraFilter = "HARMFUL",
103 local units = {}; -- mapping from unitID to frames
104 local totems = {}; -- mapping to frames with totems
106 for i = 1, MAX_BOSS_FRAMES do
107 bosses[i] = "boss"..i;
109 local currentSpec = 0; -- 0 is invalid
111 local Indicators = CreateFrame("Frame", "OmaTMW", UIParent);
113 local function updateAuraFrame(frame)
114 local unit = frame.unit;
115 if UnitExists(unit) and (not frame.spec or frame.spec == currentSpec) then
116 local name, icon, count, duration, expires;
117 for _, aura in pairs(frame.auras) do
118 name, _, icon, count, _, duration, expires = UnitAura(unit, aura, nil, frame.auraFilter);
121 frame.stack:SetText(count);
127 frame.cd:SetCooldown(expires - duration, duration);
132 frame.icon:SetTexture(icon);
141 local function updateAuras(unit)
143 for _, i in pairs(units[unit]) do
144 updateAuraFrame(frames[i]);
149 local function updateTotemFrame(frame, slot)
150 local _, name, start, duration, icon = GetTotemInfo(slot);
152 frame.cd:SetCooldown(start, duration);
154 frame.icon:SetTexture(icon);
161 local function updateTotems(slot)
163 for _, i in pairs(totems[slot]) do
164 updateTotemFrame(frames[i], slot);
169 local function createTMW(name, config, parent)
170 local frame = CreateFrame("Frame", name, parent);
171 frame:SetPoint("TOPLEFT", parent, "BOTTOMLEFT", config.x, config.y+config.height);
172 frame:SetPoint("BOTTOMRIGHT", parent, "BOTTOMLEFT", config.x+config.width, config.y);
173 frame.unit = config.unit;
174 frame.spec = config.spec;
175 frame.auras = config.auras;
176 frame.auraFilter = config.auraFilter;
177 frame.totems = config.totems;
179 frame.base = frame:CreateTexture(nil, "BACKGROUND");
180 frame.base:SetAllPoints();
181 frame.base:SetColorTexture(0, 0, 0, 0.6);
182 frame.icon = frame:CreateTexture(nil, "ARTWORK");
183 frame.icon:SetPoint("TOPLEFT", frame.base, "TOPLEFT", 1, -1);
184 frame.icon:SetPoint("BOTTOMRIGHT", frame.base, "BOTTOMRIGHT", -1, 1);
185 frame.icon:SetTexCoord(0.07, 0.93, 0.07, 0.93);
186 frame.stack = frame:CreateFontString(nil, "OVERLAY", "NumberFontNormalLarge");
187 frame.stack:SetPoint("TOPLEFT");
189 frame.cd = CreateFrame("Cooldown", name.."CD", frame, "CooldownFrameTemplate");
190 frame.cd:SetReverse(true);
191 frame.cd:SetAllPoints();
195 local function initialize()
196 Indicators:SetFrameStrata("LOW");
197 Indicators:SetPoint("BOTTOMLEFT");
198 Indicators:SetWidth(1);
199 Indicators:SetHeight(1);
200 currentSpec = GetSpecialization();
201 local name, realm = UnitFullName("player");
202 if chars[realm] and chars[realm][name] then
203 for _, config in pairs(chars[realm][name]) do
204 table.insert(settings, config)
207 for i, config in pairs(settings) do
209 if not units[config.unit] then units[config.unit] = {} end
210 table.insert(units[config.unit], i);
212 if config.totems then
213 for _, slot in pairs(config.totems) do
214 if not totems[slot] then totems[slot] = {} end
215 table.insert(totems[slot], i);
218 frames[i] = createTMW("OmaTMW"..i, config, Indicators);
221 for _, frame in pairs(frames) do
222 if frame.auras then updateAuraFrame(frame) end
224 for _, slot in pairs(frame.totems) do updateTotemFrame(frame, slot) end
229 Indicators:RegisterEvent("UNIT_AURA");
230 Indicators:RegisterEvent("PLAYER_TARGET_CHANGED");
231 Indicators:RegisterEvent("PLAYER_TOTEM_UPDATE");
232 Indicators:RegisterEvent("INSTANCE_ENCOUNTER_ENGAGE_UNIT");
233 Indicators:RegisterEvent("PLAYER_SPECIALIZATION_CHANGED");
234 Indicators:RegisterEvent("PLAYER_LOGIN");
235 Indicators:SetScript("OnEvent", function(self, event, arg1)
236 if event == "UNIT_AURA" then
238 elseif event == "PLAYER_TARGET_CHANGED" then
239 updateAuras("target");
240 elseif event == "PLAYER_TOTEM_UPDATE" then
242 elseif event == "INSTANCE_ENCOUNTER_ENGAGE_UNIT" then
243 for _, boss in pairs(bosses) do
246 elseif event == "PLAYER_SPECIALIZATION_CHANGED" then
247 currentSpec = GetSpecialization();
248 for _, frame in pairs(frames) do
249 if frame.auras then updateAuraFrame(frame) end
250 if frame.totems then updateTotemFrame(frame) end
252 elseif event == "PLAYER_LOGIN" then