diff --git a/Common.lua b/Common.lua
index 5d8fda4..f3b8af1 100644
--- a/Common.lua
+++ b/Common.lua
@@ -50,6 +50,10 @@ function SousChef.HookInventory()
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)
@@ -60,9 +64,6 @@ function SousChef.getIcon(row)
if SousChef.settings.showOnClick then
ZO_PreHookHandler(row, "OnMouseDown", SousChef.AddDetails)
ZO_PreHookHandler(row, "OnMouseExit", function(self) rowClicked = nil return false end )
- else
- ZO_PreHookHandler(ItemTooltip, "OnUpdate", function() return SousChef.AddDetails(moc()) end)
- ZO_PreHookHandler(ItemTooltip, "OnHide", function() rowClicked = nil return false end )
end
end
return rankIcon
@@ -93,7 +94,11 @@ function SousChef.AddDetails(row)
ZO_Tooltip_AddDivider(ItemTooltip)
ItemTooltip:AddLine("Used in:", "ZoFontWinH5", 1,1,1, BOTTOM, MODIFY_TEXT_TYPE_UPPERCASE)
for i,v in ipairs(usableIngredient) do
- ItemTooltip:AddLine(v)
+ if SousChef.settings.shoppingList[v] then
+ ItemTooltip:AddLine("* "..v)
+ else
+ ItemTooltip:AddLine(v)
+ end
end
end
return false
diff --git a/Inventory.lua b/Inventory.lua
index 2906835..46525cc 100644
--- a/Inventory.lua
+++ b/Inventory.lua
@@ -20,17 +20,26 @@ function SousChef.AddRankToSlot(row)
rankIcon:SetHidden(true)
if ((GetItemCraftingInfo(bagId, slotIndex)) == CRAFTING_TYPE_PROVISIONING) then
- local texture = SousChef.Pantry[u.GetItemID(GetItemLink(bagId, slotIndex))]
- if SousChef.settings.showAltKnowledge then texture = SousChef.settings.Pantry[u.GetItemID(GetItemLink(bagId, slotIndex))] end
- if texture then
- rankIcon:SetColor(SousChef.settings.colour[1], SousChef.settings.colour[2], SousChef.settings.colour[3])
+ local id = u.GetItemID(GetItemLink(bagId, slotIndex))
+ local texture = SousChef.Pantry[id]
+ if SousChef.settings.showAltKnowledge then texture = SousChef.settings.Pantry[id] end
+ if texture then
+
rankIcon:SetHidden(false)
+
if SousChef.settings.boldIcon then
rankIcon:SetTexture(m.COOKINGB[texture])
else
rankIcon:SetTexture(m.COOKING[texture])
- end
-
+ end
+
+ if SousChef:IsOnShoppingList(id) then
+ rankIcon:SetColor(SousChef.settings.shoppingColour[1], SousChef.settings.shoppingColour[2], SousChef.settings.shoppingColour[3])
+ else
+ if SousChef.settings.onlyShowShopping then return rankIcon:SetHidden(true) end
+ rankIcon:SetColor(SousChef.settings.colour[1], SousChef.settings.colour[2], SousChef.settings.colour[3])
+ end
+
end
else
if SousChef.settings.processRecipes then
diff --git a/Provisioning.lua b/Provisioning.lua
index 6a08d68..bfe49ae 100644
--- a/Provisioning.lua
+++ b/Provisioning.lua
@@ -1,6 +1,26 @@
local SousChef = SousChef
+local u = SousChef.Utility
+local m = SousChef.Media
+
+SousChef.ProvisioningButton=
+{{
+ name = "Mark Recipe", -- or function that returns a name
+ keybind = "SC_MARK_RECIPE",
+ control = self,
+ callback = function(descriptor) SousChef:MarkRecipe() end,
+ visible = function(descriptor) return PROVISIONER:GetSelectedRecipeIndex() ~= nil end,
+ alignment = KEYBIND_STRIP_ALIGN_RIGHT,
+}}
+
+local bGroup = SousChef.ProvisioningButton
+
+function SousChef:HookRecipeTreeFunction()
+ if not KEYBIND_STRIP:HasKeybindButtonGroup(bGroup) then
+ KEYBIND_STRIP:AddKeybindButtonGroup(bGroup)
+ else
+ KEYBIND_STRIP:UpdateKeybindButtonGroup(bGroup)
+ end
-function SousChef.HookRecipeTreeFunction()
-- Hook the provisioning panel
if not SousChef.hookedProvisioningFunction then
local ref = PROVISIONER.recipeTree.templateInfo.ZO_ProvisionerNavigationEntry
@@ -10,14 +30,67 @@ function SousChef.HookRecipeTreeFunction()
function(...)
local node, control, data, open, userRequested, enabled = ...
SousChef.hookedProvisioningFunction(...)
-
+ local link = GetRecipeResultItemLink(data.recipeListIndex, data.recipeIndex, LINK_STYLE_BRACKETS)
+ d(link)
+ if link then
+ SousChef:AddNotifier(control, SousChef.settings.shoppingList[zo_strformat(SI_TOOLTIP_ITEM_NAME, link)])
+ end
end
end
+ end
+ PROVISIONER:DirtyRecipeTree()
+end
+
+function SousChef:getMarkedIcon(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
+ rankIcon:SetTexture(m.CANLEARN)
+ rankIcon:SetDimensions(20, 20)
+ rankIcon:SetAnchor(RIGHT, row, LEFT, -10)
+ rankIcon:SetMouseEnabled(true)
+ rankIcon:SetHandler("OnMouseEnter", function()
+ InitializeTooltip(InformationTooltip, rankIcon, RIGHT, -15, 0)
+ InformationTooltip:AddLine("Shopping List")
+ end)
+ rankIcon:SetHandler("OnMouseExit", function()
+ ClearTooltip(InformationTooltip)
+ end)
+ end
+ return rankIcon
+end
+
+function SousChef:AddNotifier(control, marked)
+ local icon = self:getMarkedIcon(control)
+ if marked then
+ icon:SetHidden(false)
+ else
+ icon:SetHidden(true)
+ end
+end
+
+function SousChef:IsOnShoppingList(id)
+ for i,v in ipairs(SousChef.settings.ReverseCookbook[id]) do
+ if SousChef.settings.shoppingList[v] then return true 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)]
+ PROVISIONER:DirtyRecipeTree()
end
-function SousChef.HookRecipeTree(...)
+function SousChef:HookRecipeTree(...)
local eventId, craftingTable = ...
- if craftingTable ~= CRAFTING_TYPE_PROVISIONING then return end
- zo_callLater(SousChef.HookRecipeTreeFunction, 1000)
+ if craftingTable ~= CRAFTING_TYPE_PROVISIONING then return end
+ zo_callLater(function() SousChef:HookRecipeTreeFunction() end, 1000)
end
+
+function SousChef:UnhookRecipeTree()
+ if KEYBIND_STRIP:HasKeybindButtonGroup(bGroup) then
+ KEYBIND_STRIP:RemoveKeybindButtonGroup(bGroup)
+ end
+end
\ No newline at end of file
diff --git a/SousChef.lua b/SousChef.lua
index 760bb0d..48ca945 100644
--- a/SousChef.lua
+++ b/SousChef.lua
@@ -36,7 +36,7 @@ local function AddRecipe(Cookbook, link)
table.insert(Cookbook, link)
end
-function SousChef.ParseRecipes()
+function SousChef:ParseRecipes()
local lists = GetNumRecipeLists()
for listIndex = 1, lists do
local name, count = GetRecipeListInfo(listIndex)
@@ -118,13 +118,22 @@ local function SousChefCreateSettings()
"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)
+ 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)
+ 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)
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)]],
function() return SousChef.settings.experimentalMatch end,
function(value) SousChef.settings.experimentalMatch = not SousChef.settings.experimentalMatch end)
- if not SousChef.settings.processRecipes then
+ ZO_CreateStringId("SI_BINDING_NAME_SC_MARK_RECIPE", "Mark Recipe")
+
+ if not SousChef.settings.processRecipes then
ZO_Options_SetOptionInactive(markLearnt)
ZO_Options_SetOptionInactive(markAltKnows)
else
@@ -146,6 +155,7 @@ local function SousChef_Loaded(eventCode, addOnName)
checkKnown = "unknown",
markAlt = false,
colour = {1, 1, 1},
+ shoppingColour = {0,1,1},
Cookbook = {},
Pantry = {},
ReverseCookbook = {},
@@ -155,10 +165,12 @@ local function SousChef_Loaded(eventCode, addOnName)
processRecipes = true,
showSpecialIngredients = false,
ignoredRecipes = {},
- showOnClick = false
+ showOnClick = false,
+ shoppingList = {},
+ onlyShowShopping = false
}
- SousChef.settings = ZO_SavedVars:NewAccountWide("SousChef_Settings", 8, nil, defaults)
+ SousChef.settings = ZO_SavedVars:NewAccountWide("SousChef_Settings", 9, nil, defaults)
local function tablelength(T)
local count = 0
@@ -187,7 +199,8 @@ end
function SousChef.HookEvents()
EVENT_MANAGER:RegisterForEvent("SousChefTrading", EVENT_TRADING_HOUSE_RESPONSE_RECEIVED, SousChef.HookTrading)
EVENT_MANAGER:RegisterForEvent("SousChefLearnt", EVENT_RECIPE_LEARNED, SousChef.ParseRecipes)
- EVENT_MANAGER:RegisterForEvent("SousChefProvi", EVENT_CRAFTING_STATION_INTERACT, SousChef.HookRecipeTree)
+ EVENT_MANAGER:RegisterForEvent("SousChefProvi", EVENT_CRAFTING_STATION_INTERACT, function(...) SousChef:HookRecipeTree(...) end)
+ EVENT_MANAGER:RegisterForEvent("SousChefProvi", EVENT_END_CRAFTING_STATION_INTERACT, function() SousChef:UnhookRecipeTree() end)
SousChef.HookInventory()
end
diff --git a/SousChef.txt b/SousChef.txt
index 9d96a13..703a2bf 100644
--- a/SousChef.txt
+++ b/SousChef.txt
@@ -13,4 +13,5 @@ Common.lua
Inventory.lua
TradingHouse.lua
Provisioning.lua
-SousChef.xml
\ No newline at end of file
+SousChef.xml
+Bindings.xml
\ No newline at end of file
diff --git a/Utility.lua b/Utility.lua
index b958f39..87a3353 100644
--- a/Utility.lua
+++ b/Utility.lua
@@ -20,7 +20,7 @@ local separators = {"%^[%a:]+", "-", " " }
function u.StripLanguageIdentifiers(entry)
for _,v in pairs(languageElements) do
- entry = entry:gsub(v, "")
+ entry = entry:gsub(v, "")/rl
end
return entry
end
diff --git a/bindings.xml b/bindings.xml
new file mode 100644
index 0000000..fde0185
--- /dev/null
+++ b/bindings.xml
@@ -0,0 +1,9 @@
+<Bindings>
+ <Layer name="General">
+ <Category name="Sous Chef">
+ <Action name="SC_MARK_RECIPE">
+ <Down>SousChef:MarkRecipe()</Down>
+ </Action>
+ </Category>
+ </Layer>
+</Bindings>
\ No newline at end of file