Quantcast

Added a configurable (1-50) maximum for the number of unknown recipes to be shown in vendor/trainer/mob tooltips.

James D. Callahan III [07-05-10 - 05:53]
Added a configurable (1-50) maximum for the number of unknown recipes to be shown in vendor/trainer/mob tooltips.
Filename
ARL.lua
Config.lua
Locales/devel-enUS.lua
diff --git a/ARL.lua b/ARL.lua
index ff7179f..65d0fbc 100644
--- a/ARL.lua
+++ b/ARL.lua
@@ -223,6 +223,7 @@ function addon:OnInitialize()
 			spelltooltiplocation = "Right",
 			acquiretooltiplocation = "Right",
 			recipes_in_tooltips = true,
+			max_recipes_in_tooltips = 10,
 			hide_tooltip_hint = false,
 			hidepopup = false,
 			minimap = true,
@@ -505,6 +506,7 @@ function addon:OnInitialize()
 			       end
 			       local recipe_list = private.recipe_list
 			       local shifted = IsShiftKeyDown()
+			       local count = 0

 			       for spell_id in pairs(unit.item_list) do
 				       local recipe = recipe_list[spell_id]
@@ -519,8 +521,13 @@ function addon:OnInitialize()
 						       local _, _, _, hex = GetItemQualityColor(recipe.quality)

 						       self:AddLine(string.format("%s: %s%s|r (%d)", recipe.profession, hex, recipe.name, recipe.skill_level))
+						       count = count + 1
 					       end
 				       end
+
+				       if count >= addon.db.profile.max_recipes_in_tooltips then
+					       break
+				       end
 			       end
 		       end)
 end
diff --git a/Config.lua b/Config.lua
index ecdd9a2..1102b27 100644
--- a/Config.lua
+++ b/Config.lua
@@ -679,10 +679,14 @@ local function giveDisplay()
 							  }
 						  end,
 				},
-				unit_tooltip = {
+				spacer2 = {
 					order	= 23,
+					type	= "description",
+					name	= "\n",
+				},
+				unit_tooltip = {
+					order	= 24,
 					type	= "toggle",
-					width	= "full",
 					name	= L["Recipes In Tooltips"],
 					desc	= L["UNIT_TOOLTIPS_DESC"],
 					get	= function()
@@ -692,10 +696,28 @@ local function giveDisplay()
 							  addon.db.profile.recipes_in_tooltips = not addon.db.profile.recipes_in_tooltips
 						  end,
 				},
+				unit_max_tooltip = {
+					order	= 25,
+					type	= "range",
+					name	= _G.MAXIMUM,
+					desc	= L["UNIT_MAX_TOOLTIPS_DESC"],
+					min	= 1,
+					max	= 50,
+					step	= 1,
+					bigStep = 5,
+					disabled= function()
+							  return not addon.db.profile.recipes_in_tooltips
+						  end,
+					get	= function()
+							  return addon.db.profile.max_recipes_in_tooltips
+						  end,
+					set	= function(info, v)
+							  addon.db.profile.max_recipes_in_tooltips = v
+						  end,
+				},
 				tooltip_hint = {
-					order	= 24,
+					order	= 26,
 					type	= "toggle",
-					width	= "full",
 					name	= L["TOOLTIP_HINT"],
 					desc	= L["TOOLTIP_HINT_DESC"],
 					get	= function()
diff --git a/Locales/devel-enUS.lua b/Locales/devel-enUS.lua
index de5c121..1d3f71a 100644
--- a/Locales/devel-enUS.lua
+++ b/Locales/devel-enUS.lua
@@ -153,6 +153,9 @@ L["ACQUIRETOOLTIPPOSITION_DESC"] = "Changes the location of the tooltip containi

 L["Recipes In Tooltips"]	= true
 L["UNIT_TOOLTIPS_DESC"]		= "Toggles whether or not to display unknown recipes in the tooltips of the vendors, trainers, or mobs which carry them."
+
+L["UNIT_MAX_TOOLTIPS_DESC"]	= "Maximum number of recipes to show in tooltips."
+
 L["TOOLTIP_HINT"]		= "Hide Hint Text"
 L["TOOLTIP_HINT_DESC"]		= "Hides the hint text at the bottom of the tooltip."