Refine complete = Use event_craft_started -> check if in refine mode (API functiosn exists somewhere in esoui/ingame/crafting) -> event_craft_complete it's done or event_craft_failed / event_craft_aborted it was not finished correctly
Works for all other craftings as well.
Helpfull functions in here:
https://github.com/esoui/esoui/blob/...ftingutils.lua
There exists the function ZO_SmithingExtractionSlot:IsInRefineMode()
ZO_SmithingExtractionSlot should relate to the global variable SMITHING.refinementPanel
I'm using it like this within DoItAll:
Lua Code:
function DoItAll.IsShowingExtraction()
return not ZO_EnchantingTopLevelExtractionSlotContainer:IsHidden()
end
function DoItAll.IsShowingDeconstruction()
return not ZO_SmithingTopLevelDeconstructionPanelSlotContainer:IsHidden()
end
function DoItAll.IsShowingRefinement()
return not ZO_SmithingTopLevelRefinementPanelSlotContainer:IsHidden()
end
local function GetExtractionContainerFunctionCtrlAndPanel()
if DoItAll.IsShowingExtraction() then
return ZO_EnchantingTopLevelInventoryBackpack, ExtractEnchantingItem, ENCHANTING, ENCHANTING
elseif DoItAll.IsShowingDeconstruction() then
return ZO_SmithingTopLevelDeconstructionPanelInventoryBackpack, ExtractOrRefineSmithingItem, SMITHING, SMITHING.deconstructionPanel
elseif DoItAll.IsShowingRefinement() then
return ZO_SmithingTopLevelRefinementPanelInventoryBackpack, ExtractOrRefineSmithingItem, SMITHING, SMITHING.refinementPanel
end
end
And for the extraction then:
Lua Code:
container, extractFunction, craftingTableCtrlVar, craftingTablePanel = GetExtractionContainerFunctionCtrlAndPanel()
Lua Code:
if craftingTableCtrlVar.CanItemBeAddedToCraft then
extractable = craftingTableCtrlVar:CanItemBeAddedToCraft(slot.bagId, slot.slotIndex)
--Refinemant only if stackcount >= 10
if DoItAll.IsShowingRefinement() and doitall_slot.stackCount ~= nil and doitall_slot.stackCount < 10 then
extractable = false
end
--Some more checks like the maximum multicraft items (ZOs added a maximum constant MAX_ITERATIONS_PER_DECONSTRUCTION here -> See file DoItAll/src/ExtractAll/Extraction.lua)
--Check if the items to add to the extract slot are >= MAX_ITERATIONS_PER_DECONSTRUCTION (for refine it needs to be multiplied by the stackCount as each item of the 10 to refine counts as a single one!!!) and if it's => above the constant MAX_ITERATIONS_PER_DECONSTRUCTION extract those first (there cannot be added more then!) and return with the next "batch" of items to extract.
...
if extracable then
craftingTableCtrlVar:AddItemToCraft(slot.bagId, slot.slotIndex))
endif
And at the end check if only 1 or multiple items are added to the slot and extract them:
Lua Code:
if extractionSlot:HasOneItem() and craftingTablePanel.ExtractSingle then
craftingTablePanel:ExtractSingle()
elseif extractionSlot:HasMultipleItems() then
if showConfirmatioNDialog then
craftingTablePanel:ConfirmExtractAll()
else
--Attention: Direct extraction, no confirmation dialog!
craftingTablePanel:ExtractAll()
end
end
I'm registering a callback function at EVENT_CRAFT_STARTED for EVENT_CRAFT_COMPLETE and EVENT_CRAFT_FALIED. If one of them gets called it will be unregistering the 2 callback functions again. Same if next EVENT_CRAFT_STARTED is called.
Hope this helps.