Quantcast Quest:Righteous Retribution special action bar not switching in nUI - WoWInterface
Thread Tools Display Modes
08-23-18, 05:33 PM   #1
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,256
Quest:Righteous Retribution special action bar not switching in nUI

I've just come across this on my hunter and it appears it switches out to an action bar that nUI hasn't managed to figure out the combination of paging conditionals to get it to appear without a reload of the UI.

For those that haven't got there yet its the alliance quest from Taelia in Vigil Hill around level 113.

Has any of the action bar creators figured out which setup gets this to work? If I remember rightly I had a similar problem where back when with the Thanksgiving Chair Hopping Quest and could never resolve it so is probably the same bar switch mechanism if that helps.

Thanks in advance for any help that can help me figure it out.
__________________

Last edited by Xrystal : 08-23-18 at 05:49 PM.
  Reply With Quote
08-23-18, 06:26 PM   #2
Vrul
A Frostmaul Preserver
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 292
This is what I used based on Blizzard's ActionBarController code (verified it still matches up in BfA):
Code:
[vehicleui] 12; [overridebar] 14; [possessbar] [@vehicle, exists] 12; [shapeshift] 13; [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] 10; [bonusbar:5] 11; 1
I have no way to test myself but you can give it a shot.
  Reply With Quote
08-23-18, 06:30 PM   #3
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,256
Originally Posted by Vrul View Post
This is what I used based on Blizzard's ActionBarController code (verified it still matches up in BfA):
Code:
[vehicleui] 12; [overridebar] 14; [possessbar] [@vehicle, exists] 12; [shapeshift] 13; [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] 10; [bonusbar:5] 11; 1
I have no way to test myself but you can give it a shot.
Thanks Vrul, I'll give it a test and let you know.

Looking at the code, it may be the [possessbar] [@vehicle, exists] 12; part as nUI has that down as [vehicleui][possessbar] GetVehicleBarIndex(). I guess there is a difference between [@vehicle, exists] and [vehicleUI] in regards to the posessbar. Thanks again.
__________________

Last edited by Xrystal : 08-23-18 at 06:34 PM.
  Reply With Quote
08-23-18, 06:48 PM   #4
Vrul
A Frostmaul Preserver
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 292
Originally Posted by Xrystal View Post
I guess there is a difference between [@vehicle, exists] and [vehicleUI] in regards to the posessbar.
Here is that code section so you can see the logic flow and why vehicle stuff is in there two different ways:
Code:
-- If we have a skinned vehicle bar or skinned override bar, display the OverrideActionBar
if ((HasVehicleActionBar() and UnitVehicleSkin("player") and UnitVehicleSkin("player") ~= "")
or (HasOverrideActionBar() and GetOverrideBarSkin() and GetOverrideBarSkin() ~= 0)) then
    -- For now, a vehicle has precedence over override bars (hopefully designers make it so these never conflict)
    if (HasVehicleActionBar()) then
        OverrideActionBar_Setup(UnitVehicleSkin("player"), GetVehicleBarIndex());
    else
        OverrideActionBar_Setup(GetOverrideBarSkin(), GetOverrideBarIndex());
    end
-- If we have a non-skinned override bar of some sort, use the MainMenuBarArtFrame
elseif ( HasBonusActionBar() or HasOverrideActionBar() or HasVehicleActionBar() or HasTempShapeshiftActionBar() or C_PetBattles.IsInBattle() ) then
    if (HasVehicleActionBar()) then
        MainMenuBarArtFrame:SetAttribute("actionpage", GetVehicleBarIndex());
    elseif (HasOverrideActionBar()) then
        MainMenuBarArtFrame:SetAttribute("actionpage", GetOverrideBarIndex());
    elseif (HasTempShapeshiftActionBar()) then
        MainMenuBarArtFrame:SetAttribute("actionpage", GetTempShapeshiftBarIndex());
    elseif (HasBonusActionBar() and GetActionBarPage() == 1) then
        MainMenuBarArtFrame:SetAttribute("actionpage", GetBonusBarIndex());
    else
        MainMenuBarArtFrame:SetAttribute("actionpage", GetActionBarPage());
    end
