comparison Modules/Events.lua @ 49:9ff6a3b02332 ticket7

I have changed my mind, price distribution will always be based on the AH price, unless none is available, then all items have the same weight which is what was being done before.
author Asa Ayers <Asa.Ayers@Gmail.com>
date Wed, 21 Jul 2010 01:00:14 -0700
parents 5e981c1df761
children 9c95158236d1
comparison
equal deleted inserted replaced
46:5e981c1df761 49:9ff6a3b02332
222 222
223 function addon:UpdateCurrentInventory() 223 function addon:UpdateCurrentInventory()
224 self.lastInventory = self:GetCurrentInventory() 224 self.lastInventory = self:GetCurrentInventory()
225 end 225 end
226 226
227 local function distributeValueByAHValue(self, totalValue, targetItems) 227 local function distributeValue(self, totalValue, targetItems)
228 228
229 local weights = {} 229 local weights = {}
230 local totalWeight = 0 230 local totalWeight = 0
231 for link, change in pairs(targetItems) do 231 for link, change in pairs(targetItems) do
232 --[[ 232 --[[
245 for link, change in pairs(targetItems) do 245 for link, change in pairs(targetItems) do
246 self:SaveValue(link, weights[link] * valuePerPoint, change) 246 self:SaveValue(link, weights[link] * valuePerPoint, change)
247 end 247 end
248 end 248 end
249 249
250 local function distributeValue(self, totalValue, targetItems)
251 if true then
252 return distributeValueByAHValue(self, totalValue, targetItems)
253 else
254 local valuePerItem = totalChange / positiveCount
255
256 for link, change in pairs(targetItems) do
257 self:SaveValue(link, valuePerItem * change, change)
258 end
259 end
260 end
261
262 function addon:UpdateAudit() 250 function addon:UpdateAudit()
263 -- self:Debug("UpdateAudit " .. event) 251 -- self:Debug("UpdateAudit " .. event)
264 local currentInventory = self:GetCurrentInventory() 252 local currentInventory = self:GetCurrentInventory()
265 local diff = addon:GetInventoryDiff(self.lastInventory, currentInventory) 253 local diff = addon:GetInventoryDiff(self.lastInventory, currentInventory)
266 254