View Single Post
07-05-12, 04:31 AM   #4
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Actually they changed the complete ActionBarController.

BonusBar and VehicleBar are gone. Instead they introduced a bar called OverrideBar.

The problem that I'm having with the default buttons is that the bar does not swap anymore. When entering a vehicle the actionbar1 buttons stay the same and buttons are added to the overridebar. What triggers the swap is the ActionBarController_UpdateAll() function that is triggered on event.

Lua Code:
  1. event == "UPDATE_BONUS_ACTIONBAR"
  2.     event == "UPDATE_VEHICLE_ACTIONBAR"
  3.     event == "UPDATE_OVERRIDE_ACTIONBAR"
  4.     event == "ACTIONBAR_PAGE_CHANGED"

A function that returns the correct pageid is
Lua Code:
  1. local function getBarPage()
  2.     print("getting pages")
  3.     if ( HasBonusActionBar() or HasOverrideActionBar() or HasVehicleActionBar() or HasTempShapeshiftActionBar() ) then
  4.       if (HasVehicleActionBar()) then
  5.         return GetVehicleBarIndex()
  6.       elseif (HasOverrideActionBar()) then
  7.         return GetOverrideBarIndex()
  8.       elseif (HasTempShapeshiftActionBar()) then
  9.         return GetTempShapeshiftBarIndex()
  10.       elseif (HasBonusActionBar() and GetActionBarPage() == 1) then
  11.         return GetBonusBarIndex()
  12.       else
  13.         return GetActionBarPage()
  14.       end
  15.     else
  16.       return GetActionBarPage()
  17.     end
  18.   end

But how to call that function onstate and how to make the statedriver trigger onevent?

My problem is described here:
http://www.wowinterface.com/forums/s...649#post257649

I checked the state driver:
https://github.com/Ketho/wow-ui-sour...river.lua#L184

I have not enough knowledge of the secure state driver but maybe there are some events missing?
Like: UPDATE_VEHICLE_ACTIONBAR or UPDATE_OVERRIDE_ACTIONBAR

To make my bar work I need to change the actionpage attribute on the buttons. Of course securly and for all the given events. I have no clue how to do it.

I'm not sure but I think I finally understood the state driver. There very few stateids like "visibility" that have pre-defined functions. That one show/hides a frame based on the macro condition. All other stateids define the function called via self:SetAttribute('_onstate-STATEID', ([[FUNCTION]]))

But if there is no event that updates the attribute (because the event not being registered to the state driver manager) it will not work.

Lua Code:
  1. self:SetAttribute('_onstate-page', ([[
  2.   if not newstate then return end
  3.   newstate = tonumber(newstate)
  4.   for id = 1, %s do
  5.     buttons[id]:SetAttribute("actionpage", newstate)
  6.   end
  7. ]]):format(NUM_ACTIONBAR_BUTTONS))
  8. RegisterStateDriver(self, "page", getBarPage())
  9. RegisterStateDriver(self, "visibility", "[vehicleui][target=vehicle,exists] show;hide")

I know that the 3rd argument is the result of any kind of macro condition. The getBarPage() function will deliver the pageid that could be used to update the actionpage of all the buttons provided.

I might be wrong here but I think that UPDATE_VEHICLE_ACTIONBAR and UPDATE_OVERRIDE_ACTIONBAR are missing as registered events on the SecureStateDriverManager. That's why there is no update fired once entering a vehicle. (Because that is triggered by new events which have not been added yet to the statedrivermanager)

In WoW 4.3 the VehicleBar was loaded to the BonusActionBar aswell. That was removed and that change is not reflected by the state driver.

Not sure but are we allowed to add events to the statedriver manager manually? That way doing this could be the solution:
Lua Code:
  1. SecureStateDriverManager:RegisterEvent("UPDATE_VEHICLE_ACTIONBAR");
  2. SecureStateDriverManager:RegisterEvent("UPDATE_OVERRIDE_ACTIONBAR");
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 07-05-12 at 08:42 AM.