Restores tooltip additions to guild store, colors the result names

katkat42 [11-24-14 - 01:55]
Restores tooltip additions to guild store, colors the result names
Filename
Common.lua
Inventory.lua
SousChef.lua
Strings.lua
diff --git a/Common.lua b/Common.lua
index fd228d6..e2acf4a 100644
--- a/Common.lua
+++ b/Common.lua
@@ -111,7 +111,7 @@ function SousChef.AddDetails(row)
 		bagId = slotIndex
 		slotIndex = nil
 	end
-	local itemLink = (slotIndex and GetItemLink(bagId, slotIndex)) or (rowInfo.lootId and GetLootItemLink(bagId)) or (GetStoreItemLink(bagId))
+	local itemLink = (slotIndex and GetItemLink(bagId, slotIndex)) or (rowInfo.lootId and GetLootItemLink(bagId)) or (TRADING_HOUSE:IsAtTradingHouse() and GetTradingHouseSearchResultItemLink(bagId)) or (GetStoreItemLink(bagId))

 	-- item is a recipe
 	if GetItemLinkItemType(itemLink) == ITEMTYPE_RECIPE then
@@ -140,7 +140,7 @@ function SousChef.AddDetails(row)
 		ZO_Tooltip_AddDivider(ItemTooltip)
 		ItemTooltip:AddLine(str.TOOLTIP_USED_IN, "ZoFontWinH5", 1,1,1, BOTTOM, MODIFY_TEXT_TYPE_UPPERCASE)
 	    for i,v in ipairs(usableIngredient) do
-	    	local line = v
+	    	local line = zo_strformat("<<t:1>>", v)
 	    	if type(SousChef.settings.shoppingList[v]) == "table" and next(SousChef.settings.shoppingList[v]) then
 	    		line = "*(" .. u.TableKeyConcat(SousChef.settings.shoppingList[v])..") ".. line
 	    	end
diff --git a/Inventory.lua b/Inventory.lua
index d7d6fd1..f7895a2 100644
--- a/Inventory.lua
+++ b/Inventory.lua
@@ -56,7 +56,7 @@ function SousChef.AddRankToSlot(row, funcs)
 	end

 	-- are we a recipe?
-    if SousChef.settings.processRecipes then
+    if SousChef.settings.processRecipes then
     	if u.MatchInIgnoreList(slot.name) then return end
     	if GetItemLinkItemType(itemLink) == ITEMTYPE_RECIPE then
 	        local match = SousChef.Cookbook[u.CleanString(GetItemLinkName(GetItemLinkRecipeResultItemLink(itemLink)))]
diff --git a/SousChef.lua b/SousChef.lua
index 9942756..8686454 100644
--- a/SousChef.lua
+++ b/SousChef.lua
@@ -10,6 +10,7 @@ Thanks to Ayantir for the French translations, and sirinsidiator for the German
 SousChef = {}
 SousChef.Utility = {}
 SousChef.Media = {}
+SousChef.version = "2.11"

 local SousChef = SousChef
 local u = SousChef.Utility
@@ -57,6 +58,13 @@ local typeIconLookup = {
 	["Vin"] = 14,
 }

+local colors = {
+	["green"] = "|c00ff00",
+	["blue"] = "|c0066ff",
+	["purple"] = "|c782ee6",
+	["white"] = "|cFFFFFF",
+	["ending"] = "|r",
+}

 -- FUNCTIONS
 -- AddRecipe(Cookbook, link) adds the linked recipe to the player cookbook if it isn't there already.
@@ -77,9 +85,9 @@ end
 -- ParseRecipes() goes through the player's known recipes and records their info.
 function SousChef:ParseRecipes()
 	local lists = GetNumRecipeLists()
-
+
 	for listIndex = 1, lists do
-		local name, count = GetRecipeListInfo(listIndex)
+		local name, count = GetRecipeListInfo(listIndex)
 		for recipeIndex = 1, count do
 			if GetRecipeInfo(listIndex, recipeIndex) then
 				-- Store the recipes known:
@@ -95,9 +103,20 @@ function SousChef:ParseRecipes()
 				-- now record information about the recipe's ingregients
 				local _, _, ingredientCount, level, _, specialType = GetRecipeInfo(listIndex, recipeIndex)
 				-- store the recipe's index numbers and number of ingredients
