From 37e32ee0f89aece02dfbf1ce7b0944ed893bf0b2 Mon Sep 17 00:00:00 2001 From: Daniel Barbera <87785383+xRalic@users.noreply.github.com> Date: Tue, 24 May 2022 16:26:40 +0200 Subject: [PATCH 1/3] #3711: Generate contracts only on network --- src/CodingContractGenerator.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CodingContractGenerator.ts b/src/CodingContractGenerator.ts index de8160166..9ec41ca0c 100644 --- a/src/CodingContractGenerator.ts +++ b/src/CodingContractGenerator.ts @@ -155,7 +155,7 @@ function getRandomReward(): ICodingContractReward { } function getRandomServer(): BaseServer { - const servers = GetAllServers(); + const servers = GetAllServers().filter((server: BaseServer) => server.serversOnNetwork.length !== 0); let randIndex = getRandomInt(0, servers.length - 1); let randServer = servers[randIndex]; From e7a9273c80a3f7d761861f5dfdd739cdb22d07d1 Mon Sep 17 00:00:00 2001 From: Daniel Barbera <87785383+xRalic@users.noreply.github.com> Date: Tue, 24 May 2022 00:31:43 +0200 Subject: [PATCH 2/3] #2709: Generate contracts while offline --- src/engine.tsx | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/engine.tsx b/src/engine.tsx index 80be6d846..33b16057b 100644 --- a/src/engine.tsx +++ b/src/engine.tsx @@ -272,20 +272,20 @@ const Engine: { const numCyclesOffline = Math.floor(timeOffline / CONSTANTS._idleSpeed); // Generate coding contracts - // let numContracts = 0; - // if (numCyclesOffline < 3000 * 100) { - // // if we have less than 100 rolls, just roll them exactly. - // for (let i = 0; i < numCyclesOffline / 3000; i++) { - // if (Math.random() < 0.25) numContracts++; - // } - // } else { - // // just average it. - // numContracts = (numCyclesOffline / 3000) * 0.25; - // } - // console.log(`${numCyclesOffline} ${numContracts}`); - // for (let i = 0; i < numContracts; i++) { - // generateRandomContract(); - // } + let numContracts = 0; + if (numCyclesOffline < 3000 * 100) { + // if we have less than 100 rolls, just roll them exactly. + for (let i = 0; i < numCyclesOffline / 3000; i++) { + if (Math.random() < 0.25) numContracts++; + } + } else { + // just average it. + numContracts = (numCyclesOffline / 3000) * 0.25; + } + console.log(`${numCyclesOffline} ${numContracts}`); + for (let i = 0; i < numContracts; i++) { + generateRandomContract(); + } let offlineReputation = 0; const offlineHackingIncome = (Player.moneySourceA.hacking / Player.playtimeSinceLastAug) * timeOffline * 0.75; From 761d0cb03ed02e05b2a0903e01a9140476653976 Mon Sep 17 00:00:00 2001 From: Daniel Barbera <87785383+xRalic@users.noreply.github.com> Date: Tue, 24 May 2022 00:45:44 +0200 Subject: [PATCH 3/3] Remove logging --- src/engine.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/engine.tsx b/src/engine.tsx index 33b16057b..cc9e09761 100644 --- a/src/engine.tsx +++ b/src/engine.tsx @@ -282,7 +282,6 @@ const Engine: { // just average it. numContracts = (numCyclesOffline / 3000) * 0.25; } - console.log(`${numCyclesOffline} ${numContracts}`); for (let i = 0; i < numContracts; i++) { generateRandomContract(); }