From 2b43ecee19dfa6c657be1b6484968081189c79cd Mon Sep 17 00:00:00 2001 From: d87 Date: Sun, 13 Sep 2020 11:36:08 +0700 Subject: [PATCH] Initialization role changes --- Aptechka.lua | 27 ++++++++++++++++----------- corner.tga | Bin 4140 -> 4140 bytes frame.lua | 8 ++++---- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/Aptechka.lua b/Aptechka.lua index e7aef34..224ab3d 100644 --- a/Aptechka.lua +++ b/Aptechka.lua @@ -216,9 +216,6 @@ local defaults = { Aptechka:RegisterEvent("PLAYER_LOGIN") function Aptechka.PLAYER_LOGIN(self,event,arg1) - Aptechka:UpdateRangeChecker() - Aptechka:UpdateDispelBitmask() - local uir2 = function(unit) if UnitIsDeadOrGhost(unit) or UnitIsEnemy(unit, "player") then --IsSpellInRange doesn't work with dead people return UnitInRange(unit) @@ -411,7 +408,13 @@ function Aptechka.PLAYER_LOGIN(self,event,arg1) self.initConfSnippet = self.initConfSnippet..config.initialConfigPostHookSnippet end - self:LayoutUpdate() + + Aptechka:SPELLS_CHANGED() -- Does the following: + -- Aptechka:UpdateRangeChecker() + -- Aptechka:UpdateDispelBitmask() + -- self:LayoutUpdate() + -- Switches to proper profile for the role + -- Reconf from it won't run until initialization is finished self:UpdateDebuffScanningMethod() self:UpdateHighlightedDebuffsHashMap() @@ -540,11 +543,6 @@ function Aptechka.PLAYER_LOGIN(self,event,arg1) local groupGrowth = AptechkaDB.profile.groupGrowth or config.groupGrowth Aptechka:SetGrowth(unitGrowth, groupGrowth) - -- if config.DispelFilterAll - -- then DispelFilter = "HARMFUL" - -- else DispelFilter = "HARMFUL|RAID" - -- end - Aptechka:SetScript("OnUpdate",Aptechka.OnRangeUpdate) Aptechka:Show() @@ -1438,6 +1436,7 @@ function Aptechka.FrameCheckRoles(self, unit ) end function Aptechka.PLAYER_REGEN_ENABLED(self,event) + self:LayoutUpdate() self:Reconfigure() self:UnregisterEvent("PLAYER_REGEN_ENABLED") end @@ -1470,8 +1469,13 @@ end function Aptechka:OnRoleChanged() - if not InCombatLockdown() then Aptechka:LayoutUpdate() end - Aptechka:Reconfigure() -- Schedules update on combat exit, that also includes layout update + if not InCombatLockdown() then + -- Will switch profile immediately if possible + Aptechka:LayoutUpdate() + else + -- Reconfigure in combat does nothing, but schedules LayoutUpdate and Reconf on combat exit + Aptechka:Reconfigure() + end end do local currentRole @@ -1919,6 +1923,7 @@ function Aptechka.CreateHeader(self,group,petgroup) Aptechka:CreateAnchor(f,group) end + -- Buttons will be created after Show f:Show() return f diff --git a/corner.tga b/corner.tga index c3b05a5c5edad9b013b3d47472b3b5126a42e7e7..cdefef4adc028f08ac277594258e80ea29c69a87 100644 GIT binary patch delta 42 vcmZ3Zuts5mY delta 37 kcmZ3Zuts5md9L15mH$wC5B0QJ@krvLx| diff --git a/frame.lua b/frame.lua index 4eb6a08..3ac8111 100644 --- a/frame.lua +++ b/frame.lua @@ -2075,6 +2075,10 @@ local optional_widgets = { } Aptechka.optional_widgets = optional_widgets +function Aptechka:RegisterWidget(name, func) + optional_widgets[name] = func +end + function Aptechka:CreateDynamicWidget(frame, widgetName) if optional_widgets[widgetName] then local newWidget = optional_widgets[widgetName](frame) @@ -2095,10 +2099,6 @@ function Aptechka:CreateDynamicWidget(frame, widgetName) end end -function Aptechka:RegisterWidget(name, func) - optional_widgets[name] = func() -end - local function Reconf(self) local config = AptechkaDefaultConfig