WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Help/Support (https://www.wowinterface.com/forums/forumdisplay.php?f=3)
-   -   WeakAura Nameplate custom Power-Text (https://www.wowinterface.com/forums/showthread.php?t=58792)

rulezyx 06-12-21 12:23 PM

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 :)


All times are GMT -6. The time now is 11:32 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI