local lastMounted =0
local eventHandler = CreateFrame("Frame", nil, WorldFrame)

eventHandler:SetScript("OnUpdate", function()
	if IsMounted() then
		lastMounted = GetTime()
	end
end)

WhatsNext:AddConditionalStatement("Player Crowd Controlled",{
	category = "Player State",
	test = function(checkTable) 
		return not HasFullControl()
	end,
	text = "player is suffering from a form of crowd control.",
	arguments = {}
})

WhatsNext:AddConditionalStatement("Stealthed",{
	category = "Player State",
	test = function(checkTable) 
		return IsStealthed()
	end,
	text = "player is stealthed.",
	arguments = {}
})
WhatsNext:AddConditionalStatement("Resting",{
	category = "Player State",
	test = function(checkTable) 
		return IsResting()
	end,
	text = "player is resting.",
	arguments = {}
})
WhatsNext:AddConditionalStatement("Outdoors",{
	category = "Player State",
	test = function(checkTable) 
		return IsOutdoors()
	end,
	text = "player is outdoors.",
	arguments = {}
})
WhatsNext:AddConditionalStatement("Flying",{
	category = "Player State",
	test = function(checkTable) 
		return IsFlying()
	end,
	text = "player is flying.",
	arguments = {}
})
WhatsNext:AddConditionalStatement("Falling",{
	category = "Player State",
	test = function(checkTable) 
		return IsFalling()
	end,
	text = "player is falling.",
	arguments = {}
})
WhatsNext:AddConditionalStatement("Mounted",{
	category = "Player State",
	test = function(checkTable) 
		return IsMounted()
	end,
	text = "player is mounted.",
	arguments = {}
})
WhatsNext:AddConditionalStatement("MountedRecently",{
	category = "Player State",
	test = function(checkTable) 
		return  GetTime() - lastMounted <= tonumber(checkTable.time)
	end,
	text = "player was mounted in the last {time} seconds.",
	arguments = {
		time = {label = "Seconds", type = "integer", default = 1, min = 1, max = 60}
	}
})
WhatsNext:AddConditionalStatement("Swimming",{
	category = "Player State",
	test = function(checkTable) 
		return IsSwimming()
	end,
	text = "player is swimming.",
	arguments = {}
})
WhatsNext:AddConditionalStatement("SelfRes",{
	category = "Player State",
	test = function(checkTable) 
		return HasSoulstone()
	end,
	text = "player is dead and can self-resurrect.",
	arguments = {}
})