annotate Modules/Config.lua @ 184:679d3664849d

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