WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Help/Support (https://www.wowinterface.com/forums/forumdisplay.php?f=3)
-   -   Quest:Righteous Retribution special action bar not switching in nUI (https://www.wowinterface.com/forums/showthread.php?t=56592)

Xrystal 08-23-18 05:33 PM

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.

Vrul 08-23-18 06:26 PM

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.

Xrystal 08-23-18 06:30 PM

Quote:

Originally Posted by Vrul (Post 329795)
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.

Vrul 08-23-18 06:48 PM

Quote:

Originally Posted by Xrystal (Post 329796)
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


Xrystal 08-23-18 07:09 PM

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.

Vrul 08-23-18 08:53 PM

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


Xrystal 08-24-18 01:05 AM

Yep, thats what I was going to do :)

Will test later on today when I'm in wow mode.

Xrystal 08-24-18 08:25 AM

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.

Xrystal 08-24-18 06:22 PM

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,

Xrystal 08-26-18 08:41 PM

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")

Vrul 08-27-18 09:32 PM

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.

Vrul 08-27-18 09:34 PM

Quote:

Originally Posted by Xrystal (Post 329865)
would any of this have an issue in combat ?

Yes, the event handler calling SetAttribute on a secure frame will error in combat.

Xrystal 08-27-18 10:55 PM

Quote:

Originally Posted by Vrul (Post 329880)
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

Vrul 08-28-18 05:41 AM

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.

Xrystal 08-28-18 07:18 AM

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.

Vrul 08-28-18 07:19 PM

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...

Xrystal 08-28-18 07:55 PM

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.

Vrul 08-28-18 08:41 PM

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)?

Vrul 08-28-18 09:05 PM

Quote:

Originally Posted by Xrystal (Post 329906)
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.

Xrystal 08-28-18 09:16 PM

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.

Xrystal 08-28-18 09:19 PM

Quote:

Originally Posted by Vrul (Post 329909)
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.

Great good to know about the combat. It's more how the quest chain works, I'm hoping that either my other special bar swaps fixed it or this one does.

And for confirmation... just adding that _onstate-page snippet with nUI's actionbuttons variable made it all work and the pet bar came back as I suspected it would ... *happy dance*

And hey, I learnt more about the secure stuff. Thanks alot again.

Terenna 03-15-19 11:45 PM

I hate to pseudonecro this thread, but I found a solution to this if you still cared.

I did some intense digging, and came up with:
Lua Code:
  1. hooksecurefunc('ActionBarController_UpdateAll', function()  
  2.     for i = 1, 12 do
  3.         local button = _G['ActionButton'..i]
  4.         local overrideButton = _G['OverrideActionBarButton'..i]
  5.         local _, spellID
  6.         if overrideButton then
  7.             _, spellID = GetActionInfo(overrideButton.action)
  8.         end
  9.  
  10.         if ((HasOverrideActionBar() or HasVehicleActionBar()) and (spellID and spellID > 0)) or (not HasOverrideActionBar() and not HasVehicleActionBar()) then
  11.             button:SetAttribute('statehidden', false)
  12.             button:Show()
  13.         else
  14.             button:SetAttribute('statehidden', true)
  15.             button:Hide()
  16.         end
  17.     end
  18. end)

the key thing is the SetAttribute('statehidden') for the buttons. The page changes early on in this quest (as soon as you mount the gryphon) but then the attributes are changed after the page change. I found the function above to hook and it works

HOWEVER, by using SetAttribute outside of a secure environment, this does cause tainting.


