Thread: Stuf + Threat
View Single Post
06-10-11, 09:29 PM   #33
Nibelheim
local roygbi-
 
Nibelheim's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 1,600
Or for some extra features:

Code:
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)
			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 |cff%02x%02x%02x%s|r", pColor.r * 255, pColor.g * 255, pColor.b * 255, pCur, mColor.r * 255, mColor.g * 255, mColor.b * 255, 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 "|cff%02x%02x%02x%s|r", mColor.r * 255, mColor.g * 255, mColor.b * 255, mPer
			end
		elseif pToken == "RAGE" or pToken == "RUNIC_POWER" 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 == "ENERGY" then	-- Rogue
			if pCur < pMax then
				return "|cff%02x%02x%02x%s|r", pColor.r * 255, pColor.g * 255, pColor.b * 255, pCur
			end
		else	-- Everything else
			local pPer = ceil(pCur / pMax)
			if pPer < 100 then
				return "|cff%02x%02x%02x%s|r", pColor.r * 255, pColor.g * 255, pColor.b * 255, pPer
			end
		end
	end
end
Dry coded, so may not work

Edit: I wonder if Stuf supports MouseOver. In Pitbull you can just say If IsMouseOver() then and do cool things, like showing different values on mouseover.

Last edited by Nibelheim : 06-10-11 at 09:42 PM.
  Reply With Quote