else
    -- Otherwise, display the normal action bar
    ActionBarController_ResetToDefault(force);
end
  Reply With Quote
08-23-18, 07:09 PM   #5
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,256
Thanks Vrul.

It still confuses me how that normal code segment turns into conditionals. But then it has been years since I last had a look at it and it probably made a bit more sense back then while I was playing with it.

Anyway, thanks again and I'll give it a test run tomorrow when I have time to run through the whole quest which is in sections, in one go.
__________________
  Reply With Quote
08-23-18, 08:53 PM   #6
Vrul
A Frostmaul Preserver
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 292
Here is nUI's relevant section changed to follow Blizzard's logic:
Code:
		if nUI_Options.boomkinBar then
			RegisterStateDriver(
				nUI_ActionBar, "page", string.format(
					"[vehicleui] %d; [overridebar] %d; [@vehicle,exists][possessbar] %d; [shapeshift] %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] 10; [bonusbar:5] 11; 1",
					GetVehicleBarIndex(), GetOverrideBarIndex(), GetVehicleBarIndex(), GetTempShapeshiftBarIndex()
				)
			);
		else
			RegisterStateDriver(
				nUI_ActionBar, "page", string.format(
					"[vehicleui] %d; [overridebar] %d; [@vehicle,exists][possessbar] %d; [shapeshift] %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",
					GetVehicleBarIndex(), GetOverrideBarIndex(), GetVehicleBarIndex(), GetTempShapeshiftBarIndex()
				)
			);
		end
  Reply With Quote
08-24-18, 01:05 AM   #7
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,256
Yep, thats what I was going to do

Will test later on today when I'm in wow mode.
__________________
  Reply With Quote
08-24-18, 08:25 AM   #8
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,256
Bummer, that didn't work.

I don't think its the bar thats the problem .. its the buttons not appearing until it is reloaded.

So maybe something to do with when the buttons are created and applied to the bar .. more investigation I guess


Ah, order matters doesn't it .. switched them round like you have and testing again.

Nope, same problem. It must be how nUI builds the buttons and the bars.

Oops, forgot the index change, nope that didn't work either ..

However, I did notice that although the button didn't change the key for the button worked. So must be an assignment of the button to the bar problem with nUI.
__________________

Last edited by Xrystal : 08-24-18 at 08:58 AM.
  Reply With Quote
08-24-18, 06:22 PM   #9
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,256
Still no clearer to the problem for this quest .. but ..

Looking back at nUI's updates I found that I had managed to fix the pilgrims bounty bar switching and before that Draktharon Keep.

Just tested Draktharon Keep as we had since removed the separate vehicle bar code file sometime before 7.0 so I was worried it had broken my previous fixes, but nope, it still works .. so a different set up is required for this quest it seems.

Looking at Bartender, SyncUI and lsUI it appears we may have to reinstate a separate vehicle bar as it seems that is the thing they all seem to have in common.

Thanks again Vrul,
__________________
  Reply With Quote
08-26-18, 08:41 PM   #10
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,256
Well I managed to get this working. Based on investigation the best way was to set up a bar just for vehicleui use as no amount of changing the code in nUI worked.

With this set up to display when having a vehicleui and the main action bar displayed otherwise seems to work.

The quest shows an empty bar at first and then updates the buttons with the information party way through the flight. This picks up that change and lets the buttons know and sets the appropriate texture via Blizzards Frame template functionality.

Now, in this scenario combat isn't an issue from what I can see, but what if it was, I guess I'll have to find a toon that needs to do the vashjir vision quest chain as I think that was a similar setup .. to 1. see if that now works and 2. whether the combat situation in that quest chain causes an issue... but, bowing to your superior knowledge of the secure section of addons Vrul, would any of this have an issue in combat ? If so, how the hell do actionbar addons deal with this apart from the one or two that gave up and just turned on the blizzard override bar rofl. Thanks in advance again

