mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-26 17:43:48 +01:00
Added a check to prevent doubling coding contract rewards
This commit is contained in:
parent
f5f5879fc3
commit
a23c55c760
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user