diff Core.lua @ 35:31e5da6a2b16

Added a description for which item count addon is used. Virtual group option should no longer get disabled.
author Zerotorescue
date Wed, 03 Nov 2010 19:38:53 +0100
parents e732843b16d2
children 58fb38f0b447
line wrap: on
line diff
--- a/Core.lua	Sat Oct 30 23:08:25 2010 +0200
+++ b/Core.lua	Wed Nov 03 19:38:53 2010 +0100
@@ -520,7 +520,7 @@
 								"Since this is a beta some functionality might not be implemented yet while the options are available (usually - but not always - tagged as \"NYI\"). These options are used to indicate a feature is on the way and will be implemented before Inventorium is tagged as a release.\n\n" .. 
 								"Please request things you want and report anything that's clunky, weird, vague or otherwise buggy at |cfffed000the Inventorium development addon page|r. You can find this by searching for \"|cfffed000Inventorium|r\" at |cfffed000CurseForge.com|r.\n\n" .. 
 								"Tutorials for Inventorium will be created after the first stable release. If you require any help before that you can always contact me in the |cfffed000#JMTC|r IRC channel at |cfffed000QuakeNet.org|r. You may also report issues and request things there if you wish.\n\n" .. 
-								"You might notice the summary window currently gets very slow when refreshed once you get over 100-200 items in the list, this is a known issue and will be fixed in version 1.1 (which is after the initial release).",
+								"You might notice the summary window currently gets very slow when refreshed once you get over 100-200 items in the list, this is a known issue and will be fixed in |cfffed000version 1.1|r (which is after the initial release).",
 					},
 				},
 			},
@@ -533,7 +533,27 @@
 					description = {
 						order = 0,
 						type = "description",
-						name = "Here you can set general settings. The settings entered here will be used when you choose not to override the settings within an individual group.",
+						name = function()
+							local t = "Here you can set general settings. The settings entered here will be used when you choose not to override the settings within an individual group.\n\n";
+							
+							local currentAddon, selectedAddonName = addon:GetItemCountAddon();
+							
+							if currentAddon then
+								--GetCharacterCount
+								--self.supportedAddons.itemCount[selectedExternalAddon]
+								t = t .. "Currently using |cfffed000" .. selectedAddonName .. "|r as your item count addon. This addon is " .. ((currentAddon.IsEnabled() and "|cff00ff00enabled|r") or "|cffff0000disabled|r") .. ".";
+								
+								if currentAddon.GetTotalCount and currentAddon.GetCharacterCount then
+									t = t .. " This addon supports |cfffed000both total as local|r item counts.";
+								elseif currentAddon.GetTotalCount then
+									t = t .. " This addon supports |cfffed000only total|r item counts.";
+								elseif currentAddon.GetCharacterCount then
+									t = t .. " This addon supports |cfffed000only local|r item counts.";
+								end
+							end
+							
+							return t;
+						end,
 					},
 					header = {
 						order = 5,
@@ -909,7 +929,7 @@
 	local groupName = groupIdToName[info[2]];
 	local optionName = info[#info];
 	
-	if optionName:find("override") then
+	if optionName:find("override") or not info.arg then
 		return false;
 	end
 	
@@ -1139,7 +1159,29 @@
 						description = {
 							order = 0,
 							type = "description",
-							name = "Here you can set general settings for the currently selected group. If you do not wish to override a setting, the default setting specified in the general group will be used.",
+							name = function(info)
+								local groupName = groupIdToName[info[2]];
+								
+								local t = "Here you can set general settings for the currently selected group. If you do not wish to override a setting, the default setting specified in the general group will be used.\n\n";
+								
+								local currentAddon, selectedAddonName = addon:GetItemCountAddon(groupName);
+								
+								if currentAddon then
+									--GetCharacterCount
+									--self.supportedAddons.itemCount[selectedExternalAddon]
+									t = t .. "Currently using |cfffed000" .. selectedAddonName .. "|r as your item count addon. This addon is " .. ((currentAddon.IsEnabled() and "|cff00ff00enabled|r") or "|cffff0000disabled|r") .. ".";
+									
+									if currentAddon.GetTotalCount and currentAddon.GetCharacterCount then
+										t = t .. " This addon supports |cfffed000both total as local|r item counts.";
+									elseif currentAddon.GetTotalCount then
+										t = t .. " This addon supports |cfffed000only total|r item counts.";
+									elseif currentAddon.GetCharacterCount then
+										t = t .. " This addon supports |cfffed000only local|r item counts.";
+									end
+								end
+								
+								return t;
+							end,
 						},
 						header = {
 							order = 5,
@@ -1259,6 +1301,7 @@
 								
 								addon.db.global.groups[groupName][optionName] = value ~= "" and value;
 							end,
+							disabled = false,
 						},
 					},
 				},
@@ -2063,28 +2106,34 @@
 
 -- General functions used addon-wide
 
+function addon:GetItemCountAddon(group)
+	local selectedExternalAddon = self:GetOptionByKey(group, "itemCountAddon");
+	
+	if self.supportedAddons.itemCount[selectedExternalAddon] and self.supportedAddons.itemCount[selectedExternalAddon].IsEnabled() then
+		-- Try to use the default item count addon
+		
+		return self.supportedAddons.itemCount[selectedExternalAddon], selectedExternalAddon;
+	else
+		-- Default not available, get the first one then
+		
+		for name, value in pairs(self.supportedAddons.itemCount) do
+			if value.IsEnabled() then
+				return value, name;
+			end
+		end
+	end
+	
+	return;
+end
+
 function addon:GetItemCount(itemId, group)
 	itemId = tonumber(itemId);
 	
 	if not itemId then return; end
 	
-	local selectedExternalAddon = self:GetOptionByKey(group, "itemCountAddon");
+	local itemCountAddon = self:GetItemCountAddon(group);
 	
-	if self.supportedAddons.itemCount[selectedExternalAddon] and self.supportedAddons.itemCount[selectedExternalAddon].IsEnabled() then
-		-- Try to use the default item count addon
-		
-		return self.supportedAddons.itemCount[selectedExternalAddon].GetTotalCount(itemId);
-	else
-		-- Default not available, get the first one then
-		
-		for name, value in pairs(self.supportedAddons.itemCount) do
-			if value.IsEnabled() then
-				return value.GetTotalCount(itemId);
-			end
-		end
-	end
-	
-	return -1;
+	return (itemCountAddon and itemCountAddon.GetTotalCount(itemId)) or -1;
 end
 
 function addon:GetAuctionValue(itemLink, group)