Quantcast
WoWInterface - View Single Post - Quest:Righteous Retribution special action bar not switching in nUI
View Single Post
05-01-20, 09:30 PM   #25
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,513
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:
  1. -- Action Bar Creation Code Block includes ...
  2. local bar  = CreateFrame( "Frame", name, anchor, "SecureHandlerStateTemplate,SecureHandlerAttributeTemplate" );
  3. -- Other nUI Specific Bar Creation Code
  4.  
  5. --After creating nUI_ActionBar using above frame creation code
  6.  
  7. -- Paging system changed as follows ( more of an ordering of the special bars ) :
  8. RegisterStateDriver(
  9.     nUI_ActionBar, "page", string.format(
  10.           "[overridebar] %d; [shapeshift] %d;[vehicleui][possessbar] %d; [vehicleui] %d;"  ..
  11.           "[bar:2] 2; [bar:3] 3; [bar:4] 4; [bar:5] 5; [bar:6] 6; " ..
  12.           "[bonusbar:1] 7; [bonusbar:2] 8; [bonusbar:3] 9; [bonusbar:4] 1; [bonusbar:5] 11; 1",
  13.           GetOverrideBarIndex(), GetVehicleBarIndex(),GetVehicleBarIndex(), GetTempShapeshiftBarIndex()
  14.    )
  15. );
  16.  
  17. -- Handle the action bar page changes only, buttons changed in new code block
  18.         nUI_ActionBar:SetAttribute('_onstate-page', [[
  19.             if not newstate then return end
  20.             newstate = tonumber(newstate)
  21.             self:SetAttribute("actionpage", newstate)
  22.         ]])
  23.  
  24. -- New attribute setting that allows management of custom attributes
  25. -- Ignore if the state-page value was just reset because the action bar buttons have changed
  26. -- Set state-page to nil if there are no action buttons with actions at all and every time an
  27. -- action button is found with no actions .. this doesn't change anything, but allows the
  28. -- _onstate-page attribute to trigger multiple times
  29.         nUI_ActionBar:SetAttribute('_onattributechanged', ([[
  30.             if name == "state-page" and value ~= nil then
  31.                 local pageOffset, hasAction = (value - 1) * NUM_ACTIONBAR_BUTTONS
  32.                 for id = 1,NUM_ACTIONBAR_BUTTONS do
  33.                     if HasAction(id + pageOffset) then
  34.                         ActionButtons[id]:SetAttribute('actionpage', value)
  35.                         ActionButtons[id]:SetAttribute('statehidden',false) -- use by ActionButton:Update
  36.                         hasAction = true
  37.                         self:SetAttribute("showbutton",id)
  38.                     else
  39.                         ActionButtons[id]:SetAttribute('actionpage', nil)
  40.                         ActionButtons[id]:SetAttribute('statehidden',true)-- used by ActionButton:Update
  41.                         self:SetAttribute("hidebutton",id)
  42.                         self:SetAttribute("state-page", nil)
  43.                     end
  44.                 end
  45.                 if not hasAction then
  46.                     self:SetAttribute("state-page", nil)
  47.                 end                
  48.             elseif name == "showbutton" then
  49.                 ActionButtons[value]:Show()
  50.             elseif name == "hidebutton" then
  51.                 ActionButtons[value]:Hide()
  52.             end
  53.         ]]):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 ).
__________________

Last edited by Xrystal : 05-02-20 at 05:40 PM.
  Reply With Quote