Zerotorescue@62
|
1 local addon = select(2, ...);
|
Zerotorescue@62
|
2 local mod = addon:NewModule("Config");
|
Zerotorescue@62
|
3
|
Zerotorescue@62
|
4 local options, groupIdToName, groupIsVirtual, temp, count, includeTradeSkillItems, currentGroupType = {}, {}, {}, {}, 0, 500, "Normal";
|
Zerotorescue@62
|
5 local AceConfigDialog, AceConfigRegistry, AceSerializer;
|
Zerotorescue@62
|
6
|
Zerotorescue@76
|
7 local unknownItemName = "Unknown (#%d)";
|
Zerotorescue@76
|
8
|
Zerotorescue@62
|
9 -- Private functions and tables
|
Zerotorescue@62
|
10
|
Zerotorescue@62
|
11 local function SetOption(info, value, multiSelectEnabled)
|
Zerotorescue@62
|
12 local groupName = groupIdToName[info[2]];
|
Zerotorescue@62
|
13 local optionName = info[#info];
|
Zerotorescue@62
|
14
|
Zerotorescue@62
|
15 -- Special treatment for override toggle boxes
|
Zerotorescue@62
|
16 if optionName:find("override") then
|
Zerotorescue@62
|
17 if not value and info.arg then
|
Zerotorescue@62
|
18 -- If this override was disabled and a saved variable name was provided, set it to nil rather than false
|
Zerotorescue@62
|
19
|
Zerotorescue@62
|
20 value = nil;
|
Zerotorescue@62
|
21
|
Zerotorescue@62
|
22 -- If this is an override toggler then also set the related field to nil
|
Zerotorescue@62
|
23 addon.db.profile.groups[groupName][info.arg] = nil;
|
Zerotorescue@62
|
24 elseif value and info.arg then
|
Zerotorescue@62
|
25 -- If this override is now enabled, we need to copy the default into this field (unless it is not nil (which is supposed to be impossible), in which case we'll use the already selected value)
|
Zerotorescue@62
|
26
|
Zerotorescue@68
|
27 local inheritedValue = addon:GetOptionByKey(groupName, info.arg);
|
Zerotorescue@68
|
28
|
Zerotorescue@75
|
29 addon.db.profile.groups[groupName][info.arg] = (type(inheritedValue) == "table" and CopyTable(inheritedValue)) or inheritedValue; -- copying defaults by reference would let one (unintendedly) change the defaults
|
Zerotorescue@62
|
30 end
|
Zerotorescue@62
|
31 end
|
Zerotorescue@62
|
32
|
Zerotorescue@62
|
33 if multiSelectEnabled ~= nil then
|
Zerotorescue@62
|
34 -- The saved vars for a multiselect will always be an array, it may not yet exist in which case it must be created.
|
Zerotorescue@62
|
35 if not addon.db.profile.groups[groupName][optionName] then
|
Zerotorescue@62
|
36 addon.db.profile.groups[groupName][optionName] = {};
|
Zerotorescue@62
|
37 end
|
Zerotorescue@62
|
38
|
Zerotorescue@62
|
39 addon.db.profile.groups[groupName][optionName][value] = multiSelectEnabled or nil;
|
Zerotorescue@62
|
40 else
|
Zerotorescue@62
|
41 addon.db.profile.groups[groupName][optionName] = value;
|
Zerotorescue@62
|
42 end
|
Zerotorescue@62
|
43 end
|
Zerotorescue@62
|
44
|
Zerotorescue@62
|
45 local function GetOption(info)
|
Zerotorescue@62
|
46 local groupName = groupIdToName[info[2]];
|
Zerotorescue@62
|
47 local optionName = info[#info];
|
Zerotorescue@62
|
48
|
Zerotorescue@62
|
49 local noDefault;
|
Zerotorescue@62
|
50
|
Zerotorescue@62
|
51 if optionName:find("override") then
|
Zerotorescue@62
|
52 noDefault = true;
|
Zerotorescue@62
|
53 end
|
Zerotorescue@62
|
54
|
Zerotorescue@62
|
55 return addon:GetOptionByKey(groupName, optionName, noDefault);
|
Zerotorescue@62
|
56 end
|
Zerotorescue@62
|
57
|
Zerotorescue@62
|
58 local function GetMultiOption(info, value)
|
Zerotorescue@62
|
59 local groupName = groupIdToName[info[2]];
|
Zerotorescue@62
|
60 local optionName = info[#info];
|
Zerotorescue@62
|
61
|
Zerotorescue@68
|
62 local multiSelectValue = addon:GetOptionByKey(groupName, optionName);
|
Zerotorescue@68
|
63
|
Zerotorescue@68
|
64 return multiSelectValue and multiSelectValue[value];
|
Zerotorescue@62
|
65 end
|
Zerotorescue@62
|
66
|
Zerotorescue@62
|
67 local function GetDisabled(info)
|
Zerotorescue@62
|
68 local groupName = groupIdToName[info[2]];
|
Zerotorescue@62
|
69 local optionName = info[#info];
|
Zerotorescue@62
|
70
|
Zerotorescue@62
|
71 if optionName:find("override") or not info.arg then
|
Zerotorescue@62
|
72 return false;
|
Zerotorescue@62
|
73 end
|
Zerotorescue@62
|
74
|
Zerotorescue@62
|
75 return (addon:GetOptionByKey(groupName, info.arg, true) == nil);
|
Zerotorescue@62
|
76 end
|
Zerotorescue@62
|
77
|
Zerotorescue@62
|
78 local function ValidateGroupName(_, value)
|
Zerotorescue@62
|
79 value = string.lower(string.trim(value or ""));
|
Zerotorescue@62
|
80
|
Zerotorescue@62
|
81 for name, _ in pairs(addon.db.profile.groups) do
|
Zerotorescue@62
|
82 if string.lower(name) == value then
|
Zerotorescue@62
|
83 return ("A group named \"%s\" already exists."):format(name);
|
Zerotorescue@62
|
84 end
|
Zerotorescue@62
|
85 end
|
Zerotorescue@62
|
86
|
Zerotorescue@62
|
87 return true;
|
Zerotorescue@62
|
88 end
|
Zerotorescue@62
|
89
|
Zerotorescue@62
|
90 local tblAddItemTemplate = {
|
Zerotorescue@62
|
91 order = 0,
|
Zerotorescue@62
|
92 type = "input",
|
Zerotorescue@62
|
93 name = function(info)
|
Zerotorescue@62
|
94 local itemName, _, itemRarity = GetItemInfo(info[#info]);
|
Zerotorescue@62
|
95 return tostring( 7 - (itemRarity or 0) ) .. (itemName or "");
|
Zerotorescue@62
|
96 end,
|
Zerotorescue@62
|
97 get = function(info)
|
Zerotorescue@140
|
98 return tostring(info[#info]); -- Ace is going to be bitching about this if it's a numeric value, so we transmute it into a string here then back to a number on the other side
|
Zerotorescue@62
|
99 end,
|
Zerotorescue@75
|
100 set = function(groupId, itemData)
|
Zerotorescue@62
|
101 -- This is NOT a real "set", we pass the widget reference to this function which contains similar, but not the same, info.
|
Zerotorescue@62
|
102
|
Zerotorescue@76
|
103 if itemData then
|
Zerotorescue@76
|
104 local groupName = groupIdToName[groupId];
|
Zerotorescue@76
|
105
|
Zerotorescue@76
|
106 if not itemData:AddToGroup(groupName) then
|
Zerotorescue@98
|
107 addon:Print("Couldn't add the item with itemId (" .. itemData.id .. ") because it is already in a group.", addon.Colors.Red);
|
Zerotorescue@76
|
108 end
|
Zerotorescue@76
|
109
|
Zerotorescue@76
|
110 if AceConfigRegistry then
|
Zerotorescue@76
|
111 -- Now rebuild the list
|
Zerotorescue@172
|
112 AceConfigRegistry:NotifyChange("Inventorium");
|
Zerotorescue@76
|
113 end
|
Zerotorescue@62
|
114 end
|
Zerotorescue@62
|
115 end,
|
Zerotorescue@62
|
116 width = "double",
|
Zerotorescue@62
|
117 dialogControl = "ConfigItemLinkButton",
|
Zerotorescue@62
|
118 };
|
Zerotorescue@62
|
119
|
Zerotorescue@62
|
120 local tblRemoveItemTemplate = {
|
Zerotorescue@62
|
121 order = 0,
|
Zerotorescue@62
|
122 type = "input",
|
Zerotorescue@62
|
123 name = function(info)
|
Zerotorescue@62
|
124 local itemName, _, itemRarity = GetItemInfo(info[#info]);
|
Zerotorescue@62
|
125 return tostring( 7 - (itemRarity or 0) ) .. (itemName or "");
|
Zerotorescue@62
|
126 end,
|
Zerotorescue@62
|
127 get = function(info)
|
Zerotorescue@62
|
128 return tostring(info[#info]); -- Ace is going to be anal about this if it's a numeric value, so we transmute it into a string here then back to a number on the other side
|
Zerotorescue@62
|
129 end,
|
Zerotorescue@75
|
130 set = function(groupId, itemData)
|
Zerotorescue@62
|
131 -- This is NOT a real "set", we pass the widget reference to this function which contains similar, but not the same, info.
|
Zerotorescue@62
|
132
|
Zerotorescue@76
|
133 if itemData then
|
Zerotorescue@62
|
134 local groupName = groupIdToName[groupId];
|
Zerotorescue@62
|
135
|
Zerotorescue@76
|
136 itemData:RemoveFromGroup(groupName);
|
Zerotorescue@62
|
137
|
Zerotorescue@76
|
138 if AceConfigRegistry then
|
Zerotorescue@76
|
139 -- Now rebuild the list
|
Zerotorescue@172
|
140 AceConfigRegistry:NotifyChange("Inventorium");
|
Zerotorescue@76
|
141 end
|
Zerotorescue@62
|
142 end
|
Zerotorescue@62
|
143 end,
|
Zerotorescue@62
|
144 width = "double",
|
Zerotorescue@62
|
145 dialogControl = "ConfigItemLinkButton",
|
Zerotorescue@62
|
146 };
|
Zerotorescue@62
|
147
|
Zerotorescue@62
|
148 local function UpdateAddItemList(info)
|
Zerotorescue@62
|
149 local groupName = groupIdToName[info[2]];
|
Zerotorescue@62
|
150
|
Zerotorescue@62
|
151 if not addon.db.profile.groups[groupName].items then
|
Zerotorescue@62
|
152 addon.db.profile.groups[groupName].items = {};
|
Zerotorescue@62
|
153 end
|
Zerotorescue@62
|
154
|
Zerotorescue@140
|
155 -- Merge all items from all groups together (we only use this to check if an item is already in a group)
|
Zerotorescue@62
|
156 local items = {};
|
Zerotorescue@62
|
157 for groupName, values in pairs(addon.db.profile.groups) do
|
Zerotorescue@62
|
158 if values.items then
|
Zerotorescue@140
|
159 for itemId, count in pairs(values.items) do
|
Zerotorescue@140
|
160 items[itemId] = tonumber(count) or 0;
|
Zerotorescue@62
|
161 end
|
Zerotorescue@62
|
162 end
|
Zerotorescue@62
|
163 end
|
Zerotorescue@62
|
164
|
Zerotorescue@62
|
165 local ref = options.args.groups.args[info[2]].args.add.args.list.args;
|
Zerotorescue@62
|
166
|
Zerotorescue@62
|
167 -- Remaking the list, so out with the old, in with the new
|
Zerotorescue@62
|
168 table.wipe(ref);
|
Zerotorescue@62
|
169
|
Zerotorescue@62
|
170 -- Parse bags and show these
|
Zerotorescue@62
|
171 for bagID = 4, 0, -1 do
|
Zerotorescue@62
|
172 for slot = 1, GetContainerNumSlots(bagID) do
|
Zerotorescue@62
|
173 local itemId = addon:GetItemId(GetContainerItemLink(bagID, slot));
|
Zerotorescue@62
|
174
|
Zerotorescue@62
|
175 if itemId then
|
Zerotorescue@62
|
176 if not items[itemId] then
|
Zerotorescue@62
|
177 -- If this item isn't used in any group yet
|
Zerotorescue@62
|
178 ref[itemId] = tblAddItemTemplate;
|
Zerotorescue@62
|
179 else
|
Zerotorescue@62
|
180 -- It's already used in a group, don't show it
|
Zerotorescue@62
|
181 ref[itemId] = nil;
|
Zerotorescue@62
|
182 end
|
Zerotorescue@62
|
183 end
|
Zerotorescue@62
|
184 end
|
Zerotorescue@62
|
185 end
|
Zerotorescue@62
|
186
|
Zerotorescue@62
|
187 if includeTradeSkillItems ~= 500 then
|
Zerotorescue@62
|
188 -- Include tradeskill items
|
Zerotorescue@62
|
189
|
Zerotorescue@62
|
190 -- Go through all trade skills for the profession
|
Zerotorescue@62
|
191 for i = 1, GetNumTradeSkills() do
|
Zerotorescue@62
|
192 -- Try to retrieve the itemlink, this will be nil if current item is a group instead
|
Zerotorescue@62
|
193 local itemLink = GetTradeSkillItemLink(i);
|
Zerotorescue@62
|
194
|
Zerotorescue@62
|
195 if itemLink then
|
Zerotorescue@62
|
196 local itemId = addon:GetItemId(itemLink);
|
Zerotorescue@62
|
197 if not itemId then
|
Zerotorescue@62
|
198 -- If this isn't an item, it can only be an enchant instead
|
Zerotorescue@62
|
199 itemId = tonumber(itemLink:match("|Henchant:([-0-9]+)|h"));
|
Zerotorescue@62
|
200
|
Zerotorescue@62
|
201 itemId = addon.scrollIds[itemId]; -- change enchantIds into scrollIds
|
Zerotorescue@62
|
202 end
|
Zerotorescue@62
|
203
|
Zerotorescue@62
|
204 if itemId then
|
Zerotorescue@62
|
205 local itemLevel = select(4, GetItemInfo(itemId)) or 0;
|
Zerotorescue@62
|
206
|
Zerotorescue@62
|
207 if includeTradeSkillItems == 0 or itemLevel >= includeTradeSkillItems then
|
Zerotorescue@62
|
208 if not items[itemId] then
|
Zerotorescue@62
|
209 -- If this item isn't used in any group yet
|
Zerotorescue@62
|
210 ref[itemId] = tblAddItemTemplate;
|
Zerotorescue@62
|
211 else
|
Zerotorescue@62
|
212 -- It's already used in a group, don't show it
|
Zerotorescue@62
|
213 ref[itemId] = nil;
|
Zerotorescue@62
|
214 end
|
Zerotorescue@62
|
215 end
|
Zerotorescue@62
|
216 else
|
Zerotorescue@89
|
217 addon:Debug("|cffff0000ERROR|r: Couldn't find proper item id for %s", itemLink);
|
Zerotorescue@62
|
218 end
|
Zerotorescue@62
|
219 end
|
Zerotorescue@62
|
220 end
|
Zerotorescue@62
|
221 end
|
Zerotorescue@62
|
222 end
|
Zerotorescue@62
|
223
|
Zerotorescue@62
|
224 local function UpdateRemoveItemList(info)
|
Zerotorescue@62
|
225 local groupName = groupIdToName[info[2]];
|
Zerotorescue@62
|
226
|
Zerotorescue@62
|
227 if not addon.db.profile.groups[groupName].items then
|
Zerotorescue@62
|
228 addon.db.profile.groups[groupName].items = {};
|
Zerotorescue@62
|
229 end
|
Zerotorescue@62
|
230
|
Zerotorescue@62
|
231 local ref = options.args.groups.args[info[2]].args.remove.args.list.args;
|
Zerotorescue@62
|
232
|
Zerotorescue@62
|
233 -- Unset all
|
Zerotorescue@62
|
234 for itemId, _ in pairs(ref) do
|
Zerotorescue@62
|
235 ref[itemId] = nil;
|
Zerotorescue@62
|
236 end
|
Zerotorescue@62
|
237
|
Zerotorescue@62
|
238 -- Parse items in group and show these
|
Zerotorescue@62
|
239 for itemId, _ in pairs(addon.db.profile.groups[groupName].items) do
|
Zerotorescue@62
|
240 ref[itemId] = tblRemoveItemTemplate;
|
Zerotorescue@62
|
241 end
|
Zerotorescue@62
|
242 end
|
Zerotorescue@62
|
243
|
Zerotorescue@161
|
244 local function ImportPremadeItemsGroup(groupName, name)
|
Zerotorescue@161
|
245 local premadeItemGroup = addon.defaultGroups[name];
|
Zerotorescue@161
|
246
|
Zerotorescue@161
|
247 addon:Print(("Importing items from the premade group \"|cfffed000%s|r\"."):format(name));
|
Zerotorescue@161
|
248
|
Zerotorescue@161
|
249 -- Remember we imported this group and it's version so if it is ever changed, people can be notified
|
Zerotorescue@161
|
250 if not addon.db.profile.groups[groupName].premadeGroups then
|
Zerotorescue@161
|
251 addon.db.profile.groups[groupName].premadeGroups = {};
|
Zerotorescue@161
|
252 end
|
Zerotorescue@161
|
253 addon.db.profile.groups[groupName].premadeGroups[name] = premadeItemGroup.version;
|
Zerotorescue@161
|
254
|
Zerotorescue@161
|
255 for itemId, version in pairs(premadeItemGroup.items) do
|
Zerotorescue@161
|
256 if version > 0 then
|
Zerotorescue@161
|
257 -- Sanity check
|
Zerotorescue@161
|
258 itemId = itemId and tonumber(itemId);
|
Zerotorescue@161
|
259
|
Zerotorescue@161
|
260 local itemData = addon.ItemData:New(itemId);
|
Zerotorescue@161
|
261
|
Zerotorescue@161
|
262 if not itemId then
|
Zerotorescue@161
|
263 addon:Print(("\"|cfffed000%s|r\" is not a number."):format(name), addon.Colors.Red);
|
Zerotorescue@161
|
264 elseif itemData:InGroup() then
|
Zerotorescue@161
|
265 addon:Print(("Skipping |cfffed000%s|r as it is already in the group |cfffed000%s|r."):format( (itemData.link or unknownItemName:format(itemId)), itemData:InGroup() ), addon.Colors.Red);
|
Zerotorescue@161
|
266 elseif itemData:AddToGroup(groupName) then
|
Zerotorescue@161
|
267 addon:Print(("Added %s to the group |cfffed000%s|r."):format( (itemData.link or unknownItemName:format(itemId)), groupName ), addon.Colors.Green);
|
Zerotorescue@161
|
268 end
|
Zerotorescue@161
|
269 end
|
Zerotorescue@161
|
270 end
|
Zerotorescue@161
|
271 end
|
Zerotorescue@161
|
272
|
Zerotorescue@62
|
273 -- Default group
|
Zerotorescue@62
|
274 local defaultGroup = {
|
Zerotorescue@62
|
275 order = 0,
|
Zerotorescue@62
|
276 type = "group",
|
Zerotorescue@62
|
277 childGroups = "tab",
|
Zerotorescue@62
|
278 name = function(info)
|
Zerotorescue@62
|
279 local groupId = info[#info];
|
Zerotorescue@62
|
280 if groupIsVirtual[groupId] then
|
Zerotorescue@62
|
281 return ("%s |cfffed000Virtual|r"):format(groupIdToName[groupId]);
|
Zerotorescue@62
|
282 else
|
Zerotorescue@62
|
283 return groupIdToName[groupId];
|
Zerotorescue@62
|
284 end
|
Zerotorescue@62
|
285 end,
|
Zerotorescue@62
|
286 desc = function(info)
|
Zerotorescue@62
|
287 local groupId = info[#info];
|
Zerotorescue@62
|
288 if groupIsVirtual[groupId] then
|
Zerotorescue@62
|
289 return "This is a virtual group, you can use it to override the defaults for other groups.";
|
Zerotorescue@62
|
290 end
|
Zerotorescue@62
|
291 end,
|
Zerotorescue@62
|
292 args = {
|
Zerotorescue@62
|
293 general = {
|
Zerotorescue@62
|
294 order = 10,
|
Zerotorescue@62
|
295 type = "group",
|
Zerotorescue@62
|
296 name = "General",
|
Zerotorescue@62
|
297 desc = "Change the general settings for just this group.",
|
Zerotorescue@62
|
298 args = {
|
Zerotorescue@62
|
299 general = {
|
Zerotorescue@62
|
300 order = 0,
|
Zerotorescue@62
|
301 type = "group",
|
Zerotorescue@62
|
302 inline = true,
|
Zerotorescue@62
|
303 name = "General",
|
Zerotorescue@62
|
304 set = SetOption,
|
Zerotorescue@62
|
305 get = GetOption,
|
Zerotorescue@62
|
306 disabled = GetDisabled,
|
Zerotorescue@62
|
307 args = {
|
Zerotorescue@62
|
308 description = {
|
Zerotorescue@62
|
309 order = 0,
|
Zerotorescue@62
|
310 type = "description",
|
Zerotorescue@62
|
311 name = function(info)
|
Zerotorescue@62
|
312 local groupName = groupIdToName[info[2]];
|
Zerotorescue@62
|
313
|
Zerotorescue@106
|
314 local t = "";
|
Zerotorescue@106
|
315 if not addon.db.profile.defaults.hideHelp then
|
Zerotorescue@155
|
316 t = "Here you can set general settings for the currently selected group. If you do not wish to override a setting, the default setting specified in the general group will be used.";
|
Zerotorescue@62
|
317 end
|
Zerotorescue@62
|
318
|
Zerotorescue@62
|
319 return t;
|
Zerotorescue@62
|
320 end,
|
Zerotorescue@62
|
321 },
|
Zerotorescue@62
|
322 header = {
|
Zerotorescue@62
|
323 order = 5,
|
Zerotorescue@62
|
324 type = "header",
|
Zerotorescue@62
|
325 name = "",
|
Zerotorescue@106
|
326 hidden = function() return addon.db.profile.defaults.hideHelp; end,
|
Zerotorescue@62
|
327 },
|
Zerotorescue@155
|
328 overrideTrackAtCharacters = {
|
Zerotorescue@155
|
329 order = 19,
|
Zerotorescue@62
|
330 type = "toggle",
|
Zerotorescue@155
|
331 name = "Override track at",
|
Zerotorescue@176
|
332 desc = "Allows you to override at which characters groups should be tracked, appear in the summary or generate alerts.",
|
Zerotorescue@155
|
333 arg = "trackAtCharacters",
|
Zerotorescue@62
|
334 },
|
Zerotorescue@155
|
335 trackAtCharacters = {
|
Zerotorescue@155
|
336 order = 20,
|
Zerotorescue@155
|
337 type = "multiselect",
|
Zerotorescue@155
|
338 name = "Track at",
|
Zerotorescue@176
|
339 desc = "Select at which characters groups should be tracked, appear in the summary or generate alerts.",
|
Zerotorescue@62
|
340 values = function()
|
Zerotorescue@62
|
341 local temp = {};
|
Zerotorescue@155
|
342 for charName in pairs(addon.db.factionrealm.characters) do
|
Zerotorescue@155
|
343 temp[charName] = charName;
|
Zerotorescue@62
|
344 end
|
Zerotorescue@62
|
345
|
Zerotorescue@62
|
346 return temp;
|
Zerotorescue@62
|
347 end,
|
Zerotorescue@155
|
348 get = GetMultiOption,
|
Zerotorescue@155
|
349 dialogControl = "Dropdown", -- this is not standard, normal multiselect control gives us a list of all chars with toggle-boxes. UGLY! We want a multiselect-box instead.
|
Zerotorescue@155
|
350 arg = "overrideTrackAtCharacters",
|
Zerotorescue@62
|
351 },
|
Zerotorescue@176
|
352 overrideDontAlertAtCharacters = {
|
Zerotorescue@176
|
353 order = 29,
|
Zerotorescue@176
|
354 type = "toggle",
|
Zerotorescue@176
|
355 name = "Override not alerting at",
|
Zerotorescue@176
|
356 desc = "Allows you to override at which characters items in groups should |cffff0000not|r generate alerts when they are below the required stock.",
|
Zerotorescue@176
|
357 arg = "dontAlertAtCharacters",
|
Zerotorescue@176
|
358 },
|
Zerotorescue@176
|
359 dontAlertAtCharacters = {
|
Zerotorescue@176
|
360 order = 30,
|
Zerotorescue@176
|
361 type = "multiselect",
|
Zerotorescue@176
|
362 name = "Do |cffff0000not|r alert at",
|
Zerotorescue@176
|
363 desc = "Select at which characters items in groups should |cffff0000not|r generate alerts when they are below the required stock.",
|
Zerotorescue@176
|
364 values = function()
|
Zerotorescue@176
|
365 local temp = {};
|
Zerotorescue@176
|
366 for charName in pairs(addon.db.factionrealm.characters) do
|
Zerotorescue@176
|
367 temp[charName] = charName;
|
Zerotorescue@176
|
368 end
|
Zerotorescue@176
|
369
|
Zerotorescue@176
|
370 return temp;
|
Zerotorescue@176
|
371 end,
|
Zerotorescue@176
|
372 get = GetMultiOption,
|
Zerotorescue@176
|
373 dialogControl = "Dropdown", -- this is not standard, normal multiselect control gives us a list of all chars with toggle-boxes. UGLY! We want a multiselect-box instead.
|
Zerotorescue@176
|
374 arg = "overrideDontAlertAtCharacters",
|
Zerotorescue@176
|
375 },
|
Zerotorescue@62
|
376 overrideLocalItemData = {
|
Zerotorescue@62
|
377 order = 39,
|
Zerotorescue@62
|
378 type = "toggle",
|
Zerotorescue@62
|
379 name = "Override local item data",
|
Zerotorescue@62
|
380 desc = "Allows you to override the local item data setting for this group.",
|
Zerotorescue@62
|
381 arg = "localItemData",
|
Zerotorescue@62
|
382 },
|
Zerotorescue@62
|
383 localItemData = {
|
Zerotorescue@62
|
384 order = 40,
|
Zerotorescue@62
|
385 type = "multiselect",
|
Zerotorescue@62
|
386 name = "Include in local item data",
|
Zerotorescue@62
|
387 desc = "Select which data should be included in the local item data.",
|
Zerotorescue@62
|
388 values = {
|
Zerotorescue@62
|
389 ["Bag"] = "Bag",
|
Zerotorescue@62
|
390 ["Bank"] = "Bank",
|
Zerotorescue@62
|
391 ["Auction House"] = "Auction House",
|
Zerotorescue@62
|
392 ["Mailbox"] = "Mailbox",
|
Zerotorescue@62
|
393 },
|
Zerotorescue@62
|
394 get = GetMultiOption,
|
Zerotorescue@65
|
395 dialogControl = "Dropdown", -- this is not standard, normal multiselect control gives us a list of all chars with toggle-boxes. UGLY! We want a multiselect-box instead.
|
Zerotorescue@62
|
396 arg = "overrideLocalItemData",
|
Zerotorescue@62
|
397 },
|
Zerotorescue@62
|
398 virtualGroup = {
|
Zerotorescue@62
|
399 order = 50,
|
Zerotorescue@62
|
400 type = "select",
|
Zerotorescue@62
|
401 name = "Use virtual group settings",
|
Zerotorescue@62
|
402 desc = "Use the settings from a virtual group before using the general defaults.\n\n|cffff9933This is an advanced option, you will probably not need it unless you manage a lot of groups.|r\n\n|cfffed000Off|r: Use the overridden options in this group and then the defaults.\n\n|cfffed000On|r: Use the overridden options in this group, then the ones in the selected virtual group and then the defaults.",
|
Zerotorescue@62
|
403 values = function(info)
|
Zerotorescue@62
|
404 local groupName = groupIdToName[info[2]];
|
Zerotorescue@62
|
405
|
Zerotorescue@62
|
406 local temp = {};
|
Zerotorescue@62
|
407
|
Zerotorescue@62
|
408 temp[""] = "";
|
Zerotorescue@62
|
409 for name, values in pairs(addon.db.profile.groups) do
|
Zerotorescue@62
|
410 if values.isVirtual and name ~= groupName then
|
Zerotorescue@62
|
411 temp[name] = name;
|
Zerotorescue@62
|
412 end
|
Zerotorescue@62
|
413 end
|
Zerotorescue@62
|
414
|
Zerotorescue@62
|
415 return temp;
|
Zerotorescue@62
|
416 end,
|
Zerotorescue@62
|
417 set = function(info, value)
|
Zerotorescue@62
|
418 local groupName = groupIdToName[info[2]];
|
Zerotorescue@62
|
419 local optionName = info[#info];
|
Zerotorescue@62
|
420
|
Zerotorescue@62
|
421 addon.db.profile.groups[groupName][optionName] = value ~= "" and value;
|
Zerotorescue@62
|
422 end,
|
Zerotorescue@62
|
423 disabled = false,
|
Zerotorescue@62
|
424 },
|
Zerotorescue@62
|
425 },
|
Zerotorescue@62
|
426 },
|
Zerotorescue@62
|
427 minimumStock = {
|
Zerotorescue@62
|
428 order = 10,
|
Zerotorescue@62
|
429 type = "group",
|
Zerotorescue@62
|
430 inline = true,
|
Zerotorescue@62
|
431 name = "Minimum stock",
|
Zerotorescue@62
|
432 set = SetOption,
|
Zerotorescue@62
|
433 get = GetOption,
|
Zerotorescue@62
|
434 disabled = GetDisabled,
|
Zerotorescue@62
|
435 args = {
|
Zerotorescue@62
|
436 description = {
|
Zerotorescue@62
|
437 order = 0,
|
Zerotorescue@62
|
438 type = "description",
|
Zerotorescue@62
|
439 name = "Here you can specify the minimum amount of items you wish to keep in stock and related settings for the currently selected group. Please note the values entered here do not affect the queued quantities, you must set settings for that in the area below.",
|
Zerotorescue@106
|
440 hidden = function() return addon.db.profile.defaults.hideHelp; end,
|
Zerotorescue@62
|
441 },
|
Zerotorescue@62
|
442 header = {
|
Zerotorescue@62
|
443 order = 5,
|
Zerotorescue@62
|
444 type = "header",
|
Zerotorescue@62
|
445 name = "",
|
Zerotorescue@106
|
446 hidden = function() return addon.db.profile.defaults.hideHelp; end,
|
Zerotorescue@62
|
447 },
|
Zerotorescue@62
|
448
|
Zerotorescue@62
|
449 overrideMinLocalStock = {
|
Zerotorescue@62
|
450 order = 10,
|
Zerotorescue@62
|
451 type = "toggle",
|
Zerotorescue@62
|
452 name = "Override min local stock",
|
Zerotorescue@62
|
453 desc = "Allows you to override the minimum local stock setting for this group.",
|
Zerotorescue@62
|
454 arg = "minLocalStock",
|
Zerotorescue@62
|
455 },
|
Zerotorescue@62
|
456 minLocalStock = {
|
Zerotorescue@62
|
457 order = 11,
|
Zerotorescue@62
|
458 type = "range",
|
Zerotorescue@62
|
459 min = 0,
|
Zerotorescue@62
|
460 max = 100000,
|
Zerotorescue@62
|
461 softMax = 100,
|
Zerotorescue@62
|
462 step = 1,
|
Zerotorescue@62
|
463 name = "Minimum local stock",
|
Zerotorescue@62
|
464 desc = "You can manually enter a value between 100 and 100.000 in the text box below if the provided range is insufficient.",
|
Zerotorescue@62
|
465 arg = "overrideMinLocalStock",
|
Zerotorescue@62
|
466 },
|
Zerotorescue@62
|
467 overrideAlertBelowLocalMinimum = {
|
Zerotorescue@62
|
468 order = 15,
|
Zerotorescue@62
|
469 type = "toggle",
|
Zerotorescue@62
|
470 name = "Override local minimum alert",
|
Zerotorescue@62
|
471 desc = "Allows you to override wether an alert should be shown when an item in this group gets below the local minimum stock threshold.",
|
Zerotorescue@62
|
472 arg = "alertBelowLocalMinimum",
|
Zerotorescue@62
|
473 },
|
Zerotorescue@62
|
474 alertBelowLocalMinimum = {
|
Zerotorescue@62
|
475 order = 16,
|
Zerotorescue@62
|
476 type = "toggle",
|
Zerotorescue@181
|
477 name = "Alert when below local minimum",
|
Zerotorescue@62
|
478 desc = "Show an alert when an item in this group gets below the local minimum stock threshold.",
|
Zerotorescue@62
|
479 arg = "overrideAlertBelowLocalMinimum",
|
Zerotorescue@62
|
480 },
|
Zerotorescue@82
|
481 overrideAutoRefill = {
|
Zerotorescue@82
|
482 order = 17,
|
Zerotorescue@82
|
483 type = "toggle",
|
Zerotorescue@82
|
484 name = "Override auto refill",
|
Zerotorescue@82
|
485 desc = "Allows you to override wether you want to automatically refill items when below the minimum local stock.",
|
Zerotorescue@82
|
486 arg = "autoRefill",
|
Zerotorescue@82
|
487 },
|
Zerotorescue@82
|
488 autoRefill = {
|
Zerotorescue@82
|
489 order = 18,
|
Zerotorescue@82
|
490 type = "toggle",
|
Zerotorescue@131
|
491 name = "Auto refill from storage",
|
Zerotorescue@131
|
492 desc = "Automatically refill items from your storage (bank/mailbox - unless this is included in the local count - or the guild bank) when below the minimum local stock.",
|
Zerotorescue@82
|
493 arg = "overrideAutoRefill",
|
Zerotorescue@82
|
494 },
|
Zerotorescue@184
|
495 spacer = {
|
Zerotorescue@184
|
496 order = 19,
|
Zerotorescue@184
|
497 type = "description",
|
Zerotorescue@184
|
498 name = "",
|
Zerotorescue@184
|
499 },
|
Zerotorescue@62
|
500
|
Zerotorescue@62
|
501 overrideMinGlobalStock = {
|
Zerotorescue@62
|
502 order = 20,
|
Zerotorescue@62
|
503 type = "toggle",
|
Zerotorescue@62
|
504 name = "Override min global stock",
|
Zerotorescue@62
|
505 desc = "Allows you to override the minimum global stock setting for this group.",
|
Zerotorescue@62
|
506 arg = "minGlobalStock",
|
Zerotorescue@62
|
507 },
|
Zerotorescue@62
|
508 minGlobalStock = {
|
Zerotorescue@62
|
509 order = 21,
|
Zerotorescue@62
|
510 type = "range",
|
Zerotorescue@62
|
511 min = 0,
|
Zerotorescue@62
|
512 max = 100000,
|
Zerotorescue@62
|
513 softMax = 100,
|
Zerotorescue@62
|
514 step = 1,
|
Zerotorescue@62
|
515 name = "Minimum global stock",
|
Zerotorescue@62
|
516 desc = "You can manually enter a value between 100 and 100.000 in the text box below if the provided range is insufficient.",
|
Zerotorescue@62
|
517 arg = "overrideMinGlobalStock",
|
Zerotorescue@62
|
518 },
|
Zerotorescue@62
|
519 overrideAlertBelowGlobalMinimum = {
|
Zerotorescue@62
|
520 order = 25,
|
Zerotorescue@62
|
521 type = "toggle",
|
Zerotorescue@62
|
522 name = "Override global minimum alert",
|
Zerotorescue@62
|
523 desc = "Allows you to override wether an alert should be shown when an item in this group gets below the global minimum stock threshold.",
|
Zerotorescue@62
|
524 arg = "alertBelowGlobalMinimum",
|
Zerotorescue@62
|
525 },
|
Zerotorescue@62
|
526 alertBelowGlobalMinimum = {
|
Zerotorescue@62
|
527 order = 26,
|
Zerotorescue@62
|
528 type = "toggle",
|
Zerotorescue@181
|
529 name = "Alert when below global minimum",
|
Zerotorescue@62
|
530 desc = "Show an alert when an item in this group gets below the global minimum stock threshold.",
|
Zerotorescue@62
|
531 arg = "overrideAlertBelowGlobalMinimum",
|
Zerotorescue@62
|
532 },
|
Zerotorescue@62
|
533
|
Zerotorescue@62
|
534 overrideSummaryThresholdShow = {
|
Zerotorescue@62
|
535 order = 34,
|
Zerotorescue@62
|
536 type = "toggle",
|
Zerotorescue@62
|
537 name = "Override summary showing",
|
Zerotorescue@62
|
538 desc = "Allows you to override when this group should appear in the summary.",
|
Zerotorescue@62
|
539 arg = "summaryThresholdShow",
|
Zerotorescue@62
|
540 },
|
Zerotorescue@62
|
541 summaryThresholdShow = {
|
Zerotorescue@62
|
542 order = 35,
|
Zerotorescue@62
|
543 type = "range",
|
Zerotorescue@62
|
544 min = 0,
|
Zerotorescue@62
|
545 max = 10,
|
Zerotorescue@62
|
546 softMax = 100,
|
Zerotorescue@62
|
547 step = 0.05,
|
Zerotorescue@62
|
548 isPercent = true,
|
Zerotorescue@62
|
549 name = "Show in summary when below",
|
Zerotorescue@62
|
550 desc = "Show items in the summary when below the specified percentage of the minimum stock.\n\nYou can manually enter a value between 1.000% and 10.000% in the edit box if the provided range is insufficient.",
|
Zerotorescue@62
|
551 arg = "overrideSummaryThresholdShow",
|
Zerotorescue@62
|
552 },
|
Zerotorescue@62
|
553 },
|
Zerotorescue@62
|
554 },
|
Zerotorescue@62
|
555 refill = {
|
Zerotorescue@62
|
556 order = 20,
|
Zerotorescue@62
|
557 type = "group",
|
Zerotorescue@62
|
558 inline = true,
|
Zerotorescue@62
|
559 name = "Replenishing stock",
|
Zerotorescue@62
|
560 set = SetOption,
|
Zerotorescue@62
|
561 get = GetOption,
|
Zerotorescue@62
|
562 disabled = GetDisabled,
|
Zerotorescue@62
|
563 args = {
|
Zerotorescue@62
|
564 description = {
|
Zerotorescue@62
|
565 order = 0,
|
Zerotorescue@62
|
566 type = "description",
|
Zerotorescue@62
|
567 name = function(info)
|
Zerotorescue@62
|
568 local groupName = groupIdToName[info[2]];
|
Zerotorescue@62
|
569 local r = "Here you can specify the amount of items to which you wish to restock when you are collecting new items for the currently selected group. This may be higher than the minimum stock.\n\n";
|
Zerotorescue@62
|
570
|
Zerotorescue@62
|
571 r = r .. "When restocking the target amount is |cfffed000" .. addon:GetOptionByKey(groupName, "restockTarget") .. "|r of every item. Not queueing craftable items when only missing |cfffed000" .. floor( addon:GetOptionByKey(groupName, "minCraftingQueue") * addon:GetOptionByKey(groupName, "restockTarget") ) .. "|r (|cfffed000" .. ( addon:GetOptionByKey(groupName, "minCraftingQueue") * 100 ) .. "%|r) of the restock target and making |cfffed000" .. floor( ( addon:GetOptionByKey(groupName, "bonusQueue") * addon:GetOptionByKey(groupName, "restockTarget") ) + .5 ) .. "|r (|cfffed000" .. ( addon:GetOptionByKey(groupName, "bonusQueue") * 100 ) .. "%|r) extra items when you completely ran out. ";
|
Zerotorescue@62
|
572
|
Zerotorescue@62
|
573 if addon:GetOptionByKey(groupName, "priceThreshold") == 0 then
|
Zerotorescue@62
|
574 r = r .. "Queueing items at |cfffed000any|r auction value.";
|
Zerotorescue@62
|
575 else
|
Zerotorescue@62
|
576 r = r .. "Queueing items worth |cfffed000" .. addon:ReadableMoney(addon:GetOptionByKey(groupName, "priceThreshold")) .. "|r or more.";
|
Zerotorescue@62
|
577 end
|
Zerotorescue@62
|
578
|
Zerotorescue@62
|
579 return r;
|
Zerotorescue@62
|
580 end,
|
Zerotorescue@106
|
581 hidden = function() return addon.db.profile.defaults.hideHelp; end,
|
Zerotorescue@62
|
582 },
|
Zerotorescue@62
|
583 header = {
|
Zerotorescue@62
|
584 order = 5,
|
Zerotorescue@62
|
585 type = "header",
|
Zerotorescue@62
|
586 name = "",
|
Zerotorescue@106
|
587 hidden = function() return addon.db.profile.defaults.hideHelp; end,
|
Zerotorescue@62
|
588 },
|
Zerotorescue@62
|
589 overrideRestockTarget = {
|
Zerotorescue@62
|
590 order = 9,
|
Zerotorescue@62
|
591 type = "toggle",
|
Zerotorescue@62
|
592 name = "Override restock target",
|
Zerotorescue@62
|
593 desc = "Allows you to override the restock target setting for this group.",
|
Zerotorescue@62
|
594 arg = "restockTarget",
|
Zerotorescue@62
|
595 },
|
Zerotorescue@62
|
596 restockTarget = {
|
Zerotorescue@62
|
597 order = 10,
|
Zerotorescue@62
|
598 type = "range",
|
Zerotorescue@62
|
599 min = 0,
|
Zerotorescue@62
|
600 max = 100000,
|
Zerotorescue@62
|
601 softMax = 100,
|
Zerotorescue@62
|
602 step = 1,
|
Zerotorescue@62
|
603 name = "Restock target",
|
Zerotorescue@62
|
604 desc = "You can manually enter a value between 100 and 100.000 in the edit box if the provided range is insufficient.",
|
Zerotorescue@62
|
605 arg = "overrideRestockTarget",
|
Zerotorescue@62
|
606 },
|
Zerotorescue@62
|
607 overrideMinCraftingQueue = {
|
Zerotorescue@62
|
608 order = 19,
|
Zerotorescue@62
|
609 type = "toggle",
|
Zerotorescue@62
|
610 name = "Override min queue",
|
Zerotorescue@62
|
611 desc = "Allows you to override the minimum craftable items queue setting for this group.",
|
Zerotorescue@62
|
612 arg = "minCraftingQueue",
|
Zerotorescue@62
|
613 },
|
Zerotorescue@62
|
614 minCraftingQueue = {
|
Zerotorescue@62
|
615 order = 20,
|
Zerotorescue@62
|
616 type = "range",
|
Zerotorescue@62
|
617 min = 0,
|
Zerotorescue@62
|
618 max = 1,
|
Zerotorescue@62
|
619 step = 0.01,
|
Zerotorescue@62
|
620 isPercent = true,
|
Zerotorescue@154
|
621 name = "Don't queue when only missing...",
|
Zerotorescue@154
|
622 desc = "Don't add a craftable item to the queue when only missing this much or less of the restock target.\n\nExample: if your restock target is set to 60 and this is set to 5%, an item won't be queued unless you are missing more than 3 of it.",
|
Zerotorescue@62
|
623 arg = "overrideMinCraftingQueue",
|
Zerotorescue@62
|
624 },
|
Zerotorescue@62
|
625 overrideBonusQueue = {
|
Zerotorescue@62
|
626 order = 29,
|
Zerotorescue@62
|
627 type = "toggle",
|
Zerotorescue@62
|
628 name = "Override bonus queue",
|
Zerotorescue@62
|
629 desc = "Allows you to override the bonus craftable items queue setting for this group.",
|
Zerotorescue@62
|
630 arg = "bonusQueue",
|
Zerotorescue@62
|
631 },
|
Zerotorescue@62
|
632 bonusQueue = {
|
Zerotorescue@62
|
633 order = 30,
|
Zerotorescue@62
|
634 type = "range",
|
Zerotorescue@62
|
635 min = 0,
|
Zerotorescue@62
|
636 max = 10, -- 1000%
|
Zerotorescue@62
|
637 step = 0.01, -- 1%
|
Zerotorescue@62
|
638 isPercent = true,
|
Zerotorescue@62
|
639 name = "Bonus queue",
|
Zerotorescue@62
|
640 desc = "Get additional items when there are none left.\n\nExample: if your restock target is set to 60 and this is set to 10%, you will get 66 items instead of just 60 if you end up with none left while queueing.",
|
Zerotorescue@62
|
641 arg = "overrideBonusQueue",
|
Zerotorescue@62
|
642 },
|
Zerotorescue@62
|
643 overridePriceThreshold = {
|
Zerotorescue@62
|
644 order = 39,
|
Zerotorescue@62
|
645 type = "toggle",
|
Zerotorescue@62
|
646 name = "Override price threshold",
|
Zerotorescue@62
|
647 desc = "Allows you to override the price threshold setting for this group.",
|
Zerotorescue@62
|
648 arg = "priceThreshold",
|
Zerotorescue@62
|
649 },
|
Zerotorescue@62
|
650 priceThreshold = {
|
Zerotorescue@62
|
651 order = 40,
|
Zerotorescue@62
|
652 type = "input",
|
Zerotorescue@62
|
653 name = "Price threshold",
|
Zerotorescue@62
|
654 desc = "Only queue craftable items when they are worth at least this much according to your auction house addon.\n\nSet to 0 to ignore auction prices.",
|
Zerotorescue@62
|
655 validate = function(info, value) return addon:ValidateReadableMoney(info, value); end,
|
Zerotorescue@62
|
656 get = function(i) return addon:ReadableMoney(GetOption(i)); end,
|
Zerotorescue@62
|
657 set = function(i, v) SetOption(i, addon:ReadableMoneyToCopper(v)); end,
|
Zerotorescue@62
|
658 arg = "overridePriceThreshold",
|
Zerotorescue@62
|
659 },
|
Zerotorescue@62
|
660 overrideSummaryHidePriceThreshold = {
|
Zerotorescue@62
|
661 order = 49,
|
Zerotorescue@62
|
662 type = "toggle",
|
Zerotorescue@62
|
663 name = "Override summary showing",
|
Zerotorescue@62
|
664 desc = "Allows you to override if items in this group should be hidden from the summary while their value is below the price threshold.",
|
Zerotorescue@62
|
665 arg = "summaryHidePriceThreshold",
|
Zerotorescue@62
|
666 },
|
Zerotorescue@62
|
667 summaryHidePriceThreshold = {
|
Zerotorescue@62
|
668 order = 50,
|
Zerotorescue@62
|
669 type = "toggle",
|
Zerotorescue@62
|
670 name = "Hide when below threshold",
|
Zerotorescue@62
|
671 desc = "Hide items from the summary when their value is below the set price threshold.",
|
Zerotorescue@62
|
672 arg = "overrideSummaryHidePriceThreshold",
|
Zerotorescue@62
|
673 },
|
Zerotorescue@62
|
674 overrideAlwaysGetAuctionValue = {
|
Zerotorescue@62
|
675 order = 59,
|
Zerotorescue@62
|
676 type = "toggle",
|
Zerotorescue@62
|
677 name = "Override auction value showing",
|
Zerotorescue@62
|
678 desc = "Allows you to override if the auction value of items in this group should be cached and displayed even when the price threshold is set to 0|cffeda55fc|r.",
|
Zerotorescue@62
|
679 arg = "alwaysGetAuctionValue",
|
Zerotorescue@62
|
680 },
|
Zerotorescue@62
|
681 alwaysGetAuctionValue = {
|
Zerotorescue@62
|
682 order = 60,
|
Zerotorescue@62
|
683 type = "toggle",
|
Zerotorescue@62
|
684 name = "Always show auction value",
|
Zerotorescue@62
|
685 desc = "Always cache and show the auction value of items in this group, even if the price threshold is set to 0|cffeda55fc|r.",
|
Zerotorescue@62
|
686 arg = "overrideAlwaysGetAuctionValue",
|
Zerotorescue@62
|
687 },
|
Zerotorescue@62
|
688 },
|
Zerotorescue@62
|
689 },
|
Zerotorescue@155
|
690 addons = {
|
Zerotorescue@155
|
691 order = 30,
|
Zerotorescue@155
|
692 type = "group",
|
Zerotorescue@155
|
693 inline = true,
|
Zerotorescue@155
|
694 name = "Prefered addons",
|
Zerotorescue@155
|
695 set = SetOption,
|
Zerotorescue@155
|
696 get = GetOption,
|
Zerotorescue@155
|
697 disabled = GetDisabled,
|
Zerotorescue@155
|
698 args = {
|
Zerotorescue@155
|
699 description = {
|
Zerotorescue@155
|
700 order = 0,
|
Zerotorescue@155
|
701 type = "description",
|
Zerotorescue@155
|
702 name = function(info)
|
Zerotorescue@155
|
703 local groupName = groupIdToName[info[2]];
|
Zerotorescue@155
|
704
|
Zerotorescue@155
|
705 local t = "";
|
Zerotorescue@155
|
706 if not addon.db.profile.defaults.hideHelp then
|
Zerotorescue@155
|
707 t = "Selecting your prefered addons is optional, the first working addon will be used if the selected addon doesn't exist. You only need to set this when you are running multiple addons of a kind and wish to specify which addons to use for what groups.\n\n";
|
Zerotorescue@155
|
708 end
|
Zerotorescue@155
|
709
|
Zerotorescue@155
|
710 local currentAddon, selectedAddonName = addon:GetItemCountAddon(groupName);
|
Zerotorescue@155
|
711 local preferedAddon = addon:GetOptionByKey(groupName, "itemCountAddon");
|
Zerotorescue@155
|
712
|
Zerotorescue@155
|
713 if currentAddon then
|
Zerotorescue@155
|
714 --GetCharacterCount
|
Zerotorescue@155
|
715 --addon.supportedAddons.itemCount[selectedExternalAddon]
|
Zerotorescue@155
|
716 t = t .. "Currently using |cfffed000" .. selectedAddonName .. "|r as your item count addon. This addon is " .. ((currentAddon.IsEnabled() and "|cff00ff00enabled|r") or "|cffff0000disabled|r") .. ".";
|
Zerotorescue@155
|
717
|
Zerotorescue@155
|
718 if currentAddon.GetTotalCount and currentAddon.GetCharacterCount then
|
Zerotorescue@155
|
719 t = t .. " This addon supports |cfffed000both total as local|r item counts.";
|
Zerotorescue@155
|
720 elseif currentAddon.GetTotalCount then
|
Zerotorescue@155
|
721 t = t .. " This addon supports |cfffed000only total|r item counts.";
|
Zerotorescue@155
|
722 elseif currentAddon.GetCharacterCount then
|
Zerotorescue@155
|
723 t = t .. " This addon supports |cfffed000only local|r item counts.";
|
Zerotorescue@155
|
724 end
|
Zerotorescue@155
|
725
|
Zerotorescue@155
|
726 if preferedAddon ~= selectedAddonName then
|
Zerotorescue@216
|
727 t = t .. "\n\n|cffff0000You have selected |cfffed000" .. preferedAddon .. "|r|cffff0000 as your item count addon, but this appears to be disabled and thus the best alternative was selected.|r";
|
Zerotorescue@155
|
728 end
|
Zerotorescue@240
|
729 else
|
Zerotorescue@240
|
730 t = t .. "|cffff0000Warning! No item count addon detected!|r";
|
Zerotorescue@155
|
731 end
|
Zerotorescue@155
|
732
|
Zerotorescue@155
|
733 return t;
|
Zerotorescue@155
|
734 end,
|
Zerotorescue@155
|
735 },
|
Zerotorescue@155
|
736 header = {
|
Zerotorescue@155
|
737 order = 5,
|
Zerotorescue@155
|
738 type = "header",
|
Zerotorescue@155
|
739 name = "",
|
Zerotorescue@155
|
740 hidden = function() return addon.db.profile.defaults.hideHelp; end,
|
Zerotorescue@155
|
741 },
|
Zerotorescue@155
|
742 overrideAuctionPricingAddon = {
|
Zerotorescue@155
|
743 order = 9,
|
Zerotorescue@155
|
744 type = "toggle",
|
Zerotorescue@155
|
745 name = "Override pricing addon",
|
Zerotorescue@155
|
746 desc = "Allows you to override the pricing addon setting for this group.",
|
Zerotorescue@155
|
747 arg = "auctionPricingAddon",
|
Zerotorescue@155
|
748 },
|
Zerotorescue@155
|
749 auctionPricingAddon = {
|
Zerotorescue@155
|
750 order = 10,
|
Zerotorescue@155
|
751 type = "select",
|
Zerotorescue@155
|
752 name = "Prefered pricing addon",
|
Zerotorescue@155
|
753 desc = "Select the addon you prefer data for this group to be retrieved from. A random supported addon will be used if the selected addon can not be found.",
|
Zerotorescue@155
|
754 values = function()
|
Zerotorescue@155
|
755 local temp = {};
|
Zerotorescue@155
|
756 for name, value in pairs(addon.supportedAddons.auctionPricing) do
|
Zerotorescue@155
|
757 temp[name] = name;
|
Zerotorescue@155
|
758 end
|
Zerotorescue@155
|
759
|
Zerotorescue@155
|
760 return temp;
|
Zerotorescue@155
|
761 end,
|
Zerotorescue@155
|
762 set = function(info, value)
|
Zerotorescue@155
|
763 local groupName = groupIdToName[info[2]];
|
Zerotorescue@155
|
764 local optionName = info[#info];
|
Zerotorescue@155
|
765
|
Zerotorescue@155
|
766 addon.db.profile.groups[groupName][optionName] = value ~= "" and value;
|
Zerotorescue@155
|
767
|
Zerotorescue@155
|
768 if addon.supportedAddons.auctionPricing[value].OnSelect then
|
Zerotorescue@155
|
769 addon.supportedAddons.auctionPricing[value].OnSelect();
|
Zerotorescue@155
|
770 end
|
Zerotorescue@155
|
771 end,
|
Zerotorescue@155
|
772 arg = "overrideAuctionPricingAddon",
|
Zerotorescue@155
|
773 },
|
Zerotorescue@155
|
774 overrideItemCountAddon = {
|
Zerotorescue@155
|
775 order = 19,
|
Zerotorescue@155
|
776 type = "toggle",
|
Zerotorescue@155
|
777 name = "Override item count addon",
|
Zerotorescue@155
|
778 desc = "Allows you to override the item count addon setting for this group.",
|
Zerotorescue@155
|
779 arg = "itemCountAddon",
|
Zerotorescue@155
|
780 },
|
Zerotorescue@155
|
781 itemCountAddon = {
|
Zerotorescue@155
|
782 order = 20,
|
Zerotorescue@155
|
783 type = "select",
|
Zerotorescue@155
|
784 name = "Prefered item count addon",
|
Zerotorescue@216
|
785 desc = "Select the addon you prefer data for this group to be retrieved from. The best supported addon will be used if the selected addon can not be found.",
|
Zerotorescue@155
|
786 values = function()
|
Zerotorescue@155
|
787 local temp = {};
|
Zerotorescue@155
|
788 for name, value in pairs(addon.supportedAddons.itemCount) do
|
Zerotorescue@155
|
789 temp[name] = name;
|
Zerotorescue@155
|
790 end
|
Zerotorescue@155
|
791
|
Zerotorescue@155
|
792 return temp;
|
Zerotorescue@155
|
793 end,
|
Zerotorescue@155
|
794 set = function(info, value)
|
Zerotorescue@155
|
795 local groupName = groupIdToName[info[2]];
|
Zerotorescue@155
|
796 local optionName = info[#info];
|
Zerotorescue@155
|
797
|
Zerotorescue@155
|
798 addon.db.profile.groups[groupName][optionName] = value ~= "" and value;
|
Zerotorescue@155
|
799
|
Zerotorescue@155
|
800 if addon.supportedAddons.itemCount[value].OnSelect then
|
Zerotorescue@155
|
801 addon.supportedAddons.itemCount[value].OnSelect();
|
Zerotorescue@155
|
802 end
|
Zerotorescue@155
|
803 end,
|
Zerotorescue@155
|
804 arg = "overrideItemCountAddon",
|
Zerotorescue@155
|
805 },
|
Zerotorescue@155
|
806 overrideCraftingAddon = {
|
Zerotorescue@155
|
807 order = 29,
|
Zerotorescue@155
|
808 type = "toggle",
|
Zerotorescue@155
|
809 name = "Override crafting addon",
|
Zerotorescue@155
|
810 desc = "Allows you to override the crafting addon setting for this group.",
|
Zerotorescue@155
|
811 arg = "craftingAddon",
|
Zerotorescue@155
|
812 },
|
Zerotorescue@155
|
813 craftingAddon = {
|
Zerotorescue@155
|
814 order = 30,
|
Zerotorescue@155
|
815 type = "select",
|
Zerotorescue@155
|
816 name = "Prefered crafting addon",
|
Zerotorescue@155
|
817 desc = "Select the addon you prefer data from this group to be queued into. A random supported addon will be used if the selected addon can not be found.",
|
Zerotorescue@155
|
818 values = function()
|
Zerotorescue@155
|
819 local temp = {};
|
Zerotorescue@155
|
820 for name, value in pairs(addon.supportedAddons.crafting) do
|
Zerotorescue@155
|
821 temp[name] = name;
|
Zerotorescue@155
|
822 end
|
Zerotorescue@155
|
823
|
Zerotorescue@155
|
824 return temp;
|
Zerotorescue@155
|
825 end,
|
Zerotorescue@155
|
826 set = function(info, value)
|
Zerotorescue@155
|
827 local groupName = groupIdToName[info[2]];
|
Zerotorescue@155
|
828 local optionName = info[#info];
|
Zerotorescue@155
|
829
|
Zerotorescue@155
|
830 addon.db.profile.groups[groupName][optionName] = value ~= "" and value;
|
Zerotorescue@155
|
831
|
Zerotorescue@155
|
832 if addon.supportedAddons.crafting[value].OnSelect then
|
Zerotorescue@155
|
833 addon.supportedAddons.crafting[value].OnSelect();
|
Zerotorescue@155
|
834 end
|
Zerotorescue@155
|
835 end,
|
Zerotorescue@155
|
836 arg = "overrideCraftingAddon",
|
Zerotorescue@155
|
837 },
|
Zerotorescue@155
|
838 },
|
Zerotorescue@155
|
839 },
|
Zerotorescue@62
|
840 },
|
Zerotorescue@62
|
841 },
|
Zerotorescue@62
|
842 group = {
|
Zerotorescue@62
|
843 order = 20,
|
Zerotorescue@62
|
844 type = "group",
|
Zerotorescue@62
|
845 name = "Management",
|
Zerotorescue@62
|
846 desc = "Rename, delete, duplicate or export this group.",
|
Zerotorescue@62
|
847 args = {
|
Zerotorescue@62
|
848 actions = {
|
Zerotorescue@62
|
849 order = 10,
|
Zerotorescue@62
|
850 type = "group",
|
Zerotorescue@62
|
851 name = "Actions",
|
Zerotorescue@62
|
852 inline = true,
|
Zerotorescue@62
|
853 args = {
|
Zerotorescue@62
|
854 rename = {
|
Zerotorescue@62
|
855 order = 10,
|
Zerotorescue@62
|
856 type = "input",
|
Zerotorescue@62
|
857 name = "Rename group - New name",
|
Zerotorescue@62
|
858 desc = "Change the name of this group to something else. You can also use item links here as you wish.",
|
Zerotorescue@62
|
859 validate = ValidateGroupName,
|
Zerotorescue@62
|
860 set = function(info, value)
|
Zerotorescue@62
|
861 local oldGroupName = groupIdToName[info[2]];
|
Zerotorescue@62
|
862
|
Zerotorescue@62
|
863 addon.db.profile.groups[value] = CopyTable(addon.db.profile.groups[oldGroupName]);
|
Zerotorescue@62
|
864 addon.db.profile.groups[oldGroupName] = nil;
|
Zerotorescue@62
|
865
|
Zerotorescue@62
|
866 groupIdToName[info[2]] = value;
|
Zerotorescue@62
|
867 groupIdToName[value] = true;
|
Zerotorescue@62
|
868 groupIdToName[oldGroupName] = nil;
|
Zerotorescue@62
|
869
|
Zerotorescue@62
|
870 mod:FillGroupOptions();
|
Zerotorescue@62
|
871 end,
|
Zerotorescue@62
|
872 get = function(info)
|
Zerotorescue@62
|
873 return groupIdToName[info[2]];
|
Zerotorescue@62
|
874 end,
|
Zerotorescue@62
|
875 },
|
Zerotorescue@62
|
876 duplicate = {
|
Zerotorescue@62
|
877 order = 20,
|
Zerotorescue@62
|
878 type = "input",
|
Zerotorescue@62
|
879 name = "Duplicate group - New name",
|
Zerotorescue@62
|
880 desc = "Duplicate this group. You can also use item links here as you wish.\n\nAll item data will be erased.",
|
Zerotorescue@62
|
881 validate = ValidateGroupName,
|
Zerotorescue@62
|
882 set = function(info, value)
|
Zerotorescue@62
|
883 local oldGroupName = groupIdToName[info[2]];
|
Zerotorescue@62
|
884
|
Zerotorescue@62
|
885 addon.db.profile.groups[value] = CopyTable(addon.db.profile.groups[oldGroupName]);
|
Zerotorescue@62
|
886
|
Zerotorescue@62
|
887 -- Reset item data (duplicate items me no want)
|
Zerotorescue@62
|
888 addon.db.profile.groups[value].items = nil;
|
Zerotorescue@62
|
889
|
Zerotorescue@62
|
890 mod:FillGroupOptions();
|
Zerotorescue@62
|
891 end,
|
Zerotorescue@62
|
892 get = false,
|
Zerotorescue@62
|
893 },
|
Zerotorescue@62
|
894 delete = {
|
Zerotorescue@62
|
895 order = 30,
|
Zerotorescue@62
|
896 type = "execute",
|
Zerotorescue@62
|
897 name = "Delete group",
|
Zerotorescue@62
|
898 desc = "Delete the currently selected group.",
|
Zerotorescue@62
|
899 confirm = true,
|
Zerotorescue@62
|
900 confirmText = "Are you sure you wish to |cffff0000DELETE|r this group? This action is not reversable!",
|
Zerotorescue@62
|
901 func = function(info)
|
Zerotorescue@62
|
902 local groupName = groupIdToName[info[2]];
|
Zerotorescue@62
|
903
|
Zerotorescue@62
|
904 addon.db.profile.groups[groupName] = nil;
|
Zerotorescue@62
|
905
|
Zerotorescue@62
|
906 mod:FillGroupOptions();
|
Zerotorescue@62
|
907 end,
|
Zerotorescue@62
|
908 },
|
Zerotorescue@62
|
909 },
|
Zerotorescue@62
|
910 },
|
Zerotorescue@62
|
911 export = {
|
Zerotorescue@62
|
912 order = 40,
|
Zerotorescue@62
|
913 type = "group",
|
Zerotorescue@62
|
914 name = "Export",
|
Zerotorescue@62
|
915 inline = true,
|
Zerotorescue@62
|
916 args = {
|
Zerotorescue@62
|
917 input = {
|
Zerotorescue@62
|
918 order = 10,
|
Zerotorescue@62
|
919 type = "input",
|
Zerotorescue@62
|
920 multiline = true,
|
Zerotorescue@62
|
921 name = "Group data",
|
Zerotorescue@62
|
922 width = "full",
|
Zerotorescue@62
|
923 desc = "Export the group data for the currently selected group. Press CTRL-A to select all and CTRL-C to copy the text.",
|
Zerotorescue@62
|
924 set = false,
|
Zerotorescue@62
|
925 get = function(info)
|
Zerotorescue@62
|
926 local groupName = groupIdToName[info[2]];
|
Zerotorescue@62
|
927
|
Zerotorescue@152
|
928 return mod:ExportGroup(groupName);
|
Zerotorescue@62
|
929 end,
|
Zerotorescue@62
|
930 },
|
Zerotorescue@62
|
931 },
|
Zerotorescue@62
|
932 },
|
Zerotorescue@62
|
933 },
|
Zerotorescue@62
|
934 },
|
Zerotorescue@62
|
935 add = {
|
Zerotorescue@62
|
936 order = 30,
|
Zerotorescue@62
|
937 type = "group",
|
Zerotorescue@62
|
938 name = "Add items",
|
Zerotorescue@62
|
939 desc = "Add new items to this group.",
|
Zerotorescue@62
|
940 hidden = function(info) return groupIsVirtual[info[2]]; end,
|
Zerotorescue@62
|
941 args = {
|
Zerotorescue@62
|
942 singleAdd = {
|
Zerotorescue@62
|
943 order = 10,
|
Zerotorescue@62
|
944 type = "group",
|
Zerotorescue@62
|
945 inline = true,
|
Zerotorescue@62
|
946 name = "Add items",
|
Zerotorescue@62
|
947 args = {
|
Zerotorescue@62
|
948 help = {
|
Zerotorescue@62
|
949 order = 10,
|
Zerotorescue@62
|
950 type = "description",
|
Zerotorescue@62
|
951 name = "You can add a single item to this group at a time by pasting the item-id or an item-link in the field to the left or you can also import multiple items at once by pasting exported item data in the field to the right. Scroll further down to add items based on your inventory contents.",
|
Zerotorescue@106
|
952 hidden = function() return addon.db.profile.defaults.hideHelp; end,
|
Zerotorescue@62
|
953 },
|
Zerotorescue@62
|
954 itemLink = {
|
Zerotorescue@62
|
955 order = 20,
|
Zerotorescue@62
|
956 type = "input",
|
Zerotorescue@62
|
957 name = "Single item add (item-link or item-id)",
|
Zerotorescue@62
|
958 desc = "Shift-click an item-link or enter an item-id to add the related item to this group. You can only add one item link or item id at a time.",
|
Zerotorescue@62
|
959 validate = function(info, value)
|
Zerotorescue@62
|
960 -- If the value is empty we'll allow passing to clear the carret
|
Zerotorescue@62
|
961 if value == "" then return true; end
|
Zerotorescue@62
|
962
|
Zerotorescue@62
|
963 local groupName = groupIdToName[info[2]];
|
Zerotorescue@62
|
964
|
Zerotorescue@76
|
965 local itemId = (addon:GetItemId(string.trim(value)) or tonumber(string.trim(value)));
|
Zerotorescue@76
|
966
|
Zerotorescue@76
|
967 local itemData = addon.ItemData:New(itemId);
|
Zerotorescue@62
|
968
|
Zerotorescue@62
|
969 if not itemId then
|
Zerotorescue@76
|
970 return "This is not a valid item link or id.";
|
Zerotorescue@76
|
971 elseif itemData:InGroup() then
|
Zerotorescue@76
|
972 return ("This item is already in the group |cfffed000%s|r."):format(itemData:InGroup());
|
Zerotorescue@62
|
973 end
|
Zerotorescue@62
|
974
|
Zerotorescue@62
|
975 return true;
|
Zerotorescue@62
|
976 end,
|
Zerotorescue@62
|
977 set = function(info, value)
|
Zerotorescue@62
|
978 if value and value ~= "" then
|
Zerotorescue@62
|
979 local groupName = groupIdToName[info[2]];
|
Zerotorescue@62
|
980
|
Zerotorescue@76
|
981 local itemId = (addon:GetItemId(string.trim(value)) or tonumber(string.trim(value)));
|
Zerotorescue@62
|
982
|
Zerotorescue@76
|
983 local itemData = addon.ItemData:New(itemId);
|
Zerotorescue@76
|
984
|
Zerotorescue@76
|
985 if itemData:AddToGroup(groupName) then
|
Zerotorescue@98
|
986 addon:Print(("Added %s to the selected group."):format( (itemData.link or unknownItemName:format(itemId)) ), addon.Colors.Green);
|
Zerotorescue@76
|
987
|
Zerotorescue@76
|
988 if AceConfigRegistry then
|
Zerotorescue@76
|
989 -- Now rebuild the list
|
Zerotorescue@172
|
990 AceConfigRegistry:NotifyChange("Inventorium");
|
Zerotorescue@76
|
991 end
|
Zerotorescue@76
|
992 else
|
Zerotorescue@98
|
993 addon:Print(("%s is already in the group |cfffed000%s|r."):format( (itemData.link or unknownItemName:format(itemId)), itemData:InGroup() ), addon.Colors.Red);
|
Zerotorescue@76
|
994 end
|
Zerotorescue@62
|
995 end
|
Zerotorescue@62
|
996 end,
|
Zerotorescue@62
|
997 get = false,
|
Zerotorescue@62
|
998 },
|
Zerotorescue@62
|
999 importItemData = {
|
Zerotorescue@62
|
1000 order = 30,
|
Zerotorescue@62
|
1001 type = "input",
|
Zerotorescue@62
|
1002 name = "Import item data",
|
Zerotorescue@62
|
1003 desc = "Import item data from an exported item data-string. Any items already grouped will be skipped.",
|
Zerotorescue@62
|
1004 set = function(info, value)
|
Zerotorescue@62
|
1005 local groupName = groupIdToName[info[2]];
|
Zerotorescue@62
|
1006
|
Zerotorescue@62
|
1007 local allItemIds = { string.split(";", value or "") };
|
Zerotorescue@62
|
1008
|
Zerotorescue@62
|
1009 for _, value in pairs(allItemIds) do
|
Zerotorescue@62
|
1010 local itemId = tonumber(value);
|
Zerotorescue@62
|
1011
|
Zerotorescue@76
|
1012 if itemId then
|
Zerotorescue@76
|
1013 local itemData = addon.ItemData:New(itemId);
|
Zerotorescue@76
|
1014
|
Zerotorescue@76
|
1015 if itemData:InGroup() then
|
Zerotorescue@98
|
1016 addon:Print(("Skipping %s (#%d) as it is already in the group |cfffed000%s|r."):format(itemData.link or "Unknown", itemId, itemData:InGroup()), addon.Colors.Red);
|
Zerotorescue@98
|
1017 addon:Print(("Skipping %s (#%d) as it is already in the group |cfffed000%s|r."):format(itemData.link or "Unknown", itemId, itemData:InGroup()), addon.Colors.Red);
|
Zerotorescue@76
|
1018 elseif itemData:AddToGroup(groupName) then
|
Zerotorescue@98
|
1019 addon:Print(("Added %s to the group |cfffed000%s|r."):format(itemData.link or unknownItemName:format(itemId), groupName), addon.Colors.Green);
|
Zerotorescue@76
|
1020 end
|
Zerotorescue@62
|
1021 else
|
Zerotorescue@98
|
1022 addon:Print(("\"%s\" is not a number."):format(value), addon.Colors.Red);
|
Zerotorescue@62
|
1023 end
|
Zerotorescue@62
|
1024 end
|
Zerotorescue@76
|
1025
|
Zerotorescue@76
|
1026 if AceConfigRegistry then
|
Zerotorescue@76
|
1027 -- Now rebuild the list
|
Zerotorescue@172
|
1028 AceConfigRegistry:NotifyChange("Inventorium");
|
Zerotorescue@76
|
1029 end
|
Zerotorescue@62
|
1030 end,
|
Zerotorescue@62
|
1031 get = false,
|
Zerotorescue@62
|
1032 },
|
Zerotorescue@62
|
1033 importPremadeData = {
|
Zerotorescue@62
|
1034 order = 40,
|
Zerotorescue@62
|
1035 type = "select",
|
Zerotorescue@106
|
1036 width = "double",
|
Zerotorescue@62
|
1037 name = "Import premade data",
|
Zerotorescue@62
|
1038 desc = "Import item data from a premade item-group. Any items already grouped will be skipped.",
|
Zerotorescue@62
|
1039 values = function()
|
Zerotorescue@62
|
1040 local temp = {};
|
Zerotorescue@62
|
1041 for key, group in pairs(addon.defaultGroups) do
|
Zerotorescue@62
|
1042 temp[key] = key;
|
Zerotorescue@62
|
1043 end
|
Zerotorescue@62
|
1044
|
Zerotorescue@62
|
1045 return temp;
|
Zerotorescue@62
|
1046 end,
|
Zerotorescue@62
|
1047 set = function(info, value)
|
Zerotorescue@62
|
1048 local groupName = groupIdToName[info[2]];
|
Zerotorescue@62
|
1049
|
Zerotorescue@161
|
1050 local premadeItemGroup = addon.defaultGroups[value];
|
Zerotorescue@62
|
1051
|
Zerotorescue@161
|
1052 if premadeItemGroup.isParent and premadeItemGroup.childs then
|
Zerotorescue@161
|
1053 for _, premadeItemGroupName in pairs(premadeItemGroup.childs) do
|
Zerotorescue@161
|
1054 ImportPremadeItemsGroup(groupName, premadeItemGroupName);
|
Zerotorescue@62
|
1055 end
|
Zerotorescue@161
|
1056 else
|
Zerotorescue@161
|
1057 ImportPremadeItemsGroup(groupName, value);
|
Zerotorescue@62
|
1058 end
|
Zerotorescue@76
|
1059
|
Zerotorescue@76
|
1060 if AceConfigRegistry then
|
Zerotorescue@76
|
1061 -- Now rebuild the list
|
Zerotorescue@172
|
1062 AceConfigRegistry:NotifyChange("Inventorium");
|
Zerotorescue@76
|
1063 end
|
Zerotorescue@62
|
1064 end,
|
Zerotorescue@62
|
1065 get = false,
|
Zerotorescue@62
|
1066 },
|
Zerotorescue@62
|
1067 },
|
Zerotorescue@62
|
1068 },
|
Zerotorescue@62
|
1069 massAdd = {
|
Zerotorescue@62
|
1070 order = 20,
|
Zerotorescue@62
|
1071 type = "group",
|
Zerotorescue@62
|
1072 inline = true,
|
Zerotorescue@62
|
1073 name = "Mass add",
|
Zerotorescue@62
|
1074 args = {
|
Zerotorescue@62
|
1075 help = {
|
Zerotorescue@62
|
1076 order = 10,
|
Zerotorescue@62
|
1077 type = "description",
|
Zerotorescue@62
|
1078 name = "Click the items you wish to add to this group or add multiple of these items at once by providing a name filter in the field below.",
|
Zerotorescue@106
|
1079 hidden = function() return addon.db.profile.defaults.hideHelp; end,
|
Zerotorescue@62
|
1080 },
|
Zerotorescue@62
|
1081 massAdd = {
|
Zerotorescue@62
|
1082 order = 20,
|
Zerotorescue@62
|
1083 type = "input",
|
Zerotorescue@62
|
1084 name = "Add all items matching...",
|
Zerotorescue@62
|
1085 desc = "Add every item in your inventory matching the name entered in this field. If you enter \"Glyph\" as a filter, any items in your inventory containing this in their name will be added to this group.",
|
Zerotorescue@62
|
1086 set = function(info, value)
|
Zerotorescue@62
|
1087 local groupName = groupIdToName[info[2]];
|
Zerotorescue@62
|
1088
|
Zerotorescue@62
|
1089 if not value then return; end
|
Zerotorescue@62
|
1090
|
Zerotorescue@62
|
1091 value = value:lower();
|
Zerotorescue@62
|
1092
|
Zerotorescue@62
|
1093 local ref = options.args.groups.args[info[2]].args.add.args.list.args;
|
Zerotorescue@62
|
1094
|
Zerotorescue@62
|
1095 for itemId, test in pairs(ref) do
|
Zerotorescue@62
|
1096 if test then
|
Zerotorescue@76
|
1097 local itemData = addon.ItemData:New(itemId);
|
Zerotorescue@62
|
1098
|
Zerotorescue@76
|
1099 if itemData.name:lower():find(value) then
|
Zerotorescue@76
|
1100 if itemData:AddToGroup(groupName) then
|
Zerotorescue@98
|
1101 addon:Print(("Added %s to the selected group."):format( (itemData.link or unknownItemName:format(itemId)) ), addon.Colors.Green);
|
Zerotorescue@76
|
1102 else
|
Zerotorescue@98
|
1103 addon:Print(("Couldn't add %s because it is already in a group."):format(itemData.link or unknownItemName:format(itemId)), addon.Colors.Red);
|
Zerotorescue@62
|
1104 end
|
Zerotorescue@62
|
1105 end
|
Zerotorescue@62
|
1106 end
|
Zerotorescue@62
|
1107 end
|
Zerotorescue@76
|
1108
|
Zerotorescue@76
|
1109 if AceConfigRegistry then
|
Zerotorescue@76
|
1110 -- Now rebuild the list
|
Zerotorescue@172
|
1111 AceConfigRegistry:NotifyChange("Inventorium");
|
Zerotorescue@76
|
1112 end
|
Zerotorescue@62
|
1113 end,
|
Zerotorescue@62
|
1114 get = false,
|
Zerotorescue@62
|
1115 },
|
Zerotorescue@62
|
1116 minItemLevel = {
|
Zerotorescue@62
|
1117 order = 40,
|
Zerotorescue@62
|
1118 type = "select",
|
Zerotorescue@62
|
1119 values = function()
|
Zerotorescue@62
|
1120 local temp = {};
|
Zerotorescue@62
|
1121
|
Zerotorescue@62
|
1122 temp[0] = "Include everything";
|
Zerotorescue@62
|
1123
|
Zerotorescue@62
|
1124 local itemLevelTemplate = "Itemlevel >= %d";
|
Zerotorescue@62
|
1125
|
Zerotorescue@62
|
1126 for i = 1, 49 do
|
Zerotorescue@62
|
1127 temp[( i * 10 )] = itemLevelTemplate:format(( i * 10 ));
|
Zerotorescue@62
|
1128 end
|
Zerotorescue@62
|
1129
|
Zerotorescue@62
|
1130 temp[500] = "Include nothing";
|
Zerotorescue@62
|
1131
|
Zerotorescue@62
|
1132 return temp;
|
Zerotorescue@62
|
1133 end,
|
Zerotorescue@62
|
1134 name = "Include tradeskill items",
|
Zerotorescue@62
|
1135 desc = "Include all items above this item level from the currently opened tradeskill window in the below item list.\n\nSetting this very low this might considerably slow down this config window.\n\nSet to 500 to disable showing of items completely.",
|
Zerotorescue@62
|
1136 set = function(i, v) includeTradeSkillItems = v; end,
|
Zerotorescue@62
|
1137 get = function() return includeTradeSkillItems; end,
|
Zerotorescue@62
|
1138 disabled = function()
|
Zerotorescue@62
|
1139 if GetTradeSkillLine() == "UNKNOWN" then
|
Zerotorescue@62
|
1140 includeTradeSkillItems = 500;
|
Zerotorescue@62
|
1141 return true; -- disabled
|
Zerotorescue@62
|
1142 else
|
Zerotorescue@62
|
1143 return false;
|
Zerotorescue@62
|
1144 end
|
Zerotorescue@62
|
1145 end,
|
Zerotorescue@62
|
1146 },
|
Zerotorescue@62
|
1147 },
|
Zerotorescue@62
|
1148 },
|
Zerotorescue@62
|
1149 list = {
|
Zerotorescue@62
|
1150 order = 30,
|
Zerotorescue@62
|
1151 type = "group",
|
Zerotorescue@62
|
1152 inline = true,
|
Zerotorescue@62
|
1153 name = "Item list",
|
Zerotorescue@62
|
1154 hidden = UpdateAddItemList,
|
Zerotorescue@62
|
1155 args = {
|
Zerotorescue@62
|
1156
|
Zerotorescue@62
|
1157 },
|
Zerotorescue@62
|
1158 },
|
Zerotorescue@62
|
1159 },
|
Zerotorescue@62
|
1160 },
|
Zerotorescue@62
|
1161 remove = {
|
Zerotorescue@62
|
1162 order = 40,
|
Zerotorescue@62
|
1163 type = "group",
|
Zerotorescue@62
|
1164 name = "Current items",
|
Zerotorescue@62
|
1165 desc = "View, export or remove items from this group.",
|
Zerotorescue@62
|
1166 hidden = function(info) return groupIsVirtual[info[2]]; end,
|
Zerotorescue@62
|
1167 args = {
|
Zerotorescue@62
|
1168 help = {
|
Zerotorescue@62
|
1169 order = 10,
|
Zerotorescue@62
|
1170 type = "group",
|
Zerotorescue@62
|
1171 inline = true,
|
Zerotorescue@106
|
1172 name = "Remove items",
|
Zerotorescue@62
|
1173 hidden = false,
|
Zerotorescue@62
|
1174 args = {
|
Zerotorescue@62
|
1175 help = {
|
Zerotorescue@62
|
1176 order = 10,
|
Zerotorescue@62
|
1177 type = "description",
|
Zerotorescue@62
|
1178 name = "Click the items you wish to remove from this group.",
|
Zerotorescue@106
|
1179 hidden = function() return addon.db.profile.defaults.hideHelp; end,
|
Zerotorescue@62
|
1180 },
|
Zerotorescue@62
|
1181 massRemove = {
|
Zerotorescue@62
|
1182 order = 20,
|
Zerotorescue@62
|
1183 type = "input",
|
Zerotorescue@62
|
1184 name = "Remove all items matching...",
|
Zerotorescue@62
|
1185 desc = "Remove every item in this group matching the name entered in this field. If you enter \"Glyph\" as a filter, any items in this group containing this in their name will be removed from this group.",
|
Zerotorescue@62
|
1186 set = function(info, value)
|
Zerotorescue@62
|
1187 local groupName = groupIdToName[info[2]];
|
Zerotorescue@62
|
1188
|
Zerotorescue@62
|
1189 if not value then return; end
|
Zerotorescue@62
|
1190
|
Zerotorescue@62
|
1191 value = value:lower();
|
Zerotorescue@62
|
1192
|
Zerotorescue@62
|
1193 local ref = options.args.groups.args[info[2]].args.remove.args.list.args;
|
Zerotorescue@62
|
1194
|
Zerotorescue@62
|
1195 for itemId, test in pairs(ref) do
|
Zerotorescue@62
|
1196 if test then
|
Zerotorescue@76
|
1197 local itemData = addon.ItemData:New(itemId);
|
Zerotorescue@62
|
1198
|
Zerotorescue@76
|
1199 if itemData.name:lower():find(value) then
|
Zerotorescue@76
|
1200 itemData:RemoveFromGroup(groupName);
|
Zerotorescue@76
|
1201
|
Zerotorescue@98
|
1202 addon:Print(("Removed %s from the selected group."):format( (itemData.link or unknownItemName:format(itemId)) ), addon.Colors.Red);
|
Zerotorescue@62
|
1203 end
|
Zerotorescue@62
|
1204 end
|
Zerotorescue@62
|
1205 end
|
Zerotorescue@62
|
1206
|
Zerotorescue@76
|
1207 if AceConfigRegistry then
|
Zerotorescue@76
|
1208 -- Now rebuild the list
|
Zerotorescue@172
|
1209 AceConfigRegistry:NotifyChange("Inventorium");
|
Zerotorescue@76
|
1210 end
|
Zerotorescue@62
|
1211 end,
|
Zerotorescue@62
|
1212 get = false,
|
Zerotorescue@62
|
1213 },
|
Zerotorescue@62
|
1214 premadeGroups = {
|
Zerotorescue@62
|
1215 order = 30,
|
Zerotorescue@62
|
1216 type = "select",
|
Zerotorescue@106
|
1217 width = "double",
|
Zerotorescue@62
|
1218 name = "Imported premade groups",
|
Zerotorescue@62
|
1219 desc = "This is a list of all premade groups that were imported into this group. You will be notified when any of these premade groups have changed and you will be able to import these changes.\n\nSelect a group to stop reminding you of changes to the premade group (the item list will be unaffected). Doing so will require you to manually update this when new items are added to the game.",
|
Zerotorescue@62
|
1220 values = function(info)
|
Zerotorescue@62
|
1221 local groupName = groupIdToName[info[2]];
|
Zerotorescue@62
|
1222
|
Zerotorescue@62
|
1223 local temp = {};
|
Zerotorescue@76
|
1224 temp[""] = "";
|
Zerotorescue@62
|
1225 if addon.db.profile.groups[groupName].premadeGroups then
|
Zerotorescue@62
|
1226 for name, version in pairs(addon.db.profile.groups[groupName].premadeGroups) do
|
Zerotorescue@62
|
1227 temp[name] = name;
|
Zerotorescue@62
|
1228 end
|
Zerotorescue@62
|
1229 end
|
Zerotorescue@62
|
1230
|
Zerotorescue@62
|
1231 return temp;
|
Zerotorescue@62
|
1232 end,
|
Zerotorescue@62
|
1233 set = function(info, value)
|
Zerotorescue@76
|
1234 if value and value ~= "" then
|
Zerotorescue@76
|
1235 -- Remove premade group from this group
|
Zerotorescue@76
|
1236 local groupName = groupIdToName[info[2]];
|
Zerotorescue@76
|
1237
|
Zerotorescue@76
|
1238 addon.db.profile.groups[groupName].premadeGroups[value] = nil;
|
Zerotorescue@76
|
1239
|
Zerotorescue@98
|
1240 addon:Print(("No longer notifying you about changes made to the premade group named \"|cfffed000%s|r\"."):format(value));
|
Zerotorescue@76
|
1241 end
|
Zerotorescue@62
|
1242 end,
|
Zerotorescue@62
|
1243 get = false,
|
Zerotorescue@62
|
1244 disabled = function(info)
|
Zerotorescue@62
|
1245 local groupName = groupIdToName[info[2]];
|
Zerotorescue@62
|
1246
|
Zerotorescue@62
|
1247 return (not addon.db.profile.groups[groupName].premadeGroups);
|
Zerotorescue@62
|
1248 end,
|
Zerotorescue@62
|
1249 },
|
Zerotorescue@62
|
1250 },
|
Zerotorescue@62
|
1251 },
|
Zerotorescue@62
|
1252 list = {
|
Zerotorescue@62
|
1253 order = 20,
|
Zerotorescue@62
|
1254 type = "group",
|
Zerotorescue@62
|
1255 inline = true,
|
Zerotorescue@62
|
1256 name = "Item list",
|
Zerotorescue@62
|
1257 hidden = UpdateRemoveItemList,
|
Zerotorescue@62
|
1258 args = {
|
Zerotorescue@62
|
1259
|
Zerotorescue@62
|
1260 },
|
Zerotorescue@62
|
1261 },
|
Zerotorescue@62
|
1262 export = {
|
Zerotorescue@62
|
1263 order = 30,
|
Zerotorescue@62
|
1264 type = "group",
|
Zerotorescue@62
|
1265 name = "Export",
|
Zerotorescue@62
|
1266 inline = true,
|
Zerotorescue@62
|
1267 args = {
|
Zerotorescue@62
|
1268 input = {
|
Zerotorescue@62
|
1269 order = 10,
|
Zerotorescue@62
|
1270 type = "input",
|
Zerotorescue@62
|
1271 name = "Item data",
|
Zerotorescue@62
|
1272 width = "full",
|
Zerotorescue@62
|
1273 desc = "Export the item data for the currently selected group. Press CTRL-A to select all and CTRL-C to copy the text.",
|
Zerotorescue@62
|
1274 set = false,
|
Zerotorescue@62
|
1275 get = function(info)
|
Zerotorescue@62
|
1276 local groupName = groupIdToName[info[2]];
|
Zerotorescue@62
|
1277
|
Zerotorescue@62
|
1278 local combinedItemIds;
|
Zerotorescue@62
|
1279 -- Parse items in group and show these
|
Zerotorescue@62
|
1280 for itemId, _ in pairs(addon.db.profile.groups[groupName].items) do
|
Zerotorescue@62
|
1281 if not combinedItemIds then
|
Zerotorescue@62
|
1282 combinedItemIds = tostring(itemId);
|
Zerotorescue@62
|
1283 else
|
Zerotorescue@62
|
1284 combinedItemIds = combinedItemIds .. (";%d"):format(itemId);
|
Zerotorescue@62
|
1285 end
|
Zerotorescue@62
|
1286 end
|
Zerotorescue@62
|
1287
|
Zerotorescue@62
|
1288 return combinedItemIds; -- We don't serialize this because we actually DO want people to be able to manually modify it - besides, parsing it isn't going to be hard
|
Zerotorescue@62
|
1289 end,
|
Zerotorescue@62
|
1290 },
|
Zerotorescue@62
|
1291 },
|
Zerotorescue@62
|
1292 },
|
Zerotorescue@62
|
1293 },
|
Zerotorescue@62
|
1294 },
|
Zerotorescue@62
|
1295 },
|
Zerotorescue@62
|
1296 };
|
Zerotorescue@62
|
1297
|
Zerotorescue@62
|
1298
|
Zerotorescue@62
|
1299
|
Zerotorescue@62
|
1300
|
Zerotorescue@62
|
1301
|
Zerotorescue@62
|
1302
|
Zerotorescue@62
|
1303
|
Zerotorescue@62
|
1304
|
Zerotorescue@62
|
1305
|
Zerotorescue@62
|
1306 -- Object functions
|
Zerotorescue@62
|
1307
|
Zerotorescue@62
|
1308 function mod:OnEnable()
|
Zerotorescue@62
|
1309 -- Register our config slash command
|
Zerotorescue@62
|
1310 -- /im config
|
Zerotorescue@205
|
1311 addon:RegisterSlash(function()
|
Zerotorescue@205
|
1312 if mod:IsFrameOpen() then
|
Zerotorescue@205
|
1313 mod:CloseFrame();
|
Zerotorescue@205
|
1314 else
|
Zerotorescue@205
|
1315 mod:Show();
|
Zerotorescue@62
|
1316 end
|
Zerotorescue@62
|
1317 end, { "c", "config", "conf", "option", "options", "opt", "setting", "settings" }, "|Hfunction:InventoriumCommandHandler:config|h|cff00fff7/im config|r|h (or /im c) - Open the config window to change the settings and manage groups.");
|
Zerotorescue@62
|
1318
|
Zerotorescue@172
|
1319 self:Load(false);
|
Zerotorescue@172
|
1320
|
Zerotorescue@62
|
1321 -- Whenever the profile is changed, update the groups | args: (object for the functionName, eventName, functionName)
|
Zerotorescue@62
|
1322 addon.db.RegisterCallback(self, "OnProfileChanged", "RefreshConfig");
|
Zerotorescue@62
|
1323 addon.db.RegisterCallback(self, "OnProfileCopied", "RefreshConfig");
|
Zerotorescue@62
|
1324 addon.db.RegisterCallback(self, "OnProfileReset", "RefreshConfig");
|
Zerotorescue@62
|
1325
|
Zerotorescue@62
|
1326 -- Register our custom widgets
|
Zerotorescue@62
|
1327 local Widgets = addon:GetModule("Widgets");
|
Zerotorescue@62
|
1328 Widgets:ItemLinkButton();
|
Zerotorescue@62
|
1329 Widgets:ConfigItemLinkButton();
|
Zerotorescue@62
|
1330 end
|
Zerotorescue@62
|
1331
|
Zerotorescue@205
|
1332 function mod:Show()
|
Zerotorescue@205
|
1333 -- We don't want any other windows open at this time.
|
Zerotorescue@205
|
1334 for name, module in addon:IterateModules() do
|
Zerotorescue@205
|
1335 if module.CloseFrame then
|
Zerotorescue@205
|
1336 module:CloseFrame();
|
Zerotorescue@205
|
1337 end
|
Zerotorescue@205
|
1338 end
|
Zerotorescue@205
|
1339
|
Zerotorescue@205
|
1340 self:Load(true);
|
Zerotorescue@205
|
1341
|
Zerotorescue@205
|
1342 AceConfigDialog:Open("Inventorium");
|
Zerotorescue@205
|
1343 end
|
Zerotorescue@205
|
1344
|
Zerotorescue@205
|
1345 function mod:IsFrameOpen()
|
Zerotorescue@205
|
1346 return (AceConfigDialog.OpenFrames["Inventorium"] ~= nil);
|
Zerotorescue@205
|
1347 end
|
Zerotorescue@205
|
1348
|
Zerotorescue@205
|
1349 function mod:CloseFrame()
|
Zerotorescue@205
|
1350 LibStub("AceConfigDialog-3.0"):Close("Inventorium");
|
Zerotorescue@205
|
1351 end
|
Zerotorescue@205
|
1352
|
Zerotorescue@152
|
1353 function mod:ExportGroup(groupName)
|
Zerotorescue@152
|
1354 -- We want to include the group name, so we copy the table then set another value
|
Zerotorescue@152
|
1355 local temp = CopyTable(addon.db.profile.groups[groupName]);
|
Zerotorescue@152
|
1356 temp.name = groupName;
|
Zerotorescue@152
|
1357 temp.trackAtCharacters = nil;
|
Zerotorescue@152
|
1358 temp.overrideTrackAtCharacters = nil;
|
Zerotorescue@176
|
1359 temp.dontAlertAtCharacters = nil;
|
Zerotorescue@176
|
1360 temp.overrideDontAlertAtCharacters = nil;
|
Zerotorescue@152
|
1361
|
Zerotorescue@152
|
1362 if not AceSerializer then
|
Zerotorescue@152
|
1363 AceSerializer = LibStub("AceSerializer-3.0");
|
Zerotorescue@152
|
1364 end
|
Zerotorescue@152
|
1365
|
Zerotorescue@152
|
1366 return AceSerializer:Serialize(temp);
|
Zerotorescue@152
|
1367 end
|
Zerotorescue@152
|
1368
|
Zerotorescue@62
|
1369 function mod:RefreshConfig()
|
Zerotorescue@65
|
1370 self:PremadeGroupsCheck();
|
Zerotorescue@65
|
1371
|
Zerotorescue@62
|
1372 self:FillGroupOptions();
|
Zerotorescue@62
|
1373 end
|
Zerotorescue@62
|
1374
|
Zerotorescue@172
|
1375 function mod:Load(premadeGroupsCheck)
|
Zerotorescue@172
|
1376 if premadeGroupsCheck then
|
Zerotorescue@172
|
1377 self:PremadeGroupsCheck();
|
Zerotorescue@172
|
1378 end
|
Zerotorescue@172
|
1379
|
Zerotorescue@62
|
1380 if not AceConfigDialog and not AceConfigRegistry then
|
Zerotorescue@62
|
1381 self:FillOptions();
|
Zerotorescue@62
|
1382
|
Zerotorescue@62
|
1383 -- Build options dialog
|
Zerotorescue@62
|
1384 AceConfigDialog = LibStub("AceConfigDialog-3.0");
|
Zerotorescue@62
|
1385 AceConfigRegistry = LibStub("AceConfigRegistry-3.0");
|
Zerotorescue@62
|
1386 -- Register options table
|
Zerotorescue@172
|
1387 LibStub("AceConfig-3.0"):RegisterOptionsTable("Inventorium", options);
|
Zerotorescue@62
|
1388 -- Set a nice default size (so that 4 normal sized elements fit next to eachother)
|
Zerotorescue@172
|
1389 AceConfigDialog:SetDefaultSize("Inventorium", 975, 600);
|
Zerotorescue@62
|
1390
|
Zerotorescue@62
|
1391 -- In case the addon is loaded from another condition, always call the remove interface options
|
Zerotorescue@62
|
1392 if AddonLoader and AddonLoader.RemoveInterfaceOptions then
|
Zerotorescue@62
|
1393 AddonLoader:RemoveInterfaceOptions("Inventorium");
|
Zerotorescue@62
|
1394 end
|
Zerotorescue@62
|
1395
|
Zerotorescue@62
|
1396 -- Add to the blizzard addons options thing
|
Zerotorescue@172
|
1397 AceConfigDialog:AddToBlizOptions("Inventorium", "Inventorium");
|
Zerotorescue@62
|
1398 end
|
Zerotorescue@62
|
1399 end
|
Zerotorescue@62
|
1400
|
Zerotorescue@62
|
1401 function mod:FillOptions()
|
Zerotorescue@62
|
1402 options = {
|
Zerotorescue@62
|
1403 type = "group",
|
Zerotorescue@62
|
1404 name = "Inventorium Config",
|
Zerotorescue@62
|
1405 childGroups = "tree",
|
Zerotorescue@62
|
1406 args = {
|
Zerotorescue@62
|
1407 },
|
Zerotorescue@62
|
1408 };
|
Zerotorescue@62
|
1409
|
Zerotorescue@62
|
1410 -- General
|
Zerotorescue@62
|
1411 self:FillGeneralOptions();
|
Zerotorescue@62
|
1412
|
Zerotorescue@62
|
1413 -- Help
|
Zerotorescue@62
|
1414 self:FillHelpOptions();
|
Zerotorescue@62
|
1415
|
Zerotorescue@62
|
1416 -- Profile
|
Zerotorescue@62
|
1417 options.args.profiles = LibStub("AceDBOptions-3.0"):GetOptionsTable(addon.db, true);
|
Zerotorescue@62
|
1418 options.args.profiles.order = 200;
|
Zerotorescue@62
|
1419
|
Zerotorescue@106
|
1420 -- Extra
|
Zerotorescue@106
|
1421 self:FillExtraOptions();
|
Zerotorescue@106
|
1422
|
Zerotorescue@62
|
1423 -- Groups
|
Zerotorescue@62
|
1424 self:MakeGroupOptions();
|
Zerotorescue@62
|
1425
|
Zerotorescue@62
|
1426 -- Groups-contents
|
Zerotorescue@62
|
1427 self:FillGroupOptions();
|
Zerotorescue@62
|
1428 end
|
Zerotorescue@62
|
1429
|
Zerotorescue@62
|
1430 function mod:FillGeneralOptions()
|
Zerotorescue@62
|
1431 options.args.general = {
|
Zerotorescue@62
|
1432 order = 100,
|
Zerotorescue@62
|
1433 type = "group",
|
Zerotorescue@62
|
1434 name = "General",
|
Zerotorescue@62
|
1435 desc = "Change general Inventorium settings.",
|
Zerotorescue@62
|
1436 args = {
|
Zerotorescue@62
|
1437 general = {
|
Zerotorescue@62
|
1438 order = 1,
|
Zerotorescue@62
|
1439 type = "group",
|
Zerotorescue@62
|
1440 inline = true,
|
Zerotorescue@62
|
1441 name = "General",
|
Zerotorescue@62
|
1442 args = {
|
Zerotorescue@62
|
1443 description = {
|
Zerotorescue@62
|
1444 order = 0,
|
Zerotorescue@62
|
1445 type = "description",
|
Zerotorescue@62
|
1446 name = function()
|
Zerotorescue@106
|
1447 local t = "";
|
Zerotorescue@106
|
1448 if not addon.db.profile.defaults.hideHelp then
|
Zerotorescue@155
|
1449 t = "Here you can set general settings. The settings entered here will be used when you choose not to override the settings within an individual group.";
|
Zerotorescue@155
|
1450 end
|
Zerotorescue@155
|
1451
|
Zerotorescue@155
|
1452 return t;
|
Zerotorescue@155
|
1453 end,
|
Zerotorescue@155
|
1454 },
|
Zerotorescue@155
|
1455 header = {
|
Zerotorescue@155
|
1456 order = 5,
|
Zerotorescue@155
|
1457 type = "header",
|
Zerotorescue@155
|
1458 name = "",
|
Zerotorescue@155
|
1459 },
|
Zerotorescue@155
|
1460 trackAtCharacters = {
|
Zerotorescue@155
|
1461 order = 10,
|
Zerotorescue@155
|
1462 type = "multiselect",
|
Zerotorescue@176
|
1463 name = "Track at",
|
Zerotorescue@176
|
1464 desc = "Select at which characters groups should be tracked, appear in the summary or generate alerts.",
|
Zerotorescue@155
|
1465 values = function()
|
Zerotorescue@155
|
1466 local temp = {};
|
Zerotorescue@155
|
1467 for charName in pairs(addon.db.factionrealm.characters) do
|
Zerotorescue@155
|
1468 temp[charName] = charName;
|
Zerotorescue@155
|
1469 end
|
Zerotorescue@155
|
1470
|
Zerotorescue@155
|
1471 return temp;
|
Zerotorescue@155
|
1472 end,
|
Zerotorescue@155
|
1473 get = function(i, v)
|
Zerotorescue@155
|
1474 return addon.db.profile.defaults.trackAtCharacters[v];
|
Zerotorescue@155
|
1475 end,
|
Zerotorescue@155
|
1476 set = function(i, v, e)
|
Zerotorescue@155
|
1477 addon.db.profile.defaults.trackAtCharacters[v] = e or nil;
|
Zerotorescue@155
|
1478 end,
|
Zerotorescue@155
|
1479 dialogControl = "Dropdown", -- this is not standard, normal multiselect control gives us a list of all chars with toggle-boxes. UGLY! We want a multiselect-box instead.
|
Zerotorescue@155
|
1480 },
|
Zerotorescue@176
|
1481 dontAlertAtCharacters = {
|
Zerotorescue@176
|
1482 order = 15,
|
Zerotorescue@176
|
1483 type = "multiselect",
|
Zerotorescue@176
|
1484 name = "Do |cffff0000not|r alert at:",
|
Zerotorescue@176
|
1485 desc = "Select at which characters items in groups should |cffff0000not|r generate alerts when they are below the required stock.",
|
Zerotorescue@176
|
1486 values = function()
|
Zerotorescue@176
|
1487 local temp = {};
|
Zerotorescue@176
|
1488 for charName in pairs(addon.db.factionrealm.characters) do
|
Zerotorescue@176
|
1489 temp[charName] = charName;
|
Zerotorescue@176
|
1490 end
|
Zerotorescue@176
|
1491
|
Zerotorescue@176
|
1492 return temp;
|
Zerotorescue@176
|
1493 end,
|
Zerotorescue@176
|
1494 get = function(i, v)
|
Zerotorescue@176
|
1495 return addon.db.profile.defaults.dontAlertAtCharacters[v];
|
Zerotorescue@176
|
1496 end,
|
Zerotorescue@176
|
1497 set = function(i, v, e)
|
Zerotorescue@176
|
1498 addon.db.profile.defaults.dontAlertAtCharacters[v] = e or nil;
|
Zerotorescue@176
|
1499 end,
|
Zerotorescue@176
|
1500 dialogControl = "Dropdown", -- this is not standard, normal multiselect control gives us a list of all chars with toggle-boxes. UGLY! We want a multiselect-box instead.
|
Zerotorescue@176
|
1501 },
|
Zerotorescue@176
|
1502 --[[stockLevelAlertScanRepeatInterval = {
|
Zerotorescue@176
|
1503 order = 17,
|
Zerotorescue@176
|
1504 type = "multiselect",
|
Zerotorescue@176
|
1505 name = "Stock scan repeat interval",
|
Zerotorescue@176
|
1506 desc = "Select when or how often your stock levels should be checked and show alerts.",
|
Zerotorescue@176
|
1507 values = {
|
Zerotorescue@176
|
1508 ["00Login"] = "At login",
|
Zerotorescue@176
|
1509 ["01Repeat5"] = "Every 5 minutes",
|
Zerotorescue@176
|
1510 ["02Repeat10"] = "Every 10 minutes",
|
Zerotorescue@176
|
1511 ["03Repeat15"] = "Every 15 minutes",
|
Zerotorescue@176
|
1512 ["04Repeat30"] = "Every 30 minutes",
|
Zerotorescue@176
|
1513 ["05Repeat60"] = "Every 1 hour",
|
Zerotorescue@176
|
1514 ["06Repeat120"] = "Every 2 hours",
|
Zerotorescue@176
|
1515 },
|
Zerotorescue@176
|
1516 get = function(i, v) return addon.db.profile.defaults.scanRepeatInterval and addon.db.profile.defaults.scanRepeatInterval[v]; end,
|
Zerotorescue@176
|
1517 set = function(i, v, e) addon.db.profile.defaults.scanRepeatInterval[v] = e; end, -- can't be nil or the defaults will be used
|
Zerotorescue@176
|
1518 dialogControl = "Dropdown", -- this is not standard, normal multiselect control gives us a list of all chars with toggle-boxes. UGLY! We want a multiselect-box instead.
|
Zerotorescue@176
|
1519 },]]
|
Zerotorescue@155
|
1520 localItemData = {
|
Zerotorescue@155
|
1521 order = 20,
|
Zerotorescue@155
|
1522 type = "multiselect",
|
Zerotorescue@155
|
1523 name = "Include in local item data",
|
Zerotorescue@155
|
1524 desc = "Select which data should be included in the local item data.",
|
Zerotorescue@155
|
1525 values = {
|
Zerotorescue@155
|
1526 ["Bag"] = "Bag",
|
Zerotorescue@155
|
1527 ["Bank"] = "Bank",
|
Zerotorescue@155
|
1528 ["Auction House"] = "Auction House",
|
Zerotorescue@155
|
1529 ["Mailbox"] = "Mailbox",
|
Zerotorescue@155
|
1530 },
|
Zerotorescue@155
|
1531 get = function(i, v) return addon.db.profile.defaults.localItemData and addon.db.profile.defaults.localItemData[v]; end,
|
Zerotorescue@155
|
1532 set = function(i, v, e) addon.db.profile.defaults.localItemData[v] = e; end, -- can't be nil or the defaults will be used
|
Zerotorescue@155
|
1533 dialogControl = "Dropdown", -- this is not standard, normal multiselect control gives us a list of all chars with toggle-boxes. UGLY! We want a multiselect-box instead.
|
Zerotorescue@155
|
1534 },
|
Zerotorescue@155
|
1535 },
|
Zerotorescue@155
|
1536 },
|
Zerotorescue@155
|
1537 minimumStock = {
|
Zerotorescue@155
|
1538 order = 10,
|
Zerotorescue@155
|
1539 type = "group",
|
Zerotorescue@155
|
1540 inline = true,
|
Zerotorescue@155
|
1541 name = "Minimum stock",
|
Zerotorescue@155
|
1542 args = {
|
Zerotorescue@155
|
1543 description = {
|
Zerotorescue@155
|
1544 order = 0,
|
Zerotorescue@155
|
1545 type = "description",
|
Zerotorescue@155
|
1546 name = "Here you can specify the default minimum amount of items you wish to keep in stock and related settings. The settings entered here will be used when you choose not to override the settings within an individual group.",
|
Zerotorescue@155
|
1547 hidden = function() return addon.db.profile.defaults.hideHelp; end,
|
Zerotorescue@155
|
1548 },
|
Zerotorescue@155
|
1549 header = {
|
Zerotorescue@155
|
1550 order = 5,
|
Zerotorescue@155
|
1551 type = "header",
|
Zerotorescue@155
|
1552 name = "",
|
Zerotorescue@155
|
1553 hidden = function() return addon.db.profile.defaults.hideHelp; end,
|
Zerotorescue@155
|
1554 },
|
Zerotorescue@176
|
1555
|
Zerotorescue@155
|
1556 minLocalStock = {
|
Zerotorescue@155
|
1557 order = 10,
|
Zerotorescue@155
|
1558 type = "range",
|
Zerotorescue@155
|
1559 min = 0,
|
Zerotorescue@155
|
1560 max = 100000,
|
Zerotorescue@155
|
1561 softMax = 100,
|
Zerotorescue@155
|
1562 step = 1,
|
Zerotorescue@155
|
1563 name = "Minimum local stock",
|
Zerotorescue@155
|
1564 desc = "You can manually enter a value between 100 and 100.000 in the text box below if the provided range is insufficient.",
|
Zerotorescue@155
|
1565 get = function() return addon.db.profile.defaults.minLocalStock; end,
|
Zerotorescue@155
|
1566 set = function(i, v) addon.db.profile.defaults.minLocalStock = v; end,
|
Zerotorescue@155
|
1567 },
|
Zerotorescue@155
|
1568 alertBelowLocalMinimum = {
|
Zerotorescue@155
|
1569 order = 11,
|
Zerotorescue@155
|
1570 type = "toggle",
|
Zerotorescue@181
|
1571 name = "Alert when below local minimum",
|
Zerotorescue@155
|
1572 desc = "Show an alert when this item gets below this threshold.",
|
Zerotorescue@155
|
1573 get = function() return addon.db.profile.defaults.alertBelowLocalMinimum; end,
|
Zerotorescue@155
|
1574 set = function(i, v) addon.db.profile.defaults.alertBelowLocalMinimum = v; end,
|
Zerotorescue@155
|
1575 },
|
Zerotorescue@155
|
1576 autoRefill = {
|
Zerotorescue@155
|
1577 order = 12,
|
Zerotorescue@155
|
1578 type = "toggle",
|
Zerotorescue@155
|
1579 name = "Auto refill from storage",
|
Zerotorescue@155
|
1580 desc = "Automatically refill items from your storage (bank/mailbox - unless this is included in the local count - or the guild bank) when below the minimum local stock.",
|
Zerotorescue@155
|
1581 get = function() return addon.db.profile.defaults.autoRefill; end,
|
Zerotorescue@155
|
1582 set = function(i, v) addon.db.profile.defaults.autoRefill = v; end,
|
Zerotorescue@155
|
1583 },
|
Zerotorescue@184
|
1584 spacer = {
|
Zerotorescue@184
|
1585 order = 19,
|
Zerotorescue@184
|
1586 type = "description",
|
Zerotorescue@184
|
1587 name = "",
|
Zerotorescue@184
|
1588 },
|
Zerotorescue@176
|
1589
|
Zerotorescue@155
|
1590 minGlobalStock = {
|
Zerotorescue@155
|
1591 order = 20,
|
Zerotorescue@155
|
1592 type = "range",
|
Zerotorescue@155
|
1593 min = 0,
|
Zerotorescue@155
|
1594 max = 100000,
|
Zerotorescue@155
|
1595 softMax = 100,
|
Zerotorescue@155
|
1596 step = 1,
|
Zerotorescue@155
|
1597 name = "Minimum global stock",
|
Zerotorescue@155
|
1598 desc = "You can manually enter a value between 100 and 100.000 in the text box below if the provided range is insufficient.",
|
Zerotorescue@155
|
1599 get = function() return addon.db.profile.defaults.minGlobalStock; end,
|
Zerotorescue@155
|
1600 set = function(i, v) addon.db.profile.defaults.minGlobalStock = v; end,
|
Zerotorescue@155
|
1601 },
|
Zerotorescue@155
|
1602 alertBelowGlobalMinimum = {
|
Zerotorescue@155
|
1603 order = 21,
|
Zerotorescue@155
|
1604 type = "toggle",
|
Zerotorescue@181
|
1605 name = "Alert when below global minimum",
|
Zerotorescue@155
|
1606 desc = "Show an alert when this item gets below this threshold.",
|
Zerotorescue@155
|
1607 get = function() return addon.db.profile.defaults.alertBelowGlobalMinimum; end,
|
Zerotorescue@155
|
1608 set = function(i, v) addon.db.profile.defaults.alertBelowGlobalMinimum = v; end,
|
Zerotorescue@155
|
1609 },
|
Zerotorescue@176
|
1610
|
Zerotorescue@155
|
1611 summaryThresholdShow = {
|
Zerotorescue@155
|
1612 order = 30,
|
Zerotorescue@155
|
1613 type = "range",
|
Zerotorescue@155
|
1614 min = 0,
|
Zerotorescue@155
|
1615 max = 100,
|
Zerotorescue@155
|
1616 softMax = 100,
|
Zerotorescue@155
|
1617 step = 0.05,
|
Zerotorescue@155
|
1618 isPercent = true,
|
Zerotorescue@155
|
1619 name = "Show in summary when below",
|
Zerotorescue@155
|
1620 desc = "Show items in the summary when below this percentage of the minimum stock. This can be either below the minimum or the global stock.",
|
Zerotorescue@155
|
1621 get = function() return addon.db.profile.defaults.summaryThresholdShow; end,
|
Zerotorescue@155
|
1622 set = function(i, v) addon.db.profile.defaults.summaryThresholdShow = v; end,
|
Zerotorescue@155
|
1623 },
|
Zerotorescue@155
|
1624 },
|
Zerotorescue@155
|
1625 },
|
Zerotorescue@155
|
1626 refill = {
|
Zerotorescue@155
|
1627 order = 20,
|
Zerotorescue@155
|
1628 type = "group",
|
Zerotorescue@155
|
1629 inline = true,
|
Zerotorescue@155
|
1630 name = "Replenishing stock",
|
Zerotorescue@155
|
1631 args = {
|
Zerotorescue@155
|
1632 description = {
|
Zerotorescue@155
|
1633 order = 0,
|
Zerotorescue@155
|
1634 type = "description",
|
Zerotorescue@155
|
1635 name = function()
|
Zerotorescue@155
|
1636 local r = "Here you can specify the default amount of items to which you wish to restock when you are collecting new items. This may be higher than the minimum stock. The settings entered here will be used when you choose not to override the settings within an individual group.\n\n";
|
Zerotorescue@155
|
1637
|
Zerotorescue@155
|
1638 r = r .. "When restocking the target amount is |cfffed000" .. addon.db.profile.defaults.restockTarget .. "|r of every item. Not queueing craftable items when only missing |cfffed000" .. floor( addon.db.profile.defaults.minCraftingQueue * addon.db.profile.defaults.restockTarget ) .. "|r (|cfffed000" .. ( addon.db.profile.defaults.minCraftingQueue * 100 ) .. "%|r) of the restock target.";
|
Zerotorescue@155
|
1639
|
Zerotorescue@155
|
1640 return r;
|
Zerotorescue@155
|
1641 end,
|
Zerotorescue@155
|
1642 hidden = function() return addon.db.profile.defaults.hideHelp; end,
|
Zerotorescue@155
|
1643 },
|
Zerotorescue@155
|
1644 header = {
|
Zerotorescue@155
|
1645 order = 5,
|
Zerotorescue@155
|
1646 type = "header",
|
Zerotorescue@155
|
1647 name = "",
|
Zerotorescue@155
|
1648 hidden = function() return addon.db.profile.defaults.hideHelp; end,
|
Zerotorescue@155
|
1649 },
|
Zerotorescue@155
|
1650 restockTarget = {
|
Zerotorescue@155
|
1651 order = 10,
|
Zerotorescue@155
|
1652 type = "range",
|
Zerotorescue@155
|
1653 min = 0,
|
Zerotorescue@155
|
1654 max = 100000,
|
Zerotorescue@155
|
1655 softMax = 100,
|
Zerotorescue@155
|
1656 step = 1,
|
Zerotorescue@155
|
1657 name = "Restock target",
|
Zerotorescue@155
|
1658 desc = "You can manually enter a value between 100 and 100.000 in the edit box if the provided range is insufficient.",
|
Zerotorescue@155
|
1659 get = function() return addon.db.profile.defaults.restockTarget; end,
|
Zerotorescue@155
|
1660 set = function(i, v) addon.db.profile.defaults.restockTarget = v; end,
|
Zerotorescue@155
|
1661 },
|
Zerotorescue@155
|
1662 minCraftingQueue = {
|
Zerotorescue@155
|
1663 order = 20,
|
Zerotorescue@155
|
1664 type = "range",
|
Zerotorescue@155
|
1665 min = 0,
|
Zerotorescue@155
|
1666 max = 1,
|
Zerotorescue@155
|
1667 step = 0.01, -- 1%
|
Zerotorescue@155
|
1668 isPercent = true,
|
Zerotorescue@155
|
1669 name = "Don't queue if I only miss",
|
Zerotorescue@155
|
1670 desc = "Don't add a craftable item to the queue if I only miss this much or less of the restock target.\n\nExample: if your restock target is set to 60 and this is set to 5%, an item won't be queued unless you are missing more than 3 of it.",
|
Zerotorescue@155
|
1671 get = function() return addon.db.profile.defaults.minCraftingQueue; end,
|
Zerotorescue@155
|
1672 set = function(i, v) addon.db.profile.defaults.minCraftingQueue = v; end,
|
Zerotorescue@155
|
1673 },
|
Zerotorescue@155
|
1674 bonusQueue = {
|
Zerotorescue@155
|
1675 order = 30,
|
Zerotorescue@155
|
1676 type = "range",
|
Zerotorescue@155
|
1677 min = 0,
|
Zerotorescue@155
|
1678 max = 10, -- 1000%
|
Zerotorescue@155
|
1679 step = 0.01, -- 1%
|
Zerotorescue@155
|
1680 isPercent = true,
|
Zerotorescue@155
|
1681 name = "Bonus queue",
|
Zerotorescue@155
|
1682 desc = "Get additional items when there are none left.\n\nExample: if your restock target is set to 60 and this is set to 10%, you will get 66 items instead of just 60 if you end up with none left while queueing.",
|
Zerotorescue@155
|
1683 get = function() return addon.db.profile.defaults.bonusQueue; end,
|
Zerotorescue@155
|
1684 set = function(i, v) addon.db.profile.defaults.bonusQueue = v; end,
|
Zerotorescue@155
|
1685 },
|
Zerotorescue@155
|
1686 priceThreshold = {
|
Zerotorescue@155
|
1687 order = 40,
|
Zerotorescue@155
|
1688 type = "input",
|
Zerotorescue@155
|
1689 name = "Price threshold",
|
Zerotorescue@155
|
1690 desc = "Only queue craftable items when they are worth at least this much according to your auction house addon.\n\nSet to 0 to ignore auction prices.",
|
Zerotorescue@155
|
1691 validate = function(info, value) return addon:ValidateReadableMoney(info, value); end,
|
Zerotorescue@155
|
1692 get = function() return addon:ReadableMoney(addon.db.profile.defaults.priceThreshold); end,
|
Zerotorescue@155
|
1693 set = function(i, v) addon.db.profile.defaults.priceThreshold = addon:ReadableMoneyToCopper(v); end,
|
Zerotorescue@155
|
1694 },
|
Zerotorescue@155
|
1695 summaryHidePriceThreshold = {
|
Zerotorescue@155
|
1696 order = 50,
|
Zerotorescue@155
|
1697 type = "toggle",
|
Zerotorescue@155
|
1698 name = "Hide when below threshold",
|
Zerotorescue@155
|
1699 desc = "Hide items from the summary when their value is below the set price threshold.",
|
Zerotorescue@155
|
1700 get = function() return addon.db.profile.defaults.summaryHidePriceThreshold; end,
|
Zerotorescue@155
|
1701 set = function(i, v) addon.db.profile.defaults.summaryHidePriceThreshold = v; end,
|
Zerotorescue@155
|
1702 },
|
Zerotorescue@155
|
1703 alwaysGetAuctionValue = {
|
Zerotorescue@155
|
1704 order = 60,
|
Zerotorescue@155
|
1705 type = "toggle",
|
Zerotorescue@155
|
1706 name = "Always show auction value",
|
Zerotorescue@155
|
1707 desc = "Always cache and show the auction value of items, even if the price threshold is set to 0|cffeda55fc|r.",
|
Zerotorescue@155
|
1708 get = function() return addon.db.profile.defaults.alwaysGetAuctionValue; end,
|
Zerotorescue@155
|
1709 set = function(i, v) addon.db.profile.defaults.alwaysGetAuctionValue = v; end,
|
Zerotorescue@155
|
1710 },
|
Zerotorescue@155
|
1711 },
|
Zerotorescue@155
|
1712 },
|
Zerotorescue@155
|
1713 addon = {
|
Zerotorescue@155
|
1714 order = 30,
|
Zerotorescue@155
|
1715 type = "group",
|
Zerotorescue@155
|
1716 inline = true,
|
Zerotorescue@155
|
1717 name = "Prefered addons",
|
Zerotorescue@155
|
1718 args = {
|
Zerotorescue@155
|
1719 description = {
|
Zerotorescue@155
|
1720 order = 0,
|
Zerotorescue@155
|
1721 type = "description",
|
Zerotorescue@155
|
1722 name = function()
|
Zerotorescue@155
|
1723 local t = "";
|
Zerotorescue@155
|
1724 if not addon.db.profile.defaults.hideHelp then
|
Zerotorescue@155
|
1725 t = "Selecting your prefered addons is optional, the first working addon will be used if the selected addon doesn't exist. You only need to set this when you are running multiple addons of a kind and wish to specify which addons to use for what groups.\n\n";
|
Zerotorescue@106
|
1726 end
|
Zerotorescue@62
|
1727
|
Zerotorescue@62
|
1728 local currentAddon, selectedAddonName = addon:GetItemCountAddon();
|
Zerotorescue@62
|
1729 local preferedAddon = addon.db.profile.defaults.itemCountAddon;
|
Zerotorescue@62
|
1730
|
Zerotorescue@62
|
1731 if currentAddon then
|
Zerotorescue@62
|
1732 t = t .. "Currently using |cfffed000" .. selectedAddonName .. "|r as your item count addon. This addon is " .. ((currentAddon.IsEnabled() and "|cff00ff00enabled|r") or "|cffff0000disabled|r") .. ".";
|
Zerotorescue@62
|
1733
|
Zerotorescue@62
|
1734 if currentAddon.GetTotalCount and currentAddon.GetCharacterCount then
|
Zerotorescue@62
|
1735 t = t .. " This addon supports |cfffed000both total as local|r item counts.";
|
Zerotorescue@62
|
1736 elseif currentAddon.GetTotalCount then
|
Zerotorescue@62
|
1737 t = t .. " This addon supports |cfffed000only total|r item counts.";
|
Zerotorescue@62
|
1738 elseif currentAddon.GetCharacterCount then
|
Zerotorescue@62
|
1739 t = t .. " This addon supports |cfffed000only local|r item counts.";
|
Zerotorescue@62
|
1740 end
|
Zerotorescue@62
|
1741
|
Zerotorescue@62
|
1742 if preferedAddon ~= selectedAddonName then
|
Zerotorescue@216
|
1743 t = t .. "\n\n|cffff0000You have selected |cfffed000" .. preferedAddon .. "|r|cffff0000 as your item count addon, but this appears to be disabled and thus the best alternative was selected.|r";
|
Zerotorescue@62
|
1744 end
|
Zerotorescue@240
|
1745 else
|
Zerotorescue@240
|
1746 t = t .. "|cffff0000Warning! No item count addon detected!|r";
|
Zerotorescue@62
|
1747 end
|
Zerotorescue@62
|
1748
|
Zerotorescue@62
|
1749 return t;
|
Zerotorescue@62
|
1750 end,
|
Zerotorescue@62
|
1751 },
|
Zerotorescue@62
|
1752 header = {
|
Zerotorescue@62
|
1753 order = 5,
|
Zerotorescue@62
|
1754 type = "header",
|
Zerotorescue@62
|
1755 name = "",
|
Zerotorescue@62
|
1756 },
|
Zerotorescue@62
|
1757 auctionPricingAddon = {
|
Zerotorescue@62
|
1758 order = 10,
|
Zerotorescue@62
|
1759 type = "select",
|
Zerotorescue@62
|
1760 name = "Prefered pricing addon",
|
Zerotorescue@62
|
1761 desc = "Select the addon you prefer data to be retrieved from. A random supported addon will be used if the selected addon can not be found.",
|
Zerotorescue@62
|
1762 values = function()
|
Zerotorescue@62
|
1763 local temp = {};
|
Zerotorescue@62
|
1764 for name, value in pairs(addon.supportedAddons.auctionPricing) do
|
Zerotorescue@62
|
1765 temp[name] = name;
|
Zerotorescue@62
|
1766 end
|
Zerotorescue@62
|
1767
|
Zerotorescue@62
|
1768 return temp;
|
Zerotorescue@62
|
1769 end,
|
Zerotorescue@62
|
1770 get = function() return addon.db.profile.defaults.auctionPricingAddon; end,
|
Zerotorescue@62
|
1771 set = function(i, v)
|
Zerotorescue@62
|
1772 addon.db.profile.defaults.auctionPricingAddon = v;
|
Zerotorescue@62
|
1773
|
Zerotorescue@62
|
1774 if addon.supportedAddons.auctionPricing[v].OnSelect then
|
Zerotorescue@62
|
1775 addon.supportedAddons.auctionPricing[v].OnSelect();
|
Zerotorescue@62
|
1776 end
|
Zerotorescue@62
|
1777 end,
|
Zerotorescue@62
|
1778 },
|
Zerotorescue@62
|
1779 itemCountAddon = {
|
Zerotorescue@62
|
1780 order = 20,
|
Zerotorescue@62
|
1781 type = "select",
|
Zerotorescue@62
|
1782 name = "Prefered item count addon",
|
Zerotorescue@216
|
1783 desc = "Select the addon you prefer data to be retrieved from. The best supported addon will be used if the selected addon can not be found.",
|
Zerotorescue@62
|
1784 values = function()
|
Zerotorescue@62
|
1785 local temp = {};
|
Zerotorescue@62
|
1786 for name, value in pairs(addon.supportedAddons.itemCount) do
|
Zerotorescue@62
|
1787 temp[name] = name;
|
Zerotorescue@62
|
1788 end
|
Zerotorescue@62
|
1789
|
Zerotorescue@62
|
1790 return temp;
|
Zerotorescue@62
|
1791 end,
|
Zerotorescue@62
|
1792 get = function() return addon.db.profile.defaults.itemCountAddon; end,
|
Zerotorescue@62
|
1793 set = function(i, v)
|
Zerotorescue@62
|
1794 addon.db.profile.defaults.itemCountAddon = v;
|
Zerotorescue@62
|
1795
|
Zerotorescue@62
|
1796 if addon.supportedAddons.itemCount[v].OnSelect then
|
Zerotorescue@62
|
1797 addon.supportedAddons.itemCount[v].OnSelect();
|
Zerotorescue@62
|
1798 end
|
Zerotorescue@62
|
1799 end,
|
Zerotorescue@62
|
1800 },
|
Zerotorescue@62
|
1801 craftingAddon = {
|
Zerotorescue@62
|
1802 order = 30,
|
Zerotorescue@62
|
1803 type = "select",
|
Zerotorescue@62
|
1804 name = "Prefered crafting addon",
|
Zerotorescue@62
|
1805 desc = "Select the addon you prefer data to be queued into. A random supported addon will be used if the selected addon can not be found.",
|
Zerotorescue@62
|
1806 values = function()
|
Zerotorescue@62
|
1807 local temp = {};
|
Zerotorescue@62
|
1808 for name, value in pairs(addon.supportedAddons.crafting) do
|
Zerotorescue@62
|
1809 temp[name] = name;
|
Zerotorescue@62
|
1810 end
|
Zerotorescue@62
|
1811
|
Zerotorescue@62
|
1812 return temp;
|
Zerotorescue@62
|
1813 end,
|
Zerotorescue@62
|
1814 get = function() return addon.db.profile.defaults.craftingAddon; end,
|
Zerotorescue@62
|
1815 set = function(i, v)
|
Zerotorescue@62
|
1816 addon.db.profile.defaults.craftingAddon = v;
|
Zerotorescue@62
|
1817
|
Zerotorescue@62
|
1818 if addon.supportedAddons.crafting[v].OnSelect then
|
Zerotorescue@62
|
1819 addon.supportedAddons.crafting[v].OnSelect();
|
Zerotorescue@62
|
1820 end
|
Zerotorescue@62
|
1821 end,
|
Zerotorescue@62
|
1822 },
|
Zerotorescue@157
|
1823 guildSelection = {
|
Zerotorescue@157
|
1824 order = 40,
|
Zerotorescue@157
|
1825 type = "multiselect",
|
Zerotorescue@157
|
1826 name = "Include guild bank data",
|
Zerotorescue@157
|
1827 desc = "Select which guild data should be included in the item counts.",
|
Zerotorescue@157
|
1828 values = function()
|
Zerotorescue@157
|
1829 local temp = {};
|
Zerotorescue@157
|
1830
|
Zerotorescue@157
|
1831 local currentAddon, selectedAddonName = addon:GetItemCountAddon(groupName);
|
Zerotorescue@157
|
1832
|
Zerotorescue@176
|
1833 if currentAddon and currentAddon.GetGuildNames then
|
Zerotorescue@157
|
1834 local guilds = currentAddon.GetGuildNames();
|
Zerotorescue@157
|
1835
|
Zerotorescue@157
|
1836 if guilds and type(guilds) == "table" then
|
Zerotorescue@157
|
1837 for guildName, state in pairs(guilds) do
|
Zerotorescue@157
|
1838 temp[guildName] = guildName;
|
Zerotorescue@157
|
1839
|
Zerotorescue@157
|
1840 if addon.db.profile.defaults.itemCountGuildsExcluded[guildName] then
|
Zerotorescue@157
|
1841 currentAddon.SetGuildState(guildName, false);
|
Zerotorescue@157
|
1842 else
|
Zerotorescue@157
|
1843 currentAddon.SetGuildState(guildName, true);
|
Zerotorescue@157
|
1844 end
|
Zerotorescue@157
|
1845 end
|
Zerotorescue@157
|
1846 end
|
Zerotorescue@157
|
1847 end
|
Zerotorescue@157
|
1848
|
Zerotorescue@157
|
1849 return temp;
|
Zerotorescue@157
|
1850 end,
|
Zerotorescue@157
|
1851 get = function(i, v)
|
Zerotorescue@157
|
1852 local currentAddon, selectedAddonName = addon:GetItemCountAddon(groupName);
|
Zerotorescue@157
|
1853
|
Zerotorescue@176
|
1854 return currentAddon and currentAddon.GetGuildNames and currentAddon.GetGuildNames()[v];
|
Zerotorescue@157
|
1855 end,
|
Zerotorescue@157
|
1856 set = function(i, v, e)
|
Zerotorescue@157
|
1857 local currentAddon, selectedAddonName = addon:GetItemCountAddon(groupName);
|
Zerotorescue@157
|
1858
|
Zerotorescue@157
|
1859 if e then
|
Zerotorescue@157
|
1860 -- Guild is enabled, so not excluded
|
Zerotorescue@157
|
1861 addon.db.profile.defaults.itemCountGuildsExcluded[v] = nil;
|
Zerotorescue@157
|
1862 else
|
Zerotorescue@157
|
1863 addon.db.profile.defaults.itemCountGuildsExcluded[v] = true; -- this is excluded, excluded is indicated by true
|
Zerotorescue@157
|
1864 end
|
Zerotorescue@157
|
1865
|
Zerotorescue@176
|
1866 if currentAddon and currentAddon.SetGuildState then
|
Zerotorescue@157
|
1867 currentAddon.SetGuildState(v, e);
|
Zerotorescue@157
|
1868 end
|
Zerotorescue@157
|
1869 end, -- can't be nil or the defaults will be used
|
Zerotorescue@157
|
1870 dialogControl = "Dropdown", -- this is not standard, normal multiselect control gives us a list of all chars with toggle-boxes. UGLY! We want a multiselect-box instead.
|
Zerotorescue@157
|
1871 },
|
Zerotorescue@62
|
1872 },
|
Zerotorescue@62
|
1873 },
|
Zerotorescue@106
|
1874 },
|
Zerotorescue@106
|
1875 };
|
Zerotorescue@106
|
1876 end
|
Zerotorescue@106
|
1877
|
Zerotorescue@106
|
1878 function mod:FillExtraOptions()
|
Zerotorescue@189
|
1879 local selectedExportGroups, enableBackupGeneration;
|
Zerotorescue@106
|
1880 options.args.extra = {
|
Zerotorescue@106
|
1881 order = 300,
|
Zerotorescue@106
|
1882 type = "group",
|
Zerotorescue@106
|
1883 name = "Extra",
|
Zerotorescue@106
|
1884 desc = "Change additional (but completely optional) settings.",
|
Zerotorescue@106
|
1885 args = {
|
Zerotorescue@106
|
1886 misc = {
|
Zerotorescue@106
|
1887 order = 10,
|
Zerotorescue@62
|
1888 type = "group",
|
Zerotorescue@62
|
1889 inline = true,
|
Zerotorescue@106
|
1890 name = "Miscellaneous",
|
Zerotorescue@62
|
1891 args = {
|
Zerotorescue@210
|
1892 minimapIcon = {
|
Zerotorescue@210
|
1893 order = 0,
|
Zerotorescue@210
|
1894 type = "toggle",
|
Zerotorescue@210
|
1895 width = "full",
|
Zerotorescue@210
|
1896 name = "Display the minimap icon",
|
Zerotorescue@210
|
1897 desc = "Display the minimap icon for Inventorium allowing functionality to be used without typing slash commands.",
|
Zerotorescue@210
|
1898 get = function() return addon.db.profile.defaults.minimapIcon; end,
|
Zerotorescue@210
|
1899 set = function(i, v)
|
Zerotorescue@210
|
1900 addon.db.profile.defaults.minimapIcon = v;
|
Zerotorescue@210
|
1901
|
Zerotorescue@210
|
1902 if v then
|
Zerotorescue@210
|
1903 addon:GetModule("MinimapIcon"):ShowIcon();
|
Zerotorescue@210
|
1904 else
|
Zerotorescue@210
|
1905 addon:GetModule("MinimapIcon"):HideIcon();
|
Zerotorescue@210
|
1906 end
|
Zerotorescue@210
|
1907 end,
|
Zerotorescue@210
|
1908 },
|
Zerotorescue@106
|
1909 hideHelp = {
|
Zerotorescue@106
|
1910 order = 10,
|
Zerotorescue@106
|
1911 type = "toggle",
|
Zerotorescue@106
|
1912 width = "full",
|
Zerotorescue@106
|
1913 name = "Hide any help tooltips, descriptions and the help config category",
|
Zerotorescue@106
|
1914 desc = "Hide any optional help tooltips, descriptions and the help config category.\n\nPlease note some tooltips may not disappear until next login.",
|
Zerotorescue@106
|
1915 get = function() return addon.db.profile.defaults.hideHelp; end,
|
Zerotorescue@106
|
1916 set = function(i, v) addon.db.profile.defaults.hideHelp = v; end,
|
Zerotorescue@62
|
1917 },
|
Zerotorescue@106
|
1918 autoRefillSkipConfirm = {
|
Zerotorescue@62
|
1919 order = 20,
|
Zerotorescue@106
|
1920 type = "toggle",
|
Zerotorescue@106
|
1921 width = "full",
|
Zerotorescue@131
|
1922 name = "Skip the confirmation window for storage refilling",
|
Zerotorescue@131
|
1923 desc = "Automatically start moving items from the storage (bank, guild bank or mailbox) without showing the confirmation window.",
|
Zerotorescue@106
|
1924 get = function() return addon.db.profile.defaults.autoRefillSkipConfirm; end,
|
Zerotorescue@106
|
1925 set = function(i, v) addon.db.profile.defaults.autoRefillSkipConfirm = v; end,
|
Zerotorescue@76
|
1926 },
|
Zerotorescue@176
|
1927 stockAlertScanInterval = {
|
Zerotorescue@176
|
1928 order = 25,
|
Zerotorescue@176
|
1929 type = "select",
|
Zerotorescue@176
|
1930 width = "double",
|
Zerotorescue@176
|
1931 name = "Stock scan speed",
|
Zerotorescue@176
|
1932 desc = "Select the speed at which items should be scanned for stock alerts. Faster requires more resources and may drastically reduce your frame rate during a scan.",
|
Zerotorescue@176
|
1933 values = {
|
Zerotorescue@184
|
1934 ["0"] = "(Near) instant", -- scans in steps of 100
|
Zerotorescue@184
|
1935 ["0.01"] = "Very fast", -- scans in steps of 2
|
Zerotorescue@176
|
1936 ["0.05"] = "Fast",
|
Zerotorescue@176
|
1937 ["0.1"] = "Default",
|
Zerotorescue@176
|
1938 ["0.2"] = "Medium",
|
Zerotorescue@176
|
1939 ["0.3"] = "Slow",
|
Zerotorescue@176
|
1940 ["0.5"] = "Very slow",
|
Zerotorescue@176
|
1941 },
|
Zerotorescue@176
|
1942 get = function() return addon.db.profile.defaults.scanInterval; end,
|
Zerotorescue@176
|
1943 set = function(i, v) addon.db.profile.defaults.scanInterval = v; end,
|
Zerotorescue@176
|
1944 },
|
Zerotorescue@176
|
1945 spacer = {
|
Zerotorescue@176
|
1946 order = 26,
|
Zerotorescue@176
|
1947 type = "description",
|
Zerotorescue@176
|
1948 name = "",
|
Zerotorescue@176
|
1949 },
|
Zerotorescue@76
|
1950 removeCharacter = {
|
Zerotorescue@106
|
1951 order = 30,
|
Zerotorescue@76
|
1952 type = "select",
|
Zerotorescue@106
|
1953 width = "double",
|
Zerotorescue@106
|
1954 name = "Remove a character from Inventorium's memory",
|
Zerotorescue@76
|
1955 desc = "Select a character to remove all traces of it from Inventorium's memory.\n\nYour current character can not be removed, you must login to a different character to do so.",
|
Zerotorescue@76
|
1956 values = function()
|
Zerotorescue@76
|
1957 local temp = {};
|
Zerotorescue@76
|
1958
|
Zerotorescue@76
|
1959 temp[""] = "";
|
Zerotorescue@76
|
1960
|
Zerotorescue@76
|
1961 local playerName = UnitName("player");
|
Zerotorescue@76
|
1962 for charName in pairs(addon.db.factionrealm.characters) do
|
Zerotorescue@76
|
1963 if playerName ~= charName then
|
Zerotorescue@76
|
1964 temp[charName] = charName;
|
Zerotorescue@76
|
1965 end
|
Zerotorescue@76
|
1966 end
|
Zerotorescue@76
|
1967
|
Zerotorescue@76
|
1968 return temp;
|
Zerotorescue@76
|
1969 end,
|
Zerotorescue@76
|
1970 set = function(i, value)
|
Zerotorescue@76
|
1971 if value and value ~= "" then
|
Zerotorescue@76
|
1972 addon.db.factionrealm.characters[value] = nil;
|
Zerotorescue@76
|
1973 addon.db.profile.defaults.trackAtCharacters[value] = nil;
|
Zerotorescue@176
|
1974 addon.db.profile.defaults.dontAlertAtCharacters[value] = nil;
|
Zerotorescue@76
|
1975 for name, values in pairs(addon.db.profile.groups) do
|
Zerotorescue@76
|
1976 if values.trackAtCharacters then
|
Zerotorescue@76
|
1977 values.trackAtCharacters[name] = nil;
|
Zerotorescue@76
|
1978 end
|
Zerotorescue@176
|
1979
|
Zerotorescue@176
|
1980 if values.dontAlertAtCharacters then
|
Zerotorescue@176
|
1981 values.dontAlertAtCharacters[name] = nil;
|
Zerotorescue@176
|
1982 end
|
Zerotorescue@76
|
1983 end
|
Zerotorescue@76
|
1984 end
|
Zerotorescue@76
|
1985 end,
|
Zerotorescue@76
|
1986 },
|
Zerotorescue@76
|
1987 },
|
Zerotorescue@76
|
1988 },
|
Zerotorescue@106
|
1989 colorCodes = {
|
Zerotorescue@106
|
1990 order = 30,
|
Zerotorescue@106
|
1991 type = "group",
|
Zerotorescue@106
|
1992 inline = true,
|
Zerotorescue@106
|
1993 name = "Color codes",
|
Zerotorescue@106
|
1994 args = {
|
Zerotorescue@106
|
1995 description = {
|
Zerotorescue@106
|
1996 order = 0,
|
Zerotorescue@106
|
1997 type = "description",
|
Zerotorescue@106
|
1998 name = "Change the color code thresholds based on the current stock remaining of the required minimum stock.",
|
Zerotorescue@106
|
1999 hidden = function() return addon.db.profile.defaults.hideHelp; end,
|
Zerotorescue@106
|
2000 },
|
Zerotorescue@106
|
2001 header = {
|
Zerotorescue@106
|
2002 order = 5,
|
Zerotorescue@106
|
2003 type = "header",
|
Zerotorescue@106
|
2004 name = "",
|
Zerotorescue@106
|
2005 hidden = function() return addon.db.profile.defaults.hideHelp; end,
|
Zerotorescue@106
|
2006 },
|
Zerotorescue@106
|
2007 green = {
|
Zerotorescue@106
|
2008 order = 10,
|
Zerotorescue@106
|
2009 type = "range",
|
Zerotorescue@106
|
2010 min = 0,
|
Zerotorescue@106
|
2011 max = 1,
|
Zerotorescue@106
|
2012 step = 0.01,
|
Zerotorescue@106
|
2013 isPercent = true,
|
Zerotorescue@106
|
2014 name = "|cff00ff00Green|r",
|
Zerotorescue@106
|
2015 desc = "Show quantity in green when at least this much of the minimum stock is available.",
|
Zerotorescue@106
|
2016 get = function() return addon.db.profile.defaults.colors.green; end,
|
Zerotorescue@106
|
2017 set = function(i, v) addon.db.profile.defaults.colors.green = v; end,
|
Zerotorescue@106
|
2018 },
|
Zerotorescue@106
|
2019 yellow = {
|
Zerotorescue@106
|
2020 order = 20,
|
Zerotorescue@106
|
2021 type = "range",
|
Zerotorescue@106
|
2022 min = 0,
|
Zerotorescue@106
|
2023 max = 1,
|
Zerotorescue@106
|
2024 step = 0.01,
|
Zerotorescue@106
|
2025 isPercent = true,
|
Zerotorescue@106
|
2026 name = "|cffffff00Yellow|r",
|
Zerotorescue@106
|
2027 desc = "Show quantity in yellow when at least this much of the minimum stock is available.",
|
Zerotorescue@106
|
2028 get = function() return addon.db.profile.defaults.colors.yellow; end,
|
Zerotorescue@106
|
2029 set = function(i, v) addon.db.profile.defaults.colors.yellow = v; end,
|
Zerotorescue@106
|
2030 },
|
Zerotorescue@106
|
2031 orange = {
|
Zerotorescue@106
|
2032 order = 30,
|
Zerotorescue@106
|
2033 type = "range",
|
Zerotorescue@106
|
2034 min = 0,
|
Zerotorescue@106
|
2035 max = 1,
|
Zerotorescue@106
|
2036 step = 0.01,
|
Zerotorescue@106
|
2037 isPercent = true,
|
Zerotorescue@106
|
2038 name = "|cffff9933Orange|r",
|
Zerotorescue@106
|
2039 desc = "Show quantity in orange when at least this much of the minimum stock is available.",
|
Zerotorescue@106
|
2040 get = function() return addon.db.profile.defaults.colors.orange; end,
|
Zerotorescue@106
|
2041 set = function(i, v) addon.db.profile.defaults.colors.orange = v; end,
|
Zerotorescue@106
|
2042 },
|
Zerotorescue@106
|
2043 red = {
|
Zerotorescue@106
|
2044 order = 40,
|
Zerotorescue@106
|
2045 type = "range",
|
Zerotorescue@106
|
2046 min = 0,
|
Zerotorescue@106
|
2047 max = 1,
|
Zerotorescue@106
|
2048 step = 0.01,
|
Zerotorescue@106
|
2049 isPercent = true,
|
Zerotorescue@106
|
2050 name = "|cffff0000Red|r",
|
Zerotorescue@106
|
2051 desc = "Show quantity in red when at least this much of the minimum stock is available.",
|
Zerotorescue@106
|
2052 get = function() return addon.db.profile.defaults.colors.red; end,
|
Zerotorescue@106
|
2053 set = function(i, v) addon.db.profile.defaults.colors.red = v; end,
|
Zerotorescue@106
|
2054 },
|
Zerotorescue@106
|
2055 },
|
Zerotorescue@106
|
2056 },
|
Zerotorescue@189
|
2057 export = {
|
Zerotorescue@189
|
2058 order = 80,
|
Zerotorescue@189
|
2059 type = "group",
|
Zerotorescue@189
|
2060 inline = true,
|
Zerotorescue@189
|
2061 name = "Export groups",
|
Zerotorescue@189
|
2062 args = {
|
Zerotorescue@189
|
2063 description = {
|
Zerotorescue@189
|
2064 order = 0,
|
Zerotorescue@189
|
2065 type = "description",
|
Zerotorescue@189
|
2066 name = "Select the groups you wish to export below. Each group will have any account specific data removed and can safely and freely be shared with other users. All exported groups can be imported at once at the bottom of the \"Groups\" category of the config.",
|
Zerotorescue@189
|
2067 hidden = function() return addon.db.profile.defaults.hideHelp; end,
|
Zerotorescue@189
|
2068 },
|
Zerotorescue@189
|
2069 header = {
|
Zerotorescue@189
|
2070 order = 5,
|
Zerotorescue@189
|
2071 type = "header",
|
Zerotorescue@189
|
2072 name = "",
|
Zerotorescue@189
|
2073 hidden = function() return addon.db.profile.defaults.hideHelp; end,
|
Zerotorescue@189
|
2074 },
|
Zerotorescue@242
|
2075 selectExportGroups = {
|
Zerotorescue@189
|
2076 order = 9,
|
Zerotorescue@189
|
2077 type = "multiselect",
|
Zerotorescue@189
|
2078 name = "Select groups",
|
Zerotorescue@189
|
2079 desc = "Select which groups should be included in the export.",
|
Zerotorescue@189
|
2080 values = function()
|
Zerotorescue@189
|
2081 local temp = {};
|
Zerotorescue@189
|
2082
|
Zerotorescue@189
|
2083 if addon.db.profile.groups then
|
Zerotorescue@189
|
2084 temp["*InverseAll"] = "Inverse";
|
Zerotorescue@189
|
2085
|
Zerotorescue@189
|
2086 for groupName, _ in pairs(addon.db.profile.groups) do
|
Zerotorescue@189
|
2087 temp[groupName] = groupName;
|
Zerotorescue@189
|
2088 end
|
Zerotorescue@189
|
2089 end
|
Zerotorescue@189
|
2090
|
Zerotorescue@189
|
2091 return temp;
|
Zerotorescue@189
|
2092 end,
|
Zerotorescue@189
|
2093 get = function(info, value)
|
Zerotorescue@189
|
2094 --local groupName = groupIdToName[info[2]];
|
Zerotorescue@189
|
2095 --local optionName = info[#info];
|
Zerotorescue@189
|
2096
|
Zerotorescue@189
|
2097 return selectedExportGroups and selectedExportGroups[value];
|
Zerotorescue@189
|
2098 end,
|
Zerotorescue@189
|
2099 set = function(info, name, value)
|
Zerotorescue@189
|
2100 --local groupName = groupIdToName[info[2]];
|
Zerotorescue@189
|
2101 --local optionName = info[#info];
|
Zerotorescue@189
|
2102
|
Zerotorescue@189
|
2103 if not selectedExportGroups then
|
Zerotorescue@189
|
2104 selectedExportGroups = {};
|
Zerotorescue@189
|
2105 end
|
Zerotorescue@189
|
2106
|
Zerotorescue@189
|
2107 if name == "*InverseAll" then
|
Zerotorescue@189
|
2108 for groupName, _ in pairs(addon.db.profile.groups) do
|
Zerotorescue@189
|
2109 if selectedExportGroups and selectedExportGroups[groupName] then
|
Zerotorescue@189
|
2110 selectedExportGroups[groupName] = nil;
|
Zerotorescue@189
|
2111 else
|
Zerotorescue@189
|
2112 selectedExportGroups[groupName] = true;
|
Zerotorescue@189
|
2113 end
|
Zerotorescue@189
|
2114 end
|
Zerotorescue@189
|
2115 else
|
Zerotorescue@189
|
2116 if selectedExportGroups and selectedExportGroups[name] then
|
Zerotorescue@189
|
2117 selectedExportGroups[name] = nil;
|
Zerotorescue@189
|
2118 else
|
Zerotorescue@189
|
2119 selectedExportGroups[name] = true;
|
Zerotorescue@189
|
2120 end
|
Zerotorescue@189
|
2121 end
|
Zerotorescue@189
|
2122 end,
|
Zerotorescue@189
|
2123 },
|
Zerotorescue@189
|
2124 input = {
|
Zerotorescue@189
|
2125 order = 10,
|
Zerotorescue@189
|
2126 type = "input",
|
Zerotorescue@189
|
2127 multiline = true,
|
Zerotorescue@189
|
2128 width = "full",
|
Zerotorescue@189
|
2129 name = "Exported data",
|
Zerotorescue@189
|
2130 desc = "Exported group data for the currently selected group(s). Press CTRL-A to select all and CTRL-C to copy the text.",
|
Zerotorescue@189
|
2131 set = false,
|
Zerotorescue@189
|
2132 get = function()
|
Zerotorescue@189
|
2133 local result = "";
|
Zerotorescue@189
|
2134 if selectedExportGroups then
|
Zerotorescue@189
|
2135 for groupName, v in pairs(selectedExportGroups) do
|
Zerotorescue@189
|
2136 if v then
|
Zerotorescue@189
|
2137 result = result .. mod:ExportGroup(groupName) .. "\n";
|
Zerotorescue@189
|
2138 end
|
Zerotorescue@189
|
2139 end
|
Zerotorescue@189
|
2140 end
|
Zerotorescue@189
|
2141
|
Zerotorescue@189
|
2142 return result;
|
Zerotorescue@189
|
2143 end,
|
Zerotorescue@189
|
2144 },
|
Zerotorescue@189
|
2145 },
|
Zerotorescue@189
|
2146 },
|
Zerotorescue@189
|
2147 backup = {
|
Zerotorescue@189
|
2148 order = 100,
|
Zerotorescue@189
|
2149 type = "group",
|
Zerotorescue@189
|
2150 inline = true,
|
Zerotorescue@189
|
2151 name = "Generate a full backup",
|
Zerotorescue@189
|
2152 args = {
|
Zerotorescue@189
|
2153 description = {
|
Zerotorescue@189
|
2154 order = 0,
|
Zerotorescue@189
|
2155 type = "description",
|
Zerotorescue@189
|
2156 name = "With this you can generate a full backup of all your Inventorium settings. You can store this in a text file on your computer so you can import it at a later time if anything breaks to prevent losing a time consuming setup. You can also use it to share with other users but keep in mind this will include account specific data which you might not want in the wrong hands.",
|
Zerotorescue@189
|
2157 hidden = function() return addon.db.profile.defaults.hideHelp; end,
|
Zerotorescue@189
|
2158 },
|
Zerotorescue@189
|
2159 header = {
|
Zerotorescue@189
|
2160 order = 5,
|
Zerotorescue@189
|
2161 type = "header",
|
Zerotorescue@189
|
2162 name = "",
|
Zerotorescue@189
|
2163 hidden = function() return addon.db.profile.defaults.hideHelp; end,
|
Zerotorescue@189
|
2164 },
|
Zerotorescue@189
|
2165 generate = {
|
Zerotorescue@189
|
2166 order = 9,
|
Zerotorescue@189
|
2167 type = "toggle",
|
Zerotorescue@189
|
2168 width = "full",
|
Zerotorescue@189
|
2169 name = "Generate a full backup (might take a second)",
|
Zerotorescue@189
|
2170 desc = "Generate a full backup. This process might take 1 to 2 seconds.",
|
Zerotorescue@189
|
2171 set = function(_, v)
|
Zerotorescue@189
|
2172 enableBackupGeneration = v;
|
Zerotorescue@189
|
2173 end,
|
Zerotorescue@189
|
2174 get = function()
|
Zerotorescue@189
|
2175 return enableBackupGeneration;
|
Zerotorescue@189
|
2176 end,
|
Zerotorescue@189
|
2177 },
|
Zerotorescue@189
|
2178 input = {
|
Zerotorescue@189
|
2179 order = 10,
|
Zerotorescue@189
|
2180 type = "input",
|
Zerotorescue@189
|
2181 multiline = true,
|
Zerotorescue@189
|
2182 width = "full",
|
Zerotorescue@189
|
2183 name = "Exported data",
|
Zerotorescue@189
|
2184 desc = "Exported backup data. Press CTRL-A to select all and CTRL-C to copy the text.\n\nPlease note this includes character data.",
|
Zerotorescue@189
|
2185 set = false,
|
Zerotorescue@189
|
2186 get = function()
|
Zerotorescue@189
|
2187 if not enableBackupGeneration then
|
Zerotorescue@189
|
2188 return;
|
Zerotorescue@189
|
2189 end
|
Zerotorescue@189
|
2190
|
Zerotorescue@189
|
2191 -- We want to include the group name, so we copy the table then set another value
|
Zerotorescue@189
|
2192 local temp = {
|
Zerotorescue@189
|
2193 ["type"] = "backup",
|
Zerotorescue@189
|
2194 ["global"] = addon.db.global or {},
|
Zerotorescue@189
|
2195 ["profiles"] = addon.db.profiles or {},
|
Zerotorescue@189
|
2196 ["factionrealm"] = addon.db.factionrealm or {},
|
Zerotorescue@189
|
2197 };
|
Zerotorescue@189
|
2198
|
Zerotorescue@189
|
2199 if not AceSerializer then
|
Zerotorescue@189
|
2200 AceSerializer = LibStub("AceSerializer-3.0");
|
Zerotorescue@189
|
2201 end
|
Zerotorescue@189
|
2202
|
Zerotorescue@189
|
2203 return AceSerializer:Serialize(temp);
|
Zerotorescue@189
|
2204 end,
|
Zerotorescue@189
|
2205 },
|
Zerotorescue@189
|
2206 },
|
Zerotorescue@189
|
2207 },
|
Zerotorescue@189
|
2208 importBackup = {
|
Zerotorescue@189
|
2209 order = 101,
|
Zerotorescue@189
|
2210 type = "group",
|
Zerotorescue@189
|
2211 inline = true,
|
Zerotorescue@189
|
2212 name = "Import a full backup",
|
Zerotorescue@189
|
2213 args = {
|
Zerotorescue@189
|
2214 description = {
|
Zerotorescue@189
|
2215 order = 0,
|
Zerotorescue@189
|
2216 type = "description",
|
Zerotorescue@189
|
2217 name = "With this you can import a full backup of all your Inventorium settings. |cffff0000Warning! Importing a backup will TRASH all your current settings and profiles. You are advised to store your own backup prior to importing one.|r",
|
Zerotorescue@189
|
2218 hidden = function() return addon.db.profile.defaults.hideHelp; end,
|
Zerotorescue@189
|
2219 },
|
Zerotorescue@189
|
2220 header = {
|
Zerotorescue@189
|
2221 order = 5,
|
Zerotorescue@189
|
2222 type = "header",
|
Zerotorescue@189
|
2223 name = "",
|
Zerotorescue@189
|
2224 hidden = function() return addon.db.profile.defaults.hideHelp; end,
|
Zerotorescue@189
|
2225 },
|
Zerotorescue@189
|
2226 input = {
|
Zerotorescue@189
|
2227 order = 10,
|
Zerotorescue@189
|
2228 type = "input",
|
Zerotorescue@189
|
2229 multiline = true,
|
Zerotorescue@189
|
2230 width = "full",
|
Zerotorescue@189
|
2231 name = "Paste the backup data here",
|
Zerotorescue@189
|
2232 desc = "Exported backup data. To copy the backup data, press CTRL-A to select all and CTRL-C to copy it. Then click this textblock and hit CTRL-V to paste it.",
|
Zerotorescue@189
|
2233 set = function(_, v)
|
Zerotorescue@189
|
2234 if v and string.trim(v) ~= "" then
|
Zerotorescue@189
|
2235 if not AceSerializer then
|
Zerotorescue@189
|
2236 AceSerializer = LibStub("AceSerializer-3.0");
|
Zerotorescue@189
|
2237 end
|
Zerotorescue@189
|
2238
|
Zerotorescue@189
|
2239 local result, temp = AceSerializer:Deserialize(v);
|
Zerotorescue@189
|
2240
|
Zerotorescue@189
|
2241 if result and temp and type(temp) == "table" and temp.type and temp.type == "backup" then
|
Zerotorescue@189
|
2242 addon.db:ResetDB("TEMPPROFILENAME" .. GetTime());
|
Zerotorescue@189
|
2243
|
Zerotorescue@189
|
2244 local tempProfileName = addon.db:GetCurrentProfile();
|
Zerotorescue@189
|
2245
|
Zerotorescue@189
|
2246 if temp.global then
|
Zerotorescue@189
|
2247 print("Importing |cfffed000global|r data...");
|
Zerotorescue@189
|
2248
|
Zerotorescue@189
|
2249 -- Update by reference, rather than changing the reference
|
Zerotorescue@189
|
2250 for k, v in pairs(temp.global) do
|
Zerotorescue@189
|
2251 addon.db.global[k] = v;
|
Zerotorescue@189
|
2252 end
|
Zerotorescue@189
|
2253 end
|
Zerotorescue@189
|
2254
|
Zerotorescue@189
|
2255 if temp.profiles then
|
Zerotorescue@189
|
2256 print("Importing |cfffed000profiles|r data...");
|
Zerotorescue@189
|
2257
|
Zerotorescue@189
|
2258 -- Update by reference, rather than changing the reference
|
Zerotorescue@189
|
2259 for profileName, profile in pairs(temp.profiles) do
|
Zerotorescue@189
|
2260 print("Importing profile |cfffed000" .. profileName .. "|r...");
|
Zerotorescue@189
|
2261
|
Zerotorescue@189
|
2262 addon.db.profiles[profileName] = profile;
|
Zerotorescue@189
|
2263
|
Zerotorescue@189
|
2264 -- If the current profile is the temp profile, select the first profile in the backup
|
Zerotorescue@189
|
2265 if addon.db:GetCurrentProfile() == tempProfileName or profileName == "Default" then
|
Zerotorescue@189
|
2266 addon.db:SetProfile(profileName);
|
Zerotorescue@189
|
2267 end
|
Zerotorescue@189
|
2268
|
Zerotorescue@189
|
2269 -- If our backup contains a profile with the same name as the temp profile, then don't delete the temp profile
|
Zerotorescue@189
|
2270 if profileName == tempProfileName then
|
Zerotorescue@189
|
2271 tempProfileName = nil;
|
Zerotorescue@189
|
2272 end
|
Zerotorescue@189
|
2273 end
|
Zerotorescue@189
|
2274 end
|
Zerotorescue@189
|
2275
|
Zerotorescue@189
|
2276 -- Delete the temp profile
|
Zerotorescue@189
|
2277 if tempProfileName then
|
Zerotorescue@189
|
2278 addon.db:DeleteProfile(tempProfileName);
|
Zerotorescue@189
|
2279 end
|
Zerotorescue@189
|
2280
|
Zerotorescue@189
|
2281 if temp.factionrealm then
|
Zerotorescue@189
|
2282 print("Importing |cfffed000character|r data...");
|
Zerotorescue@189
|
2283
|
Zerotorescue@189
|
2284 -- Update by reference, rather than changing the reference
|
Zerotorescue@189
|
2285 for k, v in pairs(temp.factionrealm) do
|
Zerotorescue@189
|
2286 addon.db.factionrealm[k] = v;
|
Zerotorescue@189
|
2287 end
|
Zerotorescue@189
|
2288 end
|
Zerotorescue@189
|
2289
|
Zerotorescue@189
|
2290 mod:FillGroupOptions();
|
Zerotorescue@189
|
2291
|
Zerotorescue@189
|
2292 addon:Print("Import finished.", addon.Colors.Green);
|
Zerotorescue@189
|
2293 else
|
Zerotorescue@189
|
2294 addon:Print("The data provided is not supported.", addon.Colors.Red);
|
Zerotorescue@189
|
2295 end
|
Zerotorescue@189
|
2296 else
|
Zerotorescue@189
|
2297 addon:Print("The data provided is not supported.", addon.Colors.Red);
|
Zerotorescue@189
|
2298 end
|
Zerotorescue@189
|
2299 end,
|
Zerotorescue@189
|
2300 get = false,
|
Zerotorescue@189
|
2301 confirm = function() return "Are you sure you wish to override all your current settings with this data?"; end,
|
Zerotorescue@189
|
2302 },
|
Zerotorescue@189
|
2303 },
|
Zerotorescue@189
|
2304 },
|
Zerotorescue@62
|
2305 },
|
Zerotorescue@62
|
2306 };
|
Zerotorescue@62
|
2307 end
|
Zerotorescue@62
|
2308
|
Zerotorescue@62
|
2309 function mod:FillHelpOptions()
|
Zerotorescue@62
|
2310 options.args.help = {
|
Zerotorescue@62
|
2311 order = 150,
|
Zerotorescue@62
|
2312 type = "group",
|
Zerotorescue@106
|
2313 hidden = function() return addon.db.profile.defaults.hideHelp; end,
|
Zerotorescue@62
|
2314 childGroups = "tab",
|
Zerotorescue@62
|
2315 name = "Help",
|
Zerotorescue@62
|
2316 desc = "Useful information for if you're unfamiliar with a part of the addon.",
|
Zerotorescue@62
|
2317 args = {
|
Zerotorescue@62
|
2318 general = {
|
Zerotorescue@62
|
2319 order = 1,
|
Zerotorescue@62
|
2320 type = "group",
|
Zerotorescue@62
|
2321 name = "General",
|
Zerotorescue@62
|
2322 args = {
|
Zerotorescue@62
|
2323 description = {
|
Zerotorescue@62
|
2324 order = 0,
|
Zerotorescue@62
|
2325 type = "description",
|
Zerotorescue@214
|
2326 name = "You can find a |cfffed000User Manual|r inside your addon folder or online at Google Docs (see the addon download page for a link). If you are new to this addon it may be a wealth of information.\n\n" ..
|
Zerotorescue@214
|
2327 "Dropdown boxes that allow you to select more than 1 option should be closed using the \"|cfffed000Close|r\" option at the bottom before switching groups or closing the config. If this dropdown is still opened while switching groups or closing the config, it may cause an error and break the config requiring you to do /reloadui to continue working with the config.\n\n" ..
|
Zerotorescue@214
|
2328 "Please request things you want and report anything that's clunky, weird, vague or otherwise buggy at |cfffed000the Inventorium ticket tracker|r. You can find this by going to the addon page.\n\n" ..
|
Zerotorescue@214
|
2329 "You might notice the summary window currently gets a little slow when refreshed once you get over 200ish items in the list. This is a known issue and the summary window will be rewritten to resolve this somewhere in a future patch.",
|
Zerotorescue@62
|
2330 },
|
Zerotorescue@62
|
2331 },
|
Zerotorescue@62
|
2332 },
|
Zerotorescue@62
|
2333 FAQ = {
|
Zerotorescue@62
|
2334 order = 3,
|
Zerotorescue@62
|
2335 type = "group",
|
Zerotorescue@62
|
2336 name = "FAQ",
|
Zerotorescue@62
|
2337 args = {
|
Zerotorescue@62
|
2338 description = {
|
Zerotorescue@62
|
2339 order = 0,
|
Zerotorescue@62
|
2340 type = "description",
|
Zerotorescue@214
|
2341 name = "|cfffed000My groups don't appear in the summary window.|r\n" ..
|
Zerotorescue@214
|
2342 "Please ensure your current character is toggled on at the \"track at\" option beneath the \"minimum stock\" category within a group or the defaults.\n\n" ..
|
Zerotorescue@214
|
2343
|
Zerotorescue@214
|
2344 "|cfffed000The auction value column always shows a \"-\".|r\n" ..
|
Zerotorescue@214
|
2345 "The auction value will not be cached when you set the \"price threshold\" beneath the \"replenishing stock\" category to |cfffed0000c|r. You can change this behavior by adjusting this value or toggling the \"Always show auction value\" option on.\n\n" ..
|
Zerotorescue@214
|
2346
|
Zerotorescue@214
|
2347 "|cfffed000Some items appear in the \"unqueueable\" frame while I can find them in the profession.|r\n" ..
|
Zerotorescue@214
|
2348 "Old items from before Cataclysm (such as any old gems) may have been renamed and their crafting skill removed. This might have resulted in certain items having the same name as others but with different ids, for example for Smooth King's Amber (search that at Wowhead for more info). Remove both items with the same name and add the one in your profession window again and this should no longer occur.\n\n" ..
|
Zerotorescue@214
|
2349
|
Zerotorescue@214
|
2350 "|cfffed000What use do profiles have?|r\n" ..
|
Zerotorescue@214
|
2351 "Because there is already the \"track at\" option, profiles may not be useful to anyone. Nevertheless someone might find a use for it in some way and thus it is left available. You can use it to test certain things for example without the risk of your main groups being destroyed (although this should never be an excuse not to back up your settings from time to time).\n\n" ..
|
Zerotorescue@214
|
2352
|
Zerotorescue@214
|
2353 "|cfffed000Can you provide me with an example scenario for virtual groups?|r\n" ..
|
Zerotorescue@214
|
2354 "The simplest (and possibly most popular) setup to imagine for using virtual groups are glyphs. There are over 300 glyphs available distributed over 10 classes (or 8 inks). Glyphs for certain classes (such as the tribrids; Druids & Paladins) might sell a lot more often than those for others (such as pure DPS; Hunters, etc.).\n\n" ..
|
Zerotorescue@214
|
2355 "To get an easily adjustable setup you can make one virtual group, called \"Glyphs\" and override all your prefered settings in there. After you are done, make a glyph-group for each class (such as \"Glyphs (Death Knight)\" etc.) and select \"Glyphs\" as virtual group for every one of them (you can easily insert item data to these class specific groups by selecting premade data).\n\n" ..
|
Zerotorescue@214
|
2356 "Now, to change the settings for all glyph groups you can just change the settings within the virtual \"Glyph\" group. To change the settings for one class in particular, such as Paladins because they sell more often than others, you can click this group and override the appropriate settings for just that group. There are many more possibilities for you to find out.\n\n" ..
|
Zerotorescue@62
|
2357 "",
|
Zerotorescue@62
|
2358 },
|
Zerotorescue@62
|
2359 },
|
Zerotorescue@62
|
2360 },
|
Zerotorescue@62
|
2361 },
|
Zerotorescue@62
|
2362 };
|
Zerotorescue@62
|
2363 end
|
Zerotorescue@62
|
2364
|
Zerotorescue@62
|
2365 function mod:MakeGroupOptions()
|
Zerotorescue@242
|
2366 local selectedImportGroups;
|
Zerotorescue@62
|
2367 options.args.groups = {
|
Zerotorescue@62
|
2368 order = 1100,
|
Zerotorescue@62
|
2369 type = "group",
|
Zerotorescue@62
|
2370 name = "Groups",
|
Zerotorescue@62
|
2371 desc = "Change a group.",
|
Zerotorescue@62
|
2372 args = {
|
Zerotorescue@62
|
2373 create = {
|
Zerotorescue@62
|
2374 order = 10,
|
Zerotorescue@62
|
2375 type = "group",
|
Zerotorescue@62
|
2376 inline = true,
|
Zerotorescue@62
|
2377 name = "Create a brand new group",
|
Zerotorescue@62
|
2378 args = {
|
Zerotorescue@62
|
2379 name = {
|
Zerotorescue@62
|
2380 order = 10,
|
Zerotorescue@62
|
2381 type = "input",
|
Zerotorescue@62
|
2382 name = "Group name",
|
Zerotorescue@62
|
2383 desc = "The name of the group. You can also use item links as you wish.",
|
Zerotorescue@62
|
2384 validate = ValidateGroupName,
|
Zerotorescue@62
|
2385 set = function(_, value)
|
Zerotorescue@62
|
2386 addon.db.profile.groups[value] = {};
|
Zerotorescue@62
|
2387 if currentGroupType == "Virtual" then
|
Zerotorescue@62
|
2388 addon.db.profile.groups[value].isVirtual = true;
|
Zerotorescue@62
|
2389 end
|
Zerotorescue@62
|
2390
|
Zerotorescue@62
|
2391 mod:FillGroupOptions();
|
Zerotorescue@62
|
2392 end,
|
Zerotorescue@62
|
2393 get = false,
|
Zerotorescue@62
|
2394 width = "double",
|
Zerotorescue@62
|
2395 },
|
Zerotorescue@62
|
2396 type = {
|
Zerotorescue@62
|
2397 order = 20,
|
Zerotorescue@62
|
2398 type = "select",
|
Zerotorescue@62
|
2399 name = "Type (advanced)",
|
Zerotorescue@62
|
2400 desc = "The type of the new group. This can not be changed at a later time.\n\n|cffff9933This is an advanced option, you will probably not need it unless you manage a lot of groups.|r\n\n|cfffed000Normal|r: A normal group with complete functionality.\n\n|cfffed000Virtual|r: A virtual group which you can use to override the defaults for a set of groups. You can not add items to virtual groups.",
|
Zerotorescue@62
|
2401 values = {
|
Zerotorescue@62
|
2402 ["Normal"] = "Normal",
|
Zerotorescue@62
|
2403 ["Virtual"] = "Virtual",
|
Zerotorescue@62
|
2404 },
|
Zerotorescue@62
|
2405 set = function(_, value) currentGroupType = value; end,
|
Zerotorescue@62
|
2406 get = function() return currentGroupType; end,
|
Zerotorescue@62
|
2407 },
|
Zerotorescue@62
|
2408 },
|
Zerotorescue@62
|
2409 },
|
Zerotorescue@242
|
2410 importExport = {
|
Zerotorescue@62
|
2411 order = 20,
|
Zerotorescue@62
|
2412 type = "group",
|
Zerotorescue@62
|
2413 inline = true,
|
Zerotorescue@242
|
2414 name = "Import a group export",
|
Zerotorescue@62
|
2415 args = {
|
Zerotorescue@242
|
2416 help = {
|
Zerotorescue@242
|
2417 order = 5,
|
Zerotorescue@242
|
2418 type = "description",
|
Zerotorescue@242
|
2419 name = "If you have exported one or more groups (which can be done by clicking a group and opening the management tab or at the middle of the extra tab) you can instantly import them here. These groups will be added if no groups with the same name already exist.",
|
Zerotorescue@242
|
2420 hidden = function() return addon.db.profile.defaults.hideHelp; end,
|
Zerotorescue@242
|
2421 },
|
Zerotorescue@62
|
2422 input = {
|
Zerotorescue@62
|
2423 order = 10,
|
Zerotorescue@62
|
2424 type = "input",
|
Zerotorescue@62
|
2425 multiline = true,
|
Zerotorescue@242
|
2426 name = "Exported group data",
|
Zerotorescue@62
|
2427 desc = "Paste the group data as provided by a group export. If you are trying to import multiple groups at the same time, make sure to use newlines to seperate them.",
|
Zerotorescue@62
|
2428 set = function(info, value)
|
Zerotorescue@62
|
2429 local data = { string.split("\n", value or "") };
|
Zerotorescue@62
|
2430
|
Zerotorescue@62
|
2431 for _, current in pairs(data) do
|
Zerotorescue@152
|
2432 if current and string.trim(current) ~= "" then
|
Zerotorescue@152
|
2433 if not AceSerializer then
|
Zerotorescue@152
|
2434 AceSerializer = LibStub("AceSerializer-3.0");
|
Zerotorescue@152
|
2435 end
|
Zerotorescue@62
|
2436
|
Zerotorescue@152
|
2437 local result, temp = AceSerializer:Deserialize(current);
|
Zerotorescue@152
|
2438
|
Zerotorescue@152
|
2439 if not temp.name then
|
Zerotorescue@152
|
2440 addon:Print("The provided data is not supported.", addon.Colors.Red);
|
Zerotorescue@152
|
2441 elseif ValidateGroupName(nil, temp.name) ~= true then
|
Zerotorescue@152
|
2442 addon:Print(("Aborting: A group named \"%s\" already exists."):format(temp.name), addon.Colors.Red);
|
Zerotorescue@152
|
2443 else
|
Zerotorescue@152
|
2444 local name = temp.name;
|
Zerotorescue@152
|
2445 temp.name = nil;
|
Zerotorescue@152
|
2446 addon:Print(("Importing %s..."):format(name));
|
Zerotorescue@152
|
2447
|
Zerotorescue@152
|
2448 if temp.items then
|
Zerotorescue@152
|
2449 -- Remove items that are already in another group
|
Zerotorescue@152
|
2450 for value, count in pairs(temp.items) do
|
Zerotorescue@152
|
2451 local itemId = tonumber(value);
|
Zerotorescue@152
|
2452
|
Zerotorescue@152
|
2453 local itemData = addon.ItemData:New(itemId);
|
Zerotorescue@152
|
2454
|
Zerotorescue@152
|
2455 if not itemId then
|
Zerotorescue@152
|
2456 addon:Print(("\"%s\" is not a number."):format(value), addon.Colors.Red);
|
Zerotorescue@152
|
2457 temp.items[value] = nil;
|
Zerotorescue@152
|
2458 elseif itemData:InGroup() then
|
Zerotorescue@152
|
2459 addon:Print(("Skipping %s as it is already in the group |cfffed000%s|r."):format( (itemData.link or unknownItemName:format(itemId)), itemData:InGroup() ), addon.Colors.Red);
|
Zerotorescue@152
|
2460 temp.items[value] = nil;
|
Zerotorescue@152
|
2461 else
|
Zerotorescue@152
|
2462 -- Ensure the keys are numeric
|
Zerotorescue@152
|
2463 temp.items[value] = nil;
|
Zerotorescue@152
|
2464 temp.items[itemId] = tonumber(count) or 0;
|
Zerotorescue@152
|
2465 end
|
Zerotorescue@62
|
2466 end
|
Zerotorescue@62
|
2467 end
|
Zerotorescue@152
|
2468
|
Zerotorescue@152
|
2469 -- Ensure this data isn't received (this would be silly/buggy as exports from other accounts - with different characters - won't know what to do with this)
|
Zerotorescue@152
|
2470 temp.trackAtCharacters = nil;
|
Zerotorescue@152
|
2471 temp.overrideTrackAtCharacters = nil;
|
Zerotorescue@176
|
2472 temp.dontAlertAtCharacters = nil;
|
Zerotorescue@176
|
2473 temp.overrideDontAlertAtCharacters = nil;
|
Zerotorescue@152
|
2474
|
Zerotorescue@152
|
2475 addon.db.profile.groups[name] = temp;
|
Zerotorescue@62
|
2476 end
|
Zerotorescue@62
|
2477 end
|
Zerotorescue@62
|
2478 end
|
Zerotorescue@62
|
2479
|
Zerotorescue@62
|
2480 self:FillGroupOptions();
|
Zerotorescue@62
|
2481 end,
|
Zerotorescue@62
|
2482 get = false,
|
Zerotorescue@62
|
2483 width = "full",
|
Zerotorescue@62
|
2484 },
|
Zerotorescue@62
|
2485 },
|
Zerotorescue@62
|
2486 },
|
Zerotorescue@242
|
2487 importFromOtherAddons = {
|
Zerotorescue@242
|
2488 order = 30,
|
Zerotorescue@242
|
2489 type = "group",
|
Zerotorescue@242
|
2490 inline = true,
|
Zerotorescue@242
|
2491 name = "Import groups from other addons",
|
Zerotorescue@242
|
2492 args = {
|
Zerotorescue@242
|
2493 selectImportGroups = {
|
Zerotorescue@242
|
2494 order = 10,
|
Zerotorescue@242
|
2495 type = "multiselect",
|
Zerotorescue@242
|
2496 name = "Select groups",
|
Zerotorescue@242
|
2497 desc = "Select which groups should be imported.",
|
Zerotorescue@242
|
2498 values = function()
|
Zerotorescue@242
|
2499 local temp = {};
|
Zerotorescue@242
|
2500 temp["*InverseAll"] = "Inverse";
|
Zerotorescue@242
|
2501
|
Zerotorescue@242
|
2502 local Ace = LibStub("AceAddon-3.0", true);
|
Zerotorescue@242
|
2503 if Ace then
|
Zerotorescue@242
|
2504 local ZA = Ace:GetAddon("ZeroAuctions", true);
|
Zerotorescue@242
|
2505
|
Zerotorescue@242
|
2506 if ZA then
|
Zerotorescue@242
|
2507 for groupName, contents in pairs(ZA.db.global.groups) do
|
Zerotorescue@242
|
2508 temp["ZeroAuctions$" .. groupName] = string.format("ZA: %s", groupName);
|
Zerotorescue@242
|
2509 end
|
Zerotorescue@242
|
2510 end
|
Zerotorescue@242
|
2511
|
Zerotorescue@242
|
2512 local APM = Ace:GetAddon("AuctionProfitMaster", true);
|
Zerotorescue@242
|
2513
|
Zerotorescue@242
|
2514 if APM then
|
Zerotorescue@242
|
2515 for groupName, contents in pairs(APM.db.global.groups) do
|
Zerotorescue@242
|
2516 temp["AuctionProfitMaster$" .. groupName] = string.format("APM: %s", groupName);
|
Zerotorescue@242
|
2517 end
|
Zerotorescue@242
|
2518 end
|
Zerotorescue@242
|
2519 end
|
Zerotorescue@242
|
2520
|
Zerotorescue@242
|
2521 return temp;
|
Zerotorescue@242
|
2522 end,
|
Zerotorescue@242
|
2523 get = function(info, value)
|
Zerotorescue@242
|
2524 --local groupName = groupIdToName[info[2]];
|
Zerotorescue@242
|
2525 --local optionName = info[#info];
|
Zerotorescue@242
|
2526
|
Zerotorescue@242
|
2527 return selectedImportGroups and selectedImportGroups[value];
|
Zerotorescue@242
|
2528 end,
|
Zerotorescue@242
|
2529 set = function(info, name, value)
|
Zerotorescue@242
|
2530 --local groupName = groupIdToName[info[2]];
|
Zerotorescue@242
|
2531 --local optionName = info[#info];
|
Zerotorescue@242
|
2532
|
Zerotorescue@242
|
2533 if not selectedImportGroups then
|
Zerotorescue@242
|
2534 selectedImportGroups = {};
|
Zerotorescue@242
|
2535 end
|
Zerotorescue@242
|
2536
|
Zerotorescue@242
|
2537 if name == "*InverseAll" then
|
Zerotorescue@242
|
2538 for groupName, _ in pairs(info.option.values()) do
|
Zerotorescue@242
|
2539 if selectedImportGroups and selectedImportGroups[groupName] then
|
Zerotorescue@242
|
2540 selectedImportGroups[groupName] = nil;
|
Zerotorescue@242
|
2541 else
|
Zerotorescue@242
|
2542 selectedImportGroups[groupName] = true;
|
Zerotorescue@242
|
2543 end
|
Zerotorescue@242
|
2544 end
|
Zerotorescue@242
|
2545 else
|
Zerotorescue@242
|
2546 if selectedImportGroups and selectedImportGroups[name] then
|
Zerotorescue@242
|
2547 selectedImportGroups[name] = nil;
|
Zerotorescue@242
|
2548 else
|
Zerotorescue@242
|
2549 selectedImportGroups[name] = true;
|
Zerotorescue@242
|
2550 end
|
Zerotorescue@242
|
2551 end
|
Zerotorescue@242
|
2552 end,
|
Zerotorescue@242
|
2553 },
|
Zerotorescue@242
|
2554 import = {
|
Zerotorescue@242
|
2555 order = 20,
|
Zerotorescue@242
|
2556 type = "execute",
|
Zerotorescue@242
|
2557 name = "Import selected groups",
|
Zerotorescue@242
|
2558 desc = "Import the groups selected above.",
|
Zerotorescue@242
|
2559 func = function(info)
|
Zerotorescue@242
|
2560 -- Go through all selected groups
|
Zerotorescue@242
|
2561 for selection in pairs(selectedImportGroups) do
|
Zerotorescue@242
|
2562 local sourceAddon, groupName = string.match(selection, "^(%a+)\$(.+)$");
|
Zerotorescue@242
|
2563
|
Zerotorescue@242
|
2564 if sourceAddon == "ZeroAuctions" or sourceAddon == "AuctionProfitMaster" then
|
Zerotorescue@242
|
2565 -- ZeroAuctions/AuctionProfitMaster-group
|
Zerotorescue@242
|
2566
|
Zerotorescue@242
|
2567 local ZA = LibStub("AceAddon-3.0"):GetAddon(sourceAddon); -- If it was in the list, we're sure the addon is enabled
|
Zerotorescue@242
|
2568
|
Zerotorescue@242
|
2569 local temp = {};
|
Zerotorescue@242
|
2570
|
Zerotorescue@242
|
2571 do-- Set settings region
|
Zerotorescue@242
|
2572 local currentProfile = ZA.db.profile;
|
Zerotorescue@242
|
2573 if currentProfile then
|
Zerotorescue@242
|
2574 -- Set price threshold
|
Zerotorescue@242
|
2575 local threshold = currentProfile.threshold and currentProfile.threshold[groupName];
|
Zerotorescue@242
|
2576 if threshold then
|
Zerotorescue@242
|
2577 -- Set price threshold
|
Zerotorescue@242
|
2578 temp.overridePriceThreshold = true;
|
Zerotorescue@242
|
2579 temp.priceThreshold = threshold;
|
Zerotorescue@242
|
2580 end
|
Zerotorescue@242
|
2581
|
Zerotorescue@242
|
2582 -- Set minimum global stock, minimum local stock and restock target
|
Zerotorescue@242
|
2583 local postCap = currentProfile.postCap and currentProfile.postCap[groupName];
|
Zerotorescue@242
|
2584 local perAuction = currentProfile.perAuction and currentProfile.perAuction[groupName];
|
Zerotorescue@242
|
2585 if postCap and perAuction then
|
Zerotorescue@242
|
2586 -- Restock target
|
Zerotorescue@242
|
2587 temp.overrideRestockTarget = true;
|
Zerotorescue@242
|
2588 temp.restockTarget = (postCap * perAuction);
|
Zerotorescue@242
|
2589
|
Zerotorescue@242
|
2590 -- Minimum global stock
|
Zerotorescue@242
|
2591 temp.overrideMinGlobalStock = true;
|
Zerotorescue@242
|
2592 temp.minGlobalStock = (postCap * perAuction);
|
Zerotorescue@242
|
2593
|
Zerotorescue@242
|
2594 -- Minimum local stock
|
Zerotorescue@242
|
2595 temp.overrideMinLocalStock = true;
|
Zerotorescue@242
|
2596 temp.minLocalStock = perAuction;
|
Zerotorescue@242
|
2597 end
|
Zerotorescue@242
|
2598 end
|
Zerotorescue@242
|
2599 end
|
Zerotorescue@242
|
2600
|
Zerotorescue@242
|
2601 local items = ZA.db.global.groups[groupName];
|
Zerotorescue@242
|
2602
|
Zerotorescue@242
|
2603 if not groupName or not items then
|
Zerotorescue@242
|
2604 addon:Print("The provided data is not supported.", addon.Colors.Red);
|
Zerotorescue@242
|
2605 elseif ValidateGroupName(nil, groupName) ~= true then
|
Zerotorescue@242
|
2606 addon:Print(("Aborting: A group named \"%s\" already exists."):format(groupName), addon.Colors.Red);
|
Zerotorescue@242
|
2607 else
|
Zerotorescue@242
|
2608 addon:Print(("Importing %s..."):format(groupName));
|
Zerotorescue@242
|
2609
|
Zerotorescue@242
|
2610 temp.items = {};
|
Zerotorescue@242
|
2611
|
Zerotorescue@242
|
2612 if items then
|
Zerotorescue@242
|
2613 -- Remove items that are already in another group
|
Zerotorescue@242
|
2614 for value, _ in pairs(items) do
|
Zerotorescue@242
|
2615 local textItemId = string.match(value, "^item:(%d+)$");
|
Zerotorescue@242
|
2616 local itemId = tonumber(textItemId or "");
|
Zerotorescue@242
|
2617
|
Zerotorescue@242
|
2618 local itemData = addon.ItemData:New(itemId);
|
Zerotorescue@242
|
2619
|
Zerotorescue@242
|
2620 if not itemId then
|
Zerotorescue@242
|
2621 addon:Print(("\"%s\" is not a number."):format(value), addon.Colors.Red);
|
Zerotorescue@242
|
2622 elseif itemData:InGroup() then
|
Zerotorescue@242
|
2623 addon:Print(("Skipping %s as it is already in the group |cfffed000%s|r."):format( (itemData.link or unknownItemName:format(itemId)), itemData:InGroup() ), addon.Colors.Red);
|
Zerotorescue@242
|
2624 else
|
Zerotorescue@242
|
2625 temp.items[itemId] = 0;
|
Zerotorescue@242
|
2626 end
|
Zerotorescue@242
|
2627 end
|
Zerotorescue@242
|
2628 end
|
Zerotorescue@242
|
2629
|
Zerotorescue@242
|
2630 addon.db.profile.groups[groupName] = temp;
|
Zerotorescue@242
|
2631 end
|
Zerotorescue@242
|
2632 end
|
Zerotorescue@242
|
2633 end
|
Zerotorescue@242
|
2634
|
Zerotorescue@242
|
2635 mod:FillGroupOptions();
|
Zerotorescue@242
|
2636 end,
|
Zerotorescue@242
|
2637 },
|
Zerotorescue@242
|
2638 },
|
Zerotorescue@242
|
2639 },
|
Zerotorescue@62
|
2640 },
|
Zerotorescue@62
|
2641 };
|
Zerotorescue@62
|
2642 end
|
Zerotorescue@62
|
2643
|
Zerotorescue@62
|
2644 function mod:FillGroupOptions()
|
Zerotorescue@62
|
2645 for id, name in pairs(groupIdToName) do
|
Zerotorescue@62
|
2646 if type(name) == "string" and not addon.db.profile.groups[name] then
|
Zerotorescue@62
|
2647 options.args.groups.args[id] = nil;
|
Zerotorescue@62
|
2648 groupIdToName[id] = nil;
|
Zerotorescue@62
|
2649 groupIdToName[name] = nil;
|
Zerotorescue@62
|
2650 groupIsVirtual[id] = nil;
|
Zerotorescue@62
|
2651 end
|
Zerotorescue@62
|
2652 end
|
Zerotorescue@62
|
2653
|
Zerotorescue@62
|
2654 for name, values in pairs(addon.db.profile.groups) do
|
Zerotorescue@62
|
2655 if not groupIdToName[name] then
|
Zerotorescue@62
|
2656 options.args.groups.args[tostring(count)] = defaultGroup;
|
Zerotorescue@62
|
2657
|
Zerotorescue@62
|
2658 groupIdToName[tostring(count)] = name;
|
Zerotorescue@62
|
2659 groupIdToName[name] = true;
|
Zerotorescue@62
|
2660 if values.isVirtual then
|
Zerotorescue@62
|
2661 groupIsVirtual[tostring(count)] = true;
|
Zerotorescue@62
|
2662 end
|
Zerotorescue@62
|
2663
|
Zerotorescue@62
|
2664 count = ( count + 1 );
|
Zerotorescue@62
|
2665 end
|
Zerotorescue@62
|
2666 end
|
Zerotorescue@62
|
2667 end
|
Zerotorescue@65
|
2668
|
Zerotorescue@65
|
2669
|
Zerotorescue@65
|
2670
|
Zerotorescue@65
|
2671
|
Zerotorescue@65
|
2672
|
Zerotorescue@65
|
2673
|
Zerotorescue@65
|
2674 -- Verify premade groups
|
Zerotorescue@65
|
2675
|
Zerotorescue@65
|
2676 function mod:PremadeGroupsCheck(updateGroupName, updateKey, accept)
|
Zerotorescue@65
|
2677 -- Compare the current premade groups with those used, notify about changes
|
Zerotorescue@65
|
2678 if addon.defaultGroups then
|
Zerotorescue@65
|
2679 for premadeGroupName, groupInfo in pairs(addon.defaultGroups) do
|
Zerotorescue@65
|
2680 -- Go through all default groups
|
Zerotorescue@65
|
2681
|
Zerotorescue@65
|
2682 for groupName, values in pairs(addon.db.profile.groups) do
|
Zerotorescue@65
|
2683 -- Go through all groups to find those with this premade group
|
Zerotorescue@65
|
2684
|
Zerotorescue@65
|
2685 if values.premadeGroups and values.premadeGroups[premadeGroupName] and values.premadeGroups[premadeGroupName] < groupInfo.version then
|
Zerotorescue@65
|
2686 -- Outdated group
|
Zerotorescue@65
|
2687
|
Zerotorescue@65
|
2688 if updateGroupName and updateKey then
|
Zerotorescue@65
|
2689 -- This function was called after pressing yes or no in a confirm box
|
Zerotorescue@65
|
2690
|
Zerotorescue@65
|
2691 if accept then
|
Zerotorescue@65
|
2692 -- Yes was clicked
|
Zerotorescue@65
|
2693
|
Zerotorescue@65
|
2694 for itemId, version in pairs(groupInfo.items) do
|
Zerotorescue@65
|
2695 -- Go through all items in this premade group
|
Zerotorescue@65
|
2696
|
Zerotorescue@76
|
2697 local itemData = addon.ItemData:New(itemId);
|
Zerotorescue@76
|
2698
|
Zerotorescue@65
|
2699 if version > values.premadeGroups[premadeGroupName] then
|
Zerotorescue@65
|
2700 -- This item was added in a more recent version than this group: Add item
|
Zerotorescue@65
|
2701
|
Zerotorescue@76
|
2702 if itemData:InGroup() then
|
Zerotorescue@98
|
2703 addon:Print(("Skipping %s as it is already in the group |cfffed000%s|r."):format( (itemData.link or unknownItemName:format(itemId)), itemData:InGroup() ));
|
Zerotorescue@76
|
2704 elseif itemData:AddToGroup(groupName) then
|
Zerotorescue@98
|
2705 addon:Print(("Added %s found in the premade group |cfffed000%s|r to the group |cfffed000%s|r."):format( (itemData.link or unknownItemName:format(itemId)), premadeGroupName, itemData:InGroup() ), addon.Colors.Green);
|
Zerotorescue@65
|
2706 end
|
Zerotorescue@65
|
2707 elseif ( version * -1 ) > values.premadeGroups[premadeGroupName] then
|
Zerotorescue@76
|
2708 if itemData:InGroup() == groupName then
|
Zerotorescue@76
|
2709 itemData:RemoveFromGroup(groupName);
|
Zerotorescue@76
|
2710
|
Zerotorescue@98
|
2711 addon:Print(("Removed %s from the group |cfffed000%s|r as it was removed from the premade group |cfffed000%s|r."):format( (itemData.link or unknownItemName:format(itemId)), itemData:InGroup(), premadeGroupName ), addon.Colors.Red);
|
Zerotorescue@65
|
2712 else
|
Zerotorescue@98
|
2713 addon:Print(("Skipping the removal of %s as it isn't in the group |cfffed000%s|r."):format( (itemData.link or unknownItemName:format(itemId)), itemData:InGroup() ));
|
Zerotorescue@65
|
2714 end
|
Zerotorescue@65
|
2715 end
|
Zerotorescue@65
|
2716 end
|
Zerotorescue@65
|
2717
|
Zerotorescue@76
|
2718 if AceConfigRegistry then
|
Zerotorescue@76
|
2719 -- Now rebuild the list
|
Zerotorescue@172
|
2720 AceConfigRegistry:NotifyChange("Inventorium");
|
Zerotorescue@76
|
2721 end
|
Zerotorescue@76
|
2722
|
Zerotorescue@65
|
2723 -- Remember the new version
|
Zerotorescue@65
|
2724 values.premadeGroups[premadeGroupName] = groupInfo.version;
|
Zerotorescue@65
|
2725 else
|
Zerotorescue@65
|
2726 -- No was clicked
|
Zerotorescue@65
|
2727
|
Zerotorescue@65
|
2728 -- Let user know what was not added
|
Zerotorescue@65
|
2729 for itemId, version in pairs(groupInfo.items) do
|
Zerotorescue@65
|
2730 -- Go through all items in this premade group
|
Zerotorescue@65
|
2731
|
Zerotorescue@76
|
2732 local itemData = addon.ItemData:New(itemId);
|
Zerotorescue@76
|
2733
|
Zerotorescue@65
|
2734 if version > values.premadeGroups[premadeGroupName] then
|
Zerotorescue@65
|
2735 -- This item was added in a more recent version than this group: don't add (since we clicked no), but announce it
|
Zerotorescue@65
|
2736
|
Zerotorescue@98
|
2737 addon:Print(("Skipping %s found in the premade group |cfffed000%s|r."):format( (itemData.link or unknownItemName:format(itemId)), itemData:InGroup() ));
|
Zerotorescue@65
|
2738 end
|
Zerotorescue@65
|
2739 end
|
Zerotorescue@65
|
2740
|
Zerotorescue@65
|
2741 -- Remember the new version
|
Zerotorescue@65
|
2742 values.premadeGroups[premadeGroupName] = groupInfo.version;
|
Zerotorescue@65
|
2743 end
|
Zerotorescue@65
|
2744 else
|
Zerotorescue@65
|
2745 StaticPopupDialogs["InventoriumConfirmUpdatePremadeGroup"] = {
|
Zerotorescue@65
|
2746 text = "The premade group |cfffed000%s|r used in the group |cfffed000%s|r has been changed. Do you wish to copy these changes?",
|
Zerotorescue@65
|
2747 button1 = YES,
|
Zerotorescue@65
|
2748 button2 = NO,
|
Zerotorescue@65
|
2749 OnAccept = function()
|
Zerotorescue@131
|
2750 mod:PremadeGroupsCheck(groupName, premadeGroupName, true);
|
Zerotorescue@65
|
2751 end,
|
Zerotorescue@65
|
2752 OnCancel = function(_, _, reason)
|
Zerotorescue@65
|
2753 if reason == "clicked" then
|
Zerotorescue@131
|
2754 mod:PremadeGroupsCheck(groupName, premadeGroupName, false);
|
Zerotorescue@65
|
2755 end
|
Zerotorescue@65
|
2756 end,
|
Zerotorescue@65
|
2757 timeout = 0,
|
Zerotorescue@65
|
2758 whileDead = 1,
|
Zerotorescue@65
|
2759 hideOnEscape = 1,
|
Zerotorescue@65
|
2760 };
|
Zerotorescue@65
|
2761 StaticPopup_Show("InventoriumConfirmUpdatePremadeGroup", premadeGroupName, groupName);
|
Zerotorescue@65
|
2762
|
Zerotorescue@65
|
2763 return;
|
Zerotorescue@65
|
2764 end
|
Zerotorescue@65
|
2765 end
|
Zerotorescue@65
|
2766 end
|
Zerotorescue@65
|
2767 end
|
Zerotorescue@65
|
2768 end
|
Zerotorescue@65
|
2769 end
|