fix: enable stance/state bars for CoA custom classes with shapeshift forms
Vanilla Bartender4 assumes only DRUID/WARRIOR/WARLOCK/PRIEST/ROGUE/HERO have
shapeshift forms. CoA custom classes (Witchdoctor, Templar, …) can register
forms late at runtime and aren't in the whitelist, so the stance/state bar
never came up for them.
StanceBar.lua:
- ApplyConfig() no longer Disable()s the module when GetNumShapeshiftForms()
is 0 at config time. A disabled module never re-enables on
UPDATE_SHAPESHIFT_FORMS, so late-registered forms were lost. We now just
hide the bar frame.
- Register UPDATE_SHAPESHIFT_FORMS and PLAYER_ENTERING_WORLD on the module
itself and re-Enable() / show the bar when forms appear after the fact.
Options/Bar.lua:
- The 'Hide in Stance/Form' visibility option was gated by a hard-coded
stanceClasses whitelist. Add an OR-fallback on GetNumShapeshiftForms() > 0
so CoA classes with forms get the UI.
StateBar.lua:
- DefaultStanceMap only had vanilla entries. For unknown classes with live
forms, synthesise a generic { id="formN", index=N } map at runtime so
UpdateStates() can wire stance-based action bar swaps.
This commit is contained in:
@@ -48,18 +48,43 @@ function StanceBarMod:OnEnable()
|
||||
self.bar:RegisterEvent("PLAYER_REGEN_ENABLED")
|
||||
self.bar:RegisterEvent("ACTIONBAR_PAGE_CHANGED")
|
||||
self:RegisterEvent("UPDATE_BINDINGS", "ReassignBindings")
|
||||
-- CoA: re-enable / refresh when forms appear late (custom classes)
|
||||
self:RegisterEvent("UPDATE_SHAPESHIFT_FORMS", "OnShapeshiftFormsUpdate")
|
||||
self:RegisterEvent("PLAYER_ENTERING_WORLD", "OnShapeshiftFormsUpdate")
|
||||
self:ReassignBindings()
|
||||
self:ApplyConfig()
|
||||
end
|
||||
|
||||
function StanceBarMod:OnShapeshiftFormsUpdate()
|
||||
-- CoA: if the module is disabled but forms now exist (custom class form
|
||||
-- registered after login), bring it back online.
|
||||
if not self:IsEnabled() and GetNumShapeshiftForms() > 0 then
|
||||
self:Enable()
|
||||
return
|
||||
end
|
||||
if self:IsEnabled() and self.bar then
|
||||
if GetNumShapeshiftForms() > 0 then
|
||||
if self.bar.Show then self.bar:Show() end
|
||||
else
|
||||
if self.bar.Hide then self.bar:Hide() end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
StanceBarMod.button_count = 10
|
||||
|
||||
function StanceBarMod:ApplyConfig()
|
||||
if not self:IsEnabled() then return end
|
||||
self.bar:ApplyConfig(self.db.profile)
|
||||
|
||||
-- CoA: custom classes (Witchdoctor, Templar, …) may register forms late.
|
||||
-- Don't Disable() the module if there are 0 forms right now — once disabled
|
||||
-- we'd never come back when UPDATE_SHAPESHIFT_FORMS arrives. Just hide the bar
|
||||
-- frame; UpdateStanceButtons() will re-show it when forms appear.
|
||||
if GetNumShapeshiftForms() == 0 then
|
||||
self:Disable()
|
||||
if self.bar.Hide then self.bar:Hide() end
|
||||
else
|
||||
if self.bar.Show then self.bar:Show() end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user