How can i hook complex Blizz functions, like: Module:FuncName(arguments)?
I would like to SetJustifyH "CENTER" all ObjectiveTrackerBlocks and remove all "Dashes" as well. I'm talking about Blocks that contains information about Quests you currently track:
(Sorry for different language on screenshot) Files that respond to this frames locates in Interface\AddOns\Blizzard_ObjectiveTracker\ folder. There are lots of files in this folder, but I think most relevant is this: Blizzard_ObjectiveTracker.lua (link to wowprogramming.com) There are lot's of complex functions that I had never worked before. For example: Lua Code:
I tried to investigate more information about this functions and how they works, and for me (person who never programmed before, it's pretty hard to instantly understand them, but i would like). On Hooking Functions Guide I read that it's possible to hook this strange functions. This Guide gives this example: Lua Code:
Lua Code:
But it looks like that i'm doing something wrong. I don't get any lua errors, but no print("TEST") as well, so it's not hooked. I will very appreciate if you could help me with example of how can i hook this complex functions or with advice or ideas how can i SetJustifyH("CENTER") and remove Dash without hooking this crazy functions (Names of ObjectiveTrackerBlocks are dynamic: example on screenshot) :) |
SetHeader method is only used when Blizzard_ObjectiveTracker add-on is loaded, your function won't be call because your add-on can't be loaded before the Blizzard_ObjectiveTracker.
For secure, you should use hooksecurefunc. Maybe you can test on Lua Code:
|
I'm not entirely sure, especially when it comes to metatables, but it seems like it stores the functions to the table DEFAULT_OBJECTIVE_TRACKER_MODULE and then creates a link to these with the metatable, so it still links to the old function in the memory if you dont hook it before the metatable is created. And it seems SetHeader is used only once per trackerframe on startup so I believe you cant hook it (theres a good chance Im wrong here though).
Maybe you can do something like this though Code:
local trackers = { |
Based on the code used in Who Framed Watcher Wabbit this should probably work:
lua Code:
Depending on how the lines are sized and anchored (I didn't look) you may need to make additional changes to support center alignment. If it doesn't look properly centered, post a screenshot. |
All times are GMT -6. The time now is 02:44 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI