Made the 'show alt' knowledge more fine grained, you can now turn on and off ingredient views as separate from recipe ones.

Wobin [05-14-14 - 14:39]
Made the 'show alt' knowledge more fine grained, you can now turn on and off ingredient views as separate from recipe ones.
Added who marked a recipe on the Shopping List in the tooltip
Filename
Common.lua
Inventory.lua
Provisioning.lua
SousChef.lua
diff --git a/Common.lua b/Common.lua
index edd1cc9..58919c8 100644
--- a/Common.lua
+++ b/Common.lua
@@ -64,7 +64,7 @@ function SousChef.HookInventory()
 	ZO_ScrollList_RefreshVisible(BANK)
 	ZO_ScrollList_RefreshVisible(GUILD_BANK)
 	if not SousChef.settings.showOnClick then
-		ZO_PreHookHandler(ItemTooltip, "OnShow", function() zo_callLater(function() SousChef.AddDetails(moc()) end, 700) end)
+		ZO_PreHookHandler(ItemTooltip, "OnShow", function() zo_callLater(function() SousChef.AddDetails(moc()) end, 1000) end)
 		ZO_PreHookHandler(ItemTooltip, "OnUpdate", function() return SousChef.AddDetails(moc()) end)
 		ZO_PreHookHandler(ItemTooltip, "OnHide", function() rowClicked = nil return false end )
 	end
@@ -116,16 +116,18 @@ function SousChef.AddDetails(row)
         end
     end

+    if SousChef.settings.onlyShowShopping and SousChef.slotLines[row:GetName()]:IsHidden() then return end
+
 	local itemId = u.GetItemID(slotIndex and GetItemLink(bagId, slotIndex) or GetLootItemLink(bagId)) -- Get itemId of inventory or loot slot
 	local usableIngredient = SousChef.ReverseCookbook[itemId]
-	if SousChef.settings.showAltKnowledge then usableIngredient = SousChef.settings.ReverseCookbook[itemId] end
-	if usableIngredient then
+	if SousChef.settings.showAltIngredientKnowledge then usableIngredient = SousChef.settings.ReverseCookbook[itemId] end
+	if usableIngredient then
 		ZO_Tooltip_AddDivider(ItemTooltip)
 		ItemTooltip:AddLine("Used in:", "ZoFontWinH5", 1,1,1, BOTTOM, MODIFY_TEXT_TYPE_UPPERCASE)
 	    for i,v in ipairs(usableIngredient) do
 	    	local line = v
-	    	if SousChef.settings.shoppingList[v] then
-	    		line = "* ".. line
+	    	if type(SousChef.settings.shoppingList[v]) == "table" and next(SousChef.settings.shoppingList[v]) then
+	    		line = "*(" .. u.TableKeyConcat(SousChef.settings.shoppingList[v])..") ".. line
 	    	end
 	    	if SousChef.settings.showCounts then
 	    		local bookmark = SousChef.CookbookIndex[v]
diff --git a/Inventory.lua b/Inventory.lua
index 83873ca..46ee93c 100644
--- a/Inventory.lua
+++ b/Inventory.lua
@@ -28,7 +28,7 @@ function SousChef.AddRankToSlot(row, funcs)

 	local id = u.GetItemID(idFunc(bagId, slotIndex))
 	local texture = SousChef.Pantry[id]
-	if SousChef.settings.showAltKnowledge then texture = SousChef.settings.Pantry[id] end
+	if SousChef.settings.showAltIngredientKnowledge then texture = SousChef.settings.Pantry[id] end
 	if texture then

 		rankIcon:SetHidden(false)
diff --git a/Provisioning.lua b/Provisioning.lua
index d600c2e..661eaef 100644
--- a/Provisioning.lua
+++ b/Provisioning.lua
@@ -57,9 +57,9 @@ function SousChef:HookRecipeTreeFunction()
             function(...)
                 local node, control, data, open, userRequested, enabled = ...
                 SousChef.hookedProvisioningFunction(...)
-                local link = GetRecipeResultItemLink(data.recipeListIndex, data.recipeIndex, LINK_STYLE_BRACKETS)
+                local link = zo_strformat(SI_TOOLTIP_ITEM_NAME, GetRecipeResultItemLink(data.recipeListIndex, data.recipeIndex, LINK_STYLE_BRACKETS))
                 if link then
-                    SousChef:AddNotifier(control, SousChef.settings.shoppingList[zo_strformat(SI_TOOLTIP_ITEM_NAME, link)])
+                    SousChef:AddNotifier(control, type(SousChef.settings.shoppingList[link]) == "table" and next(SousChef.settings.shoppingList[link]))
                 end
             end
         end
@@ -98,14 +98,22 @@ end

 function SousChef:IsOnShoppingList(id)
     for i,v in ipairs(SousChef.settings.ReverseCookbook[id]) do
-        if SousChef.settings.shoppingList[v] then return true end
+        if type(SousChef.settings.shoppingList[v]) == "table" and next(SousChef.settings.shoppingList[v]) then return SousChef.settings.shoppingList[v] end
     end
     return false
 end

 function SousChef:MarkRecipe()
-    local link = GetRecipeResultItemLink(PROVISIONER:GetSelectedRecipeListIndex(), PROVISIONER:GetSelectedRecipeIndex(), LINK_STYLE_BRACKETS)
-    SousChef.settings.shoppingList[zo_strformat(SI_TOOLTIP_ITEM_NAME, link)] = not SousChef.settings.shoppingList[zo_strformat(SI_TOOLTIP_ITEM_NAME, link)]
+    local link = zo_strformat(SI_TOOLTIP_ITEM_NAME, GetRecipeResultItemLink(PROVISIONER:GetSelectedRecipeListIndex(), PROVISIONER:GetSelectedRecipeIndex(), LINK_STYLE_BRACKETS))
+
+    if type(SousChef.settings.shoppingList[link]) ~= "table" then SousChef.settings.shoppingList[link]  = {} end
+
+    if not SousChef.settings.shoppingList[link][GetUnitName("player")] then
+        SousChef.settings.shoppingList[link][GetUnitName("player")] = true -- we're now marked
+    else
+        SousChef.settings.shoppingList[link][GetUnitName("player")] = nil -- we're now unmarked
+    end
+
     PROVISIONER:DirtyRecipeTree()
 end

diff --git a/SousChef.lua b/SousChef.lua
index f25efb4..72ba95f 100644
--- a/SousChef.lua
+++ b/SousChef.lua
@@ -46,6 +46,12 @@ local typeIconLookup = {
 	["Wine"] = 14
 }

+function SousChef:RefreshViews()
+	ZO_ScrollList_RefreshVisible(BACKPACK)
+	ZO_ScrollList_RefreshVisible(BANK)
+	ZO_ScrollList_RefreshVisible(GUILD_BANK)
+end
+
 function SousChef:ParseRecipes()
 	local lists = GetNumRecipeLists()

@@ -86,13 +92,10 @@ function SousChef:ParseRecipes()

 		end
 	end
-	ZO_ScrollList_RefreshVisible(BACKPACK)
-	ZO_ScrollList_RefreshVisible(BANK)
-	ZO_ScrollList_RefreshVisible(GUILD_BANK)
+	SousChef:RefreshViews()
 end

-local function SousChefCreateSettings()
-    d("Creating menu")
+local function SousChefCreateSettings()
 	local panel = LAM:CreateControlPanel("SousChefMenu", "Sous Chef")

 	LAM:AddHeader(panel, "SousChef_General", "Recipe Options")
