annotate ItemCountAddons/DataStore (current account only).lua @ 62:fee06221176f

Seperated the config from Core.lua. Many other code cleaning up for readability. Added local references for much used globals. Moved widgets to a different file for readability. Re-added global function for slash command handling since we do need it for our chat-hyperlinks. Fixed queueing to properly use the track at property of virtual groups. Fixed queueing to display the item id instead of the item link if the item link could not be loaded. Speed slider at the summary now has an interval of 1% down from 5% and rounds rather than ceils it?s value so 101% will become 100% rather than 105%. Now using the right stock properties at the summary. Added a help group to the config.
author Zerotorescue
date Wed, 22 Dec 2010 19:56:55 +0100
parents 06fee4208bf2
children
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 charracters on this account (GetCharacters defaults to THIS_ACCOUNT)
Zerotorescue@17 9 for characterName, character in pairs(DataStore:GetCharacters(realm, nil)) do
Zerotorescue@17 10 -- Get only useful info (currency / gear shouldn't contain the stuff we are interested in)
Zerotorescue@54 11 local bag, bank = DataStore:GetContainerItemCount(character, itemId) or 0, 0;
Zerotorescue@54 12 local auctionHouse = DataStore:GetAuctionHouseItemCount(character, itemId) or 0;
Zerotorescue@54 13 local mail = DataStore:GetMailItemCount(character, itemId) or 0;
Zerotorescue@17 14
Zerotorescue@17 15 totalCount = totalCount + bag + bank + auctionHouse + mail;
Zerotorescue@17 16 end
Zerotorescue@17 17
Zerotorescue@17 18 return totalCount or -1;
Zerotorescue@17 19 end
Zerotorescue@17 20
Zerotorescue@17 21 local function GetCharacterCount(itemId)
Zerotorescue@17 22 local character = DataStore:GetCharacter();
Zerotorescue@17 23
Zerotorescue@54 24 local bag, bank = DataStore:GetContainerItemCount(character, itemId) or 0, 0;
Zerotorescue@54 25 local auctionHouse = DataStore:GetAuctionHouseItemCount(character, itemId) or 0;
Zerotorescue@54 26 local mail = DataStore:GetMailItemCount(character, itemId) or 0;
Zerotorescue@17 27
Zerotorescue@17 28 return bag, bank, auctionHouse, mail;
Zerotorescue@17 29 end
Zerotorescue@17 30
Zerotorescue@17 31 local function IsEnabled()
Zerotorescue@17 32 return (DataStore and DataStore.GetContainerItemCount and DataStore.GetAuctionHouseItemCount and DataStore.GetMailItemCount);
Zerotorescue@17 33 end
Zerotorescue@17 34
Zerotorescue@17 35 IMRegisterItemCountAddon("DataStore (current account only)", GetTotalCount, GetCharacterCount, IsEnabled);
Zerotorescue@17 36
Zerotorescue@17 37 end