Lua Code:
  1. ------------------------------------------------------
  2. --[[              Bar Setup                       ]]--
  3. ------------------------------------------------------
  4. local barFrame = CreateFrame("Frame","XBar_Vehicle", UIParent, "SecureHandlerStateTemplate, SecureHandlerAttributeTemplate")
  5. local background = barFrame:CreateTexture("$parent_Background", "BACKGROUND")
  6. background:SetColorTexture(0,0,0,0.5)
  7. background:SetAllPoints()
  8. barFrame:SetWidth(51 * 12)
  9. barFrame:SetHeight(51)
  10. barFrame:SetPoint("CENTER")
  11.  
  12. ------------------------------------------------------
  13. --[[                 Button Setup                 ]]--
  14. ------------------------------------------------------
  15. barFrame.Buttons = {}
  16. for i = 1,NUM_ACTIONBAR_BUTTONS do    
  17.     local btn = CreateFrame("CheckButton", "$parent_Button"..i, barFrame, "SecureActionButtonTemplate,ActionBarButtonTemplate")
  18.     btn:SetWidth(50)
  19.     btn:SetHeight(50)
  20.     if i == 1 then
  21.         btn:SetPoint("LEFT",5,0)
  22.     else
  23.         btn:SetPoint("LEFT", "$parent_Button"..i - 1, "RIGHT", 1,0)
  24.     end
  25.    
  26.     local page = GetVehicleBarIndex()
  27.     local action = i + ((page - 1) * NUM_ACTIONBAR_BUTTONS)
  28.     btn:SetAttribute("type", "action")
  29.     btn:SetAttribute("action", action)
  30.     btn:SetAttribute("useparent-actionpage", true);  
  31.  
  32.     btn.NormalTexture:Hide()    
  33.     btn:Show()
  34.    
  35.     barFrame.Buttons[i] = btn
  36. end
  37.  
  38.  
  39. ------------------------------------------------------
  40. --[[                 Secure Stuff                 ]]--
  41. ------------------------------------------------------
  42.  
  43. barFrame:SetAttribute("_onattributechanged",[[ -- self, name, value    
  44.     if name == "updatebar" then
  45.         local page = GetVehicleBarIndex()
  46.         if HasVehicleActionBar() then        
  47.             local buttons = newtable(self:GetChildren())
  48.             for i,v in ipairs(buttons) do
  49.                 local action = i + ((page - 1) * 12)
  50.                 v:SetAttribute("action",action)                
  51.             end
  52.         end
  53.     end
  54. ]])
  55.  
  56. barFrame:SetAttribute('_onstate-actionpage', [[
  57.         self:SetAttribute('actionpage', GetVehicleBarIndex())
  58.     ]])
  59.  
  60. RegisterStateDriver(barFrame, "visibility", "[vehicleui] show; hide")
  61. RegisterStateDriver(barFrame, "page", "[vehicleui] 12; 1")
  62. barFrame:Execute(barFrame:GetAttribute('_onstate-actionpage'))
  63.  
  64. OverrideActionBarLeaveFrameLeaveButton:SetParent( barFrame );
  65. OverrideActionBarLeaveFrameLeaveButton:SetAllPoints( barFrame.Buttons[12] );
  66. RegisterStateDriver( OverrideActionBarLeaveFrameLeaveButton, "visibility", "[vehicleui][@vehicle, exists] show; hide" );       
  67.  
  68.  
  69. ------------------------------------------------------
  70. --[[         Event Control                        ]]--
  71. ------------------------------------------------------
  72. local function onEvent(self,event,...)
  73.     local args = {...}
  74.     if event == "UPDATE_VEHICLE_ACTIONBAR" then
  75.         barFrame:SetAttribute("updatebar")
  76.     end    
  77. end
  78.  
  79. barFrame:SetScript("OnEvent", onEvent)
  80. barFrame:RegisterEvent("UPDATE_VEHICLE_ACTIONBAR")
__________________
  Reply With Quote
08-27-18, 09:32 PM   #11
Vrul
A Frostmaul Preserver
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 292
Can you put this into it's own temp addon and see if it works for that quest:
Code:
local addonName, addon = ...

------------------------------------------------------
--[[                  Bar Setup                   ]]--
------------------------------------------------------
local actionbar = CreateFrame('Frame', addonName .. "ActionBar", UIParent, 'SecureHandlerStateTemplate')
actionbar:SetPoint('CENTER')
actionbar:SetSize(51 * 12, 51)

local background = actionbar:CreateTexture(nil, 'BACKGROUND')
actionbar.background = background
background:SetColorTexture(0, 0, 0, 0.5)
background:SetAllPoints()

actionbar:Execute([[
    ActionButtons = newtable()
]])

------------------------------------------------------
--[[                 Button Setup                 ]]--
------------------------------------------------------
local lastButton
for id = 1, NUM_ACTIONBAR_BUTTONS do    
    local button = CreateFrame('CheckButton', "$parentButton" .. id, actionbar, 'ActionBarButtonTemplate')
    button:SetID(id)
    button:SetSize(50, 50)

    if id ~= 1 then
        button:SetPoint('LEFT', lastButton, 'RIGHT', 1, 0)
    else
        button:SetPoint('LEFT', 5, 0)
    end

    button.NormalTexture:Hide()

    actionbar:SetFrameRef("button", button)
    actionbar:Execute(([[
        ActionButtons[%s] = self:GetFrameRef("button")
    ]]):format(id))

    lastButton = button
end

actionbar:Execute([[
    self:SetAttribute("frameref-button", nil)
]])

------------------------------------------------------
--[[                 Paging Stuff                 ]]--
------------------------------------------------------
actionbar:SetAttribute("_onstate-page", [[
	newstate = tonumber(newstate)
	for id, button in ipairs(ActionButtons) do
		button:SetAttribute('actionpage', newstate)
	end
]])

