Mercurial > wow > itemauditor
changeset 52:9c95158236d1
Fixed the way I was calculating the value when distributing cost among multiple items.
author | Asa Ayers <Asa.Ayers@Gmail.com> |
---|---|
date | Wed, 21 Jul 2010 20:36:56 -0700 |
parents | 84bfb5469189 |
children | c6c98fc1be8e |
files | Modules/Events.lua |
diffstat | 1 files changed, 3 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/Modules/Events.lua Wed Jul 21 01:22:30 2010 -0700 +++ b/Modules/Events.lua Wed Jul 21 20:36:56 2010 -0700 @@ -235,15 +235,14 @@ 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) + local ap = (addon:GetAuctionPrice(link) or 1) * change 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) + local value = totalValue * (weights[link]/totalWeight) + self:SaveValue(link, value, change) end end