annotate ItemCountAddons/DataStore (without guilds).lua @ 36:58fb38f0b447
The list of possible commands when you write /im without any arguement will now include commands inserted by modules with their own descriptions.
Clicking a command in this list will now execute it.
The slash command handler function is now a global so you can invoke these through other methods.
Added an optional event function to registering auction pricing addons, when defined this will be executed when the pricing addon gets selected.
Removed the unused ?Override local item data? option.
Added ?AuctionProfitMaster? and ?ZeroAuctions? pricing support. The pricing info displayed in the summary window will be used for this.
Trying to queue without any items in the summary should no longer give an error.
author |
Zerotorescue |
date |
Sat, 20 Nov 2010 17:24:16 +0100 |
parents |
8f5c02113c5c |
children |
06fee4208bf2 |
rev |
line source |
Zerotorescue@17
|
1 do
|
Zerotorescue@17
|
2
|
Zerotorescue@17
|
3 local function GetTotalCount(itemId)
|
Zerotorescue@17
|
4 local realm = GetRealmName();
|
Zerotorescue@17
|
5
|
Zerotorescue@17
|
6 local totalCount = 0;
|
Zerotorescue@17
|
7
|
Zerotorescue@17
|
8 -- Process all accounts
|
Zerotorescue@17
|
9 for accountName in pairs(DataStore:GetAccounts()) do
|
Zerotorescue@17
|
10
|
Zerotorescue@17
|
11 -- Process all charracters
|
Zerotorescue@17
|
12 for characterName, character in pairs(DataStore:GetCharacters(realm, accountName)) do
|
Zerotorescue@17
|
13 -- Get only useful info (currency / gear shouldn't contain the stuff we are interested in)
|
Zerotorescue@17
|
14 local bag, bank = DataStore:GetContainerItemCount(character, itemId);
|
Zerotorescue@17
|
15 local auctionHouse = DataStore:GetAuctionHouseItemCount(character, itemId);
|
Zerotorescue@17
|
16 local mail = DataStore:GetMailItemCount(character, itemId);
|
Zerotorescue@17
|
17
|
Zerotorescue@17
|
18 totalCount = totalCount + bag + bank + auctionHouse + mail;
|
Zerotorescue@17
|
19 end
|
Zerotorescue@17
|
20 end
|
Zerotorescue@17
|
21
|
Zerotorescue@17
|
22 return totalCount or -1;
|
Zerotorescue@17
|
23 end
|
Zerotorescue@17
|
24
|
Zerotorescue@17
|
25 local function GetCharacterCount(itemId)
|
Zerotorescue@17
|
26 local character = DataStore:GetCharacter();
|
Zerotorescue@17
|
27
|
Zerotorescue@17
|
28 local bag, bank = DataStore:GetContainerItemCount(character, itemId);
|
Zerotorescue@17
|
29 local auctionHouse = DataStore:GetAuctionHouseItemCount(character, itemId);
|
Zerotorescue@17
|
30 local mail = DataStore:GetMailItemCount(character, itemId);
|
Zerotorescue@17
|
31
|
Zerotorescue@17
|
32 return bag, bank, auctionHouse, mail;
|
Zerotorescue@17
|
33 end
|
Zerotorescue@17
|
34
|
Zerotorescue@17
|
35 local function IsEnabled()
|
Zerotorescue@17
|
36 return (DataStore and DataStore.GetContainerItemCount and DataStore.GetAuctionHouseItemCount and DataStore.GetMailItemCount);
|
Zerotorescue@17
|
37 end
|
Zerotorescue@17
|
38
|
Zerotorescue@17
|
39 IMRegisterItemCountAddon("DataStore (without guilds)", GetTotalCount, GetCharacterCount, IsEnabled);
|
Zerotorescue@17
|
40
|
Zerotorescue@17
|
41 end
|