View Single Post
03/18/19, 03:07 PM   #5
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 5,012
For the crafting this is true, but I told you the addon to check the other stuff like BankAll as well:

Lua Code:
  1. local bankScene = SCENE_MANAGER:GetScene("bank")
  2. bankScene:RegisterCallback("StateChange",  function(oldState, newState)
  3.     if(newState == SCENE_SHOWING) then
  4.         --Remove the old keybind if there is still one activated
  5.         if DoItAll.currentKeyStripDef ~= nil then
  6.             KEYBIND_STRIP:RemoveKeybindButtonGroup(DoItAll.currentKeyStripDef)
  7.         end
  8.         KEYBIND_STRIP:AddKeybindButtonGroup(keystripDef)
  9.     elseif(newState == SCENE_HIDDEN) then
  10.         KEYBIND_STRIP:RemoveKeybindButtonGroup(keystripDef)
  11.         --Add the keystrip def to the global vars so we can reach it from everywhere
  12.         DoItAll.currentKeyStripDef = nil
  13.     end
  14. 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) )
  Reply With Quote