local SousChef = SousChef local u = SousChef.Utility local m = SousChef.Media local BACKPACK = ZO_PlayerInventoryBackpack local BANK = ZO_PlayerBankBackpack local GUILD_BANK = ZO_GuildBankBackpack local COOKING_RANK_2 = [[SousChef\media\Two.dds]] local COOKING_RANK_3 = [[SousChef\media\Three.dds]] local COOKING_RANK_4 = [[SousChef\media\Four.dds]] local COOKING_RANK_5 = [[SousChef\media\Five.dds]] local COOKING_RANK_6 = [[SousChef\media\Six.dds]] local COOKING_FLAVOUR = [[SousChef\media\Flavour.dds]] local COOKING_SPICE = [[SousChef\media\Spice.dds]] local COOKING_SPICEB = [[SousChef\media\Spice_Flat.dds]] local COOKING_RANK_1B = [[SousChef\media\One_flat.dds]] local COOKING_RANK_2B = [[SousChef\media\Two_flat.dds]] local COOKING_RANK_3B = [[SousChef\media\Three_flat.dds]] local COOKING_RANK_4B = [[SousChef\media\Four_flat.dds]] local COOKING_RANK_5B = [[SousChef\media\Five_flat.dds]] local COOKING_RANK_6B = [[SousChef\media\Six_flat.dds]] local COOKING_FLAVOURB = [[SousChef\media\flavour_flat.dds]] local COOKING_RANK_1 = [[SousChef\media\One.dds]] m.COOKING = { COOKING_RANK_1, COOKING_RANK_2, COOKING_RANK_3, COOKING_RANK_4, COOKING_RANK_5, COOKING_RANK_6, COOKING_FLAVOUR, COOKING_SPICE } m.COOKINGB = { COOKING_RANK_1B, COOKING_RANK_2B, COOKING_RANK_3B, COOKING_RANK_4B, COOKING_RANK_5B, COOKING_RANK_6B, COOKING_FLAVOURB, COOKING_SPICEB } m.CANLEARN = [[/esoui/art/loot/loot_finesseitem.dds]] local rowClicked = {} function SousChef.HookInventory() for _,v in pairs(PLAYER_INVENTORY.inventories) do local listView = v.listView if listView and listView.dataTypes and listView.dataTypes[1] then SousChef.hookedFunctions = listView.dataTypes[1].setupCallback if SousChef.hookedFunctions then listView.dataTypes[1].setupCallback = function(rowControl, slot) SousChef.hookedFunctions(rowControl, slot) SousChef.AddRankToSlot(rowControl) end else d("SousChef could not hook into the Inventory") end end end ZO_ScrollList_RefreshVisible(BACKPACK) ZO_ScrollList_RefreshVisible(BANK) ZO_ScrollList_RefreshVisible(GUILD_BANK) if not SousChef.settings.showOnClick then ZO_PreHookHandler(ItemTooltip, "OnUpdate", function() return SousChef.AddDetails(moc()) end) ZO_PreHookHandler(ItemTooltip, "OnHide", function() rowClicked = nil return false end ) end end function SousChef.getIcon(row) local rankIcon = SousChef.slotLines[row:GetName()] if(not rankIcon) then rankIcon = WINDOW_MANAGER:CreateControl(row:GetName() .. "SousChef", row, CT_TEXTURE) SousChef.slotLines[row:GetName()] = rankIcon if SousChef.settings.showOnClick then ZO_PreHookHandler(row, "OnMouseDown", SousChef.AddDetails) ZO_PreHookHandler(row, "OnMouseExit", function(self) rowClicked = nil return false end ) end end return rankIcon end function SousChef.AddDetails(row) if not row.dataEntry or not row.dataEntry.data or rowClicked == row then return false end rowClicked = row local rowInfo = row.dataEntry.data local bagId = rowInfo.bagId local slotIndex = rowInfo.slotIndex if u.MatchesRecipe(rowInfo.name or "") then local gmatch = u.MatchInGlobalCookbook(rowInfo.name) if gmatch then ZO_Tooltip_AddDivider(ItemTooltip) ItemTooltip:AddLine("Known by ", "ZoFontWinH5", 1,1,1, BOTTOM, MODIFY_TEXT_TYPE_UPPERCASE) ItemTooltip:AddLine(u.TableKeyConcat(gmatch)) return false end end if ((GetItemCraftingInfo(bagId, slotIndex)) ~= CRAFTING_TYPE_PROVISIONING) then return false end local usableIngredient = SousChef.ReverseCookbook[u.GetItemID(GetItemLink(bagId, slotIndex))] if SousChef.settings.showAltKnowledge then usableIngredient = SousChef.settings.ReverseCookbook[u.GetItemID(GetItemLink(bagId, slotIndex))] 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 if SousChef.settings.shoppingList[v] then ItemTooltip:AddLine("* "..v) else ItemTooltip:AddLine(v) end end end return false end function SousChef.AddRecipeToIgnoreList(link) if GetItemLinkInfo(link) ~= "" then link = string.match(link, "([%w\128-\244 ]+)%]") end SousChef.settings.ignoredRecipes[link] = true d("Adding " .. link .. " to ignored recipes") end function SousChef.RemoveRecipeFromIgnoreList(link) if GetItemLinkInfo(link) ~= "" then link = string.match(link, "([%w\128-\244 ]+)%]") end if not SousChef.settings.ignoredRecipes[link] then d(link .. " not found in ignore list") return end SousChef.settings.ignoredRecipes[link] = nil d("Removed " .. link .. " from ignored recipes") end function SousChef.ListIgnoredRecipes() d("Ignoring:") for recipe in pairs(SousChef.settings.ignoredRecipes) do d(recipe) end end