I've conversely come up with:
Lua Code:
  1. frame:SetAttribute('_onattributechanged', [[
  2.         for i = 1, 12 do
  3.             local button = _G['ActionButton'..i]
  4.             local overrideButton = _G['OverrideActionBarButton'..i]
  5.             local _, spellID
  6.             if overrideButton then
  7.                 _, spellID = GetActionInfo(overrideButton.action)
  8.             end
  9.  
  10.             if ((HasOverrideActionBar() or HasVehicleActionBar()) and (spellID and spellID > 0)) or (not HasOverrideActionBar() and not HasVehicleActionBar()) then
  11.                 button:SetAttribute('statehidden', false)
  12.                 button:Show()
  13.             else
  14.                 button:SetAttribute('statehidden', true)
  15.                 button:Hide()
  16.             end
  17.         end
  18.     ]])

but IDK if it works and it takes like 2-3 hours of questing to get to that particular quest to test it. If anyone can test that, let me know, if not, I'll post back when I have the time to get another character to that quest.

Terenna 03-16-19 10:39 AM

Did some more testing and came up with this:

Lua Code:
  1. local AttributeChangedFrame = CreateFrame('frame', nil, UIParent, 'SecureHandlerAttributeTemplate')
  2. for i = 1, 12 do
  3.     local button = _G['ActionButton'..i]
  4.     AttributeChangedFrame:SetFrameRef('ActionButton'..i, button)
  5. end
  6.  
  7. for i = 1, 6 do
  8.     local overrideButton = _G['OverrideActionBarButton'..i]
  9.     AttributeChangedFrame:SetFrameRef('OverrideActionBarButton'..i, overrideButton)
  10. end
  11. AttributeChangedFrame:Execute([[
  12.     buttons = table.new()
  13.     for i = 1, 12 do
  14.         table.insert(buttons, self:GetFrameRef('ActionButton'..i))
  15.     end
  16.     overridebuttons = table.new()
  17.     for i = 1, 6 do
  18.         table.insert(overridebuttons, self:GetFrameRef('OverrideActionBarButton'..i))
  19.     end
  20. ]])
  21.  
  22. for i = 1, 6 do
  23.     local overrideButton = _G['OverrideActionBarButton'..i]
  24.     overrideButton:HookScript('OnAttributeChanged', function()
  25.         AttributeChangedFrame:Execute[[
  26.             for i = 1, 6 do
  27.                 if not overridebuttons[i]:GetAttribute('statehidden') then
  28.                     buttons[i]:SetAttribute('statehidden', false)
  29.                     buttons[i]:Show()
  30.                 else
  31.                     buttons[i]:SetAttribute('statehidden', true)
  32.                     buttons[i]:Hide()
  33.                 end
  34.             end
  35.         ]]
  36.     end)
  37.    
  38.     local button = _G['ActionButton'..i]
  39.     button:HookScript('OnAttributeChanged', function()
  40.         AttributeChangedFrame:Execute[[
  41.             for i = 1, 12 do
  42.                 if (not HasOverrideActionBar() and not HasVehicleActionBar() and buttons[i]:GetAttribute('statehidden')) then
  43.                     buttons[i]:SetAttribute('statehidden', false)
  44.                     buttons[i]:Show()
  45.                 end
  46.             end
  47.         ]]
  48.     end)
  49. end

This works beautifully and causes 0 taint. HOWEVER, I'm nearly positive this could be way more optimized.

Xrystal 04-10-19 08:39 PM

I'm pretty sure I got this working in the end for nUI and a custom bar addon.

I just didn't progress my character until I had it working exactly how I expected it to work :) .. And then tested the next one in the quest chain that did this before moving on.

As far as I am aware it is working fine.

Xrystal 05-01-20 09:30 PM

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 ).

Xrystal 07-22-20 11:02 AM

The Big Boom is another quest that has this type of action bar update process.


This will hopefully finalise the changes I ended up making to the action bar in relation to the override bar buttons appearing when they are scheduled rather than immediately.

The following are the changes I ended up making but I just had to add 'elseif value == GetOverrideBarIndex() then' line instead of just else .. as without it .. all other actionbar states were ignoring changes such as dragging new abilities onto the bar etc. And macro based buttons were flashing as well as abilities that weren't valid. These are nUI changes so they are based Terenna's findings adjusted to work with nUI as nUI creates its own action bars.



