Skip to content

Commit

Permalink
Initialization role changes
Browse files Browse the repository at this point in the history
  • Loading branch information
d87 committed Sep 13, 2020
1 parent db3c6af commit 2b43ece
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 15 deletions.
27 changes: 16 additions & 11 deletions Aptechka.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Binary file modified corner.tga
Binary file not shown.
8 changes: 4 additions & 4 deletions frame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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

Expand Down

0 comments on commit 2b43ece

Please sign in to comment.