Red-out lines for recipes that require a rank we don't have yet

This commit is contained in:
tekkub ʕ ´ᴥ` ʔ 2016-09-06 19:59:59 -06:00
parent f39146ffb0
commit ea530ec4da
2 changed files with 34 additions and 0 deletions

View File

@ -240,6 +240,13 @@ local function Knowable(link)
end 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 default_grad = {0,1,0,0.75, 0,1,0,0} -- green
local grads = setmetatable({ local grads = setmetatable({
red = {1,0,0,0.75, 1,0,0,0}, red = {1,0,0,0.75, 1,0,0,0},
@ -273,6 +280,9 @@ local function ShowMerchantItem(row, i)
if ns.knowns[link] then if ns.knowns[link] then
color = quality_colors[0] color = quality_colors[0]
row.backdrop:Hide() row.backdrop:Hide()
elseif RecipeNeedsRank(link) then
row.backdrop:SetGradientAlpha("HORIZONTAL", unpack(grads.red))
row.backdrop:Show()
else else
row.backdrop:SetGradientAlpha("HORIZONTAL", unpack(grads[quality])) row.backdrop:SetGradientAlpha("HORIZONTAL", unpack(grads[quality]))
row.backdrop:Show() row.backdrop:Show()

View File

@ -26,3 +26,27 @@ ns.knowns = setmetatable({}, {
end end
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
})