diff --git a/GnomishVendorShrinker.lua b/GnomishVendorShrinker.lua index 690b20c..ad26c8a 100644 --- a/GnomishVendorShrinker.lua +++ b/GnomishVendorShrinker.lua @@ -1,5 +1,7 @@ local NUMROWS, ICONSIZE, GAP, SCROLLSTEP = 14, 17, 4, 5 +local knowns = GVS_SCANNER +GVS_SCANNER = nil for _,f in pairs{MerchantNextPageButton, MerchantPrevPageButton, MerchantPageText} do @@ -154,6 +156,11 @@ for i=1,NUMROWS do if self.extendedCost then MerchantFrame.extendedCost = self end end) + local backdrop = row:CreateTexture(nil, "BACKGROUND") + backdrop:SetAllPoints() + backdrop:SetTexture("Interface\\Tooltips\\UI-Tooltip-Background") + row.backdrop = backdrop + local icon = CreateFrame('Frame', nil, row) icon:SetHeight(ICONSIZE) icon:SetWidth(ICONSIZE) @@ -191,6 +198,9 @@ for i=1,NUMROWS do end +local _, _, _, _, _, _, _, _, RECIPE = GetAuctionItemClasses() +local quality_colors = {} +for i=1,7 do quality_colors[i] = select(4, GetItemQualityColor(i)) end local offset = 0 local function Refresh() local n = GetMerchantNumItems() @@ -199,9 +209,25 @@ local function Refresh() if j > n then row:Hide() else + row.backdrop:Hide() + local name, itemTexture, itemPrice, itemStackCount, numAvailable, isUsable, extendedCost = GetMerchantItemInfo(j) local link = GetMerchantItemLink(j) - local color = link and select(4, GetItemQualityColor(select(3, GetItemInfo(link)))) or "|cffffffff" + local color = "|cffffffff" + if link then + local name, link2, quality, iLevel, reqLevel, class, subclass, maxStack, equipSlot, texture, vendorPrice = GetItemInfo(link) + color = quality_colors[quality] + + if class == RECIPE and not knowns[link] then + row.backdrop:SetGradientAlpha("HORIZONTAL", 0,0,1,0.75, 0,0,1,0) + row.backdrop:Show() + end + end + + if not isUsable then + row.backdrop:SetGradientAlpha("HORIZONTAL", 1,0,0,0.75, 1,0,0,0) + row.backdrop:Show() + end row.icon:SetTexture(itemTexture) row.ItemName:SetText((numAvailable > -1 and ("["..numAvailable.."] ") or "").. color.. (name or "").. (itemStackCount > 1 and ("|r x"..itemStackCount) or "")) diff --git a/GnomishVendorShrinker.toc b/GnomishVendorShrinker.toc index c7cfc6a..123376b 100644 --- a/GnomishVendorShrinker.toc +++ b/GnomishVendorShrinker.toc @@ -13,4 +13,5 @@ tekKonfig\tekKonfig.xml +KnownScanner.lua GnomishVendorShrinker.lua diff --git a/KnownScanner.lua b/KnownScanner.lua new file mode 100644 index 0000000..2116221 --- /dev/null +++ b/KnownScanner.lua @@ -0,0 +1,24 @@ + +local tip = CreateFrame("GameTooltip") +tip:SetOwner(WorldFrame, "ANCHOR_NONE") + +local lcache = {} +for i=1,30 do + lcache[i] = tip:CreateFontString() + -- lcache[i]:SetFontObject(GameFontNormal) + tip:AddFontStrings(lcache[i], tip:CreateFontString()) +end + +local knowns = setmetatable({}, {__index = function(t, i) + tip:ClearLines() + if not tip:IsOwned(WorldFrame) then tip:SetOwner(WorldFrame, "ANCHOR_NONE") end + tip:SetHyperlink(i) + for i=1,tip:NumLines() do + if lcache[i]:GetText() == ITEM_SPELL_KNOWN then + t[i] = true + return true + end + end +end}) + +GVS_SCANNER = knowns diff --git a/README.textile b/README.textile index 30be783..2502953 100644 --- a/README.textile +++ b/README.textile @@ -7,12 +7,13 @@ h2. Features * Clicking an item simply buys it, instead of picking up the item * Alt-click buys a full stack (or as close to a full stack as is possible for limited-stock items) * Ctrl- and shift-click behave as default (dress-up and paste link, respectively) +* Recipes you do not yet know are highlighted in blue +* Items you cannot use are highlighted in red h2. Un-features * No support for split-stack purchases, I'm not convinced it's needed. * No search... yet -* No way to red-out known recipes... yet. h2. Links