Thread Tools Display Modes
08-08-14, 03:08 PM   #1
ObbleYeah
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Sep 2008
Posts: 210
garrison buttons

to preface; I'm aware that the garrison UI is buggy and seemingly unfinished currently (w/ duplicate follower abilities and traits etc).

...

Ugh, trying to make sense of blizzard's convoluted frame-naming strategies in the garrison UI.

I'm attempting to access icons buried in the mission frames and have got most of them - except for the rewards shown on the available/in progress lists. You can see 'em here:



Actually, as you can probably see, I am managing to reach and access some of the icons - but without any kind of consistency. They'll only apply if I have 'available' missions, and only on the first icon of a row.

this is the code i'm using, co-opting blizzard's use of strange and convoluted multi-part locals

Lua Code:
  1. --
  2. local SkinGarriButtons = CreateFrame("Frame", nil, UIParent)
  3.     -- lol, haven't tested which events are called when
  4.     -- to-do: make sure we're only using the right ones
  5.     SkinGarriButtons:RegisterEvent("ADDON_LOADED")
  6.     SkinGarriButtons:RegisterEvent("PLAYER_ENTERING_WORLD")
  7.     SkinGarriButtons:RegisterEvent("GARRISON_MISSION_LIST_UPDATE")
  8.     SkinGarriButtons:RegisterEvent("GARRISON_FOLLOWER_LIST_UPDATE")
  9.     SkinGarriButtons:RegisterEvent("GARRISON_FOLLOWER_REMOVED")
  10.     SkinGarriButtons:RegisterEvent("CURRENCY_DISPLAY_UPDATE")
  11.     SkinGarriButtons:RegisterEvent("GARRISON_FOLLOWER_XP_CHANGED")
  12.     SkinGarriButtons:RegisterEvent("GARRISON_MISSION_STARTED")
  13.     SkinGarriButtons:RegisterEvent("GARRISON_MISSION_FINISHED")
  14.  
  15.     SkinGarriButtons:SetScript("OnEvent", function(self, event, AddOn)
  16.             if (AddOn=="Blizzard_GarrisonUI") then
  17.                 -- mission list reward icons
  18.                 -- NOT WORKING CORRECTLY
  19.                 local ml = GarrisonMissionFrame.MissionTab.MissionList
  20.                 local scrollFrame = ml.listScroll
  21.                 local buttons = scrollFrame.buttons
  22.                 local numButtons = #buttons
  23.            
  24.                 local missions = ml.showInProgress and ml.inProgressMissions or ml.availableMissions
  25.                 local numMissions = #missions
  26.                 local offset = HybridScrollFrame_GetOffset(scrollFrame)
  27.            
  28.                 for i = 1, numButtons do
  29.                     local button = buttons[i]
  30.                     local index = offset + i -- adjust index
  31.                
  32.                     if (index<=numMissions) then
  33.                         local mission = missions[index]
  34.                         local tt = 1
  35.                         for k, maxrewards in pairs(mission.rewards) do
  36.                             local Reward = button.Rewards[tt]
  37.                             --
  38.                     -- style
  39.                             --
  40.                         end
  41.                         tt = tt + 1
  42.                     end
  43.                 end
  44.             end
  45.         end

and the relevant functions buried in Garrison MissionUI:
https://github.com/tekkub/wow-ui-sou...onUI.lua#L1231
https://github.com/tekkub/wow-ui-sou...onUI.lua#L1310

accessing other buttons has been a relative breeze, using simple calls like
Lua Code:
  1. --
  2. local completereward = GarrisonMissionFrame.MissionComplete
  3. for i = 1, #completereward.BonusRewards.Rewards do
  4.     completereward.BonusRewards.Rewards[i]:DoStuff(stuff)
  5. end
but I haven't found a simple + working method for these damn available/in-progress buttons.
 
08-08-14, 03:31 PM   #2
ObbleYeah
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Sep 2008
Posts: 210
dammit I think I just figured it out. This bugs me for a week then I post in here and fix it in 5 minutes. Always the same

Lua Code:
  1. --
  2.      -- mission list reward icons
  3.      -- ...maybe WORKING CORRECTLY?
  4.      local ml = GarrisonMissionFrame.MissionTab.MissionList
  5.      local buttons = ml.listScroll.buttons    
  6.      local missions = ml.showInProgress and ml.inProgressMissions or ml.availableMissions
  7.      local numMissions = #missions
  8.            
  9.     for i = 1, numMissions do
  10.         local button = buttons[i]
  11.    
  12.         for k = 1, #button.Rewards do
  13.             button.Rewards[k]:DoStuff(stuff)
  14.         end
  15.     end
 
 

WoWInterface » Site Forums » Archived Beta Forums » WoD Beta archived threads » garrison buttons

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