Mercurial > wow > itemauditor
comparison Modules/Events.lua @ 113:52e8cad9ccc4 Release 2010-09-01
Ticket 35 - I found a better solution to prevent bag scanning from interfering with mailing, so both can be done at the same time now.
| author | Asa Ayers <Asa.Ayers@Gmail.com> |
|---|---|
| date | Wed, 01 Sep 2010 23:36:23 -0700 |
| parents | c59d22fac6d1 |
| children | 526036e4358f |
comparison
equal
deleted
inserted
replaced
| 112:619ee0a1ff3b | 113:52e8cad9ccc4 |
|---|---|
| 22 ItemAuditor:HideAllFrames() | 22 ItemAuditor:HideAllFrames() |
| 23 end | 23 end |
| 24 | 24 |
| 25 function ItemAuditor:MAIL_SHOW() | 25 function ItemAuditor:MAIL_SHOW() |
| 26 self:Debug("MAIL_SHOW") | 26 self:Debug("MAIL_SHOW") |
| 27 self:UnwatchBags() | 27 self.mailOpen = true |
| 28 ItemAuditor:UpdateCurrentInventory() | 28 ItemAuditor:UpdateCurrentInventory() |
| 29 self.lastMailScan = self:ScanMail() | 29 self.lastMailScan = self:ScanMail() |
| 30 | 30 |
| 31 self:UnregisterEvent("MAIL_SHOW") | 31 self:UnregisterEvent("MAIL_SHOW") |
| 32 self:RegisterEvent("MAIL_CLOSED") | 32 self:RegisterEvent("MAIL_CLOSED") |
| 185 self:Debug("MAIL_CLOSED") | 185 self:Debug("MAIL_CLOSED") |
| 186 ItemAuditor:UnregisterEvent("MAIL_CLOSED") | 186 ItemAuditor:UnregisterEvent("MAIL_CLOSED") |
| 187 self:MAIL_INBOX_UPDATE() | 187 self:MAIL_INBOX_UPDATE() |
| 188 self:UnregisterEvent("MAIL_INBOX_UPDATE") | 188 self:UnregisterEvent("MAIL_INBOX_UPDATE") |
| 189 self:RegisterEvent("MAIL_SHOW") | 189 self:RegisterEvent("MAIL_SHOW") |
| 190 self:WatchBags() | 190 self.mailOpen = nil |
| 191 end | 191 end |
| 192 | 192 |
| 193 local storedCountDiff | 193 local storedCountDiff |
| 194 function ItemAuditor:MAIL_INBOX_UPDATE() | 194 function ItemAuditor:MAIL_INBOX_UPDATE() |
| 195 self:Debug("MAIL_INBOX_UPDATE") | 195 self:Debug("MAIL_INBOX_UPDATE") |
| 308 Nothing needs to be done, but this will prevent mistakenly attributing | 308 Nothing needs to be done, but this will prevent mistakenly attributing |
| 309 the cost of flights to the first item you pick up. | 309 the cost of flights to the first item you pick up. |
| 310 ]] | 310 ]] |
| 311 elseif diff.money > 0 and self:tcount(positive) > 0 and self:tcount(negative) == 0 then | 311 elseif diff.money > 0 and self:tcount(positive) > 0 and self:tcount(negative) == 0 then |
| 312 self:Debug("loot") | 312 self:Debug("loot") |
| 313 elseif abs(diff.money) > 0 and self:tcount(diff.items) == 1 then | 313 elseif abs(diff.money) > 0 and self:tcount(diff.items) == 1 and not self.mailOpen then |
| 314 self:Debug("purchase or sale") | 314 self:Debug("purchase or sale") |
| 315 | 315 |
| 316 for link, count in pairs(diff.items) do | 316 for link, count in pairs(diff.items) do |
| 317 self:SaveValue(link, 0 - diff.money, count) | 317 self:SaveValue(link, 0 - diff.money, count) |
| 318 end | 318 end |
