diff --git a/GnomishVendorShrinker.lua b/GnomishVendorShrinker.lua index 071fe57..5dd2419 100644 --- a/GnomishVendorShrinker.lua +++ b/GnomishVendorShrinker.lua @@ -240,6 +240,13 @@ local function Knowable(link) end +local function RecipeNeedsRank(link) + local _, _, _, _, _, class = GetItemInfo(link) + if class ~= RECIPE then return end + return ns.unmet_requirements[link] +end + + local default_grad = {0,1,0,0.75, 0,1,0,0} -- green local grads = setmetatable({ red = {1,0,0,0.75, 1,0,0,0}, @@ -273,6 +280,9 @@ local function ShowMerchantItem(row, i) if ns.knowns[link] then color = quality_colors[0] row.backdrop:Hide() + elseif RecipeNeedsRank(link) then + row.backdrop:SetGradientAlpha("HORIZONTAL", unpack(grads.red)) + row.backdrop:Show() else row.backdrop:SetGradientAlpha("HORIZONTAL", unpack(grads[quality])) row.backdrop:Show() diff --git a/KnownScanner.lua b/KnownScanner.lua index 7d25df1..fc86520 100644 --- a/KnownScanner.lua +++ b/KnownScanner.lua @@ -26,3 +26,27 @@ ns.knowns = setmetatable({}, { end end }) + + +-- "Requires Previous Rank" +local PREV_RANK = TOOLTIP_SUPERCEDING_SPELL_NOT_KNOWN +local function NeedsRank(link) + ns.scantip:SetHyperlink(link) + for i=1,ns.scantip:NumLines() do + print(ns.scantip.L[i], ns.scantip.L[i] == PREV_RANK) + if ns.scantip.L[i] == PREV_RANK then return true end + end +end + + +ns.unmet_requirements = setmetatable({}, { + __index = function(t, i) + local id = ns.ids[i] + if not id then return end + + if NeedsRank(i) then + t[i] = true + return true + end + end +})