Thread Tools Display Modes
04-01-14, 03:20 PM   #1
Malsomnus
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Apr 2013
Posts: 203
Patch 6.0

So after reading the new patch notes (and taking roughly 20 minutes to stop laughing), I realized that it's probably going to be up to me to create an add-on named Version 6.0 Sneak Peek that implements as many of the changes described in those patch notes as possible.
(Why, yes, I'm the same crazy guy who started developing Crabby...)

So, in a nutshell:
1. Is it possible to modify game strings, e.g. to replace every instance of the string "rogue" with "blush" and every instance of "brew" with "giggle juice"?
2. Any tips for modifying ability tooltips? (Yes, Charge would get a random one)
3. Fake number squish, can I do that by carefully wrapping many API functions?
4. Is this a really really stupid idea?
__________________
SanityCheck - If you've ever said the words "Sorry, I forgot" then you need this add-on.

Remember, every time you post a comment on an add-on, a kitten gets its wings!
  Reply With Quote
04-01-14, 11:35 PM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,324
I guess you can try intercepting UI functions that set the text of various UI elements by hooking into the UI object metatables. For example, if you want to intercept and modify the text of every FontString object as they are being set, this example code would be a place to start.

Lua Code:
  1. --  First, we dynamicly create a FontString object in order to grab the shared FontString metatable
  2. local meta=getmetatable(UIParent:CreateFontString("BACKGROUND")).__index;
  3. local SetText=meta.SetText;--   Link to our original function
  4.  
  5. --  We need to secure hook the function in case this would be called by secure code
  6. hooksecurefunc(meta,"SetText",function(self,text)
  7. --  Even though the original function has already set the text as supplied, we'll replace it with our own
  8.  
  9. --  We don't want to throw a UI error if text isn't a string
  10.     if type(text)~="string" then return; end
  11.  
  12. --  We use string.gsub() to modify the text using the old function
  13.     SetText(self,text:gsub("SearchWord","ReplacementWord");
  14. end);

Note the secure hook method may not work for functions like GameTooltip:AddLine(), in which each call adds a new line.
__________________
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)
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Patch 6.0


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off