Quantcast Problem with reskinning the OrderHall "Troops" icons - WoWInterface
Thread Tools Display Modes
11-03-16, 05:18 PM   #1
Mayron
A Frostmaul Preserver
 
Mayron's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 260
Problem with reskinning the OrderHall "Troops" icons

I want to change the appearance of the troop icons on the OrderHallCommandBar:



Lua Code:
  1. -- ignore the "CreateEventHandler" function as it basically just handles my events in an easier way
  2. em:CreateEventHandler("GARRISON_UPDATE", function()
  3.         if (type(OrderHallCommandBar.TroopSummary) == "table") then
  4.             for id, troop in ipairs(OrderHallCommandBar.TroopSummary) do
  5.                 -- do stuff            
  6.             end
  7.         end
  8. end);

The only problem is that I have no clue when this "OrderHallCommandBar.TroopSummary" table fills up with data, nor when the troop icons appear on the bar. I've tried "GARRISON_UPDATE" but this doesn't work. It works when you reload the UI when you are already in the Class Hall but not when you log out, login, and then enter the Class Hall. I've tried hooking all functions inside "Blizzard_OrderHallCommandBar.lua" but in that file there is no code that mentions "TroopSummary" and it is inherited from "Blizzard_OrderHallCommandBar.xml":

XML Code:
  1. <Frame name="OrderHallClassSpecCategoryTemplate" parentArray="TroopSummary" virtual="true" mixin="OrderHallClassSpecCategory">

I've also tried running my troops reskinning code after "PLAYER_ENTERING_WORLD" and when the "Blizzard_OrderHallUI" AddOn is loaded but the TroopSummary table is always empty and then it shows. I just don't know what event/function to hook.

Does anyone know anything about this?

Thanks

Last edited by Mayron : 11-03-16 at 05:21 PM.
  Reply With Quote
11-04-16, 02:16 PM   #2
Miiru
A Flamescale Wyrmkin
 
Miiru's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 138
Hooking OrderHallCommandBarMixin:RefreshCategories seems to work.
__________________
◘◘ Author of MiirGui Texture Pack - [Core] [Blue] [Grey] ◘◘
  Reply With Quote
11-05-16, 04:11 AM   #3
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 784
Here is something that i wrote, that works very well!

Lua Code:
  1. local A, C, L = select(2, ...):unpack()
  2.  
  3. local OrderHallFrameEvent = CreateFrame("Frame")
  4. OrderHallFrameEvent:RegisterEvent("ADDON_LOADED")
  5. OrderHallFrameEvent:RegisterEvent("PLAYER_ENTERING_WORLD")
  6.  
  7. local GarrsionFrameEvent = CreateFrame("Frame")
  8. GarrsionFrameEvent:RegisterEvent("ADDON_LOADED")
  9. GarrsionFrameEvent:RegisterEvent("PLAYER_ENTERING_WORLD")
  10. GarrsionFrameEvent:RegisterEvent("GARRISON_UPDATE")
  11.  
  12. local function GarrsionFrameOnEvent(self, event, AddOn)
  13.     if C_Garrison.IsPlayerInGarrison(LE_GARRISON_TYPE_7_0) then
  14.         ATopPanel:Show()
  15.     else
  16.         ATopPanel:Hide()
  17.         return
  18.     end
  19. end
  20.  
  21. local function OrderHallBarOnEvent(self, event, AddOn)
  22.     if AddOn == "Blizzard_OrderHallUI" then
  23.    
  24.        -- Create a Fake Bar so we can reposition the Troops Icon + Text
  25.        
  26.         local OrderHallCommandBarFrame = CreateFrame("Frame", nil, UIParent)
  27.         OrderHallCommandBarFrame:SetSize(588, 24)
  28.         OrderHallCommandBarFrame:SetPoint("TOP", UIParent, 0, -1)
  29.        
  30.          -- Attach the Original Bar to our Fake Bar!
  31.  
  32.         local AOrderHallCommandBar = _G["OrderHallCommandBar"]     
  33.         AOrderHallCommandBar:ClearAllPoints()
  34.         AOrderHallCommandBar:SetParent("UIParent")
  35.         AOrderHallCommandBar:SetAllPoints(OrderHallCommandBarFrame)
  36.         AOrderHallCommandBar:SetPoint("TOP", OrderHallCommandBarFrame)
  37.        
  38.         -- Hide Blizz Texture & World Map Button
  39.        
  40.         AOrderHallCommandBar.Background:Hide()
  41.         AOrderHallCommandBar.WorldMapButton:Hide()
  42.        
  43.         -- Reposition Icons + Texts
  44.  
  45.         AOrderHallCommandBar.ClassIcon:ClearAllPoints()
  46.         AOrderHallCommandBar.ClassIcon:SetPoint("TOPLEFT", UIParent, 0, -1)
  47.  
  48.         AOrderHallCommandBar.Currency:ClearAllPoints()
  49.         AOrderHallCommandBar.Currency:SetPoint("TOPLEFT", UIParent, 618, -6)
  50.        
  51.         AOrderHallCommandBar.CurrencyIcon:ClearAllPoints()
  52.         AOrderHallCommandBar.CurrencyIcon:SetPoint("TOPLEFT", UIParent, 662, 0)
  53.    
  54.         AOrderHallCommandBar.AreaName:SetFont(C.Media.Font2, 14, "THINOUTLINE")    
  55.         AOrderHallCommandBar.AreaName:SetVertexColor(0.41, 0.8, 0.94)
  56.     end
  57. end
  58.  
  59. GarrsionFrameEvent:SetScript("OnEvent", GarrsionFrameOnEvent)
  60. OrderHallFrameEvent:SetScript("OnEvent", OrderHallBarOnEvent)
Attached Thumbnails
Click image for larger version

Name:	Skärmklipp.PNG
Views:	77
Size:	167.7 KB
ID:	8869  

Last edited by Aftermathhqt : 11-05-16 at 04:23 AM.
  Reply With Quote
11-05-16, 11:21 AM   #4
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,109
You are creating a frame every time the Order Hall UI is opened? Why not reuse the same frame?
  Reply With Quote
11-06-16, 05:53 AM   #5
Mayron
A Frostmaul Preserver
 
Mayron's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 260
Originally Posted by Miiru View Post
Weird. I already tried that but it didn't work. I think I was hooking "RefreshAll". I'll try it when I get back home, thank you.
  Reply With Quote
11-06-16, 06:07 AM   #6
Mayron
A Frostmaul Preserver
 
Mayron's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 260
Originally Posted by Game92 View Post
Here is something that i wrote, that works very well!
That's not what I am asking for help with though. I don't have a problem with reskinning anything except the troop icons which your code doesn't attempt to alter. The image looks like the troop icons are the exact same as the default Blizzard bar. Still, the rest of the icon looks good

Last edited by Mayron : 11-06-16 at 06:12 AM.
  Reply With Quote
11-07-16, 01:23 PM   #7
Mayron
A Frostmaul Preserver
 
Mayron's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 260
Originally Posted by Miiru View Post
Sadly this does not work if you login to somewhere external to the Order hall and then enter the Hall. I'm not sure why.
  Reply With Quote
11-07-16, 10:03 PM   #8
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,727
Try looking at my Broker_ClassHall addon.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
11-08-16, 01:11 AM   #9
Miiru
A Flamescale Wyrmkin
 
Miiru's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 138
Originally Posted by Mayron View Post
Sadly this does not work if you login to somewhere external to the Order hall and then enter the Hall. I'm not sure why.
Weird. This is working fine for me.

Lua Code:
  1. local function skin_orderhall()
  2.     print("Triggered")
  3. end
  4.  
  5. hooksecurefunc(OrderHallCommandBar,"RefreshCategories",skin_orderhall)

(after checking for the orderhall ui to be loaded first, of course)
__________________
◘◘ Author of MiirGui Texture Pack - [Core] [Blue] [Grey] ◘◘

Last edited by Miiru : 11-08-16 at 01:14 AM.
  Reply With Quote
11-08-16, 05:50 AM   #10
ObbleYeah
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Sep 2008
Posts: 210
i also had issues with satisfactorily skinning these, and eventually redrew the frames:

https://github.com/obble/iipui/blob/...commandbar.lua


Last edited by ObbleYeah : 11-08-16 at 05:58 AM.
  Reply With Quote
11-08-16, 08:07 AM   #11
Mayron
A Frostmaul Preserver
 
Mayron's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 260
Thank you for the help! The problem was that I was using:

Lua Code:
  1. if (type(OrderHallCommandBar.TroopSummary) == "table") then

instead of:

Lua Code:
  1. local info = C_Garrison.GetClassSpecCategoryInfo(LE_FOLLOWER_TYPE_GARRISON_7_0)

And I think needed to request the info first using:

Lua Code:
  1. C_Garrison.RequestClassSpecCategoryInfo(LE_FOLLOWER_TYPE_GARRISON_7_0)

I wanted to reposition the Blizzard Troop icons but this seems impossible because I have no clue when they get created. Instead, like what everyone else appears to be doing, I need to create my own troop icons and hide the Blizzard ones. I'm still unsure how to hide the Blizzard ones considering I can't seem to target them. Maybe just create an entirely new bar from scratch..

Last edited by Mayron : 11-08-16 at 08:09 AM.
  Reply With Quote
11-08-16, 10:41 AM   #12
ObbleYeah
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Sep 2008
Posts: 210
Calling this line just releases the pool of frames used for followers, so they will hide:
https://github.com/obble/iipui/blob/...andbar.lua#L79

The frames are being created on demand using this new frame pool stuff
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Problem with reskinning the OrderHall "Troops" icons

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