move ctx.log to NetscriptHelpers

This commit is contained in:
Snarling
2022-08-08 15:51:50 -04:00
parent 8f8d9a1d23
commit 01e63b10a1
11 changed files with 296 additions and 234 deletions
+4 -3
View File
@@ -55,16 +55,17 @@ export function NetscriptCodingContract(player: IPlayer, workerScript: WorkerScr
const serv = helpers.getServer(ctx, hostname);
if (contract.isSolution(answerStr)) {
const reward = player.gainCodingContractReward(creward, contract.getDifficulty());
ctx.log(() => `Successfully completed Coding Contract '${filename}'. Reward: ${reward}`);
helpers.log(ctx, () => `Successfully completed Coding Contract '${filename}'. Reward: ${reward}`);
serv.removeContract(filename);
return returnReward ? reward : true;
} else {
++contract.tries;
if (contract.tries >= contract.getMaxNumTries()) {
ctx.log(() => `Coding Contract attempt '${filename}' failed. Contract is now self-destructing`);
helpers.log(ctx, () => `Coding Contract attempt '${filename}' failed. Contract is now self-destructing`);
serv.removeContract(filename);
} else {
ctx.log(
helpers.log(
ctx,
() =>
`Coding Contract attempt '${filename}' failed. ${
contract.getMaxNumTries() - contract.tries