From d79a4485a6b1a3ae6b647d94b45ee22a515441f2 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Mon, 29 May 2023 23:25:09 +0200 Subject: Many new api calls --- lib/ships.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'lib/ships.js') diff --git a/lib/ships.js b/lib/ships.js index 6eefd87..109054c 100644 --- a/lib/ships.js +++ b/lib/ships.js @@ -30,10 +30,21 @@ export async function dock(ctx) { return response; } +export async function jump(ctx) { + const response = await api.send({endpoint: `/my/ships/${ctx.ship}/jump`, method: 'POST', payload: { systemSymbol: ctx.system }}); + await api.sleep(response.data.cooldown.remainingSeconds*1000); + return response; +} + export async function navigate(ctx) { const response = await api.send({endpoint: `/my/ships/${ctx.ship}/navigate`, method: 'POST', payload: { waypointSymbol: ctx.waypoint }}); const delay = new Date(response.data.nav.route.arrival) - new Date(); await api.sleep(delay); + return response; +} + +export async function negotiate(ctx) { + return await api.send({endpoint: `/my/ships/${ctx.ship}/negotiate/contract`, method: 'POST'}); } export async function orbit(ctx) { @@ -58,3 +69,7 @@ export async function sell(ctx) { export async function ship(ctx) { return await api.send({endpoint: `/my/ships/${ctx.ship}`}); } + +export async function survey(ctx) { + return await api.send({endpoint: `/my/ships/${ctx.ship}/survey`, method: 'POST'}); +} -- cgit v1.2.3