mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-19 02:50:50 +00:00
actionbar: use statedriver for pet visibility
This commit is contained in:
+24
-18
@@ -895,26 +895,32 @@ pfUI:RegisterModule("actionbar", "vanilla:tbc", function ()
|
|||||||
if enable == "1" then
|
if enable == "1" then
|
||||||
-- handle pet bar
|
-- handle pet bar
|
||||||
if i == 12 then
|
if i == 12 then
|
||||||
-- only show when pet actions exists
|
if bars[i].SetAttribute and RegisterStateDriver then
|
||||||
if PetHasActionBar() then
|
-- set state driver for pet bars
|
||||||
bars[i]:Show()
|
bars[i]:SetAttribute("unit", "pet")
|
||||||
|
RegisterStateDriver(bars[i], 'visibility', "[pet] show; hide")
|
||||||
else
|
else
|
||||||
bars[i]:Hide()
|
-- only show when pet actions exists
|
||||||
end
|
if PetHasActionBar() then
|
||||||
|
bars[i]:Show()
|
||||||
|
else
|
||||||
|
bars[i]:Hide()
|
||||||
|
end
|
||||||
|
|
||||||
-- show/hide petbar on petbar updates
|
-- show/hide petbar on petbar updates
|
||||||
if init then
|
if init then
|
||||||
bars[i]:RegisterEvent("PET_BAR_UPDATE")
|
bars[i]:RegisterEvent("PET_BAR_UPDATE")
|
||||||
bars[i]:SetScript("OnEvent", function()
|
bars[i]:SetScript("OnEvent", function()
|
||||||
-- hide obsolete buttons
|
-- hide obsolete buttons
|
||||||
for i=1, NUM_PET_ACTION_SLOTS do
|
for i=1, NUM_PET_ACTION_SLOTS do
|
||||||
if not PetHasActionBar() and bars[12][i] then
|
if not PetHasActionBar() and bars[12][i] then
|
||||||
bars[12][i]:Hide()
|
bars[12][i]:Hide()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- refresh layout
|
-- refresh layout
|
||||||
CreateActionBar(12)
|
CreateActionBar(12)
|
||||||
end)
|
end)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- handle shapeshift bar
|
-- handle shapeshift bar
|
||||||
|
|||||||
Reference in New Issue
Block a user