View Single Post
12/03/14, 01:32 PM   #61
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 5,048
Ok, thanks again, I'll give it a try this way.

After my tries:
I'm not able to prehook the function SetMode of ZO_Smithing or SMITHING.

I've tried it in several ways, searched for aliases to use. But there are none as it seems.
The way I know it should work does nothing:
Lua Code:
  1. ZO_PreHook("ZO_Smithing", "SetMode", function(mode)
  2. ...
  3. end)

Ok, my fault. Or let's say another feature
I forgot to remove the "" around ZO_Smithing :-(
And the function needs another parameter before mode (holding the SMITHING object).


Correct call:

Lua Code:
  1. --Prehook the smithing function SetMode() which gets executed as the smithing tabs are changed
  2.     ZO_PreHook(ZO_Smithing, "SetMode", function(smithing_obj, mode)
  3.  
  4.         d("[ZO_Smithing:SetMode] Mode: " .. tostring(mode), true)
  5.         if     mode == SMITHING_MODE_REFINMENT then
  6.             d("REFINEMENT")
  7.         elseif mode == SMITHING_MODE_CREATION then
  8.             d("CREATION")
  9.         elseif mode == SMITHING_MODE_IMPROVEMENT then
  10.             d("IMPROVEMENT")
  11.         elseif mode == SMITHING_MODE_DECONSTRUCTION then
  12.             d("DECONSTRUCTION")
  13.         elseif mode == SMITHING_MODE_RESEARCH then
  14.             d("RESEARCH")
  15.         else
  16.             d("SMITHING")
  17.         end
  18.         return false
  19.     end)

Last edited by Baertram : 12/03/14 at 02:40 PM.
  Reply With Quote