c0c06ef - Add basic action bar support
[wowui.git] / OmaRF / RaidFrame.lua
index 955c816..3cde21c 100644 (file)
@@ -1,8 +1,7 @@
 -- RaidFrame.lua
 local _;
-local unpack, pairs, rawget = unpack, pairs, rawget;
+local unpack, pairs = unpack, pairs;
 local format = string.format;
-local UnitHealthMax, UnitPowerMax = UnitHealthMax, UnitPowerMax;
 local UnitInRange = UnitInRange;
 local InCombatLockdown = InCombatLockdown;
 local CreateFrame, RegisterStateDriver, RegisterUnitWatch = CreateFrame, RegisterStateDriver, RegisterUnitWatch;
@@ -30,6 +29,7 @@ local attributes = {};
 
 local CFrame = CreateFrame("Frame", "OmaRFFrame", UIParent);
 local inheritedFrames = "SecureUnitButtonTemplate,SecureHandlerStateTemplate";
+local barTexture = "Interface\\AddOns\\OmaRF\\images\\minimalist";
 local class = nil;
 local party = {};
 local raid = {};
@@ -37,14 +37,14 @@ local raid = {};
 local M = {};
 OmaRaidFrame = M;
 
-local function unitUpdate(self, elapsed)
+local function unitUpdate(frame)
     -- there's no in/out of range event, have to check each frame
     -- from FrameXML/CompactUnitFrame.lua
-    local inRange, checked = UnitInRange(self.displayed);
+    local inRange, checked = UnitInRange(frame.displayed);
     if checked and not inRange then
-        self:SetAlpha(0.55);
+        frame:SetAlpha(0.55);
     else
-        self:SetAlpha(1);
+        frame:SetAlpha(1);
     end
 end
 
@@ -92,7 +92,7 @@ local function setupFrame(frame, secure, unit)
     frame.background:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -1, 1);
     frame.background:SetColorTexture(unpack(bgColor));
     frame.health = frame:CreateTexture(nil, "BORDER");
-    frame.health:SetTexture("Interface\\RaidFrame\\Raid-Bar-Hp-Fill");
+    frame.health:SetTexture(barTexture);
     frame.health:SetPoint("TOPLEFT", frame.background, "TOPLEFT");
     frame.health:SetPoint("BOTTOMLEFT", frame.background, "BOTTOMLEFT");
     frame.health:SetVertexColor(unpack(healthColor));
@@ -104,7 +104,8 @@ local function setupFrame(frame, secure, unit)
     frame.shield = frame:CreateTexture(nil, "BORDER");
     frame.shield:SetPoint("TOPLEFT", frame.health, "TOPRIGHT");
     frame.shield:SetPoint("BOTTOMLEFT", frame.health, "BOTTOMRIGHT");
-    frame.shield:SetColorTexture(unpack(shieldColor));
+    frame.shield:SetTexture(barTexture);
+    frame.shield:SetVertexColor(unpack(shieldColor));
     frame.shield:Hide();
     frame.shieldhl = frame:CreateTexture(nil, "ARTWORK");
     frame.shieldhl:SetPoint("TOPLEFT", frame.background, "TOPRIGHT", -1, 0);
@@ -146,6 +147,12 @@ local function setupFrame(frame, secure, unit)
     frame.ready:SetPoint("TOPLEFT", frame.background, "BOTTOMLEFT", 0, 14);
     frame.ready:SetPoint("BOTTOMRIGHT", frame.background, "BOTTOMLEFT", 14, 0);
     frame.ready:Hide();
+    frame.targeticon = frame:CreateTexture(nil, "OVERLAY");
+    frame.targeticon:SetPoint("CENTER", frame.background, "TOP");
+    frame.targeticon:SetWidth(12);
+    frame.targeticon:SetHeight(12);
+    frame.targeticon:SetTexture("Interface\\TARGETINGFRAME\\UI-RaidTargetingIcons");
+    frame.targeticon:Hide();
     -- set up indicators
     setupIndicators(frame, class);
     -- set scripts
@@ -264,17 +271,14 @@ local function initializeFocus(parent)
     secure:SetAttribute("_onstate-vehicleui", vehicletoggle);
 end
 
-local function loadCharSettings()
-    anchorX, anchorY = Settings.Character.AnchorX, Settings.Character.AnchorY;
-    attributes = Settings.Character.Clickheal;
-end
-
 local function initialize()
     -- let other addons hook these to anchor tooltip elsewhere
     GameTooltip = _G["GameTooltip"];
     GameTooltip_SetDefaultAnchor = _G["GameTooltip_SetDefaultAnchor"];
-    loadCharSettings();
-    class = UnitClass("player");
+    _, class = UnitClass("player");
+    anchorX, anchorY = Settings.Character.AnchorX, Settings.Character.AnchorY;
+    attributes = Settings.Character.Clickheal;
+    CFrame:SetFrameStrata("LOW");
     CFrame:SetPoint("CENTER", nil, "CENTER", anchorX, anchorY);
     CFrame:SetHeight((height+2)*8);
     CFrame:SetWidth((width+2)*5);
@@ -319,10 +323,10 @@ local function hideBlizzardRaid()
     hideBlizzardRaidButton();
 
     -- hide focus frame
-    for _, frame in pairs({FocusFrame, FocusFrameToT}) do
+    for _, frame in pairs({FocusFrame, FocusFrameToT, FocusFrameSpellBar}) do
         frame:UnregisterAllEvents();
-        frame.healthbar:UnregisterAllEvents();
-        frame.manabar:UnregisterAllEvents();
+        if frame.healthbar then frame.healthbar:UnregisterAllEvents() end
+        if frame.manabar then frame.manabar:UnregisterAllEvents() end
         if frame.spellbar then frame.spellbar:UnregisterAllEvents() end
         if frame.powerBarAlt then frame.powerBarAlt:UnregisterAllEvents() end
         frame:Hide();