Thread Tools Display Modes
06-12-21, 12:23 PM   #1
rulezyx
A Flamescale Wyrmkin
 
rulezyx's Avatar
Join Date: Jan 2020
Posts: 106
Smile WeakAura Nameplate custom Power-Text

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
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » WeakAura Nameplate custom Power-Text

Thread Tools
Display Modes

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