Offline hacking income now shown for scripts (#873)

This commit is contained in:
alutman 2023-10-23 20:00:16 +11:00 committed by GitHub
parent 36a8b35cfb
commit 445c0c3134
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 1 deletions

@ -9,6 +9,7 @@ export const CONSTANTS: {
VersionNumber: number;
MaxSkillLevel: number;
MilliPerCycle: number;
OfflineHackingIncome: number;
CorpFactionRepRequirement: number;
BaseFocusBonus: number;
BaseCostFor1GBOfRamHome: number;
@ -96,6 +97,9 @@ export const CONSTANTS: {
// Milliseconds per game cycle
MilliPerCycle: 200,
// Multiplier for hacking income earned from offline scripts
OfflineHackingIncome: 0.75,
// How much reputation is needed to join a megacorporation's faction
CorpFactionRepRequirement: 400e3,

@ -54,9 +54,15 @@ export function scriptCalculateOfflineProduction(runningScript: RunningScript):
const expGain = confidence * (runningScript.onlineExpGained / runningScript.onlineRunningTime) * timePassed;
Player.gainHackingExp(expGain);
const moneyGain =
(runningScript.onlineMoneyMade / runningScript.onlineRunningTime) * timePassed * CONSTANTS.OfflineHackingIncome;
// money is given to player during engine load
Player.scriptProdSinceLastAug += moneyGain;
// Update script stats
runningScript.offlineRunningTime += timePassed;
runningScript.offlineExpGained += expGain;
runningScript.offlineMoneyMade += moneyGain;
// Weaken
for (const hostname of Object.keys(runningScript.dataMap)) {

@ -262,7 +262,8 @@ const Engine: {
}
let offlineReputation = 0;
const offlineHackingIncome = (Player.moneySourceA.hacking / Player.playtimeSinceLastAug) * timeOffline * 0.75;
const offlineHackingIncome =
(Player.moneySourceA.hacking / Player.playtimeSinceLastAug) * timeOffline * CONSTANTS.OfflineHackingIncome;
Player.gainMoney(offlineHackingIncome, "hacking");
// Process offline progress