Added quality filter to the Provisioning Table
Wobin [05-11-14 - 05:57]
Added quality filter to the Provisioning Table
diff --git a/Provisioning.lua b/Provisioning.lua
index 2c9f756..6df5269 100644
--- a/Provisioning.lua
+++ b/Provisioning.lua
@@ -2,6 +2,33 @@ local SousChef = SousChef
local u = SousChef.Utility
local m = SousChef.Media
+function SousChef:UpdateProvisioningTable()
+ self.qualityCheckBox = SousChef_ControllerOnlyQuality
+
+ local function OnFilterChanged()
+ self.settings.qualityChecked = ZO_CheckButton_IsChecked(self.qualityCheckBox)
+ PROVISIONER:DirtyRecipeTree()
+ end
+ self.qualityCheckBox:SetParent(ZO_ProvisionerTopLevel)
+ ZO_CheckButton_SetLabelText(self.qualityCheckBox, "Quality")
+ ZO_CheckButton_SetToggleFunction(self.qualityCheckBox, OnFilterChanged)
+ ZO_CraftingUtils_ConnectCheckBoxToCraftingProcess(self.qualityCheckBox)
+ ZO_CheckButton_SetCheckState(self.qualityCheckBox, self.settings.qualityChecked)
+
+ -- Nudge to the left
+ ZO_ProvisionerTopLevelHaveSkills:ClearAnchors()
+ ZO_ProvisionerTopLevelHaveSkills:SetAnchor( LEFT, ZO_ProvisionerTopLevelHaveIngredients, RIGHT, 180 )
+
+ SousChef.filter = PROVISIONER.DoesRecipePassFilter
+
+ PROVISIONER.DoesRecipePassFilter =
+ function(control, specialIngredientType, numCreatable, provisionerLevelReq, qualityReq)
+ if ZO_CheckButton_IsChecked(self.qualityCheckBox) and qualityReq < 2 then return false end
+ return SousChef.filter(control, specialIngredientType, numCreatable, provisionerLevelReq, qualityReq)
+ end
+end
+
+
SousChef.ProvisioningButton=
{{
name = "Mark Recipe", -- or function that returns a name
@@ -84,7 +111,7 @@ end
function SousChef:HookRecipeTree(...)
local eventId, craftingTable = ...
- if craftingTable ~= CRAFTING_TYPE_PROVISIONING then return end
+ if craftingTable ~= CRAFTING_TYPE_PROVISIONING then return end
zo_callLater(function() SousChef:HookRecipeTreeFunction() end, 1000)
end
diff --git a/SousChef.lua b/SousChef.lua
index 6ef954f..631a8fd 100644
--- a/SousChef.lua
+++ b/SousChef.lua
@@ -216,7 +216,8 @@ local function SousChef_Loaded(eventCode, addOnName)
showOnClick = false,
showCounts = true,
shoppingList = {},
- onlyShowShopping = false
+ onlyShowShopping = false,
+ qualityChecked = false
}
SousChef.settings = ZO_SavedVars:NewAccountWide("SousChef_Settings", 9, GetCVar("Language.2"), defaults)
@@ -240,6 +241,8 @@ local function SousChef_Loaded(eventCode, addOnName)
SLASH_COMMANDS['/sciremove'] = SousChef.RemoveRecipeFromIgnoreList
SLASH_COMMANDS['/scilist'] = SousChef.ListIgnoredRecipes
+ SousChef:UpdateProvisioningTable()
+
-- Now we want to hook into the function that sets the details on the inventory slot
zo_callLater(SousChef.HookEvents, 3000)
end
diff --git a/SousChef.xml b/SousChef.xml
index e6888bd..68275d2 100644
--- a/SousChef.xml
+++ b/SousChef.xml
@@ -1,6 +1,11 @@
<GuiXml>
<Controls>
<TopLevelControl name="SousChef_Controller">
+ <Controls>
+ <Button name="$(parent)OnlyQuality" inherits="ZO_CheckButton">
+ <Anchor point="LEFT" relativeTo="ZO_ProvisionerTopLevelHaveSkills" relativePoint="RIGHT" offsetX="150" />
+ </Button>
+ </Controls>
</TopLevelControl>
</Controls>
</GuiXml>
\ No newline at end of file