View Single Post
08-31-20, 08:52 PM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
I would innately follow what the original function did, cutting out everything else that's irrelevant to what you want to change.

In response to your example, this would hook the original function to run afterward and change the text of the objectives to remove the prepended dash.
Lua Code:
  1. hooksecurefunc("QuestWatch_Update",function()
  2.     local questidx;
  3.     local lineidx=1;
  4.     local numobjectives;
  5.  
  6.     for i=1,GetNumQuestWatches() do
  7.         questidx=GetQuestIndexForWatch(i);
  8.         if questidx then
  9.             numobjectives=GetNumQuestLeaderBoards(questidx);
  10.             if numobjectives>0 then
  11.                 lineidx=lineidx+1;--    Iterate past title header
  12.                 for j=1,numobjectives do
  13.                     local textobj=_G["QuestWatchLine"..lineidx];
  14.                     if not textobj then return; end--   This check isn't in the original function and it will throw an error if it runs out of these text objects
  15.  
  16.                     local objective=GetQuestLogLeaderBoard(j,questidx);
  17.                     textobj:SetText(objective);
  18.  
  19.                     lineidx=lineidx+1;--    Iterate to next line
  20.                 end
  21.             end
  22.         end
  23.     end
  24. end);
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 08-31-20 at 09:00 PM.
  Reply With Quote