@@ -119,10 +122,10 @@ local function SousChefCreateSettings()
 						function(valueString) SousChef.settings.checkKnown = valueString end)
 	LAM:AddCheckbox(panel, "markAltKnows", "Alternate Character Check", "Indicate if an alt knows the recipe on unknown recipes. Will only work if the above setting is set to 'unknown'",
 						function() return SousChef.settings.markAlt end,
-						function(value) SousChef.settings.markAlt = not SousChef.settings.markAlt end)
+						function(value) SousChef.settings.markAlt = not SousChef.settings.markAlt SousChef:RefreshViews() end)
 	LAM:AddCheckbox(panel, "showAltKnows", "Alternate Character Recipe Knowledge", "Show rank indicators on alts for all recipe knowledge of all alternate characters",
 						function() return SousChef.settings.showAltKnowledge end,
-						function(value) SousChef.settings.showAltKnowledge = not SousChef.settings.showAltKnowledge end)
+						function(value) SousChef.settings.showAltKnowledge = not SousChef.settings.showAltKnowledge SousChef:RefreshViews() end)
     LAM:AddCheckbox(panel, "experimental", "Use the experimental recipe matcher", [[Currently Sous Chef cannot match reliably in other languages. This will attempt to match as best it can by stripping out common prepositions so that the recipe and result match better.

     (NOTE: please file a typo bug report with Zenimax if you find recipes that don't match the results exactly, with the recipe/result names)]],
@@ -137,11 +140,14 @@ local function SousChefCreateSettings()
 	LAM:AddCheckbox(panel, "showResultCount", "Show recipe result counts", "Show how many of a particular recipe can be made next to the link in the Ingredient tooltip",
 						function() return SousChef.settings.showCounts end,
 						function(value) SousChef.settings.showCounts = not SousChef.settings.showCounts end)
-
+	LAM:AddCheckbox(panel, "markAltIngKnows", "Alternate Character Ingredient Knowledge", "Indicate if an alt uses the ingredients",
+						function() return SousChef.settings.showAltIngredientKnowledge end,
+						function(value) SousChef.settings.showAltIngredientKnowledge = not SousChef.settings.showAltIngredientKnowledge SousChef:RefreshViews() end)
+
 	LAM:AddHeader(panel, "SousChef_Indicator", "Indicator Options")
 	LAM:AddCheckbox(panel, "useBold", "Use bolder icons", "Swap out rank icon to a more flat display",
 						function() return SousChef.settings.boldIcon end,
-						function(value) SousChef.settings.boldIcon = not SousChef.settings.boldIcon end)
+						function(value) SousChef.settings.boldIcon = not SousChef.settings.boldIcon SousChef:RefreshViews() end)
 	LAM:AddCheckbox(panel, "specialIngredients", "Show special ingredients", "Indicate if an ingredient is considered a Spice/Flavour rather than the tier of the max ranked recipe you have that uses it",
 						function() return SousChef.settings.showSpecialIngredients end,
 						function(value)
@@ -155,18 +161,18 @@ local function SousChefCreateSettings()
 						end)
 	LAM:AddCheckbox(panel, "typeIcons", "Show special ingredients as types", "Use the icon for the type of food it's a special ingredient for, eg Grilled",
 						function() return SousChef.settings.typeIcon end,
-						function(value) SousChef.settings.typeIcon = not SousChef.settings.typeIcon SousChef.ParseRecipes() end)
+						function(value) SousChef.settings.typeIcon = not SousChef.settings.typeIcon SousChef.ParseRecipes() SousChef:RefreshViews() end)
 	LAM:AddColorPicker(panel, "setColour", "Indicator colour",
 						"Allows you to set the colour of the indicator",
 						function() return SousChef.settings.colour[1], SousChef.settings.colour[2], SousChef.settings.colour[3] end,
-						function(r,g,b) SousChef.settings.colour[1] = r; SousChef.settings.colour[2] = g; SousChef.settings.colour[3] = b end)
+						function(r,g,b) SousChef.settings.colour[1] = r; SousChef.settings.colour[2] = g; SousChef.settings.colour[3] = b SousChef:RefreshViews() end)
 	LAM:AddColorPicker(panel, "setShoppingListColour", "Shopping List indicator colour",
 						"Allows you to set the colour of the indicator for ingredients in your Shopping List",
 						function() return SousChef.settings.shoppingColour[1], SousChef.settings.shoppingColour[2], SousChef.settings.shoppingColour[3] end,
-						function(r,g,b) SousChef.settings.shoppingColour[1] = r; SousChef.settings.shoppingColour[2] = g; SousChef.settings.shoppingColour[3] = b end)
+						function(r,g,b) SousChef.settings.shoppingColour[1] = r; SousChef.settings.shoppingColour[2] = g; SousChef.settings.shoppingColour[3] = b SousChef:RefreshViews() end)
 	LAM:AddCheckbox(panel, "onlyShoppingList", "Only show Shopping List ingredients", "Only mark ingredients on your Shopping List",
 						function() return SousChef.settings.onlyShowShopping end,
-						function(value) SousChef.settings.onlyShowShopping = not SousChef.settings.onlyShowShopping end)
+						function(value) SousChef.settings.onlyShowShopping = not SousChef.settings.onlyShowShopping SousChef:RefreshViews() end)

 	ZO_CreateStringId("SI_BINDING_NAME_SC_MARK_RECIPE", "Mark Recipe")

@@ -207,6 +213,7 @@ local function SousChef_Loaded(eventCode, addOnName)
 		Pantry = {},
 		ReverseCookbook = {},
 		showAltKnowledge = false,
+		showAltIngredientKnowledge = false,
 		boldIcon = false,
 		typeIcon = true,
         experimentalMatch = false,