View Single Post
03/23/15, 08:28 AM   #2
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
It would be much easier if you do not add new line, but just modify text already in there.
For example line:
Spell Resistance: 10000
becomes:
Spell Resistance: 10000 (15.63%)


Simple code how to do that:
Lua Code:
  1. local function GetDisplayValue(self)
  2.     local value = self:GetValue()
  3.     local percentage = value / ((GetUnitLevel("player") + GetUnitVeteranRank("player"))  * 10)
  4.  
  5.     return ("%d (%04.02f%%)"):format(value, percentage)
  6. end
  7.  
  8. local SetUpStat_Orig = ZO_Stats.SetUpStat
  9. local function SetUpStat(self, statEntry, statType)
  10.     SetUpStat_Orig(self, statEntry, statType)
  11.     if statType == STAT_SPELL_RESIST or statType == STAT_PHYSICAL_RESIST then
  12.         self.statEntries[statType].GetDisplayValue = GetDisplayValue
  13.     end
  14. end
  15. ZO_Stats.SetUpStat = SetUpStat
  Reply With Quote