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]; diff --git a/src/engine.tsx b/src/engine.tsx index 80be6d846..cc9e09761 100644 --- a/src/engine.tsx +++ b/src/engine.tsx @@ -272,20 +272,19 @@ 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; + } + for (let i = 0; i < numContracts; i++) { + generateRandomContract(); + } let offlineReputation = 0; const offlineHackingIncome = (Player.moneySourceA.hacking / Player.playtimeSinceLastAug) * timeOffline * 0.75;