-				-- XXX: why does this table get indexed with the formatted item name, but the Pantry table uses the whole link?
-				SousChef.CookbookIndex[GetItemLinkName(GetRecipeResultItemLink(listIndex, recipeIndex, LINK_STYLE_BRACKETS))] =
-					{listIndex = listIndex, recipeIndex = recipeIndex, numIngredients = ingredientCount}
+				local resultLink = GetRecipeResultItemLink(listIndex, recipeIndex)
+				local plainName = GetItemLinkName(resultLink)
+				local recipeColor = GetItemLinkQuality(resultLink)
+				local coloredName
+				if recipeColor == ITEM_QUALITY_MAGIC then -- green
+					coloredName = colors.green .. zo_strformat("<<t:1>>", plainName) .. colors.ending
+				elseif recipeColor == ITEM_QUALITY_ARCANE then -- blue
+					coloredName = colors.blue .. zo_strformat("<<t:1>>", plainName) .. colors.ending
+				elseif recipeColor == ITEM_QUALITY_ARTIFACT then -- purple
+					coloredName = colors.purple .. zo_strformat("<<t:1>>", plainName) .. colors.ending
+				else -- can't happen
+					coloredName = zo_strformat("<<t:1>>", plainName)
+				end
+				SousChef.CookbookIndex[coloredName] = {listIndex = listIndex, recipeIndex = recipeIndex, numIngredients = ingredientCount}
 				-- now, for every ingredient in the current recipe...
 				for ingredientIndex = 1, ingredientCount do
 					local link = u.GetItemID(GetRecipeIngredientItemLink(listIndex, recipeIndex, ingredientIndex, LINK_STYLE_DEFAULT))
@@ -110,16 +129,16 @@ function SousChef:ParseRecipes()
                         SousChef.settings.Pantry[link] = math.max(level, SousChef.Pantry[link] or 0)
                     else
 						-- if this is a special ingredient, record:
-						-- 						type icon number if user wants type icons,								7 if ingredient is a flavoring,						8 otherwise (ie, ingredient is a spice)
+						-- 						type icon number if user wants type icons,								7 if ingredient is a flavoring,				8 otherwise (ie, ingredient is a spice)
                         SousChef.Pantry[link] = SousChef.settings.typeIcon and typeIconLookup[name] or specialType == PROVISIONER_SPECIAL_INGREDIENT_TYPE_FLAVORING and 7 or 8
                         SousChef.settings.Pantry[link] = SousChef.settings.typeIcon and typeIconLookup[name] or specialType == PROVISIONER_SPECIAL_INGREDIENT_TYPE_FLAVORING and 7 or 8
                     end
 					-- Store the recipe it's used in to the character reverseCookbook
 					if not SousChef.ReverseCookbook[link] then SousChef.ReverseCookbook[link] = {} end
-					AddRecipe(SousChef.ReverseCookbook[link], GetItemLinkName(GetRecipeResultItemLink(listIndex, recipeIndex, LINK_STYLE_BRACKETS)))
+					AddRecipe(SousChef.ReverseCookbook[link], coloredName)
 					-- ...and to the account-wide reverseCookbook
 					if not SousChef.settings.ReverseCookbook[link] then SousChef.settings.ReverseCookbook[link] = {} end
-					AddRecipe(SousChef.settings.ReverseCookbook[link], GetItemLinkName(GetRecipeResultItemLink(listIndex, recipeIndex, LINK_STYLE_BRACKETS)))
+					AddRecipe(SousChef.settings.ReverseCookbook[link], coloredName)
 				end
 			end
 		end
@@ -135,11 +154,11 @@ local function SousChefCreateSettings()
 		name = "Sous Chef",
 		displayName = "Sous Chef",
 		author = "Wobin & KatKat42 & CrazyDutchGuy",
-		version = "2.10",
+		version = SousChef.version,
 		registerForRefresh = true,
 		slashCommand = "/souschef",
 	}
-
+
 	LAM:RegisterAddonPanel("SousChefSettings", panelData)

 	local optionsMenu = {
@@ -148,7 +167,6 @@ local function SousChefCreateSettings()
 			name = str.MENU_RECIPE_HEADER,
 			width = "full",
 		},
-
 		[2] = {
 			type = "checkbox",
 			name = str.MENU_PROCESS_RECIPES,
@@ -157,7 +175,6 @@ local function SousChefCreateSettings()
 			setFunc = function(value) SousChef.settings.processRecipes = value end,
 			width = "full",
 		},
-
 		[3] = {
 			type = "dropdown",
 			name = str.MENU_MARK_IF_KNOWN,
@@ -187,7 +204,6 @@ local function SousChefCreateSettings()
 			end,
 			disabled = function() return not SousChef.settings.processRecipes end,
 		},
-
 		[4] = {
 			type = "checkbox",
 			name = str.MENU_MARK_IF_ALT_KNOWS,
@@ -196,7 +212,6 @@ local function SousChefCreateSettings()
 			setFunc = function(value) SousChef.settings.markAlt = value SousChef:RefreshViews() end,
 			disabled = function() return (not SousChef.settings.processRecipes) or (SousChef.settings.checkKnown == "known") end,
 		},
