4 local GetNamePlateForUnit = C_NamePlate.GetNamePlateForUnit;
5 local UnitExists = UnitExists;
6 local UnitAura = UnitAura;
8 local main = CreateFrame("Frame", "OmaNameplateAuras");
13 local function createNameplate(parent)
14 local name = format("OmaPlate%i", unique);
15 local frame = CreateFrame("Frame", name, parent);
16 frames[parent] = frame;
18 frame:SetPoint("BOTTOM", parent, "TOP", 0, 14);
22 frame.base = frame:CreateTexture(nil, "BACKGROUND");
23 frame.base:SetAllPoints();
24 frame.base:SetColorTexture(0, 0, 0, 0.6);
25 frame.icon = frame:CreateTexture(nil, "ARTWORK");
26 frame.icon:SetPoint("TOPLEFT", frame.base, "TOPLEFT", 1, -1);
27 frame.icon:SetPoint("BOTTOMRIGHT", frame.base, "BOTTOMRIGHT", -1, 1);
28 frame.icon:SetTexCoord(0.07, 0.93, 0.07, 0.93);
29 frame.cd = CreateFrame("Cooldown", format("%sCD", name), frame, "CooldownFrameTemplate");
30 frame.cd:SetReverse(true);
31 frame.cd:SetHideCountdownNumbers(true);
32 frame.cd:SetAllPoints();
36 local function setNameplate(unit)
37 local frame = frames[GetNamePlateForUnit(unit)];
38 -- TODO register interesting events to track on nameplates
41 local function unsetNameplate(unit)
42 local frame = frames[GetNamePlateForUnit(unit)];
43 frame:UnregisterAllEvents();
48 ["NAME_PLATE_CREATED"] = createNameplate,
49 ["NAME_PLATE_UNIT_ADDED"] = setNameplate,
50 ["NAME_PLATE_UNIT_REMOVED"] = unsetNameplate,
52 main:SetScript("OnEvent", function(self, event)
53 main:UnregisterAllEvents();
54 main:SetScript("OnEvent", function(self, event, arg1)
57 main:RegisterEvent("NAME_PLATE_CREATED");
58 main:RegisterEvent("NAME_PLATE_UNIT_ADDED");
59 main:RegisterEvent("NAME_PLATE_UNIT_REMOVED");
61 main:RegisterEvent("PLAYER_LOGIN");