9405379 - Add focus frame
authorAleksi Blinnikka <aleksi.blinnikka@gmail.com>
Sat, 27 Jan 2018 12:03:55 +0000
committerAleksi Blinnikka <aleksi.blinnikka@gmail.com>
Sat, 27 Jan 2018 12:03:55 +0000
OmaRF/Events.lua
OmaRF/RaidFrame.lua

index faeff80..633319f 100644 (file)
@@ -260,7 +260,6 @@ local function updateRole(frame, unit)
 end
 
 local function updateReadyCheck(frame, unit)
-    if GetReadyCheckTimeLeft() <= 0 then return end
     local status = GetReadyCheckStatus(unit);
     if status == "ready" then
         frame.ready:SetTexture(READY_CHECK_READY_TEXTURE);
@@ -364,6 +363,7 @@ eventFuncs["UNIT_EXITED_VEHICLE"] = eventFuncs["UPDATE_ALL_BARS"];
 eventFuncs["UNIT_PET"] = eventFuncs["UPDATE_ALL_BARS"];
 eventFuncs["GROUP_ROSTER_UPDATE"] = eventFuncs["UPDATE_ALL_BARS"];
 eventFuncs["PLAYER_ENTERING_WORLD"] = eventFuncs["UPDATE_ALL_BARS"];
+eventFuncs["PLAYER_FOCUS_CHANGED"] = eventFuncs["UPDATE_ALL_BARS"];
 
 function M.UnitEvent(self, event)
     eventFuncs[event](self);
index 461d4dc..1f4bc87 100644 (file)
@@ -96,6 +96,7 @@ local function frameShow(frame)
     frame:RegisterEvent("READY_CHECK");
     frame:RegisterEvent("READY_CHECK_CONFIRM");
     frame:RegisterEvent("READY_CHECK_FINISHED");
+    if frame.unit == "focus" then frame:RegisterEvent("PLAYER_FOCUS_CHANGED") end
     registerEvents(frame);
     frame:SetScript("OnUpdate", unitUpdate);
     unitEvent(frame, "UPDATE_ALL_BARS", frame.displayed);
@@ -306,12 +307,27 @@ local function initializeRaid(parent)
     end
 end
 
+local function initializeFocus(parent)
+    local secure = CreateFrame("Button", "OmaFocusSecure", parent, inheritedFrames);
+    local frame = CreateFrame("Frame", "OmaFocus", parent);
+    local unit = "focus";
+    secure:SetPoint("BOTTOMLEFT", parent, "TOPLEFT");
+    frame:SetPoint("BOTTOMLEFT", parent, "TOPLEFT");
+    setupFrame(frame, secure, unit);
+    RegisterUnitWatch(frame);
+    RegisterUnitWatch(secure);
+    local vehicle = format("[@%s,unithasvehicleui] vehicle; no", unit);
+    RegisterStateDriver(secure, "vehicleui", vehicle);
+    secure:SetAttribute("_onstate-vehicleui", vehicletoggle);
+end
+
 local function initialize()
     CFrame:SetPoint("CENTER", nil, "CENTER", anchorX, anchorY);
     CFrame:SetHeight((height+2)*8);
     CFrame:SetWidth((width+2)*5+1);
     initializeParty(CFrame);
     initializeRaid(CFrame);
+    initializeFocus(CFrame);
 end
 
 local function loadCharSettings()