comparison Modules/Events.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
comparison
equal deleted inserted replaced
3:bbcf81868171 4:c940b527ccab
3 3
4 local utils = addonTable.utils 4 local utils = addonTable.utils
5 5
6 function addon:PLAYER_ENTERING_WORLD() 6 function addon:PLAYER_ENTERING_WORLD()
7 self:RegisterEvent("MAIL_SHOW") 7 self:RegisterEvent("MAIL_SHOW")
8 self:RegisterEvent("UNIT_SPELLCAST_START")
8 self:WatchBags() 9 self:WatchBags()
9 end 10 end
10 11
11 function addon:MAIL_SHOW() 12 function addon:MAIL_SHOW()
12 self:Debug("MAIL_SHOW") 13 self:Debug("MAIL_SHOW")
39 end 40 end
40 41
41 self.lastMailScan = newScan 42 self.lastMailScan = newScan
42 end 43 end
43 44
44 function addon:UNIT_SPELLCAST_SENT(target, spell) 45 function addon:UNIT_SPELLCAST_START(event, target, spell)
45 if target == "player" and spell = "Milling" then 46 if target == "player" and spell == "Milling" then
46 47 self:UnwatchBags()
48 self:UpdateCurrentInventory()
49 self:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED")
50 self:RegisterEvent("LOOT_CLOSED")
47 end 51 end
48 end 52 end
49 53
50 function addon:UNIT_SPELLCAST_INTERRUPTED(target, spell) 54 --[[
55 The item should be destroyed before this point, so the last inventory check
56 needs to be kept so it can be combined with the up coming loot.
57 ]]
58 function addon:LOOT_CLOSED()
59 self:UnregisterEvent("LOOT_CLOSED")
60 self:UnregisterEvent("UNIT_SPELLCAST_INTERRUPTED")
61 local inventory = self.lastInventory
62 self:WatchBags()
63 self.lastInventory = inventory
64 end
51 65
66 function addon:UNIT_SPELLCAST_INTERRUPTED(event, target, spell)
67 if target == "player" and spell == "Milling" then
68 self:UnregisterEvent("UNIT_SPELLCAST_INTERRUPTED")
69 self:UnregisterEvent("LOOT_CLOSED")
70 self:WatchBags()
71 end
72 end
73
74 function addon:UpdateCurrentInventory()
75 self.lastInventory = self:GetCurrentInventory()
52 end 76 end
53 77
54 function addon:UpdateAudit() 78 function addon:UpdateAudit()
55 self:Debug("UpdateAudit") 79 self:Debug("UpdateAudit")
56 local currentInventory = self:GetCurrentInventory() 80 local currentInventory = self:GetCurrentInventory()
100 end 124 end
101 end 125 end
102 end 126 end
103 127
104 self.lastInventory = currentInventory 128 self.lastInventory = currentInventory
129 addon:WatchBags()
105 end 130 end