1
0
Fork 0

[node] multiple contracting fixes and some more refactoring

This commit is contained in:
Julien Dessaux 2024-04-06 21:36:42 +02:00
parent eeaa64b5ed
commit 3e80bc8a4d
Signed by: adyxax
GPG key ID: F92E51B86E07177E
6 changed files with 65 additions and 46 deletions

View file

@ -61,6 +61,10 @@ export async function deliver(contract: Contract, ship: Ship): Promise<Contract>
}});
if (response.error) {
switch(response.error.code) {
case 4503: // contract has expired
// TODO sell cargo? the next trading loop should take care of it by itself
contract.fulfilled = true;
return contract;
case 4509: // contract delivery terms have been met
return await fulfill(contract);
default: // yet unhandled error