annotate Modules/Config.lua @ 189:90e5911a2ff1

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