-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathKnownScanner.lua
51 lines (38 loc) · 932 Bytes
/
KnownScanner.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
local myname, ns = ...
local function HasHeirloom(id)
return C_Heirloom.IsItemHeirloom(id) and C_Heirloom.PlayerHasHeirloom(id)
end
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
end
end
ns.knowns = setmetatable({}, {
__index = function(t, i)
local id = ns.ids[i]
if not id then return end
if HasHeirloom(id) or IsKnown(i) then
t[i] = true
return true
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
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
})