Added in a 'known by' to the tooltip for alternate known recipes

Wobin [04-17-14 - 14:09]
Added in a 'known by' to the tooltip for alternate known recipes
Filename
SousChef.lua
diff --git a/SousChef.lua b/SousChef.lua
index b611891..65ef3cf 100644
--- a/SousChef.lua
+++ b/SousChef.lua
@@ -61,6 +61,21 @@ local function AddDetails(row)
 	if not row.dataEntry or not row.dataEntry.data or rowClicked[row] then return false end
 	local bagId = row.dataEntry.data.bagId
 	local slotIndex = row.dataEntry.data.slotIndex
+
+	if GetItemType(bagId, slotIndex) == ITEMTYPE_RECIPE then
+		local gmatch = MatchInGlobalCookbook(bagId, slotIndex)
+		if gmatch then
+			ItemTooltip:AddLine("")
+			ItemTooltip:AddLine("Known by ", "ZoFontWinH5", 1,1,1, BOTTOM, MODIFY_TEXT_TYPE_UPPERCASE)
+			for i,v in pairs(gmatch) do
+				ItemTooltip:AddLine(i)
+			end
+			rowClicked[row] = true
+			return
+		end
+	end
+
+
 	if ((GetItemCraftingInfo(bagId, slotIndex)) ~= CRAFTING_TYPE_PROVISIONING) then	return false end

 	local usableIngredient = ReverseCookbook[GetItemID(GetItemLink(bagId, slotIndex))]
@@ -177,8 +192,12 @@ local function ParseRecipes()
 		for recipeIndex = 1, count do
 			if GetRecipeInfo(listIndex, recipeIndex) then
 				-- Store the recipes known
-				Cookbook[(GetRecipeResultItemInfo(listIndex, recipeIndex)):gsub(" ",""):lower() .. "recipe"] = true
-				settings.Cookbook[(GetRecipeResultItemInfo(listIndex, recipeIndex)):gsub(" ",""):lower() .. "recipe"] = true
+				local recipeName = (GetRecipeResultItemInfo(listIndex, recipeIndex)):gsub(" ",""):lower() .. "recipe"
+				Cookbook[recipeName] = true
+				if not settings.Cookbook[recipeName] then
+					settings.Cookbook[recipeName] = {}
+				end
+				settings.Cookbook[recipeName][GetUnitName("player")] = true
 				local _, _, ingredientCount, level = GetRecipeInfo(listIndex, recipeIndex)
 				for ingredientIndex = 1, ingredientCount do
 					local link = GetItemID(GetRecipeIngredientItemLink(listIndex, recipeIndex, ingredientIndex, LINK_STYLE_NORMAL))
@@ -250,7 +269,7 @@ local function SousChef_Loaded(eventCode, addOnName)
 		boldIcon = false
 	}

-	settings = ZO_SavedVars:NewAccountWide("SousChef_Settings", 5, nil, defaults)
+	settings = ZO_SavedVars:NewAccountWide("SousChef_Settings", 6, nil, defaults)

     SLASH_COMMANDS["/SCDebug"] = function()
 		d("Debug mode on")
@@ -295,6 +314,7 @@ local function SousChef_Loaded(eventCode, addOnName)
 	ZO_ScrollList_RefreshVisible(GUILD_BANK)

 	EVENT_MANAGER:RegisterForEvent("SousChefTRading", EVENT_TRADING_HOUSE_RESPONSE_RECEIVED, HookTrading)
+	EVENT_MANAGER:RegisterForEvent("SousChefLearnt", EVENT_RECIPE_LEARNED, ParseRecipes)

 end