comparison ItemCountAddons/DataStore (with guilds).lua @ 54:06fee4208bf2

Altoholic should now properly show an on select message when chosen. Selecting DataStore as item count addons should no longer break. The local item count displayed in the summary is now actually local rather than global.
author Zerotorescue
date Mon, 20 Dec 2010 14:30:31 +0100
parents 8f5c02113c5c
children
comparison
equal deleted inserted replaced
53:4fc49c9a8f2b 54:06fee4208bf2
11 for accountName in pairs(DataStore:GetAccounts()) do 11 for accountName in pairs(DataStore:GetAccounts()) do
12 12
13 -- Process all charracters 13 -- Process all charracters
14 for characterName, character in pairs(DataStore:GetCharacters(realm, accountName)) do 14 for characterName, character in pairs(DataStore:GetCharacters(realm, accountName)) do
15 -- Get only useful info (currency / gear shouldn't contain the stuff we are interested in) 15 -- Get only useful info (currency / gear shouldn't contain the stuff we are interested in)
16 local bag, bank = DataStore:GetContainerItemCount(character, itemId); 16 local bag, bank = DataStore:GetContainerItemCount(character, itemId) or 0, 0;
17 local auctionHouse = DataStore:GetAuctionHouseItemCount(character, itemId); 17 local auctionHouse = DataStore:GetAuctionHouseItemCount(character, itemId) or 0;
18 local mail = DataStore:GetMailItemCount(character, itemId); 18 local mail = DataStore:GetMailItemCount(character, itemId) or 0;
19 19
20 totalCount = totalCount + bag + bank + auctionHouse + mail; 20 totalCount = totalCount + bag + bank + auctionHouse + mail;
21 end 21 end
22 22
23 -- Process all guilds 23 -- Process all guilds
25 if not guilds[guildName] then 25 if not guilds[guildName] then
26 -- We don't want itemcounts from a single guild to be counted twice, so first to present data wins 26 -- We don't want itemcounts from a single guild to be counted twice, so first to present data wins
27 27
28 guilds[guildName] = true; 28 guilds[guildName] = true;
29 29
30 local guild = DataStore:GetGuildBankItemCount(guild, itemId); 30 local guild = DataStore:GetGuildBankItemCount(guild, itemId) or 0;
31 31
32 totalCount = totalCount + guild; 32 totalCount = totalCount + guild;
33 end 33 end
34 end 34 end
35 end 35 end
38 end 38 end
39 39
40 local function GetCharacterCount(itemId) 40 local function GetCharacterCount(itemId)
41 local character = DataStore:GetCharacter(); 41 local character = DataStore:GetCharacter();
42 42
43 local bag, bank = DataStore:GetContainerItemCount(character, itemId); 43 local bag, bank = DataStore:GetContainerItemCount(character, itemId) or 0, 0;
44 local auctionHouse = DataStore:GetAuctionHouseItemCount(character, itemId); 44 local auctionHouse = DataStore:GetAuctionHouseItemCount(character, itemId) or 0;
45 local mail = DataStore:GetMailItemCount(character, itemId); 45 local mail = DataStore:GetMailItemCount(character, itemId) or 0;
46 46
47 return bag, bank, auctionHouse, mail; 47 return bag, bank, auctionHouse, mail;
48 end 48 end
49 49
50 local function IsEnabled() 50 local function IsEnabled()