GnomishVendorShrinker/KnownScanner.lua

52 lines
932 B
Lua
Raw Normal View History

2010-05-02 22:20:55 +00:00
local myname, ns = ...
2016-09-07 01:59:24 +00:00
local function HasHeirloom(id)
return C_Heirloom.IsItemHeirloom(id) and C_Heirloom.PlayerHasHeirloom(id)
end
2015-01-26 09:26:17 +00:00
2016-09-07 01:59:24 +00:00
local function IsKnown(link)
ns.scantip:SetHyperlink(link)
for i=1,ns.scantip:NumLines() do
if ns.scantip.L[i] == ITEM_SPELL_KNOWN then return true end
2015-01-26 09:26:17 +00:00
end
2016-09-07 01:59:24 +00:00
end
ns.knowns = setmetatable({}, {
__index = function(t, i)
local id = ns.ids[i]
if not id then return end
2015-01-26 09:26:17 +00:00
2016-09-07 01:59:24 +00:00
if HasHeirloom(id) or IsKnown(i) then
t[i] = true
return true
end
end
2016-09-07 01:59:24 +00:00
})
-- "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
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
})