Repository navigation
Expand file tree
/
Copy pathConfig.lua
More file actions
157 lines (144 loc) · 5.11 KB
/
Copy pathConfig.lua
File metadata and controls
157 lines (144 loc) · 5.11 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
local _, ns = ...
ns.defaults = {
settings = {
enableToasts = true,
toastSound = true,
gatherTooltips = true,
showMinimap = true,
craftOnClick = true,
shiftCraftMax = true,
notifyGreen = false, -- also toast green (low) skill-up recipes
hiddenRecipes = {}, -- [recipeSpellId] = true — right-click toast to hide
-- When learned cache is empty / incomplete, list catalog recipes with orange <= skill.
skillGatedFallback = true,
-- Alt browser list filters (independent toggles).
showLearnedRecipes = true,
showUnlearnedRecipes = true,
-- Unlearned list skill sort: "asc" / "desc" by orange, or "off" (difficulty order).
-- Must not use Lua nil for off — that deletes the key and MergeDefaults restores the default.
unlearnedSortBySkill = "asc",
notifyProfessions = {
Alchemy = true,
Blacksmithing = true,
Enchanting = true,
Engineering = true,
Inscription = true,
Jewelcrafting = true,
Leatherworking = true,
Tailoring = true,
Mining = true,
Cooking = true,
["First Aid"] = true,
Herbalism = true,
Skinning = true,
Fishing = true,
},
toastPoint = { "TOP", "UIParent", "TOP", 0, -80 },
toastCollapsed = false, -- minimize toast stack (like quest objectives)
toastFilterProfession = nil, -- nil = All; otherwise profession key
toastPage = 1,
toastPageSize = 4, -- crafts visible per page
maxToastCandidates = 60, -- soft cap before Notify filters/paginates
toastScale = 1.0, -- toast stack scale (0.7–1.5)
charTabSize = 28, -- alt sidebar class-icon size in px (20–40)
recipePage = 1, -- alt browser recipe list page
recipePageSize = 12, -- recipes per page in main UI (8–30)
},
minimap = {
hide = false,
angle = 220,
},
chars = {},
-- [charKey] = { notifyProfessions = {}, hiddenRecipes = {} } — only the logged-in char edits its own.
charPrefs = {},
recipeOverrides = {}, -- [recipeId] = { reagents = {...} } optional runtime patches
-- Mainline/Midnight: recipes harvested via GetRecipeInfo / GetRecipeSchematic.
liveRecipes = {}, -- [recipeId] = recipe entry
}
SLASH_PROFESSIONMASTER1 = "/pm"
SLASH_PROFESSIONMASTER2 = "/professionmaster"
SlashCmdList["PROFESSIONMASTER"] = function(msg)
local raw = (msg or ""):match("^%s*(.-)%s*$") or ""
local cmd = raw:lower()
if cmd == "" or cmd == "open" or cmd == "ui" then
if ns.UI then
ns.UI:Toggle()
end
return
end
if cmd == "options" or cmd == "config" or cmd == "settings" then
if ns.Options then
ns.Options:Open()
end
return
end
if cmd == "minimap" then
if ns.MinimapButton then
local show = not ns.MinimapButton:IsShown()
ns.MinimapButton:SetShown(show)
if ns.db and ns.db.settings then
ns.db.settings.showMinimap = show
end
ns.Print("Minimap icon %s.", show and "shown" or "hidden")
end
return
end
if cmd == "scan" then
if ns.CharDB then
ns.CharDB:SyncAllProfessionRecipes()
end
return
end
if cmd == "debug" then
if ns.CharDB and ns.CharDB.DebugReport then
ns.CharDB:DebugReport()
end
return
end
if cmd == "refresh" or cmd == "toasts" then
if ns.Inventory then
ns.Inventory:Refresh()
end
if ns.SkillUp then
ns.SkillUp:Refresh()
if ns.SkillUp.Report then
ns.SkillUp:Report()
end
end
return
end
if cmd == "green" then
local on = not (ns.db.settings.notifyGreen and true or false)
ns.db.settings.notifyGreen = on
ns.Print("Green recipe toasts %s.", on and "enabled" or "disabled")
ns.ScheduleRescan()
return
end
if cmd == "unhide" or cmd == "clearhidden" then
local n = ns.RecipeDB and ns.RecipeDB:CountHiddenRecipes() or 0
if ns.RecipeDB then
ns.RecipeDB:ClearHiddenRecipes()
end
ns.Print("Cleared %d hidden recipe(s).", n)
ns.ScheduleRescan()
return
end
if cmd == "forget" or cmd == "clearrecipes" then
local n = ns.CharDB and ns.CharDB:ClearRecipeCache() or 0
ns.Print("Cleared %d cached learned recipe(s). Click Scan to re-sync.", n)
if ns.UI and ns.UI.RefreshIfShown then
ns.UI:RefreshIfShown()
end
ns.ScheduleRescan()
return
end
if cmd == "reset" then
local keepChars = ns.db.chars
ProfessionMasterDB = ns.DeepCopy(ns.defaults)
ProfessionMasterDB.chars = keepChars
ns.db = ProfessionMasterDB
ns.Print("Settings reset (characters kept).")
return
end
ns.Print("Commands: /pm | options | minimap | scan | debug | refresh | green | unhide | forget | reset")
end