-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChecks.lua
More file actions
64 lines (56 loc) · 2.53 KB
/
Copy pathChecks.lua
File metadata and controls
64 lines (56 loc) · 2.53 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
local ADDON_NAME, ns = ...
local Checks = {}
ns.Checks = Checks
local deDE = GetLocale() == "deDE"
-- Inventory slots we care about. Order = display order in problem lists.
-- enchant = should normally carry an enchant in TBC.
local SLOTS = {
{ id = 1, key = "head", enchant = true, en = "Head", de = "Kopf" },
{ id = 3, key = "shoulder", enchant = true, en = "Shoulder", de = "Schulter" },
{ id = 15, key = "back", enchant = true, en = "Back", de = "Umhang" },
{ id = 5, key = "chest", enchant = true, en = "Chest", de = "Brust" },
{ id = 9, key = "wrist", enchant = true, en = "Wrist", de = "Handgelenk" },
{ id = 10, key = "hands", enchant = true, en = "Hands", de = "Hände" },
{ id = 7, key = "legs", enchant = true, en = "Legs", de = "Beine" },
{ id = 8, key = "feet", enchant = true, en = "Feet", de = "Füße" },
{ id = 16, key = "mainhand", enchant = true, en = "Weapon", de = "Waffe" },
{ id = 17, key = "offhand", enchant = false, en = "Off-hand", de = "Schildhand" },
{ id = 11, key = "finger1", enchant = "ring", en = "Ring 1", de = "Ring 1" },
{ id = 12, key = "finger2", enchant = "ring", en = "Ring 2", de = "Ring 2" },
}
Checks.SLOTS = SLOTS
local function slotName(slot)
return deDE and slot.de or slot.en
end
-- Analyze a capture record. Returns an array of human-readable problem strings.
function Checks:Analyze(record)
local profile = ns.db and ns.db.profile or {}
local problems = {}
if not record or not record.slots then
return problems
end
for _, slot in ipairs(SLOTS) do
local data = record.slots[slot.id]
if data and data.link then
-- Missing enchant
local wantEnchant = slot.enchant
if wantEnchant == "ring" then
wantEnchant = profile.checkRingEnchants
end
if wantEnchant and (not data.enchantId or data.enchantId == 0) then
problems[#problems + 1] = (deDE and "kein Enchant: %s" or "no enchant: %s"):format(slotName(slot))
end
-- Empty gem sockets
if profile.checkSockets and data.emptySockets and data.emptySockets > 0 then
problems[#problems + 1] = (deDE and "%d leere Sockel: %s" or "%d empty socket(s): %s")
:format(data.emptySockets, slotName(slot))
end
end
end
-- Talents: only flag the clearly-broken case (no points spent at all). The actual
-- spec spread is shown as info, not treated as a "problem".
if profile.checkTalents and record.talents and record.talents.total == 0 then
problems[#problems + 1] = deDE and "keine Talente verteilt" or "no talents spent"
end
return problems
end