From 3f1019db181747a474eb68099174dfdfc4c276c5 Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Mon, 5 Jul 2010 01:53:22 -0400 Subject: [PATCH] Added a configurable (1-50) maximum for the number of unknown recipes to be shown in vendor/trainer/mob tooltips. --- ARL.lua | 7 +++++++ Config.lua | 30 ++++++++++++++++++++++++++---- Locales/devel-enUS.lua | 3 +++ 3 files changed, 36 insertions(+), 4 deletions(-) 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." -- 1.7.9.5