diff Plugins/ItemCountAddons/DataStore (with guilds).lua @ 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 de18ef96983b
children
line wrap: on
line diff
--- 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