comparison ItemCountAddons/DataStore (current account only).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
6 local totalCount = 0; 6 local totalCount = 0;
7 7
8 -- Process all charracters on this account (GetCharacters defaults to THIS_ACCOUNT) 8 -- Process all charracters on this account (GetCharacters defaults to THIS_ACCOUNT)
9 for characterName, character in pairs(DataStore:GetCharacters(realm, nil)) do 9 for characterName, character in pairs(DataStore:GetCharacters(realm, nil)) do
10 -- Get only useful info (currency / gear shouldn't contain the stuff we are interested in) 10 -- Get only useful info (currency / gear shouldn't contain the stuff we are interested in)
11 local bag, bank = DataStore:GetContainerItemCount(character, itemId); 11 local bag, bank = DataStore:GetContainerItemCount(character, itemId) or 0, 0;
12 local auctionHouse = DataStore:GetAuctionHouseItemCount(character, itemId); 12 local auctionHouse = DataStore:GetAuctionHouseItemCount(character, itemId) or 0;
13 local mail = DataStore:GetMailItemCount(character, itemId); 13 local mail = DataStore:GetMailItemCount(character, itemId) or 0;
14 14
15 totalCount = totalCount + bag + bank + auctionHouse + mail; 15 totalCount = totalCount + bag + bank + auctionHouse + mail;
16 end 16 end
17 17
18 return totalCount or -1; 18 return totalCount or -1;
19 end 19 end
20 20
21 local function GetCharacterCount(itemId) 21 local function GetCharacterCount(itemId)
22 local character = DataStore:GetCharacter(); 22 local character = DataStore:GetCharacter();
23 23
24 local bag, bank = DataStore:GetContainerItemCount(character, itemId); 24 local bag, bank = DataStore:GetContainerItemCount(character, itemId) or 0, 0;
25 local auctionHouse = DataStore:GetAuctionHouseItemCount(character, itemId); 25 local auctionHouse = DataStore:GetAuctionHouseItemCount(character, itemId) or 0;
26 local mail = DataStore:GetMailItemCount(character, itemId); 26 local mail = DataStore:GetMailItemCount(character, itemId) or 0;
27 27
28 return bag, bank, auctionHouse, mail; 28 return bag, bank, auctionHouse, mail;
29 end 29 end
30 30
31 local function IsEnabled() 31 local function IsEnabled()