-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfig.lua
More file actions
206 lines (187 loc) · 8.74 KB
/
config.lua
File metadata and controls
206 lines (187 loc) · 8.74 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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
--- @class TUM_NS: NumyConfigNS
local ns = select(2, ...);
--- @class TUM_Config
local TUM_Config = {}
ns.TUM_Config = TUM_Config;
local Config = ns.Config;
--- @enum TUM_Config_ModifierKeyOptions
TUM_Config.modifierKeyOptions = {
always = "always",
shift = "shift",
ctrl = "ctrl",
alt = "alt",
never = "never",
};
--- @enum TUM_Config_AutoConfirmCatalystOptions
TUM_Config.autoConfirmCatalystOptions = {
never = "never",
previousSeason = "previousSeason",
always = "always",
};
TUM_Config.settingKeys = {
hideWhenCollected = "hideWhenCollected",
showCollectedModifierKey = "showCollectedModifierKey",
showCollectedFromOtherItemModifierKey = "showCollectedFromOtherItemModifierKey",
showUncollectedModifierKey = "showUncollectedModifierKey",
showWarbandCatalystInfoModifierKey = "showWarbandCatalystInfoModifierKey",
warbandCatalystClassList = "warbandCatalystClassList",
autoConfirmCatalyst = "autoConfirmCatalyst",
baganatorIconSize = "baganatorIconSize",
debug = "debug",
};
--- @return TUM_DB
function TUM_Config:Init()
--- @type TransmogUpgradeMaster
local TUM = ns.core;
--- @class TUM_DB
local defaults = {
--- @type boolean
hideWhenCollected = false,
--- @type boolean
debug = false,
--- @type TUM_Config_ModifierKeyOptions
showCollectedModifierKey = self.modifierKeyOptions.always,
--- @type TUM_Config_ModifierKeyOptions
showCollectedFromOtherItemModifierKey = self.modifierKeyOptions.always,
--- @type TUM_Config_ModifierKeyOptions
showUncollectedModifierKey = self.modifierKeyOptions.always,
--- @type TUM_Config_ModifierKeyOptions
showWarbandCatalystInfoModifierKey = self.modifierKeyOptions.shift,
--- @type table<number, boolean> # [classID] = true/false
warbandCatalystClassList = {},
--- @type TUM_Config_AutoConfirmCatalystOptions
autoConfirmCatalyst = self.autoConfirmCatalystOptions.previousSeason,
--- @type number
baganatorIconSize = 15,
--- @type boolean
UI_treatOtherItemAsCollected = false,
--- @type boolean
UI_todoListShown = true,
};
TransmogUpgradeMasterDB = TransmogUpgradeMasterDB or {};
--- @type TUM_DB
self.db = TransmogUpgradeMasterDB;
for k, v in pairs(defaults) do
if self.db[k] == nil then
if k == "showCollectedFromOtherItemModifierKey" then
self.db[k] = (self.db.showUncollectedModifierKey or v);
else
self.db[k] = v;
end
end
end
for classID = 1, GetNumClasses() do
defaults.warbandCatalystClassList[classID] = true;
if self.db.warbandCatalystClassList[classID] == nil then
self.db.warbandCatalystClassList[classID] = true;
end
end
Config:Init("Transmog Upgrade Master", "TransmogUpgradeMaster", self.db, defaults);
do
local showModifierOptions = {
{ text = "Always", value = self.modifierKeyOptions.always, tooltip = "Always show." },
{ text = "Shift", value = self.modifierKeyOptions.shift, tooltip = "Only while holding Shift.", label = "While holding SHIFT" },
{ text = "Ctrl", value = self.modifierKeyOptions.ctrl, tooltip = "Only while holding Ctrl.", label = "While holding CTRL" },
{ text = "Alt", value = self.modifierKeyOptions.alt, tooltip = "Only while holding Alt.", label = "While holding ALT" },
{ text = "Never", value = self.modifierKeyOptions.never, tooltip = "Never show." },
};
Config:MakeHeader(
"Display Transmog Collection Status in Tooltip",
"Show whether you have collected an Upgraded or Catalysed appearance in the tooltip."
);
Config:MakeDropdown(
"Collected",
self.settingKeys.showCollectedModifierKey,
"When to display the Upgrade and Catalyst information for collected appearances.",
showModifierOptions
);
Config:MakeDropdown(
"Collected From Other Item",
self.settingKeys.showCollectedFromOtherItemModifierKey,
"When to display the Upgrade and Catalyst information for collected appearances that are learned from other items.",
showModifierOptions
);
Config:MakeDropdown(
"Uncollected",
self.settingKeys.showUncollectedModifierKey,
"When to display the Upgrade and Catalyst information for uncollected appearances.",
showModifierOptions
);
Config:MakeHeader(
"Warband Catalyst Info",
"For warbound or BoE items, you can show the classes for which you can get an appearance by catalysing (and upgrading) the item."
);
local showWarbandInfo = Config:MakeDropdown(
"Show Warband Catalyst Info",
self.settingKeys.showWarbandCatalystInfoModifierKey,
"When to display the Warband Catalyst information in the tooltip.",
showModifierOptions
);
do
local expandInitializer, isExpanded = Config:MakeExpandableSection("Displayed Classes")
local function isVisible()
return self.db.showWarbandCatalystInfoModifierKey ~= self.modifierKeyOptions.never;
end
expandInitializer:AddShownPredicate(isVisible);
local tooltip = "If checked, the tooltip will show the Catalyst information for %s for warbound or BoE items."
for classID = 1, GetNumClasses() do
local className, classFile = GetClassInfo(classID);
local classColor = RAID_CLASS_COLORS[classFile];
local label = "Show " .. classColor:WrapTextInColorCode(className);
local classCheckbox = Config:MakeCheckbox(
label,
classID,
tooltip:format(classColor:WrapTextInColorCode(className)),
defaults.warbandCatalystClassList[classID],
self.db.warbandCatalystClassList
);
classCheckbox:SetParentInitializer(showWarbandInfo, isVisible);
classCheckbox:AddShownPredicate(isVisible);
classCheckbox:AddShownPredicate(isExpanded);
end
end
Config:MakeHeader("Other Settings");
local sliderOptions = Settings.CreateSliderOptions(5, 30, 0.5);
sliderOptions:SetLabelFormatter(MinimalSliderWithSteppersMixin.Label.Right, function(val) return ("%.1f"):format(val); end);
local initializer, setting = Config:MakeSlider(
"Baganator Icon Size",
self.settingKeys.baganatorIconSize,
"Adjust the size of the icon shown in Baganator. Use Baganator's settings to adjust the position of the icon.",
sliderOptions
);
initializer:AddModifyPredicate(function() return C_AddOns.IsAddOnLoaded("Baganator") and Baganator and Baganator.API and true or false; end);
setting:SetValueChangedCallback(function()
if Baganator and Baganator.API then
Baganator.API.RequestItemButtonsRefresh()
end
end);
Config:MakeDropdown(
"Auto Confirm Catalyst",
self.settingKeys.autoConfirmCatalyst,
"Automatically confirm the popup window when you try to Catalyse an item.",
{
{ text = "Never", value = self.autoConfirmCatalystOptions.never, tooltip = "Never auto-confirm." },
{ text = "Previous Season", value = self.autoConfirmCatalystOptions.previousSeason, tooltip = "Auto-confirm for items from previous seasons that are free." },
{ text = "Always", value = self.autoConfirmCatalystOptions.always, tooltip = "Always auto-confirm, even if there are limited charges." },
}
);
Config:MakeCheckbox("Debug Tooltip Info", self.settingKeys.debug, "If Checked, debug info will be shown in the tooltip.");
Config:MakeButton(
"Reset Transmog Cache",
function() TransmogUpgradeMasterCacheDB = {}; TUM:InitItemSourceMap(); end,
"Reset the Transmog cache. This will cause the addon to re-cache all items, which may take a minute or so. This can fix rare situations when transmog changes are hotfixed in by blizzard."
);
Config:MakeButton(
"Open Collections UI",
function() TUM.UI:ToggleUI(); end,
string.format(
"Open the Collections UI, you can also type %s in chat, or click on the Addon Compartment button to open this UI.",
GREEN_FONT_COLOR:WrapTextInColorCode("/tum")
)
);
end
return self.db;
end
function TUM_Config:OpenSettings()
Config:OpenSettings();
end