Zerotorescue@11
|
1 -- You can access this addon's object through: LibStub("AceAddon-3.0"):GetAddon("Inventorium")
|
Zerotorescue@17
|
2 local addon = select(2, ...);
|
Zerotorescue@17
|
3 addon = LibStub("AceAddon-3.0"):NewAddon(addon, "Inventorium", "AceEvent-3.0");
|
Zerotorescue@1
|
4
|
Zerotorescue@1
|
5 local AceGUI = LibStub("AceGUI-3.0");
|
Zerotorescue@0
|
6
|
Zerotorescue@0
|
7 local AceConfigDialog, AceConfigRegistry, AceSerializer;
|
Zerotorescue@30
|
8 local groupIdToName, groupIsVirtual, options = {}, {}, {};
|
Zerotorescue@13
|
9 local includeTradeSkillItems = 500;
|
Zerotorescue@13
|
10
|
Zerotorescue@13
|
11 -- All modules must be able to retrieve our supported addons database, thus keep it public
|
Zerotorescue@13
|
12 addon.supportedAddons = {};
|
Zerotorescue@13
|
13 addon.supportedAddons.auctionPricing = {};
|
Zerotorescue@13
|
14 addon.supportedAddons.itemCount = {};
|
Zerotorescue@13
|
15 addon.supportedAddons.crafting = {};
|
Zerotorescue@0
|
16
|
Zerotorescue@0
|
17 function addon:OnInitialize()
|
Zerotorescue@0
|
18 self:Debug("OnInitialize");
|
Zerotorescue@0
|
19
|
Zerotorescue@0
|
20 -- SAVED VARIABLES
|
Zerotorescue@0
|
21
|
Zerotorescue@0
|
22 local defaults = {
|
Zerotorescue@0
|
23 global = {
|
Zerotorescue@0
|
24 groups = {},
|
Zerotorescue@0
|
25 defaults = {
|
Zerotorescue@13
|
26 auctionPricingAddon = "Auctioneer",
|
Zerotorescue@13
|
27 itemCountAddon = "Altoholic",
|
Zerotorescue@13
|
28 craftingAddon = "AdvancedTradeSkillWindow",
|
Zerotorescue@0
|
29 minimumStock = 60,
|
Zerotorescue@0
|
30 alertBelowMinimum = true,
|
Zerotorescue@0
|
31 summaryThresholdShow = 10,
|
Zerotorescue@0
|
32 restockTarget = 60,
|
Zerotorescue@0
|
33 minCraftingQueue = 0.05,
|
Zerotorescue@0
|
34 bonusQueue = 0.1,
|
Zerotorescue@0
|
35 priceThreshold = 0,
|
Zerotorescue@13
|
36 summaryHidePriceThreshold = false,
|
Zerotorescue@0
|
37 trackAtCharacters = {},
|
Zerotorescue@13
|
38 summary = {
|
Zerotorescue@13
|
39 speed = 5,
|
Zerotorescue@13
|
40 width = 650,
|
Zerotorescue@13
|
41 height = 600,
|
Zerotorescue@13
|
42 },
|
Zerotorescue@0
|
43 colors = {
|
Zerotorescue@17
|
44 red = 0,
|
Zerotorescue@17
|
45 orange = 0.3,
|
Zerotorescue@17
|
46 yellow = 0.6,
|
Zerotorescue@17
|
47 green = 0.95,
|
Zerotorescue@0
|
48 },
|
Zerotorescue@0
|
49 },
|
Zerotorescue@0
|
50 },
|
Zerotorescue@0
|
51 factionrealm = {
|
Zerotorescue@0
|
52 characters = {},
|
Zerotorescue@0
|
53 },
|
Zerotorescue@0
|
54 };
|
Zerotorescue@0
|
55
|
Zerotorescue@0
|
56 -- Register our saved variables database
|
Zerotorescue@11
|
57 self.db = LibStub("AceDB-3.0"):New("InventoriumDB", defaults, true);
|
Zerotorescue@0
|
58
|
Zerotorescue@0
|
59 -- SLASH COMMANDS
|
Zerotorescue@0
|
60
|
Zerotorescue@0
|
61 -- Disable the AddonLoader slash commands
|
Zerotorescue@11
|
62 SLASH_INVENTORIUM1 = nil;
|
Zerotorescue@0
|
63 SLASH_IY1 = nil;
|
Zerotorescue@0
|
64
|
Zerotorescue@0
|
65 -- Register our own slash commands
|
Zerotorescue@11
|
66 SLASH_INVENTORIUM1 = "/inventorium";
|
Zerotorescue@11
|
67 SLASH_INVENTORIUM2 = "/im";
|
Zerotorescue@11
|
68 SlashCmdList["INVENTORIUM"] = function(msg)
|
Zerotorescue@0
|
69 self:CommandHandler(msg);
|
Zerotorescue@0
|
70 end
|
Zerotorescue@0
|
71
|
Zerotorescue@0
|
72 -- INTERFACE OPTIONS
|
Zerotorescue@0
|
73
|
Zerotorescue@0
|
74 -- Attempt to remove the interface options added by AddonLoader (if enabled)
|
Zerotorescue@0
|
75 if AddonLoader and AddonLoader.RemoveInterfaceOptions then
|
Zerotorescue@11
|
76 AddonLoader:RemoveInterfaceOptions("Inventorium");
|
Zerotorescue@0
|
77 end
|
Zerotorescue@0
|
78
|
Zerotorescue@0
|
79 -- Now create our own options frame
|
Zerotorescue@0
|
80 local frame = CreateFrame("Frame", nil, UIParent);
|
Zerotorescue@0
|
81 frame:Hide();
|
Zerotorescue@11
|
82 frame.name = "Inventorium";
|
Zerotorescue@0
|
83 frame:HookScript("OnShow", function(self)
|
Zerotorescue@0
|
84 -- Refresh the frame to instantly show the right options
|
Zerotorescue@0
|
85 InterfaceOptionsFrame_OpenToCategory(self.name)
|
Zerotorescue@0
|
86 end);
|
Zerotorescue@0
|
87 -- And add it to the interface options
|
Zerotorescue@0
|
88 InterfaceOptions_AddCategory(frame);
|
Zerotorescue@0
|
89
|
Zerotorescue@1
|
90 self:MakeItemLinkButtonWidget();
|
Zerotorescue@1
|
91 self:MakeConfigItemLinkButtonWidget();
|
Zerotorescue@0
|
92
|
Zerotorescue@0
|
93 -- Remember this character is mine
|
Zerotorescue@0
|
94 local playerName = UnitName("player");
|
Zerotorescue@0
|
95 if not self.db.factionrealm.characters[playerName] then
|
Zerotorescue@0
|
96 self.db.factionrealm.characters[playerName] = true;
|
Zerotorescue@0
|
97
|
Zerotorescue@0
|
98 -- Default to tracking on all chars, untracking is a convenience, not tracking by default would probably get multiple issue reports.
|
Zerotorescue@0
|
99 self.db.global.defaults.trackAtCharacters[playerName] = true;
|
Zerotorescue@0
|
100 end
|
Zerotorescue@23
|
101
|
Zerotorescue@23
|
102 self:PremadeGroupsCheck();
|
Zerotorescue@0
|
103 end
|
Zerotorescue@0
|
104
|
Zerotorescue@24
|
105 local function InGroup(itemId)
|
Zerotorescue@24
|
106 -- Go through all groups to see if this item is already somewhere
|
Zerotorescue@24
|
107 for groupName, values in pairs(addon.db.global.groups) do
|
Zerotorescue@24
|
108 if values.items and values.items[itemId] then
|
Zerotorescue@24
|
109 return groupName;
|
Zerotorescue@24
|
110 end
|
Zerotorescue@24
|
111 end
|
Zerotorescue@24
|
112
|
Zerotorescue@24
|
113 return;
|
Zerotorescue@24
|
114 end
|
Zerotorescue@24
|
115
|
Zerotorescue@23
|
116 function addon:PremadeGroupsCheck(updateGroupName, updateKey, accept)
|
Zerotorescue@23
|
117 -- Compare the current premade groups with those used, notify about changes
|
Zerotorescue@23
|
118 if addon.defaultGroups then
|
Zerotorescue@23
|
119 for key, groupInfo in pairs(addon.defaultGroups) do
|
Zerotorescue@23
|
120 -- Go through all default groups
|
Zerotorescue@23
|
121
|
Zerotorescue@23
|
122 for groupName, values in pairs(addon.db.global.groups) do
|
Zerotorescue@23
|
123 -- Go through all groups to find those with this premade group
|
Zerotorescue@23
|
124
|
Zerotorescue@23
|
125 if values.premadeGroups and values.premadeGroups[key] and values.premadeGroups[key] < groupInfo.version then
|
Zerotorescue@23
|
126 -- Outdated group
|
Zerotorescue@23
|
127
|
Zerotorescue@23
|
128 if updateGroupName and updateKey then
|
Zerotorescue@23
|
129 -- This function was called after pressing yes or no in a confirm box
|
Zerotorescue@23
|
130
|
Zerotorescue@23
|
131 if accept then
|
Zerotorescue@23
|
132 -- Yes was clicked
|
Zerotorescue@23
|
133
|
Zerotorescue@23
|
134 for itemId, version in pairs(groupInfo.items) do
|
Zerotorescue@23
|
135 -- Go through all items in this premade group
|
Zerotorescue@23
|
136
|
Zerotorescue@23
|
137 if version > values.premadeGroups[key] then
|
Zerotorescue@23
|
138 -- This item was added in a more recent version than this group: Add item
|
Zerotorescue@23
|
139
|
Zerotorescue@23
|
140 if InGroup(itemId) then
|
Zerotorescue@23
|
141 print(("Skipping %s (#%d) as it is already in the group |cfffed000%s|r."):format(select(2, GetItemInfo(itemId)) or "Unknown", itemId, InGroup(itemId)));
|
Zerotorescue@23
|
142 elseif AddToGroup(groupName, itemId) then
|
Zerotorescue@23
|
143 print(("Added %s (#%d) found in the premade group |cfffed000%s|r to the group |cfffed000%s|r."):format(select(2, GetItemInfo(itemId)) or "Unknown", itemId, InGroup(itemId)));
|
Zerotorescue@23
|
144 end
|
Zerotorescue@23
|
145 end
|
Zerotorescue@23
|
146 end
|
Zerotorescue@23
|
147
|
Zerotorescue@23
|
148 -- Remember the new version
|
Zerotorescue@23
|
149 values.premadeGroups[key] = groupInfo.version;
|
Zerotorescue@23
|
150 else
|
Zerotorescue@23
|
151 -- No was clicked
|
Zerotorescue@23
|
152
|
Zerotorescue@23
|
153 -- Let user know what was not added
|
Zerotorescue@23
|
154 for itemId, version in pairs(groupInfo.items) do
|
Zerotorescue@23
|
155 -- Go through all items in this premade group
|
Zerotorescue@23
|
156
|
Zerotorescue@23
|
157 if version > values.premadeGroups[key] then
|
Zerotorescue@23
|
158 -- This item was added in a more recent version than this group: don't add (since we clicked no), but announce it
|
Zerotorescue@23
|
159
|
Zerotorescue@23
|
160 print(("Skipping %s (#%d) found in the premade group |cfffed000%s|r."):format(select(2, GetItemInfo(itemId)) or "Unknown", itemId, InGroup(itemId)));
|
Zerotorescue@23
|
161 end
|
Zerotorescue@23
|
162 end
|
Zerotorescue@23
|
163
|
Zerotorescue@23
|
164 -- Remember the new version
|
Zerotorescue@23
|
165 values.premadeGroups[key] = groupInfo.version;
|
Zerotorescue@23
|
166 end
|
Zerotorescue@23
|
167 else
|
Zerotorescue@23
|
168 StaticPopupDialogs["InventoriumConfirmUpdatePremadeGroup"] = {
|
Zerotorescue@23
|
169 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@23
|
170 button1 = YES,
|
Zerotorescue@23
|
171 button2 = NO,
|
Zerotorescue@23
|
172 OnAccept = function(self)
|
Zerotorescue@23
|
173 addon:PremadeGroupsCheck(groupName, key, true);
|
Zerotorescue@23
|
174 end,
|
Zerotorescue@23
|
175 OnCancel = function(self, _, reason)
|
Zerotorescue@23
|
176 if reason == "clicked" then
|
Zerotorescue@23
|
177 addon:PremadeGroupsCheck(groupName, key, false);
|
Zerotorescue@23
|
178 end
|
Zerotorescue@23
|
179 end,
|
Zerotorescue@23
|
180 timeout = 0,
|
Zerotorescue@23
|
181 whileDead = 1,
|
Zerotorescue@23
|
182 hideOnEscape = 1,
|
Zerotorescue@23
|
183 };
|
Zerotorescue@23
|
184 StaticPopup_Show("InventoriumConfirmUpdatePremadeGroup", key, groupName);
|
Zerotorescue@23
|
185
|
Zerotorescue@23
|
186 return;
|
Zerotorescue@23
|
187 end
|
Zerotorescue@23
|
188 end
|
Zerotorescue@23
|
189 end
|
Zerotorescue@23
|
190 end
|
Zerotorescue@23
|
191 end
|
Zerotorescue@23
|
192 end
|
Zerotorescue@23
|
193
|
Zerotorescue@23
|
194
|
Zerotorescue@1
|
195 local slashArgs = {};
|
Zerotorescue@1
|
196 function addon:RegisterSlash(func, ...)
|
Zerotorescue@1
|
197 for _, arg in pairs({ ... }) do
|
Zerotorescue@1
|
198 slashArgs[arg] = func;
|
Zerotorescue@1
|
199 end
|
Zerotorescue@1
|
200 end
|
Zerotorescue@1
|
201
|
Zerotorescue@1
|
202 function addon:MakeItemLinkButtonWidget()
|
Zerotorescue@0
|
203 --[[
|
Zerotorescue@0
|
204 [ ItemLinkButton ]
|
Zerotorescue@1
|
205 This custom widget has to show an icon with the item link next to it.
|
Zerotorescue@1
|
206 Upon hover it must show the item tooltip.
|
Zerotorescue@1
|
207 Upon click it must execute the function provided through user data.
|
Zerotorescue@1
|
208
|
Zerotorescue@1
|
209 UserData: itemId, onClickEvent
|
Zerotorescue@1
|
210
|
Zerotorescue@0
|
211 OnEnter: tooltip show
|
Zerotorescue@1
|
212 OnLeave: tooltip hide
|
Zerotorescue@1
|
213 OnClick: UserData.onClickEvent
|
Zerotorescue@0
|
214 ]]
|
Zerotorescue@0
|
215
|
Zerotorescue@0
|
216 local widgetType = "ItemLinkButton";
|
Zerotorescue@0
|
217 local widgetVersion = 1;
|
Zerotorescue@0
|
218
|
Zerotorescue@1
|
219 local function Constructor()
|
Zerotorescue@1
|
220 local widget = AceGUI:Create("InteractiveLabel");
|
Zerotorescue@1
|
221 widget.type = widgetType;
|
Zerotorescue@1
|
222
|
Zerotorescue@1
|
223 -- We overwrite the OnAcquire as we want to set our callbacks even
|
Zerotorescue@1
|
224 -- when the widget is re-used from the widget pool
|
Zerotorescue@1
|
225 widget.originalOnAcquire = widget.OnAcquire;
|
Zerotorescue@1
|
226 widget.OnAcquire = function(self, ...)
|
Zerotorescue@1
|
227
|
Zerotorescue@1
|
228
|
Zerotorescue@1
|
229 -- We overwrite the setcallback because we don't want anything else
|
Zerotorescue@1
|
230 -- to overwrite our OnEnter, OnLeave and OnClick events
|
Zerotorescue@1
|
231 -- which would be done by the AceConfigDialog after a widget gets re-used
|
Zerotorescue@1
|
232 if not self.originalSetCallBack then
|
Zerotorescue@1
|
233 self.originalSetCallBack = self.SetCallback;
|
Zerotorescue@1
|
234 self.SetCallback = function(this, event, func, ...)
|
Zerotorescue@1
|
235 if event == "OnEnter" or event == "OnLeave" or event == "OnClick" then
|
Zerotorescue@1
|
236 -- Don't allow overwriting of these events
|
Zerotorescue@1
|
237 return;
|
Zerotorescue@1
|
238 elseif event == "CustomOnEnter" then
|
Zerotorescue@1
|
239 return this.originalSetCallBack(this, "OnEnter", func, ...);
|
Zerotorescue@1
|
240 elseif event == "CustomOnLeave" then
|
Zerotorescue@1
|
241 return this.originalSetCallBack(this, "OnLeave", func, ...);
|
Zerotorescue@1
|
242 elseif event == "CustomOnClick" then
|
Zerotorescue@1
|
243 return this.originalSetCallBack(this, "OnClick", func, ...);
|
Zerotorescue@1
|
244 else
|
Zerotorescue@1
|
245 return this.originalSetCallBack(this, event, func, ...);
|
Zerotorescue@1
|
246 end
|
Zerotorescue@1
|
247 end;
|
Zerotorescue@1
|
248 end
|
Zerotorescue@1
|
249
|
Zerotorescue@1
|
250
|
Zerotorescue@1
|
251 -- Set our own events, since we disabled the normal event-names, we'll call them our custom versions
|
Zerotorescue@1
|
252 self:SetCallback("CustomOnEnter", function(this)
|
Zerotorescue@1
|
253 local itemId = this:GetUserData("itemId");
|
Zerotorescue@1
|
254
|
Zerotorescue@1
|
255 if itemId then
|
Zerotorescue@1
|
256 GameTooltip:SetOwner(this.frame, "ANCHOR_TOPRIGHT");
|
Zerotorescue@1
|
257 GameTooltip:SetHyperlink(("item:%d"):format(itemId));
|
Zerotorescue@1
|
258 GameTooltip:Show();
|
Zerotorescue@1
|
259 end
|
Zerotorescue@1
|
260 end);
|
Zerotorescue@1
|
261 self:SetCallback("CustomOnLeave", function(this)
|
Zerotorescue@1
|
262 GameTooltip:Hide();
|
Zerotorescue@1
|
263 end);
|
Zerotorescue@23
|
264 self:SetCallback("CustomOnClick", function(this, ...)
|
Zerotorescue@23
|
265 -- Below is used in child widgets to prepare for onclick
|
Zerotorescue@1
|
266 if this.OnClick then
|
Zerotorescue@23
|
267 this.OnClick(this, ...);
|
Zerotorescue@1
|
268 end
|
Zerotorescue@1
|
269
|
Zerotorescue@1
|
270 local func = this:GetUserData("exec");
|
Zerotorescue@1
|
271 local itemId = this:GetUserData("itemId");
|
Zerotorescue@1
|
272
|
Zerotorescue@1
|
273 if func then
|
Zerotorescue@1
|
274 -- If this is a config option we will need the group id
|
Zerotorescue@1
|
275 local path = this:GetUserData("path");
|
Zerotorescue@1
|
276 local groupId = (path and path[2]) or nil;
|
Zerotorescue@1
|
277
|
Zerotorescue@23
|
278 func(groupId, itemId, ...);
|
Zerotorescue@1
|
279 end
|
Zerotorescue@1
|
280 end);
|
Zerotorescue@1
|
281
|
Zerotorescue@1
|
282
|
Zerotorescue@1
|
283
|
Zerotorescue@1
|
284 -- Then also do whatever it wanted to do
|
Zerotorescue@1
|
285 self.originalOnAcquire(self, ...);
|
Zerotorescue@1
|
286 end;
|
Zerotorescue@1
|
287
|
Zerotorescue@1
|
288 -- Remember the original SetText as this might get overwritten by the config-widget
|
Zerotorescue@1
|
289 widget.originalSetText = widget.SetText;
|
Zerotorescue@1
|
290
|
Zerotorescue@1
|
291 widget.SetItemId = function(self, itemId)
|
Zerotorescue@1
|
292 self:SetUserData("itemId", itemId);
|
Zerotorescue@1
|
293
|
Zerotorescue@1
|
294 -- Put the icon in front of it
|
Zerotorescue@1
|
295 self:SetImage(GetItemIcon(itemId));
|
Zerotorescue@0
|
296 -- Standardize the size
|
Zerotorescue@0
|
297 self:SetImageSize(16, 16);
|
Zerotorescue@0
|
298
|
Zerotorescue@0
|
299 -- Make readable font
|
Zerotorescue@0
|
300 self:SetFontObject(GameFontHighlight);
|
Zerotorescue@0
|
301
|
Zerotorescue@0
|
302 -- We don't want to set the itemId as text, but rather the item link, so get that.
|
Zerotorescue@1
|
303 local itemLink = select(2, GetItemInfo(itemId)) or ("Unknown (#%d)"):format(itemId);
|
Zerotorescue@0
|
304
|
Zerotorescue@1
|
305 self:originalSetText(itemLink);
|
Zerotorescue@1
|
306 end;
|
Zerotorescue@1
|
307
|
Zerotorescue@1
|
308 return widget;
|
Zerotorescue@0
|
309 end
|
Zerotorescue@1
|
310
|
Zerotorescue@1
|
311 AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion);
|
Zerotorescue@1
|
312 end
|
Zerotorescue@1
|
313
|
Zerotorescue@1
|
314 function addon:MakeConfigItemLinkButtonWidget()
|
Zerotorescue@1
|
315 -- Define out custom item link button widget
|
Zerotorescue@1
|
316 -- This will be called as if it's an input element, we overwrite some of the related functions which are called for default input fields
|
Zerotorescue@0
|
317
|
Zerotorescue@1
|
318 local widgetType = "ConfigItemLinkButton";
|
Zerotorescue@1
|
319 local widgetVersion = 1;
|
Zerotorescue@0
|
320
|
Zerotorescue@1
|
321 -- Empty function for disabling functions
|
Zerotorescue@1
|
322 local function Dummy() end
|
Zerotorescue@0
|
323
|
Zerotorescue@0
|
324 -- Makes an instance of our ItemLinkButton widget
|
Zerotorescue@0
|
325 local function GetItemLinkButton()
|
Zerotorescue@1
|
326 local widget = AceGUI:Create("ItemLinkButton");
|
Zerotorescue@0
|
327 widget.type = widgetType;
|
Zerotorescue@0
|
328
|
Zerotorescue@0
|
329 -- We can only provide custom widgets for input, select and multiselect fields
|
Zerotorescue@0
|
330 -- Input being the simplest, we use that - however, it provides two parameters: label and text. We only need one, disable the other.
|
Zerotorescue@0
|
331 widget.SetLabel = Dummy;
|
Zerotorescue@0
|
332
|
Zerotorescue@1
|
333 -- SetText is called when this button is being created and contains the itemId
|
Zerotorescue@1
|
334 -- Forward that itemId to the ItemLinkButton
|
Zerotorescue@1
|
335 widget.SetText = function(self, value, ...)
|
Zerotorescue@1
|
336 if value and tonumber(value) then
|
Zerotorescue@1
|
337 self:SetItemId(tonumber(value));
|
Zerotorescue@1
|
338 end
|
Zerotorescue@1
|
339 end;
|
Zerotorescue@1
|
340
|
Zerotorescue@1
|
341 widget.OnClick = function(self, ...)
|
Zerotorescue@1
|
342 local option = self:GetUserData("option");
|
Zerotorescue@1
|
343
|
Zerotorescue@1
|
344 if option and option.set then
|
Zerotorescue@1
|
345 self:SetUserData("exec", option.set);
|
Zerotorescue@1
|
346 end
|
Zerotorescue@1
|
347 end;
|
Zerotorescue@0
|
348
|
Zerotorescue@0
|
349 return widget;
|
Zerotorescue@0
|
350 end
|
Zerotorescue@0
|
351
|
Zerotorescue@0
|
352 AceGUI:RegisterWidgetType(widgetType, GetItemLinkButton, widgetVersion);
|
Zerotorescue@0
|
353 end
|
Zerotorescue@0
|
354
|
Zerotorescue@0
|
355 function addon:CommandHandler(message)
|
Zerotorescue@0
|
356 local cmd, arg = string.split(" ", (message or ""), 2);
|
Zerotorescue@0
|
357 cmd = string.lower(cmd);
|
Zerotorescue@0
|
358
|
Zerotorescue@0
|
359 if cmd == "c" or cmd == "config" or cmd == "conf" or cmd == "option" or cmd == "options" or cmd == "opt" or cmd == "setting" or cmd == "settings" then
|
Zerotorescue@9
|
360 -- We don't want any other windows open at this time.
|
Zerotorescue@9
|
361 for name, module in self:IterateModules() do
|
Zerotorescue@9
|
362 if module.CloseFrame then
|
Zerotorescue@9
|
363 module:CloseFrame();
|
Zerotorescue@9
|
364 end
|
Zerotorescue@9
|
365 end
|
Zerotorescue@9
|
366
|
Zerotorescue@0
|
367 self:Show();
|
Zerotorescue@0
|
368 elseif cmd == "d" or cmd == "debug" then
|
Zerotorescue@0
|
369 self.debugChannel = false;
|
Zerotorescue@0
|
370 for i = 1, NUM_CHAT_WINDOWS do
|
Zerotorescue@0
|
371 local name = GetChatWindowInfo(i);
|
Zerotorescue@0
|
372
|
Zerotorescue@0
|
373 if name:upper() == "DEBUG" then
|
Zerotorescue@0
|
374 self.debugChannel = _G["ChatFrame" .. i];
|
Zerotorescue@0
|
375
|
Zerotorescue@0
|
376 print("A debug channel already exists, used the old one. (" .. i .. ")");
|
Zerotorescue@0
|
377 return;
|
Zerotorescue@0
|
378 end
|
Zerotorescue@0
|
379 end
|
Zerotorescue@0
|
380
|
Zerotorescue@0
|
381 if not self.debugChannel then
|
Zerotorescue@0
|
382 -- Create a new debug channel
|
Zerotorescue@0
|
383 local chatFrame = FCF_OpenNewWindow('Debug');
|
Zerotorescue@0
|
384 ChatFrame_RemoveAllMessageGroups(chatFrame);
|
Zerotorescue@0
|
385 self.debugChannel = chatFrame;
|
Zerotorescue@0
|
386
|
Zerotorescue@0
|
387 print("New debug channel created.");
|
Zerotorescue@0
|
388 end
|
Zerotorescue@1
|
389 elseif slashArgs[cmd] then
|
Zerotorescue@1
|
390 slashArgs[cmd]();
|
Zerotorescue@0
|
391 else
|
Zerotorescue@11
|
392 print("Wrong command, available: /inventorium config (or /im c) and /inventorium summary (or /im s)");
|
Zerotorescue@0
|
393 end
|
Zerotorescue@0
|
394 end
|
Zerotorescue@0
|
395
|
Zerotorescue@0
|
396 function addon:Load()
|
Zerotorescue@0
|
397 if not AceConfigDialog and not AceConfigRegistry then
|
Zerotorescue@0
|
398 self:FillOptions();
|
Zerotorescue@0
|
399
|
Zerotorescue@0
|
400 -- Build options dialog
|
Zerotorescue@0
|
401 AceConfigDialog = LibStub("AceConfigDialog-3.0");
|
Zerotorescue@0
|
402 AceConfigRegistry = LibStub("AceConfigRegistry-3.0");
|
Zerotorescue@0
|
403 -- Register options table
|
Zerotorescue@11
|
404 LibStub("AceConfig-3.0"):RegisterOptionsTable("InventoriumOptions", options);
|
Zerotorescue@0
|
405 -- Set a nice default size (so that 4 normal sized elements fit next to eachother)
|
Zerotorescue@11
|
406 AceConfigDialog:SetDefaultSize("InventoriumOptions", 975, 600);
|
Zerotorescue@0
|
407
|
Zerotorescue@0
|
408 -- In case the addon is loaded from another condition, always call the remove interface options
|
Zerotorescue@0
|
409 if AddonLoader and AddonLoader.RemoveInterfaceOptions then
|
Zerotorescue@11
|
410 AddonLoader:RemoveInterfaceOptions("Inventorium");
|
Zerotorescue@0
|
411 end
|
Zerotorescue@0
|
412
|
Zerotorescue@0
|
413 -- Add to the blizzard addons options thing
|
Zerotorescue@11
|
414 --AceConfigDialog:AddToBlizOptions("InventoriumOptions");
|
Zerotorescue@0
|
415 end
|
Zerotorescue@0
|
416 end
|
Zerotorescue@0
|
417
|
Zerotorescue@0
|
418 function addon:Show()
|
Zerotorescue@0
|
419 self:Load();
|
Zerotorescue@0
|
420
|
Zerotorescue@11
|
421 AceConfigDialog:Open("InventoriumOptions");
|
Zerotorescue@0
|
422 end
|
Zerotorescue@0
|
423
|
Zerotorescue@0
|
424 function addon:FillOptions()
|
Zerotorescue@0
|
425 options = {
|
Zerotorescue@0
|
426 type = "group",
|
Zerotorescue@11
|
427 name = "Inventorium",
|
Zerotorescue@0
|
428 childGroups = "tree",
|
Zerotorescue@0
|
429 args = {
|
Zerotorescue@0
|
430 },
|
Zerotorescue@0
|
431 };
|
Zerotorescue@0
|
432
|
Zerotorescue@0
|
433 self:FillGeneralOptions();
|
Zerotorescue@0
|
434
|
Zerotorescue@0
|
435 options.args.profiles = LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db, true);
|
Zerotorescue@0
|
436 options.args.profiles.order = 200;
|
Zerotorescue@0
|
437
|
Zerotorescue@0
|
438 self:MakeGroupOptions();
|
Zerotorescue@0
|
439
|
Zerotorescue@0
|
440 self:FillGroupOptions();
|
Zerotorescue@0
|
441 end
|
Zerotorescue@0
|
442
|
Zerotorescue@1
|
443 local goldText = "%s%d|cffffd700g|r ";
|
Zerotorescue@1
|
444 local silverText = "%s%d|cffc7c7cfs|r ";
|
Zerotorescue@1
|
445 local copperText = "%s%d|cffeda55fc|r";
|
Zerotorescue@1
|
446
|
Zerotorescue@1
|
447 function addon:ReadableMoney(copper, clean)
|
Zerotorescue@1
|
448 local text = "";
|
Zerotorescue@1
|
449
|
Zerotorescue@1
|
450 local gold = floor( copper / COPPER_PER_GOLD );
|
Zerotorescue@1
|
451 if gold > 0 then
|
Zerotorescue@1
|
452 text = goldText:format(text, gold);
|
Zerotorescue@1
|
453 end
|
Zerotorescue@1
|
454
|
Zerotorescue@13
|
455 if not clean or (not gold or gold < 10) then
|
Zerotorescue@1
|
456 local silver = floor( ( copper % COPPER_PER_GOLD ) / COPPER_PER_SILVER );
|
Zerotorescue@1
|
457 if silver > 0 then
|
Zerotorescue@1
|
458 text = silverText:format(text, silver);
|
Zerotorescue@1
|
459 end
|
Zerotorescue@1
|
460
|
Zerotorescue@13
|
461 if not clean or (not gold or gold < 1) then
|
Zerotorescue@1
|
462 local copper = floor( copper % COPPER_PER_SILVER );
|
Zerotorescue@1
|
463 if copper > 0 or text == "" then
|
Zerotorescue@1
|
464 text = copperText:format(text, copper);
|
Zerotorescue@1
|
465 end
|
Zerotorescue@1
|
466 end
|
Zerotorescue@1
|
467 end
|
Zerotorescue@1
|
468
|
Zerotorescue@1
|
469
|
Zerotorescue@1
|
470 return string.trim(text);
|
Zerotorescue@1
|
471 end
|
Zerotorescue@1
|
472
|
Zerotorescue@1
|
473 function addon:ReadableMoneyToCopper(value)
|
Zerotorescue@1
|
474 -- If a player enters a value it will be filled without color codes
|
Zerotorescue@1
|
475 -- If it is retrieved from the database, it will be colored coded
|
Zerotorescue@1
|
476 -- Thus we look for both
|
Zerotorescue@1
|
477 local gold = tonumber(string.match(value, "(%d+)|c[a-fA-F0-9]+g|r") or string.match(value, "(%d+)g"));
|
Zerotorescue@1
|
478 local silver = tonumber(string.match(value, "(%d+)|c[a-fA-F0-9]+s|r") or string.match(value, "(%d+)s"));
|
Zerotorescue@1
|
479 local copper = tonumber(string.match(value, "(%d+)|c[a-fA-F0-9]+c|r") or string.match(value, "(%d+)c"));
|
Zerotorescue@1
|
480
|
Zerotorescue@1
|
481 return ( (gold or 0) * COPPER_PER_GOLD ) + ( (silver or 0) * COPPER_PER_SILVER ) + (copper or 0);
|
Zerotorescue@1
|
482 end
|
Zerotorescue@1
|
483
|
Zerotorescue@1
|
484 function addon:ValidateReadableMoney(info, value)
|
Zerotorescue@1
|
485 -- If a player enters a value it will be filled without color codes
|
Zerotorescue@1
|
486 -- If it is retrieved from the database, it will be colored coded
|
Zerotorescue@1
|
487 -- Thus we look for both
|
Zerotorescue@1
|
488 local gold = tonumber(string.match(value, "(%d+)|c[a-fA-F0-9]+g|r") or string.match(value, "(%d+)g"));
|
Zerotorescue@1
|
489 local silver = tonumber(string.match(value, "(%d+)|c[a-fA-F0-9]+s|r") or string.match(value, "(%d+)s"));
|
Zerotorescue@1
|
490 local copper = tonumber(string.match(value, "(%d+)|c[a-fA-F0-9]+c|r") or string.match(value, "(%d+)c"));
|
Zerotorescue@1
|
491
|
Zerotorescue@1
|
492 if not gold and not silver and not copper then
|
Zerotorescue@1
|
493 return "The provided amount of money is invalid. Please provide the amount of money as #g#s#c, e.g. 591617g24s43c.";
|
Zerotorescue@1
|
494 else
|
Zerotorescue@1
|
495 return true;
|
Zerotorescue@1
|
496 end
|
Zerotorescue@1
|
497 end
|
Zerotorescue@1
|
498
|
Zerotorescue@0
|
499 function addon:FillGeneralOptions()
|
Zerotorescue@0
|
500 options.args.general = {
|
Zerotorescue@0
|
501 order = 100,
|
Zerotorescue@0
|
502 type = "group",
|
Zerotorescue@0
|
503 name = "General",
|
Zerotorescue@11
|
504 desc = "Change general Inventorium settings.",
|
Zerotorescue@0
|
505 args = {
|
Zerotorescue@0
|
506 general = {
|
Zerotorescue@0
|
507 order = 0,
|
Zerotorescue@0
|
508 type = "group",
|
Zerotorescue@0
|
509 inline = true,
|
Zerotorescue@0
|
510 name = "General",
|
Zerotorescue@0
|
511 args = {
|
Zerotorescue@0
|
512 description = {
|
Zerotorescue@0
|
513 order = 0,
|
Zerotorescue@0
|
514 type = "description",
|
Zerotorescue@23
|
515 name = "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@0
|
516 },
|
Zerotorescue@0
|
517 header = {
|
Zerotorescue@0
|
518 order = 5,
|
Zerotorescue@0
|
519 type = "header",
|
Zerotorescue@0
|
520 name = "",
|
Zerotorescue@0
|
521 },
|
Zerotorescue@13
|
522 auctionPricingAddon = {
|
Zerotorescue@0
|
523 order = 10,
|
Zerotorescue@0
|
524 type = "select",
|
Zerotorescue@0
|
525 name = "Prefered pricing addon",
|
Zerotorescue@13
|
526 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@13
|
527 values = function()
|
Zerotorescue@13
|
528 local temp = {};
|
Zerotorescue@13
|
529 for name, value in pairs(self.supportedAddons.auctionPricing) do
|
Zerotorescue@13
|
530 temp[name] = name;
|
Zerotorescue@13
|
531 end
|
Zerotorescue@13
|
532
|
Zerotorescue@13
|
533 return temp;
|
Zerotorescue@13
|
534 end,
|
Zerotorescue@13
|
535 get = function() return self.db.global.defaults.auctionPricingAddon; end,
|
Zerotorescue@13
|
536 set = function(i, v) self.db.global.defaults.auctionPricingAddon = v; end,
|
Zerotorescue@0
|
537 },
|
Zerotorescue@0
|
538 itemCountAddon = {
|
Zerotorescue@0
|
539 order = 20,
|
Zerotorescue@0
|
540 type = "select",
|
Zerotorescue@0
|
541 name = "Prefered item count addon",
|
Zerotorescue@13
|
542 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@13
|
543 values = function()
|
Zerotorescue@13
|
544 local temp = {};
|
Zerotorescue@13
|
545 for name, value in pairs(self.supportedAddons.itemCount) do
|
Zerotorescue@13
|
546 temp[name] = name;
|
Zerotorescue@13
|
547 end
|
Zerotorescue@13
|
548
|
Zerotorescue@13
|
549 return temp;
|
Zerotorescue@13
|
550 end,
|
Zerotorescue@13
|
551 get = function() return self.db.global.defaults.itemCountAddon; end,
|
Zerotorescue@13
|
552 set = function(i, v) self.db.global.defaults.itemCountAddon = v; end,
|
Zerotorescue@13
|
553 },
|
Zerotorescue@13
|
554 craftingAddon = {
|
Zerotorescue@23
|
555 order = 30,
|
Zerotorescue@13
|
556 type = "select",
|
Zerotorescue@13
|
557 name = "Prefered crafting addon",
|
Zerotorescue@13
|
558 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@13
|
559 values = function()
|
Zerotorescue@13
|
560 local temp = {};
|
Zerotorescue@13
|
561 for name, value in pairs(self.supportedAddons.crafting) do
|
Zerotorescue@13
|
562 temp[name] = name;
|
Zerotorescue@13
|
563 end
|
Zerotorescue@13
|
564
|
Zerotorescue@13
|
565 return temp;
|
Zerotorescue@13
|
566 end,
|
Zerotorescue@13
|
567 get = function() return self.db.global.defaults.craftingAddon; end,
|
Zerotorescue@13
|
568 set = function(i, v) self.db.global.defaults.craftingAddon = v; end,
|
Zerotorescue@0
|
569 },
|
Zerotorescue@23
|
570 localItemData = {
|
Zerotorescue@23
|
571 order = 40,
|
Zerotorescue@23
|
572 type = "multiselect",
|
Zerotorescue@23
|
573 name = "Include in local item data NYI | PH",
|
Zerotorescue@23
|
574 desc = "Select which data should be included in the local item data.",
|
Zerotorescue@23
|
575 values = {
|
Zerotorescue@23
|
576 ["Bag"] = "Bag",
|
Zerotorescue@23
|
577 ["Bank"] = "Bank",
|
Zerotorescue@23
|
578 ["Auction House"] = "Auction House",
|
Zerotorescue@23
|
579 ["Mailbox"] = "Mailbox",
|
Zerotorescue@23
|
580 },
|
Zerotorescue@23
|
581 get = function(i, v) return self.db.global.defaults.localItemData and self.db.global.defaults.localItemData[v]; end,
|
Zerotorescue@23
|
582 set = function(i, v, e) self.db.global.defaults.localItemData[v] = e or nil; end,
|
Zerotorescue@23
|
583 --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@23
|
584 },
|
Zerotorescue@0
|
585 },
|
Zerotorescue@0
|
586 },
|
Zerotorescue@0
|
587 minimumStock = {
|
Zerotorescue@0
|
588 order = 10,
|
Zerotorescue@0
|
589 type = "group",
|
Zerotorescue@0
|
590 inline = true,
|
Zerotorescue@0
|
591 name = "Minimum stock",
|
Zerotorescue@0
|
592 args = {
|
Zerotorescue@0
|
593 description = {
|
Zerotorescue@0
|
594 order = 0,
|
Zerotorescue@0
|
595 type = "description",
|
Zerotorescue@0
|
596 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@0
|
597 },
|
Zerotorescue@0
|
598 header = {
|
Zerotorescue@0
|
599 order = 5,
|
Zerotorescue@0
|
600 type = "header",
|
Zerotorescue@0
|
601 name = "",
|
Zerotorescue@0
|
602 },
|
Zerotorescue@0
|
603 minimumStock = {
|
Zerotorescue@0
|
604 order = 10,
|
Zerotorescue@0
|
605 type = "range",
|
Zerotorescue@0
|
606 min = 0,
|
Zerotorescue@0
|
607 max = 100000,
|
Zerotorescue@17
|
608 softMax = 100,
|
Zerotorescue@0
|
609 step = 1,
|
Zerotorescue@0
|
610 name = "Minimum stock",
|
Zerotorescue@17
|
611 desc = "You can manually enter a value between 100 and 100.000 in the text box below if the provided range is insufficient.",
|
Zerotorescue@0
|
612 get = function() return self.db.global.defaults.minimumStock; end,
|
Zerotorescue@0
|
613 set = function(i, v) self.db.global.defaults.minimumStock = v; end,
|
Zerotorescue@0
|
614 },
|
Zerotorescue@0
|
615 summaryThresholdShow = {
|
Zerotorescue@0
|
616 order = 20,
|
Zerotorescue@0
|
617 type = "range",
|
Zerotorescue@0
|
618 min = 0,
|
Zerotorescue@0
|
619 max = 100,
|
Zerotorescue@0
|
620 softMax = 10,
|
Zerotorescue@0
|
621 step = 0.05,
|
Zerotorescue@0
|
622 isPercent = true,
|
Zerotorescue@0
|
623 name = "Show in summary when below",
|
Zerotorescue@0
|
624 desc = "Show items in the summary when below this 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@0
|
625 get = function() return self.db.global.defaults.summaryThresholdShow; end,
|
Zerotorescue@0
|
626 set = function(i, v) self.db.global.defaults.summaryThresholdShow = v; end,
|
Zerotorescue@0
|
627 },
|
Zerotorescue@0
|
628 alertBelowMinimum = {
|
Zerotorescue@0
|
629 order = 30,
|
Zerotorescue@0
|
630 type = "toggle",
|
Zerotorescue@30
|
631 name = "NYI | Alert when below minimum",
|
Zerotorescue@0
|
632 desc = "Show an alert when this item gets below this threshold.",
|
Zerotorescue@0
|
633 get = function() return self.db.global.defaults.alertBelowMinimum; end,
|
Zerotorescue@0
|
634 set = function(i, v) self.db.global.defaults.alertBelowMinimum = v; end,
|
Zerotorescue@0
|
635 },
|
Zerotorescue@0
|
636 trackAtCharacters = {
|
Zerotorescue@0
|
637 order = 40,
|
Zerotorescue@0
|
638 type = "multiselect",
|
Zerotorescue@0
|
639 name = "Track at",
|
Zerotorescue@0
|
640 desc = "Select at which characters this should appear in the summary and generate alerts.",
|
Zerotorescue@0
|
641 values = function()
|
Zerotorescue@0
|
642 local temp = {};
|
Zerotorescue@0
|
643 for charName in pairs(self.db.factionrealm.characters) do
|
Zerotorescue@0
|
644 temp[charName] = charName;
|
Zerotorescue@0
|
645 end
|
Zerotorescue@0
|
646
|
Zerotorescue@0
|
647 return temp;
|
Zerotorescue@0
|
648 end,
|
Zerotorescue@1
|
649 get = function(i, v) return self.db.global.defaults.trackAtCharacters[v]; end,
|
Zerotorescue@23
|
650 set = function(i, v, e) self.db.global.defaults.trackAtCharacters[v] = e or nil; end,
|
Zerotorescue@13
|
651 --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@0
|
652 },
|
Zerotorescue@0
|
653 },
|
Zerotorescue@0
|
654 },
|
Zerotorescue@0
|
655 refill = {
|
Zerotorescue@0
|
656 order = 20,
|
Zerotorescue@0
|
657 type = "group",
|
Zerotorescue@0
|
658 inline = true,
|
Zerotorescue@0
|
659 name = "Replenishing stock",
|
Zerotorescue@0
|
660 args = {
|
Zerotorescue@0
|
661 description = {
|
Zerotorescue@0
|
662 order = 0,
|
Zerotorescue@0
|
663 type = "description",
|
Zerotorescue@0
|
664 name = function()
|
Zerotorescue@0
|
665 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@0
|
666
|
Zerotorescue@0
|
667 r = r .. "When restocking the target amount is |cfffed000" .. self.db.global.defaults.restockTarget .. "|r of every item. Not queueing craftable items when only missing |cfffed000" .. floor( self.db.global.defaults.minCraftingQueue * self.db.global.defaults.restockTarget ) .. "|r (|cfffed000" .. ( self.db.global.defaults.minCraftingQueue * 100 ) .. "%|r) of the restock target.";
|
Zerotorescue@0
|
668
|
Zerotorescue@0
|
669 return r;
|
Zerotorescue@0
|
670 end,
|
Zerotorescue@0
|
671 },
|
Zerotorescue@0
|
672 header = {
|
Zerotorescue@0
|
673 order = 5,
|
Zerotorescue@0
|
674 type = "header",
|
Zerotorescue@0
|
675 name = "",
|
Zerotorescue@0
|
676 },
|
Zerotorescue@0
|
677 restockTarget = {
|
Zerotorescue@0
|
678 order = 10,
|
Zerotorescue@0
|
679 type = "range",
|
Zerotorescue@0
|
680 min = 0,
|
Zerotorescue@0
|
681 max = 100000,
|
Zerotorescue@30
|
682 softMax = 100,
|
Zerotorescue@0
|
683 step = 1,
|
Zerotorescue@0
|
684 name = "Restock target",
|
Zerotorescue@30
|
685 desc = "You can manually enter a value between 100 and 100.000 in the edit box if the provided range is insufficient.",
|
Zerotorescue@0
|
686 get = function() return self.db.global.defaults.restockTarget; end,
|
Zerotorescue@0
|
687 set = function(i, v) self.db.global.defaults.restockTarget = v; end,
|
Zerotorescue@0
|
688 },
|
Zerotorescue@0
|
689 minCraftingQueue = {
|
Zerotorescue@0
|
690 order = 20,
|
Zerotorescue@0
|
691 type = "range",
|
Zerotorescue@0
|
692 min = 0,
|
Zerotorescue@0
|
693 max = 1,
|
Zerotorescue@0
|
694 step = 0.01, -- 1%
|
Zerotorescue@0
|
695 isPercent = true,
|
Zerotorescue@0
|
696 name = "Don't queue if I only miss",
|
Zerotorescue@0
|
697 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@0
|
698 get = function() return self.db.global.defaults.minCraftingQueue; end,
|
Zerotorescue@0
|
699 set = function(i, v) self.db.global.defaults.minCraftingQueue = v; end,
|
Zerotorescue@0
|
700 },
|
Zerotorescue@0
|
701 bonusQueue = {
|
Zerotorescue@0
|
702 order = 30,
|
Zerotorescue@0
|
703 type = "range",
|
Zerotorescue@0
|
704 min = 0,
|
Zerotorescue@0
|
705 max = 10, -- 1000%
|
Zerotorescue@0
|
706 step = 0.01, -- 1%
|
Zerotorescue@0
|
707 isPercent = true,
|
Zerotorescue@0
|
708 name = "Bonus queue",
|
Zerotorescue@1
|
709 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@0
|
710 get = function() return self.db.global.defaults.bonusQueue; end,
|
Zerotorescue@0
|
711 set = function(i, v) self.db.global.defaults.bonusQueue = v; end,
|
Zerotorescue@0
|
712 },
|
Zerotorescue@0
|
713 priceThreshold = {
|
Zerotorescue@0
|
714 order = 40,
|
Zerotorescue@0
|
715 type = "input",
|
Zerotorescue@0
|
716 name = "Price threshold",
|
Zerotorescue@1
|
717 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@1
|
718 validate = function(info, value) return self:ValidateReadableMoney(info, value); end,
|
Zerotorescue@1
|
719 get = function() return self:ReadableMoney(self.db.global.defaults.priceThreshold); end,
|
Zerotorescue@1
|
720 set = function(i, v) self.db.global.defaults.priceThreshold = self:ReadableMoneyToCopper(v); end,
|
Zerotorescue@0
|
721 },
|
Zerotorescue@13
|
722 summaryHidePriceThreshold = {
|
Zerotorescue@0
|
723 order = 50,
|
Zerotorescue@0
|
724 type = "toggle",
|
Zerotorescue@1
|
725 name = "Hide when below threshold",
|
Zerotorescue@0
|
726 desc = "Hide items from the summary when their value is below the set price threshold.",
|
Zerotorescue@13
|
727 get = function() return self.db.global.defaults.summaryHidePriceThreshold; end,
|
Zerotorescue@13
|
728 set = function(i, v) self.db.global.defaults.summaryHidePriceThreshold = v; end,
|
Zerotorescue@0
|
729 },
|
Zerotorescue@30
|
730 queueSkipPriceThreshild = {
|
Zerotorescue@30
|
731 order = 55,
|
Zerotorescue@30
|
732 type = "toggle",
|
Zerotorescue@30
|
733 name = "NYI | Don't queue when below threshold",
|
Zerotorescue@30
|
734 desc = "Do not queue items when their value is below the set price threshold.",
|
Zerotorescue@30
|
735 get = function() return self.db.global.defaults.queueSkipPriceThreshild; end,
|
Zerotorescue@30
|
736 set = function(i, v) self.db.global.defaults.queueSkipPriceThreshild = v; end,
|
Zerotorescue@30
|
737 },
|
Zerotorescue@23
|
738 alwaysGetAuctionValue = {
|
Zerotorescue@23
|
739 order = 60,
|
Zerotorescue@23
|
740 type = "toggle",
|
Zerotorescue@23
|
741 name = "Always show auction value",
|
Zerotorescue@23
|
742 desc = "Always cache and show the auction value of items, even if the price threshold is set to 0.",
|
Zerotorescue@23
|
743 get = function() return self.db.global.defaults.alwaysGetAuctionValue; end,
|
Zerotorescue@23
|
744 set = function(i, v) self.db.global.defaults.alwaysGetAuctionValue = v; end,
|
Zerotorescue@23
|
745 },
|
Zerotorescue@0
|
746 },
|
Zerotorescue@0
|
747 },
|
Zerotorescue@0
|
748 colorCodes = {
|
Zerotorescue@0
|
749 order = 30,
|
Zerotorescue@0
|
750 type = "group",
|
Zerotorescue@0
|
751 inline = true,
|
Zerotorescue@0
|
752 name = "Color codes",
|
Zerotorescue@0
|
753 args = {
|
Zerotorescue@0
|
754 description = {
|
Zerotorescue@0
|
755 order = 0,
|
Zerotorescue@0
|
756 type = "description",
|
Zerotorescue@0
|
757 name = "Change the color code thresholds based on the current stock remaining of the required minimum stock.",
|
Zerotorescue@0
|
758 },
|
Zerotorescue@0
|
759 header = {
|
Zerotorescue@0
|
760 order = 5,
|
Zerotorescue@0
|
761 type = "header",
|
Zerotorescue@0
|
762 name = "",
|
Zerotorescue@0
|
763 },
|
Zerotorescue@0
|
764 green = {
|
Zerotorescue@0
|
765 order = 10,
|
Zerotorescue@0
|
766 type = "range",
|
Zerotorescue@0
|
767 min = 0,
|
Zerotorescue@0
|
768 max = 1,
|
Zerotorescue@0
|
769 step = 0.01,
|
Zerotorescue@0
|
770 isPercent = true,
|
Zerotorescue@0
|
771 name = "|cff00ff00Green|r",
|
Zerotorescue@0
|
772 desc = "Show quantity in green when at least this much of the minimum stock is available.",
|
Zerotorescue@0
|
773 get = function() return self.db.global.defaults.colors.green; end,
|
Zerotorescue@0
|
774 set = function(i, v) self.db.global.defaults.colors.green = v; end,
|
Zerotorescue@0
|
775 },
|
Zerotorescue@0
|
776 yellow = {
|
Zerotorescue@0
|
777 order = 20,
|
Zerotorescue@0
|
778 type = "range",
|
Zerotorescue@0
|
779 min = 0,
|
Zerotorescue@0
|
780 max = 1,
|
Zerotorescue@0
|
781 step = 0.01,
|
Zerotorescue@0
|
782 isPercent = true,
|
Zerotorescue@0
|
783 name = "|cffffff00Yellow|r",
|
Zerotorescue@0
|
784 desc = "Show quantity in yellow when at least this much of the minimum stock is available.",
|
Zerotorescue@0
|
785 get = function() return self.db.global.defaults.colors.yellow; end,
|
Zerotorescue@0
|
786 set = function(i, v) self.db.global.defaults.colors.yellow = v; end,
|
Zerotorescue@0
|
787 },
|
Zerotorescue@0
|
788 orange = {
|
Zerotorescue@0
|
789 order = 30,
|
Zerotorescue@0
|
790 type = "range",
|
Zerotorescue@0
|
791 min = 0,
|
Zerotorescue@0
|
792 max = 1,
|
Zerotorescue@0
|
793 step = 0.01,
|
Zerotorescue@0
|
794 isPercent = true,
|
Zerotorescue@0
|
795 name = "|cffff9933Orange|r",
|
Zerotorescue@0
|
796 desc = "Show quantity in orange when at least this much of the minimum stock is available.",
|
Zerotorescue@0
|
797 get = function() return self.db.global.defaults.colors.orange; end,
|
Zerotorescue@0
|
798 set = function(i, v) self.db.global.defaults.colors.orange = v; end,
|
Zerotorescue@0
|
799 },
|
Zerotorescue@0
|
800 red = {
|
Zerotorescue@0
|
801 order = 40,
|
Zerotorescue@0
|
802 type = "range",
|
Zerotorescue@0
|
803 min = 0,
|
Zerotorescue@0
|
804 max = 1,
|
Zerotorescue@0
|
805 step = 0.01,
|
Zerotorescue@0
|
806 isPercent = true,
|
Zerotorescue@0
|
807 name = "|cffff0000Red|r",
|
Zerotorescue@0
|
808 desc = "Show quantity in red when at least this much of the minimum stock is available.",
|
Zerotorescue@0
|
809 get = function() return self.db.global.defaults.colors.red; end,
|
Zerotorescue@0
|
810 set = function(i, v) self.db.global.defaults.colors.red = v; end,
|
Zerotorescue@0
|
811 },
|
Zerotorescue@0
|
812 },
|
Zerotorescue@0
|
813 },
|
Zerotorescue@0
|
814 },
|
Zerotorescue@0
|
815 };
|
Zerotorescue@0
|
816 end
|
Zerotorescue@0
|
817
|
Zerotorescue@0
|
818 local count = 0;
|
Zerotorescue@0
|
819 local temp = {};
|
Zerotorescue@0
|
820
|
Zerotorescue@1
|
821 local function SetOption(info, value, multiSelectEnabled)
|
Zerotorescue@0
|
822 local groupName = groupIdToName[info[2]];
|
Zerotorescue@0
|
823 local optionName = info[#info];
|
Zerotorescue@0
|
824
|
Zerotorescue@23
|
825 -- Special treatment for override toggle boxes
|
Zerotorescue@23
|
826 if not info.arg:find("override") then
|
Zerotorescue@23
|
827 if not value and info.arg then
|
Zerotorescue@23
|
828 -- If this override was disabled and a saved variable name was provided, set it to nil rather than false
|
Zerotorescue@23
|
829
|
Zerotorescue@23
|
830 value = nil;
|
Zerotorescue@23
|
831
|
Zerotorescue@23
|
832 -- If this is an override toggler then also set the related field to nil
|
Zerotorescue@23
|
833 addon.db.global.groups[groupName][info.arg] = nil;
|
Zerotorescue@23
|
834 elseif value and info.arg then
|
Zerotorescue@23
|
835 -- 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@23
|
836
|
Zerotorescue@23
|
837 addon.db.global.groups[groupName][info.arg] = addon:GetOptionByKey(groupName, info.arg);
|
Zerotorescue@23
|
838 end
|
Zerotorescue@0
|
839 end
|
Zerotorescue@0
|
840
|
Zerotorescue@1
|
841 if multiSelectEnabled ~= nil then
|
Zerotorescue@1
|
842 -- The saved vars for a multiselect will always be an array, it may not yet exist in which case it must be created.
|
Zerotorescue@1
|
843 if not addon.db.global.groups[groupName][optionName] then
|
Zerotorescue@1
|
844 addon.db.global.groups[groupName][optionName] = {};
|
Zerotorescue@1
|
845 end
|
Zerotorescue@1
|
846
|
Zerotorescue@1
|
847 addon.db.global.groups[groupName][optionName][value] = multiSelectEnabled or nil;
|
Zerotorescue@1
|
848 else
|
Zerotorescue@1
|
849 addon.db.global.groups[groupName][optionName] = value;
|
Zerotorescue@1
|
850 end
|
Zerotorescue@0
|
851 end
|
Zerotorescue@0
|
852
|
Zerotorescue@1
|
853 function addon:GetOptionByKey(groupName, optionName, noDefault)
|
Zerotorescue@23
|
854 if groupName and self.db.global.groups[groupName] and self.db.global.groups[groupName][optionName] ~= nil then
|
Zerotorescue@23
|
855 return self.db.global.groups[groupName][optionName];
|
Zerotorescue@23
|
856 elseif self.db.global.defaults[optionName] and not noDefault then
|
Zerotorescue@23
|
857 return self.db.global.defaults[optionName];
|
Zerotorescue@0
|
858 else
|
Zerotorescue@0
|
859 return nil;
|
Zerotorescue@0
|
860 end
|
Zerotorescue@0
|
861 end
|
Zerotorescue@0
|
862
|
Zerotorescue@0
|
863 local function GetOption(info)
|
Zerotorescue@0
|
864 local groupName = groupIdToName[info[2]];
|
Zerotorescue@0
|
865 local optionName = info[#info];
|
Zerotorescue@0
|
866
|
Zerotorescue@1
|
867 return addon:GetOptionByKey(groupName, optionName);
|
Zerotorescue@1
|
868 end
|
Zerotorescue@1
|
869
|
Zerotorescue@1
|
870 local function GetMultiOption(info, value)
|
Zerotorescue@1
|
871 local groupName = groupIdToName[info[2]];
|
Zerotorescue@1
|
872 local optionName = info[#info];
|
Zerotorescue@1
|
873
|
Zerotorescue@1
|
874 if addon.db.global.groups[groupName][optionName] ~= nil then
|
Zerotorescue@1
|
875 return addon.db.global.groups[groupName][optionName][value];
|
Zerotorescue@1
|
876 elseif addon.db.global.defaults[optionName] then
|
Zerotorescue@1
|
877 return addon.db.global.defaults[optionName][value];
|
Zerotorescue@1
|
878 else
|
Zerotorescue@1
|
879 return nil;
|
Zerotorescue@1
|
880 end
|
Zerotorescue@0
|
881 end
|
Zerotorescue@0
|
882
|
Zerotorescue@0
|
883 local function GetDisabled(info)
|
Zerotorescue@0
|
884 if not info.arg or not info.arg:find("override") then
|
Zerotorescue@0
|
885 return false;
|
Zerotorescue@0
|
886 end
|
Zerotorescue@0
|
887
|
Zerotorescue@0
|
888 local groupName = groupIdToName[info[2]];
|
Zerotorescue@0
|
889 local optionName = info[#info];
|
Zerotorescue@0
|
890
|
Zerotorescue@1
|
891 return (addon:GetOptionByKey(groupName, info.arg, true) == nil);
|
Zerotorescue@0
|
892 end
|
Zerotorescue@0
|
893
|
Zerotorescue@0
|
894 local function ValidateGroupName(_, value)
|
Zerotorescue@0
|
895 value = string.lower(string.trim(value or ""));
|
Zerotorescue@0
|
896
|
Zerotorescue@0
|
897 for name, _ in pairs(addon.db.global.groups) do
|
Zerotorescue@0
|
898 if string.lower(name) == value then
|
Zerotorescue@0
|
899 return ("A group named \"%s\" already exists."):format(name);
|
Zerotorescue@0
|
900 end
|
Zerotorescue@0
|
901 end
|
Zerotorescue@0
|
902
|
Zerotorescue@0
|
903 return true;
|
Zerotorescue@0
|
904 end
|
Zerotorescue@0
|
905
|
Zerotorescue@0
|
906 local function AddToGroup(groupName, itemId)
|
Zerotorescue@0
|
907 if InGroup(itemId) then
|
Zerotorescue@0
|
908 return false;
|
Zerotorescue@0
|
909 end
|
Zerotorescue@0
|
910
|
Zerotorescue@0
|
911 if not addon.db.global.groups[groupName].items then
|
Zerotorescue@0
|
912 addon.db.global.groups[groupName].items = {};
|
Zerotorescue@0
|
913 end
|
Zerotorescue@0
|
914
|
Zerotorescue@0
|
915 -- Set this item
|
Zerotorescue@0
|
916 addon.db.global.groups[groupName].items[itemId] = true;
|
Zerotorescue@0
|
917
|
Zerotorescue@0
|
918 -- Now rebuild the list
|
Zerotorescue@11
|
919 AceConfigRegistry:NotifyChange("InventoriumOptions");
|
Zerotorescue@0
|
920
|
Zerotorescue@0
|
921 return true;
|
Zerotorescue@0
|
922 end
|
Zerotorescue@0
|
923
|
Zerotorescue@0
|
924 local tblAddItemTemplate = {
|
Zerotorescue@0
|
925 order = 0,
|
Zerotorescue@0
|
926 type = "input",
|
Zerotorescue@0
|
927 name = function(info)
|
Zerotorescue@0
|
928 local itemName, _, itemRarity = GetItemInfo(info[#info]);
|
Zerotorescue@0
|
929 return tostring( 7 - (itemRarity or 0) ) .. (itemName or "");
|
Zerotorescue@0
|
930 end,
|
Zerotorescue@0
|
931 get = function(info)
|
Zerotorescue@0
|
932 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@0
|
933 end,
|
Zerotorescue@1
|
934 set = function(groupId, itemId)
|
Zerotorescue@0
|
935 -- This is NOT a real "set", we pass the widget reference to this function which contains similar, but not the same, info.
|
Zerotorescue@0
|
936
|
Zerotorescue@1
|
937 if itemId then
|
Zerotorescue@1
|
938 local groupName = groupIdToName[groupId];
|
Zerotorescue@0
|
939
|
Zerotorescue@1
|
940 if not AddToGroup(groupName, itemId) then
|
Zerotorescue@1
|
941 print("|cffff0000Couldn't add the item with itemId (" .. itemId .. ") because it is already in a group.|r");
|
Zerotorescue@0
|
942 end
|
Zerotorescue@0
|
943 end
|
Zerotorescue@0
|
944 end,
|
Zerotorescue@0
|
945 width = "double",
|
Zerotorescue@1
|
946 dialogControl = "ConfigItemLinkButton",
|
Zerotorescue@0
|
947 };
|
Zerotorescue@0
|
948
|
Zerotorescue@0
|
949 local tblRemoveItemTemplate = {
|
Zerotorescue@0
|
950 order = 0,
|
Zerotorescue@0
|
951 type = "input",
|
Zerotorescue@0
|
952 name = function(info)
|
Zerotorescue@0
|
953 local itemName, _, itemRarity = GetItemInfo(info[#info]);
|
Zerotorescue@0
|
954 return tostring( 7 - (itemRarity or 0) ) .. (itemName or "");
|
Zerotorescue@0
|
955 end,
|
Zerotorescue@0
|
956 get = function(info)
|
Zerotorescue@0
|
957 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@0
|
958 end,
|
Zerotorescue@1
|
959 set = function(groupId, itemId)
|
Zerotorescue@0
|
960 -- This is NOT a real "set", we pass the widget reference to this function which contains similar, but not the same, info.
|
Zerotorescue@0
|
961
|
Zerotorescue@1
|
962 if itemId then
|
Zerotorescue@1
|
963 local groupName = groupIdToName[groupId];
|
Zerotorescue@0
|
964
|
Zerotorescue@0
|
965 -- Unset this item
|
Zerotorescue@1
|
966 addon.db.global.groups[groupName].items[itemId] = nil;
|
Zerotorescue@0
|
967
|
Zerotorescue@0
|
968 -- Now rebuild the list
|
Zerotorescue@11
|
969 AceConfigRegistry:NotifyChange("InventoriumOptions");
|
Zerotorescue@0
|
970 end
|
Zerotorescue@0
|
971 end,
|
Zerotorescue@0
|
972 width = "double",
|
Zerotorescue@1
|
973 dialogControl = "ConfigItemLinkButton",
|
Zerotorescue@0
|
974 };
|
Zerotorescue@0
|
975
|
Zerotorescue@0
|
976 local function UpdateAddItemList(info)
|
Zerotorescue@0
|
977 local groupName = groupIdToName[info[2]];
|
Zerotorescue@0
|
978
|
Zerotorescue@0
|
979 if not addon.db.global.groups[groupName].items then
|
Zerotorescue@0
|
980 addon.db.global.groups[groupName].items = {};
|
Zerotorescue@0
|
981 end
|
Zerotorescue@0
|
982
|
Zerotorescue@0
|
983 -- Merge all items from all groups together
|
Zerotorescue@0
|
984 local items = {};
|
Zerotorescue@0
|
985 for groupName, values in pairs(addon.db.global.groups) do
|
Zerotorescue@0
|
986 if values.items then
|
Zerotorescue@0
|
987 for itemId, _ in pairs(values.items) do
|
Zerotorescue@0
|
988 items[itemId] = true;
|
Zerotorescue@0
|
989 end
|
Zerotorescue@0
|
990 end
|
Zerotorescue@0
|
991 end
|
Zerotorescue@0
|
992
|
Zerotorescue@0
|
993 local ref = options.args.groups.args[info[2]].args.add.args.list.args;
|
Zerotorescue@0
|
994
|
Zerotorescue@13
|
995 -- Remaking the list, so out with the old, in with the new
|
Zerotorescue@13
|
996 table.wipe(ref);
|
Zerotorescue@13
|
997
|
Zerotorescue@0
|
998 -- Parse bags and show these
|
Zerotorescue@0
|
999 for bagID = 4, 0, -1 do
|
Zerotorescue@0
|
1000 for slot = 1, GetContainerNumSlots(bagID) do
|
Zerotorescue@0
|
1001 local itemId = addon:GetItemId(GetContainerItemLink(bagID, slot));
|
Zerotorescue@0
|
1002
|
Zerotorescue@0
|
1003 if itemId then
|
Zerotorescue@0
|
1004 if not items[itemId] then
|
Zerotorescue@0
|
1005 -- If this item isn't used in any group yet
|
Zerotorescue@0
|
1006 ref[itemId] = tblAddItemTemplate;
|
Zerotorescue@0
|
1007 else
|
Zerotorescue@0
|
1008 -- It's already used in a group, don't show it
|
Zerotorescue@0
|
1009 ref[itemId] = nil;
|
Zerotorescue@0
|
1010 end
|
Zerotorescue@0
|
1011 end
|
Zerotorescue@0
|
1012 end
|
Zerotorescue@0
|
1013 end
|
Zerotorescue@13
|
1014
|
Zerotorescue@13
|
1015 if includeTradeSkillItems ~= 500 then
|
Zerotorescue@13
|
1016 -- Include tradeskill items
|
Zerotorescue@13
|
1017
|
Zerotorescue@13
|
1018 -- Go through all trade skills for the profession
|
Zerotorescue@13
|
1019 for i = 1, GetNumTradeSkills() do
|
Zerotorescue@13
|
1020 -- Try to retrieve the itemlink, this will be nil if current item is a group instead
|
Zerotorescue@13
|
1021 local itemLink = GetTradeSkillItemLink(i);
|
Zerotorescue@13
|
1022
|
Zerotorescue@13
|
1023 if itemLink then
|
Zerotorescue@13
|
1024 local itemId = addon:GetItemId(itemLink);
|
Zerotorescue@13
|
1025 if not itemId then
|
Zerotorescue@13
|
1026 -- If this isn't an item, it can only be an enchant instead
|
Zerotorescue@13
|
1027 itemId = tonumber(itemLink:match("|Henchant:([-0-9]+)|h"));
|
Zerotorescue@13
|
1028
|
Zerotorescue@17
|
1029 itemId = addon.scrollIds[itemId]; -- change enchantIds into scrollIds
|
Zerotorescue@13
|
1030 end
|
Zerotorescue@13
|
1031
|
Zerotorescue@17
|
1032 if itemId then
|
Zerotorescue@17
|
1033 local itemLevel = select(4, GetItemInfo(itemId)) or 0;
|
Zerotorescue@17
|
1034
|
Zerotorescue@17
|
1035 if includeTradeSkillItems == 0 or itemLevel >= includeTradeSkillItems then
|
Zerotorescue@17
|
1036 if not items[itemId] then
|
Zerotorescue@17
|
1037 -- If this item isn't used in any group yet
|
Zerotorescue@17
|
1038 ref[itemId] = tblAddItemTemplate;
|
Zerotorescue@17
|
1039 else
|
Zerotorescue@17
|
1040 -- It's already used in a group, don't show it
|
Zerotorescue@17
|
1041 ref[itemId] = nil;
|
Zerotorescue@17
|
1042 end
|
Zerotorescue@13
|
1043 end
|
Zerotorescue@17
|
1044 else
|
Zerotorescue@17
|
1045 addon:Debug("|cffff0000ERROR|r: Couldn't find proper item id for " .. itemLink);
|
Zerotorescue@13
|
1046 end
|
Zerotorescue@13
|
1047 end
|
Zerotorescue@13
|
1048 end
|
Zerotorescue@13
|
1049 end
|
Zerotorescue@0
|
1050 end
|
Zerotorescue@0
|
1051
|
Zerotorescue@0
|
1052 local function UpdateRemoveItemList(info)
|
Zerotorescue@0
|
1053 local groupName = groupIdToName[info[2]];
|
Zerotorescue@0
|
1054
|
Zerotorescue@0
|
1055 if not addon.db.global.groups[groupName].items then
|
Zerotorescue@0
|
1056 addon.db.global.groups[groupName].items = {};
|
Zerotorescue@0
|
1057 end
|
Zerotorescue@0
|
1058
|
Zerotorescue@0
|
1059 local ref = options.args.groups.args[info[2]].args.remove.args.list.args;
|
Zerotorescue@0
|
1060
|
Zerotorescue@0
|
1061 -- Unset all
|
Zerotorescue@0
|
1062 for itemId, _ in pairs(ref) do
|
Zerotorescue@0
|
1063 ref[itemId] = nil;
|
Zerotorescue@0
|
1064 end
|
Zerotorescue@0
|
1065
|
Zerotorescue@0
|
1066 -- Parse items in group and show these
|
Zerotorescue@0
|
1067 for itemId, _ in pairs(addon.db.global.groups[groupName].items) do
|
Zerotorescue@0
|
1068 ref[itemId] = tblRemoveItemTemplate;
|
Zerotorescue@0
|
1069 end
|
Zerotorescue@0
|
1070 end
|
Zerotorescue@0
|
1071
|
Zerotorescue@0
|
1072 function addon:GetItemId(itemLink)
|
Zerotorescue@13
|
1073 itemLink = itemLink and itemLink:match("|Hitem:([-0-9]+):"); -- if itemLink is nil, it won't execute the second part
|
Zerotorescue@0
|
1074 itemLink = itemLink and tonumber(itemLink);
|
Zerotorescue@0
|
1075
|
Zerotorescue@0
|
1076 return itemLink;
|
Zerotorescue@0
|
1077 end
|
Zerotorescue@0
|
1078
|
Zerotorescue@0
|
1079 -- Default group
|
Zerotorescue@0
|
1080 local defaultGroup = {
|
Zerotorescue@0
|
1081 order = 0,
|
Zerotorescue@0
|
1082 type = "group",
|
Zerotorescue@0
|
1083 childGroups = "tab",
|
Zerotorescue@0
|
1084 name = function(info)
|
Zerotorescue@30
|
1085 local groupId = info[#info];
|
Zerotorescue@30
|
1086 if groupIsVirtual[groupId] then
|
Zerotorescue@30
|
1087 return ("%s |cfffed000Virtual|r"):format(groupIdToName[groupId]);
|
Zerotorescue@30
|
1088 else
|
Zerotorescue@30
|
1089 return groupIdToName[groupId];
|
Zerotorescue@30
|
1090 end
|
Zerotorescue@30
|
1091 end,
|
Zerotorescue@30
|
1092 desc = function(info)
|
Zerotorescue@30
|
1093 local groupId = info[#info];
|
Zerotorescue@30
|
1094 if groupIsVirtual[groupId] then
|
Zerotorescue@30
|
1095 return "This is a virtual group, you can use it to override the defaults for other groups.";
|
Zerotorescue@30
|
1096 end
|
Zerotorescue@0
|
1097 end,
|
Zerotorescue@0
|
1098 args = {
|
Zerotorescue@0
|
1099 general = {
|
Zerotorescue@0
|
1100 order = 10,
|
Zerotorescue@0
|
1101 type = "group",
|
Zerotorescue@23
|
1102 name = "General",
|
Zerotorescue@23
|
1103 desc = "Change the general settings for just this group.",
|
Zerotorescue@0
|
1104 args = {
|
Zerotorescue@23
|
1105 general = {
|
Zerotorescue@23
|
1106 order = 0,
|
Zerotorescue@23
|
1107 type = "group",
|
Zerotorescue@23
|
1108 inline = true,
|
Zerotorescue@23
|
1109 name = "General",
|
Zerotorescue@23
|
1110 set = SetOption,
|
Zerotorescue@23
|
1111 get = GetOption,
|
Zerotorescue@23
|
1112 disabled = GetDisabled,
|
Zerotorescue@23
|
1113 args = {
|
Zerotorescue@23
|
1114 description = {
|
Zerotorescue@23
|
1115 order = 0,
|
Zerotorescue@23
|
1116 type = "description",
|
Zerotorescue@23
|
1117 name = "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@23
|
1118 },
|
Zerotorescue@23
|
1119 header = {
|
Zerotorescue@23
|
1120 order = 5,
|
Zerotorescue@23
|
1121 type = "header",
|
Zerotorescue@23
|
1122 name = "",
|
Zerotorescue@23
|
1123 },
|
Zerotorescue@23
|
1124 overrideAuctionPricingAddon = {
|
Zerotorescue@23
|
1125 order = 9,
|
Zerotorescue@23
|
1126 type = "toggle",
|
Zerotorescue@23
|
1127 name = "Override pricing addon",
|
Zerotorescue@23
|
1128 desc = "Allows you to override the pricing addon setting for this group.",
|
Zerotorescue@23
|
1129 arg = "auctionPricingAddon",
|
Zerotorescue@23
|
1130 },
|
Zerotorescue@23
|
1131 auctionPricingAddon = {
|
Zerotorescue@23
|
1132 order = 10,
|
Zerotorescue@23
|
1133 type = "select",
|
Zerotorescue@23
|
1134 name = "Prefered pricing addon",
|
Zerotorescue@23
|
1135 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@23
|
1136 values = function()
|
Zerotorescue@23
|
1137 local temp = {};
|
Zerotorescue@23
|
1138 for name, value in pairs(addon.supportedAddons.auctionPricing) do
|
Zerotorescue@23
|
1139 temp[name] = name;
|
Zerotorescue@23
|
1140 end
|
Zerotorescue@23
|
1141
|
Zerotorescue@23
|
1142 return temp;
|
Zerotorescue@23
|
1143 end,
|
Zerotorescue@23
|
1144 arg = "overrideAuctionPricingAddon",
|
Zerotorescue@23
|
1145 },
|
Zerotorescue@23
|
1146 overrideItemCountAddon = {
|
Zerotorescue@23
|
1147 order = 19,
|
Zerotorescue@23
|
1148 type = "toggle",
|
Zerotorescue@23
|
1149 name = "Override item count addon",
|
Zerotorescue@23
|
1150 desc = "Allows you to override the item count addon setting for this group.",
|
Zerotorescue@23
|
1151 arg = "itemCountAddon",
|
Zerotorescue@23
|
1152 },
|
Zerotorescue@23
|
1153 itemCountAddon = {
|
Zerotorescue@23
|
1154 order = 20,
|
Zerotorescue@23
|
1155 type = "select",
|
Zerotorescue@23
|
1156 name = "Prefered item count addon",
|
Zerotorescue@23
|
1157 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@23
|
1158 values = function()
|
Zerotorescue@23
|
1159 local temp = {};
|
Zerotorescue@23
|
1160 for name, value in pairs(addon.supportedAddons.itemCount) do
|
Zerotorescue@23
|
1161 temp[name] = name;
|
Zerotorescue@23
|
1162 end
|
Zerotorescue@23
|
1163
|
Zerotorescue@23
|
1164 return temp;
|
Zerotorescue@23
|
1165 end,
|
Zerotorescue@23
|
1166 arg = "overrideItemCountAddon",
|
Zerotorescue@23
|
1167 },
|
Zerotorescue@23
|
1168 overrideCraftingAddon = {
|
Zerotorescue@23
|
1169 order = 29,
|
Zerotorescue@23
|
1170 type = "toggle",
|
Zerotorescue@23
|
1171 name = "Override crafting addon",
|
Zerotorescue@23
|
1172 desc = "Allows you to override the crafting addon setting for this group.",
|
Zerotorescue@23
|
1173 arg = "craftingAddon",
|
Zerotorescue@23
|
1174 },
|
Zerotorescue@23
|
1175 craftingAddon = {
|
Zerotorescue@23
|
1176 order = 30,
|
Zerotorescue@23
|
1177 type = "select",
|
Zerotorescue@23
|
1178 name = "Prefered crafting addon",
|
Zerotorescue@23
|
1179 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@23
|
1180 values = function()
|
Zerotorescue@23
|
1181 local temp = {};
|
Zerotorescue@23
|
1182 for name, value in pairs(addon.supportedAddons.crafting) do
|
Zerotorescue@23
|
1183 temp[name] = name;
|
Zerotorescue@23
|
1184 end
|
Zerotorescue@23
|
1185
|
Zerotorescue@23
|
1186 return temp;
|
Zerotorescue@23
|
1187 end,
|
Zerotorescue@23
|
1188 arg = "overrideCraftingAddon",
|
Zerotorescue@23
|
1189 },
|
Zerotorescue@30
|
1190 virtualGroup = {
|
Zerotorescue@30
|
1191 order = 40,
|
Zerotorescue@30
|
1192 type = "select",
|
Zerotorescue@30
|
1193 name = "Use virtual group settings",
|
Zerotorescue@30
|
1194 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@30
|
1195 values = function()
|
Zerotorescue@30
|
1196 local temp = {};
|
Zerotorescue@30
|
1197
|
Zerotorescue@30
|
1198 --TODO: Build list based on virtual groups we have, exclude the currently selected virtual group (allow endless linking, e.g. Normal group -> virtual1 -> virtual2 -> virtual3 -> ... -> defaults, do this by calling the "GetOptionByKey" function whenever a virtual group is enabled)
|
Zerotorescue@30
|
1199 temp[""] = "";
|
Zerotorescue@30
|
1200 temp["NYI"] = "Not Yet Implemented";
|
Zerotorescue@30
|
1201
|
Zerotorescue@30
|
1202 return temp;
|
Zerotorescue@30
|
1203 end,
|
Zerotorescue@30
|
1204 },
|
Zerotorescue@23
|
1205 },
|
Zerotorescue@23
|
1206 },
|
Zerotorescue@0
|
1207 minimumStock = {
|
Zerotorescue@0
|
1208 order = 10,
|
Zerotorescue@0
|
1209 type = "group",
|
Zerotorescue@0
|
1210 inline = true,
|
Zerotorescue@0
|
1211 name = "Minimum stock",
|
Zerotorescue@0
|
1212 set = SetOption,
|
Zerotorescue@0
|
1213 get = GetOption,
|
Zerotorescue@0
|
1214 disabled = GetDisabled,
|
Zerotorescue@0
|
1215 args = {
|
Zerotorescue@0
|
1216 description = {
|
Zerotorescue@0
|
1217 order = 0,
|
Zerotorescue@0
|
1218 type = "description",
|
Zerotorescue@0
|
1219 name = "Here you can specify the minimum amount of items you wish to keep in stock and related settings for the currently selected group.",
|
Zerotorescue@0
|
1220 },
|
Zerotorescue@0
|
1221 header = {
|
Zerotorescue@0
|
1222 order = 5,
|
Zerotorescue@0
|
1223 type = "header",
|
Zerotorescue@0
|
1224 name = "",
|
Zerotorescue@0
|
1225 },
|
Zerotorescue@0
|
1226 overrideMinimumStock = {
|
Zerotorescue@0
|
1227 order = 9,
|
Zerotorescue@0
|
1228 type = "toggle",
|
Zerotorescue@0
|
1229 name = "Override min stock",
|
Zerotorescue@0
|
1230 desc = "Allows you to override the minimum stock setting for this group.",
|
Zerotorescue@0
|
1231 arg = "minimumStock",
|
Zerotorescue@0
|
1232 },
|
Zerotorescue@0
|
1233 minimumStock = {
|
Zerotorescue@0
|
1234 order = 10,
|
Zerotorescue@0
|
1235 type = "range",
|
Zerotorescue@0
|
1236 min = 0,
|
Zerotorescue@0
|
1237 max = 100000,
|
Zerotorescue@17
|
1238 softMax = 100,
|
Zerotorescue@0
|
1239 step = 1,
|
Zerotorescue@0
|
1240 name = "Minimum stock",
|
Zerotorescue@17
|
1241 desc = "You can manually enter a value between 100 and 100.000 in the text box below if the provided range is insufficient.",
|
Zerotorescue@0
|
1242 arg = "overrideMinimumStock",
|
Zerotorescue@0
|
1243 },
|
Zerotorescue@0
|
1244 overrideSummaryThresholdShow = {
|
Zerotorescue@0
|
1245 order = 19,
|
Zerotorescue@0
|
1246 type = "toggle",
|
Zerotorescue@0
|
1247 name = "Override summary showing",
|
Zerotorescue@0
|
1248 desc = "Allows you to override when this group should appear in the summary.",
|
Zerotorescue@0
|
1249 arg = "summaryThresholdShow",
|
Zerotorescue@0
|
1250 },
|
Zerotorescue@0
|
1251 summaryThresholdShow = {
|
Zerotorescue@0
|
1252 order = 20,
|
Zerotorescue@0
|
1253 type = "range",
|
Zerotorescue@0
|
1254 min = 0,
|
Zerotorescue@0
|
1255 max = 100,
|
Zerotorescue@0
|
1256 softMax = 10,
|
Zerotorescue@0
|
1257 step = 0.05,
|
Zerotorescue@0
|
1258 isPercent = true,
|
Zerotorescue@0
|
1259 name = "Show in summary when below",
|
Zerotorescue@0
|
1260 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@0
|
1261 arg = "overrideSummaryThresholdShow",
|
Zerotorescue@0
|
1262 },
|
Zerotorescue@0
|
1263 overrideAlertBelowMinimum = {
|
Zerotorescue@0
|
1264 order = 29,
|
Zerotorescue@0
|
1265 type = "toggle",
|
Zerotorescue@0
|
1266 name = "Override minimum alert",
|
Zerotorescue@0
|
1267 desc = "Allows you to override wether an alert should be shown when an item in this group gets below the minimum stock threshold.",
|
Zerotorescue@0
|
1268 arg = "alertBelowMinimum",
|
Zerotorescue@0
|
1269 },
|
Zerotorescue@0
|
1270 alertBelowMinimum = {
|
Zerotorescue@0
|
1271 order = 30,
|
Zerotorescue@0
|
1272 type = "toggle",
|
Zerotorescue@30
|
1273 name = "NYI | Alert when below minimum",
|
Zerotorescue@0
|
1274 desc = "Show an alert when an item in this group gets below the minimum stock threshold.",
|
Zerotorescue@0
|
1275 arg = "overrideAlertBelowMinimum",
|
Zerotorescue@0
|
1276 },
|
Zerotorescue@1
|
1277 overrideTrackAtCharacters = {
|
Zerotorescue@1
|
1278 order = 39,
|
Zerotorescue@1
|
1279 type = "toggle",
|
Zerotorescue@1
|
1280 name = "Override track at",
|
Zerotorescue@1
|
1281 desc = "Allows you to override at which characters items in this group should appear in the summary and generate alerts.",
|
Zerotorescue@1
|
1282 arg = "trackAtCharacters",
|
Zerotorescue@1
|
1283 },
|
Zerotorescue@1
|
1284 trackAtCharacters = {
|
Zerotorescue@1
|
1285 order = 40,
|
Zerotorescue@1
|
1286 type = "multiselect",
|
Zerotorescue@1
|
1287 name = "Track at",
|
Zerotorescue@1
|
1288 desc = "Select at which characters this should appear in the summary and generate alerts.",
|
Zerotorescue@1
|
1289 values = function()
|
Zerotorescue@1
|
1290 local temp = {};
|
Zerotorescue@1
|
1291 for charName in pairs(addon.db.factionrealm.characters) do
|
Zerotorescue@1
|
1292 temp[charName] = charName;
|
Zerotorescue@1
|
1293 end
|
Zerotorescue@1
|
1294
|
Zerotorescue@1
|
1295 return temp;
|
Zerotorescue@1
|
1296 end,
|
Zerotorescue@1
|
1297 get = GetMultiOption,
|
Zerotorescue@13
|
1298 --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@1
|
1299 arg = "overrideTrackAtCharacters",
|
Zerotorescue@1
|
1300 },
|
Zerotorescue@0
|
1301 },
|
Zerotorescue@0
|
1302 },
|
Zerotorescue@0
|
1303 refill = {
|
Zerotorescue@0
|
1304 order = 20,
|
Zerotorescue@0
|
1305 type = "group",
|
Zerotorescue@0
|
1306 inline = true,
|
Zerotorescue@0
|
1307 name = "Replenishing stock",
|
Zerotorescue@0
|
1308 set = SetOption,
|
Zerotorescue@0
|
1309 get = GetOption,
|
Zerotorescue@0
|
1310 disabled = GetDisabled,
|
Zerotorescue@0
|
1311 args = {
|
Zerotorescue@0
|
1312 description = {
|
Zerotorescue@0
|
1313 order = 0,
|
Zerotorescue@0
|
1314 type = "description",
|
Zerotorescue@0
|
1315 name = function(info)
|
Zerotorescue@0
|
1316 local groupName = groupIdToName[info[2]];
|
Zerotorescue@0
|
1317 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@0
|
1318
|
Zerotorescue@17
|
1319 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@0
|
1320
|
Zerotorescue@0
|
1321 return r;
|
Zerotorescue@0
|
1322 end,
|
Zerotorescue@0
|
1323 },
|
Zerotorescue@0
|
1324 header = {
|
Zerotorescue@0
|
1325 order = 5,
|
Zerotorescue@0
|
1326 type = "header",
|
Zerotorescue@0
|
1327 name = "",
|
Zerotorescue@0
|
1328 },
|
Zerotorescue@0
|
1329 overrideRestockTarget = {
|
Zerotorescue@0
|
1330 order = 9,
|
Zerotorescue@0
|
1331 type = "toggle",
|
Zerotorescue@0
|
1332 name = "Override restock target",
|
Zerotorescue@0
|
1333 desc = "Allows you to override the restock target setting for this group.",
|
Zerotorescue@0
|
1334 arg = "restockTarget",
|
Zerotorescue@0
|
1335 },
|
Zerotorescue@0
|
1336 restockTarget = {
|
Zerotorescue@0
|
1337 order = 10,
|
Zerotorescue@0
|
1338 type = "range",
|
Zerotorescue@0
|
1339 min = 0,
|
Zerotorescue@0
|
1340 max = 100000,
|
Zerotorescue@30
|
1341 softMax = 100,
|
Zerotorescue@0
|
1342 step = 1,
|
Zerotorescue@0
|
1343 name = "Restock target",
|
Zerotorescue@30
|
1344 desc = "You can manually enter a value between 100 and 100.000 in the edit box if the provided range is insufficient.",
|
Zerotorescue@0
|
1345 arg = "overrideRestockTarget",
|
Zerotorescue@0
|
1346 },
|
Zerotorescue@0
|
1347 overrideMinCraftingQueue = {
|
Zerotorescue@0
|
1348 order = 19,
|
Zerotorescue@0
|
1349 type = "toggle",
|
Zerotorescue@0
|
1350 name = "Override min queue",
|
Zerotorescue@0
|
1351 desc = "Allows you to override the minimum craftable items queue setting for this group.",
|
Zerotorescue@0
|
1352 arg = "minCraftingQueue",
|
Zerotorescue@0
|
1353 },
|
Zerotorescue@0
|
1354 minCraftingQueue = {
|
Zerotorescue@0
|
1355 order = 20,
|
Zerotorescue@0
|
1356 type = "range",
|
Zerotorescue@0
|
1357 min = 0,
|
Zerotorescue@0
|
1358 max = 1,
|
Zerotorescue@0
|
1359 step = 0.01,
|
Zerotorescue@0
|
1360 isPercent = true,
|
Zerotorescue@0
|
1361 name = "Don't queue if I only miss",
|
Zerotorescue@0
|
1362 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@0
|
1363 arg = "overrideMinCraftingQueue",
|
Zerotorescue@0
|
1364 },
|
Zerotorescue@1
|
1365 overrideBonusQueue = {
|
Zerotorescue@1
|
1366 order = 29,
|
Zerotorescue@1
|
1367 type = "toggle",
|
Zerotorescue@1
|
1368 name = "Override bonus queue",
|
Zerotorescue@1
|
1369 desc = "Allows you to override the bonus craftable items queue setting for this group.",
|
Zerotorescue@1
|
1370 arg = "bonusQueue",
|
Zerotorescue@1
|
1371 },
|
Zerotorescue@1
|
1372 bonusQueue = {
|
Zerotorescue@1
|
1373 order = 30,
|
Zerotorescue@1
|
1374 type = "range",
|
Zerotorescue@1
|
1375 min = 0,
|
Zerotorescue@1
|
1376 max = 10, -- 1000%
|
Zerotorescue@1
|
1377 step = 0.01, -- 1%
|
Zerotorescue@1
|
1378 isPercent = true,
|
Zerotorescue@1
|
1379 name = "Bonus queue",
|
Zerotorescue@1
|
1380 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@1
|
1381 arg = "overrideBonusQueue",
|
Zerotorescue@1
|
1382 },
|
Zerotorescue@1
|
1383 overridePriceThreshold = {
|
Zerotorescue@1
|
1384 order = 39,
|
Zerotorescue@1
|
1385 type = "toggle",
|
Zerotorescue@1
|
1386 name = "Override price threshold",
|
Zerotorescue@1
|
1387 desc = "Allows you to override the price threshold setting for this group.",
|
Zerotorescue@1
|
1388 arg = "priceThreshold",
|
Zerotorescue@1
|
1389 },
|
Zerotorescue@1
|
1390 priceThreshold = {
|
Zerotorescue@1
|
1391 order = 40,
|
Zerotorescue@1
|
1392 type = "input",
|
Zerotorescue@1
|
1393 name = "Price threshold",
|
Zerotorescue@1
|
1394 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@1
|
1395 validate = function(info, value) return addon:ValidateReadableMoney(info, value); end,
|
Zerotorescue@1
|
1396 get = function(i) return addon:ReadableMoney(GetOption(i)); end,
|
Zerotorescue@1
|
1397 set = function(i, v) SetOption(i, addon:ReadableMoneyToCopper(v)); end,
|
Zerotorescue@1
|
1398 arg = "overridePriceThreshold",
|
Zerotorescue@1
|
1399 },
|
Zerotorescue@13
|
1400 overrideSummaryHidePriceThreshold = {
|
Zerotorescue@1
|
1401 order = 49,
|
Zerotorescue@1
|
1402 type = "toggle",
|
Zerotorescue@1
|
1403 name = "Override summary showing",
|
Zerotorescue@1
|
1404 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@13
|
1405 arg = "summaryHidePriceThreshold",
|
Zerotorescue@1
|
1406 },
|
Zerotorescue@13
|
1407 summaryHidePriceThreshold = {
|
Zerotorescue@1
|
1408 order = 50,
|
Zerotorescue@1
|
1409 type = "toggle",
|
Zerotorescue@1
|
1410 name = "Hide when below threshold",
|
Zerotorescue@1
|
1411 desc = "Hide items from the summary when their value is below the set price threshold.",
|
Zerotorescue@13
|
1412 arg = "overrideSummaryHidePriceThreshold",
|
Zerotorescue@1
|
1413 },
|
Zerotorescue@30
|
1414 overrideQueueSkipPriceThreshild = {
|
Zerotorescue@30
|
1415 order = 54,
|
Zerotorescue@30
|
1416 type = "toggle",
|
Zerotorescue@30
|
1417 name = "Override queue skipping",
|
Zerotorescue@30
|
1418 desc = "Allows you to override if items in this group should be skipped when queueing while their value is below the price threshold.",
|
Zerotorescue@30
|
1419 arg = "queueSkipPriceThreshild",
|
Zerotorescue@30
|
1420 },
|
Zerotorescue@30
|
1421 queueSkipPriceThreshild = {
|
Zerotorescue@30
|
1422 order = 55,
|
Zerotorescue@30
|
1423 type = "toggle",
|
Zerotorescue@30
|
1424 name = "NYI | Don't queue when below threshold",
|
Zerotorescue@30
|
1425 desc = "Do not queue items when their value is below the set price threshold.",
|
Zerotorescue@30
|
1426 arg = "overrideQueueSkipPriceThreshild",
|
Zerotorescue@30
|
1427 },
|
Zerotorescue@23
|
1428 overrideAlwaysGetAuctionValue = {
|
Zerotorescue@23
|
1429 order = 59,
|
Zerotorescue@23
|
1430 type = "toggle",
|
Zerotorescue@23
|
1431 name = "Override auction value showing",
|
Zerotorescue@23
|
1432 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.",
|
Zerotorescue@23
|
1433 arg = "alwaysGetAuctionValue",
|
Zerotorescue@23
|
1434 },
|
Zerotorescue@23
|
1435 alwaysGetAuctionValue = {
|
Zerotorescue@23
|
1436 order = 60,
|
Zerotorescue@23
|
1437 type = "toggle",
|
Zerotorescue@23
|
1438 name = "Always show auction value",
|
Zerotorescue@23
|
1439 desc = "Always cache and show the auction value of items in this group, even if the price threshold is set to 0.",
|
Zerotorescue@23
|
1440 arg = "overrideAlwaysGetAuctionValue",
|
Zerotorescue@23
|
1441 },
|
Zerotorescue@0
|
1442 },
|
Zerotorescue@0
|
1443 },
|
Zerotorescue@0
|
1444 },
|
Zerotorescue@0
|
1445 },
|
Zerotorescue@0
|
1446 group = {
|
Zerotorescue@0
|
1447 order = 20,
|
Zerotorescue@0
|
1448 type = "group",
|
Zerotorescue@23
|
1449 name = "Management",
|
Zerotorescue@23
|
1450 desc = "Rename, delete, duplicate or export this group.",
|
Zerotorescue@0
|
1451 args = {
|
Zerotorescue@10
|
1452 actions = {
|
Zerotorescue@0
|
1453 order = 10,
|
Zerotorescue@0
|
1454 type = "group",
|
Zerotorescue@10
|
1455 name = "Actions",
|
Zerotorescue@0
|
1456 inline = true,
|
Zerotorescue@0
|
1457 args = {
|
Zerotorescue@0
|
1458 rename = {
|
Zerotorescue@0
|
1459 order = 10,
|
Zerotorescue@0
|
1460 type = "input",
|
Zerotorescue@10
|
1461 name = "Rename group - New name",
|
Zerotorescue@0
|
1462 desc = "Change the name of this group to something else. You can also use item links here as you wish.",
|
Zerotorescue@0
|
1463 validate = ValidateGroupName,
|
Zerotorescue@0
|
1464 set = function(info, value)
|
Zerotorescue@0
|
1465 local oldGroupName = groupIdToName[info[2]];
|
Zerotorescue@0
|
1466
|
Zerotorescue@0
|
1467 addon.db.global.groups[value] = CopyTable(addon.db.global.groups[oldGroupName]);
|
Zerotorescue@0
|
1468 addon.db.global.groups[oldGroupName] = nil;
|
Zerotorescue@0
|
1469
|
Zerotorescue@0
|
1470 groupIdToName[info[2]] = value;
|
Zerotorescue@0
|
1471 groupIdToName[value] = true;
|
Zerotorescue@0
|
1472 groupIdToName[oldGroupName] = nil;
|
Zerotorescue@0
|
1473
|
Zerotorescue@0
|
1474 addon:FillGroupOptions();
|
Zerotorescue@0
|
1475 end,
|
Zerotorescue@0
|
1476 get = function(info)
|
Zerotorescue@0
|
1477 return groupIdToName[info[2]];
|
Zerotorescue@0
|
1478 end,
|
Zerotorescue@0
|
1479 },
|
Zerotorescue@10
|
1480 duplicate = {
|
Zerotorescue@10
|
1481 order = 20,
|
Zerotorescue@10
|
1482 type = "input",
|
Zerotorescue@10
|
1483 name = "Duplicate group - New name",
|
Zerotorescue@10
|
1484 desc = "Duplicate this group. You can also use item links here as you wish.\n\nAll item data will be erased.",
|
Zerotorescue@10
|
1485 validate = ValidateGroupName,
|
Zerotorescue@10
|
1486 set = function(info, value)
|
Zerotorescue@10
|
1487 local oldGroupName = groupIdToName[info[2]];
|
Zerotorescue@10
|
1488
|
Zerotorescue@10
|
1489 addon.db.global.groups[value] = CopyTable(addon.db.global.groups[oldGroupName]);
|
Zerotorescue@10
|
1490
|
Zerotorescue@10
|
1491 -- Reset item data (duplicate items me no want)
|
Zerotorescue@10
|
1492 addon.db.global.groups[value].items = nil;
|
Zerotorescue@10
|
1493
|
Zerotorescue@10
|
1494 addon:FillGroupOptions();
|
Zerotorescue@10
|
1495 end,
|
Zerotorescue@10
|
1496 get = false,
|
Zerotorescue@10
|
1497 },
|
Zerotorescue@0
|
1498 delete = {
|
Zerotorescue@10
|
1499 order = 30,
|
Zerotorescue@0
|
1500 type = "execute",
|
Zerotorescue@0
|
1501 name = "Delete group",
|
Zerotorescue@0
|
1502 desc = "Delete the currently selected group.",
|
Zerotorescue@0
|
1503 confirm = true,
|
Zerotorescue@0
|
1504 confirmText = "Are you sure you wish to |cffff0000DELETE|r this group? This action is not reversable!",
|
Zerotorescue@0
|
1505 func = function(info)
|
Zerotorescue@0
|
1506 local groupName = groupIdToName[info[2]];
|
Zerotorescue@0
|
1507
|
Zerotorescue@0
|
1508 addon.db.global.groups[groupName] = nil;
|
Zerotorescue@0
|
1509
|
Zerotorescue@0
|
1510 addon:FillGroupOptions();
|
Zerotorescue@0
|
1511 end,
|
Zerotorescue@0
|
1512 },
|
Zerotorescue@0
|
1513 },
|
Zerotorescue@0
|
1514 },
|
Zerotorescue@0
|
1515 export = {
|
Zerotorescue@10
|
1516 order = 40,
|
Zerotorescue@0
|
1517 type = "group",
|
Zerotorescue@0
|
1518 name = "Export",
|
Zerotorescue@0
|
1519 inline = true,
|
Zerotorescue@0
|
1520 args = {
|
Zerotorescue@0
|
1521 input = {
|
Zerotorescue@0
|
1522 order = 10,
|
Zerotorescue@0
|
1523 type = "input",
|
Zerotorescue@0
|
1524 multiline = true,
|
Zerotorescue@0
|
1525 name = "Group data",
|
Zerotorescue@0
|
1526 width = "full",
|
Zerotorescue@0
|
1527 desc = "Export the group data for the currently selected group. Press CTRL-A to select all and CTRL-C to copy the text.",
|
Zerotorescue@0
|
1528 set = false,
|
Zerotorescue@0
|
1529 get = function(info)
|
Zerotorescue@0
|
1530 local groupName = groupIdToName[info[2]];
|
Zerotorescue@0
|
1531
|
Zerotorescue@0
|
1532 -- We want to include the group name, so we copy the table then set another value
|
Zerotorescue@0
|
1533 local temp = CopyTable(addon.db.global.groups[groupName]);
|
Zerotorescue@0
|
1534 temp.name = groupName;
|
Zerotorescue@9
|
1535 temp.trackAtCharacters = nil;
|
Zerotorescue@9
|
1536 temp.overrideTrackAtCharacters = nil;
|
Zerotorescue@0
|
1537
|
Zerotorescue@0
|
1538 if not AceSerializer then
|
Zerotorescue@0
|
1539 AceSerializer = LibStub("AceSerializer-3.0");
|
Zerotorescue@0
|
1540 end
|
Zerotorescue@0
|
1541
|
Zerotorescue@0
|
1542 return AceSerializer:Serialize(temp);
|
Zerotorescue@0
|
1543 end,
|
Zerotorescue@0
|
1544 },
|
Zerotorescue@0
|
1545 },
|
Zerotorescue@0
|
1546 },
|
Zerotorescue@0
|
1547 },
|
Zerotorescue@0
|
1548 },
|
Zerotorescue@0
|
1549 add = {
|
Zerotorescue@0
|
1550 order = 30,
|
Zerotorescue@0
|
1551 type = "group",
|
Zerotorescue@0
|
1552 name = "Add items",
|
Zerotorescue@23
|
1553 desc = "Add new items to this group.",
|
Zerotorescue@30
|
1554 disabled = function(info) return groupIsVirtual[info[2]]; end,
|
Zerotorescue@0
|
1555 args = {
|
Zerotorescue@0
|
1556 singleAdd = {
|
Zerotorescue@0
|
1557 order = 10,
|
Zerotorescue@0
|
1558 type = "group",
|
Zerotorescue@0
|
1559 inline = true,
|
Zerotorescue@0
|
1560 name = "Add items",
|
Zerotorescue@0
|
1561 args = {
|
Zerotorescue@0
|
1562 help = {
|
Zerotorescue@0
|
1563 order = 10,
|
Zerotorescue@0
|
1564 type = "description",
|
Zerotorescue@0
|
1565 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@0
|
1566 },
|
Zerotorescue@0
|
1567 itemLink = {
|
Zerotorescue@0
|
1568 order = 20,
|
Zerotorescue@0
|
1569 type = "input",
|
Zerotorescue@0
|
1570 name = "Single item add (item-link or item-id)",
|
Zerotorescue@0
|
1571 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@0
|
1572 validate = function(info, value)
|
Zerotorescue@0
|
1573 -- If the value is empty we'll allow passing to clear the carret
|
Zerotorescue@0
|
1574 if value == "" then return true; end
|
Zerotorescue@0
|
1575
|
Zerotorescue@0
|
1576 local groupName = groupIdToName[info[2]];
|
Zerotorescue@0
|
1577
|
Zerotorescue@0
|
1578 local itemId = addon:GetItemId(string.trim(value or "")) or tonumber(string.trim(value or ""));
|
Zerotorescue@0
|
1579
|
Zerotorescue@0
|
1580 if not itemId then
|
Zerotorescue@0
|
1581 return "This is not a valid item link.";
|
Zerotorescue@0
|
1582 elseif InGroup(itemId) then
|
Zerotorescue@0
|
1583 return ("This item is already in the group \"%s\"."):format(InGroup(itemId));
|
Zerotorescue@0
|
1584 end
|
Zerotorescue@0
|
1585
|
Zerotorescue@0
|
1586 return true;
|
Zerotorescue@0
|
1587 end,
|
Zerotorescue@0
|
1588 set = function(info, value)
|
Zerotorescue@0
|
1589 if value and value ~= "" then
|
Zerotorescue@0
|
1590 local groupName = groupIdToName[info[2]];
|
Zerotorescue@0
|
1591
|
Zerotorescue@0
|
1592 local itemId = addon:GetItemId(string.trim(value or "")) or tonumber(string.trim(value or ""));
|
Zerotorescue@0
|
1593
|
Zerotorescue@0
|
1594 AddToGroup(groupName, itemId);
|
Zerotorescue@0
|
1595
|
Zerotorescue@0
|
1596 print(("Added %s"):format(select(2, GetItemInfo(itemId)) or ("Unknown (#%d)"):format(itemId)));
|
Zerotorescue@0
|
1597 end
|
Zerotorescue@0
|
1598 end,
|
Zerotorescue@0
|
1599 get = false,
|
Zerotorescue@0
|
1600 },
|
Zerotorescue@17
|
1601 importItemData = {
|
Zerotorescue@17
|
1602 order = 30,
|
Zerotorescue@0
|
1603 type = "input",
|
Zerotorescue@0
|
1604 name = "Import item data",
|
Zerotorescue@0
|
1605 desc = "Import item data from an exported item data-string. Any items already grouped will be skipped.",
|
Zerotorescue@0
|
1606 set = function(info, value)
|
Zerotorescue@0
|
1607 local groupName = groupIdToName[info[2]];
|
Zerotorescue@0
|
1608
|
Zerotorescue@0
|
1609 local allItemIds = { string.split(";", value or "") };
|
Zerotorescue@0
|
1610
|
Zerotorescue@0
|
1611 for _, value in pairs(allItemIds) do
|
Zerotorescue@0
|
1612 local itemId = tonumber(value);
|
Zerotorescue@0
|
1613
|
Zerotorescue@0
|
1614 if not itemId then
|
Zerotorescue@0
|
1615 print(("\"%s\" is not a number."):format(value));
|
Zerotorescue@0
|
1616 elseif InGroup(itemId) then
|
Zerotorescue@0
|
1617 print(("Skipping %s (#%d) as it is already in the group |cfffed000%s|r."):format(select(2, GetItemInfo(itemId)) or "Unknown", itemId, InGroup(itemId)));
|
Zerotorescue@0
|
1618 else
|
Zerotorescue@0
|
1619 AddToGroup(groupName, itemId);
|
Zerotorescue@0
|
1620 end
|
Zerotorescue@0
|
1621 end
|
Zerotorescue@0
|
1622 end,
|
Zerotorescue@0
|
1623 get = false,
|
Zerotorescue@0
|
1624 },
|
Zerotorescue@17
|
1625 importPremadeData = {
|
Zerotorescue@17
|
1626 order = 40,
|
Zerotorescue@17
|
1627 type = "select",
|
Zerotorescue@17
|
1628 name = "Import premade data",
|
Zerotorescue@17
|
1629 desc = "Import item data from a premade item-group. Any items already grouped will be skipped.",
|
Zerotorescue@17
|
1630 values = function()
|
Zerotorescue@17
|
1631 local temp = {};
|
Zerotorescue@17
|
1632 for key, group in pairs(addon.defaultGroups) do
|
Zerotorescue@17
|
1633 temp[key] = key;
|
Zerotorescue@17
|
1634 end
|
Zerotorescue@17
|
1635
|
Zerotorescue@17
|
1636 return temp;
|
Zerotorescue@17
|
1637 end,
|
Zerotorescue@17
|
1638 set = function(info, value)
|
Zerotorescue@17
|
1639 local groupName = groupIdToName[info[2]];
|
Zerotorescue@17
|
1640
|
Zerotorescue@17
|
1641 print(("Importing items from the premade group \"|cfffed000%s|r\"."):format(value));
|
Zerotorescue@17
|
1642
|
Zerotorescue@17
|
1643 -- Remember we imported this group and it's version so if it is ever changed, people can be notified
|
Zerotorescue@17
|
1644 if not addon.db.global.groups[groupName].premadeGroups then
|
Zerotorescue@17
|
1645 addon.db.global.groups[groupName].premadeGroups = {};
|
Zerotorescue@17
|
1646 end
|
Zerotorescue@17
|
1647 addon.db.global.groups[groupName].premadeGroups[value] = addon.defaultGroups[value].version;
|
Zerotorescue@17
|
1648
|
Zerotorescue@17
|
1649 for itemId, _ in pairs(addon.defaultGroups[value].items) do
|
Zerotorescue@17
|
1650 itemId = itemId and tonumber(itemId);
|
Zerotorescue@17
|
1651
|
Zerotorescue@17
|
1652 if not itemId then
|
Zerotorescue@17
|
1653 print(("\"|cfffed000%s|r\" is not a number."):format(value));
|
Zerotorescue@17
|
1654 elseif InGroup(itemId) then
|
Zerotorescue@17
|
1655 print(("Skipping |cfffed000%s|r (#%d) as it is already in the group |cfffed000%s|r."):format(select(2, GetItemInfo(itemId)) or "Unknown", itemId, InGroup(itemId)));
|
Zerotorescue@17
|
1656 else
|
Zerotorescue@17
|
1657 AddToGroup(groupName, itemId);
|
Zerotorescue@17
|
1658 end
|
Zerotorescue@17
|
1659 end
|
Zerotorescue@17
|
1660 end,
|
Zerotorescue@17
|
1661 get = false,
|
Zerotorescue@17
|
1662 },
|
Zerotorescue@0
|
1663 },
|
Zerotorescue@0
|
1664 },
|
Zerotorescue@0
|
1665 massAdd = {
|
Zerotorescue@0
|
1666 order = 20,
|
Zerotorescue@0
|
1667 type = "group",
|
Zerotorescue@0
|
1668 inline = true,
|
Zerotorescue@0
|
1669 name = "Mass add",
|
Zerotorescue@0
|
1670 args = {
|
Zerotorescue@0
|
1671 help = {
|
Zerotorescue@0
|
1672 order = 10,
|
Zerotorescue@0
|
1673 type = "description",
|
Zerotorescue@0
|
1674 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@0
|
1675 },
|
Zerotorescue@0
|
1676 massAdd = {
|
Zerotorescue@0
|
1677 order = 20,
|
Zerotorescue@0
|
1678 type = "input",
|
Zerotorescue@0
|
1679 name = "Add all items matching...",
|
Zerotorescue@0
|
1680 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@13
|
1681 set = function(info, value)
|
Zerotorescue@17
|
1682 local groupName = groupIdToName[info[2]];
|
Zerotorescue@17
|
1683
|
Zerotorescue@13
|
1684 if not value then return; end
|
Zerotorescue@13
|
1685
|
Zerotorescue@13
|
1686 value = value:lower();
|
Zerotorescue@13
|
1687
|
Zerotorescue@13
|
1688 local ref = options.args.groups.args[info[2]].args.add.args.list.args;
|
Zerotorescue@13
|
1689
|
Zerotorescue@13
|
1690 for itemId, test in pairs(ref) do
|
Zerotorescue@13
|
1691 if test then
|
Zerotorescue@13
|
1692 local itemName = GetItemInfo(itemId);
|
Zerotorescue@13
|
1693
|
Zerotorescue@13
|
1694 if itemName:lower():find(value) then
|
Zerotorescue@13
|
1695 if not AddToGroup(groupName, itemId) then
|
Zerotorescue@13
|
1696 print("|cffff0000Couldn't add the item with itemId (" .. itemId .. ") because it is already in a group.|r");
|
Zerotorescue@13
|
1697 end
|
Zerotorescue@13
|
1698 end
|
Zerotorescue@13
|
1699 end
|
Zerotorescue@13
|
1700 end
|
Zerotorescue@13
|
1701 end,
|
Zerotorescue@0
|
1702 get = false,
|
Zerotorescue@0
|
1703 },
|
Zerotorescue@13
|
1704 minItemLevel = {
|
Zerotorescue@13
|
1705 order = 40,
|
Zerotorescue@13
|
1706 type = "select",
|
Zerotorescue@13
|
1707 values = function()
|
Zerotorescue@13
|
1708 local temp = {};
|
Zerotorescue@13
|
1709
|
Zerotorescue@13
|
1710 temp[0] = "Include everything";
|
Zerotorescue@13
|
1711
|
Zerotorescue@13
|
1712 local itemLevelTemplate = "Itemlevel >= %d";
|
Zerotorescue@13
|
1713
|
Zerotorescue@13
|
1714 for i = 1, 49 do
|
Zerotorescue@13
|
1715 temp[( i * 10 )] = itemLevelTemplate:format(( i * 10 ));
|
Zerotorescue@13
|
1716 end
|
Zerotorescue@13
|
1717
|
Zerotorescue@13
|
1718 temp[500] = "Include nothing";
|
Zerotorescue@13
|
1719
|
Zerotorescue@13
|
1720 return temp;
|
Zerotorescue@13
|
1721 end,
|
Zerotorescue@13
|
1722 name = "Include tradeskill items",
|
Zerotorescue@13
|
1723 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@13
|
1724 set = function(i, v) includeTradeSkillItems = v; end,
|
Zerotorescue@13
|
1725 get = function() return includeTradeSkillItems; end,
|
Zerotorescue@13
|
1726 disabled = function()
|
Zerotorescue@13
|
1727 if GetTradeSkillLine() == "UNKNOWN" then
|
Zerotorescue@13
|
1728 includeTradeSkillItems = 500;
|
Zerotorescue@13
|
1729 return true; -- disabled
|
Zerotorescue@13
|
1730 else
|
Zerotorescue@13
|
1731 return false;
|
Zerotorescue@13
|
1732 end
|
Zerotorescue@13
|
1733 end,
|
Zerotorescue@13
|
1734 },
|
Zerotorescue@0
|
1735 },
|
Zerotorescue@0
|
1736 },
|
Zerotorescue@0
|
1737 list = {
|
Zerotorescue@0
|
1738 order = 30,
|
Zerotorescue@0
|
1739 type = "group",
|
Zerotorescue@0
|
1740 inline = true,
|
Zerotorescue@0
|
1741 name = "Item list",
|
Zerotorescue@0
|
1742 hidden = UpdateAddItemList,
|
Zerotorescue@0
|
1743 args = {
|
Zerotorescue@0
|
1744
|
Zerotorescue@0
|
1745 },
|
Zerotorescue@0
|
1746 },
|
Zerotorescue@0
|
1747 },
|
Zerotorescue@0
|
1748 },
|
Zerotorescue@0
|
1749 remove = {
|
Zerotorescue@0
|
1750 order = 40,
|
Zerotorescue@0
|
1751 type = "group",
|
Zerotorescue@0
|
1752 name = "Current items",
|
Zerotorescue@23
|
1753 desc = "View, export or remove items from this group.",
|
Zerotorescue@30
|
1754 disabled = function(info) return groupIsVirtual[info[2]]; end,
|
Zerotorescue@0
|
1755 args = {
|
Zerotorescue@0
|
1756 help = {
|
Zerotorescue@0
|
1757 order = 10,
|
Zerotorescue@0
|
1758 type = "group",
|
Zerotorescue@0
|
1759 inline = true,
|
Zerotorescue@0
|
1760 name = "Help",
|
Zerotorescue@0
|
1761 hidden = false,
|
Zerotorescue@0
|
1762 args = {
|
Zerotorescue@0
|
1763 help = {
|
Zerotorescue@0
|
1764 order = 10,
|
Zerotorescue@0
|
1765 type = "description",
|
Zerotorescue@0
|
1766 name = "Click the items you wish to remove from this group.",
|
Zerotorescue@0
|
1767 },
|
Zerotorescue@17
|
1768 massRemove = {
|
Zerotorescue@17
|
1769 order = 20,
|
Zerotorescue@17
|
1770 type = "input",
|
Zerotorescue@17
|
1771 name = "Remove all items matching...",
|
Zerotorescue@17
|
1772 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@17
|
1773 set = function(info, value)
|
Zerotorescue@17
|
1774 local groupName = groupIdToName[info[2]];
|
Zerotorescue@17
|
1775
|
Zerotorescue@17
|
1776 if not value then return; end
|
Zerotorescue@17
|
1777
|
Zerotorescue@17
|
1778 value = value:lower();
|
Zerotorescue@17
|
1779
|
Zerotorescue@17
|
1780 local ref = options.args.groups.args[info[2]].args.remove.args.list.args;
|
Zerotorescue@17
|
1781
|
Zerotorescue@17
|
1782 for itemId, test in pairs(ref) do
|
Zerotorescue@17
|
1783 if test then
|
Zerotorescue@17
|
1784 local itemName = GetItemInfo(itemId);
|
Zerotorescue@17
|
1785
|
Zerotorescue@17
|
1786 if itemName:lower():find(value) then
|
Zerotorescue@17
|
1787 -- Unset this item
|
Zerotorescue@17
|
1788 addon.db.global.groups[groupName].items[itemId] = nil;
|
Zerotorescue@17
|
1789 end
|
Zerotorescue@17
|
1790 end
|
Zerotorescue@17
|
1791 end
|
Zerotorescue@17
|
1792 end,
|
Zerotorescue@17
|
1793 get = false,
|
Zerotorescue@17
|
1794 },
|
Zerotorescue@17
|
1795 premadeGroups = {
|
Zerotorescue@17
|
1796 order = 30,
|
Zerotorescue@17
|
1797 type = "select",
|
Zerotorescue@17
|
1798 name = "Imported premade groups",
|
Zerotorescue@23
|
1799 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@17
|
1800 values = function(info)
|
Zerotorescue@17
|
1801 local groupName = groupIdToName[info[2]];
|
Zerotorescue@17
|
1802
|
Zerotorescue@17
|
1803 local temp = {};
|
Zerotorescue@17
|
1804 if addon.db.global.groups[groupName].premadeGroups then
|
Zerotorescue@17
|
1805 for name, version in pairs(addon.db.global.groups[groupName].premadeGroups) do
|
Zerotorescue@17
|
1806 temp[name] = name;
|
Zerotorescue@17
|
1807 end
|
Zerotorescue@17
|
1808 end
|
Zerotorescue@17
|
1809
|
Zerotorescue@17
|
1810 return temp;
|
Zerotorescue@17
|
1811 end,
|
Zerotorescue@17
|
1812 set = function(info, value)
|
Zerotorescue@17
|
1813 -- Remove premade group from this group
|
Zerotorescue@17
|
1814 local groupName = groupIdToName[info[2]];
|
Zerotorescue@17
|
1815
|
Zerotorescue@17
|
1816 addon.db.global.groups[groupName].premadeGroups[value] = nil;
|
Zerotorescue@17
|
1817
|
Zerotorescue@17
|
1818 print(("No longer notifying you about changes made to the premade group named \"|cfffed000%s|r\"."):format(value));
|
Zerotorescue@17
|
1819 end,
|
Zerotorescue@17
|
1820 get = false,
|
Zerotorescue@17
|
1821 disabled = function(info)
|
Zerotorescue@17
|
1822 local groupName = groupIdToName[info[2]];
|
Zerotorescue@17
|
1823
|
Zerotorescue@17
|
1824 return (not addon.db.global.groups[groupName].premadeGroups);
|
Zerotorescue@17
|
1825 end,
|
Zerotorescue@17
|
1826 },
|
Zerotorescue@0
|
1827 },
|
Zerotorescue@0
|
1828 },
|
Zerotorescue@0
|
1829 list = {
|
Zerotorescue@0
|
1830 order = 20,
|
Zerotorescue@0
|
1831 type = "group",
|
Zerotorescue@0
|
1832 inline = true,
|
Zerotorescue@0
|
1833 name = "Item list",
|
Zerotorescue@0
|
1834 hidden = UpdateRemoveItemList,
|
Zerotorescue@0
|
1835 args = {
|
Zerotorescue@0
|
1836
|
Zerotorescue@0
|
1837 },
|
Zerotorescue@0
|
1838 },
|
Zerotorescue@0
|
1839 export = {
|
Zerotorescue@0
|
1840 order = 30,
|
Zerotorescue@0
|
1841 type = "group",
|
Zerotorescue@0
|
1842 name = "Export",
|
Zerotorescue@0
|
1843 inline = true,
|
Zerotorescue@0
|
1844 args = {
|
Zerotorescue@0
|
1845 input = {
|
Zerotorescue@0
|
1846 order = 10,
|
Zerotorescue@0
|
1847 type = "input",
|
Zerotorescue@0
|
1848 name = "Item data",
|
Zerotorescue@0
|
1849 width = "full",
|
Zerotorescue@0
|
1850 desc = "Export the item data for the currently selected group. Press CTRL-A to select all and CTRL-C to copy the text.",
|
Zerotorescue@0
|
1851 set = false,
|
Zerotorescue@0
|
1852 get = function(info)
|
Zerotorescue@0
|
1853 local groupName = groupIdToName[info[2]];
|
Zerotorescue@0
|
1854
|
Zerotorescue@0
|
1855 local combinedItemIds;
|
Zerotorescue@0
|
1856 -- Parse items in group and show these
|
Zerotorescue@0
|
1857 for itemId, _ in pairs(addon.db.global.groups[groupName].items) do
|
Zerotorescue@0
|
1858 if not combinedItemIds then
|
Zerotorescue@0
|
1859 combinedItemIds = tostring(itemId);
|
Zerotorescue@0
|
1860 else
|
Zerotorescue@0
|
1861 combinedItemIds = combinedItemIds .. (";%d"):format(itemId);
|
Zerotorescue@0
|
1862 end
|
Zerotorescue@0
|
1863 end
|
Zerotorescue@0
|
1864
|
Zerotorescue@0
|
1865 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@0
|
1866 end,
|
Zerotorescue@0
|
1867 },
|
Zerotorescue@0
|
1868 },
|
Zerotorescue@0
|
1869 },
|
Zerotorescue@0
|
1870 },
|
Zerotorescue@0
|
1871 },
|
Zerotorescue@0
|
1872 },
|
Zerotorescue@0
|
1873 };
|
Zerotorescue@0
|
1874
|
Zerotorescue@30
|
1875 local currentGroupType = "Normal";
|
Zerotorescue@0
|
1876 function addon:MakeGroupOptions()
|
Zerotorescue@0
|
1877 options.args.groups = {
|
Zerotorescue@0
|
1878 order = 1100,
|
Zerotorescue@0
|
1879 type = "group",
|
Zerotorescue@0
|
1880 name = "Groups",
|
Zerotorescue@0
|
1881 desc = "Change a group.",
|
Zerotorescue@0
|
1882 args = {
|
Zerotorescue@0
|
1883 create = {
|
Zerotorescue@0
|
1884 order = 10,
|
Zerotorescue@0
|
1885 type = "group",
|
Zerotorescue@0
|
1886 inline = true,
|
Zerotorescue@0
|
1887 name = "Create a brand new group",
|
Zerotorescue@0
|
1888 args = {
|
Zerotorescue@0
|
1889 name = {
|
Zerotorescue@0
|
1890 order = 10,
|
Zerotorescue@0
|
1891 type = "input",
|
Zerotorescue@0
|
1892 name = "Group name",
|
Zerotorescue@0
|
1893 desc = "The name of the group. You can also use item links as you wish.",
|
Zerotorescue@0
|
1894 validate = ValidateGroupName,
|
Zerotorescue@0
|
1895 set = function(_, value)
|
Zerotorescue@0
|
1896 self.db.global.groups[value] = {};
|
Zerotorescue@30
|
1897 if currentGroupType == "Virtual" then
|
Zerotorescue@30
|
1898 self.db.global.groups[value].isVirtual = true;
|
Zerotorescue@30
|
1899 end
|
Zerotorescue@30
|
1900
|
Zerotorescue@0
|
1901 addon:FillGroupOptions();
|
Zerotorescue@0
|
1902 end,
|
Zerotorescue@0
|
1903 get = false,
|
Zerotorescue@0
|
1904 width = "double",
|
Zerotorescue@0
|
1905 },
|
Zerotorescue@30
|
1906 type = {
|
Zerotorescue@30
|
1907 order = 20,
|
Zerotorescue@30
|
1908 type = "select",
|
Zerotorescue@30
|
1909 name = "Type (advanced)",
|
Zerotorescue@30
|
1910 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@30
|
1911 values = {
|
Zerotorescue@30
|
1912 ["Normal"] = "Normal",
|
Zerotorescue@30
|
1913 ["Virtual"] = "Virtual",
|
Zerotorescue@30
|
1914 },
|
Zerotorescue@30
|
1915 set = function(_, value) currentGroupType = value; end,
|
Zerotorescue@30
|
1916 get = function() return currentGroupType; end,
|
Zerotorescue@30
|
1917 },
|
Zerotorescue@0
|
1918 },
|
Zerotorescue@0
|
1919 },
|
Zerotorescue@0
|
1920 import = {
|
Zerotorescue@0
|
1921 order = 20,
|
Zerotorescue@0
|
1922 type = "group",
|
Zerotorescue@0
|
1923 inline = true,
|
Zerotorescue@0
|
1924 name = "Import a group",
|
Zerotorescue@0
|
1925 args = {
|
Zerotorescue@0
|
1926 input = {
|
Zerotorescue@0
|
1927 order = 10,
|
Zerotorescue@0
|
1928 type = "input",
|
Zerotorescue@0
|
1929 multiline = true,
|
Zerotorescue@0
|
1930 name = "Group data",
|
Zerotorescue@0
|
1931 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@0
|
1932 set = function(info, value)
|
Zerotorescue@9
|
1933 local data = { string.split("\n", value or "") };
|
Zerotorescue@0
|
1934
|
Zerotorescue@9
|
1935 for _, current in pairs(data) do
|
Zerotorescue@0
|
1936 if not AceSerializer then
|
Zerotorescue@0
|
1937 AceSerializer = LibStub("AceSerializer-3.0");
|
Zerotorescue@0
|
1938 end
|
Zerotorescue@0
|
1939
|
Zerotorescue@0
|
1940 local result, temp = AceSerializer:Deserialize(current);
|
Zerotorescue@0
|
1941
|
Zerotorescue@0
|
1942 if not temp.name then
|
Zerotorescue@0
|
1943 print("|cffff0000The provided data is not supported.|r");
|
Zerotorescue@10
|
1944 elseif ValidateGroupName(nil, temp.name) ~= true then
|
Zerotorescue@10
|
1945 print(("|cffff0000Aborting: A group named \"%s\" already exists.|r"):format(temp.name));
|
Zerotorescue@0
|
1946 else
|
Zerotorescue@10
|
1947 local name = temp.name;
|
Zerotorescue@0
|
1948 temp.name = nil;
|
Zerotorescue@9
|
1949 print(("Importing %s..."):format(name));
|
Zerotorescue@10
|
1950
|
Zerotorescue@10
|
1951 -- Remove items that are already in another group
|
Zerotorescue@10
|
1952 for value, _ in pairs(temp.items) do
|
Zerotorescue@17
|
1953 local itemId = tonumber(value);
|
Zerotorescue@10
|
1954
|
Zerotorescue@10
|
1955 if not itemId then
|
Zerotorescue@10
|
1956 print(("\"%s\" is not a number."):format(value));
|
Zerotorescue@10
|
1957 temp.items[value] = nil;
|
Zerotorescue@10
|
1958 elseif InGroup(itemId) then
|
Zerotorescue@10
|
1959 print(("Skipping %s (#%d) as it is already in the group |cfffed000%s|r."):format(select(2, GetItemInfo(itemId)) or "Unknown", itemId, InGroup(itemId)));
|
Zerotorescue@10
|
1960 temp.items[value] = nil;
|
Zerotorescue@10
|
1961 else
|
Zerotorescue@10
|
1962 -- Ensure the keys are numeric
|
Zerotorescue@10
|
1963 temp.items[value] = nil;
|
Zerotorescue@10
|
1964 temp.items[itemId] = true;
|
Zerotorescue@10
|
1965 end
|
Zerotorescue@10
|
1966 end
|
Zerotorescue@10
|
1967
|
Zerotorescue@23
|
1968 -- 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@10
|
1969 temp.trackAtCharacters = nil;
|
Zerotorescue@10
|
1970 temp.overrideTrackAtCharacters = nil;
|
Zerotorescue@10
|
1971
|
Zerotorescue@10
|
1972 self.db.global.groups[name] = temp;
|
Zerotorescue@0
|
1973 end
|
Zerotorescue@0
|
1974 end
|
Zerotorescue@10
|
1975
|
Zerotorescue@10
|
1976 self:FillGroupOptions();
|
Zerotorescue@0
|
1977 end,
|
Zerotorescue@0
|
1978 get = false,
|
Zerotorescue@0
|
1979 width = "full",
|
Zerotorescue@0
|
1980 },
|
Zerotorescue@0
|
1981 },
|
Zerotorescue@0
|
1982 },
|
Zerotorescue@0
|
1983 },
|
Zerotorescue@0
|
1984 };
|
Zerotorescue@0
|
1985 end
|
Zerotorescue@0
|
1986
|
Zerotorescue@0
|
1987 function addon:FillGroupOptions()
|
Zerotorescue@0
|
1988 for id, name in pairs(groupIdToName) do
|
Zerotorescue@0
|
1989 if type(name) == "string" and not self.db.global.groups[name] then
|
Zerotorescue@0
|
1990 options.args.groups.args[id] = nil;
|
Zerotorescue@0
|
1991 groupIdToName[id] = nil;
|
Zerotorescue@0
|
1992 groupIdToName[name] = nil;
|
Zerotorescue@30
|
1993 groupIsVirtual[id] = nil;
|
Zerotorescue@0
|
1994 end
|
Zerotorescue@0
|
1995 end
|
Zerotorescue@0
|
1996
|
Zerotorescue@0
|
1997 for name, values in pairs(self.db.global.groups) do
|
Zerotorescue@0
|
1998 if not groupIdToName[name] then
|
Zerotorescue@23
|
1999 options.args.groups.args[tostring(count)] = defaultGroup;
|
Zerotorescue@0
|
2000
|
Zerotorescue@0
|
2001 groupIdToName[tostring(count)] = name;
|
Zerotorescue@0
|
2002 groupIdToName[name] = true;
|
Zerotorescue@30
|
2003 if values.isVirtual then
|
Zerotorescue@30
|
2004 groupIsVirtual[tostring(count)] = true;
|
Zerotorescue@30
|
2005 end
|
Zerotorescue@0
|
2006
|
Zerotorescue@0
|
2007 count = ( count + 1 );
|
Zerotorescue@0
|
2008 end
|
Zerotorescue@0
|
2009 end
|
Zerotorescue@0
|
2010 end
|
Zerotorescue@0
|
2011
|
Zerotorescue@13
|
2012
|
Zerotorescue@13
|
2013
|
Zerotorescue@13
|
2014 -- General functions used addon-wide
|
Zerotorescue@13
|
2015
|
Zerotorescue@23
|
2016 function addon:GetItemCount(itemId, group)
|
Zerotorescue@13
|
2017 itemId = tonumber(itemId);
|
Zerotorescue@13
|
2018
|
Zerotorescue@13
|
2019 if not itemId then return; end
|
Zerotorescue@13
|
2020
|
Zerotorescue@23
|
2021 local selectedExternalAddon = self:GetOptionByKey(group, "itemCountAddon");
|
Zerotorescue@23
|
2022
|
Zerotorescue@23
|
2023 if self.supportedAddons.itemCount[selectedExternalAddon] and self.supportedAddons.itemCount[selectedExternalAddon].IsEnabled() then
|
Zerotorescue@13
|
2024 -- Try to use the default item count addon
|
Zerotorescue@13
|
2025
|
Zerotorescue@23
|
2026 return self.supportedAddons.itemCount[selectedExternalAddon].GetTotalCount(itemId);
|
Zerotorescue@13
|
2027 else
|
Zerotorescue@13
|
2028 -- Default not available, get the first one then
|
Zerotorescue@13
|
2029
|
Zerotorescue@13
|
2030 for name, value in pairs(self.supportedAddons.itemCount) do
|
Zerotorescue@13
|
2031 if value.IsEnabled() then
|
Zerotorescue@17
|
2032 return value.GetTotalCount(itemId);
|
Zerotorescue@13
|
2033 end
|
Zerotorescue@13
|
2034 end
|
Zerotorescue@13
|
2035 end
|
Zerotorescue@13
|
2036
|
Zerotorescue@13
|
2037 return -1;
|
Zerotorescue@0
|
2038 end
|
Zerotorescue@0
|
2039
|
Zerotorescue@23
|
2040 function addon:GetAuctionValue(itemLink, group)
|
Zerotorescue@23
|
2041 if not itemLink then return -5; end
|
Zerotorescue@13
|
2042
|
Zerotorescue@23
|
2043 local selectedExternalAddon = self:GetOptionByKey(group, "auctionPricingAddon");
|
Zerotorescue@23
|
2044
|
Zerotorescue@23
|
2045 if self.supportedAddons.auctionPricing[selectedExternalAddon] and self.supportedAddons.auctionPricing[selectedExternalAddon].IsEnabled() then
|
Zerotorescue@13
|
2046 -- Try to use the default auction pricing addon
|
Zerotorescue@1
|
2047
|
Zerotorescue@23
|
2048 return self.supportedAddons.auctionPricing[selectedExternalAddon].GetValue(itemLink);
|
Zerotorescue@13
|
2049 else
|
Zerotorescue@13
|
2050 -- Default not available, get the first one then
|
Zerotorescue@1
|
2051
|
Zerotorescue@13
|
2052 for name, value in pairs(self.supportedAddons.auctionPricing) do
|
Zerotorescue@13
|
2053 if value.IsEnabled() then
|
Zerotorescue@13
|
2054 return value.GetValue(itemLink);
|
Zerotorescue@13
|
2055 end
|
Zerotorescue@1
|
2056 end
|
Zerotorescue@1
|
2057 end
|
Zerotorescue@7
|
2058
|
Zerotorescue@7
|
2059 return -2;
|
Zerotorescue@1
|
2060 end
|
Zerotorescue@1
|
2061
|
Zerotorescue@0
|
2062
|
Zerotorescue@0
|
2063
|
Zerotorescue@13
|
2064 -- Public
|
Zerotorescue@13
|
2065
|
Zerotorescue@13
|
2066 function IMRegisterPricingAddon(name, get, enabled)
|
Zerotorescue@13
|
2067 addon.supportedAddons.auctionPricing[name] = {
|
Zerotorescue@13
|
2068 GetValue = get,
|
Zerotorescue@13
|
2069 IsEnabled = enabled,
|
Zerotorescue@13
|
2070 };
|
Zerotorescue@13
|
2071 end
|
Zerotorescue@13
|
2072
|
Zerotorescue@17
|
2073 function IMRegisterItemCountAddon(name, getTotal, getCharacter, enabled)
|
Zerotorescue@13
|
2074 addon.supportedAddons.itemCount[name] = {
|
Zerotorescue@17
|
2075 GetTotalCount = getTotal,
|
Zerotorescue@17
|
2076 GetCharacterCount = getCharacter,
|
Zerotorescue@13
|
2077 IsEnabled = enabled,
|
Zerotorescue@13
|
2078 };
|
Zerotorescue@13
|
2079 end
|
Zerotorescue@13
|
2080
|
Zerotorescue@13
|
2081 function IMRegisterCraftingAddon(name, queue, enabled)
|
Zerotorescue@13
|
2082 addon.supportedAddons.crafting[name] = {
|
Zerotorescue@13
|
2083 Queue = queue,
|
Zerotorescue@13
|
2084 IsEnabled = enabled,
|
Zerotorescue@13
|
2085 };
|
Zerotorescue@13
|
2086 end
|
Zerotorescue@13
|
2087
|
Zerotorescue@13
|
2088
|
Zerotorescue@13
|
2089
|
Zerotorescue@13
|
2090 -- Debug
|
Zerotorescue@0
|
2091
|
Zerotorescue@0
|
2092 function addon:Debug(t)
|
Zerotorescue@0
|
2093 if not self.debugChannel and self.debugChannel ~= false then
|
Zerotorescue@0
|
2094 -- We want to check just once, so if you add a debug channel later just do a /reload (registering an event for this is wasted resources)
|
Zerotorescue@0
|
2095 self.debugChannel = false;
|
Zerotorescue@0
|
2096
|
Zerotorescue@0
|
2097 for i = 1, NUM_CHAT_WINDOWS do
|
Zerotorescue@0
|
2098 local name = GetChatWindowInfo(i);
|
Zerotorescue@0
|
2099
|
Zerotorescue@0
|
2100 if name:upper() == "DEBUG" then
|
Zerotorescue@0
|
2101 self.debugChannel = _G["ChatFrame" .. i];
|
Zerotorescue@0
|
2102 end
|
Zerotorescue@0
|
2103 end
|
Zerotorescue@0
|
2104 end
|
Zerotorescue@0
|
2105
|
Zerotorescue@0
|
2106 if self.debugChannel then
|
Zerotorescue@0
|
2107 self.debugChannel:AddMessage(t);
|
Zerotorescue@0
|
2108 end
|
Zerotorescue@0
|
2109 end
|