diff --git a/src/Terminal/Terminal.ts b/src/Terminal/Terminal.ts index 5369a5907..db9daa67b 100644 --- a/src/Terminal/Terminal.ts +++ b/src/Terminal/Terminal.ts @@ -284,7 +284,7 @@ export class Terminal implements ITerminal { `Security decreased on '${server.hostname}' from ${numeralWrapper.formatSecurity( oldSec, )} to ${numeralWrapper.formatSecurity(newSec)} (min: ${numeralWrapper.formatSecurity(server.minDifficulty)})` + - ` and Gained ${numeralWrapper.formatExp(expGain)} hacking exp.`, + ` and Gained ${numeralWrapper.formatExp(expGain)} hacking exp.`, ); } @@ -330,8 +330,7 @@ export class Terminal implements ITerminal { this.print("Time to hack: " + (!isHacknet ? convertTimeMsToTimeElapsedString(hackingTime, true) : "N/A")); } this.print( - `Total money available on server: ${ - currServ instanceof Server ? numeralWrapper.formatMoney(currServ.moneyAvailable) : "N/A" + `Total money available on server: ${currServ instanceof Server ? numeralWrapper.formatMoney(currServ.moneyAvailable) : "N/A" }`, ); if (currServ instanceof Server) { @@ -463,6 +462,12 @@ export class Terminal implements ITerminal { this.contractOpen = true; const res = await contract.prompt(); + //Check if the contract still exists by the time the promise is fullfilled + if (serv.getContract(contractName) == null) { + this.contractOpen = false; + return this.error("Contract no longer exists (Was it solved by a script?)"); + } + switch (res) { case CodingContractResult.Success: if (contract.reward !== null) {