To follow on from this initial quest related action bar problems... there was another quest (
https://www.wowhead.com/quest=52042/the-big-boom) that needed the bar updated again *sigh* .. so hopefully my change to my previous bar changes haven't killed off the Righteous Retribution quest chain. Or the Tortollan Turtles daily quest (
https://www.wowhead.com/quest=55300/the-cycle-of-life) I had to make a change for ( just a re-order of the special bars) since this thread was updated.
Anyway ..
This is what I ended up doing to make things work for big boom which works in a similar way to Righteous Retribution which may have got broken when I made the changes needed for Tortollan Turtles Daily.
Lua Code:
-- Action Bar Creation Code Block includes ...
local bar = CreateFrame( "Frame", name, anchor, "SecureHandlerStateTemplate,SecureHandlerAttributeTemplate" );
-- Other nUI Specific Bar Creation Code
--After creating nUI_ActionBar using above frame creation code
-- Paging system changed as follows ( more of an ordering of the special bars ) :
RegisterStateDriver(
nUI_ActionBar, "page", string.format(
"[overridebar] %d; [shapeshift] %d;[vehicleui][possessbar] %d; [vehicleui] %d;" ..
"[bar:2] 2; [bar:3] 3; [bar:4] 4; [bar:5] 5; [bar:6] 6; " ..
"[bonusbar:1] 7; [bonusbar:2] 8; [bonusbar:3] 9; [bonusbar:4] 1; [bonusbar:5] 11; 1",
GetOverrideBarIndex(), GetVehicleBarIndex(),GetVehicleBarIndex(), GetTempShapeshiftBarIndex()
)
);
-- Handle the action bar page changes only, buttons changed in new code block
nUI_ActionBar:SetAttribute('_onstate-page', [[
if not newstate then return end
newstate = tonumber(newstate)
self:SetAttribute("actionpage", newstate)
]])
-- New attribute setting that allows management of custom attributes
-- Ignore if the state-page value was just reset because the action bar buttons have changed
-- Set state-page to nil if there are no action buttons with actions at all and every time an
-- action button is found with no actions .. this doesn't change anything, but allows the
-- _onstate-page attribute to trigger multiple times
nUI_ActionBar:SetAttribute('_onattributechanged', ([[
if name == "state-page" and value ~= nil then
local pageOffset, hasAction = (value - 1) * NUM_ACTIONBAR_BUTTONS
for id = 1,NUM_ACTIONBAR_BUTTONS do
if HasAction(id + pageOffset) then
ActionButtons[id]:SetAttribute('actionpage', value)
ActionButtons[id]:SetAttribute('statehidden',false) -- use by ActionButton:Update
hasAction = true
self:SetAttribute("showbutton",id)
else
ActionButtons[id]:SetAttribute('actionpage', nil)
ActionButtons[id]:SetAttribute('statehidden',true)-- used by ActionButton:Update
self:SetAttribute("hidebutton",id)
self:SetAttribute("state-page", nil)
end
end
if not hasAction then
self:SetAttribute("state-page", nil)
end
elseif name == "showbutton" then
ActionButtons[value]:Show()
elseif name == "hidebutton" then
ActionButtons[value]:Hide()
end
]]):gsub('NUM_ACTIONBAR_BUTTONS', NUM_ACTIONBAR_BUTTONS))
This seems to work fine, after several hours of mixing and matching the code Terenna posted so that it worked with nUI. At least for the big boom quest... I'll hold off handing it in until I have tested at least the tortollan turtle quest. Which after completing just now is working fine.
And it doesn't seem to have overtly affected the normal action bar switching ( druid forms etc switch and update fine with the correct ability icons ).