From 2a0ac573113520aa40b26dd37697eab0bc0d7da2 Mon Sep 17 00:00:00 2001 From: tekkub Date: Sun, 27 Feb 2011 23:37:17 -0700 Subject: [PATCH] Make qty text red for alt-currency that we don't have enough of --- GnomishVendorShrinker.lua | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/GnomishVendorShrinker.lua b/GnomishVendorShrinker.lua index bea9507..1ad0c05 100644 --- a/GnomishVendorShrinker.lua +++ b/GnomishVendorShrinker.lua @@ -89,10 +89,20 @@ local function OnLeave() end +local function GetCurencyCount(item) + for i=1,GetCurrencyListSize() do + local name, _, _, _, _, count = GetCurrencyListInfo(i) + if item == name then return count end + end +end + + local function SetValue(self, text, icon, link) - self.text:SetText(text) + local color = link and GetCurencyCount(link) >= text and "|cffffffff" or "|cffff9999" + self.text:SetText(color..text) self.icon:SetTexture(icon) - self.link, self.index, self.itemIndex = link + self.link, self.index, self.itemIndex = nil + if link and link:match("^item:%d+") then self.link = link end self:Show() end @@ -129,8 +139,8 @@ local function AddAltCurrency(frame, i) if ns.IHASCAT then itemCount, honorPoints, arenaPoints = honorPoints, 0, 0 end for j=itemCount,1,-1 do local f = frame:GetAltCurrencyFrame() - local texture, price = GetMerchantItemCostItem(i, j) - f:SetValue(price, texture) + local texture, price, _, name = GetMerchantItemCostItem(i, j) + f:SetValue(price, texture, name) f.index, f.itemIndex, f.link = i, j lastframe = f.text end