WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Help/Support (https://www.wowinterface.com/forums/forumdisplay.php?f=3)
-   -   STUF Unit frames custom Lua- Is it possible to hide text if the target is casting? (https://www.wowinterface.com/forums/showthread.php?t=57162)

bender1453 05-24-19 05:33 PM

STUF Unit frames custom Luas - Hide level if it's 120 and hide power if it's 0
 
Changed my mind, the other issue isn't a big problem but these I have to fix.

bender1453 05-27-19 11:46 AM

Title changed as well. I'm using this and it works to some extent for power bars, but it doesn't show the value when it's full and I'd like to remove the class coloring too.

I have no idea how to hide the level text if it's 120, in other words, the cap.

function(unit)
local pCur, pMax, mCur, mMax = UnitPower(unit), UnitPowerMax(unit), UnitPower(unit, 0), UnitPowerMax(unit, 0)
if pMax > 0 then
local pType, pToken = UnitPowerType(unit)
local pColor = PowerBarColor[pType]
if ( (pToken ~= "MANA") and (mMax > 0) ) then -- Druid in Bear/Cat form
local mColor = PowerBarColor[0]
local mPer = ceil((mCur / mMax)*100)
local ShowPower, ShowMana
if ((pToken == "RAGE") and (pCur > 0)) or ((pToken == "ENERGY") and (pCur < pMax)) then
ShowPower = true
end
if mPer < 100 then
ShowMana = true
end
if ShowPower and ShowMana then
return "|cff%02x%02x%02x%s|r %s|cff05cbe5%%|r", pColor.r * 255, pColor.g * 255, pColor.b * 255, pCur, mPer
elseif ShowPower then
return "|cff%02x%02x%02x%s|r", pColor.r * 255, pColor.g * 255, pColor.b * 255, pCur
elseif ShowMana then
return "%s|cff05cbe5%%|r . |cff05cbe5%s|r", mPer, mCur
end

if pToken == "LUNAR_POWER" or pToken == "MAELSTROM" or pToken == "INSANITY" then
if pCur > 0 then
return "|cff%02x%02x%02x%s|r", pColor.r * 255, pColor.g * 255, pColor.b * 255, pCur
end
end
elseif pToken == "RAGE" or pToken == "RUNIC_POWER" or pToken == "FURY" or pToken == "PAIN" then -- Warrior / DK
if pCur > 0 then
return "|cff%02x%02x%02x%s|r", pColor.r * 255, pColor.g * 255, pColor.b * 255, pCur
end
elseif pToken == "MANA" then -- Mage
local pPer = ceil((pCur / pMax)*100)
if pCur < pMax then
return "%s|cff05cbe5%%|r", pPer
end
else -- Everything else
if pCur < pMax then
return "|cff%02x%02x%02x%s|r", pColor.r * 255, pColor.g * 255, pColor.b * 255, pCur
end
end
end
end


All times are GMT -6. The time now is 06:33 AM.

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