Check if the player is on a flying mount

This snippet will check if the player is currently on a flying mount. It works better (for me) then IsFlying() because that will return false if you are on a flying mount but not in the air.


-- you need this frame
local f = CreateFrame('GameTooltip', 'MyTooltip', UIParent, 'GameTooltipTemplate')

function isPlayerFlying ()
	local i = 1
	local text
	local buff

	f:SetOwner(UIParent, 'ANCHOR_NONE')

	buff = UnitBuff('player', i)
	while buff do
		f:SetUnitBuff('player', i)
		text = idFlightMode_TooltipTextLeft2:GetText()

		if text:match('^Increases flight speed by.*$') then
			return true

		i = i + 1
		buff = UnitBuff('player', i)


	return false
Posted by Industrial at Sun, 05 Jul 2009 18:56:17 +0000