# HG changeset patch # User Zerotorescue # Date 1290270256 -3600 # Node ID 58fb38f0b4470a271063912c1967d1fec1d54aee # Parent 31e5da6a2b16d0cc89362177a0a7d2596babfb6c The list of possible commands when you write /im without any arguement will now include commands inserted by modules with their own descriptions. Clicking a command in this list will now execute it. The slash command handler function is now a global so you can invoke these through other methods. Added an optional event function to registering auction pricing addons, when defined this will be executed when the pricing addon gets selected. Removed the unused ?Override local item data? option. Added ?AuctionProfitMaster? and ?ZeroAuctions? pricing support. The pricing info displayed in the summary window will be used for this. Trying to queue without any items in the summary should no longer give an error. diff -r 31e5da6a2b16 -r 58fb38f0b447 .pkgmeta --- a/.pkgmeta Wed Nov 03 19:38:53 2010 +0100 +++ b/.pkgmeta Sat Nov 20 17:24:16 2010 +0100 @@ -41,6 +41,9 @@ Libs/LibStub: url: svn://svn.wowace.com/wow/libstub/mainline/trunk tag: latest + Libs/ChatHyperlinks: + url: http://hg.curseforge.net/wow/chathyperlinks/mainline + tag: latest enable-nolib-creation: no diff -r 31e5da6a2b16 -r 58fb38f0b447 AuctionAddons/AuctionProfitMaster.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AuctionAddons/AuctionProfitMaster.lua Sat Nov 20 17:24:16 2010 +0100 @@ -0,0 +1,28 @@ +do + + local APM; + + local function GetValue(link) + return (APM and APM:GetModule("Scan"):GetLowestAuction(APM:GetSafeLink(link))) or -1; + end + + local function IsEnabled() + local isEnabled = (select(6, GetAddOnInfo("AuctionProfitMaster")) == nil); + + if isEnabled then + APM = LibStub("AceAddon-3.0"):GetAddon("AuctionProfitMaster"); + end + + return isEnabled and APM; + end + + local function OnSelect() + local addonName = "|r|cfffed000AuctionProfitMaster|r|cffff6600"; + + print("|cffff6600Using " .. addonName .. " as pricing addon is not recommended. Items at the auction house above the \"ignore stacks over\" will always be ignored (and thus not affect the displayed price) and if you are the only one posting, " .. addonName .. " will act as if there are no auctions up.|r"); + end + + IMRegisterPricingAddon("AuctionProfitMaster", GetValue, IsEnabled, OnSelect); + +end + diff -r 31e5da6a2b16 -r 58fb38f0b447 AuctionAddons/ZeroAuctions.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AuctionAddons/ZeroAuctions.lua Sat Nov 20 17:24:16 2010 +0100 @@ -0,0 +1,28 @@ +do + + local ZA; + + local function GetValue(link) + return (ZA and ZA:GetModule("Scan"):GetLowestAuction(ZA:GetSafeLink(link))) or -1; + end + + local function IsEnabled() + local isEnabled = (select(6, GetAddOnInfo("ZeroAuctions")) == nil); + + if isEnabled then + ZA = LibStub("AceAddon-3.0"):GetAddon("ZeroAuctions"); + end + + return isEnabled and ZA; + end + + local function OnSelect() + local addonName = "|r|cfffed000ZeroAuctions|r|cffff6600"; + + print("|cffff6600Using " .. addonName .. " as pricing addon is not recommended. Items at the auction house above the \"ignore stacks over\" will always be ignored (and thus not affect the displayed price) and if you are the only one posting, " .. addonName .. " will act as if there are no auctions up.|r"); + end + + IMRegisterPricingAddon("ZeroAuctions", GetValue, IsEnabled, OnSelect); + +end + diff -r 31e5da6a2b16 -r 58fb38f0b447 Core.lua --- a/Core.lua Wed Nov 03 19:38:53 2010 +0100 +++ b/Core.lua Sat Nov 20 17:24:16 2010 +0100 @@ -69,10 +69,44 @@ -- Register our own slash commands SLASH_INVENTORIUM1 = "/inventorium"; SLASH_INVENTORIUM2 = "/im"; - SlashCmdList["INVENTORIUM"] = function(msg) - self:CommandHandler(msg); - end + SlashCmdList["INVENTORIUM"] = InventoriumCommandHandler; + -- Config command handling + self:RegisterSlash(function(this) + -- We don't want any other windows open at this time. + for name, module in this:IterateModules() do + if module.CloseFrame then + module:CloseFrame(); + end + end + + this:Show(); + 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."); + + -- Debug command handling + self:RegisterSlash(function(this) + this.debugChannel = false; + for i = 1, NUM_CHAT_WINDOWS do + local name = GetChatWindowInfo(i); + + if name:upper() == "DEBUG" then + this.debugChannel = _G["ChatFrame" .. i]; + + print("A debug channel already exists, used the old one. (" .. i .. ")"); + return; + end + end + + if not this.debugChannel then + -- Create a new debug channel + local chatFrame = FCF_OpenNewWindow('Debug'); + ChatFrame_RemoveAllMessageGroups(chatFrame); + this.debugChannel = chatFrame; + + print("New debug channel created."); + end + end, { "d", "debug" }); + -- INTERFACE OPTIONS -- Attempt to remove the interface options added by AddonLoader (if enabled) @@ -196,12 +230,6 @@ end -local slashArgs = {}; -function addon:RegisterSlash(func, ...) - for _, arg in pairs({ ... }) do - slashArgs[arg] = func; - end -end function addon:MakeItemLinkButtonWidget() --[[ @@ -228,8 +256,8 @@ -- when the widget is re-used from the widget pool widget.originalOnAcquire = widget.OnAcquire; widget.OnAcquire = function(self, ...) - - + + -- We overwrite the setcallback because we don't want anything else -- to overwrite our OnEnter, OnLeave and OnClick events -- which would be done by the AceConfigDialog after a widget gets re-used @@ -252,6 +280,7 @@ end + -- Set our own events, since we disabled the normal event-names, we'll call them our custom versions self:SetCallback("CustomOnEnter", function(this) local itemId = this:GetUserData("itemId"); @@ -356,44 +385,27 @@ AceGUI:RegisterWidgetType(widgetType, GetItemLinkButton, widgetVersion); end -function addon:CommandHandler(message) +local slashArgs = {}; +local slashError = "Wrong arguement, the following arguements are available:"; + +function addon:RegisterSlash(func, args, description) + for _, arg in pairs(args) do + slashArgs[arg] = func; + end + + if description then + slashError = slashError .. "\n" .. description; + end +end + +function InventoriumCommandHandler(message) local cmd, arg = string.split(" ", (message or ""), 2); cmd = string.lower(cmd); - 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 - -- We don't want any other windows open at this time. - for name, module in self:IterateModules() do - if module.CloseFrame then - module:CloseFrame(); - end - end - - self:Show(); - elseif cmd == "d" or cmd == "debug" then - self.debugChannel = false; - for i = 1, NUM_CHAT_WINDOWS do - local name = GetChatWindowInfo(i); - - if name:upper() == "DEBUG" then - self.debugChannel = _G["ChatFrame" .. i]; - - print("A debug channel already exists, used the old one. (" .. i .. ")"); - return; - end - end - - if not self.debugChannel then - -- Create a new debug channel - local chatFrame = FCF_OpenNewWindow('Debug'); - ChatFrame_RemoveAllMessageGroups(chatFrame); - self.debugChannel = chatFrame; - - print("New debug channel created."); - end - elseif slashArgs[cmd] then - slashArgs[cmd](); + if slashArgs[cmd] then + slashArgs[cmd](addon, arg); else - print("Wrong command, available: /inventorium config (or /im c) and /inventorium summary (or /im s)"); + print(slashError); end end @@ -574,7 +586,13 @@ return temp; end, get = function() return self.db.global.defaults.auctionPricingAddon; end, - set = function(i, v) self.db.global.defaults.auctionPricingAddon = v; end, + set = function(i, v) + self.db.global.defaults.auctionPricingAddon = v; + + if self.supportedAddons.auctionPricing[v].OnSelect then + self.supportedAddons.auctionPricing[v].OnSelect(); + end + end, }, itemCountAddon = { order = 20, @@ -608,7 +626,7 @@ get = function() return self.db.global.defaults.craftingAddon; end, set = function(i, v) self.db.global.defaults.craftingAddon = v; end, }, - localItemData = { + --[[localItemData = { order = 40, type = "multiselect", name = "Include in local item data", @@ -622,7 +640,7 @@ get = function(i, v) return self.db.global.defaults.localItemData and self.db.global.defaults.localItemData[v]; end, set = function(i, v, e) self.db.global.defaults.localItemData[v] = e or nil; end, --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. - }, + },]] }, }, minimumStock = { @@ -1208,6 +1226,16 @@ return temp; end, + set = function(info, value) + local groupName = groupIdToName[info[2]]; + local optionName = info[#info]; + + addon.db.global.groups[groupName][optionName] = value ~= "" and value; + + if addon.supportedAddons.auctionPricing[value].OnSelect then + addon.supportedAddons.auctionPricing[value].OnSelect(); + end + end, arg = "overrideAuctionPricingAddon", }, overrideItemCountAddon = { @@ -1254,7 +1282,7 @@ end, arg = "overrideCraftingAddon", }, - overrideLocalItemData = { + --[[overrideLocalItemData = { order = 39, type = "toggle", name = "Override local item data", @@ -1275,7 +1303,7 @@ get = GetMultiOption, --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. arg = "overrideLocalItemData", - }, + },]] virtualGroup = { order = 50, type = "select", @@ -2162,10 +2190,11 @@ -- Public -function IMRegisterPricingAddon(name, get, enabled) +function IMRegisterPricingAddon(name, get, enabled, onSelect) addon.supportedAddons.auctionPricing[name] = { GetValue = get, IsEnabled = enabled, + OnSelect = onSelect, }; end diff -r 31e5da6a2b16 -r 58fb38f0b447 Inventorium.toc --- a/Inventorium.toc Wed Nov 03 19:38:53 2010 +0100 +++ b/Inventorium.toc Sat Nov 20 17:24:16 2010 +0100 @@ -19,7 +19,9 @@ AuctionAddons\Auctioneer.lua AuctionAddons\AuctionLite.lua AuctionAddons\AuctionMaster.lua +AuctionAddons\AuctionProfitMaster.lua AuctionAddons\Others.lua +AuctionAddons\ZeroAuctions.lua ItemCountAddons\Altoholic.lua ItemCountAddons\DataStore (current account only).lua diff -r 31e5da6a2b16 -r 58fb38f0b447 Queue.lua --- a/Queue.lua Wed Nov 03 19:38:53 2010 +0100 +++ b/Queue.lua Sat Nov 20 17:24:16 2010 +0100 @@ -4,8 +4,8 @@ function mod:OnEnable() -- Register our own slash commands addon:RegisterSlash(function() - self:QueueAll(); - end, "q", "que", "queue"); + mod:QueueAll(); + end, { "q", "que", "queue" }, "|Hfunction:InventoriumCommandHandler:queue|h|cff00fff7/im queue|r|h (or /im q) - Queue all items found in the currently opened profession that are within the groups tracked at this current character."); self:RegisterMessage("IM_QUEUE_ALL"); self:RegisterMessage("IM_QUEUE_GROUP"); @@ -45,11 +45,14 @@ -- Process every single tradeskill self:ProcessTradeSkill(i, groupName, temp); end - - for itemId, _ in pairs(addon.db.global.groups[groupName].items) do - if not temp[itemId] then - local itemLink = select(2, GetItemInfo(itemId)); - print("Couldn't queue " .. itemLink .. " (not part of this profession)"); + + if addon.db.global.groups[groupName].items then + for itemId, _ in pairs(addon.db.global.groups[groupName].items) do + if not temp[itemId] then + local itemLink = select(2, GetItemInfo(itemId)); + + print("Couldn't queue " .. itemLink .. " (not part of this profession)"); + end end end end diff -r 31e5da6a2b16 -r 58fb38f0b447 Summary.lua --- a/Summary.lua Wed Nov 03 19:38:53 2010 +0100 +++ b/Summary.lua Sat Nov 20 17:24:16 2010 +0100 @@ -17,7 +17,7 @@ addon:RegisterSlash(function() mod:BuildMain(); mod:Build(); - end, "s", "sum", "summary"); + end, { "s", "sum", "summary" }, "|Hfunction:InventoriumCommandHandler:summary|h|cff00fff7/im summary|r|h (or /im s) - Show the summary window containing an overview of all items within the groups tracked at this current character."); addon:RegisterSlash(function() if mod.frame then mod.frame:SetWidth(650); @@ -25,7 +25,7 @@ print("Resetting width and height of the summary frame."); end - end, "r", "reset"); + end, { "r", "reset" }, "|Hfunction:InventoriumCommandHandler:reset|h|cff00fff7/im reset|r|h (or /im r) - Reset the size of the summary frame."); end local function ShowTooltip(self) @@ -326,6 +326,19 @@ iGroup:AddChild(lblQuantity); + -- Local quantity + --[[local lblLocal = AceGUI:Create("InteractiveLabel"); + lblLocal:SetText("|cfffed000Loc.|r"); + lblLocal:SetFontObject(GameFontHighlight); + lblLocal:SetRelativeWidth(.099); + lblLocal:SetCallback("OnClick", function() ReSort("current"); end); + lblLocal:SetCallback("OnEnter", ShowTooltip); + lblLocal:SetCallback("OnLeave", HideTooltip); + lblLocal.frame.tooltipTitle = "Local stock"; + lblLocal.frame.tooltip = "Sort on the amount of items currently in local stock."; + + iGroup:AddChild(lblLocal);]] + -- Required stock local lblMinimumStock = AceGUI:Create("InteractiveLabel"); lblMinimumStock:SetText("|cfffed000Min.|r"); @@ -368,6 +381,7 @@ value = ((priceThreshold == 0 and not alwaysGetAuctionValue) and -4) or -3,-- if (no price threshold is set for this item and you don't want to always get auction value), then don't look it up either --addon:GetAuctionValue(itemLink), rarity = itemRarity or 1, count = -3,--addon:GetItemCount(itemId, groupName), + --localCount = -3, set = {}, }); CACHE_ITEMS_TOTAL = CACHE_ITEMS_TOTAL + 1; @@ -454,6 +468,13 @@ iGroup:AddChild(lblQuantity); + -- Local quantity + --[[local lblLocal = AceGUI:Create("Label"); + lblLocal:SetText(self:DisplayItemCount(item.count, minimumStock)); + lblLocal:SetRelativeWidth(.099); + + iGroup:AddChild(lblLocal);]] + -- Required stock local lblMinimumStock = AceGUI:Create("Label"); lblMinimumStock:SetText(minimumStock); diff -r 31e5da6a2b16 -r 58fb38f0b447 embeds.xml --- a/embeds.xml Wed Nov 03 19:38:53 2010 +0100 +++ b/embeds.xml Sat Nov 20 17:24:16 2010 +0100 @@ -14,4 +14,5 @@ +