Quantcast
WoWInterface - View Single Post - LF help with UIErrorsFrame:AddMessage
View Single Post
07-04-20, 02:16 PM   #2
Kanegasi
A Firelord
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 495
The text size is dictated by UIErrorsFrame itself, I don't think you can change the size of an individual line.

As for the icon, I don't think you can dynamically get the file path to use in the texture escape sequence if you were looking to code for any spell, but you can look up the file name on wowhead by finding the icon ID.

Code:
Cyclone spell ID is 33786:
    https://www.wowhead.com/spell=33786
Click on the icon and the popup shows 136022, so:
    https://www.wowhead.com/icon=136022
File name is "Spell_nature_earthbind", so:
    /run print("\124TInterface\\ICONS\\Spell_nature_earthbind:0\124t")
This command prints the icon autosized to your chat frame.
Now for the class color, you'll have to query UnitGUID("target"), then the second return of GetPlayerInfoByGUID(guid), then RAID_CLASS_COLORS[class].colorStr.

Code:
local guid,_,class,color=UnitGUID("target")
if guid then
    _,class=GetPlayerInfoByGUID(guid)
end
if class then
    color=RAID_CLASS_COLORS[class].colorStr
end
Now put everything together:

Lua Code:
  1. local guid,name,_,class,color=UnitGUID("target"),UnitName("target")
  2. if guid then
  3.     _,class=GetPlayerInfoByGUID(guid)
  4. end
  5. if class then
  6.     color=RAID_CLASS_COLORS[class].colorStr
  7. end
  8.  
  9. UIErrorsFrame:AddMessage("Casted \124TInterface\\ICONS\\Spell_nature_earthbind:0\124t on "..((color and "\124C"..color or "")..(name or "")..(color and "\124r" or "")).."!!",1.0,2.0,1.0,53,3)
  Reply With Quote