annotate Modules/Config.lua @ 161:fcc95c62d232

Premade groups can now be combined into a single group to allow easier adding of a combination (e.g. all glyphs at once).
author Zerotorescue
date Sun, 23 Jan 2011 18:24:00 +0100
parents e136c99fe5bb
children e31b68c119df
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@76 112 AceConfigRegistry:NotifyChange("InventoriumOptions");
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@76 140 AceConfigRegistry:NotifyChange("InventoriumOptions");
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@155 332 desc = "Allows you to override at which characters items in this group should appear in the summary and 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@155 339 desc = "Select at which characters this should appear in the summary and 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@62 352 overrideLocalItemData = {
Zerotorescue@62 353 order = 39,
Zerotorescue@62 354 type = "toggle",
Zerotorescue@62 355 name = "Override local item data",
Zerotorescue@62 356 desc = "Allows you to override the local item data setting for this group.",
Zerotorescue@62 357 arg = "localItemData",
Zerotorescue@62 358 },
Zerotorescue@62 359 localItemData = {
Zerotorescue@62 360 order = 40,
Zerotorescue@62 361 type = "multiselect",
Zerotorescue@62 362 name = "Include in local item data",
Zerotorescue@62 363 desc = "Select which data should be included in the local item data.",
Zerotorescue@62 364 values = {
Zerotorescue@62 365 ["Bag"] = "Bag",
Zerotorescue@62 366 ["Bank"] = "Bank",
Zerotorescue@62 367 ["Auction House"] = "Auction House",
Zerotorescue@62 368 ["Mailbox"] = "Mailbox",
Zerotorescue@62 369 },
Zerotorescue@62 370 get = GetMultiOption,
Zerotorescue@65 371 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 372 arg = "overrideLocalItemData",
Zerotorescue@62 373 },
Zerotorescue@62 374 virtualGroup = {
Zerotorescue@62 375 order = 50,
Zerotorescue@62 376 type = "select",
Zerotorescue@62 377 name = "Use virtual group settings",
Zerotorescue@62 378 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 379 values = function(info)
Zerotorescue@62 380 local groupName = groupIdToName[info[2]];
Zerotorescue@62 381
Zerotorescue@62 382 local temp = {};
Zerotorescue@62 383
Zerotorescue@62 384 temp[""] = "";
Zerotorescue@62 385 for name, values in pairs(addon.db.profile.groups) do
Zerotorescue@62 386 if values.isVirtual and name ~= groupName then
Zerotorescue@62 387 temp[name] = name;
Zerotorescue@62 388 end
Zerotorescue@62 389 end
Zerotorescue@62 390
Zerotorescue@62 391 return temp;
Zerotorescue@62 392 end,
Zerotorescue@62 393 set = function(info, value)
Zerotorescue@62 394 local groupName = groupIdToName[info[2]];
Zerotorescue@62 395 local optionName = info[#info];
Zerotorescue@62 396
Zerotorescue@62 397 addon.db.profile.groups[groupName][optionName] = value ~= "" and value;
Zerotorescue@62 398 end,
Zerotorescue@62 399 disabled = false,
Zerotorescue@62 400 },
Zerotorescue@62 401 },
Zerotorescue@62 402 },
Zerotorescue@62 403 minimumStock = {
Zerotorescue@62 404 order = 10,
Zerotorescue@62 405 type = "group",
Zerotorescue@62 406 inline = true,
Zerotorescue@62 407 name = "Minimum stock",
Zerotorescue@62 408 set = SetOption,
Zerotorescue@62 409 get = GetOption,
Zerotorescue@62 410 disabled = GetDisabled,
Zerotorescue@62 411 args = {
Zerotorescue@62 412 description = {
Zerotorescue@62 413 order = 0,
Zerotorescue@62 414 type = "description",
Zerotorescue@62 415 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 416 hidden = function() return addon.db.profile.defaults.hideHelp; end,
Zerotorescue@62 417 },
Zerotorescue@62 418 header = {
Zerotorescue@62 419 order = 5,
Zerotorescue@62 420 type = "header",
Zerotorescue@62 421 name = "",
Zerotorescue@106 422 hidden = function() return addon.db.profile.defaults.hideHelp; end,
Zerotorescue@62 423 },
Zerotorescue@62 424
Zerotorescue@62 425 overrideMinLocalStock = {
Zerotorescue@62 426 order = 10,
Zerotorescue@62 427 type = "toggle",
Zerotorescue@62 428 name = "Override min local stock",
Zerotorescue@62 429 desc = "Allows you to override the minimum local stock setting for this group.",
Zerotorescue@62 430 arg = "minLocalStock",
Zerotorescue@62 431 },
Zerotorescue@62 432 minLocalStock = {
Zerotorescue@62 433 order = 11,
Zerotorescue@62 434 type = "range",
Zerotorescue@62 435 min = 0,
Zerotorescue@62 436 max = 100000,
Zerotorescue@62 437 softMax = 100,
Zerotorescue@62 438 step = 1,
Zerotorescue@62 439 name = "Minimum local stock",
Zerotorescue@62 440 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 441 arg = "overrideMinLocalStock",
Zerotorescue@62 442 },
Zerotorescue@62 443 overrideAlertBelowLocalMinimum = {
Zerotorescue@62 444 order = 15,
Zerotorescue@62 445 type = "toggle",
Zerotorescue@62 446 name = "Override local minimum alert",
Zerotorescue@62 447 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 448 arg = "alertBelowLocalMinimum",
Zerotorescue@62 449 },
Zerotorescue@62 450 alertBelowLocalMinimum = {
Zerotorescue@62 451 order = 16,
Zerotorescue@62 452 type = "toggle",
Zerotorescue@62 453 name = "Alert when below local minimum (NYI)",
Zerotorescue@62 454 desc = "Show an alert when an item in this group gets below the local minimum stock threshold.",
Zerotorescue@62 455 arg = "overrideAlertBelowLocalMinimum",
Zerotorescue@62 456 },
Zerotorescue@82 457 overrideAutoRefill = {
Zerotorescue@82 458 order = 17,
Zerotorescue@82 459 type = "toggle",
Zerotorescue@82 460 name = "Override auto refill",
Zerotorescue@82 461 desc = "Allows you to override wether you want to automatically refill items when below the minimum local stock.",
Zerotorescue@82 462 arg = "autoRefill",
Zerotorescue@82 463 },
Zerotorescue@82 464 autoRefill = {
Zerotorescue@82 465 order = 18,
Zerotorescue@82 466 type = "toggle",
Zerotorescue@131 467 name = "Auto refill from storage",
Zerotorescue@131 468 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 469 arg = "overrideAutoRefill",
Zerotorescue@82 470 },
Zerotorescue@62 471
Zerotorescue@62 472 overrideMinGlobalStock = {
Zerotorescue@62 473 order = 20,
Zerotorescue@62 474 type = "toggle",
Zerotorescue@62 475 name = "Override min global stock",
Zerotorescue@62 476 desc = "Allows you to override the minimum global stock setting for this group.",
Zerotorescue@62 477 arg = "minGlobalStock",
Zerotorescue@62 478 },
Zerotorescue@62 479 minGlobalStock = {
Zerotorescue@62 480 order = 21,
Zerotorescue@62 481 type = "range",
Zerotorescue@62 482 min = 0,
Zerotorescue@62 483 max = 100000,
Zerotorescue@62 484 softMax = 100,
Zerotorescue@62 485 step = 1,
Zerotorescue@62 486 name = "Minimum global stock",
Zerotorescue@62 487 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 488 arg = "overrideMinGlobalStock",
Zerotorescue@62 489 },
Zerotorescue@62 490 overrideAlertBelowGlobalMinimum = {
Zerotorescue@62 491 order = 25,
Zerotorescue@62 492 type = "toggle",
Zerotorescue@62 493 name = "Override global minimum alert",
Zerotorescue@62 494 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 495 arg = "alertBelowGlobalMinimum",
Zerotorescue@62 496 },
Zerotorescue@62 497 alertBelowGlobalMinimum = {
Zerotorescue@62 498 order = 26,
Zerotorescue@62 499 type = "toggle",
Zerotorescue@62 500 name = "Alert when below global minimum (NYI)",
Zerotorescue@62 501 desc = "Show an alert when an item in this group gets below the global minimum stock threshold.",
Zerotorescue@62 502 arg = "overrideAlertBelowGlobalMinimum",
Zerotorescue@62 503 },
Zerotorescue@62 504
Zerotorescue@62 505 overrideSummaryThresholdShow = {
Zerotorescue@62 506 order = 34,
Zerotorescue@62 507 type = "toggle",
Zerotorescue@62 508 name = "Override summary showing",
Zerotorescue@62 509 desc = "Allows you to override when this group should appear in the summary.",
Zerotorescue@62 510 arg = "summaryThresholdShow",
Zerotorescue@62 511 },
Zerotorescue@62 512 summaryThresholdShow = {
Zerotorescue@62 513 order = 35,
Zerotorescue@62 514 type = "range",
Zerotorescue@62 515 min = 0,
Zerotorescue@62 516 max = 10,
Zerotorescue@62 517 softMax = 100,
Zerotorescue@62 518 step = 0.05,
Zerotorescue@62 519 isPercent = true,
Zerotorescue@62 520 name = "Show in summary when below",
Zerotorescue@62 521 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 522 arg = "overrideSummaryThresholdShow",
Zerotorescue@62 523 },
Zerotorescue@62 524 },
Zerotorescue@62 525 },
Zerotorescue@62 526 refill = {
Zerotorescue@62 527 order = 20,
Zerotorescue@62 528 type = "group",
Zerotorescue@62 529 inline = true,
Zerotorescue@62 530 name = "Replenishing stock",
Zerotorescue@62 531 set = SetOption,
Zerotorescue@62 532 get = GetOption,
Zerotorescue@62 533 disabled = GetDisabled,
Zerotorescue@62 534 args = {
Zerotorescue@62 535 description = {
Zerotorescue@62 536 order = 0,
Zerotorescue@62 537 type = "description",
Zerotorescue@62 538 name = function(info)
Zerotorescue@62 539 local groupName = groupIdToName[info[2]];
Zerotorescue@62 540 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 541
Zerotorescue@62 542 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 543
Zerotorescue@62 544 if addon:GetOptionByKey(groupName, "priceThreshold") == 0 then
Zerotorescue@62 545 r = r .. "Queueing items at |cfffed000any|r auction value.";
Zerotorescue@62 546 else
Zerotorescue@62 547 r = r .. "Queueing items worth |cfffed000" .. addon:ReadableMoney(addon:GetOptionByKey(groupName, "priceThreshold")) .. "|r or more.";
Zerotorescue@62 548 end
Zerotorescue@62 549
Zerotorescue@62 550 return r;
Zerotorescue@62 551 end,
Zerotorescue@106 552 hidden = function() return addon.db.profile.defaults.hideHelp; end,
Zerotorescue@62 553 },
Zerotorescue@62 554 header = {
Zerotorescue@62 555 order = 5,
Zerotorescue@62 556 type = "header",
Zerotorescue@62 557 name = "",
Zerotorescue@106 558 hidden = function() return addon.db.profile.defaults.hideHelp; end,
Zerotorescue@62 559 },
Zerotorescue@62 560 overrideRestockTarget = {
Zerotorescue@62 561 order = 9,
Zerotorescue@62 562 type = "toggle",
Zerotorescue@62 563 name = "Override restock target",
Zerotorescue@62 564 desc = "Allows you to override the restock target setting for this group.",
Zerotorescue@62 565 arg = "restockTarget",
Zerotorescue@62 566 },
Zerotorescue@62 567 restockTarget = {
Zerotorescue@62 568 order = 10,
Zerotorescue@62 569 type = "range",
Zerotorescue@62 570 min = 0,
Zerotorescue@62 571 max = 100000,
Zerotorescue@62 572 softMax = 100,
Zerotorescue@62 573 step = 1,
Zerotorescue@62 574 name = "Restock target",
Zerotorescue@62 575 desc = "You can manually enter a value between 100 and 100.000 in the edit box if the provided range is insufficient.",
Zerotorescue@62 576 arg = "overrideRestockTarget",
Zerotorescue@62 577 },
Zerotorescue@62 578 overrideMinCraftingQueue = {
Zerotorescue@62 579 order = 19,
Zerotorescue@62 580 type = "toggle",
Zerotorescue@62 581 name = "Override min queue",
Zerotorescue@62 582 desc = "Allows you to override the minimum craftable items queue setting for this group.",
Zerotorescue@62 583 arg = "minCraftingQueue",
Zerotorescue@62 584 },
Zerotorescue@62 585 minCraftingQueue = {
Zerotorescue@62 586 order = 20,
Zerotorescue@62 587 type = "range",
Zerotorescue@62 588 min = 0,
Zerotorescue@62 589 max = 1,
Zerotorescue@62 590 step = 0.01,
Zerotorescue@62 591 isPercent = true,
Zerotorescue@154 592 name = "Don't queue when only missing...",
Zerotorescue@154 593 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 594 arg = "overrideMinCraftingQueue",
Zerotorescue@62 595 },
Zerotorescue@62 596 overrideBonusQueue = {
Zerotorescue@62 597 order = 29,
Zerotorescue@62 598 type = "toggle",
Zerotorescue@62 599 name = "Override bonus queue",
Zerotorescue@62 600 desc = "Allows you to override the bonus craftable items queue setting for this group.",
Zerotorescue@62 601 arg = "bonusQueue",
Zerotorescue@62 602 },
Zerotorescue@62 603 bonusQueue = {
Zerotorescue@62 604 order = 30,
Zerotorescue@62 605 type = "range",
Zerotorescue@62 606 min = 0,
Zerotorescue@62 607 max = 10, -- 1000%
Zerotorescue@62 608 step = 0.01, -- 1%
Zerotorescue@62 609 isPercent = true,
Zerotorescue@62 610 name = "Bonus queue",
Zerotorescue@62 611 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 612 arg = "overrideBonusQueue",
Zerotorescue@62 613 },
Zerotorescue@62 614 overridePriceThreshold = {
Zerotorescue@62 615 order = 39,
Zerotorescue@62 616 type = "toggle",
Zerotorescue@62 617 name = "Override price threshold",
Zerotorescue@62 618 desc = "Allows you to override the price threshold setting for this group.",
Zerotorescue@62 619 arg = "priceThreshold",
Zerotorescue@62 620 },
Zerotorescue@62 621 priceThreshold = {
Zerotorescue@62 622 order = 40,
Zerotorescue@62 623 type = "input",
Zerotorescue@62 624 name = "Price threshold",
Zerotorescue@62 625 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 626 validate = function(info, value) return addon:ValidateReadableMoney(info, value); end,
Zerotorescue@62 627 get = function(i) return addon:ReadableMoney(GetOption(i)); end,
Zerotorescue@62 628 set = function(i, v) SetOption(i, addon:ReadableMoneyToCopper(v)); end,
Zerotorescue@62 629 arg = "overridePriceThreshold",
Zerotorescue@62 630 },
Zerotorescue@62 631 overrideSummaryHidePriceThreshold = {
Zerotorescue@62 632 order = 49,
Zerotorescue@62 633 type = "toggle",
Zerotorescue@62 634 name = "Override summary showing",
Zerotorescue@62 635 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 636 arg = "summaryHidePriceThreshold",
Zerotorescue@62 637 },
Zerotorescue@62 638 summaryHidePriceThreshold = {
Zerotorescue@62 639 order = 50,
Zerotorescue@62 640 type = "toggle",
Zerotorescue@62 641 name = "Hide when below threshold",
Zerotorescue@62 642 desc = "Hide items from the summary when their value is below the set price threshold.",
Zerotorescue@62 643 arg = "overrideSummaryHidePriceThreshold",
Zerotorescue@62 644 },
Zerotorescue@62 645 overrideAlwaysGetAuctionValue = {
Zerotorescue@62 646 order = 59,
Zerotorescue@62 647 type = "toggle",
Zerotorescue@62 648 name = "Override auction value showing",
Zerotorescue@62 649 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 650 arg = "alwaysGetAuctionValue",
Zerotorescue@62 651 },
Zerotorescue@62 652 alwaysGetAuctionValue = {
Zerotorescue@62 653 order = 60,
Zerotorescue@62 654 type = "toggle",
Zerotorescue@62 655 name = "Always show auction value",
Zerotorescue@62 656 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 657 arg = "overrideAlwaysGetAuctionValue",
Zerotorescue@62 658 },
Zerotorescue@62 659 },
Zerotorescue@62 660 },
Zerotorescue@155 661 addons = {
Zerotorescue@155 662 order = 30,
Zerotorescue@155 663 type = "group",
Zerotorescue@155 664 inline = true,
Zerotorescue@155 665 name = "Prefered addons",
Zerotorescue@155 666 set = SetOption,
Zerotorescue@155 667 get = GetOption,
Zerotorescue@155 668 disabled = GetDisabled,
Zerotorescue@155 669 args = {
Zerotorescue@155 670 description = {
Zerotorescue@155 671 order = 0,
Zerotorescue@155 672 type = "description",
Zerotorescue@155 673 name = function(info)
Zerotorescue@155 674 local groupName = groupIdToName[info[2]];
Zerotorescue@155 675
Zerotorescue@155 676 local t = "";
Zerotorescue@155 677 if not addon.db.profile.defaults.hideHelp then
Zerotorescue@155 678 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 679 end
Zerotorescue@155 680
Zerotorescue@155 681 local currentAddon, selectedAddonName = addon:GetItemCountAddon(groupName);
Zerotorescue@155 682 local preferedAddon = addon:GetOptionByKey(groupName, "itemCountAddon");
Zerotorescue@155 683
Zerotorescue@155 684 if currentAddon then
Zerotorescue@155 685 --GetCharacterCount
Zerotorescue@155 686 --addon.supportedAddons.itemCount[selectedExternalAddon]
Zerotorescue@155 687 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 688
Zerotorescue@155 689 if currentAddon.GetTotalCount and currentAddon.GetCharacterCount then
Zerotorescue@155 690 t = t .. " This addon supports |cfffed000both total as local|r item counts.";
Zerotorescue@155 691 elseif currentAddon.GetTotalCount then
Zerotorescue@155 692 t = t .. " This addon supports |cfffed000only total|r item counts.";
Zerotorescue@155 693 elseif currentAddon.GetCharacterCount then
Zerotorescue@155 694 t = t .. " This addon supports |cfffed000only local|r item counts.";
Zerotorescue@155 695 end
Zerotorescue@155 696
Zerotorescue@155 697 if preferedAddon ~= selectedAddonName then
Zerotorescue@155 698 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 699 end
Zerotorescue@155 700 end
Zerotorescue@155 701
Zerotorescue@155 702 return t;
Zerotorescue@155 703 end,
Zerotorescue@155 704 },
Zerotorescue@155 705 header = {
Zerotorescue@155 706 order = 5,
Zerotorescue@155 707 type = "header",
Zerotorescue@155 708 name = "",
Zerotorescue@155 709 hidden = function() return addon.db.profile.defaults.hideHelp; end,
Zerotorescue@155 710 },
Zerotorescue@155 711 overrideAuctionPricingAddon = {
Zerotorescue@155 712 order = 9,
Zerotorescue@155 713 type = "toggle",
Zerotorescue@155 714 name = "Override pricing addon",
Zerotorescue@155 715 desc = "Allows you to override the pricing addon setting for this group.",
Zerotorescue@155 716 arg = "auctionPricingAddon",
Zerotorescue@155 717 },
Zerotorescue@155 718 auctionPricingAddon = {
Zerotorescue@155 719 order = 10,
Zerotorescue@155 720 type = "select",
Zerotorescue@155 721 name = "Prefered pricing addon",
Zerotorescue@155 722 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 723 values = function()
Zerotorescue@155 724 local temp = {};
Zerotorescue@155 725 for name, value in pairs(addon.supportedAddons.auctionPricing) do
Zerotorescue@155 726 temp[name] = name;
Zerotorescue@155 727 end
Zerotorescue@155 728
Zerotorescue@155 729 return temp;
Zerotorescue@155 730 end,
Zerotorescue@155 731 set = function(info, value)
Zerotorescue@155 732 local groupName = groupIdToName[info[2]];
Zerotorescue@155 733 local optionName = info[#info];
Zerotorescue@155 734
Zerotorescue@155 735 addon.db.profile.groups[groupName][optionName] = value ~= "" and value;
Zerotorescue@155 736
Zerotorescue@155 737 if addon.supportedAddons.auctionPricing[value].OnSelect then
Zerotorescue@155 738 addon.supportedAddons.auctionPricing[value].OnSelect();
Zerotorescue@155 739 end
Zerotorescue@155 740 end,
Zerotorescue@155 741 arg = "overrideAuctionPricingAddon",
Zerotorescue@155 742 },
Zerotorescue@155 743 overrideItemCountAddon = {
Zerotorescue@155 744 order = 19,
Zerotorescue@155 745 type = "toggle",
Zerotorescue@155 746 name = "Override item count addon",
Zerotorescue@155 747 desc = "Allows you to override the item count addon setting for this group.",
Zerotorescue@155 748 arg = "itemCountAddon",
Zerotorescue@155 749 },
Zerotorescue@155 750 itemCountAddon = {
Zerotorescue@155 751 order = 20,
Zerotorescue@155 752 type = "select",
Zerotorescue@155 753 name = "Prefered item count addon",
Zerotorescue@155 754 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 755 values = function()
Zerotorescue@155 756 local temp = {};
Zerotorescue@155 757 for name, value in pairs(addon.supportedAddons.itemCount) do
Zerotorescue@155 758 temp[name] = name;
Zerotorescue@155 759 end
Zerotorescue@155 760
Zerotorescue@155 761 return temp;
Zerotorescue@155 762 end,
Zerotorescue@155 763 set = function(info, value)
Zerotorescue@155 764 local groupName = groupIdToName[info[2]];
Zerotorescue@155 765 local optionName = info[#info];
Zerotorescue@155 766
Zerotorescue@155 767 addon.db.profile.groups[groupName][optionName] = value ~= "" and value;
Zerotorescue@155 768
Zerotorescue@155 769 if addon.supportedAddons.itemCount[value].OnSelect then
Zerotorescue@155 770 addon.supportedAddons.itemCount[value].OnSelect();
Zerotorescue@155 771 end
Zerotorescue@155 772 end,
Zerotorescue@155 773 arg = "overrideItemCountAddon",
Zerotorescue@155 774 },
Zerotorescue@155 775 overrideCraftingAddon = {
Zerotorescue@155 776 order = 29,
Zerotorescue@155 777 type = "toggle",
Zerotorescue@155 778 name = "Override crafting addon",
Zerotorescue@155 779 desc = "Allows you to override the crafting addon setting for this group.",
Zerotorescue@155 780 arg = "craftingAddon",
Zerotorescue@155 781 },
Zerotorescue@155 782 craftingAddon = {
Zerotorescue@155 783 order = 30,
Zerotorescue@155 784 type = "select",
Zerotorescue@155 785 name = "Prefered crafting addon",
Zerotorescue@155 786 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 787 values = function()
Zerotorescue@155 788 local temp = {};
Zerotorescue@155 789 for name, value in pairs(addon.supportedAddons.crafting) do
Zerotorescue@155 790 temp[name] = name;
Zerotorescue@155 791 end
Zerotorescue@155 792
Zerotorescue@155 793 return temp;
Zerotorescue@155 794 end,
Zerotorescue@155 795 set = function(info, value)
Zerotorescue@155 796 local groupName = groupIdToName[info[2]];
Zerotorescue@155 797 local optionName = info[#info];
Zerotorescue@155 798
Zerotorescue@155 799 addon.db.profile.groups[groupName][optionName] = value ~= "" and value;
Zerotorescue@155 800
Zerotorescue@155 801 if addon.supportedAddons.crafting[value].OnSelect then
Zerotorescue@155 802 addon.supportedAddons.crafting[value].OnSelect();
Zerotorescue@155 803 end
Zerotorescue@155 804 end,
Zerotorescue@155 805 arg = "overrideCraftingAddon",
Zerotorescue@155 806 },
Zerotorescue@155 807 },
Zerotorescue@155 808 },
Zerotorescue@62 809 },
Zerotorescue@62 810 },
Zerotorescue@62 811 group = {
Zerotorescue@62 812 order = 20,
Zerotorescue@62 813 type = "group",
Zerotorescue@62 814 name = "Management",
Zerotorescue@62 815 desc = "Rename, delete, duplicate or export this group.",
Zerotorescue@62 816 args = {
Zerotorescue@62 817 actions = {
Zerotorescue@62 818 order = 10,
Zerotorescue@62 819 type = "group",
Zerotorescue@62 820 name = "Actions",
Zerotorescue@62 821 inline = true,
Zerotorescue@62 822 args = {
Zerotorescue@62 823 rename = {
Zerotorescue@62 824 order = 10,
Zerotorescue@62 825 type = "input",
Zerotorescue@62 826 name = "Rename group - New name",
Zerotorescue@62 827 desc = "Change the name of this group to something else. You can also use item links here as you wish.",
Zerotorescue@62 828 validate = ValidateGroupName,
Zerotorescue@62 829 set = function(info, value)
Zerotorescue@62 830 local oldGroupName = groupIdToName[info[2]];
Zerotorescue@62 831
Zerotorescue@62 832 addon.db.profile.groups[value] = CopyTable(addon.db.profile.groups[oldGroupName]);
Zerotorescue@62 833 addon.db.profile.groups[oldGroupName] = nil;
Zerotorescue@62 834
Zerotorescue@62 835 groupIdToName[info[2]] = value;
Zerotorescue@62 836 groupIdToName[value] = true;
Zerotorescue@62 837 groupIdToName[oldGroupName] = nil;
Zerotorescue@62 838
Zerotorescue@62 839 mod:FillGroupOptions();
Zerotorescue@62 840 end,
Zerotorescue@62 841 get = function(info)
Zerotorescue@62 842 return groupIdToName[info[2]];
Zerotorescue@62 843 end,
Zerotorescue@62 844 },
Zerotorescue@62 845 duplicate = {
Zerotorescue@62 846 order = 20,
Zerotorescue@62 847 type = "input",
Zerotorescue@62 848 name = "Duplicate group - New name",
Zerotorescue@62 849 desc = "Duplicate this group. You can also use item links here as you wish.\n\nAll item data will be erased.",
Zerotorescue@62 850 validate = ValidateGroupName,
Zerotorescue@62 851 set = function(info, value)
Zerotorescue@62 852 local oldGroupName = groupIdToName[info[2]];
Zerotorescue@62 853
Zerotorescue@62 854 addon.db.profile.groups[value] = CopyTable(addon.db.profile.groups[oldGroupName]);
Zerotorescue@62 855
Zerotorescue@62 856 -- Reset item data (duplicate items me no want)
Zerotorescue@62 857 addon.db.profile.groups[value].items = nil;
Zerotorescue@62 858
Zerotorescue@62 859 mod:FillGroupOptions();
Zerotorescue@62 860 end,
Zerotorescue@62 861 get = false,
Zerotorescue@62 862 },
Zerotorescue@62 863 delete = {
Zerotorescue@62 864 order = 30,
Zerotorescue@62 865 type = "execute",
Zerotorescue@62 866 name = "Delete group",
Zerotorescue@62 867 desc = "Delete the currently selected group.",
Zerotorescue@62 868 confirm = true,
Zerotorescue@62 869 confirmText = "Are you sure you wish to |cffff0000DELETE|r this group? This action is not reversable!",
Zerotorescue@62 870 func = function(info)
Zerotorescue@62 871 local groupName = groupIdToName[info[2]];
Zerotorescue@62 872
Zerotorescue@62 873 addon.db.profile.groups[groupName] = nil;
Zerotorescue@62 874
Zerotorescue@62 875 mod:FillGroupOptions();
Zerotorescue@62 876 end,
Zerotorescue@62 877 },
Zerotorescue@62 878 },
Zerotorescue@62 879 },
Zerotorescue@62 880 export = {
Zerotorescue@62 881 order = 40,
Zerotorescue@62 882 type = "group",
Zerotorescue@62 883 name = "Export",
Zerotorescue@62 884 inline = true,
Zerotorescue@62 885 args = {
Zerotorescue@62 886 input = {
Zerotorescue@62 887 order = 10,
Zerotorescue@62 888 type = "input",
Zerotorescue@62 889 multiline = true,
Zerotorescue@62 890 name = "Group data",
Zerotorescue@62 891 width = "full",
Zerotorescue@62 892 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 893 set = false,
Zerotorescue@62 894 get = function(info)
Zerotorescue@62 895 local groupName = groupIdToName[info[2]];
Zerotorescue@62 896
Zerotorescue@152 897 return mod:ExportGroup(groupName);
Zerotorescue@62 898 end,
Zerotorescue@62 899 },
Zerotorescue@62 900 },
Zerotorescue@62 901 },
Zerotorescue@62 902 },
Zerotorescue@62 903 },
Zerotorescue@62 904 add = {
Zerotorescue@62 905 order = 30,
Zerotorescue@62 906 type = "group",
Zerotorescue@62 907 name = "Add items",
Zerotorescue@62 908 desc = "Add new items to this group.",
Zerotorescue@62 909 hidden = function(info) return groupIsVirtual[info[2]]; end,
Zerotorescue@62 910 args = {
Zerotorescue@62 911 singleAdd = {
Zerotorescue@62 912 order = 10,
Zerotorescue@62 913 type = "group",
Zerotorescue@62 914 inline = true,
Zerotorescue@62 915 name = "Add items",
Zerotorescue@62 916 args = {
Zerotorescue@62 917 help = {
Zerotorescue@62 918 order = 10,
Zerotorescue@62 919 type = "description",
Zerotorescue@62 920 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 921 hidden = function() return addon.db.profile.defaults.hideHelp; end,
Zerotorescue@62 922 },
Zerotorescue@62 923 itemLink = {
Zerotorescue@62 924 order = 20,
Zerotorescue@62 925 type = "input",
Zerotorescue@62 926 name = "Single item add (item-link or item-id)",
Zerotorescue@62 927 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 928 validate = function(info, value)
Zerotorescue@62 929 -- If the value is empty we'll allow passing to clear the carret
Zerotorescue@62 930 if value == "" then return true; end
Zerotorescue@62 931
Zerotorescue@62 932 local groupName = groupIdToName[info[2]];
Zerotorescue@62 933
Zerotorescue@76 934 local itemId = (addon:GetItemId(string.trim(value)) or tonumber(string.trim(value)));
Zerotorescue@76 935
Zerotorescue@76 936 local itemData = addon.ItemData:New(itemId);
Zerotorescue@62 937
Zerotorescue@62 938 if not itemId then
Zerotorescue@76 939 return "This is not a valid item link or id.";
Zerotorescue@76 940 elseif itemData:InGroup() then
Zerotorescue@76 941 return ("This item is already in the group |cfffed000%s|r."):format(itemData:InGroup());
Zerotorescue@62 942 end
Zerotorescue@62 943
Zerotorescue@62 944 return true;
Zerotorescue@62 945 end,
Zerotorescue@62 946 set = function(info, value)
Zerotorescue@62 947 if value and value ~= "" then
Zerotorescue@62 948 local groupName = groupIdToName[info[2]];
Zerotorescue@62 949
Zerotorescue@76 950 local itemId = (addon:GetItemId(string.trim(value)) or tonumber(string.trim(value)));
Zerotorescue@62 951
Zerotorescue@76 952 local itemData = addon.ItemData:New(itemId);
Zerotorescue@76 953
Zerotorescue@76 954 if itemData:AddToGroup(groupName) then
Zerotorescue@98 955 addon:Print(("Added %s to the selected group."):format( (itemData.link or unknownItemName:format(itemId)) ), addon.Colors.Green);
Zerotorescue@76 956
Zerotorescue@76 957 if AceConfigRegistry then
Zerotorescue@76 958 -- Now rebuild the list
Zerotorescue@76 959 AceConfigRegistry:NotifyChange("InventoriumOptions");
Zerotorescue@76 960 end
Zerotorescue@76 961 else
Zerotorescue@98 962 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 963 end
Zerotorescue@62 964 end
Zerotorescue@62 965 end,
Zerotorescue@62 966 get = false,
Zerotorescue@62 967 },
Zerotorescue@62 968 importItemData = {
Zerotorescue@62 969 order = 30,
Zerotorescue@62 970 type = "input",
Zerotorescue@62 971 name = "Import item data",
Zerotorescue@62 972 desc = "Import item data from an exported item data-string. Any items already grouped will be skipped.",
Zerotorescue@62 973 set = function(info, value)
Zerotorescue@62 974 local groupName = groupIdToName[info[2]];
Zerotorescue@62 975
Zerotorescue@62 976 local allItemIds = { string.split(";", value or "") };
Zerotorescue@62 977
Zerotorescue@62 978 for _, value in pairs(allItemIds) do
Zerotorescue@62 979 local itemId = tonumber(value);
Zerotorescue@62 980
Zerotorescue@76 981 if itemId then
Zerotorescue@76 982 local itemData = addon.ItemData:New(itemId);
Zerotorescue@76 983
Zerotorescue@76 984 if itemData:InGroup() then
Zerotorescue@98 985 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 986 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 987 elseif itemData:AddToGroup(groupName) then
Zerotorescue@98 988 addon:Print(("Added %s to the group |cfffed000%s|r."):format(itemData.link or unknownItemName:format(itemId), groupName), addon.Colors.Green);
Zerotorescue@76 989 end
Zerotorescue@62 990 else
Zerotorescue@98 991 addon:Print(("\"%s\" is not a number."):format(value), addon.Colors.Red);
Zerotorescue@62 992 end
Zerotorescue@62 993 end
Zerotorescue@76 994
Zerotorescue@76 995 if AceConfigRegistry then
Zerotorescue@76 996 -- Now rebuild the list
Zerotorescue@76 997 AceConfigRegistry:NotifyChange("InventoriumOptions");
Zerotorescue@76 998 end
Zerotorescue@62 999 end,
Zerotorescue@62 1000 get = false,
Zerotorescue@62 1001 },
Zerotorescue@62 1002 importPremadeData = {
Zerotorescue@62 1003 order = 40,
Zerotorescue@62 1004 type = "select",
Zerotorescue@106 1005 width = "double",
Zerotorescue@62 1006 name = "Import premade data",
Zerotorescue@62 1007 desc = "Import item data from a premade item-group. Any items already grouped will be skipped.",
Zerotorescue@62 1008 values = function()
Zerotorescue@62 1009 local temp = {};
Zerotorescue@62 1010 for key, group in pairs(addon.defaultGroups) do
Zerotorescue@62 1011 temp[key] = key;
Zerotorescue@62 1012 end
Zerotorescue@62 1013
Zerotorescue@62 1014 return temp;
Zerotorescue@62 1015 end,
Zerotorescue@62 1016 set = function(info, value)
Zerotorescue@62 1017 local groupName = groupIdToName[info[2]];
Zerotorescue@62 1018
Zerotorescue@161 1019 local premadeItemGroup = addon.defaultGroups[value];
Zerotorescue@62 1020
Zerotorescue@161 1021 if premadeItemGroup.isParent and premadeItemGroup.childs then
Zerotorescue@161 1022 for _, premadeItemGroupName in pairs(premadeItemGroup.childs) do
Zerotorescue@161 1023 ImportPremadeItemsGroup(groupName, premadeItemGroupName);
Zerotorescue@62 1024 end
Zerotorescue@161 1025 else
Zerotorescue@161 1026 ImportPremadeItemsGroup(groupName, value);
Zerotorescue@62 1027 end
Zerotorescue@76 1028
Zerotorescue@76 1029 if AceConfigRegistry then
Zerotorescue@76 1030 -- Now rebuild the list
Zerotorescue@76 1031 AceConfigRegistry:NotifyChange("InventoriumOptions");
Zerotorescue@76 1032 end
Zerotorescue@62 1033 end,
Zerotorescue@62 1034 get = false,
Zerotorescue@62 1035 },
Zerotorescue@62 1036 },
Zerotorescue@62 1037 },
Zerotorescue@62 1038 massAdd = {
Zerotorescue@62 1039 order = 20,
Zerotorescue@62 1040 type = "group",
Zerotorescue@62 1041 inline = true,
Zerotorescue@62 1042 name = "Mass add",
Zerotorescue@62 1043 args = {
Zerotorescue@62 1044 help = {
Zerotorescue@62 1045 order = 10,
Zerotorescue@62 1046 type = "description",
Zerotorescue@62 1047 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 1048 hidden = function() return addon.db.profile.defaults.hideHelp; end,
Zerotorescue@62 1049 },
Zerotorescue@62 1050 massAdd = {
Zerotorescue@62 1051 order = 20,
Zerotorescue@62 1052 type = "input",
Zerotorescue@62 1053 name = "Add all items matching...",
Zerotorescue@62 1054 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 1055 set = function(info, value)
Zerotorescue@62 1056 local groupName = groupIdToName[info[2]];
Zerotorescue@62 1057
Zerotorescue@62 1058 if not value then return; end
Zerotorescue@62 1059
Zerotorescue@62 1060 value = value:lower();
Zerotorescue@62 1061
Zerotorescue@62 1062 local ref = options.args.groups.args[info[2]].args.add.args.list.args;
Zerotorescue@62 1063
Zerotorescue@62 1064 for itemId, test in pairs(ref) do
Zerotorescue@62 1065 if test then
Zerotorescue@76 1066 local itemData = addon.ItemData:New(itemId);
Zerotorescue@62 1067
Zerotorescue@76 1068 if itemData.name:lower():find(value) then
Zerotorescue@76 1069 if itemData:AddToGroup(groupName) then
Zerotorescue@98 1070 addon:Print(("Added %s to the selected group."):format( (itemData.link or unknownItemName:format(itemId)) ), addon.Colors.Green);
Zerotorescue@76 1071 else
Zerotorescue@98 1072 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 1073 end
Zerotorescue@62 1074 end
Zerotorescue@62 1075 end
Zerotorescue@62 1076 end
Zerotorescue@76 1077
Zerotorescue@76 1078 if AceConfigRegistry then
Zerotorescue@76 1079 -- Now rebuild the list
Zerotorescue@76 1080 AceConfigRegistry:NotifyChange("InventoriumOptions");
Zerotorescue@76 1081 end
Zerotorescue@62 1082 end,
Zerotorescue@62 1083 get = false,
Zerotorescue@62 1084 },
Zerotorescue@62 1085 minItemLevel = {
Zerotorescue@62 1086 order = 40,
Zerotorescue@62 1087 type = "select",
Zerotorescue@62 1088 values = function()
Zerotorescue@62 1089 local temp = {};
Zerotorescue@62 1090
Zerotorescue@62 1091 temp[0] = "Include everything";
Zerotorescue@62 1092
Zerotorescue@62 1093 local itemLevelTemplate = "Itemlevel >= %d";
Zerotorescue@62 1094
Zerotorescue@62 1095 for i = 1, 49 do
Zerotorescue@62 1096 temp[( i * 10 )] = itemLevelTemplate:format(( i * 10 ));
Zerotorescue@62 1097 end
Zerotorescue@62 1098
Zerotorescue@62 1099 temp[500] = "Include nothing";
Zerotorescue@62 1100
Zerotorescue@62 1101 return temp;
Zerotorescue@62 1102 end,
Zerotorescue@62 1103 name = "Include tradeskill items",
Zerotorescue@62 1104 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 1105 set = function(i, v) includeTradeSkillItems = v; end,
Zerotorescue@62 1106 get = function() return includeTradeSkillItems; end,
Zerotorescue@62 1107 disabled = function()
Zerotorescue@62 1108 if GetTradeSkillLine() == "UNKNOWN" then
Zerotorescue@62 1109 includeTradeSkillItems = 500;
Zerotorescue@62 1110 return true; -- disabled
Zerotorescue@62 1111 else
Zerotorescue@62 1112 return false;
Zerotorescue@62 1113 end
Zerotorescue@62 1114 end,
Zerotorescue@62 1115 },
Zerotorescue@62 1116 },
Zerotorescue@62 1117 },
Zerotorescue@62 1118 list = {
Zerotorescue@62 1119 order = 30,
Zerotorescue@62 1120 type = "group",
Zerotorescue@62 1121 inline = true,
Zerotorescue@62 1122 name = "Item list",
Zerotorescue@62 1123 hidden = UpdateAddItemList,
Zerotorescue@62 1124 args = {
Zerotorescue@62 1125
Zerotorescue@62 1126 },
Zerotorescue@62 1127 },
Zerotorescue@62 1128 },
Zerotorescue@62 1129 },
Zerotorescue@62 1130 remove = {
Zerotorescue@62 1131 order = 40,
Zerotorescue@62 1132 type = "group",
Zerotorescue@62 1133 name = "Current items",
Zerotorescue@62 1134 desc = "View, export or remove items from this group.",
Zerotorescue@62 1135 hidden = function(info) return groupIsVirtual[info[2]]; end,
Zerotorescue@62 1136 args = {
Zerotorescue@62 1137 help = {
Zerotorescue@62 1138 order = 10,
Zerotorescue@62 1139 type = "group",
Zerotorescue@62 1140 inline = true,
Zerotorescue@106 1141 name = "Remove items",
Zerotorescue@62 1142 hidden = false,
Zerotorescue@62 1143 args = {
Zerotorescue@62 1144 help = {
Zerotorescue@62 1145 order = 10,
Zerotorescue@62 1146 type = "description",
Zerotorescue@62 1147 name = "Click the items you wish to remove from this group.",
Zerotorescue@106 1148 hidden = function() return addon.db.profile.defaults.hideHelp; end,
Zerotorescue@62 1149 },
Zerotorescue@62 1150 massRemove = {
Zerotorescue@62 1151 order = 20,
Zerotorescue@62 1152 type = "input",
Zerotorescue@62 1153 name = "Remove all items matching...",
Zerotorescue@62 1154 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 1155 set = function(info, value)
Zerotorescue@62 1156 local groupName = groupIdToName[info[2]];
Zerotorescue@62 1157
Zerotorescue@62 1158 if not value then return; end
Zerotorescue@62 1159
Zerotorescue@62 1160 value = value:lower();
Zerotorescue@62 1161
Zerotorescue@62 1162 local ref = options.args.groups.args[info[2]].args.remove.args.list.args;
Zerotorescue@62 1163
Zerotorescue@62 1164 for itemId, test in pairs(ref) do
Zerotorescue@62 1165 if test then
Zerotorescue@76 1166 local itemData = addon.ItemData:New(itemId);
Zerotorescue@62 1167
Zerotorescue@76 1168 if itemData.name:lower():find(value) then
Zerotorescue@76 1169 itemData:RemoveFromGroup(groupName);
Zerotorescue@76 1170
Zerotorescue@98 1171 addon:Print(("Removed %s from the selected group."):format( (itemData.link or unknownItemName:format(itemId)) ), addon.Colors.Red);
Zerotorescue@62 1172 end
Zerotorescue@62 1173 end
Zerotorescue@62 1174 end
Zerotorescue@62 1175
Zerotorescue@76 1176 if AceConfigRegistry then
Zerotorescue@76 1177 -- Now rebuild the list
Zerotorescue@76 1178 AceConfigRegistry:NotifyChange("InventoriumOptions");
Zerotorescue@76 1179 end
Zerotorescue@62 1180 end,
Zerotorescue@62 1181 get = false,
Zerotorescue@62 1182 },
Zerotorescue@62 1183 premadeGroups = {
Zerotorescue@62 1184 order = 30,
Zerotorescue@62 1185 type = "select",
Zerotorescue@106 1186 width = "double",
Zerotorescue@62 1187 name = "Imported premade groups",
Zerotorescue@62 1188 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 1189 values = function(info)
Zerotorescue@62 1190 local groupName = groupIdToName[info[2]];
Zerotorescue@62 1191
Zerotorescue@62 1192 local temp = {};
Zerotorescue@76 1193 temp[""] = "";
Zerotorescue@62 1194 if addon.db.profile.groups[groupName].premadeGroups then
Zerotorescue@62 1195 for name, version in pairs(addon.db.profile.groups[groupName].premadeGroups) do
Zerotorescue@62 1196 temp[name] = name;
Zerotorescue@62 1197 end
Zerotorescue@62 1198 end
Zerotorescue@62 1199
Zerotorescue@62 1200 return temp;
Zerotorescue@62 1201 end,
Zerotorescue@62 1202 set = function(info, value)
Zerotorescue@76 1203 if value and value ~= "" then
Zerotorescue@76 1204 -- Remove premade group from this group
Zerotorescue@76 1205 local groupName = groupIdToName[info[2]];
Zerotorescue@76 1206
Zerotorescue@76 1207 addon.db.profile.groups[groupName].premadeGroups[value] = nil;
Zerotorescue@76 1208
Zerotorescue@98 1209 addon:Print(("No longer notifying you about changes made to the premade group named \"|cfffed000%s|r\"."):format(value));
Zerotorescue@76 1210 end
Zerotorescue@62 1211 end,
Zerotorescue@62 1212 get = false,
Zerotorescue@62 1213 disabled = function(info)
Zerotorescue@62 1214 local groupName = groupIdToName[info[2]];
Zerotorescue@62 1215
Zerotorescue@62 1216 return (not addon.db.profile.groups[groupName].premadeGroups);
Zerotorescue@62 1217 end,
Zerotorescue@62 1218 },
Zerotorescue@62 1219 },
Zerotorescue@62 1220 },
Zerotorescue@62 1221 list = {
Zerotorescue@62 1222 order = 20,
Zerotorescue@62 1223 type = "group",
Zerotorescue@62 1224 inline = true,
Zerotorescue@62 1225 name = "Item list",
Zerotorescue@62 1226 hidden = UpdateRemoveItemList,
Zerotorescue@62 1227 args = {
Zerotorescue@62 1228
Zerotorescue@62 1229 },
Zerotorescue@62 1230 },
Zerotorescue@62 1231 export = {
Zerotorescue@62 1232 order = 30,
Zerotorescue@62 1233 type = "group",
Zerotorescue@62 1234 name = "Export",
Zerotorescue@62 1235 inline = true,
Zerotorescue@62 1236 args = {
Zerotorescue@62 1237 input = {
Zerotorescue@62 1238 order = 10,
Zerotorescue@62 1239 type = "input",
Zerotorescue@62 1240 name = "Item data",
Zerotorescue@62 1241 width = "full",
Zerotorescue@62 1242 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 1243 set = false,
Zerotorescue@62 1244 get = function(info)
Zerotorescue@62 1245 local groupName = groupIdToName[info[2]];
Zerotorescue@62 1246
Zerotorescue@62 1247 local combinedItemIds;
Zerotorescue@62 1248 -- Parse items in group and show these
Zerotorescue@62 1249 for itemId, _ in pairs(addon.db.profile.groups[groupName].items) do
Zerotorescue@62 1250 if not combinedItemIds then
Zerotorescue@62 1251 combinedItemIds = tostring(itemId);
Zerotorescue@62 1252 else
Zerotorescue@62 1253 combinedItemIds = combinedItemIds .. (";%d"):format(itemId);
Zerotorescue@62 1254 end
Zerotorescue@62 1255 end
Zerotorescue@62 1256
Zerotorescue@62 1257 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 1258 end,
Zerotorescue@62 1259 },
Zerotorescue@62 1260 },
Zerotorescue@62 1261 },
Zerotorescue@62 1262 },
Zerotorescue@62 1263 },
Zerotorescue@62 1264 },
Zerotorescue@62 1265 };
Zerotorescue@62 1266
Zerotorescue@62 1267
Zerotorescue@62 1268
Zerotorescue@62 1269
Zerotorescue@62 1270
Zerotorescue@62 1271
Zerotorescue@62 1272
Zerotorescue@62 1273
Zerotorescue@62 1274
Zerotorescue@62 1275 -- Object functions
Zerotorescue@62 1276
Zerotorescue@62 1277 function mod:OnEnable()
Zerotorescue@62 1278 -- Register our config slash command
Zerotorescue@62 1279 -- /im config
Zerotorescue@62 1280 addon:RegisterSlash(function(this)
Zerotorescue@62 1281 -- We don't want any other windows open at this time.
Zerotorescue@62 1282 for name, module in this:IterateModules() do
Zerotorescue@62 1283 if module.CloseFrame then
Zerotorescue@62 1284 module:CloseFrame();
Zerotorescue@62 1285 end
Zerotorescue@62 1286 end
Zerotorescue@62 1287
Zerotorescue@62 1288 this:GetModule("Config"):Show();
Zerotorescue@62 1289 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 1290
Zerotorescue@62 1291 -- Whenever the profile is changed, update the groups | args: (object for the functionName, eventName, functionName)
Zerotorescue@62 1292 addon.db.RegisterCallback(self, "OnProfileChanged", "RefreshConfig");
Zerotorescue@62 1293 addon.db.RegisterCallback(self, "OnProfileCopied", "RefreshConfig");
Zerotorescue@62 1294 addon.db.RegisterCallback(self, "OnProfileReset", "RefreshConfig");
Zerotorescue@62 1295
Zerotorescue@62 1296 -- Register our custom widgets
Zerotorescue@62 1297 local Widgets = addon:GetModule("Widgets");
Zerotorescue@62 1298 Widgets:ItemLinkButton();
Zerotorescue@62 1299 Widgets:ConfigItemLinkButton();
Zerotorescue@62 1300 end
Zerotorescue@62 1301
Zerotorescue@152 1302 function mod:ExportGroup(groupName)
Zerotorescue@152 1303 -- We want to include the group name, so we copy the table then set another value
Zerotorescue@152 1304 local temp = CopyTable(addon.db.profile.groups[groupName]);
Zerotorescue@152 1305 temp.name = groupName;
Zerotorescue@152 1306 temp.trackAtCharacters = nil;
Zerotorescue@152 1307 temp.overrideTrackAtCharacters = nil;
Zerotorescue@152 1308
Zerotorescue@152 1309 if not AceSerializer then
Zerotorescue@152 1310 AceSerializer = LibStub("AceSerializer-3.0");
Zerotorescue@152 1311 end
Zerotorescue@152 1312
Zerotorescue@152 1313 return AceSerializer:Serialize(temp);
Zerotorescue@152 1314 end
Zerotorescue@152 1315
Zerotorescue@62 1316 function mod:RefreshConfig()
Zerotorescue@65 1317 self:PremadeGroupsCheck();
Zerotorescue@65 1318
Zerotorescue@62 1319 self:FillGroupOptions();
Zerotorescue@62 1320 end
Zerotorescue@62 1321
Zerotorescue@62 1322 function mod:Load()
Zerotorescue@62 1323 if not AceConfigDialog and not AceConfigRegistry then
Zerotorescue@65 1324 self:PremadeGroupsCheck();
Zerotorescue@65 1325
Zerotorescue@62 1326 self:FillOptions();
Zerotorescue@62 1327
Zerotorescue@62 1328 -- Build options dialog
Zerotorescue@62 1329 AceConfigDialog = LibStub("AceConfigDialog-3.0");
Zerotorescue@62 1330 AceConfigRegistry = LibStub("AceConfigRegistry-3.0");
Zerotorescue@62 1331 -- Register options table
Zerotorescue@62 1332 LibStub("AceConfig-3.0"):RegisterOptionsTable("InventoriumOptions", options);
Zerotorescue@62 1333 -- Set a nice default size (so that 4 normal sized elements fit next to eachother)
Zerotorescue@62 1334 AceConfigDialog:SetDefaultSize("InventoriumOptions", 975, 600);
Zerotorescue@62 1335
Zerotorescue@62 1336 -- In case the addon is loaded from another condition, always call the remove interface options
Zerotorescue@62 1337 if AddonLoader and AddonLoader.RemoveInterfaceOptions then
Zerotorescue@62 1338 AddonLoader:RemoveInterfaceOptions("Inventorium");
Zerotorescue@62 1339 end
Zerotorescue@62 1340
Zerotorescue@62 1341 -- Add to the blizzard addons options thing
Zerotorescue@62 1342 AceConfigDialog:AddToBlizOptions("InventoriumOptions");
Zerotorescue@62 1343 end
Zerotorescue@62 1344 end
Zerotorescue@62 1345
Zerotorescue@62 1346 function mod:Show()
Zerotorescue@62 1347 self:Load();
Zerotorescue@62 1348
Zerotorescue@62 1349 AceConfigDialog:Open("InventoriumOptions");
Zerotorescue@62 1350 end
Zerotorescue@62 1351
Zerotorescue@62 1352 function mod:FillOptions()
Zerotorescue@62 1353 options = {
Zerotorescue@62 1354 type = "group",
Zerotorescue@62 1355 name = "Inventorium Config",
Zerotorescue@62 1356 childGroups = "tree",
Zerotorescue@62 1357 args = {
Zerotorescue@62 1358 },
Zerotorescue@62 1359 };
Zerotorescue@62 1360
Zerotorescue@62 1361 -- General
Zerotorescue@62 1362 self:FillGeneralOptions();
Zerotorescue@62 1363
Zerotorescue@62 1364 -- Help
Zerotorescue@62 1365 self:FillHelpOptions();
Zerotorescue@62 1366
Zerotorescue@62 1367 -- Profile
Zerotorescue@62 1368 options.args.profiles = LibStub("AceDBOptions-3.0"):GetOptionsTable(addon.db, true);
Zerotorescue@62 1369 options.args.profiles.order = 200;
Zerotorescue@62 1370
Zerotorescue@106 1371 -- Extra
Zerotorescue@106 1372 self:FillExtraOptions();
Zerotorescue@106 1373
Zerotorescue@62 1374 -- Groups
Zerotorescue@62 1375 self:MakeGroupOptions();
Zerotorescue@62 1376
Zerotorescue@62 1377 -- Groups-contents
Zerotorescue@62 1378 self:FillGroupOptions();
Zerotorescue@62 1379 end
Zerotorescue@62 1380
Zerotorescue@62 1381 function mod:FillGeneralOptions()
Zerotorescue@62 1382 options.args.general = {
Zerotorescue@62 1383 order = 100,
Zerotorescue@62 1384 type = "group",
Zerotorescue@62 1385 name = "General",
Zerotorescue@62 1386 desc = "Change general Inventorium settings.",
Zerotorescue@62 1387 args = {
Zerotorescue@62 1388 general = {
Zerotorescue@62 1389 order = 1,
Zerotorescue@62 1390 type = "group",
Zerotorescue@62 1391 inline = true,
Zerotorescue@62 1392 name = "General",
Zerotorescue@62 1393 args = {
Zerotorescue@62 1394 description = {
Zerotorescue@62 1395 order = 0,
Zerotorescue@62 1396 type = "description",
Zerotorescue@62 1397 name = function()
Zerotorescue@106 1398 local t = "";
Zerotorescue@106 1399 if not addon.db.profile.defaults.hideHelp then
Zerotorescue@155 1400 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 1401 end
Zerotorescue@155 1402
Zerotorescue@155 1403 return t;
Zerotorescue@155 1404 end,
Zerotorescue@155 1405 },
Zerotorescue@155 1406 header = {
Zerotorescue@155 1407 order = 5,
Zerotorescue@155 1408 type = "header",
Zerotorescue@155 1409 name = "",
Zerotorescue@155 1410 },
Zerotorescue@155 1411 trackAtCharacters = {
Zerotorescue@155 1412 order = 10,
Zerotorescue@155 1413 type = "multiselect",
Zerotorescue@155 1414 width = "double",
Zerotorescue@155 1415 name = "Track at these characters:",
Zerotorescue@155 1416 desc = "Select at which characters this should appear in the summary and generate alerts.",
Zerotorescue@155 1417 values = function()
Zerotorescue@155 1418 local temp = {};
Zerotorescue@155 1419 for charName in pairs(addon.db.factionrealm.characters) do
Zerotorescue@155 1420 temp[charName] = charName;
Zerotorescue@155 1421 end
Zerotorescue@155 1422
Zerotorescue@155 1423 return temp;
Zerotorescue@155 1424 end,
Zerotorescue@155 1425 get = function(i, v)
Zerotorescue@155 1426 return addon.db.profile.defaults.trackAtCharacters[v];
Zerotorescue@155 1427 end,
Zerotorescue@155 1428 set = function(i, v, e)
Zerotorescue@155 1429 addon.db.profile.defaults.trackAtCharacters[v] = e or nil;
Zerotorescue@155 1430 end,
Zerotorescue@155 1431 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 1432 },
Zerotorescue@155 1433 localItemData = {
Zerotorescue@155 1434 order = 20,
Zerotorescue@155 1435 type = "multiselect",
Zerotorescue@155 1436 width = "double",
Zerotorescue@155 1437 name = "Include in local item data",
Zerotorescue@155 1438 desc = "Select which data should be included in the local item data.",
Zerotorescue@155 1439 values = {
Zerotorescue@155 1440 ["Bag"] = "Bag",
Zerotorescue@155 1441 ["Bank"] = "Bank",
Zerotorescue@155 1442 ["Auction House"] = "Auction House",
Zerotorescue@155 1443 ["Mailbox"] = "Mailbox",
Zerotorescue@155 1444 },
Zerotorescue@155 1445 get = function(i, v) return addon.db.profile.defaults.localItemData and addon.db.profile.defaults.localItemData[v]; end,
Zerotorescue@155 1446 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 1447 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 1448 },
Zerotorescue@155 1449 },
Zerotorescue@155 1450 },
Zerotorescue@155 1451 minimumStock = {
Zerotorescue@155 1452 order = 10,
Zerotorescue@155 1453 type = "group",
Zerotorescue@155 1454 inline = true,
Zerotorescue@155 1455 name = "Minimum stock",
Zerotorescue@155 1456 args = {
Zerotorescue@155 1457 description = {
Zerotorescue@155 1458 order = 0,
Zerotorescue@155 1459 type = "description",
Zerotorescue@155 1460 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 1461 hidden = function() return addon.db.profile.defaults.hideHelp; end,
Zerotorescue@155 1462 },
Zerotorescue@155 1463 header = {
Zerotorescue@155 1464 order = 5,
Zerotorescue@155 1465 type = "header",
Zerotorescue@155 1466 name = "",
Zerotorescue@155 1467 hidden = function() return addon.db.profile.defaults.hideHelp; end,
Zerotorescue@155 1468 },
Zerotorescue@155 1469 minLocalStock = {
Zerotorescue@155 1470 order = 10,
Zerotorescue@155 1471 type = "range",
Zerotorescue@155 1472 min = 0,
Zerotorescue@155 1473 max = 100000,
Zerotorescue@155 1474 softMax = 100,
Zerotorescue@155 1475 step = 1,
Zerotorescue@155 1476 name = "Minimum local stock",
Zerotorescue@155 1477 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 1478 get = function() return addon.db.profile.defaults.minLocalStock; end,
Zerotorescue@155 1479 set = function(i, v) addon.db.profile.defaults.minLocalStock = v; end,
Zerotorescue@155 1480 },
Zerotorescue@155 1481 alertBelowLocalMinimum = {
Zerotorescue@155 1482 order = 11,
Zerotorescue@155 1483 type = "toggle",
Zerotorescue@155 1484 name = "Alert when below local minimum (NYI)",
Zerotorescue@155 1485 desc = "Show an alert when this item gets below this threshold.",
Zerotorescue@155 1486 get = function() return addon.db.profile.defaults.alertBelowLocalMinimum; end,
Zerotorescue@155 1487 set = function(i, v) addon.db.profile.defaults.alertBelowLocalMinimum = v; end,
Zerotorescue@155 1488 },
Zerotorescue@155 1489 autoRefill = {
Zerotorescue@155 1490 order = 12,
Zerotorescue@155 1491 type = "toggle",
Zerotorescue@155 1492 name = "Auto refill from storage",
Zerotorescue@155 1493 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 1494 get = function() return addon.db.profile.defaults.autoRefill; end,
Zerotorescue@155 1495 set = function(i, v) addon.db.profile.defaults.autoRefill = v; end,
Zerotorescue@155 1496 },
Zerotorescue@155 1497 minGlobalStock = {
Zerotorescue@155 1498 order = 20,
Zerotorescue@155 1499 type = "range",
Zerotorescue@155 1500 min = 0,
Zerotorescue@155 1501 max = 100000,
Zerotorescue@155 1502 softMax = 100,
Zerotorescue@155 1503 step = 1,
Zerotorescue@155 1504 name = "Minimum global stock",
Zerotorescue@155 1505 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 1506 get = function() return addon.db.profile.defaults.minGlobalStock; end,
Zerotorescue@155 1507 set = function(i, v) addon.db.profile.defaults.minGlobalStock = v; end,
Zerotorescue@155 1508 },
Zerotorescue@155 1509 alertBelowGlobalMinimum = {
Zerotorescue@155 1510 order = 21,
Zerotorescue@155 1511 type = "toggle",
Zerotorescue@155 1512 name = "Alert when below global minimum (NYI)",
Zerotorescue@155 1513 desc = "Show an alert when this item gets below this threshold.",
Zerotorescue@155 1514 get = function() return addon.db.profile.defaults.alertBelowGlobalMinimum; end,
Zerotorescue@155 1515 set = function(i, v) addon.db.profile.defaults.alertBelowGlobalMinimum = v; end,
Zerotorescue@155 1516 },
Zerotorescue@155 1517 summaryThresholdShow = {
Zerotorescue@155 1518 order = 30,
Zerotorescue@155 1519 type = "range",
Zerotorescue@155 1520 min = 0,
Zerotorescue@155 1521 max = 100,
Zerotorescue@155 1522 softMax = 100,
Zerotorescue@155 1523 step = 0.05,
Zerotorescue@155 1524 isPercent = true,
Zerotorescue@155 1525 name = "Show in summary when below",
Zerotorescue@155 1526 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 1527 get = function() return addon.db.profile.defaults.summaryThresholdShow; end,
Zerotorescue@155 1528 set = function(i, v) addon.db.profile.defaults.summaryThresholdShow = v; end,
Zerotorescue@155 1529 },
Zerotorescue@155 1530 },
Zerotorescue@155 1531 },
Zerotorescue@155 1532 refill = {
Zerotorescue@155 1533 order = 20,
Zerotorescue@155 1534 type = "group",
Zerotorescue@155 1535 inline = true,
Zerotorescue@155 1536 name = "Replenishing stock",
Zerotorescue@155 1537 args = {
Zerotorescue@155 1538 description = {
Zerotorescue@155 1539 order = 0,
Zerotorescue@155 1540 type = "description",
Zerotorescue@155 1541 name = function()
Zerotorescue@155 1542 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 1543
Zerotorescue@155 1544 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 1545
Zerotorescue@155 1546 return r;
Zerotorescue@155 1547 end,
Zerotorescue@155 1548 hidden = function() return addon.db.profile.defaults.hideHelp; end,
Zerotorescue@155 1549 },
Zerotorescue@155 1550 header = {
Zerotorescue@155 1551 order = 5,
Zerotorescue@155 1552 type = "header",
Zerotorescue@155 1553 name = "",
Zerotorescue@155 1554 hidden = function() return addon.db.profile.defaults.hideHelp; end,
Zerotorescue@155 1555 },
Zerotorescue@155 1556 restockTarget = {
Zerotorescue@155 1557 order = 10,
Zerotorescue@155 1558 type = "range",
Zerotorescue@155 1559 min = 0,
Zerotorescue@155 1560 max = 100000,
Zerotorescue@155 1561 softMax = 100,
Zerotorescue@155 1562 step = 1,
Zerotorescue@155 1563 name = "Restock target",
Zerotorescue@155 1564 desc = "You can manually enter a value between 100 and 100.000 in the edit box if the provided range is insufficient.",
Zerotorescue@155 1565 get = function() return addon.db.profile.defaults.restockTarget; end,
Zerotorescue@155 1566 set = function(i, v) addon.db.profile.defaults.restockTarget = v; end,
Zerotorescue@155 1567 },
Zerotorescue@155 1568 minCraftingQueue = {
Zerotorescue@155 1569 order = 20,
Zerotorescue@155 1570 type = "range",
Zerotorescue@155 1571 min = 0,
Zerotorescue@155 1572 max = 1,
Zerotorescue@155 1573 step = 0.01, -- 1%
Zerotorescue@155 1574 isPercent = true,
Zerotorescue@155 1575 name = "Don't queue if I only miss",
Zerotorescue@155 1576 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 1577 get = function() return addon.db.profile.defaults.minCraftingQueue; end,
Zerotorescue@155 1578 set = function(i, v) addon.db.profile.defaults.minCraftingQueue = v; end,
Zerotorescue@155 1579 },
Zerotorescue@155 1580 bonusQueue = {
Zerotorescue@155 1581 order = 30,
Zerotorescue@155 1582 type = "range",
Zerotorescue@155 1583 min = 0,
Zerotorescue@155 1584 max = 10, -- 1000%
Zerotorescue@155 1585 step = 0.01, -- 1%
Zerotorescue@155 1586 isPercent = true,
Zerotorescue@155 1587 name = "Bonus queue",
Zerotorescue@155 1588 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 1589 get = function() return addon.db.profile.defaults.bonusQueue; end,
Zerotorescue@155 1590 set = function(i, v) addon.db.profile.defaults.bonusQueue = v; end,
Zerotorescue@155 1591 },
Zerotorescue@155 1592 priceThreshold = {
Zerotorescue@155 1593 order = 40,
Zerotorescue@155 1594 type = "input",
Zerotorescue@155 1595 name = "Price threshold",
Zerotorescue@155 1596 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 1597 validate = function(info, value) return addon:ValidateReadableMoney(info, value); end,
Zerotorescue@155 1598 get = function() return addon:ReadableMoney(addon.db.profile.defaults.priceThreshold); end,
Zerotorescue@155 1599 set = function(i, v) addon.db.profile.defaults.priceThreshold = addon:ReadableMoneyToCopper(v); end,
Zerotorescue@155 1600 },
Zerotorescue@155 1601 summaryHidePriceThreshold = {
Zerotorescue@155 1602 order = 50,
Zerotorescue@155 1603 type = "toggle",
Zerotorescue@155 1604 name = "Hide when below threshold",
Zerotorescue@155 1605 desc = "Hide items from the summary when their value is below the set price threshold.",
Zerotorescue@155 1606 get = function() return addon.db.profile.defaults.summaryHidePriceThreshold; end,
Zerotorescue@155 1607 set = function(i, v) addon.db.profile.defaults.summaryHidePriceThreshold = v; end,
Zerotorescue@155 1608 },
Zerotorescue@155 1609 alwaysGetAuctionValue = {
Zerotorescue@155 1610 order = 60,
Zerotorescue@155 1611 type = "toggle",
Zerotorescue@155 1612 name = "Always show auction value",
Zerotorescue@155 1613 desc = "Always cache and show the auction value of items, even if the price threshold is set to 0|cffeda55fc|r.",
Zerotorescue@155 1614 get = function() return addon.db.profile.defaults.alwaysGetAuctionValue; end,
Zerotorescue@155 1615 set = function(i, v) addon.db.profile.defaults.alwaysGetAuctionValue = v; end,
Zerotorescue@155 1616 },
Zerotorescue@155 1617 },
Zerotorescue@155 1618 },
Zerotorescue@155 1619 addon = {
Zerotorescue@155 1620 order = 30,
Zerotorescue@155 1621 type = "group",
Zerotorescue@155 1622 inline = true,
Zerotorescue@155 1623 name = "Prefered addons",
Zerotorescue@155 1624 args = {
Zerotorescue@155 1625 description = {
Zerotorescue@155 1626 order = 0,
Zerotorescue@155 1627 type = "description",
Zerotorescue@155 1628 name = function()
Zerotorescue@155 1629 local t = "";
Zerotorescue@155 1630 if not addon.db.profile.defaults.hideHelp then
Zerotorescue@155 1631 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 1632 end
Zerotorescue@62 1633
Zerotorescue@62 1634 local currentAddon, selectedAddonName = addon:GetItemCountAddon();
Zerotorescue@62 1635 local preferedAddon = addon.db.profile.defaults.itemCountAddon;
Zerotorescue@62 1636
Zerotorescue@62 1637 if currentAddon then
Zerotorescue@62 1638 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 1639
Zerotorescue@62 1640 if currentAddon.GetTotalCount and currentAddon.GetCharacterCount then
Zerotorescue@62 1641 t = t .. " This addon supports |cfffed000both total as local|r item counts.";
Zerotorescue@62 1642 elseif currentAddon.GetTotalCount then
Zerotorescue@62 1643 t = t .. " This addon supports |cfffed000only total|r item counts.";
Zerotorescue@62 1644 elseif currentAddon.GetCharacterCount then
Zerotorescue@62 1645 t = t .. " This addon supports |cfffed000only local|r item counts.";
Zerotorescue@62 1646 end
Zerotorescue@62 1647
Zerotorescue@62 1648 if preferedAddon ~= selectedAddonName then
Zerotorescue@62 1649 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 1650 end
Zerotorescue@62 1651 end
Zerotorescue@62 1652
Zerotorescue@62 1653 return t;
Zerotorescue@62 1654 end,
Zerotorescue@62 1655 },
Zerotorescue@62 1656 header = {
Zerotorescue@62 1657 order = 5,
Zerotorescue@62 1658 type = "header",
Zerotorescue@62 1659 name = "",
Zerotorescue@62 1660 },
Zerotorescue@62 1661 auctionPricingAddon = {
Zerotorescue@62 1662 order = 10,
Zerotorescue@62 1663 type = "select",
Zerotorescue@62 1664 name = "Prefered pricing addon",
Zerotorescue@62 1665 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 1666 values = function()
Zerotorescue@62 1667 local temp = {};
Zerotorescue@62 1668 for name, value in pairs(addon.supportedAddons.auctionPricing) do
Zerotorescue@62 1669 temp[name] = name;
Zerotorescue@62 1670 end
Zerotorescue@62 1671
Zerotorescue@62 1672 return temp;
Zerotorescue@62 1673 end,
Zerotorescue@62 1674 get = function() return addon.db.profile.defaults.auctionPricingAddon; end,
Zerotorescue@62 1675 set = function(i, v)
Zerotorescue@62 1676 addon.db.profile.defaults.auctionPricingAddon = v;
Zerotorescue@62 1677
Zerotorescue@62 1678 if addon.supportedAddons.auctionPricing[v].OnSelect then
Zerotorescue@62 1679 addon.supportedAddons.auctionPricing[v].OnSelect();
Zerotorescue@62 1680 end
Zerotorescue@62 1681 end,
Zerotorescue@62 1682 },
Zerotorescue@62 1683 itemCountAddon = {
Zerotorescue@62 1684 order = 20,
Zerotorescue@62 1685 type = "select",
Zerotorescue@62 1686 name = "Prefered item count addon",
Zerotorescue@62 1687 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 1688 values = function()
Zerotorescue@62 1689 local temp = {};
Zerotorescue@62 1690 for name, value in pairs(addon.supportedAddons.itemCount) do
Zerotorescue@62 1691 temp[name] = name;
Zerotorescue@62 1692 end
Zerotorescue@62 1693
Zerotorescue@62 1694 return temp;
Zerotorescue@62 1695 end,
Zerotorescue@62 1696 get = function() return addon.db.profile.defaults.itemCountAddon; end,
Zerotorescue@62 1697 set = function(i, v)
Zerotorescue@62 1698 addon.db.profile.defaults.itemCountAddon = v;
Zerotorescue@62 1699
Zerotorescue@62 1700 if addon.supportedAddons.itemCount[v].OnSelect then
Zerotorescue@62 1701 addon.supportedAddons.itemCount[v].OnSelect();
Zerotorescue@62 1702 end
Zerotorescue@62 1703 end,
Zerotorescue@62 1704 },
Zerotorescue@62 1705 craftingAddon = {
Zerotorescue@62 1706 order = 30,
Zerotorescue@62 1707 type = "select",
Zerotorescue@62 1708 name = "Prefered crafting addon",
Zerotorescue@62 1709 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 1710 values = function()
Zerotorescue@62 1711 local temp = {};
Zerotorescue@62 1712 for name, value in pairs(addon.supportedAddons.crafting) do
Zerotorescue@62 1713 temp[name] = name;
Zerotorescue@62 1714 end
Zerotorescue@62 1715
Zerotorescue@62 1716 return temp;
Zerotorescue@62 1717 end,
Zerotorescue@62 1718 get = function() return addon.db.profile.defaults.craftingAddon; end,
Zerotorescue@62 1719 set = function(i, v)
Zerotorescue@62 1720 addon.db.profile.defaults.craftingAddon = v;
Zerotorescue@62 1721
Zerotorescue@62 1722 if addon.supportedAddons.crafting[v].OnSelect then
Zerotorescue@62 1723 addon.supportedAddons.crafting[v].OnSelect();
Zerotorescue@62 1724 end
Zerotorescue@62 1725 end,
Zerotorescue@62 1726 },
Zerotorescue@157 1727 guildSelection = {
Zerotorescue@157 1728 order = 40,
Zerotorescue@157 1729 type = "multiselect",
Zerotorescue@157 1730 name = "Include guild bank data",
Zerotorescue@157 1731 desc = "Select which guild data should be included in the item counts.",
Zerotorescue@157 1732 values = function()
Zerotorescue@157 1733 local temp = {};
Zerotorescue@157 1734
Zerotorescue@157 1735 local currentAddon, selectedAddonName = addon:GetItemCountAddon(groupName);
Zerotorescue@157 1736
Zerotorescue@157 1737 if currentAddon.GetGuildNames then
Zerotorescue@157 1738 local guilds = currentAddon.GetGuildNames();
Zerotorescue@157 1739
Zerotorescue@157 1740 if guilds and type(guilds) == "table" then
Zerotorescue@157 1741 for guildName, state in pairs(guilds) do
Zerotorescue@157 1742 temp[guildName] = guildName;
Zerotorescue@157 1743
Zerotorescue@157 1744 if addon.db.profile.defaults.itemCountGuildsExcluded[guildName] then
Zerotorescue@157 1745 currentAddon.SetGuildState(guildName, false);
Zerotorescue@157 1746 else
Zerotorescue@157 1747 currentAddon.SetGuildState(guildName, true);
Zerotorescue@157 1748 end
Zerotorescue@157 1749 end
Zerotorescue@157 1750 end
Zerotorescue@157 1751 end
Zerotorescue@157 1752
Zerotorescue@157 1753 return temp;
Zerotorescue@157 1754 end,
Zerotorescue@157 1755 get = function(i, v)
Zerotorescue@157 1756 local currentAddon, selectedAddonName = addon:GetItemCountAddon(groupName);
Zerotorescue@157 1757
Zerotorescue@157 1758 return currentAddon.GetGuildNames and currentAddon.GetGuildNames()[v];
Zerotorescue@157 1759 end,
Zerotorescue@157 1760 set = function(i, v, e)
Zerotorescue@157 1761 local currentAddon, selectedAddonName = addon:GetItemCountAddon(groupName);
Zerotorescue@157 1762
Zerotorescue@157 1763 if e then
Zerotorescue@157 1764 -- Guild is enabled, so not excluded
Zerotorescue@157 1765 addon.db.profile.defaults.itemCountGuildsExcluded[v] = nil;
Zerotorescue@157 1766 else
Zerotorescue@157 1767 addon.db.profile.defaults.itemCountGuildsExcluded[v] = true; -- this is excluded, excluded is indicated by true
Zerotorescue@157 1768 end
Zerotorescue@157 1769
Zerotorescue@157 1770 if currentAddon.SetGuildState then
Zerotorescue@157 1771 currentAddon.SetGuildState(v, e);
Zerotorescue@157 1772 end
Zerotorescue@157 1773 end, -- can't be nil or the defaults will be used
Zerotorescue@157 1774 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 1775 },
Zerotorescue@62 1776 },
Zerotorescue@62 1777 },
Zerotorescue@106 1778 },
Zerotorescue@106 1779 };
Zerotorescue@106 1780 end
Zerotorescue@106 1781
Zerotorescue@106 1782 function mod:FillExtraOptions()
Zerotorescue@152 1783 local selectedExportGroups = {};
Zerotorescue@106 1784 options.args.extra = {
Zerotorescue@106 1785 order = 300,
Zerotorescue@106 1786 type = "group",
Zerotorescue@106 1787 name = "Extra",
Zerotorescue@106 1788 desc = "Change additional (but completely optional) settings.",
Zerotorescue@106 1789 args = {
Zerotorescue@106 1790 misc = {
Zerotorescue@106 1791 order = 10,
Zerotorescue@62 1792 type = "group",
Zerotorescue@62 1793 inline = true,
Zerotorescue@106 1794 name = "Miscellaneous",
Zerotorescue@62 1795 args = {
Zerotorescue@106 1796 hideHelp = {
Zerotorescue@106 1797 order = 10,
Zerotorescue@106 1798 type = "toggle",
Zerotorescue@106 1799 width = "full",
Zerotorescue@106 1800 name = "Hide any help tooltips, descriptions and the help config category",
Zerotorescue@106 1801 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 1802 get = function() return addon.db.profile.defaults.hideHelp; end,
Zerotorescue@106 1803 set = function(i, v) addon.db.profile.defaults.hideHelp = v; end,
Zerotorescue@62 1804 },
Zerotorescue@106 1805 autoRefillSkipConfirm = {
Zerotorescue@62 1806 order = 20,
Zerotorescue@106 1807 type = "toggle",
Zerotorescue@106 1808 width = "full",
Zerotorescue@131 1809 name = "Skip the confirmation window for storage refilling",
Zerotorescue@131 1810 desc = "Automatically start moving items from the storage (bank, guild bank or mailbox) without showing the confirmation window.",
Zerotorescue@106 1811 get = function() return addon.db.profile.defaults.autoRefillSkipConfirm; end,
Zerotorescue@106 1812 set = function(i, v) addon.db.profile.defaults.autoRefillSkipConfirm = v; end,
Zerotorescue@76 1813 },
Zerotorescue@76 1814 removeCharacter = {
Zerotorescue@106 1815 order = 30,
Zerotorescue@76 1816 type = "select",
Zerotorescue@106 1817 width = "double",
Zerotorescue@106 1818 name = "Remove a character from Inventorium's memory",
Zerotorescue@76 1819 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 1820 values = function()
Zerotorescue@76 1821 local temp = {};
Zerotorescue@76 1822
Zerotorescue@76 1823 temp[""] = "";
Zerotorescue@76 1824
Zerotorescue@76 1825 local playerName = UnitName("player");
Zerotorescue@76 1826 for charName in pairs(addon.db.factionrealm.characters) do
Zerotorescue@76 1827 if playerName ~= charName then
Zerotorescue@76 1828 temp[charName] = charName;
Zerotorescue@76 1829 end
Zerotorescue@76 1830 end
Zerotorescue@76 1831
Zerotorescue@76 1832 return temp;
Zerotorescue@76 1833 end,
Zerotorescue@76 1834 set = function(i, value)
Zerotorescue@76 1835 if value and value ~= "" then
Zerotorescue@76 1836 addon.db.factionrealm.characters[value] = nil;
Zerotorescue@76 1837 addon.db.profile.defaults.trackAtCharacters[value] = nil;
Zerotorescue@76 1838 for name, values in pairs(addon.db.profile.groups) do
Zerotorescue@76 1839 if values.trackAtCharacters then
Zerotorescue@76 1840 values.trackAtCharacters[name] = nil;
Zerotorescue@76 1841 end
Zerotorescue@76 1842 end
Zerotorescue@76 1843 end
Zerotorescue@76 1844 end,
Zerotorescue@76 1845 },
Zerotorescue@76 1846 },
Zerotorescue@76 1847 },
Zerotorescue@152 1848 export = {
Zerotorescue@156 1849 order = 20,
Zerotorescue@152 1850 type = "group",
Zerotorescue@152 1851 inline = true,
Zerotorescue@152 1852 name = "Export groups",
Zerotorescue@152 1853 args = {
Zerotorescue@152 1854 localItemData = {
Zerotorescue@152 1855 order = 0,
Zerotorescue@152 1856 type = "multiselect",
Zerotorescue@152 1857 name = "Select groups",
Zerotorescue@152 1858 desc = "Select which groups should be included in the export.",
Zerotorescue@152 1859 values = function()
Zerotorescue@152 1860 local temp = {};
Zerotorescue@152 1861
Zerotorescue@152 1862 if addon.db.profile.groups then
Zerotorescue@152 1863 temp["*InverseAll"] = "Inverse";
Zerotorescue@152 1864
Zerotorescue@152 1865 for groupName, _ in pairs(addon.db.profile.groups) do
Zerotorescue@152 1866 temp[groupName] = groupName;
Zerotorescue@152 1867 end
Zerotorescue@152 1868 end
Zerotorescue@152 1869
Zerotorescue@152 1870 return temp;
Zerotorescue@152 1871 end,
Zerotorescue@152 1872 get = function(info, value)
Zerotorescue@152 1873 --local groupName = groupIdToName[info[2]];
Zerotorescue@152 1874 --local optionName = info[#info];
Zerotorescue@152 1875
Zerotorescue@152 1876 return selectedExportGroups[value];
Zerotorescue@152 1877 end,
Zerotorescue@152 1878 set = function(info, name, value)
Zerotorescue@152 1879 --local groupName = groupIdToName[info[2]];
Zerotorescue@152 1880 --local optionName = info[#info];
Zerotorescue@152 1881
Zerotorescue@152 1882 if name == "*InverseAll" then
Zerotorescue@152 1883 for groupName, _ in pairs(addon.db.profile.groups) do
Zerotorescue@152 1884 if selectedExportGroups[groupName] then
Zerotorescue@152 1885 selectedExportGroups[groupName] = nil;
Zerotorescue@152 1886 else
Zerotorescue@152 1887 selectedExportGroups[groupName] = true;
Zerotorescue@152 1888 end
Zerotorescue@152 1889 end
Zerotorescue@152 1890 else
Zerotorescue@152 1891 if selectedExportGroups[name] then
Zerotorescue@152 1892 selectedExportGroups[name] = nil;
Zerotorescue@152 1893 else
Zerotorescue@152 1894 selectedExportGroups[name] = true;
Zerotorescue@152 1895 end
Zerotorescue@152 1896 end
Zerotorescue@152 1897 end,
Zerotorescue@152 1898 },
Zerotorescue@152 1899 input = {
Zerotorescue@152 1900 order = 10,
Zerotorescue@152 1901 type = "input",
Zerotorescue@152 1902 multiline = true,
Zerotorescue@152 1903 width = "full",
Zerotorescue@152 1904 name = "Exported data",
Zerotorescue@152 1905 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 1906 set = false,
Zerotorescue@152 1907 get = function(info)
Zerotorescue@152 1908 local result = "";
Zerotorescue@152 1909 for groupName, v in pairs(selectedExportGroups) do
Zerotorescue@152 1910 if v then
Zerotorescue@152 1911 result = result .. mod:ExportGroup(groupName) .. "\n";
Zerotorescue@152 1912 end
Zerotorescue@152 1913 end
Zerotorescue@152 1914
Zerotorescue@152 1915 return result;
Zerotorescue@152 1916 end,
Zerotorescue@152 1917 },
Zerotorescue@152 1918 },
Zerotorescue@152 1919 },
Zerotorescue@106 1920 colorCodes = {
Zerotorescue@106 1921 order = 30,
Zerotorescue@106 1922 type = "group",
Zerotorescue@106 1923 inline = true,
Zerotorescue@106 1924 name = "Color codes",
Zerotorescue@106 1925 args = {
Zerotorescue@106 1926 description = {
Zerotorescue@106 1927 order = 0,
Zerotorescue@106 1928 type = "description",
Zerotorescue@106 1929 name = "Change the color code thresholds based on the current stock remaining of the required minimum stock.",
Zerotorescue@106 1930 hidden = function() return addon.db.profile.defaults.hideHelp; end,
Zerotorescue@106 1931 },
Zerotorescue@106 1932 header = {
Zerotorescue@106 1933 order = 5,
Zerotorescue@106 1934 type = "header",
Zerotorescue@106 1935 name = "",
Zerotorescue@106 1936 hidden = function() return addon.db.profile.defaults.hideHelp; end,
Zerotorescue@106 1937 },
Zerotorescue@106 1938 green = {
Zerotorescue@106 1939 order = 10,
Zerotorescue@106 1940 type = "range",
Zerotorescue@106 1941 min = 0,
Zerotorescue@106 1942 max = 1,
Zerotorescue@106 1943 step = 0.01,
Zerotorescue@106 1944 isPercent = true,
Zerotorescue@106 1945 name = "|cff00ff00Green|r",
Zerotorescue@106 1946 desc = "Show quantity in green when at least this much of the minimum stock is available.",
Zerotorescue@106 1947 get = function() return addon.db.profile.defaults.colors.green; end,
Zerotorescue@106 1948 set = function(i, v) addon.db.profile.defaults.colors.green = v; end,
Zerotorescue@106 1949 },
Zerotorescue@106 1950 yellow = {
Zerotorescue@106 1951 order = 20,
Zerotorescue@106 1952 type = "range",
Zerotorescue@106 1953 min = 0,
Zerotorescue@106 1954 max = 1,
Zerotorescue@106 1955 step = 0.01,
Zerotorescue@106 1956 isPercent = true,
Zerotorescue@106 1957 name = "|cffffff00Yellow|r",
Zerotorescue@106 1958 desc = "Show quantity in yellow when at least this much of the minimum stock is available.",
Zerotorescue@106 1959 get = function() return addon.db.profile.defaults.colors.yellow; end,
Zerotorescue@106 1960 set = function(i, v) addon.db.profile.defaults.colors.yellow = v; end,
Zerotorescue@106 1961 },
Zerotorescue@106 1962 orange = {
Zerotorescue@106 1963 order = 30,
Zerotorescue@106 1964 type = "range",
Zerotorescue@106 1965 min = 0,
Zerotorescue@106 1966 max = 1,
Zerotorescue@106 1967 step = 0.01,
Zerotorescue@106 1968 isPercent = true,
Zerotorescue@106 1969 name = "|cffff9933Orange|r",
Zerotorescue@106 1970 desc = "Show quantity in orange when at least this much of the minimum stock is available.",
Zerotorescue@106 1971 get = function() return addon.db.profile.defaults.colors.orange; end,
Zerotorescue@106 1972 set = function(i, v) addon.db.profile.defaults.colors.orange = v; end,
Zerotorescue@106 1973 },
Zerotorescue@106 1974 red = {
Zerotorescue@106 1975 order = 40,
Zerotorescue@106 1976 type = "range",
Zerotorescue@106 1977 min = 0,
Zerotorescue@106 1978 max = 1,
Zerotorescue@106 1979 step = 0.01,
Zerotorescue@106 1980 isPercent = true,
Zerotorescue@106 1981 name = "|cffff0000Red|r",
Zerotorescue@106 1982 desc = "Show quantity in red when at least this much of the minimum stock is available.",
Zerotorescue@106 1983 get = function() return addon.db.profile.defaults.colors.red; end,
Zerotorescue@106 1984 set = function(i, v) addon.db.profile.defaults.colors.red = v; end,
Zerotorescue@106 1985 },
Zerotorescue@106 1986 },
Zerotorescue@106 1987 },
Zerotorescue@62 1988 },
Zerotorescue@62 1989 };
Zerotorescue@62 1990 end
Zerotorescue@62 1991
Zerotorescue@62 1992 function mod:FillHelpOptions()
Zerotorescue@62 1993 options.args.help = {
Zerotorescue@62 1994 order = 150,
Zerotorescue@62 1995 type = "group",
Zerotorescue@106 1996 hidden = function() return addon.db.profile.defaults.hideHelp; end,
Zerotorescue@62 1997 childGroups = "tab",
Zerotorescue@62 1998 name = "Help",
Zerotorescue@62 1999 desc = "Useful information for if you're unfamiliar with a part of the addon.",
Zerotorescue@62 2000 args = {
Zerotorescue@62 2001 general = {
Zerotorescue@62 2002 order = 1,
Zerotorescue@62 2003 type = "group",
Zerotorescue@62 2004 name = "General",
Zerotorescue@62 2005 args = {
Zerotorescue@62 2006 description = {
Zerotorescue@62 2007 order = 0,
Zerotorescue@62 2008 type = "description",
Zerotorescue@62 2009 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 2010 "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 2011 "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 2012 "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 2013 "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 2014 },
Zerotorescue@62 2015 },
Zerotorescue@62 2016 },
Zerotorescue@62 2017 manual = {
Zerotorescue@62 2018 order = 2,
Zerotorescue@62 2019 type = "group",
Zerotorescue@62 2020 name = "Manual",
Zerotorescue@62 2021 args = {
Zerotorescue@62 2022 intro = {
Zerotorescue@62 2023 order = 1,
Zerotorescue@62 2024 type = "group",
Zerotorescue@62 2025 inline = true,
Zerotorescue@62 2026 name = "Intro",
Zerotorescue@62 2027 args = {
Zerotorescue@62 2028 description = {
Zerotorescue@62 2029 order = 0,
Zerotorescue@62 2030 type = "description",
Zerotorescue@62 2031 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 2032 },
Zerotorescue@62 2033 },
Zerotorescue@62 2034 },
Zerotorescue@62 2035 Overview = {
Zerotorescue@62 2036 order = 2,
Zerotorescue@62 2037 type = "group",
Zerotorescue@62 2038 inline = true,
Zerotorescue@62 2039 name = "Overview",
Zerotorescue@62 2040 args = {
Zerotorescue@62 2041 description = {
Zerotorescue@62 2042 order = 0,
Zerotorescue@62 2043 type = "description",
Zerotorescue@62 2044 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 2045
Zerotorescue@62 2046 "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 2047 "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 2048 },
Zerotorescue@62 2049 },
Zerotorescue@62 2050 },
Zerotorescue@62 2051 Groups = {
Zerotorescue@62 2052 order = 3,
Zerotorescue@62 2053 type = "group",
Zerotorescue@62 2054 inline = true,
Zerotorescue@62 2055 name = "Groups",
Zerotorescue@62 2056 args = {
Zerotorescue@62 2057 description = {
Zerotorescue@62 2058 order = 0,
Zerotorescue@62 2059 type = "description",
Zerotorescue@62 2060 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 2061 },
Zerotorescue@62 2062 },
Zerotorescue@62 2063 },
Zerotorescue@62 2064 Queueing = {
Zerotorescue@62 2065 order = 4,
Zerotorescue@62 2066 type = "group",
Zerotorescue@62 2067 inline = true,
Zerotorescue@62 2068 name = "Queueing",
Zerotorescue@62 2069 args = {
Zerotorescue@62 2070 description = {
Zerotorescue@62 2071 order = 0,
Zerotorescue@62 2072 type = "description",
Zerotorescue@62 2073 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 2074
Zerotorescue@62 2075 "The queueing can be done into most popular crafting profession window replacing addons. This includes |cfffed000AdvancedTradeSkillWindow|r, |cfffed000GnomeWorks|r and |cfffed000Skillet|r.",
Zerotorescue@62 2076 },
Zerotorescue@62 2077 },
Zerotorescue@62 2078 },
Zerotorescue@62 2079 Configuring = {
Zerotorescue@62 2080 order = 5,
Zerotorescue@62 2081 type = "group",
Zerotorescue@62 2082 inline = true,
Zerotorescue@62 2083 name = "Configuring",
Zerotorescue@62 2084 args = {
Zerotorescue@62 2085 description = {
Zerotorescue@62 2086 order = 0,
Zerotorescue@62 2087 type = "description",
Zerotorescue@62 2088 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 2089
Zerotorescue@62 2090 "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 2091
Zerotorescue@62 2092 "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 2093
Zerotorescue@62 2094 "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 2095
Zerotorescue@62 2096 "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 2097
Zerotorescue@62 2098 "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 2099 },
Zerotorescue@62 2100 },
Zerotorescue@62 2101 },
Zerotorescue@62 2102 VirtualGroups = {
Zerotorescue@62 2103 order = 6,
Zerotorescue@62 2104 type = "group",
Zerotorescue@62 2105 inline = true,
Zerotorescue@62 2106 name = "Virtual groups",
Zerotorescue@62 2107 args = {
Zerotorescue@62 2108 description = {
Zerotorescue@62 2109 order = 0,
Zerotorescue@62 2110 type = "description",
Zerotorescue@62 2111 name = "|cffccccccThis is advanced optional functionality. I recommend skipping this paragraph if you are new to Inventorium.|r\n\n" ..
Zerotorescue@62 2112
Zerotorescue@62 2113 "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 2114 },
Zerotorescue@62 2115 },
Zerotorescue@62 2116 },
Zerotorescue@62 2117 },
Zerotorescue@62 2118 },
Zerotorescue@62 2119 FAQ = {
Zerotorescue@62 2120 order = 3,
Zerotorescue@62 2121 type = "group",
Zerotorescue@62 2122 name = "FAQ",
Zerotorescue@62 2123 args = {
Zerotorescue@62 2124 description = {
Zerotorescue@62 2125 order = 0,
Zerotorescue@62 2126 type = "description",
Zerotorescue@62 2127 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 2128 "|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 2129 "|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 2130 "|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 2131 "|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 2132 "|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 2133 "",
Zerotorescue@62 2134 },
Zerotorescue@62 2135 },
Zerotorescue@62 2136 },
Zerotorescue@62 2137 },
Zerotorescue@62 2138 };
Zerotorescue@62 2139 end
Zerotorescue@62 2140
Zerotorescue@62 2141 function mod:MakeGroupOptions()
Zerotorescue@62 2142 options.args.groups = {
Zerotorescue@62 2143 order = 1100,
Zerotorescue@62 2144 type = "group",
Zerotorescue@62 2145 name = "Groups",
Zerotorescue@62 2146 desc = "Change a group.",
Zerotorescue@62 2147 args = {
Zerotorescue@62 2148 create = {
Zerotorescue@62 2149 order = 10,
Zerotorescue@62 2150 type = "group",
Zerotorescue@62 2151 inline = true,
Zerotorescue@62 2152 name = "Create a brand new group",
Zerotorescue@62 2153 args = {
Zerotorescue@62 2154 name = {
Zerotorescue@62 2155 order = 10,
Zerotorescue@62 2156 type = "input",
Zerotorescue@62 2157 name = "Group name",
Zerotorescue@62 2158 desc = "The name of the group. You can also use item links as you wish.",
Zerotorescue@62 2159 validate = ValidateGroupName,
Zerotorescue@62 2160 set = function(_, value)
Zerotorescue@62 2161 addon.db.profile.groups[value] = {};
Zerotorescue@62 2162 if currentGroupType == "Virtual" then
Zerotorescue@62 2163 addon.db.profile.groups[value].isVirtual = true;
Zerotorescue@62 2164 end
Zerotorescue@62 2165
Zerotorescue@62 2166 mod:FillGroupOptions();
Zerotorescue@62 2167 end,
Zerotorescue@62 2168 get = false,
Zerotorescue@62 2169 width = "double",
Zerotorescue@62 2170 },
Zerotorescue@62 2171 type = {
Zerotorescue@62 2172 order = 20,
Zerotorescue@62 2173 type = "select",
Zerotorescue@62 2174 name = "Type (advanced)",
Zerotorescue@62 2175 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 2176 values = {
Zerotorescue@62 2177 ["Normal"] = "Normal",
Zerotorescue@62 2178 ["Virtual"] = "Virtual",
Zerotorescue@62 2179 },
Zerotorescue@62 2180 set = function(_, value) currentGroupType = value; end,
Zerotorescue@62 2181 get = function() return currentGroupType; end,
Zerotorescue@62 2182 },
Zerotorescue@62 2183 },
Zerotorescue@62 2184 },
Zerotorescue@62 2185 import = {
Zerotorescue@62 2186 order = 20,
Zerotorescue@62 2187 type = "group",
Zerotorescue@62 2188 inline = true,
Zerotorescue@62 2189 name = "Import a group",
Zerotorescue@62 2190 args = {
Zerotorescue@62 2191 input = {
Zerotorescue@62 2192 order = 10,
Zerotorescue@62 2193 type = "input",
Zerotorescue@62 2194 multiline = true,
Zerotorescue@62 2195 name = "Group data",
Zerotorescue@62 2196 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 2197 set = function(info, value)
Zerotorescue@62 2198 local data = { string.split("\n", value or "") };
Zerotorescue@62 2199
Zerotorescue@62 2200 for _, current in pairs(data) do
Zerotorescue@152 2201 if current and string.trim(current) ~= "" then
Zerotorescue@152 2202 if not AceSerializer then
Zerotorescue@152 2203 AceSerializer = LibStub("AceSerializer-3.0");
Zerotorescue@152 2204 end
Zerotorescue@62 2205
Zerotorescue@152 2206 local result, temp = AceSerializer:Deserialize(current);
Zerotorescue@152 2207
Zerotorescue@152 2208 if not temp.name then
Zerotorescue@152 2209 addon:Print("The provided data is not supported.", addon.Colors.Red);
Zerotorescue@152 2210 elseif ValidateGroupName(nil, temp.name) ~= true then
Zerotorescue@152 2211 addon:Print(("Aborting: A group named \"%s\" already exists."):format(temp.name), addon.Colors.Red);
Zerotorescue@152 2212 else
Zerotorescue@152 2213 local name = temp.name;
Zerotorescue@152 2214 temp.name = nil;
Zerotorescue@152 2215 addon:Print(("Importing %s..."):format(name));
Zerotorescue@152 2216
Zerotorescue@152 2217 if temp.items then
Zerotorescue@152 2218 -- Remove items that are already in another group
Zerotorescue@152 2219 for value, count in pairs(temp.items) do
Zerotorescue@152 2220 local itemId = tonumber(value);
Zerotorescue@152 2221
Zerotorescue@152 2222 local itemData = addon.ItemData:New(itemId);
Zerotorescue@152 2223
Zerotorescue@152 2224 if not itemId then
Zerotorescue@152 2225 addon:Print(("\"%s\" is not a number."):format(value), addon.Colors.Red);
Zerotorescue@152 2226 temp.items[value] = nil;
Zerotorescue@152 2227 elseif itemData:InGroup() then
Zerotorescue@152 2228 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 2229 temp.items[value] = nil;
Zerotorescue@152 2230 else
Zerotorescue@152 2231 -- Ensure the keys are numeric
Zerotorescue@152 2232 temp.items[value] = nil;
Zerotorescue@152 2233 temp.items[itemId] = tonumber(count) or 0;
Zerotorescue@152 2234 end
Zerotorescue@62 2235 end
Zerotorescue@62 2236 end
Zerotorescue@152 2237
Zerotorescue@152 2238 -- 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 2239 temp.trackAtCharacters = nil;
Zerotorescue@152 2240 temp.overrideTrackAtCharacters = nil;
Zerotorescue@152 2241
Zerotorescue@152 2242 addon.db.profile.groups[name] = temp;
Zerotorescue@62 2243 end
Zerotorescue@62 2244 end
Zerotorescue@62 2245 end
Zerotorescue@62 2246
Zerotorescue@62 2247 self:FillGroupOptions();
Zerotorescue@62 2248 end,
Zerotorescue@62 2249 get = false,
Zerotorescue@62 2250 width = "full",
Zerotorescue@62 2251 },
Zerotorescue@62 2252 },
Zerotorescue@62 2253 },
Zerotorescue@62 2254 },
Zerotorescue@62 2255 };
Zerotorescue@62 2256 end
Zerotorescue@62 2257
Zerotorescue@62 2258 function mod:FillGroupOptions()
Zerotorescue@62 2259 for id, name in pairs(groupIdToName) do
Zerotorescue@62 2260 if type(name) == "string" and not addon.db.profile.groups[name] then
Zerotorescue@62 2261 options.args.groups.args[id] = nil;
Zerotorescue@62 2262 groupIdToName[id] = nil;
Zerotorescue@62 2263 groupIdToName[name] = nil;
Zerotorescue@62 2264 groupIsVirtual[id] = nil;
Zerotorescue@62 2265 end
Zerotorescue@62 2266 end
Zerotorescue@62 2267
Zerotorescue@62 2268 for name, values in pairs(addon.db.profile.groups) do
Zerotorescue@62 2269 if not groupIdToName[name] then
Zerotorescue@62 2270 options.args.groups.args[tostring(count)] = defaultGroup;
Zerotorescue@62 2271
Zerotorescue@62 2272 groupIdToName[tostring(count)] = name;
Zerotorescue@62 2273 groupIdToName[name] = true;
Zerotorescue@62 2274 if values.isVirtual then
Zerotorescue@62 2275 groupIsVirtual[tostring(count)] = true;
Zerotorescue@62 2276 end
Zerotorescue@62 2277
Zerotorescue@62 2278 count = ( count + 1 );
Zerotorescue@62 2279 end
Zerotorescue@62 2280 end
Zerotorescue@62 2281 end
Zerotorescue@65 2282
Zerotorescue@65 2283
Zerotorescue@65 2284
Zerotorescue@65 2285
Zerotorescue@65 2286
Zerotorescue@65 2287
Zerotorescue@65 2288 -- Verify premade groups
Zerotorescue@65 2289
Zerotorescue@65 2290 function mod:PremadeGroupsCheck(updateGroupName, updateKey, accept)
Zerotorescue@65 2291 -- Compare the current premade groups with those used, notify about changes
Zerotorescue@65 2292 if addon.defaultGroups then
Zerotorescue@65 2293 for premadeGroupName, groupInfo in pairs(addon.defaultGroups) do
Zerotorescue@65 2294 -- Go through all default groups
Zerotorescue@65 2295
Zerotorescue@65 2296 for groupName, values in pairs(addon.db.profile.groups) do
Zerotorescue@65 2297 -- Go through all groups to find those with this premade group
Zerotorescue@65 2298
Zerotorescue@65 2299 if values.premadeGroups and values.premadeGroups[premadeGroupName] and values.premadeGroups[premadeGroupName] < groupInfo.version then
Zerotorescue@65 2300 -- Outdated group
Zerotorescue@65 2301
Zerotorescue@65 2302 if updateGroupName and updateKey then
Zerotorescue@65 2303 -- This function was called after pressing yes or no in a confirm box
Zerotorescue@65 2304
Zerotorescue@65 2305 if accept then
Zerotorescue@65 2306 -- Yes was clicked
Zerotorescue@65 2307
Zerotorescue@65 2308 for itemId, version in pairs(groupInfo.items) do
Zerotorescue@65 2309 -- Go through all items in this premade group
Zerotorescue@65 2310
Zerotorescue@76 2311 local itemData = addon.ItemData:New(itemId);
Zerotorescue@76 2312
Zerotorescue@65 2313 if version > values.premadeGroups[premadeGroupName] then
Zerotorescue@65 2314 -- This item was added in a more recent version than this group: Add item
Zerotorescue@65 2315
Zerotorescue@76 2316 if itemData:InGroup() then
Zerotorescue@98 2317 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 2318 elseif itemData:AddToGroup(groupName) then
Zerotorescue@98 2319 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 2320 end
Zerotorescue@65 2321 elseif ( version * -1 ) > values.premadeGroups[premadeGroupName] then
Zerotorescue@76 2322 if itemData:InGroup() == groupName then
Zerotorescue@76 2323 itemData:RemoveFromGroup(groupName);
Zerotorescue@76 2324
Zerotorescue@98 2325 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 2326 else
Zerotorescue@98 2327 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 2328 end
Zerotorescue@65 2329 end
Zerotorescue@65 2330 end
Zerotorescue@65 2331
Zerotorescue@76 2332 if AceConfigRegistry then
Zerotorescue@76 2333 -- Now rebuild the list
Zerotorescue@76 2334 AceConfigRegistry:NotifyChange("InventoriumOptions");
Zerotorescue@76 2335 end
Zerotorescue@76 2336
Zerotorescue@65 2337 -- Remember the new version
Zerotorescue@65 2338 values.premadeGroups[premadeGroupName] = groupInfo.version;
Zerotorescue@65 2339 else
Zerotorescue@65 2340 -- No was clicked
Zerotorescue@65 2341
Zerotorescue@65 2342 -- Let user know what was not added
Zerotorescue@65 2343 for itemId, version in pairs(groupInfo.items) do
Zerotorescue@65 2344 -- Go through all items in this premade group
Zerotorescue@65 2345
Zerotorescue@76 2346 local itemData = addon.ItemData:New(itemId);
Zerotorescue@76 2347
Zerotorescue@65 2348 if version > values.premadeGroups[premadeGroupName] then
Zerotorescue@65 2349 -- This item was added in a more recent version than this group: don't add (since we clicked no), but announce it
Zerotorescue@65 2350
Zerotorescue@98 2351 addon:Print(("Skipping %s found in the premade group |cfffed000%s|r."):format( (itemData.link or unknownItemName:format(itemId)), itemData:InGroup() ));
Zerotorescue@65 2352 end
Zerotorescue@65 2353 end
Zerotorescue@65 2354
Zerotorescue@65 2355 -- Remember the new version
Zerotorescue@65 2356 values.premadeGroups[premadeGroupName] = groupInfo.version;
Zerotorescue@65 2357 end
Zerotorescue@65 2358 else
Zerotorescue@65 2359 StaticPopupDialogs["InventoriumConfirmUpdatePremadeGroup"] = {
Zerotorescue@65 2360 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 2361 button1 = YES,
Zerotorescue@65 2362 button2 = NO,
Zerotorescue@65 2363 OnAccept = function()
Zerotorescue@131 2364 mod:PremadeGroupsCheck(groupName, premadeGroupName, true);
Zerotorescue@65 2365 end,
Zerotorescue@65 2366 OnCancel = function(_, _, reason)
Zerotorescue@65 2367 if reason == "clicked" then
Zerotorescue@131 2368 mod:PremadeGroupsCheck(groupName, premadeGroupName, false);
Zerotorescue@65 2369 end
Zerotorescue@65 2370 end,
Zerotorescue@65 2371 timeout = 0,
Zerotorescue@65 2372 whileDead = 1,
Zerotorescue@65 2373 hideOnEscape = 1,
Zerotorescue@65 2374 };
Zerotorescue@65 2375 StaticPopup_Show("InventoriumConfirmUpdatePremadeGroup", premadeGroupName, groupName);
Zerotorescue@65 2376
Zerotorescue@65 2377 return;
Zerotorescue@65 2378 end
Zerotorescue@65 2379 end
Zerotorescue@65 2380 end
Zerotorescue@65 2381 end
Zerotorescue@65 2382 end
Zerotorescue@65 2383 end