I wrote a WeakAura to display Ressource/Powerbars to the default nameplates.
It is pretty easy to display text but I want my own text-format and I have issues to use my custom code for nameplates since I dont have a exact unit like player/target/focus.
My Weakaura as lua.import:
https://pastebin.com/q8SaDGMV
WeakAuras
Display
Custom/Common Text:
Code:
function()
local power = UnitPower("UNIT");
local maxPower = UnitPowerMax("UNIT");
return string.format("%s", aura_env.pretty(power), aura_env.pretty(maxPower))
end
Action
Custom/Format Code:
Code:
aura_env.pretty = function(power)
if power < 1000 then
return string.format('%s', power)
end
if power < 1000000 then
powerRed = power/1000
suffix = 'k'
elseif power < 1000000000 then
powerRed = power/1000000
suffix = 'm'
else
powerRed = power/1000000000
suffix = 'b'
end
if powerRed < 10 then
return string.format('%.1f%s', powerRed, suffix)
elseif powerRed < 100 then
return string.format('%.1f%s', powerRed, suffix)
else
return string.format('%.1f%s', powerRed, suffix)
end
end
I could use the default/weakaura format options but I would prefer my own one.
If somebody has an idea/knows how to get this to work I would really appreciate some help