674e0c0 - Fix char-specific settings, add Gedren
[wowui.git] / OmaRF / RaidFrame.lua
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);