From 6504e44ffa97965e47e893b55621d2d04003d519 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Wed, 15 May 2024 23:49:33 +0200 Subject: [node] Added agent class, and fixed contract updates --- nodejs/automation/init.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'nodejs/automation') 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 { 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 { } db.reset(); dbTokens.addToken(json.data.token); - dbAgents.addAgent(json.data.agent); + setAgent(json.data.agent); } -- cgit v1.2.3