View Single Post
02/13/23, 12:06 AM   #7
Matoro342
Join Date: Feb 2023
Posts: 9
Ok, I'll see if I understand this correctly:

Lua Code:
  1. local function TooltipHook(tooltipControl, method, linkFunc)
  2.     local origMethod = tooltipControl[method] -- saving the original method
  3.  
  4.     tooltipControl[method] = function(self, ...) -- redefining the method for the tooltipControl object
  5.         origMethod(self, ...) -- do whatever it was supposed to before
  6.         AddRuneInfo(self, GetRuneInfoText(linkFunc(...))) -- do additional stuff using the function for the item link
  7.     end
  8. end

Am I correct in assuming this only needs to be called once because it just overwrites the original function and it then doesn't require a hook every time it's called? I am somewhat confused as HookBagTips() passes in ItemTooltip to the tooltipControl, I think at first I thought it had to be a defined variable pulled from the game, but this is just actually generally letting us rewrite the functions for any ItemTooltip? I apologize for being a noob with LUA.

With that method, do I still need to use something like ZO_PreHook or an event manager per tooltip? I would guess it only needs to run once. I will try it with SecurePostHook and see where that gets me. Thanks so much!
  Reply With Quote