For the crafting this is true, but I told you the addon to check the other stuff like BankAll as well:
Lua Code:
local bankScene = SCENE_MANAGER:GetScene("bank")
bankScene:RegisterCallback("StateChange", function(oldState, newState)
if(newState == SCENE_SHOWING) then
--Remove the old keybind if there is still one activated
if DoItAll.currentKeyStripDef ~= nil then
KEYBIND_STRIP:RemoveKeybindButtonGroup(DoItAll.currentKeyStripDef)
end
KEYBIND_STRIP:AddKeybindButtonGroup(keystripDef)
elseif(newState == SCENE_HIDDEN) then
KEYBIND_STRIP:RemoveKeybindButtonGroup(keystripDef)
--Add the keystrip def to the global vars so we can reach it from everywhere
DoItAll.currentKeyStripDef = nil
end
end)
Get the scene for the crafting, use the scene's StateChange callback function to add/remove the keybinds. Try this.
SCENE_MANAGER.currentScene is providing you the current scene if you are at the crafting station.
If the scene is always the same and you need a difference you could check if the scene got fragments below and use the fragment's StateChange callback function then.
And check within the scene which mode is currently activated via a preHook to SMITHING.SetMode to see which mode of the crafting station gets activated (modes = e.g.
--Smithing modes
SMITHING_MODE_ROOT = 0
SMITHING_MODE_REFINMENT = 1
SMITHING_MODE_CREATION = 2
SMITHING_MODE_DECONSTRUCTION = 3
SMITHING_MODE_IMPROVEMENT = 4
SMITHING_MODE_RESEARCH = 5
SMITHING_MODE_RECIPES = 6
)
But as said before: Please do not overwrite the functions in smithing like SetMode or others which will most likely kill other addons! Just prehook them and add e.g. a small delay like 250ms to wait for them to be finished (via zo_callLater(function() --your stuff in here end, 250) )