annotate Core.lua @ 14:0fc8a54516d7

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