-- TODO: Make this not suck
function TomTom:AddWaypoint(x, y, desc, persistent, minimap, world, silent)
	local c, z = GetCurrentMapContinent(), GetCurrentMapZone()

	if not c or not z or c < 1 then
		--self:Print("Cannot find a valid zone to place the coordinates")
		return
	end

	return self:AddZWaypoint(c, z, x, y, desc, persistent, minimap, world, nil, silent)
end

function TomTom:AddZWaypoint(c, z, x, y, desc, persistent, minimap, world, callbacks, silent, crazy)
	-- Convert the c,z,x,y tuple to m,f,x,y and pass the work off to AddMFWaypoint()
	local mapId, floor = hbd:GetMapIDFromCZ(c, z)
	if not mapId then return end

	return self:AddMFWaypoint(mapId, floor, x / 100, y / 100, {
		title = desc,
		persistent = persistent,
		minimap = minimap,
		world = world,
		callbacks = callbacks,
		silent = silent,
		crazy = crazy,
	})
end

function TomTom:AddWaypointToCurrentZone(x, y, desc)
	local m, f = TomTom:GetCurrentPlayerPosition()
	if not m then return end

	return self:AddMFWaypoint(m, f, x / 100, y / 100, {
		title = desc,
	})
end

function TomTom:SetCustomWaypoint(c, z, x, y, callback, minimap, world, silent)
	return self:AddZWaypoint(c, z, x, y, nil, false, minimap, world, callback, silent)
end

function TomTom:SetCustomMFWaypoint(m, f, x, y, opts)
	opts.persistent = false

	return self:AddMFWaypoint(m, f, x, y, opts)
end
