Skip to content

Commit

Permalink
Return AutoHide to the AutoButton when showClassButtons is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
EsreverWoW committed Aug 20, 2022
1 parent eec0eb5 commit 655f0da
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 10 deletions.
35 changes: 35 additions & 0 deletions PallyPower.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2436,6 +2436,41 @@ function PallyPower:UpdateLayout()
if (classlist[classIndex] and classlist[classIndex] ~= 0 and (gspellID ~= 0 or self:NormalBlessingCount(classIndex) > 0)) then
cbNum = cbNum + 1
local cButton = self.classButtons[cbNum]
if cbNum == 1 then
if self.opt.display.showClassButtons then
self.autoButton:SetAttribute("_onenter", [[
for _, child in ipairs(childs) do
if child:GetAttribute("Display") == 1 then
child:Show()
end
end
]])
cButton:SetAttribute("_onhide", nil)
else
self.autoButton:SetAttribute("_onenter", [[
local leadChild
for _, child in ipairs(childs) do
if child:GetAttribute("Display") == 1 then
child:Show()
if (leadChild) then
leadChild:AddToAutoHide(child)
else
leadChild = child
leadChild:RegisterAutoHide(5)
end
end
end
if (leadChild) then
leadChild:AddToAutoHide(self)
end
]])
cButton:SetAttribute("_onhide", [[
for _, other in ipairs(others) do
other:Hide()
end
]])
end
end
if isPally and self.opt.enabled and self.opt.display.showClassButtons and ((GetNumGroupMembers() == 0 and self.opt.ShowWhenSolo) or (GetNumGroupMembers() > 0 and self.opt.ShowInParty)) then
cButton:Show()
else
Expand Down
13 changes: 3 additions & 10 deletions PallyPowerOptions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -611,17 +611,13 @@ PallyPower.options = {
order = 1,
type = "toggle",
name = L["Class Buttons"],
desc = L["If this option is disabled it will also disable the Player Buttons and you will only be able to buff using the Auto Buff button."],
desc = L["[Enable/Disable] Class Buttons"],
width = 1.1,
get = function(info)
return PallyPower.opt.display.showClassButtons
end,
set = function(info, val)
PallyPower.opt.display.showClassButtons = val
if not PallyPower.opt.display.showClassButtons then
PallyPower.opt.display.showPlayerButtons = false
PallyPower.opt.display.buffDuration = false
end
PallyPower:UpdateRoster()
end
},
Expand All @@ -631,16 +627,13 @@ PallyPower.options = {
name = L["Player Buttons"],
desc = L["If this option is disabled then you will no longer see the pop out buttons showing individual players and you will not be able to reapply Normal Blessings while in combat."],
disabled = function(info)
return PallyPower.opt.display.showClassButtons == false or PallyPower.opt.enabled == false or not isPally
return PallyPower.opt.enabled == false or not isPally
end,
get = function(info)
return PallyPower.opt.display.showPlayerButtons
end,
set = function(info, val)
PallyPower.opt.display.showPlayerButtons = val
if not PallyPower.opt.display.showClassButtons then
PallyPower.opt.display.showPlayerButtons = false
end
PallyPower:UpdateRoster()
end
},
Expand All @@ -650,7 +643,7 @@ PallyPower.options = {
name = L["Buff Duration"],
desc = L["If this option is disabled then Class and Player buttons will ignore buffs' duration, allowing buffs to be reapplied at will. This is especially useful for Protection Paladins when they spam Greater Blessings to generate more threat."],
disabled = function(info)
return PallyPower.opt.display.showClassButtons == false or PallyPower.opt.enabled == false or not isPally
return PallyPower.opt.enabled == false or not isPally
end,
get = function(info)
return PallyPower.opt.display.buffDuration
Expand Down

0 comments on commit 655f0da

Please sign in to comment.