290e5ed - Ready check support
authorAleksi Blinnikka <aleksi.blinnikka@gmail.com>
Fri, 26 Jan 2018 02:14:34 +0000
committerAleksi Blinnikka <aleksi.blinnikka@gmail.com>
Fri, 26 Jan 2018 02:14:34 +0000
OmaRF/Events.lua
OmaRF/RaidFrame.lua
OmaRF/Settings.lua

index f5522c3..faeff80 100644 (file)
@@ -13,8 +13,12 @@ local UnitIsDeadOrGhost, UnitIsConnected = UnitIsDeadOrGhost, UnitIsConnected;
 local UnitHasIncomingResurrection = UnitHasIncomingResurrection;
 local UnitGetTotalHealAbsorbs = UnitGetTotalHealAbsorbs;
 local UnitHasVehicleUI, UnitTargetsVehicleInRaidUI = UnitHasVehicleUI, UnitTargetsVehicleInRaidUI;
+local GetReadyCheckTimeLeft, GetReadyCheckStatus = GetReadyCheckTimeLeft, GetReadyCheckStatus;
 local UnitGroupRolesAssigned = UnitGroupRolesAssigned;
 local RAID_CLASS_COLORS = RAID_CLASS_COLORS;
+local READY_CHECK_READY_TEXTURE = READY_CHECK_READY_TEXTURE;
+local READY_CHECK_NOT_READY_TEXTURE = READY_CHECK_NOT_READY_TEXTURE;
+local READY_CHECK_WAITING_TEXTURE = READY_CHECK_WAITING_TEXTURE;
 
 local checkIndicators = OmaRFIndicators.CheckIndicators;
 
@@ -30,7 +34,7 @@ local M = {};
 OmaRFEvents = M;
 function M.RegisterEvents(frame)
     -- events are taken from FrameXML/CompactUnitFrame.lua
-    -- TODO ready check support, raid marker support,
+    -- TODO raid marker support,
     -- player flags support (/afk, /dnd)
     local displayed = frame.unit ~= frame.displayed and frame.displayed or nil;
     frame:RegisterUnitEvent("UNIT_HEALTH", frame.unit, displayed);
@@ -255,6 +259,23 @@ local function updateRole(frame, unit)
     end
 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);
+        frame.ready:Show()
+    elseif status == "notready" then
+        frame.ready:SetTexture(READY_CHECK_NOT_READY_TEXTURE);
+        frame.ready:Show()
+    elseif status == "waiting" then
+        frame.ready:SetTexture(READY_CHECK_WAITING_TEXTURE);
+        frame.ready:Show()
+    else
+        frame.ready:Hide()
+    end
+end
+
 local eventFuncs = {
     ["UNIT_HEALTH"] = function(frame)
         updateHealth(frame, frame.displayed);
@@ -312,6 +333,9 @@ local eventFuncs = {
     ["PLAYER_ROLES_ASSIGNED"] = function(frame)
         updateRole(frame, frame.unit);
     end,
+    ["READY_CHECK"] = function(frame)
+        updateReadyCheck(frame, frame.unit);
+    end,
     ["UPDATE_ALL_BARS"] = function(frame)
         updateVehicle(frame);
         updateMaxHealth(frame, frame.displayed);
@@ -325,6 +349,7 @@ local eventFuncs = {
         updateHealAbsorb(frame, frame.displayed);
         updatePowerColor(frame, frame.displayed);
         updateIncomingRes(frame, frame.unit);
+        updateReadyCheck(frame, frame.unit);
         updateAggro(frame, frame.displayed);
         updateName(frame, frame.displayed);
         updateRole(frame, frame.unit);
@@ -332,11 +357,14 @@ local eventFuncs = {
 };
 eventFuncs["UNIT_HEALTH_FREQUENT"] = eventFuncs["UNIT_HEALTH"];
 eventFuncs["PARTY_MEMBER_DISABLE"] = eventFuncs["PARTY_MEMBER_ENABLE"];
+eventFuncs["READY_CHECK_CONFIRM"] = eventFuncs["READY_CHECK"];
+eventFuncs["READY_CHECK_FINISHED"] = eventFuncs["READY_CHECK"];
 eventFuncs["UNIT_ENTERED_VEHICLE"] = eventFuncs["UPDATE_ALL_BARS"];
 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"];
+
 function M.UnitEvent(self, event)
     eventFuncs[event](self);
 end
index cb2c3a2..dc5a7a7 100644 (file)
@@ -91,6 +91,9 @@ local function frameShow(frame)
     frame:RegisterEvent("PLAYER_ROLES_ASSIGNED");
     frame:RegisterEvent("GROUP_ROSTER_UPDATE");
     frame:RegisterEvent("PLAYER_ENTERING_WORLD");
+    frame:RegisterEvent("READY_CHECK");
+    frame:RegisterEvent("READY_CHECK_CONFIRM");
+    frame:RegisterEvent("READY_CHECK_FINISHED");
     registerEvents(frame);
     frame:SetScript("OnUpdate", unitUpdate);
     unitEvent(frame, "UPDATE_ALL_BARS", frame.displayed);
@@ -181,6 +184,10 @@ local function setupFrame(frame, secure, unit)
     frame.rez:SetPoint("BOTTOMRIGHT", frame.background, "CENTER", 12, -12);
     frame.rez:SetTexture("Interface\\RaidFrame\\Raid-Icon-Rez");
     frame.rez:Hide();
+    frame.ready = frame:CreateTexture(nil, "OVERLAY");
+    frame.ready:SetPoint("TOPLEFT", frame.background, "BOTTOMLEFT", 0, 12);
+    frame.ready:SetPoint("BOTTOMRIGHT", frame.background, "BOTTOMLEFT", 12, 0);
+    frame.ready:Hide();
     -- set up indicators
     setupIndicators(frame);
     -- set scripts
index de76ea7..225f433 100644 (file)
@@ -70,9 +70,9 @@ local chars = {
                 ["ctrl-type1"] = "spell",
                 ["alt-type2"] = "spell",
                 ["spell1"] = "Healing Touch",
-                ["spell2"] = "Swiftmend",
+                ["spell2"] = "Lifebloom",
                 ["shift-spell1"] = "Regrowth",
-                ["shift-spell2"] = "Lifebloom",
+                ["shift-spell2"] = "Swiftmend",
                 ["ctrl-spell1"] = "Nature's Cure",
                 ["alt-spell2"] = "Rebirth",
             },