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:
function DEFAULT_OBJECTIVE_TRACKER_MODULE:SetHeader(block, text, animateReason)
block.module = self;
block.isHeader = true;
block.Text:SetText(text);
block.animateReason = animateReason or 0;
self.Header = block;
end
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:
--[[Functions called using the object calling syntax, object:method(...), can also be hooked; one simply has to remember that the construct is merely syntactic sugar for objec*****thod(object, ...);. To hook a function that was originally declared as:]]
function AnAddon.Module:FuncName(arg1)
-- Things happen here...
end
--[[We store the original function and replace it with a hook:]]
local original_AnAddon_Module_FuncName = AnAddon.Module.FuncName;
function AnAddon.Module:FuncName(...)
local arg1 = ...; -- Use the vararg expression in case the function signature changes
if type(arg1) == "number" and arg1 > 0 then
-- Call the original function; because of object calling syntax,
-- pass self as the first argument.
return original_AnAddon_Module_FuncName(self, ...);
end
end
--[[The example hook above will only allow the original function to be called if the first argument is a strictly positive number.]]
According to this example, i tryed to hook Blizzards function "
DEFAULT_OBJECTIVE_TRACKER_MODULE:SetHeader" with this code:
Lua Code:
local DEFAULT_OBJECTIVE_TRACKER_MODULE_SET_HEADER = DEFAULT_OBJECTIVE_TRACKER_MODULE.SetHeader
function DEFAULT_OBJECTIVE_TRACKER_MODULE:SetHeader(...)
print("TEST")
return DEFAULT_OBJECTIVE_TRACKER_MODULE_SET_HEADER(self, ...);
end
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)