674e0c0 - Fix char-specific settings, add Gedren
authorAleksi Blinnikka <aleksi.blinnikka@gmail.com>
Wed, 24 Jan 2018 16:09:27 +0000
committerAleksi Blinnikka <aleksi.blinnikka@gmail.com>
Wed, 24 Jan 2018 16:09:27 +0000
OmaRF/Events.lua
OmaRF/Indicators.lua
OmaRF/RaidFrame.lua
OmaRF/Settings.lua

index 4316a82..41fc221 100644 (file)
@@ -19,12 +19,12 @@ local RAID_CLASS_COLORS = RAID_CLASS_COLORS;
 local checkIndicators = OmaRFIndicators.CheckIndicators;
 
 local Settings = OmaRFSettings;
-local width = Settings.Character.Width;
 local baseColor = Settings.BaseColor;
 local overlayColorDispel = Settings.OverlayColorDispel;
 local overlayColorCharm = Settings.OverlayColorCharm;
 local overlayColorAlert = Settings.OverlayColorAlert;
 local powerColors = Settings.PowerColors;
+local width = 10;
 
 local M = {};
 OmaRFEvents = M;
@@ -80,8 +80,10 @@ local function updateText(frame, unit)
     local healthLost = max - current;
     if UnitIsDeadOrGhost(unit) then
         frame.text:SetText("Dead");
+        frame.text:Show();
     elseif not UnitIsConnected(unit) then
         frame.text:SetText("DC");
+        frame.text:Show();
     elseif healthLost > 0 then
         if healthLost > 1200000000 then -- 1.2B
             frame.text:SetFormattedText("-%.1fB", healthLost / 1000000000);
@@ -337,3 +339,7 @@ eventFuncs["GROUP_ROSTER_UPDATE"] = eventFuncs["UPDATE_ALL_BARS"];
 function M.UnitEvent(self, event)
     eventFuncs[event](self);
 end
+
+function M.LoadChar()
+    width = Settings.Character.Width;
+end
index fbf9817..b3c7d07 100644 (file)
@@ -7,9 +7,9 @@ local UnitIsDeadOrGhost, UnitIsConnected = UnitIsDeadOrGhost, UnitIsConnected;
 local CTimerAfter = C_Timer.After;
 
 local Settings = OmaRFSettings;
-local positions = Settings.Positions;
-local watchedAuras = Settings.Character["WatchedAuras"];
 local majorAuras = Settings.MajorAuras;
+local positions = {};
+local watchedAuras = {};
 
 local updaters = {};
 local updating = {};
@@ -122,3 +122,8 @@ function M.CheckIndicators(frame, unit)
         frame.major:Hide();
     end
 end
+
+function M.LoadChar()
+    watchedAuras = Settings.Character["WatchedAuras"];
+    positions = Settings.Character.Positions;
+end
index 31ef192..078280d 100644 (file)
@@ -11,9 +11,6 @@ local registerEvents = OmaRFEvents.RegisterEvents;
 local unitEvent = OmaRFEvents.UnitEvent;
 
 local Settings = OmaRFSettings;
-local positions = Settings.Positions;
-local width, height = Settings.Character.Width, Settings.Character.Height;
-local anchorX, anchorY = Settings.Character.AnchorX, Settings.Character.AnchorY;
 local indSize = Settings.IndSize;
 local baseColor = Settings.BaseColor;
 local bgColor = Settings.BgColor;
@@ -22,7 +19,11 @@ local shieldColor = Settings.ShieldColor;
 local shieldhlColor = Settings.ShieldhlColor;
 local healpredColor = Settings.HealpredColor;
 local healabsorbColor = Settings.HealabsorbColor;
-local attributes = Settings.Character.Clickheal;
+-- placeholders with visible values when error happens
+local positions = {};
+local width, height = 10, 10;
+local anchorX, anchorY = 10, 10;
+local attributes = {};
 
 local CFrame = CreateFrame("Frame", "OmaRFFrame", UIParent);
 local inheritedFrames = "SecureUnitButtonTemplate,SecureHandlerStateTemplate";
@@ -289,9 +290,22 @@ local function initialize()
     initializeRaid(CFrame);
 end
 
+local function loadCharSettings()
+    width, height = Settings.Character.Width, Settings.Character.Height;
+    anchorX, anchorY = Settings.Character.AnchorX, Settings.Character.AnchorY;
+    attributes = Settings.Character.Clickheal;
+    positions = Settings.Character.Positions;
+end
+
+CFrame:RegisterEvent("ADDON_LOADED");
 CFrame:RegisterEvent("PLAYER_LOGIN");
 CFrame:SetScript("OnEvent", function(self, event)
     if event == "PLAYER_LOGIN" then
         initialize();
+    elseif event == "ADDON_LOADED" then
+        OmaRFLoadChar();
+        loadCharSettings();
+        OmaRFEvents.LoadChar();
+        OmaRFIndicators.LoadChar();
     end
 end);
index 997e4c7..de76ea7 100644 (file)
@@ -9,6 +9,7 @@ local rawget = rawget;
 -- configurable settings
 -- character specific settings
 local charDefaults = {
+    Positions = {"TOPRIGHT", "BOTTOMLEFT"},
     Width = 80,
     Height = 40,
     AnchorX = 0,
@@ -21,6 +22,7 @@ local charDefaults = {
 local chars = {
     ["Stormreaver"] = {
         ["Vildan"] = {
+            Positions = {"TOPRIGHT", "BOTTOMLEFT"},
             Width = 80,
             Height = 40,
             AnchorX = 0,
@@ -50,12 +52,36 @@ local chars = {
                 ["alt-shift-spell2"] = "Beacon of Faith",
             },
         },
+        ["Gedren"] = {
+            Positions = {"TOPLEFT", "TOPRIGHT", "BOTTOMLEFT"},
+            Width = 80,
+            Height = 40,
+            AnchorX = 0,
+            AnchorY = -330,
+            WatchedAuras = {
+                ["Rejuvenation"] = "TOPRIGHT",
+                ["Lifebloom"] = "TOPLEFT",
+            },
+            Clickheal = {
+                ["type1"] = "spell",
+                ["type2"] = "spell",
+                ["shift-type1"] = "spell",
+                ["shift-type2"] = "spell",
+                ["ctrl-type1"] = "spell",
+                ["alt-type2"] = "spell",
+                ["spell1"] = "Healing Touch",
+                ["spell2"] = "Swiftmend",
+                ["shift-spell1"] = "Regrowth",
+                ["shift-spell2"] = "Lifebloom",
+                ["ctrl-spell1"] = "Nature's Cure",
+                ["alt-spell2"] = "Rebirth",
+            },
+        },
     },
 };
 
 -- account-wide settings
 local settings = {
-    Positions = {"TOPRIGHT", "BOTTOMLEFT"},
     IndSize = 14,
     BaseColor = {0, 0, 0},
     BgColor = {0.7, 0.7, 0.7},
@@ -99,9 +125,11 @@ OmaRFSettings = settings;
 -- watch to not remove mana entry
 setmetatable(settings.PowerColors, {__index = function(t) return rawget(t, PowerTypeMana) end});
 
-local name, realm = UnitFullName("player");
-if chars[realm] and chars[realm][name] then
-    settings.Character = chars[realm][name];
-else
-    settings.Character = charDefaults;
+function OmaRFLoadChar()
+    local name, realm = UnitFullName("player");
+    if chars[realm] and chars[realm][name] then
+        settings.Character = chars[realm][name];
+    else
+        settings.Character = charDefaults;
+    end
 end