end |
|
--------------------------------------------------------------------- |
-- Fix long reagent count text in tradeskill UI |
-- Fix long reagent count text in garrison & tradeskill UI |
--------------------------------------------------------------------- |
|
local function SetReagentCount(button, quantity, needed) |
button.Count:SetFormattedText("%d/%d", quantity, needed) |
if floor(button.Count:GetStringWidth()) > floor(button.Icon:GetWidth() + 0.5) then |
button.Count:SetFormattedText("%d\n/%d", quantity, needed) |
end |
end |
|
mods["Blizzard_GarrisonUI"] = function() |
hooksecurefunc("GarrisonCapacitiveDisplayFrame_Update", function(self, success, maxShipments, plotID) |
local reagents = self.CapacitiveDisplay.Reagents |
for i = 1, C_Garrison.GetNumShipmentReagents() do |
local name, texture, quality, needed, quantity, itemID = C_Garrison.GetShipmentReagentInfo(i) |
if name then |
SetReagentCount(reagents[i], quantity, needed) |
end |
end |
end) |
end |
|
mods["Blizzard_TradeSkillUI"] = function() |
hooksecurefunc("TradeSkillFrame_SetSelection", function(id) |
for i = 1, GetTradeSkillNumReagents(id) do |
local reagentName, reagentTexture, reagentCount, playerReagentCount = GetTradeSkillReagentInfo(id, i) |
if reagentName and reagentTexture then |
local button = _G["TradeSkillReagent"..i] |
local count = _G["TradeSkillReagent"..i.."Count"] |
count:SetFormattedText("%d/%d", playerReagentCount, reagentCount) |
if floor(count:GetStringWidth()) > floor(button.Icon:GetWidth() + .5) then |
count:SetFormattedText("%d\n/%d", playerReagentCount, reagentCount) |
end |
local name, texture, needed, quantity = GetTradeSkillReagentInfo(id, i) |
if name and tTexture then |
SetReagentCount(_G["TradeSkillReagent"..i], quantity, needed) |
end |
end |
end) |