Mercurial > wow > inventory
changeset 156:314943963155
Added initial guild bank data excluding (for addons like DataStore). This setting is currently not stored on relog.
author | Zerotorescue |
---|---|
date | Sat, 22 Jan 2011 02:57:08 +0100 |
parents | 5081056cade1 |
children | e136c99fe5bb |
files | Core.lua Modules/Config.lua Plugins/ItemCountAddons/DataStore (with guilds).lua |
diffstat | 3 files changed, 103 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/Core.lua Sat Jan 22 01:46:17 2011 +0100 +++ b/Core.lua Sat Jan 22 02:57:08 2011 +0100 @@ -427,26 +427,28 @@ function IMRegisterPricingAddon(name, get, enabled, onSelect) addon.supportedAddons.auctionPricing[name] = { - GetValue = get, - IsEnabled = enabled, - OnSelect = onSelect, + ["GetValue"] = get, + ["IsEnabled"] = enabled, + ["OnSelect"] = onSelect, }; end -function IMRegisterItemCountAddon(name, getTotal, getCharacter, enabled, onSelect) +function IMRegisterItemCountAddon(name, getTotal, getCharacter, enabled, onSelect, getGuildNames, setGuildState) addon.supportedAddons.itemCount[name] = { - GetTotalCount = getTotal, - GetCharacterCount = getCharacter, - IsEnabled = enabled, - OnSelect = onSelect, + ["GetTotalCount"] = getTotal, + ["GetCharacterCount"] = getCharacter, + ["IsEnabled"] = enabled, + ["OnSelect"] = onSelect, + ["GetGuildNames"] = getGuildNames, + ["SetGuildState"] = setGuildState, }; end function IMRegisterCraftingAddon(name, queue, enabled, onSelect) addon.supportedAddons.crafting[name] = { - Queue = queue, - IsEnabled = enabled, - OnSelect = onSelect, + ["Queue"] = queue, + ["IsEnabled"] = enabled, + ["OnSelect"] = onSelect, }; end
--- a/Modules/Config.lua Sat Jan 22 01:46:17 2011 +0100 +++ b/Modules/Config.lua Sat Jan 22 02:57:08 2011 +0100 @@ -1782,8 +1782,65 @@ }, }, }, + guildSelection = { + order = 15, + type = "group", + inline = true, + name = "Filter item count data", + args = { + description = { + order = 0, + type = "description", + name = "Change which data sources are used in the item counts.", + hidden = function() return addon.db.profile.defaults.hideHelp; end, + }, + header = { + order = 5, + type = "header", + name = "", + hidden = function() return addon.db.profile.defaults.hideHelp; end, + }, + guilds = { + order = 20, + type = "multiselect", + width = "double", + name = "Include guild bank data", + desc = "Select which guild data should be included in the item counts.", + values = function() + local temp = {}; + + local currentAddon, selectedAddonName = addon:GetItemCountAddon(groupName); + + if currentAddon.GetGuildNames then + local guilds = currentAddon.GetGuildNames(); + + if guilds and type(guilds) == "table" then + for guildName, state in pairs(guilds) do + temp[guildName] = guildName; + end + end + end + + return temp; + end, + get = function(i, v) + local currentAddon, selectedAddonName = addon:GetItemCountAddon(groupName); + + return currentAddon.GetGuildNames and currentAddon.GetGuildNames()[v]; + end, + set = function(i, v, e) + local currentAddon, selectedAddonName = addon:GetItemCountAddon(groupName); + + if currentAddon.SetGuildState then + currentAddon:SetGuildState(v, e); + end + end, -- can't be nil or the defaults will be used + dialogControl = "Dropdown", -- this is not standard, normal multiselect control gives us a list of all chars with toggle-boxes. UGLY! We want a multiselect-box instead. + }, + }, + }, export = { - order = 30, + order = 20, type = "group", inline = true, name = "Export groups",
--- a/Plugins/ItemCountAddons/DataStore (with guilds).lua Sat Jan 22 01:46:17 2011 +0100 +++ b/Plugins/ItemCountAddons/DataStore (with guilds).lua Sat Jan 22 02:57:08 2011 +0100 @@ -1,4 +1,34 @@ do + local disabledGuilds = {}; + + local function GetGuildNames() + local guilds = {}; + + local realm = GetRealmName(); + + -- Process all accounts + for accountName in pairs(DataStore:GetAccounts()) do + for guildName, guild in pairs(DataStore:GetGuilds(realm, accountName)) do + + if disabledGuilds[guildName] then + guilds[guildName] = false; + else + guilds[guildName] = true; + end + + end + end + + return guilds; + end + + local function SetGuildState(guildName, state) + if not state then + disabledGuilds[guildName] = true; + else + disabledGuilds[guildName] = nil; + end + end local function GetTotalCount(itemId) local realm = GetRealmName(); @@ -23,7 +53,7 @@ -- Process all guilds for guildName, guild in pairs(DataStore:GetGuilds(realm, accountName)) do - if not guilds[guildName] then + if not guilds[guildName] and not disabledGuilds[guildName] then -- We don't want itemcounts from a single guild to be counted twice, so first to present data wins guilds[guildName] = true; @@ -53,6 +83,6 @@ return (DataStore and DataStore.GetContainerItemCount and DataStore.GetAuctionHouseItemCount and DataStore.GetMailItemCount); end - IMRegisterItemCountAddon("DataStore (with guilds)", GetTotalCount, GetCharacterCount, IsEnabled); + IMRegisterItemCountAddon("DataStore (with guilds)", GetTotalCount, GetCharacterCount, IsEnabled, nil, GetGuildNames, SetGuildState); end