Many new api calls
This commit is contained in:
parent
e52378e03f
commit
d79a4485a6
6 changed files with 75 additions and 8 deletions
39
main.js
39
main.js
|
@ -1,4 +1,5 @@
|
|||
import * as autoContract from './automation/contract.js';
|
||||
import * as autoMining from './automation/mining.js';
|
||||
import * as agent from './lib/agent.js';
|
||||
import * as api from './lib/api.js';
|
||||
import * as contracts from './lib/contracts.js';
|
||||
|
@ -12,12 +13,16 @@ my-agent Fetch your agent's status.
|
|||
register [symbol] [faction] Registers your agent then inits the database
|
||||
ships.ship [ship_symbol] Retrieve a ship's status.
|
||||
ships Retrieve all of your ships.
|
||||
status Servers' status`);
|
||||
}
|
||||
|
||||
switch(process.argv[2]) {
|
||||
case 'autoContractForShip':
|
||||
await autoContract.auto({ship: process.argv[3]});
|
||||
break;
|
||||
case 'autoMiningForShip':
|
||||
await autoMining.mineUntilFullOf({ship: process.argv[3], good: 'NON_EXISTENT'});
|
||||
break;
|
||||
case 'init':
|
||||
if (process.argv[3] !== undefined && process.argv[4] !== undefined && process.argv[5] !== undefined) {
|
||||
agent.init(process.argv[3], process.argv[4], process.argv[5]);
|
||||
|
@ -38,14 +43,20 @@ case 'register':
|
|||
case 'ships':
|
||||
api.debugLog(await api.send({endpoint: '/my/ships'}));
|
||||
break;
|
||||
case 'status':
|
||||
api.debugLog(await api.send({endpoint: '/'}));
|
||||
break;
|
||||
default:
|
||||
// wip and manual actions
|
||||
switch(process.argv[2]) {
|
||||
case 'contracts.accept':
|
||||
api.debugLog(await contracts.accept({contract: process.argv[3]}));
|
||||
break;
|
||||
case 'contracts.contracts':
|
||||
api.debugLog(await contracts.contracts());
|
||||
break;
|
||||
case 'contracts.accept':
|
||||
api.debugLog(await contracts.accept({id: process.argv[3]}));
|
||||
case 'contracts.fulfill':
|
||||
api.debugLog(await contracts.fulfill({contract: process.argv[3]}));
|
||||
break;
|
||||
case 'ships.dock':
|
||||
api.debugLog(await ships.dock({ship: process.argv[3]}));
|
||||
|
@ -53,9 +64,18 @@ default:
|
|||
case 'ships.extract':
|
||||
api.debugLog(await ships.extract({ship: process.argv[3]}));
|
||||
break;
|
||||
case 'ships.jump':
|
||||
api.debugLog(await ships.jump({ship: process.argv[3], system: process.argv[4]}));
|
||||
break;
|
||||
//case 'market':
|
||||
// api.send({endpoint: `/systems/${process.argv[3]}/waypoints/${process.argv[4]}/market`});
|
||||
// break;
|
||||
case 'ships.navigate':
|
||||
api.debugLog(await ships.navigate({ship: process.argv[3], waypoint: process.argv[4]}));
|
||||
break;
|
||||
case 'ships.negotiate':
|
||||
api.debugLog(await ships.negotiate({ship: process.argv[3]}));
|
||||
break;
|
||||
case 'ships.navigate':
|
||||
api.debugLog(await ships.navigate({ship: process.argv[3], waypoint: process.argv[4]}));
|
||||
break;
|
||||
|
@ -74,12 +94,27 @@ default:
|
|||
case 'ships.ship':
|
||||
api.debugLog(await ships.ship({ship: process.argv[3]}));
|
||||
break;
|
||||
case 'ships.survey':
|
||||
api.debugLog(await ships.survey({ship: process.argv[3]}));
|
||||
break;
|
||||
case 'systems.asteroids':
|
||||
api.debugLog(await systems.type({symbol: process.argv[3], type: 'ASTEROID_FIELD'}));
|
||||
break;
|
||||
case 'systems.jumpGate':
|
||||
api.debugLog(await systems.type({symbol: process.argv[3], type: 'JUMP_GATE'}));
|
||||
break;
|
||||
case 'systems.shipyard':
|
||||
api.debugLog(await systems.shipyard({symbol: process.argv[3]}));
|
||||
break;
|
||||
case 'systems.shipyards':
|
||||
api.debugLog(await systems.trait({symbol: process.argv[3], trait: 'SHIPYARD'}));
|
||||
break;
|
||||
case 'systems.system':
|
||||
api.debugLog(await systems.system({symbol: process.argv[3]}));
|
||||
break;
|
||||
case 'systems.systems':
|
||||
api.debugLog(await systems.systems());
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue