Zerotorescue@17: do Zerotorescue@17: Zerotorescue@17: local function GetTotalCount(itemId) Zerotorescue@17: local realm = GetRealmName(); Zerotorescue@17: Zerotorescue@17: local totalCount = 0; Zerotorescue@17: Zerotorescue@17: -- Process all charracters on this account (GetCharacters defaults to THIS_ACCOUNT) Zerotorescue@17: for characterName, character in pairs(DataStore:GetCharacters(realm, nil)) do Zerotorescue@17: -- Get only useful info (currency / gear shouldn't contain the stuff we are interested in) Zerotorescue@54: local bag, bank = DataStore:GetContainerItemCount(character, itemId) or 0, 0; Zerotorescue@54: local auctionHouse = DataStore:GetAuctionHouseItemCount(character, itemId) or 0; Zerotorescue@54: local mail = DataStore:GetMailItemCount(character, itemId) or 0; Zerotorescue@17: Zerotorescue@17: totalCount = totalCount + bag + bank + auctionHouse + mail; Zerotorescue@17: end Zerotorescue@17: Zerotorescue@17: return totalCount or -1; Zerotorescue@17: end Zerotorescue@17: Zerotorescue@17: local function GetCharacterCount(itemId) Zerotorescue@17: local character = DataStore:GetCharacter(); Zerotorescue@17: Zerotorescue@54: local bag, bank = DataStore:GetContainerItemCount(character, itemId) or 0, 0; Zerotorescue@54: local auctionHouse = DataStore:GetAuctionHouseItemCount(character, itemId) or 0; Zerotorescue@54: local mail = DataStore:GetMailItemCount(character, itemId) or 0; Zerotorescue@17: Zerotorescue@17: return bag, bank, auctionHouse, mail; Zerotorescue@17: end Zerotorescue@17: Zerotorescue@17: local function IsEnabled() Zerotorescue@17: return (DataStore and DataStore.GetContainerItemCount and DataStore.GetAuctionHouseItemCount and DataStore.GetMailItemCount); Zerotorescue@17: end Zerotorescue@17: Zerotorescue@17: IMRegisterItemCountAddon("DataStore (current account only)", GetTotalCount, GetCharacterCount, IsEnabled); Zerotorescue@17: Zerotorescue@17: end