Quantcast
WoWInterface - View Single Post - How can i hook complex Blizz functions, like: Module:FuncName(arguments)?
View Single Post
10-03-15, 08:27 PM   #4
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Based on the code used in Who Framed Watcher Wabbit this should probably work:

lua Code:
  1. -- Keep track of headers and lines we already processed:
  2. local skinnedHeaders, skinnedLines = {}, {}
  3.  
  4. -- Function to apply changes to headers and lines:
  5. local function UpdateLine(module, block, objectiveKey, text, lineType, useFullHeight, hideDash, colorStyle)
  6.     -- Process the header:
  7.     local header = block.HeaderText
  8.     if header and not skinnedHeaders[header] then
  9.         -- Center align the header text:
  10.         header:SetJustifyH("CENTER")
  11.         -- (You can add more changes here if you like)
  12.         -- Add it to the table of headers we already processed:
  13.         skinnedHeaders[header] = true
  14.     end
  15.     -- Process the line itself:
  16.     local line = block.lines[objectiveKey]
  17.     if line and not skinnedLines[lines] then
  18.         -- Center align the line text:
  19.         line.Text:SetJustifyH("CENTER")
  20.         -- (You can add more changes here if you like)
  21.         -- If the line has a dash...
  22.         if line.Dash then
  23.             -- ...hide the dash:
  24.             line.Dash:Hide()
  25.             -- ...and prevent it from being shown in the future:
  26.             line.Dash.Show = line.Dash.Hide
  27.         end
  28.         -- Add it to the list of lines we already processed:
  29.         skinnedLines[line] = true
  30.     end
  31. end
  32.  
  33. -- Hook the AddObjective method for all modules:
  34. for i = 1, #ObjectiveTrackerFrame.MODULES do
  35.     hooksecurefunc(ObjectiveTrackerFrame.MODULES[i], "AddObjective", UpdateLine)
  36. end
  37. hooksecurefunc(SCENARIO_TRACKER_MODULE, "AddObjective", UpdateLine)

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.
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
  Reply With Quote