local paging = {
    ("[vehicleui] %d"):format(GetVehicleBarIndex()),
    ("[overridebar] %s"):format(GetOverrideBarIndex()),
    ("[possessbar] [@vehicle, exists] %s"):format(GetVehicleBarIndex()),
    ("[shapeshift] %d"):format(GetTempShapeshiftBarIndex())
}
for index = 2, NUM_ACTIONBAR_PAGES do
    paging[#paging + 1] = ("[bar:%d] %d"):format(index, index)
end
for index = 1, 5 do
    paging[#paging + 1] = ("[bonusbar:%d] %d"):format(index, index + NUM_ACTIONBAR_PAGES)
end
paging[#paging + 1] = "1"
RegisterStateDriver(actionbar, "page", strjoin("; ", unpack(paging)))

------------------------------------------------------
--[[                 Leave Button                 ]]--
------------------------------------------------------
OverrideActionBarLeaveFrameLeaveButton:SetParent(actionbar)
OverrideActionBarLeaveFrameLeaveButton:SetAllPoints(lastButton)
RegisterStateDriver(OverrideActionBarLeaveFrameLeaveButton, "visibility", "[canexitvehicle] show; hide")
Of course make sure you change it to a better spot/size so you can actually play.
  Reply With Quote
08-27-18, 09:34 PM   #12
Vrul
A Frostmaul Preserver
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 292
Originally Posted by Xrystal View Post
would any of this have an issue in combat ?
Yes, the event handler calling SetAttribute on a secure frame will error in combat.
  Reply With Quote
08-27-18, 10:55 PM   #13
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,256
Originally Posted by Vrul View Post
Yes, the event handler calling SetAttribute on a secure frame will error in combat.
Hoped that might be the only one but trying your other code out to see if it works. Thanks alot

I can honestly say I've learnt more about what the secure stuff does trying to get these silly quest bars working than anything else rofl


Edit:
Nope, The overridebar comes up with the button fine but the new bar shows actionpage 1, switches to a new bar when jumping on the bird but doesn't add the button when it activates. So far that setattribute call to grab the GetActionInfo at the right time is the only way I've managed to get it work. Same as nUI's action bar .. a reload of the UI after the action bar has added the button will show the button and allows it to be used.

Image: http://wow.swangen.co.uk/vehiclebarproblem/image.jpg

One side note that I am not sure if it happens everytime but when I get on the bird, it in essence becomes a pet. I tried the [vehicleui][@pet,exists] test to see if that worked but no joy. Oh wait, its not a pet, just nUI's way of portraying a vehicle .. never mind rofl.

I think what the problem is that once it sets the page on that first call from UPDATE_VEHICLE_ACTIONBAR event it doesn't need refreshing. Because it doesn't need refreshing it never gets to update the action info properly.

before quest start ..

UPDATE_VEHICLE_ACTIONBAR event amongst others
Action Page = 1 (ok)
Action Button 1 HasAction ? yes
Are buttons displayed ? yes

get on mount ..

UPDATE_VEHICLE_ACTIONBAR event amongst others
Action Page = 12 (ok)
Action Button 1 HasAction ? no

autofly to hit trigger point
UPDATE_VEHICLE_ACTIONBAR event amongst others
Action Page = 12 (not different so doesn't trigger)
Action Button 1 HasAction ? yes
Are buttons displayed ? no
__________________

Last edited by Xrystal : 08-28-18 at 01:27 AM.
  Reply With Quote
08-28-18, 05:41 AM   #14
Vrul
A Frostmaul Preserver
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 292
I'm pretty sure its because for the conditions:
Code:
[vehicleui] 12; [overridebar] 14
only causes the OverrideActionBar buttons to be updated where the other conditions:
Code:
[possessbar] [@vehicle, exists] 12; [shapeshift] 13; [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] 10; [bonusbar:5] 11; 1
update the normal action buttons.

After work I'll dig through Blizzard's code to see if there is work around to get one bar to handle both, otherwise I'll clean up your new vehicle bar code and make it work without the event part.
  Reply With Quote
08-28-18, 07:18 AM   #15
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,256
Thanks.

The last time I looked at this type of bar change was back in cataclysm days with the visions of vashjr and I am hoping because it is a similar scenario it will get that working as well.


Hmm. Just realised .. on my code the main action bar disappears as per its visibility conditional supposedly but if I also hide the override bar the main action bar never comes back until a reload. Not a biggie with nUI but annoying otherwise rofl.
__________________

Last edited by Xrystal : 08-28-18 at 09:10 AM.
  Reply With Quote
08-28-18, 07:19 PM   #16
Vrul
A Frostmaul Preserver
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 292
Give this a try:
Code:
local BUTTON_SIZE, BUTTON_SPACING = 50, 1

------------------------------------------------------
--[[              Bar Setup                       ]]--
------------------------------------------------------
local barFrame = CreateFrame("Frame", "XBar_Vehicle", UIParent, "SecureHandlerStateTemplate")
barFrame:SetSize((BUTTON_SIZE + BUTTON_SPACING) * NUM_ACTIONBAR_BUTTONS, BUTTON_SIZE)
barFrame:SetPoint("CENTER")

local background = barFrame:CreateTexture(nil, "BACKGROUND")
background:SetColorTexture(0, 0, 0, 0.5)
background:SetAllPoints()

barFrame:Execute([[
    ActionButtons = newtable()
]])

------------------------------------------------------
--[[                 Button Setup                 ]]--
------------------------------------------------------
local buttons = { }
for id = 1, NUM_ACTIONBAR_BUTTONS do
    local button = CreateFrame("CheckButton", "$parent_Button" .. id, barFrame, "ActionBarButtonTemplate")
    button:SetID(id)

    button:SetSize(BUTTON_SIZE, BUTTON_SIZE)
    if id ~= 1 then
        button:SetPoint("LEFT", buttons[id - 1], "RIGHT", BUTTON_SPACING, 0)
    else
        button:SetPoint("LEFT", 5, 0)
    end

    button.NormalTexture:Hide()

    barFrame:SetFrameRef("button", button)
    barFrame:Execute(([[
        ActionButtons[%s] = self:GetFrameRef("button")
    ]]):format(id))

    buttons[id] = button
end
barFrame.Buttons = buttons

------------------------------------------------------
--[[                 Secure Stuff                 ]]--
------------------------------------------------------
barFrame:Execute([[
    self:SetAttribute("frameref-button", nil)
]])

barFrame:SetAttribute('_onstate-page', ([[
    newstate = tonumber(newstate)
    self:SetAttribute("actionpage", newstate)

    local pageOffset, hasAction = (newstate - 1) * NUM_ACTIONBAR_BUTTONS
    for id = 1, #ActionButtons do
        if HasAction(id + pageOffset) then
            ActionButtons[id]:SetAttribute('actionpage', newstate)
            hasAction = true
        else
            ActionButtons[id]:SetAttribute('actionpage', nil)
        end
    end

    if not hasAction then
        self:SetAttribute("state-page", nil)
    end
]]):gsub('NUM_ACTIONBAR_BUTTONS', NUM_ACTIONBAR_BUTTONS))

RegisterStateDriver(barFrame, "page", ("[vehicleui] %s; [overridebar] %s; 1"):format(GetVehicleBarIndex(), GetOverrideBarIndex()))
RegisterStateDriver(barFrame, "visibility", "[vehicleui] [overridebar] show; hide")

OverrideActionBarLeaveFrameLeaveButton:SetParent(barFrame)
OverrideActionBarLeaveFrameLeaveButton:SetAllPoints(buttons[12])
RegisterStateDriver(OverrideActionBarLeaveFrameLeaveButton, "visibility", "[canexitvehicle] show; hide")
If that works I can modify it so you only need the one bar and not separate main, vehicle, override...
  Reply With Quote
08-28-18, 07:55 PM   #17
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,256
Thanks, giving it a go now ..

And yes if you can do that it will be great cos then I may have a better idea how to implement it into nUI.

Edit:

Did get a couple of errors to do with newstate being nil ( of course it would as its being set to nil ) so added the test to return if newstate is nil after setting the actionpage to newstate.

With the override bar visible it worked apart from the keybinding. With the overridebar hidden the keybinding worked. So I would say a resounding success.

Trying to see what you did different to me rofl. I tried the setting it to null if HasAction was false but it didn't work for me rofl


Thanks a hell of a lot but yes if you can put it in a single bar, I'll test it again. And when I get my rogue up to the vashjr combat equivalent I'll be able to confirm that combat situation works with it too.
__________________

Last edited by Xrystal : 08-28-18 at 08:11 PM.
  Reply With Quote
08-28-18, 08:41 PM   #18
Vrul
A Frostmaul Preserver
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 292
This should let you just use one action bar for everything:
Code:
local BUTTON_SIZE, BUTTON_SPACING = 50, 1

------------------------------------------------------
--[[              Bar Setup                       ]]--
------------------------------------------------------
local actionBar = CreateFrame("Frame", "XActionBar", UIParent, "SecureHandlerStateTemplate")
actionBar:SetSize((BUTTON_SIZE + BUTTON_SPACING) * NUM_ACTIONBAR_BUTTONS, BUTTON_SIZE)
actionBar:SetPoint("CENTER")

local background = actionBar:CreateTexture(nil, "BACKGROUND")
background:SetColorTexture(0, 0, 0, 0.5)
background:SetAllPoints()

actionBar:Execute([[
    buttons = newtable()
]])

------------------------------------------------------
--[[                 Button Setup                 ]]--
------------------------------------------------------
local buttons = { }
for id = 1, NUM_ACTIONBAR_BUTTONS do
    local button = CreateFrame("CheckButton", "$parentButton" .. id, actionBar, "ActionBarButtonTemplate")
    button:SetID(id)

    button:SetSize(BUTTON_SIZE, BUTTON_SIZE)
    if id ~= 1 then
        button:SetPoint("LEFT", buttons[id - 1], "RIGHT", BUTTON_SPACING, 0)
    else
        button:SetPoint("LEFT")
    end

    button.NormalTexture:Hide()

    actionBar:SetFrameRef("button", button)
    actionBar:Execute(([[
        buttons[%s] = self:GetFrameRef("button")
    ]]):format(id))

    buttons[id] = button
end
actionBar.Buttons = buttons

actionBar:Execute([[
    self:SetAttribute("frameref-button", nil)
]])

------------------------------------------------------
--[[                 Paging Stuff                 ]]--
------------------------------------------------------
actionBar:SetAttribute('_onstate-page', ([[
    if not newstate then return end
    newstate = tonumber(newstate)
    self:SetAttribute("actionpage", newstate)

    local pageOffset, hasAction = (newstate - 1) * NUM_ACTIONBAR_BUTTONS
    for id = 1, NUM_ACTIONBAR_BUTTONS do
        if HasAction(id + pageOffset) then
            buttons[id]:SetAttribute('actionpage', newstate)
            hasAction = true
        else
            buttons[id]:SetAttribute('actionpage', nil)
        end
    end

    if not hasAction then
        self:SetAttribute("state-page", nil)
    end
]]):gsub('NUM_ACTIONBAR_BUTTONS', NUM_ACTIONBAR_BUTTONS))

local paging = {
    ("[vehicleui] %d"):format(GetVehicleBarIndex()),
    ("[overridebar] %s"):format(GetOverrideBarIndex()),
    ("[possessbar] [@vehicle, exists] %s"):format(GetVehicleBarIndex()),
    ("[shapeshift] %d"):format(GetTempShapeshiftBarIndex())
}
for index = 2, NUM_ACTIONBAR_PAGES do
    paging[#paging + 1] = ("[bar:%d] %d"):format(index, index)
end
for index = 1, 5 do
    paging[#paging + 1] = ("[bonusbar:%d] %d"):format(index, index + NUM_ACTIONBAR_PAGES)
end
paging[#paging + 1] = "1"
RegisterStateDriver(actionBar, "page", strjoin("; ", unpack(paging)))

------------------------------------------------------
--[[                 Leave Button                 ]]--
------------------------------------------------------
OverrideActionBarLeaveFrameLeaveButton:SetParent(actionBar)
OverrideActionBarLeaveFrameLeaveButton:SetAllPoints(buttons[12])
RegisterStateDriver(OverrideActionBarLeaveFrameLeaveButton, "visibility", "[canexitvehicle] show; hide")
Can you provide a Wowhead link to the quest you have been testing this against (I may want to try some other ideas out later)?
  Reply With Quote
08-28-18, 09:05 PM   #19
Vrul
A Frostmaul Preserver
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 292
Originally Posted by Xrystal View Post
And when I get my rogue up to the vashjr combat equivalent I'll be able to confirm that combat situation works with it too.
I already tried it on the Beta server using a druid on a target dummy. I could switch forms in combat with no issues. If it works for that it will work for any other state transition.
  Reply With Quote
08-28-18, 09:16 PM   #20
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,256
This is the quest. It's gained after you do a bunch of quests in Freehold.
The last part is obviously the one you are interested in .. thankfully you can redo just that part by exiting the vehicle before completing the task, or you have to drop and redo the whole quest steps rofl.
https://www.wowhead.com/quest=49741/...us-retribution

Oh and theres a similar quest further in the chain.
https://www.wowhead.com/quest=50790/hot-pursuit



Test results ..
Action Bar switching works fine .. apart from the pet bar which didn't come back, but that could be resolved with the pet bar setup nUI has or the pet bar file ( if I was doing this as part of my own addon rofl ), or due to its connection to the main action bar which I hid on the second test along with the overridebar.


Thanks again.

Now to get this working with nUI rofl. Hopefully just that secure stuff will be needed to be added but will see.
__________________

Last edited by Xrystal : 08-28-18 at 09:42 PM.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Quest:Righteous Retribution special action bar not switching in nUI

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off