Mercurial > wow > itemauditor
diff Core.lua @ 4:c940b527ccab
Fixed Milling. Disenchating will probably have to be fixed the same way
author | Asa Ayers <Asa.Ayers@Gmail.com> |
---|---|
date | Sat, 22 May 2010 15:23:11 -0700 |
parents | bbcf81868171 |
children | 7d0f4ebedf8c |
line wrap: on
line diff
--- a/Core.lua Sat May 22 11:34:19 2010 -0700 +++ b/Core.lua Sat May 22 15:23:11 2010 -0700 @@ -131,23 +131,29 @@ end end +local defaultBagDelay = 0.2 + function addon:WatchBags(delay) - if self.watch_handle == nil then - delay = delay or 0.2 - self.lastInventory = self:GetCurrentInventory() - self.watch_handle = self:RegisterBucketEvent({"BAG_UPDATE", "PLAYER_MONEY"}, delay, "UpdateAudit") - end + delay = delay or defaultBagDelay + if delay ~= self.currentBagDelay then + self:UnwatchBags() + end + + if self.watch_handle == nil then + self.currentBagDelay = delay + self:Debug("currentBagDelay = " .. delay) + addon:UpdateCurrentInventory() + self.watch_handle = self:RegisterBucketEvent({"BAG_UPDATE", "PLAYER_MONEY"}, self.currentBagDelay, "UpdateAudit") + end end function addon:UnwatchBags() - if self.watch_handle ~= nil then - self:UnregisterBucket(self.watch_handle) - self.watch_handle = nil - end + if self.watch_handle ~= nil then + self:UnregisterBucket(self.watch_handle) + self.watch_handle = nil + end end - - function addon:GetItemCost(itemName, countModifier) local invested = abs(self.db.factionrealm.item_account[itemName] or 0)