Mercurial > wow > inventory
changeset 13:5006cb0e97c6
Removed sound media registrations since we don?t use them.
Added an option to include tadeskill items above a certain item level threshold in the add items config tab.
Renamed the variable for toggling hiding from summary when below price threshold-option. You will have to re-set it.
Summary size and processing speed will now be remembered.
Processing speed slider can now go up to 500% (up from 100%).
Silver will be hidden from money when it includes more than 10 gold (down from 100g) and copper will be hidden if it includes more than 1 gold (down from 10g).
Auction addons, crafting addons and itemcount addons can now register themselves through a few global functions. The most used addons have been included in the addon folder.
You can now select the prefered default pricing, item count and crafting addons.
Temporarily removed the ?dialogControl = ?DropDown?? from the track at select boxes. This functionality is broken within the Ace3 library and until it is fixed I wish to keep these options somewhat functional.
The item list will now be truncated before rebuilding. Previously items disappearing from your inventory would still appear in this list.
Mass add is now functional.
All buttons and sliders that were meant to receive a tooltip (including the sort-headers), now have one.
Added spacers between all buttons and sliders of the summary window.
Added a ?queue all? button to the summary window. This button is not yet functional.
If the value of an item is not retrieved from the auction prices database, it will appear as a dash (-) rather than ?0c?.
If no item count is enabled, item counts will appear as ?Unknown? instead of breaking (or defaulting to 0).
author | Zerotorescue |
---|---|
date | Mon, 18 Oct 2010 15:26:42 +0200 |
parents | 417c3cfb9623 |
children | 0fc8a54516d7 |
files | AuctionAddons/AuctionLite.lua AuctionAddons/AuctionMaster.lua AuctionAddons/Auctionator.lua AuctionAddons/Auctioneer.lua AuctionAddons/Others.lua Core.lua CraftingAddons/AdvancedTradeSkillWindow.lua CraftingAddons/GnomeWorks.lua CraftingAddons/Skillet.lua Inventorium.toc ItemCountAddons/Altoholic.lua ItemCountAddons/ItemCount.lua Queue.lua Summary.lua |
diffstat | 14 files changed, 845 insertions(+), 132 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AuctionAddons/AuctionLite.lua Mon Oct 18 15:26:42 2010 +0200 @@ -0,0 +1,15 @@ +do + + local function GetValue(link) + local history = AuctionLite:GetHistoricalPriceById(itemID); + + return (history and hist.items > 0 and math.floor(hist.price)) or -1; + end + + local function IsEnabled() + return (AuctionLite and AuctionLite.GetHistoricalPriceById); + end + + IMRegisterPricingAddon("AuctionLite", GetValue, IsEnabled); + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AuctionAddons/AuctionMaster.lua Mon Oct 18 15:26:42 2010 +0200 @@ -0,0 +1,16 @@ +do + + local function GetValue(link) + local _, _, _, lowerBuyout, _, _, numAuctions, _ = AucMasGetCurrentAuctionInfo(link, false, true); + --local avgBid, avgBuyout, lowerBid, lowerBuyout, upperBid, upperBuyout, numAuctions, numBuyouts + + return (numAuctions > 0 and lowerBuyout) or -1; + end + + local function IsEnabled() + return (AucMasGetCurrentAuctionInfo); + end + + IMRegisterPricingAddon("AuctionMaster", GetValue, IsEnabled); + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AuctionAddons/Auctionator.lua Mon Oct 18 15:26:42 2010 +0200 @@ -0,0 +1,13 @@ +do + + local function GetValue(link) + return Atr_GetAuctionBuyout(link) or -1; + end + + local function IsEnabled() + return (Atr_GetAuctionBuyout); + end + + IMRegisterPricingAddon("Auctionator", GetValue, IsEnabled); + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AuctionAddons/Auctioneer.lua Mon Oct 18 15:26:42 2010 +0200 @@ -0,0 +1,21 @@ +do + + local function GetValue(link) + local imgSeen, _, _, _, _, lowBuy, _, _ = AucAdvanced.Modules.Util.SimpleAuction.Private.GetItems(link); + --local imgseen, image, matchBid, matchBuy, lowBid, lowBuy, aveBuy, aSeen + + if imgSeen <= 0 then + -- No auctions up at this time + return -1; + end + + return lowBuy; + end + + local function IsEnabled() + return (AucAdvanced ~= nil and AucAdvanced.Modules.Util.SimpleAuction ~= nil and AucAdvanced.Modules.Util.SimpleAuction.Private.GetItems ~= nil); + end + + IMRegisterPricingAddon("Auctioneer", GetValue, IsEnabled); + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AuctionAddons/Others.lua Mon Oct 18 15:26:42 2010 +0200 @@ -0,0 +1,13 @@ +do + + local function GetValue(link) + return GetAuctionBuyout(link) or -1; + end + + local function IsEnabled() + return (GetAuctionBuyout); + end + + IMRegisterPricingAddon("Others", GetValue, IsEnabled); + +end
--- a/Core.lua Sat Oct 16 20:58:39 2010 +0200 +++ b/Core.lua Mon Oct 18 15:26:42 2010 +0200 @@ -3,26 +3,16 @@ local AceGUI = LibStub("AceGUI-3.0"); -local Media = LibStub("LibSharedMedia-3.0"); -Media:Register("sound", "Cartoon FX", [[Sound\Doodad\Goblin_Lottery_Open03.wav]]); -Media:Register("sound", "Cheer", [[Sound\Event Sounds\OgreEventCheerUnique.wav]]); -Media:Register("sound", "Explosion", [[Sound\Doodad\Hellfire_Raid_FX_Explosion05.wav]]); -Media:Register("sound", "Fel Nova", [[Sound\Spells\SeepingGaseous_Fel_Nova.wav]]); -Media:Register("sound", "Fel Portal", [[Sound\Spells\Sunwell_Fel_PortalStand.wav]]); -Media:Register("sound", "Magic Click", [[Sound\interface\MagicClick.wav]]); -Media:Register("sound", "Rubber Ducky", [[Sound\Doodad\Goblin_Lottery_Open01.wav]]); -Media:Register("sound", "Shing!", [[Sound\Doodad\PortcullisActive_Closed.wav]]); -Media:Register("sound", "Simon Chime", [[Sound\Doodad\SimonGame_LargeBlueTree.wav]]); -Media:Register("sound", "Simon Error", [[Sound\Spells\SimonGame_Visual_BadPress.wav]]); -Media:Register("sound", "Simon Start", [[Sound\Spells\SimonGame_Visual_GameStart.wav]]); -Media:Register("sound", "War Drums", [[Sound\Event Sounds\Event_wardrum_ogre.wav]]); -Media:Register("sound", "Wham!", [[Sound\Doodad\PVP_Lordaeron_Door_Open.wav]]); -Media:Register("sound", "Whisper Ping", [[Sound\interface\iTellMessage.wav]]); -Media:Register("sound", "You Will Die!", [[Sound\Creature\CThun\CThunYouWillDIe.wav]]); - local AceConfigDialog, AceConfigRegistry, AceSerializer; local groupIdToName = {}; local options = {}; +local includeTradeSkillItems = 500; + +-- All modules must be able to retrieve our supported addons database, thus keep it public +addon.supportedAddons = {}; +addon.supportedAddons.auctionPricing = {}; +addon.supportedAddons.itemCount = {}; +addon.supportedAddons.crafting = {}; function addon:OnInitialize() self:Debug("OnInitialize"); @@ -33,6 +23,9 @@ global = { groups = {}, defaults = { + auctionPricingAddon = "Auctioneer", + itemCountAddon = "Altoholic", + craftingAddon = "AdvancedTradeSkillWindow", minimumStock = 60, alertBelowMinimum = true, summaryThresholdShow = 10, @@ -40,8 +33,13 @@ minCraftingQueue = 0.05, bonusQueue = 0.1, priceThreshold = 0, - hideFromSummaryWhenBelowPriceThreshold = false, + summaryHidePriceThreshold = false, trackAtCharacters = {}, + summary = { + speed = 5, + width = 650, + height = 600, + }, colors = { red = 0; orange = 0.3; @@ -361,13 +359,13 @@ text = goldText:format(text, gold); end - if not clean or (not gold or gold < 100) then + if not clean or (not gold or gold < 10) then local silver = floor( ( copper % COPPER_PER_GOLD ) / COPPER_PER_SILVER ); if silver > 0 then text = silverText:format(text, silver); end - if not clean or (not gold or gold < 10) then + if not clean or (not gold or gold < 1) then local copper = floor( copper % COPPER_PER_SILVER ); if copper > 0 or text == "" then text = copperText:format(text, copper); @@ -428,28 +426,53 @@ type = "header", name = "", }, - auctionAddon = { + auctionPricingAddon = { order = 10, type = "select", name = "Prefered pricing addon", - values = { - Auctioneer = "Auctioneer", - Auctionator = "Auctionator", - }, - get = function() end, - set = function(i, v) end, + 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.", + values = function() + local temp = {}; + for name, value in pairs(self.supportedAddons.auctionPricing) do + temp[name] = name; + end + + return temp; + end, + get = function() return self.db.global.defaults.auctionPricingAddon; end, + set = function(i, v) self.db.global.defaults.auctionPricingAddon = v; end, }, itemCountAddon = { order = 20, type = "select", name = "Prefered item count addon", - values = { - Altoholic = "Altoholic", - DataStore = "DataStore", - ItemCount = "ItemCount", - }, - get = function() end, - set = function(i, v) end, + 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.", + values = function() + local temp = {}; + for name, value in pairs(self.supportedAddons.itemCount) do + temp[name] = name; + end + + return temp; + end, + get = function() return self.db.global.defaults.itemCountAddon; end, + set = function(i, v) self.db.global.defaults.itemCountAddon = v; end, + }, + craftingAddon = { + order = 20, + type = "select", + name = "Prefered crafting addon", + 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.", + values = function() + local temp = {}; + for name, value in pairs(self.supportedAddons.crafting) do + temp[name] = name; + end + + return temp; + end, + get = function() return self.db.global.defaults.craftingAddon; end, + set = function(i, v) self.db.global.defaults.craftingAddon = v; end, }, }, }, @@ -527,8 +550,7 @@ end end end, - confirm = true, - 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. + --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. }, }, }, @@ -599,13 +621,13 @@ get = function() return self:ReadableMoney(self.db.global.defaults.priceThreshold); end, set = function(i, v) self.db.global.defaults.priceThreshold = self:ReadableMoneyToCopper(v); end, }, - hideFromSummaryWhenBelowPriceThreshold = { -- I wish this var could be a little bit shorter... + summaryHidePriceThreshold = { order = 50, type = "toggle", name = "Hide when below threshold", desc = "Hide items from the summary when their value is below the set price threshold.", - get = function() return self.db.global.defaults.hideFromSummaryWhenBelowPriceThreshold; end, - set = function(i, v) self.db.global.defaults.hideFromSummaryWhenBelowPriceThreshold = v; end, + get = function() return self.db.global.defaults.summaryHidePriceThreshold; end, + set = function(i, v) self.db.global.defaults.summaryHidePriceThreshold = v; end, }, }, }, @@ -859,6 +881,9 @@ local ref = options.args.groups.args[info[2]].args.add.args.list.args; + -- Remaking the list, so out with the old, in with the new + table.wipe(ref); + -- Parse bags and show these for bagID = 4, 0, -1 do for slot = 1, GetContainerNumSlots(bagID) do @@ -875,6 +900,38 @@ end end end + + if includeTradeSkillItems ~= 500 then + -- Include tradeskill items + + -- Go through all trade skills for the profession + for i = 1, GetNumTradeSkills() do + -- Try to retrieve the itemlink, this will be nil if current item is a group instead + local itemLink = GetTradeSkillItemLink(i); + + if itemLink then + local itemId = addon:GetItemId(itemLink); + if not itemId then + -- If this isn't an item, it can only be an enchant instead + itemId = tonumber(itemLink:match("|Henchant:([-0-9]+)|h")); + + itemId = scrollIds[itemId]; -- change enchantIds into scrollIds + end + + local itemLevel = select(4, GetItemInfo(itemId)) or 0; + + if includeTradeSkillItems == 0 or itemLevel >= includeTradeSkillItems then + if not items[itemId] then + -- If this item isn't used in any group yet + ref[itemId] = tblAddItemTemplate; + else + -- It's already used in a group, don't show it + ref[itemId] = nil; + end + end + end + end + end end local function UpdateRemoveItemList(info) @@ -898,7 +955,7 @@ end function addon:GetItemId(itemLink) - itemLink = itemLink and select(3, string.find(itemLink, "|Hitem:([-0-9]+):")); -- if itemLink is nil, it won't execute the second part + itemLink = itemLink and itemLink:match("|Hitem:([-0-9]+):"); -- if itemLink is nil, it won't execute the second part itemLink = itemLink and tonumber(itemLink); return itemLink; @@ -1018,8 +1075,7 @@ return temp; end, get = GetMultiOption, - confirm = true, - 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. + --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 = "overrideTrackAtCharacters", }, }, @@ -1121,19 +1177,19 @@ set = function(i, v) SetOption(i, addon:ReadableMoneyToCopper(v)); end, arg = "overridePriceThreshold", }, - overrideHideFromSummaryWhenBelowPriceThreshold = { + overrideSummaryHidePriceThreshold = { order = 49, type = "toggle", name = "Override summary showing", desc = "Allows you to override if items in this group should be hidden from the summary while their value is below the price threshold.", - arg = "hideFromSummaryWhenBelowPriceThreshold", + arg = "summaryHidePriceThreshold", }, - hideFromSummaryWhenBelowPriceThreshold = { -- I wish this var could be a little bit shorter... + summaryHidePriceThreshold = { order = 50, type = "toggle", name = "Hide when below threshold", desc = "Hide items from the summary when their value is below the set price threshold.", - arg = "overrideHideFromSummaryWhenBelowPriceThreshold", + arg = "overrideSummaryHidePriceThreshold", }, }, }, @@ -1334,9 +1390,60 @@ type = "input", name = "Add all items matching...", 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.", - --set = massAddItems, + set = function(info, value) + if not value then return; end + + value = value:lower(); + + local ref = options.args.groups.args[info[2]].args.add.args.list.args; + + for itemId, test in pairs(ref) do + if test then + local itemName = GetItemInfo(itemId); + + if itemName:lower():find(value) then + local groupName = groupIdToName[info[2]]; + + if not AddToGroup(groupName, itemId) then + print("|cffff0000Couldn't add the item with itemId (" .. itemId .. ") because it is already in a group.|r"); + end + end + end + end + end, get = false, }, + minItemLevel = { + order = 40, + type = "select", + values = function() + local temp = {}; + + temp[0] = "Include everything"; + + local itemLevelTemplate = "Itemlevel >= %d"; + + for i = 1, 49 do + temp[( i * 10 )] = itemLevelTemplate:format(( i * 10 )); + end + + temp[500] = "Include nothing"; + + return temp; + end, + name = "Include tradeskill items", + 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.", + set = function(i, v) includeTradeSkillItems = v; end, + get = function() return includeTradeSkillItems; end, + disabled = function() + if GetTradeSkillLine() == "UNKNOWN" then + includeTradeSkillItems = 500; + return true; -- disabled + else + return false; + end + end, + }, }, }, list = { @@ -1533,34 +1640,47 @@ end end + + +-- General functions used addon-wide + function addon:GetItemCount(itemId) - return Altoholic:GetItemCount(itemId); + itemId = tonumber(itemId); + + if not itemId then return; end + + if self.supportedAddons.itemCount[self.db.global.defaults.itemCountAddon] then + -- Try to use the default item count addon + + return self.supportedAddons.itemCount[self.db.global.defaults.itemCountAddon].GetCount(itemId); + else + -- Default not available, get the first one then + + for name, value in pairs(self.supportedAddons.itemCount) do + if value.IsEnabled() then + return value.GetCount(itemId); + end + end + end + + return -1; end -function addon:GetAuctionValue(link) - if GetAuctionBuyout then - -- Auctionator support +function addon:GetAuctionValue(itemLink) + if not itemLink then return; end + + if self.supportedAddons.auctionPricing[self.db.global.defaults.auctionPricingAddon] then + -- Try to use the default auction pricing addon - local lowBuy = GetAuctionBuyout(link); + return self.supportedAddons.auctionPricing[self.db.global.defaults.auctionPricingAddon].GetValue(itemLink); + else + -- Default not available, get the first one then - if lowBuy == nil then - -- No auctions up at this time - return -1; + for name, value in pairs(self.supportedAddons.auctionPricing) do + if value.IsEnabled() then + return value.GetValue(itemLink); + end end - - return lowBuy; - elseif AucAdvanced ~= nil and AucAdvanced.Modules.Util.SimpleAuction ~= nil and AucAdvanced.Modules.Util.SimpleAuction.Private.GetItems ~= nil then - -- Auctioneer support - - local imgSeen, _, _, _, _, lowBuy, _, _ = AucAdvanced.Modules.Util.SimpleAuction.Private.GetItems(link); - --local imgseen, image, matchBid, matchBuy, lowBid, lowBuy, aveBuy, aSeen - - if imgSeen <= 0 then - -- No auctions up at this time - return -1; - end - - return lowBuy; end return -2; @@ -1568,6 +1688,32 @@ +-- Public + +function IMRegisterPricingAddon(name, get, enabled) + addon.supportedAddons.auctionPricing[name] = { + GetValue = get, + IsEnabled = enabled, + }; +end + +function IMRegisterItemCountAddon(name, get, enabled) + addon.supportedAddons.itemCount[name] = { + GetCount = get, + IsEnabled = enabled, + }; +end + +function IMRegisterCraftingAddon(name, queue, enabled) + addon.supportedAddons.crafting[name] = { + Queue = queue, + IsEnabled = enabled, + }; +end + + + +-- Debug function addon:Debug(t) if not self.debugChannel and self.debugChannel ~= false then
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CraftingAddons/AdvancedTradeSkillWindow.lua Mon Oct 18 15:26:42 2010 +0200 @@ -0,0 +1,16 @@ +do + + local function Queue(tradeSkillIndex, amount) + local link = GetTradeSkillItemLink(tradeSkillIndex); + local itemName = link:match("%[([^%[%]]*)%]"); + + return ATSW_AddJob(itemName, amount); + end + + local function IsEnabled() + return (ATSW_AddJob); + end + + IMRegisterCraftingAddon("AdvancedTradeSkillWindow", Queue, IsEnabled); + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CraftingAddons/GnomeWorks.lua Mon Oct 18 15:26:42 2010 +0200 @@ -0,0 +1,17 @@ +do + + local function Queue(tradeSkillIndex, amount) + local link = GetTradeSkillRecipeLink(tradeSkillIndex); + local recipeId = tonumber(link:match("|Henchant:([-0-9]+)|h")); + + GnomeWorks:ShowQueueList(); + return GnomeWorks:AddToQueue(GnomeWorks.player, tradeSkillIndex, recipeId, amount); + end + + local function IsEnabled() + return (GnomeWorks and GnomeWorks.AddToQueue); + end + + IMRegisterCraftingAddon("GnomeWorks", Queue, IsEnabled); + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CraftingAddons/Skillet.lua Mon Oct 18 15:26:42 2010 +0200 @@ -0,0 +1,17 @@ +do + + local function Queue(tradeSkillIndex, amount) + local link = GetTradeSkillRecipeLink(tradeSkillIndex); + local recipeId = tonumber(link:match("|Henchant:([-0-9]+)|h")); + + local newCommand = Skillet:QueueCommandIterate(recipeId, amount); + return Skillet:AddToQueue(newCommand); + end + + local function IsEnabled() + return (Skillet and Skillet.QueueCommandIterate and Skillet.AddToQueue); + end + + IMRegisterCraftingAddon("Skillet", Queue, IsEnabled); + +end
--- a/Inventorium.toc Sat Oct 16 20:58:39 2010 +0200 +++ b/Inventorium.toc Mon Oct 18 15:26:42 2010 +0200 @@ -11,3 +11,17 @@ Core.lua Summary.lua +Queue.lua + +AuctionAddons\Auctionator.lua +AuctionAddons\Auctioneer.lua +AuctionAddons\AuctionLite.lua +AuctionAddons\AuctionMaster.lua +AuctionAddons\Others.lua + +ItemCountAddons\Altoholic.lua +ItemCountAddons\ItemCount.lua + +CraftingAddons\AdvancedTradeSkillWindow.lua +CraftingAddons\GnomeWorks.lua +CraftingAddons\Skillet.lua
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ItemCountAddons/Altoholic.lua Mon Oct 18 15:26:42 2010 +0200 @@ -0,0 +1,13 @@ +do + + local function GetCount(itemId) + return Altoholic:GetItemCount(itemId) or -1; + end + + local function IsEnabled() + return (Altoholic and Altoholic.GetItemCount); + end + + IMRegisterItemCountAddon("Altoholic", GetCount, IsEnabled); + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ItemCountAddons/ItemCount.lua Mon Oct 18 15:26:42 2010 +0200 @@ -0,0 +1,13 @@ +do + + local function GetCount(itemId) + return _GetItemCount(itemId) or -1; + end + + local function IsEnabled() + return (_GetItemCount); + end + + IMRegisterItemCountAddon("ItemCount", GetCount, IsEnabled); + +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Queue.lua Mon Oct 18 15:26:42 2010 +0200 @@ -0,0 +1,340 @@ +local addon = LibStub("AceAddon-3.0"):GetAddon("Inventorium"); +local mod = addon:NewModule("Queue", "AceEvent-3.0", "AceTimer-3.0"); + +local scrollIds = { + [27951] = 37603, + [7418] = 38679, + [7420] = 38766, + [7426] = 38767, + [7428] = 38768, + [7443] = 38769, + [7454] = 38770, + [7457] = 38771, + [7745] = 38772, + [7748] = 38773, + [7766] = 38774, + [7771] = 38775, + [7776] = 38776, + [7779] = 38777, + [7782] = 38778, + [7786] = 38779, + [7788] = 38780, + [7793] = 38781, + [7857] = 38782, + [7859] = 38783, + [7861] = 38784, + [7863] = 38785, + [7867] = 38786, + [13378] = 38787, + [13380] = 38788, + [13419] = 38789, + [13421] = 38790, + [13464] = 38791, + [13485] = 38792, + [13501] = 38793, + [13503] = 38794, + [13522] = 38795, + [13529] = 38796, + [13536] = 38797, + [13538] = 38798, + [13607] = 38799, + [13612] = 38800, + [13617] = 38801, + [13620] = 38802, + [13622] = 38803, + [13626] = 38804, + [13631] = 38805, + [13635] = 38806, + [13637] = 38807, + [13640] = 38808, + [13642] = 38809, + [13644] = 38810, + [13646] = 38811, + [13648] = 38812, + [13653] = 38813, + [13655] = 38814, + [13657] = 38815, + [13659] = 38816, + [13661] = 38817, + [13663] = 38818, + [13687] = 38819, + [13689] = 38820, + [13693] = 38821, + [13695] = 38822, + [13698] = 38823, + [13700] = 38824, + [13746] = 38825, + [13794] = 38826, + [13815] = 38827, + [13817] = 38828, + [13822] = 38829, + [13836] = 38830, + [13841] = 38831, + [13846] = 38832, + [13858] = 38833, + [13868] = 38834, + [13882] = 38835, + [13887] = 38836, + [13890] = 38837, + [13898] = 38838, + [13905] = 38839, + [13915] = 38840, + [13917] = 38841, + [13931] = 38842, + [13933] = 38843, + [13935] = 38844, + [13937] = 38845, + [13939] = 38846, + [13941] = 38847, + [13943] = 38848, + [13945] = 38849, + [13947] = 38850, + [13948] = 38851, + [20008] = 38852, + [20009] = 38853, + [20010] = 38854, + [20011] = 38855, + [20012] = 38856, + [20013] = 38857, + [20014] = 38858, + [20015] = 38859, + [20016] = 38860, + [20017] = 38861, + [20020] = 38862, + [20023] = 38863, + [20024] = 38864, + [20025] = 38865, + [20026] = 38866, + [20028] = 38867, + [20029] = 38868, + [20030] = 38869, + [20031] = 38870, + [20032] = 38871, + [20033] = 38872, + [20034] = 38873, + [20035] = 38874, + [20036] = 38875, + [21931] = 38876, + [22749] = 38877, + [22750] = 38878, + [23799] = 38879, + [23800] = 38880, + [23801] = 38881, + [23802] = 38882, + [23803] = 38883, + [23804] = 38884, + [25072] = 38885, + [25073] = 38886, + [25074] = 38887, + [25078] = 38888, + [25079] = 38889, + [25080] = 38890, + [25081] = 38891, + [25082] = 38892, + [25083] = 38893, + [25084] = 38894, + [25086] = 38895, + [27837] = 38896, + [27899] = 38897, + [27905] = 38898, + [27906] = 38899, + [27911] = 38900, + [27913] = 38901, + [27914] = 38902, + [27917] = 38903, + [27944] = 38904, + [27945] = 38905, + [27946] = 38906, + [27947] = 38907, + [27948] = 38908, + [27950] = 38909, + [27954] = 38910, + [27957] = 38911, + [27958] = 38912, + [27960] = 38913, + [27961] = 38914, + [27962] = 38915, + [27967] = 38917, + [27968] = 38918, + [27971] = 38919, + [27972] = 38920, + [27975] = 38921, + [27977] = 38922, + [27981] = 38923, + [27982] = 38924, + [27984] = 38925, + [28003] = 38926, + [28004] = 38927, + [33990] = 38928, + [33991] = 38929, + [33992] = 38930, + [33993] = 38931, + [33994] = 38932, + [33995] = 38933, + [33996] = 38934, + [33997] = 38935, + [33999] = 38936, + [34001] = 38937, + [34002] = 38938, + [34003] = 38939, + [34004] = 38940, + [34005] = 38941, + [34006] = 38942, + [34007] = 38943, + [34008] = 38944, + [34009] = 38945, + [34010] = 38946, + [42620] = 38947, + [42974] = 38948, + [44383] = 38949, + [44483] = 38950, + [44484] = 38951, + [44488] = 38953, + [44489] = 38954, + [44492] = 38955, + [44494] = 38956, + [44500] = 38959, + [44506] = 38960, + [44508] = 38961, + [44509] = 38962, + [44510] = 38963, + [44513] = 38964, + [44524] = 38965, + [44528] = 38966, + [44529] = 38967, + [44555] = 38968, + [44556] = 38969, + [60616] = 38971, + [44576] = 38972, + [44582] = 38973, + [44584] = 38974, + [44588] = 38975, + [44589] = 38976, + [44590] = 38977, + [44591] = 38978, + [44592] = 38979, + [44593] = 38980, + [44595] = 38981, + [44596] = 38982, + [44598] = 38984, + [60623] = 38986, + [44616] = 38987, + [44621] = 38988, + [44623] = 38989, + [44625] = 38990, + [44629] = 38991, + [44630] = 38992, + [44631] = 38993, + [44633] = 38995, + [44635] = 38997, + [46578] = 38998, + [46594] = 38999, + [47051] = 39000, + [47672] = 39001, + [47766] = 39002, + [47898] = 39003, + [47899] = 39004, + [47900] = 39005, + [47901] = 39006, + [59625] = 43987, + [60606] = 44449, + [60621] = 44453, + [60653] = 44455, + [60609] = 44456, + [60663] = 44457, + [60668] = 44458, + [60691] = 44463, + [60692] = 44465, + [60707] = 44466, + [60714] = 44467, + [60763] = 44469, + [60767] = 44470, + [59621] = 44493, + [59619] = 44497, + [44575] = 44815, + [62256] = 44947, + [62948] = 45056, + [62959] = 45060, + [63746] = 45628, + [64441] = 46026, + [64579] = 46098, + [71692] = 50816, +};--enchantId=scrollId + +function mod:OnEnable() + -- Register our own slash commands + addon:RegisterSlash(function() + self:QueueAll(); + end, "q", "que", "queue"); +end + +function mod:QueueAll() + -- Go through all trade skills for the profession + for i = 1, GetNumTradeSkills() do + -- Go through all groups + for groupName, _ in pairs(addon.db.global.groups) do + -- Process every single tradeskill + self:ProcessTradeSkill(i, groupName); + end + end +end + +function mod:QueueGroup(groupName) + if not addon.db.global.groups[groupName] then return false; end + + -- Go through all trade skills for the profession + for i = 1, GetNumTradeSkills() do + -- Process every single tradeskill + self:ProcessTradeSkill(i, groupName); + end +end + +function mod:ProcessTradeSkill(i, groupName) + -- Try to retrieve the itemlink, this will be nil if current item is a group instead + local itemLink = GetTradeSkillItemLink(i); + + if itemLink then + local itemId = addon:GetItemId(itemLink); + if not itemId then + -- If this isn't an item, it can only be an enchant instead + itemId = tonumber(itemLink:match("|Henchant:([-0-9]+)|h")); + + itemId = scrollIds[itemId]; -- change enchantIds into scrollIds + end + + if addon.db.global.groups[groupName].items[itemId] then + -- This item is in this group, queue it! + + local amount = ( addon:GetOptionByKey(groupName, "restockTarget") - addon:GetItemCount(itemId) ); + + if amount > 0 then + self:Queue(i, amount); + + print("Queued " .. amount .. " of " .. itemLink); + end + end + end +end + +function mod:Queue(tradeSkillIndex, amount) + tradeSkillIndex = tonumber(tradeSkillIndex); + amount = tonumber(amount); + + if not tradeSkillIndex or not amount then return; end + + if addon.supportedAddons.crafting[addon.db.global.defaults.craftingAddon] then + -- Try to use the default auction pricing addon + + return addon.supportedAddons.crafting[addon.db.global.defaults.craftingAddon].Queue(tradeSkillIndex, amount); + else + -- Default not available, get the first one then + + for name, value in pairs(addon.supportedAddons.crafting) do + if value.IsEnabled() then + return value.Queue(tradeSkillIndex, amount); + end + end + end + + return -2; +end
--- a/Summary.lua Sat Oct 16 20:58:39 2010 +0200 +++ b/Summary.lua Mon Oct 18 15:26:42 2010 +0200 @@ -13,6 +13,25 @@ end, "s", "sum", "summary"); end +local function ShowTooltip(self) + -- If this function is called from a widget, self is the widget and self.frame the actual frame + local this = self.frame or self; + + GameTooltip:SetOwner(this, "ANCHOR_NONE"); + GameTooltip:SetPoint("BOTTOM", this, "TOP"); + GameTooltip:SetText(this.tooltipTitle, 1, .82, 0, 1); + + if type(this.tooltip) == "string" then + GameTooltip:AddLine(this.tooltip, 1, 1, 1, 1); + end + + GameTooltip:Show(); +end + +local function HideTooltip() + GameTooltip:Hide(); +end + function mod:RegisterWidgets() -- Register InlineGroupWithButton-widget -- This widget adds a button next to the header of an inline group @@ -35,20 +54,8 @@ button:SetScript("OnClick", buttonSettings.exec); button.tooltipTitle = buttonSettings.name; button.tooltip = buttonSettings.desc or ""; - button:SetScript("OnEnter", function(self) - GameTooltip:SetOwner(self, "ANCHOR_NONE") - GameTooltip:SetPoint("BOTTOM", self, "TOP") - GameTooltip:SetText(self.tooltipTitle, 1, .82, 0, 1) - - if type(self.tooltip) == "string" then - GameTooltip:AddLine(self.tooltip, 1, 1, 1, 1); - end - - GameTooltip:Show(); - end); - button:SetScript("OnLeave", function(self) - GameTooltip:Hide(); - end); + button:SetScript("OnEnter", ShowTooltip); + button:SetScript("OnLeave", HideTooltip); else error("settings must be a table - usage: MakeButton(table);"); end @@ -61,7 +68,8 @@ end local itemsCache = {}; -local CACHE_ITEMS_TOTAL, CACHE_ITEMS_CURRENT, CACHE_ITEMS_PER_UPDATE = 0, 0, 5; + +local CACHE_ITEMS_TOTAL, CACHE_ITEMS_CURRENT = 0, 0; local cacheStart; function mod:BuildMain() @@ -71,12 +79,20 @@ -- Main Window mod.frame = AceGUI:Create("Frame"); - mod.frame:SetTitle("Inventorium Summary"); + mod.frame:SetTitle("Summary"); mod.frame:SetLayout("Fill"); mod.frame:SetCallback("OnClose", function(widget) mod:CancelTimer(self.tmrUpdater, true); mod:CloseFrame(); end); + mod.frame:SetWidth(addon.db.global.defaults.summary.width); + mod.frame:SetHeight(addon.db.global.defaults.summary.height); + mod.frame.OnWidthSet = function(_, width) + addon.db.global.defaults.summary.width = width; + end; + mod.frame.OnHeightSet = function(_, height) + addon.db.global.defaults.summary.height = height; + end; -- ScrollFrame child mod.scrollFrame = AceGUI:Create("ScrollFrame"); @@ -144,7 +160,6 @@ -- Refresh button local btnRefresh = AceGUI:Create("Button"); btnRefresh:SetText("Refresh"); - -- SetTooltip: Reload all item counts and auction values. btnRefresh:SetRelativeWidth(.2); btnRefresh:SetCallback("OnClick", function() -- Reset items cache @@ -153,22 +168,75 @@ -- Rebuild itemlist and start caching mod:Build(); end); + btnRefresh:SetCallback("OnEnter", ShowTooltip); + btnRefresh:SetCallback("OnLeave", HideTooltip); + btnRefresh.frame.tooltipTitle = "Refresh Cache"; + btnRefresh.frame.tooltip = "Refresh the list and recache the item counts and auction values."; mod.scrollFrame:AddChild(btnRefresh); + local lblSpacer = AceGUI:Create("Label"); + lblSpacer:SetRelativeWidth(.03); + + mod.scrollFrame:AddChild(lblSpacer); + -- Speed slider - local btnRefresh = AceGUI:Create("Slider"); - btnRefresh:SetLabel("Processing speed"); - btnRefresh:SetSliderValues(0.01, 1, 0.01); - btnRefresh:SetIsPercent(true); - -- SetTooltip: Change the speed at which item counts and auction values are being cached. Higher is faster but may drastically reduce your FPS while caching. - btnRefresh:SetRelativeWidth(.3); - btnRefresh:SetCallback("OnMouseUp", function(self, event, value) - CACHE_ITEMS_PER_UPDATE = ceil( value * 100 / 5 ); -- max = 20, min = 1 + local sdrSpeed = AceGUI:Create("Slider"); + sdrSpeed:SetLabel("Processing speed"); + sdrSpeed:SetSliderValues(0.01, 5, 0.01); + sdrSpeed:SetIsPercent(true); + sdrSpeed:SetRelativeWidth(.3); + sdrSpeed:SetCallback("OnMouseUp", function(self, event, value) + addon.db.global.defaults.summary.speed = ceil( value * 100 / 5 ); + + CACHE_ITEMS_PER_UPDATE = addon.db.global.defaults.summary.speed; -- max = 20, min = 1 end); - btnRefresh:SetValue( CACHE_ITEMS_PER_UPDATE * 5 / 100 ); + sdrSpeed:SetValue( addon.db.global.defaults.summary.speed * 5 / 100 ); + sdrSpeed:SetCallback("OnEnter", ShowTooltip); + sdrSpeed:SetCallback("OnLeave", HideTooltip); + sdrSpeed.frame.tooltipTitle = "Caching Processing Speed"; + sdrSpeed.frame.tooltip = "Change the speed at which item counts and auction values are being cached. Higher is faster but may drastically reduce your FPS while caching.\n\nAnything above 100% will probably become uncomfortable."; - mod.scrollFrame:AddChild(btnRefresh); + mod.scrollFrame:AddChild(sdrSpeed); + + local lblSpacer = AceGUI:Create("Label"); + lblSpacer:SetRelativeWidth(.23); + + mod.scrollFrame:AddChild(lblSpacer); + + -- Config button + --[[local btnConfig = AceGUI:Create("Button"); + btnConfig:SetText("Config"); + btnConfig:SetRelativeWidth(.2); + btnConfig:SetCallback("OnClick", function() + --TODO: Tidy up + SlashCmdList["INVENTORIUM"]("config"); + end); + btnConfig:SetCallback("OnEnter", ShowTooltip); + btnConfig:SetCallback("OnLeave", HideTooltip); + btnConfig.frame.tooltipTitle = "Config"; + btnConfig.frame.tooltip = "Click to open the config window. This will close the current window."; + + mod.scrollFrame:AddChild(btnConfig);]] + + local lblSpacer = AceGUI:Create("Label"); + lblSpacer:SetRelativeWidth(.03); + + mod.scrollFrame:AddChild(lblSpacer); + + -- Queue all button + local btnQueueAll = AceGUI:Create("Button"); + btnQueueAll:SetText("Queue All"); + btnQueueAll:SetRelativeWidth(.2); + btnQueueAll:SetCallback("OnClick", function() + + end); + btnQueueAll:SetCallback("OnEnter", ShowTooltip); + btnQueueAll:SetCallback("OnLeave", HideTooltip); + btnQueueAll.frame.tooltipTitle = "Queue all"; + btnQueueAll.frame.tooltip = "Queue everything that requires restocking within every single visible group."; + + mod.scrollFrame:AddChild(btnQueueAll); times.init = ceil( ( GetTime() - buildStartTime ) * 1000 ); addon:Debug("Time spent legend: (init / sorting / preparing / building / all)."); @@ -216,6 +284,10 @@ lblItem:SetFontObject(GameFontHighlight); lblItem:SetRelativeWidth(.7); lblItem:SetCallback("OnClick", function() ReSort("item"); end); + lblItem:SetCallback("OnEnter", ShowTooltip); + lblItem:SetCallback("OnLeave", HideTooltip); + lblItem.frame.tooltipTitle = "Item"; + lblItem.frame.tooltip = "Sort on the item quality, then name."; iGroup:AddChild(lblItem); @@ -225,15 +297,23 @@ lblQuantity:SetFontObject(GameFontHighlight); lblQuantity:SetRelativeWidth(.099); lblQuantity:SetCallback("OnClick", function() ReSort("current"); end); + lblQuantity:SetCallback("OnEnter", ShowTooltip); + lblQuantity:SetCallback("OnLeave", HideTooltip); + lblQuantity.frame.tooltipTitle = "Current stock"; + lblQuantity.frame.tooltip = "Sort on the amount of items currently in stock."; iGroup:AddChild(lblQuantity); -- Required stock local lblMinimumStock = AceGUI:Create("InteractiveLabel"); - lblMinimumStock:SetText("|cfffed000Req.|r"); + lblMinimumStock:SetText("|cfffed000Min.|r"); lblMinimumStock:SetFontObject(GameFontHighlight); lblMinimumStock:SetRelativeWidth(.099); lblMinimumStock:SetCallback("OnClick", function() ReSort("percentage"); end); + lblMinimumStock:SetCallback("OnEnter", ShowTooltip); + lblMinimumStock:SetCallback("OnLeave", HideTooltip); + lblMinimumStock.frame.tooltipTitle = "Minimum stock"; + lblMinimumStock.frame.tooltip = "Sort on the minimum amount of items you wish to keep in stock."; iGroup:AddChild(lblMinimumStock); @@ -243,6 +323,10 @@ lblValue:SetFontObject(GameFontHighlight); lblValue:SetRelativeWidth(.099); lblValue:SetCallback("OnClick", function() ReSort("value"); end); + lblValue:SetCallback("OnEnter", ShowTooltip); + lblValue:SetCallback("OnLeave", HideTooltip); + lblValue.frame.tooltipTitle = "Value"; + lblValue.frame.tooltip = "Sort on the item auction value."; iGroup:AddChild(lblValue); @@ -257,15 +341,11 @@ for itemId, _ in pairs(values.items) do local itemName, itemLink, itemRarity = GetItemInfo(itemId); - if not itemRarity then - print(itemId .. ": " .. itemName .. " - " .. itemLink); - end - table.insert(itemsCache[groupName], { id = itemId, name = itemName or unknownItemName:format(itemId), link = itemLink or unknownItemName:format(itemId), - value = ((priceThreshold == 0) and 0) or -3,-- if no price threshold is set for this item, then don't look it up either --addon:GetAuctionValue(itemLink), + value = ((priceThreshold == 0) and -4) or -3,-- if no price threshold is set for this item, then don't look it up either --addon:GetAuctionValue(itemLink), rarity = itemRarity or 1, count = -3,--addon:GetItemCount(itemId), set = {}, @@ -379,7 +459,9 @@ groupTimes.building = ceil( ( GetTime() - groupStartTime ) * 1000 ); end - addon:Debug(("Building of %s took %d ms (%d / %d / %d / %d / %d)."):format(groupName, ceil( ( GetTime() - groupStartTime ) * 1000 ), groupTimes.init, groupTimes.sorting, groupTimes.preparing, groupTimes.building, ceil( ( GetTime() - buildStartTime ) * 1000 ))); + if groupStartTime and groupTimes then + addon:Debug(("Building of %s took %d ms (%d / %d / %d / %d / %d)."):format(groupName, ceil( ( GetTime() - groupStartTime ) * 1000 ), groupTimes.init or 0, groupTimes.sorting or 0, groupTimes.preparing or 0, groupTimes.building or 0, ceil( ( GetTime() - buildStartTime ) * 1000 ))); + end end mod.scrollFrame:ResumeLayout(); @@ -428,7 +510,7 @@ mod.frame:SetStatusText(("Caching auction values and item-counts... %d%% has already been processed."):format(floor(CACHE_ITEMS_CURRENT / CACHE_ITEMS_TOTAL * 100))); end - if i >= CACHE_ITEMS_PER_UPDATE then + if i >= addon.db.global.defaults.summary.speed then return; end end @@ -473,6 +555,8 @@ return "|cff0000ffNo AH mod|r"; elseif value == -3 then return "|cffffff00Unknown|r"; + elseif value == -4 then + return "|cff00ff00-|r"; elseif value < priceThreshold then return ("|cffff0000%s|r"):format(addon:ReadableMoney(value or 0, true)); else @@ -481,7 +565,9 @@ end function mod:DisplayItemCount(value, minimumStock) - if value == -3 then + if value == -1 then + return "|cffffff00Unknown|r"; + elseif value == -3 then return "|cffffff00Unknown|r"; else return self:ColorCode(value, minimumStock); @@ -501,30 +587,3 @@ return formatted; end - ---[[ -No longer used, we're now caching complete item data instead of just AH values. -local AuctionValueCache = {}; -function mod:GetAuctionValue(link) - local itemId = addon:GetItemId(link); - - if AuctionValueCache[itemId] then - return AuctionValueCache[itemId]; - else - local value = addon:GetAuctionValue(link); - - AuctionValueCache[itemId] = value; - - -- Reset the cache 1 minute after last updating it - self:CancelTimer(self.tmrResetCache, true); - self.tmrResetCache = self:ScheduleTimer(function() - table.wipe(AuctionValueCache); - - mod.frame:SetStatusText("The auction item value cache has been reset."); - end, 60); - mod.frame:SetStatusText(""); - - return value; - end -end -]] \ No newline at end of file