-
 		[5] = {
 			type = "checkbox",
 			name = str.MENU_TOOLTIP_IF_ALT_KNOWS,
@@ -205,7 +220,6 @@ local function SousChefCreateSettings()
 			setFunc = function(value) SousChef.settings.showAltKnowledge = value SousChef:RefreshViews() end,
 			disabled = function() return not SousChef.settings.processRecipes end,
 		},
-
 		[6] = {
 			type = "checkbox",
 			name = str.MENU_MATCHER,
@@ -214,7 +228,6 @@ local function SousChefCreateSettings()
 			setFunc = function(value) SousChef.settings.experimentalMatch = value end,
 			disabled = function() return not SousChef.settings.processRecipes end,
 		},
-
 		[7] = {
 			type = "checkbox",
 			name = str.MENU_SORT_PROVISIONING,
@@ -229,13 +242,12 @@ local function SousChefCreateSettings()
 				end
 			end,
 		},
-
+
 		[8] = {
 			type = "header",
 			name = str.MENU_TOOLTIP_HEADER,
 			width = "full",
 		},
-
 		[9] = {
 			type = "checkbox",
 			name = str.MENU_TOOLTIP_CLICK,
@@ -244,7 +256,6 @@ local function SousChefCreateSettings()
 			getFunc = function() return SousChef.settings.showOnClick end,
 			setFunc = function(value) SousChef.settings.showOnClick = value end,
 		},
-
 		[10] = {
 			type = "checkbox",
 			name = str.MENU_RESULT_COUNTS,
@@ -252,7 +263,6 @@ local function SousChefCreateSettings()
 			getFunc = function() return SousChef.settings.showCounts end,
 			setFunc = function(value) SousChef.settings.showCounts = value end,
 		},
-
 		[11] = {
 			type = "checkbox",
 			name = str.MENU_ALT_USE,
@@ -266,7 +276,6 @@ local function SousChefCreateSettings()
 			name = str.MENU_INDICATOR_HEADER,
 			width = "full",
 		},
-
 		[13] = {
 			type = "checkbox",
 			name = str.MENU_ICON_SET,
@@ -274,7 +283,6 @@ local function SousChefCreateSettings()
 			getFunc = function() return SousChef.settings.boldIcon end,
 			setFunc = function(value) SousChef.settings.boldIcon = value SousChef:RefreshViews() end,
 		},
-
 		[14] = {
 			type = "checkbox",
 			name = str.MENU_SPECIAL_ICONS,
@@ -285,7 +293,6 @@ local function SousChefCreateSettings()
 				SousChef.ParseRecipes()
 			end,
 		},
-
 		[15] = {
 			type = "checkbox",
 			name = str.MENU_SPECIAL_TYPES,
@@ -294,7 +301,6 @@ local function SousChefCreateSettings()
 			setFunc = function(value) SousChef.settings.typeIcon = value SousChef.ParseRecipes() SousChef:RefreshViews() end,
 			disabled = function() return not SousChef.settings.showSpecialIngredients end,
 		},
-
 		[16] = {
 			type = "colorpicker",
 			name = str.MENU_INDICATOR_COLOR,
@@ -304,10 +310,9 @@ local function SousChefCreateSettings()
 				SousChef.settings.colour[1] = r
 				SousChef.settings.colour[2] = g
 				SousChef.settings.colour[3] = b
-				SousChef:RefreshViews()
+				SousChef:RefreshViews()
 			end,
 		},
-
 		[17] = {
 			type = "colorpicker",
 			name = str.MENU_SHOPPING_COLOR,
@@ -320,7 +325,6 @@ local function SousChefCreateSettings()
 				SousChef:RefreshViews()
 			end,
 		},
-
 		[18] = {
 			type = "checkbox",
 			name = str.MENU_ONLY_MARK_SHOPPING,
@@ -328,13 +332,12 @@ local function SousChefCreateSettings()
 			getFunc = function() return SousChef.settings.onlyShowShopping end,
 			setFunc = function(value) SousChef.settings.onlyShowShopping = value SousChef:RefreshViews() end,
 		},
-
 		[19] = {
 			type = "checkbox",
 			name = str.MENU_SORT_INGREDIENTS,
 			tooltip = str.MENU_SORT_INGREDIENTS_TOOLTIP,
 			getFunc = function() return SousChef.settings.sortKnownIngredients end,
-			setFunc = function(value)
+			setFunc = function(value)
 				SousChef.settings.sortKnownIngredients = not SousChef.settings.sortKnownIngredients
 				if not SousChef.settings.sortKnownIngredients then
 					SousChef.UnregisterSort()
@@ -344,22 +347,21 @@ local function SousChefCreateSettings()
 			end,
 		},
 	}
