View Single Post
07-31-18, 05:01 AM   #8
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 666
Originally Posted by MuffinManKen View Post
The comment about hooksecurefunc got me wondering if this is even the right direction to go in.

MuffinFactionizer (among other things) allows sorting of your Factions list in the standard Reputation dialog. To do this it creates its own "ReputationFrame_Update".

What are the current "best practices" for replacing significant functionality in a default UI frame? The current approach of just replacing some functions feels fragile.
hooksecurefunc will work just fine here. ReputationFrame_Update will happen, then your own hooked function will change what it needs to each time. I hook that same function for my ExaltedPlus addon to alter the paragon faction bars. It’s also very simple to switch to immediately.

Code:
function YourRepFrameUpdate()
    -- your code
end
turns into

Code:
hooksecurefunc("ReputationFrame_Update",function()
    -- your code untouched
end)
Nothing should be different. Then, you can strip all the duplicate stuff your function does that ReputationFrame_Update already does that you don’t need to change, so your hook is streamlined to only what you want to change.
  Reply With Quote