WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Problem with reskinning the OrderHall "Troops" icons (https://www.wowinterface.com/forums/showthread.php?t=54789)

Mayron 11-03-16 05:18 PM

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

Miiru 11-04-16 02:16 PM

Hooking OrderHallCommandBarMixin:RefreshCategories seems to work.

Aftermathhqt 11-05-16 04:11 AM

1 Attachment(s)
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)

myrroddin 11-05-16 11:21 AM

You are creating a frame every time the Order Hall UI is opened? Why not reuse the same frame?

Mayron 11-06-16 05:53 AM

Quote:

Originally Posted by Miiru (Post 320664)

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.

Mayron 11-06-16 06:07 AM

Quote:

Originally Posted by Game92 (Post 320671)
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 :)

Mayron 11-07-16 01:23 PM

Quote:

Originally Posted by Miiru (Post 320664)

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.

Seerah 11-07-16 10:03 PM

Try looking at my Broker_ClassHall addon.

Miiru 11-08-16 01:11 AM

Quote:

Originally Posted by Mayron (Post 320711)
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)

ObbleYeah 11-08-16 05:50 AM

i also had issues with satisfactorily skinning these, and eventually redrew the frames:

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


Mayron 11-08-16 08:07 AM

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

ObbleYeah 11-08-16 10:41 AM

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


All times are GMT -6. The time now is 08:22 AM.

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