Mercurial > wow > inventory
view ItemCountAddons/DataStore (with 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 |
line wrap: on
line source
do local function GetTotalCount(itemId) local realm = GetRealmName(); local totalCount = 0; local guilds = {}; -- Process all accounts for accountName in pairs(DataStore:GetAccounts()) do -- Process all charracters for characterName, character in pairs(DataStore:GetCharacters(realm, accountName)) do -- Get only useful info (currency / gear shouldn't contain the stuff we are interested in) local bag, bank = DataStore:GetContainerItemCount(character, itemId); local auctionHouse = DataStore:GetAuctionHouseItemCount(character, itemId); local mail = DataStore:GetMailItemCount(character, itemId); totalCount = totalCount + bag + bank + auctionHouse + mail; end -- Process all guilds for guildName, guild in pairs(DataStore:GetGuilds(realm, accountName)) do if not guilds[guildName] then -- We don't want itemcounts from a single guild to be counted twice, so first to present data wins guilds[guildName] = true; local guild = DataStore:GetGuildBankItemCount(guild, itemId); totalCount = totalCount + guild; end end end return totalCount or -1; end local function GetCharacterCount(itemId) local character = DataStore:GetCharacter(); local bag, bank = DataStore:GetContainerItemCount(character, itemId); local auctionHouse = DataStore:GetAuctionHouseItemCount(character, itemId); local mail = DataStore:GetMailItemCount(character, itemId); return bag, bank, auctionHouse, mail; end local function IsEnabled() return (DataStore and DataStore.GetContainerItemCount and DataStore.GetAuctionHouseItemCount and DataStore.GetMailItemCount); end IMRegisterItemCountAddon("DataStore (with guilds)", GetTotalCount, GetCharacterCount, IsEnabled); end