Lua GetPowerPct

From ArcEmu-Wiki
Jump to: navigation, search

Description

Returns the Unit's percentage of power left based upon the argument passed. If no argument is passed (The argument is omitted) or set to -1, then the default power is returned.

Power Types

POWER_TYPE_MANA			= 0
POWER_TYPE_RAGE			= 1
POWER_TYPE_FOCUS		= 2
POWER_TYPE_ENERGY		= 3
POWER_TYPE_HAPPINESS		= 4
POWER_TYPE_RUNES		= 5
POWER_TYPE_RUNIC_POWER		= 6

Usage/Example

The following script, once run, would set the player's power it's maximum using the Arcane Intellect visual (Thanks to use of :Energize()).

function Restore(pUnit, _, pPlayer)
	local powerpct = pPlayer:GetPowerPct()
	if (powerpct <= 100) then
		pUnit:Energize(pPlayer, 23030, pPlayer:GetMaxPower(), pPlayer:GetPowerType())
	end
end
Personal tools