View Single Post
09/19/14, 01:52 PM   #1
mattmillus
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 13
Hooking ZO_Tooltip:LayoutItem

I am trying to create a more powerful/graceful way of modifying item tooltips than PreHooking the OnShow and OnUpdate methods (which seems to be what most devs do).

I found this function inside itemtooltips.lua:
function ZO_Tooltip:LayoutItem(itemLink, equipped, creatorName)

This seems to be the perfect place to post-hook in - its the function that branches based on the item type and then draws all of the tooltips rows. However I do not seem to be able to hook the function using the same technique I used for other class functions (such as for hooking GUILD_ROSTER.CompareGuildMembers).

I do:
local origLayoutItem
local function myLayoutItem(self, itemLink, equipped, creatorName) d("HIT") end

and then I tried both:
1)
origLayoutItem = ItemTooltip.LayoutItem
ItemTooltip.LayoutItem = myLayoutItem

and 2)
origLayoutItem = ZO_Tooltip.LayoutItem
ZO_Tooltip.LayoutItem = myLayoutItem

But I cant get my debug to hit. Is this entire function truly not called by the game, or am I doing something wrong with the class object? Could it be a private function or something, how would I tell?

Any help appreciated!
  Reply With Quote