diff options
author | Julien Dessaux | 2023-05-29 23:25:09 +0200 |
---|---|---|
committer | Julien Dessaux | 2023-05-29 23:25:09 +0200 |
commit | d79a4485a6b1a3ae6b647d94b45ee22a515441f2 (patch) | |
tree | eccef4acf2a206fa0cfd74c783672287ae99a50b /lib/ships.js | |
parent | Refactored the code to separate automation code from the lib handling the api (diff) | |
download | spacetraders-d79a4485a6b1a3ae6b647d94b45ee22a515441f2.tar.gz spacetraders-d79a4485a6b1a3ae6b647d94b45ee22a515441f2.tar.bz2 spacetraders-d79a4485a6b1a3ae6b647d94b45ee22a515441f2.zip |
Many new api calls
Diffstat (limited to '')
-rw-r--r-- | lib/ships.js | 15 |
1 files changed, 15 insertions, 0 deletions
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'}); +} |