Mercurial > wow > itemauditor
comparison Core.lua @ 141:15a259503d63
Adding some debugging code to help fix ticket 46.
| author | Asa Ayers <Asa.Ayers@Gmail.com> |
|---|---|
| date | Mon, 04 Oct 2010 19:01:46 -0700 |
| parents | 7e1496b25311 |
| children | 03e108d12ef1 |
comparison
equal
deleted
inserted
replaced
| 140:828cd9bf919e | 141:15a259503d63 |
|---|---|
| 377 end | 377 end |
| 378 | 378 |
| 379 local realm = GetRealmName() | 379 local realm = GetRealmName() |
| 380 local ds_account = 'Default' | 380 local ds_account = 'Default' |
| 381 function ItemAuditor:GetItemCount(searchID) | 381 function ItemAuditor:GetItemCount(searchID) |
| 382 self:Debug('ItemAuditor:GetItemCount(%s)', tostring(searchID)) | |
| 382 local count = 0 | 383 local count = 0 |
| 383 for _, character in pairs(DataStore:GetCharacters(realm, ds_account)) do | 384 for _, character in pairs(DataStore:GetCharacters(realm, ds_account)) do |
| 384 if DataStore:GetCharacterFaction(character) == UnitFactionGroup("player") then | 385 if DataStore:GetCharacterFaction(character) == UnitFactionGroup("player") then |
| 385 local bag, bank = DataStore:GetContainerItemCount(character, searchID) | 386 local bag, bank = DataStore:GetContainerItemCount(character, searchID) |
| 386 count = count + (bag or 0) + (bank or 0) | 387 count = count + (bag or 0) + (bank or 0) |
| 387 count = count + (DataStore:GetAuctionHouseItemCount(character, searchID) or 0) | 388 count = count + (DataStore:GetAuctionHouseItemCount(character, searchID) or 0) |
| 388 count = count + (DataStore:GetInventoryItemCount(character, searchID) or 0) | 389 count = count + (DataStore:GetInventoryItemCount(character, searchID) or 0) |
| 389 count = count + (DataStore:GetMailItemCount(character, searchID) or 0) | 390 count = count + (DataStore:GetMailItemCount(character, searchID) or 0) |
| 390 count = count + (DataStore:GetCurrencyItemCount(character, searchID) or 0) | 391 count = count + (DataStore:GetCurrencyItemCount(character, searchID) or 0) |
| 391 end | 392 else |
| 392 end | 393 self:Debug('Skipping %s', character) |
| 394 end | |
| 395 end | |
| 396 self:Debug('before guild count: %s', count) | |
| 393 for guildName in pairs(self.db.factionrealm.enabled_guilds) do | 397 for guildName in pairs(self.db.factionrealm.enabled_guilds) do |
| 394 count = count + DataStore:GetGuildBankItemCount(DataStore:GetGuilds()[guildName], searchID) | 398 count = count + DataStore:GetGuildBankItemCount(DataStore:GetGuilds()[guildName], searchID) |
| 395 end | 399 end |
| 400 self:Debug('after guild count: %s', count) | |
| 396 | 401 |
| 397 local itemName = GetItemInfo(searchID) | 402 local itemName = GetItemInfo(searchID) |
| 398 for character, mailbox in pairs(allMailboxes) do | 403 for character, mailbox in pairs(allMailboxes) do |
| 399 for type, items in pairs(mailbox) do | 404 for type, items in pairs(mailbox) do |
| 400 if type == 'AHWon' or type == 'COD' then | 405 if type == 'AHWon' or type == 'COD' then |
| 401 for name, data in pairs(items) do | 406 for name, data in pairs(items) do |
| 402 if name == itemName then | 407 if name == itemName then |
| 403 count = count - data.count | 408 count = count - data.count |
| 404 | 409 self:Debug('removing mail %s %s %s', character, type, data.count) |
| 405 end | 410 end |
| 406 end | 411 end |
| 407 end | 412 end |
| 408 end | 413 end |
| 409 end | 414 end |
