diff --git a/SousChef.lua b/SousChef.lua
index 790b58f..59e7c25 100644
--- a/SousChef.lua
+++ b/SousChef.lua
@@ -46,7 +46,6 @@ function EndsWith(String,End)
return End=='' or string.sub(String,-string.len(End))==End
end
-
local function CleanString(entry)
return entry:gsub("%^(%a+)", ""):gsub(" ",""):lower()
end
@@ -66,26 +65,23 @@ local function AddDetails(row)
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
+ local gmatch = settings.Cookbook[CleanString(row.dataEntry.data.name)]
+ 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
-
-
+
if ((GetItemCraftingInfo(bagId, slotIndex)) ~= CRAFTING_TYPE_PROVISIONING) then return false end
local usableIngredient = ReverseCookbook[GetItemID(GetItemLink(bagId, slotIndex))]
if settings.showAltKnowledge then usableIngredient = settings.ReverseCookbook[GetItemID(GetItemLink(bagId, slotIndex))] end
if usableIngredient then
- ItemTooltip:AddLine("Used in:")
+ ItemTooltip:AddLine("Used in:", "ZoFontWinH5", 1,1,1, BOTTOM, MODIFY_TEXT_TYPE_UPPERCASE)
for i,v in ipairs(usableIngredient) do
ItemTooltip:AddLine(v)
end
@@ -99,10 +95,8 @@ local function getIcon(row)
if(not rankIcon) then
rankIcon = WINDOW_MANAGER:CreateControl(row:GetName() .. "SousChef", row, CT_TEXTURE)
slotLines[row:GetName()] = rankIcon
- if row:GetOwningWindow():GetName() ~= "ZO_TradingHouse" then
- ZO_PreHookHandler(row, "OnMouseDown", AddDetails)
- ZO_PreHookHandler(row, "OnMouseExit", function(self) rowClicked[self] = nil end )
- end
+ ZO_PreHookHandler(row, "OnMouseDown", AddDetails)
+ ZO_PreHookHandler(row, "OnMouseExit", function(self) rowClicked[self] = nil end )
end
return rankIcon
end
@@ -163,9 +157,9 @@ local function AddTradingSlot(row, result)
rankIcon:SetHidden(true)
- if EndsWith(result.name, GetString(SI_ITEMTYPE29):lower()) then
- local match = Cookbook[result.name:lower():gsub(" ","")]
- local gmatch = settings.Cookbook[result.name:lower():gsub(" ","")]
+ if EndsWith(result.name:lower(), GetString(SI_ITEMTYPE29):lower()) then
+ local match = Cookbook[CleanString(result.name)]
+ local gmatch = settings.Cookbook[CleanString(result.name)]
if (match and settings.checkKnown == "known") or
(not match and settings.checkKnown == "unknown")then
rankIcon:SetDimensions(30, 30)
@@ -205,8 +199,8 @@ local function ParseRecipes()
for ingredientIndex = 1, ingredientCount do
local link = GetItemID(GetRecipeIngredientItemLink(listIndex, recipeIndex, ingredientIndex, LINK_STYLE_NORMAL))
-- Store the fact that the ingredient is used
- Pantry[link] = level
- settings.Pantry[link] = level
+ Pantry[link] = math.max(level, Pantry[link] or 0)
+ settings.Pantry[link] = math.max(level, Pantry[link] or 0)
-- Store the recipe it's used in
if not ReverseCookbook[link] then ReverseCookbook[link] = {} end
AddRecipe(ReverseCookbook[link], zo_strformat(SI_TOOLTIP_ITEM_NAME, GetRecipeResultItemLink(listIndex, recipeIndex, LINK_STYLE_BRACKETS)))