diff options
author | Julien Dessaux | 2024-05-15 23:49:33 +0200 |
---|---|---|
committer | Julien Dessaux | 2024-05-15 23:49:33 +0200 |
commit | 6504e44ffa97965e47e893b55621d2d04003d519 (patch) | |
tree | 18b416bdd03988b5e2215e8e4c1771b06e7f4084 /nodejs/automation | |
parent | [node] updated dependencies (diff) | |
download | spacetraders-6504e44ffa97965e47e893b55621d2d04003d519.tar.gz spacetraders-6504e44ffa97965e47e893b55621d2d04003d519.tar.bz2 spacetraders-6504e44ffa97965e47e893b55621d2d04003d519.zip |
[node] Added agent class, and fixed contract updates
Diffstat (limited to '')
-rw-r--r-- | nodejs/automation/init.ts | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/nodejs/automation/init.ts b/nodejs/automation/init.ts index 28163b7..7ec1252 100644 --- a/nodejs/automation/init.ts +++ b/nodejs/automation/init.ts @@ -1,12 +1,9 @@ -import * as dbAgents from '../database/agents.ts'; import * as db from '../database/db.ts'; import * as dbTokens from '../database/tokens.ts'; import { Response, } from '../lib/api.ts'; -import { - Agent, -} from '../lib/types.ts'; +import { Agent, initAgent, setAgent } from '../lib/agent.ts'; import { Contract } from '../lib/contracts.ts'; import { Ship } from '../lib/ships.ts'; import * as libContracts from '../lib/contracts.ts'; @@ -30,6 +27,7 @@ export async function init(): Promise<void> { switch(json.error?.code) { case 4111: // 4111 means the agent symbol has already been claimed so no server reset happened // TODO await agents.agents(); + await initAgent(); return; default: throw json; @@ -37,5 +35,5 @@ export async function init(): Promise<void> { } db.reset(); dbTokens.addToken(json.data.token); - dbAgents.addAgent(json.data.agent); + setAgent(json.data.agent); } |