Lua Code:
  1. nUI_ActionBar = nUI_ButtonBars.Bars["nUI_ActionBar"];
  2.  
  3.  
  4.         nUI_ActionBar:SetAttribute( "actionpage", 1 );
  5.        
  6.         nUI_ActionBar:Execute(
  7.             [[
  8.                 ChildList     = newtable( self:GetChildren() );
  9.                 ActionButtons = newtable();
  10.                 actionType    = self:GetAttribute( "nUI_ActionType" );
  11.                
  12.                 local j = 1;
  13.                
  14.                 for i, button in ipairs( ChildList ) do
  15.                     if not button:GetAttribute( "nUI_ActionButtonOverlay" ) then
  16.                         ActionButtons[j] = button;
  17.                         j = j+1;
  18.                     end
  19.                 end
  20.             ]]
  21.         );
  22.        
  23.         -- Handle bars where the state page changes
  24.         nUI_ActionBar:SetAttribute(
  25.             "_onstate-page",
  26.             [[
  27.                 if not newstate then return end
  28.                 newstate = tonumber(newstate)
  29.                 self:SetAttribute("actionpage", newstate)                          
  30.             ]]
  31.         )
  32.        
  33.  
  34.         nUI_ActionBar:SetAttribute(
  35.             "_onshow",
  36.             [[                        
  37.                 for i, button in ipairs( ActionButtons ) do
  38.                     if not button:GetAttribute( "nUI_ActionButtonOverlay" ) then
  39.                         button:SetAttribute( "touch", nil )
  40.                     end            
  41.                 end        
  42.             ]]
  43.         );        
  44.  
  45.        
  46.         -- Handle buttons that appear over time
  47.         nUI_ActionBar:SetAttribute(
  48.             "_onattributechanged", (
  49.                 [[                    
  50.                     if name == "state-page" then
  51.                         if value ~= nil then
  52.                             local pageOffset, hasAction = (value - 1) * NUM_ACTIONBAR_BUTTONS
  53.                             for id = 1,NUM_ACTIONBAR_BUTTONS do
  54.                                 if HasAction(id + pageOffset) then
  55.                                     ActionButtons[id]:SetAttribute('actionpage', value)
  56.                                     ActionButtons[id]:SetAttribute('statehidden',false)
  57.                                     hasAction = true
  58.                                     self:SetAttribute("showbutton",id)
  59.                                 --- If this is the override bar, do this extra check for those times when the
  60.                                 --- actionbuttons appear one at a time based on a timed sequence
  61.                                 elseif value == 12 then  
  62.                                     ActionButtons[id]:SetAttribute('actionpage', nil)
  63.                                     ActionButtons[id]:SetAttribute('statehidden',true)
  64.                                     self:SetAttribute("hidebutton",id)
  65.                                     self:SetAttribute("state-page", nil)
  66.                                 end
  67.                             end
  68.                             if not hasAction then
  69.                                 self:SetAttribute("state-page", nil)
  70.                             end                
  71.                         else
  72.                     end
  73.                     elseif name == "showbutton" then
  74.                         ActionButtons[value]:Show()
  75.                     elseif name == "hidebutton" then
  76.                         ActionButtons[value]:Hide()
  77.                     end
  78.                 ]]
  79.             ):gsub('NUM_ACTIONBAR_BUTTONS', NUM_ACTIONBAR_BUTTONS)
  80.         )
  81.        
  82.         if nUI_ActionBar.registered then
  83.             UnregisterStateDriver( nUI_ActionBar, "page" );
  84.         end
  85.        
  86.         if nUI_Options.boomkinBar then
  87.             RegisterStateDriver(
  88.                 nUI_ActionBar, "page", string.format(
  89.                     "[overridebar] %d; [shapeshift] %d;[vehicleui][possessbar] %d; [vehicleui] %d; "  ..
  90.                     "[bar:2] 2; [bar:3] 3; [bar:4] 4; [bar:5] 5; [bar:6] 6; " ..
  91.                     "[bonusbar:1] 7; [bonusbar:2] 8; [bonusbar:3] 9;   [bonusbar:4] 10; [bonusbar:5] 11; 1",
  92.                     GetOverrideBarIndex(), GetTempShapeshiftBarIndex(), GetVehicleBarIndex(),GetVehicleBarIndex()
  93.                 )
  94.             );
  95.         else
  96.             RegisterStateDriver(
  97.                 nUI_ActionBar, "page", string.format(
  98.                     "[overridebar] %d; [shapeshift] %d;[vehicleui][possessbar] %d; [vehicleui] %d; "  ..
  99.                     "[bar:2] 2; [bar:3] 3; [bar:4] 4; [bar:5] 5; [bar:6] 6; " ..
  100.                     "[bonusbar:1] 7; [bonusbar:2] 8; [bonusbar:3] 9; [bonusbar:4] 1; [bonusbar:5] 11; 1",
  101.                     GetOverrideBarIndex(), GetTempShapeshiftBarIndex(), GetVehicleBarIndex(),GetVehicleBarIndex()
  102.                 )
  103.             );
  104.         end
  105.  
  106.         -- OverrideActionBarLeaveFrameLeaveButton has to be attached to Button12
  107.         OverrideActionBarLeaveFrameLeaveButton:SetParent( nUI_ActionBar );
  108.         OverrideActionBarLeaveFrameLeaveButton:SetAllPoints( nUI_ActionBar_Button12 );
  109.         RegisterStateDriver( OverrideActionBarLeaveFrameLeaveButton, "visibility", "[vehicleui][target=vehicle, exists] show; hide" );     
  110.         nUI_Movers:lockFrame( OverrideActionBarLeaveFrameLeaveButton, true, nil );
  111.         nUI_ActionBar.registered = true;

