Mercurial > wow > itemauditor
changeset 51:84bfb5469189
Merged and closed ticket7
author | Asa Ayers <Asa.Ayers@Gmail.com> |
---|---|
date | Wed, 21 Jul 2010 01:22:30 -0700 |
parents | 508110e7c8ee (current diff) c0166af6e49a (diff) |
children | 9c95158236d1 |
files | CHANGELOG.txt |
diffstat | 3 files changed, 30 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/CHANGELOG.txt Tue Jul 20 00:20:15 2010 -0700 +++ b/CHANGELOG.txt Wed Jul 21 01:22:30 2010 -0700 @@ -1,4 +1,8 @@ -2010-07-20 Asa Ayers <Asa.Ayers@Gmail.com> +2010-07-21 Asa Ayers <Asa.Ayers@Gmail.com> + +- Fixed the way prices were being calculated as items were being created/destroyed/converted/crafted. see http://www.wowace.com/addons/itemauditor/tickets/7-create-options-for-how-to-distribute-value-when-creating/ + +2010-07-18 Asa Ayers <Asa.Ayers@Gmail.com> - Implemented COD mail (Ticket #1) and updated the way postage was counted so that if you mail multiple items at once, they will all have the postage counted. I also removed the 30c for postage from how QA thresholds are calculated now that they will be counted every time. - Added a dialog to allow the user to send COD mail without a tracking number.
--- a/Modules/DisplayInvested.lua Tue Jul 20 00:20:15 2010 -0700 +++ b/Modules/DisplayInvested.lua Wed Jul 21 01:22:30 2010 -0700 @@ -98,7 +98,7 @@ ItemAuditor:SaveValue(link, newValue-investedTotal, 0) end - StaticPopup_Show ("ItemAuditor_NewPrice", link, 'two'); + StaticPopup_Show ("ItemAuditor_NewPrice"); end local function displayMoney(rowFrame, cellFrame, data, cols, row, realrow, column, fShow, table, ...)
--- a/Modules/Events.lua Tue Jul 20 00:20:15 2010 -0700 +++ b/Modules/Events.lua Wed Jul 21 01:22:30 2010 -0700 @@ -224,6 +224,29 @@ self.lastInventory = self:GetCurrentInventory() end +local function distributeValue(self, totalValue, targetItems) + + local weights = {} + local totalWeight = 0 + for link, change in pairs(targetItems) do + --[[ + If something has never been seen on the AH, it must not be very valuable. + I'm using 1c so it doesn't have much weight and I can't get a devided by zero error. + The only time I know that this is a problem is when crafting a BOP item, and it + is always crafted 1 at a time, so a weight of 1 will work. + ]] + local ap = (addon:GetAuctionPrice(link) or 1) + totalWeight = totalWeight + ap + weights[link] = ap + end + + local valuePerPoint = totalValue / totalWeight + + for link, change in pairs(targetItems) do + self:SaveValue(link, weights[link] * valuePerPoint, change) + end +end + function addon:UpdateAudit() -- self:Debug("UpdateAudit " .. event) local currentInventory = self:GetCurrentInventory() @@ -266,11 +289,7 @@ totalChange = totalChange + (itemCost * abs(change)) end - local valuePerItem = totalChange / positiveCount - - for link, change in pairs(positive) do - self:SaveValue(link, valuePerItem * change, change) - end + distributeValue(self, totalChange, positive) else self:Debug("No match in UpdateAudit.") end