comparison Modules/Events.lua @ 15:44e70a3fdb19

Merged utils into ItemAuditor.
author Asa Ayers <Asa.Ayers@Gmail.com>
date Sat, 03 Jul 2010 07:40:01 -0700
parents 8c83d5f6e306
children ff9a698caebc
comparison
equal deleted inserted replaced
14:6fc9fbaa94b3 15:44e70a3fdb19
96 negative[item] = count 96 negative[item] = count
97 negativeCount = negativeCount + abs(count) 97 negativeCount = negativeCount + abs(count)
98 end 98 end
99 end 99 end
100 100
101 if diff.money > 0 and utils:tcount(positive) > 0 and utils:tcount(negative) == 0 then 101 if diff.money > 0 and self:tcount(positive) > 0 and self:tcount(negative) == 0 then
102 -- self:Debug("loot") 102 self:Debug("loot")
103 elseif utils:tcount(diff.items) == 1 then 103 elseif self:tcount(diff.items) == 1 then
104 -- self:Debug("purchase or sale") 104 self:Debug("purchase or sale")
105 105
106 for link, count in pairs(diff.items) do 106 for link, count in pairs(diff.items) do
107 self:SaveValue(link, 0 - diff.money) 107 self:SaveValue(link, 0 - diff.money)
108 end 108 end
109 elseif utils:tcount(diff.items) > 1 then 109 elseif self:tcount(diff.items) > 1 then
110 110
111 if utils:tcount(positive) > 0 and utils:tcount(negative) > 0 then 111 if self:tcount(positive) > 0 and self:tcount(negative) > 0 then
112 -- we must have created/converted something 112 -- we must have created/converted something
113 -- self:Debug("conversion") 113 self:Debug("conversion")
114 114
115 local totalChange = 0 115 local totalChange = 0
116 for link, change in pairs(negative) do 116 for link, change in pairs(negative) do
117 local _, itemCost, count = self:GetItemCost(link, change) 117 local _, itemCost, count = self:GetItemCost(link, change)
118 self:SaveValue(link, itemCost * change) 118 self:SaveValue(link, itemCost * change)