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:
local function GetDisplayValue(self)
local value = self:GetValue()
local percentage = value / ((GetUnitLevel("player") + GetUnitVeteranRank("player")) * 10)
return ("%d (%04.02f%%)"):format(value, percentage)
end
local SetUpStat_Orig = ZO_Stats.SetUpStat
local function SetUpStat(self, statEntry, statType)
SetUpStat_Orig(self, statEntry, statType)
if statType == STAT_SPELL_RESIST or statType == STAT_PHYSICAL_RESIST then
self.statEntries[statType].GetDisplayValue = GetDisplayValue
end
end
ZO_Stats.SetUpStat = SetUpStat