Grey out known heirlooms on 6.1

This commit is contained in:
tekkub :bear:  2015-01-26 02:26:17 -07:00
parent 340a2b2667
commit 7a9f2e658b
6 changed files with 49 additions and 6 deletions

View File

@ -246,13 +246,22 @@ local function ShowMerchantItem(row, i)
local link = GetMerchantItemLink(i) local link = GetMerchantItemLink(i)
local color = quality_colors.default local color = quality_colors.default
row.backdrop:Hide() row.backdrop:Hide()
if not isUsable then
row.backdrop:SetGradientAlpha("HORIZONTAL", unpack(grads.red))
row.backdrop:Show()
end
if link then if link then
local name, link2, quality, iLevel, reqLevel, class, subclass, maxStack, equipSlot, texture, vendorPrice = GetItemInfo(link) local name, link2, quality, iLevel, reqLevel, class, subclass, maxStack, equipSlot, texture, vendorPrice = GetItemInfo(link)
local id = ns.ids[link]
local is_heirloom = ns.is_six_one and C_Heirloom.IsItemHeirloom(id)
color = quality_colors[quality] color = quality_colors[quality]
if class == RECIPE or texture:lower():match(GARRISON_ICON) then if is_heirloom or class == RECIPE or texture:lower():match(GARRISON_ICON) then
if ns.knowns[link] then if ns.knowns[link] then
color = quality_colors[0] color = quality_colors[0]
row.backdrop:Hide()
else else
row.backdrop:SetGradientAlpha("HORIZONTAL", unpack(grads[quality])) row.backdrop:SetGradientAlpha("HORIZONTAL", unpack(grads[quality]))
row.backdrop:Show() row.backdrop:Show()
@ -260,11 +269,6 @@ local function ShowMerchantItem(row, i)
end end
end end
if not isUsable then
row.backdrop:SetGradientAlpha("HORIZONTAL", unpack(grads.red))
row.backdrop:Show()
end
row.icon:SetTexture(itemTexture) row.icon:SetTexture(itemTexture)
row.ItemName:SetText((numAvailable > -1 and ("["..numAvailable.."] ") or "").. color.. (name or "<Loading item data>").. (itemStackCount > 1 and ("|r x"..itemStackCount) or "")) row.ItemName:SetText((numAvailable > -1 and ("["..numAvailable.."] ") or "").. color.. (name or "<Loading item data>").. (itemStackCount > 1 and ("|r x"..itemStackCount) or ""))

View File

@ -13,6 +13,9 @@
## X-LoadOn-Merchant: true ## X-LoadOn-Merchant: true
## X-LoadOn-InterfaceOptions: GnomishVendorShrinker ## X-LoadOn-InterfaceOptions: GnomishVendorShrinker
externals\itemid.lua
externals\ptr.lua
tekFunks\gsc.lua tekFunks\gsc.lua
tekKonfig\tekKonfig.xml tekKonfig\tekKonfig.xml
LibItemSearch-1.0.lua LibItemSearch-1.0.lua

View File

@ -11,6 +11,16 @@ for i=1,40 do
end end
ns.knowns = setmetatable({}, {__index = function(t, i) ns.knowns = setmetatable({}, {__index = function(t, i)
if ns.is_six_one then
local id = ns.ids[i]
if not id then return end
if C_Heirloom.IsItemHeirloom(id) and C_Heirloom.PlayerHasHeirloom(id) then
t[i] = true
return true
end
end
tip:ClearLines() tip:ClearLines()
if not tip:IsOwned(WorldFrame) then tip:SetOwner(WorldFrame, "ANCHOR_NONE") end if not tip:IsOwned(WorldFrame) then tip:SetOwner(WorldFrame, "ANCHOR_NONE") end
tip:SetHyperlink(i) tip:SetHyperlink(i)

2
externals.txt Normal file
View File

@ -0,0 +1,2 @@
itemid.lua
ptr.lua

20
externals/itemid.lua vendored Normal file
View File

@ -0,0 +1,20 @@
local myname, ns = ...
-- Creates a memoizing table that converts an itemlink string into an itemID int
ns.ids = setmetatable({}, {
__index = function(t,i)
if type(i) == "number" then
t[i] = i
return i
elseif type(i) ~= "string" then
t[i] = false
return
end
local id = tonumber(i:match("item:(%d+)"))
t[i] = id
return id
end,
})

4
externals/ptr.lua vendored Normal file
View File

@ -0,0 +1,4 @@
local myname, ns = ...
ns.is_six_one = GetBuildInfo() == "6.1.0"