-- PLAYER_TARGET_CHANGED
function(e)
	local hasEyes = UnitBuff("player", "Spectral Sight") -- Spectral Sight
	if not hasEyes then
		--print("Player has no Spectral Sight")
		return
	end

	local unitUuid = UnitGUID("target")
	if not unitUuid then
		--print(string.format("Target has no UUID: %s", tostring(unitUuid)))
		return
	end
	--print(string.format("Target UUID: %s", tostring(unitUuid)))

	if not string.find(unitUuid, "Player") then
		--print(string.format("Target %s is not a player", tostring(unitUuid)))
		return
	end

	local targetStealth = UnitBuff("target", "Stealth")
	if not targetStealth then
		--print("Target has no Stealth")
		return
	end
	--print(string.format("Target Stealth: %s", tostring(targetStealth)))

	local targetName = UnitName("target")
	if not targetName then
		--print("Target has no name")
		return
	end
	--print(string.format("Target Name: %s", tostring(targetName)))

	local pvp = UnitIsPVP("target")
	local pvpState = pvp == true and "ON" or "OFF"

	local low, high = WeakAuras.GetRange("target")
	local key = string.format("%s-%s-%s-%s", unitUuid, targetName, low, high)
	--print(string.format("Key: %s", tostring(key)))
	--print(string.format("Previous Key: %s", tostring(aura_env.previousTarget)))
	if not aura_env.previousTarget then aura_env.previousTarget = key end
	if aura_env.previousTarget == key then
		--print(string.format("Target same as previous target: %s", tostring(key)))
		return
	end

	local message =
		string.format("I see %s in stealth with pvp %s between %d and %d yards away", targetName, pvpState, low, high)
	--print(string.format("Sending message: %s", tostring(message)))
	SendChatMessage(message, "RAID")
	aura_env.previousTarget = key
end
