annotate Modules/Config.lua @ 181:dd0e7e00bb9d

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