Mercurial > wow > itemauditor
changeset 82:e9f7bc9199ca release 2010-08-05
Fixed Bug 23 - When you purchase multiple stacks of the same item and it is one you have not invested in yet, ItemAuditor mistakenly counted items you have not yet pulled from the mail as items you already owned. This resulted in those items being counted twice.
author | Asa Ayers <Asa.Ayers@Gmail.com> |
---|---|
date | Thu, 05 Aug 2010 22:20:44 -0700 |
parents | 64166ba5209a |
children | 94dffffb167c |
files | CHANGELOG.txt Core.lua Modules/Crafting.lua Modules/DisplayInvested.lua Modules/UnitTests.lua |
diffstat | 5 files changed, 25 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/CHANGELOG.txt Thu Aug 05 20:21:05 2010 -0700 +++ b/CHANGELOG.txt Thu Aug 05 22:20:44 2010 -0700 @@ -1,6 +1,7 @@ 2010-08-05 Asa Ayers <Asa.Ayers@Gmail.com> - Fixed Bug 22 - Exchanging player bags for bank bags changes invested +- Fixed Bug 23 - When you purchase multiple stacks of the same item and it is one you have not invested in yet, ItemAuditor mistakenly counted items you have not yet pulled from the mail as items you already owned. This resulted in those items being counted twice. 2010-08-01 Asa Ayers <Asa.Ayers@Gmail.com>
--- a/Core.lua Thu Aug 05 20:21:05 2010 -0700 +++ b/Core.lua Thu Aug 05 22:20:44 2010 -0700 @@ -341,6 +341,20 @@ return results end +function ItemAuditor:GetItemCount(searchID) + local itemCounts = {} + local count = 0 + for _, character in pairs(DataStore:GetCharacters()) do + bags, bank = DataStore:GetContainerItemCount(character, searchID) + + count = count + bags + bank + + DataStore:GetAuctionHouseItemCount(character, searchID) + + DataStore:GetInventoryItemCount(character, searchID) + + DataStore:GetCurrencyItemCount(character, searchID) + end + return count +end + function ItemAuditor:GetItem(link, viewOnly) if viewOnly == nil then viewOnly = false @@ -357,7 +371,7 @@ if self.db.factionrealm.item_account[itemName] ~= nil then self.db.factionrealm.items[link] = { - count = Altoholic:GetItemCount(self:GetIDFromLink(link)), + count = ItemAuditor:GetItemCount(self:GetIDFromLink(link)), invested = abs(self.db.factionrealm.item_account[itemName] or 0), } self.db.factionrealm.item_account[itemName] = nil @@ -366,14 +380,14 @@ if viewOnly == false and self.db.factionrealm.items[link] == nil then self.db.factionrealm.items[link] = { - count = Altoholic:GetItemCount(self:GetIDFromLink(link)), + count = ItemAuditor:GetItemCount(self:GetIDFromLink(link)), invested = abs(self.db.factionrealm.item_account[itemName] or 0), } end if self.db.factionrealm.items[link] ~= nil then - self.db.factionrealm.items[link].count = Altoholic:GetItemCount(self:GetIDFromLink(link)) + self.db.factionrealm.items[link].count = ItemAuditor:GetItemCount(self:GetIDFromLink(link)) if self.db.factionrealm.items[link].invested == nil then self.db.factionrealm.items[link].invested = 0 @@ -436,7 +450,7 @@ self:RemoveItem(link) -- This doesn't work when you mail the only copy of an item you have to another character. --[[ - elseif item.count == 0 and realLink and Altoholic:GetItemCount(self:GetIDFromLink(realLink)) then + elseif item.count == 0 and realLink and ItemAuditor:GetItemCount(self:GetIDFromLink(realLink)) then self:Print("You ran out of " .. itemName .. " and never recovered " .. self:FormatMoney(item.invested)) self:RemoveItem(link) ]] @@ -506,5 +520,5 @@ end end - return 0, 0, Altoholic:GetItemCount(ItemAuditor:GetIDFromLink(link)) + return 0, 0, ItemAuditor:GetItemCount(ItemAuditor:GetIDFromLink(link)) end
--- a/Modules/Crafting.lua Thu Aug 05 20:21:05 2010 -0700 +++ b/Modules/Crafting.lua Thu Aug 05 22:20:44 2010 -0700 @@ -379,7 +379,7 @@ -- This check has to be here for things like Inscription Research that don't produce an item. if itemLink then - local count = Altoholic:GetItemCount(itemId) + local count = ItemAuditor:GetItemCount(itemId) local reagents = {} local totalCost = 0 for reagentId = 1, GetTradeSkillNumReagents(i) do
--- a/Modules/DisplayInvested.lua Thu Aug 05 20:21:05 2010 -0700 +++ b/Modules/DisplayInvested.lua Thu Aug 05 22:20:44 2010 -0700 @@ -197,7 +197,7 @@ for link, count in pairs(inventory.items) do if includedItems[link] == nil then - local count = Altoholic:GetItemCount(ItemAuditor:GetIDFromLink(link)) + local count = ItemAuditor:GetItemCount(ItemAuditor:GetIDFromLink(link)) local itemName, link = GetItemInfo(link) tableData[i] = { itemName.."|"..link,
--- a/Modules/UnitTests.lua Thu Aug 05 20:21:05 2010 -0700 +++ b/Modules/UnitTests.lua Thu Aug 05 22:20:44 2010 -0700 @@ -124,8 +124,8 @@ }, } - backups['Altoholic.GetItemCount'] = Altoholic.GetItemCount - Altoholic.GetItemCount = function(self, id) + backups['ItemAuditor.GetItemCount'] = ItemAuditor.GetItemCount + ItemAuditor.GetItemCount = function(self, id) local total = GetItemCount(id) total = total + (fakeAlts[id] or 0) @@ -140,7 +140,7 @@ ItemAuditor:Print('Unit Test tearDown') ItemAuditor:UpdateCurrentInventory() ItemAuditor.db = backups['ItemAuditor.db'] - Altoholic.GetItemCount = backups['Altoholic.GetItemCount'] + ItemAuditor.GetItemCount = backups['ItemAuditor.GetItemCount'] end; testMockGetContainerItemLink = function()