1
0
Fork 0

Many new api calls

This commit is contained in:
Julien Dessaux 2023-05-29 23:25:09 +02:00
parent e52378e03f
commit d79a4485a6
Signed by: adyxax
GPG key ID: F92E51B86E07177E
6 changed files with 75 additions and 8 deletions

View file

@ -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'});
}