-
 	LAM:RegisterOptionControls("SousChefSettings", optionsMenu)
 end

 -- SousChef_Loaded(eventCode, addOnName) runs when the EVENT_ADD_ON_LOADED event fires.
 local function SousChef_Loaded(eventCode, addOnName)
 	if(addOnName ~= "SousChef") then return end
-
+
 	-- default config settings
 	local defaults = {
 		--watching = true,
 		checkKnown = "unknown",
-		markAlt = false,
+		markAlt = false,
 		colour = {1, 1, 1},
 		shoppingColour = {0,1,1},
-		Cookbook = {},
+		Cookbook = {},
 		Pantry = {},
 		ReverseCookbook = {},
 		showAltKnowledge = false,
@@ -380,25 +382,9 @@ local function SousChef_Loaded(eventCode, addOnName)
 	}

 	local localized = SousChef.Strings[SousChef.lang]
-
-	-- Fetch the saved variables
-    SousChef.settings = ZO_SavedVars:NewAccountWide("SousChef_Settings", 9, SousChef.lang, defaults)

-	-- redo some saved vars with the new format
-	for ingredient, recipes in pairs(SousChef.settings.ReverseCookbook) do
-		for index, linkOrName in pairs(recipes) do
-			if (string.find(linkOrName, "|H1:", 1, true) ~= nil) then
-				linkOrName = GetItemLinkName(linkOrName)
-			end
-		end
-	end
-
-	for recipe, chars in pairs(SousChef.settings.shoppingList) do
-		if (string.find(recipe, "|H1:", 1, true) ~= nil) then
-			SousChef.settings.shoppingList[GetItemLinkName(recipe)] = chars
-			SousChef.settings.shoppingList[recipe] = nil
-		end
-	end
+	-- Fetch the saved variables
+    SousChef.settings = ZO_SavedVars:NewAccountWide("SousChef_Settings", 10, SousChef.lang, defaults)

 	-- define some slash commands
 	SLASH_COMMANDS['/scstats'] = function()
@@ -408,13 +394,13 @@ local function SousChef_Loaded(eventCode, addOnName)
 	SLASH_COMMANDS['/sciadd'] = SousChef.AddRecipeToIgnoreList
 	SLASH_COMMANDS['/sciremove'] = SousChef.RemoveRecipeFromIgnoreList
 	SLASH_COMMANDS['/scilist'] = SousChef.ListIgnoredRecipes
-
+
 	-- initialize the configuration menu
 	SousChefCreateSettings()
-
+
 	-- parse the recipes this character knows, in a second
 	zo_callLater(SousChef.ParseRecipes, 1000)
-
+
 	SousChef:UpdateProvisioningTable()
 	SousChef:HookGetRecipeInfo()

diff --git a/Strings.lua b/Strings.lua
index 975231a..3508a08 100644
--- a/Strings.lua
+++ b/Strings.lua
@@ -60,7 +60,7 @@ SousChef.Strings = {
 		-- tooltip
 		TOOLTIP_KNOWN_BY = "Known by ",
 		TOOLTIP_USED_IN = "Used in:",
-		TOOLTIP_CREATES = "Creates a Level <<1>> <<2>>", -- where <<1>> is the level and <<2>> is the result name
+		TOOLTIP_CREATES = "Creates a Level <<1>> <<t:2>>", -- where <<1>> is the level and <<2>> is the result name
 	},

 	-- Thanks to sirinsidiator for the German translations here!
@@ -125,7 +125,7 @@ SousChef.Strings = {
 		-- tooltip
 		TOOLTIP_KNOWN_BY = "Gelernt von ",
 		TOOLTIP_USED_IN = "Verwendet in:",
-		TOOLTIP_CREATES = "Creates a Level <<1>> <<2>>", -- where <<1>> is the level and <<2>> is the result name
+		TOOLTIP_CREATES = "Creates a Level <<1>> <<t:2>>", -- where <<1>> is the level and <<2>> is the result name
 	},

 	--Thanks to Ayantir for the French translations here!
@@ -190,6 +190,6 @@ SousChef.Strings = {
 		-- tooltip
 		TOOLTIP_KNOWN_BY = "Connue par ",
 		TOOLTIP_USED_IN = "Utilisé par :",
-		TOOLTIP_CREATES = "Creates a Level <<1>> <<2>>", -- where <<1>> is the level and <<2>> is the result name
+		TOOLTIP_CREATES = "Creates a Level <<1>> <<t:2>>", -- where <<1>> is the level and <<2>> is the result name
 	},
 }
\ No newline at end of file