
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 = function(checkTable) 
		return "player is suffering from a form of crowd control."
	end,
	arguments = {}
})

WhatsNext:AddConditionalStatement("Stealthed",{
	category = "Player State",
	test = function(checkTable) 
		return IsStealthed()
	end,
	text = function(checkTable) 
		return "player is stealthed."
	end,
	arguments = {}
})
WhatsNext:AddConditionalStatement("Resting",{
	category = "Player State",
	test = function(checkTable) 
		return IsResting()
	end,
	text = function(checkTable) 
		return "player is resting."
	end,
	arguments = {}
})
WhatsNext:AddConditionalStatement("Outdoors",{
	category = "Player State",
	test = function(checkTable) 
		return IsOutdoors()
	end,
	text = function(checkTable) 
		return "player is outdoors."
	end,
	arguments = {}
})
WhatsNext:AddConditionalStatement("Flying",{
	category = "Player State",
	test = function(checkTable) 
		return IsFlying()
	end,
	text = function(checkTable) 
		return "player is flying."
	end,
	arguments = {}
})
WhatsNext:AddConditionalStatement("Falling",{
	category = "Player State",
	test = function(checkTable) 
		return IsFalling()
	end,
	text = function(checkTable) 
		return "player is falling."
	end,
	arguments = {}
})
WhatsNext:AddConditionalStatement("Mounted",{
	category = "Player State",
	test = function(checkTable) 
		return IsMounted()
	end,
	text = function(checkTable) 
		return "player is mounted."
	end,
	arguments = {}
})
WhatsNext:AddConditionalStatement("MountedRecently",{
	category = "Player State",
	test = function(checkTable) 
		return  GetTime() - lastMounted <= tonumber(checkTable.time)
	end,
	text = function(checkTable) 
		return "player was mounted in the last " .. WhatsNext:GetNumberDisplay(checkTable.time) .. " seconds."
	end,
	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 = function(checkTable) 
		return "player is swimming."
	end,
	arguments = {}
})
WhatsNext:AddConditionalStatement("SelfRes",{
	category = "Player State",
	test = function(checkTable) 
		return HasSoulstone()
	end,
	text = function(checkTable) 
		return "player is dead and can self-resurrect."
	end,
	arguments = {}
})