comparison Modules/Scanner.lua @ 89:a12d22ef3f39

AceSerializer has been enabled again as it?s used when exporting/importing groups. All other unused libraries are now really removed. Adjusted debug function to format only when a debug channel is available. Fixed moving from guild banks, checking if items are locked is different then with banks. Now unregistering the item locking event so it doesn?t continue to try to move every time an item is switched after the automated cycle has finished. (geeezus, this description is a total overkill) Fixed item queueing. Queue all when there?s a group without any items inside no longer crashes. Removing cached container data after closing a container.
author Zerotorescue
date Fri, 07 Jan 2011 22:19:03 +0100
parents 3bec0ea44607
children 31493364b163
comparison
equal deleted inserted replaced
88:f1c035694545 89:a12d22ef3f39
13 function mod:ClearCache() 13 function mod:ClearCache()
14 table.wipe(itemCache); 14 table.wipe(itemCache);
15 end 15 end
16 16
17 function mod:CacheLocation(location, remember) 17 function mod:CacheLocation(location, remember)
18 -- Reset cache just in case it was filled
19 self:ClearCache();
20
18 if location == addon.Locations.Bag or location == addon.Locations.Bank then 21 if location == addon.Locations.Bag or location == addon.Locations.Bank then
19 -- Reset cache just in case it was filled
20 self:ClearCache();
21
22 local start, stop; 22 local start, stop;
23 if location == addon.Locations.Bag then 23 if location == addon.Locations.Bag then
24 start = 0; 24 start = 0;
25 stop = NUM_BAG_SLOTS; 25 stop = NUM_BAG_SLOTS;
26 else 26 else
58 -- Continue scanning a different slot 58 -- Continue scanning a different slot
59 slotId = (slotId - 1); 59 slotId = (slotId - 1);
60 end 60 end
61 end 61 end
62 elseif location == addon.Locations.Guild then 62 elseif location == addon.Locations.Guild then
63 -- Reset cache before we scan
64 self:ClearCache();
65
66 for tabId = 1, GetNumGuildBankTabs() do 63 for tabId = 1, GetNumGuildBankTabs() do
67 local isViewable = select(3, GetGuildBankTabInfo(tabId)); 64 local isViewable = select(3, GetGuildBankTabInfo(tabId));
68 65
69 if isViewable == 1 then 66 if isViewable == 1 then
70 local slotId = (MAX_GUILDBANK_SLOTS_PER_TAB or 98); -- start by scanning the last slot 67 local slotId = (MAX_GUILDBANK_SLOTS_PER_TAB or 98); -- start by scanning the last slot
188 end 185 end
189 186
190 function mod:BANKFRAME_CLOSED() 187 function mod:BANKFRAME_CLOSED()
191 addon:Debug("Scanner:BANKFRAME_CLOSED"); 188 addon:Debug("Scanner:BANKFRAME_CLOSED");
192 189
190 self:ClearCache();
191
193 mod:UnregisterEvent("BANKFRAME_CLOSED"); 192 mod:UnregisterEvent("BANKFRAME_CLOSED");
194 193
195 StaticPopup_Hide("InventoriumRefill"); 194 StaticPopup_Hide("InventoriumRefill");
196 end 195 end
197 196
206 end 205 end
207 end 206 end
208 207
209 function mod:DoScanGuild() 208 function mod:DoScanGuild()
210 if not scanned then 209 if not scanned then
211 addon:Debug("Scanner:GUILDBANKBAGSLOTS_CHANGED"); 210 addon:Debug("Scanner:DoScanGuild");
212 211
213 scanned = true; 212 scanned = true;
214 213
215 self:Scan(addon.Locations.Guild); 214 self:Scan(addon.Locations.Guild);
216 end 215 end
218 217
219 function mod:GUILDBANKFRAME_CLOSED() 218 function mod:GUILDBANKFRAME_CLOSED()
220 addon:Debug("Scanner:GUILDBANKFRAME_CLOSED"); 219 addon:Debug("Scanner:GUILDBANKFRAME_CLOSED");
221 220
222 scanned = nil; 221 scanned = nil;
222 self:ClearCache();
223 223
224 self:UnregisterEvent("GUILDBANKFRAME_CLOSED"); 224 self:UnregisterEvent("GUILDBANKFRAME_CLOSED");
225 self:UnregisterEvent("GUILDBANKBAGSLOTS_CHANGED"); 225 self:UnregisterEvent("GUILDBANKBAGSLOTS_CHANGED");
226 226
227 self:CancelTimer(tmrScanGuild, true); -- silent 227 self:CancelTimer(tmrScanGuild, true); -- silent