Xrystal 07-28-20 10:32 PM

But alas .. my last post was not to be the last .. it appears that these changes affect how stance bars work ( in nUI at least ). So I may have to switch the override bar into a separate bar rather than a switching bar and apply the code to that which should solve the problems all round.

Xrystal 07-29-20 07:39 AM

Wow .. all I had to do was monitor for a couple of events and then do a secure execute snippet to update the buttons again .. I suppose it is all a learning curve

The first time round it doesn't need to do it as the initial state-page change has the same code. Any additional calls to update the bars just asks for the page as last set and updates all the buttons again.

Works flawlessly with Big Boom quest and doesn't affect stance bar changes rofl.

Lua Code:
  1. elseif event == "UPDATE_VEHICLE_ACTIONBAR" or event == "UPDATE_OVERRIDE_ACTIONBAR" then
  2.         nUI_ActionBar:Execute(([[
  3.             local page = self:GetAttribute('state-page')
  4.             if not page then return end
  5.             local pageOffset, hasAction = (page - 1) * NUM_ACTIONBAR_BUTTONS
  6.             for id = 1, #ActionButtons do
  7.                 if HasAction(id + pageOffset) then
  8.                     ActionButtons[id]:SetAttribute('actionpage', page)
  9.                     hasAction = true
  10.                 else
  11.                     ActionButtons[id]:SetAttribute('actionpage', nil)
  12.                 end
  13.             end
  14.  
  15.             if not hasAction then
  16.                 self:SetAttribute('state-page', nil)
  17.             end            
  18.         ]]):gsub('NUM_ACTIONBAR_BUTTONS', NUM_ACTIONBAR_BUTTONS))        
  19.     end

Xrystal 10-22-20 07:45 AM

And after some more tests with the different action bar change requirements and found this allowed things to work in all scenarios so far found:

Lua Code:
  1. nUI_ActionBar:SetAttribute(
  2.             "_onstate-page",
  3.             [[
  4.            
  5.                 if not newstate then return end
  6.                 newstate = tonumber(newstate)
  7.            
  8.                 if HasVehicleActionBar() then
  9.                     newPage = GetVehicleBarIndex() or 0
  10.                 elseif HasOverrideActionBar() then
  11.                     newPage = GetOverrideBarIndex() or 0
  12.                 elseif HasTempShapeshiftActionBar() then
  13.                     newPage = GetTempShapeshiftBarIndex() or 0
  14.                 elseif HasBonusActionBar() and GetActionBarPage() == 1 then
  15.                     newPage = GetBonusBarIndex() or 0        
  16.                 else
  17.                     newPage = 0
  18.                 end
  19.            
  20.                 if ( newPage == 0 ) then
  21.                     newstate = GetActionBarPage()
  22.                 end
  23.            
  24.         self:SetAttribute( "actionpage", tonumber( newstate ) );
  25.                
  26.            
  27.                 -- Update the buttons
  28.                 for id = 1, #ActionButtons do
  29.                     local button = ActionButtons[id]
  30.             if not button:GetAttribute( "nUI_ActionButtonOverlay" ) then
  31.             button:SetAttribute( "touch", nil )
  32.                         button:SetAttribute('actionpage', newstate)
  33.                     end
  34.                 end
  35.  
  36.         ]]
  37.     );

In addition to these event watching additions

Lua Code:
  1. elseif event == "UPDATE_VEHICLE_ACTIONBAR" then
  2.         nUI_ActionBar:Execute(([[   self:SetAttribute('state-page',GetVehicleBarIndex())  ]]))
  3.     elseif event == "UPDATE_OVERRIDE_ACTIONBAR" then
  4.         nUI_ActionBar:Execute(([[   self:SetAttribute('state-page',GetOverrideBarIndex())  ]]))


And for a non nUI setup for those wanting to see the basics in full
Lua Code:
  1. local addon,data = ...
  2. data = data or {}
  3. data.BlizzUI = data.BlizzUI or CreateFrame("Frame")
  4. --MainMenuBarArtFrame:SetParent(data.BlizzUI)
  5. data.BlizzUI:Hide()
  6.  
  7.  
  8. local BUTTON_SIZE, BUTTON_SPACING = 50, 1
  9.  
  10. ------------------------------------------------------
  11. --[[              Bar Setup                       ]]--
  12. ------------------------------------------------------
  13. local barFrame = CreateFrame("Frame", "XBar_Main", UIParent, "SecureHandlerStateTemplate")
  14. barFrame:SetSize((BUTTON_SIZE + BUTTON_SPACING) * NUM_ACTIONBAR_BUTTONS, BUTTON_SIZE)
  15. barFrame:SetPoint("CENTER")
  16.  
  17. local background = barFrame:CreateTexture(nil, "BACKGROUND")
  18. background:SetColorTexture(0, 0, 0, 0.5)
  19. background:SetAllPoints()
  20.  
  21. barFrame:Execute([[
  22.     ActionButtons = newtable()
  23. ]])
  24.  
  25. ------------------------------------------------------
  26. --[[                 Button Setup                 ]]--
  27. ------------------------------------------------------
  28. local buttons = { }
  29. for id = 1, NUM_ACTIONBAR_BUTTONS do
  30.     local button = CreateFrame("CheckButton", "$parent_Button" .. id, barFrame, "ActionBarButtonTemplate")
  31.     button:SetID(id)
  32.     button:SetSize(BUTTON_SIZE, BUTTON_SIZE)
  33.    
  34.     if id ~= 1 then
  35.         button:SetPoint("LEFT", buttons[id - 1], "RIGHT", BUTTON_SPACING, 0)
  36.     else
  37.         button:SetPoint("LEFT", 5, 0)
  38.     end
  39.  
  40.     local background = button:CreateTexture(nil, "BACKGROUND")
  41.     background:SetColorTexture(1, 1, 1, 0.5)
  42.     background:SetAllPoints()
  43.  
  44.     button.NormalTexture:Hide()
  45.  
  46.     barFrame:SetFrameRef("button", button)
  47.     barFrame:Execute(([[
  48.         ActionButtons[%s] = self:GetFrameRef("button")
  49.     ]]):format(id))
  50.  
  51.     buttons[id] = button
  52. end
  53. barFrame.Buttons = buttons
  54.  
  55. ------------------------------------------------------
  56. --[[                 Secure Stuff                 ]]--
  57. ------------------------------------------------------
  58. barFrame:Execute([[
  59.     self:SetAttribute("frameref-button", nil)
  60. ]])
  61.  
  62. barFrame:SetAttribute('_onstate-page', ([[
  63.     if not newstate then return end
  64.     newstate = tonumber(newstate)
  65.        
  66.     if HasVehicleActionBar() then
  67.         newPage = GetVehicleBarIndex() or 0
  68.     elseif HasOverrideActionBar() then
  69.         newPage = GetOverrideBarIndex() or 0
  70.     elseif HasTempShapeshiftActionBar() then
  71.         newPage = GetTempShapeshiftBarIndex() or 0
  72.     elseif HasBonusActionBar() and GetActionBarPage() == 1 then
  73.         newPage = GetBonusBarIndex() or 0    
  74.     else
  75.         newPage = 0
  76.     end
  77.            
  78.     if ( newPage == 0 ) then
  79.         newstate = GetActionBarPage()
  80.     end
  81.        
  82.     self:SetAttribute("actionpage", newstate)
  83.  
  84.     for id = 1, #ActionButtons do
  85.         ActionButtons[id]:SetAttribute('actionpage', newstate)
  86.     end
  87.  
  88. ]]):gsub('NUM_ACTIONBAR_BUTTONS', NUM_ACTIONBAR_BUTTONS))
  89.  
  90.  
  91.  
  92. ------------------------------------------------------
  93. --[[           Registration Stuff                 ]]--
  94. ------------------------------------------------------
  95. RegisterStateDriver(
  96.     barFrame, "page", string.format(
  97.         "[vehicleui][possessbar] %d; [vehicleui] %d; [overridebar] %d; [shapeshift] %d; " ..
  98.         "[bar:2] 2; [bar:3] 3; [bar:4] 4; [bar:5] 5; [bar:6] 6; " ..
  99.         "[bonusbar:1] 7; [bonusbar:2] 8; [bonusbar:3] 9; [bonusbar:4] 10; [bonusbar:5] 11; 1",
  100.         GetVehicleBarIndex(), GetVehicleBarIndex(), GetOverrideBarIndex(), GetTempShapeshiftBarIndex())
  101. );
  102.  
  103. OverrideActionBarLeaveFrameLeaveButton:SetParent(barFrame)
  104. OverrideActionBarLeaveFrameLeaveButton:SetAllPoints(buttons[12])
  105. RegisterStateDriver(OverrideActionBarLeaveFrameLeaveButton, "visibility", "[canexitvehicle] show; hide")
  106.  
  107. local function OnEvent(self,event,...)
  108.     if event == "UPDATE_VEHICLE_ACTIONBAR" then
  109.         barFrame:Execute(([[   self:SetAttribute('state-page',GetVehicleBarIndex())  ]]))
  110.     elseif event == "UPDATE_OVERRIDE_ACTIONBAR" then
  111.         barFrame:Execute(([[   self:SetAttribute('state-page',GetOverrideBarIndex())  ]]))        
  112.     end
  113. end
  114.  
  115. barFrame:RegisterEvent("UPDATE_VEHICLE_ACTIONBAR")
  116. barFrame:RegisterEvent("UPDATE_OVERRIDE_ACTIONBAR")
  117. barFrame:SetScript("OnEvent",OnEvent)


All times are GMT -6. The time now is 08:25 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI