mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-21 23:23:51 +01:00
UI: fix scripts recorded offline income (#1025)
This commit is contained in:
parent
fccc27fe58
commit
84c4dba1e2
@ -56,7 +56,7 @@ export function scriptCalculateOfflineProduction(runningScript: RunningScript):
|
||||
Player.gainHackingExp(expGain);
|
||||
|
||||
const moneyGain =
|
||||
(runningScript.onlineMoneyMade / runningScript.onlineRunningTime) * timePassed * CONSTANTS.OfflineHackingIncome;
|
||||
(runningScript.onlineMoneyMade / Player.playtimeSinceLastAug) * timePassed * CONSTANTS.OfflineHackingIncome;
|
||||
// money is given to player during engine load
|
||||
Player.scriptProdSinceLastAug += moneyGain;
|
||||
|
||||
|
@ -3,7 +3,8 @@ import "../../src/Player";
|
||||
import { loadAllServers, saveAllServers } from "../../src/Server/AllServers";
|
||||
import { loadAllRunningScripts } from "../../src/NetscriptWorker";
|
||||
import { Settings } from "../../src/Settings/Settings";
|
||||
|
||||
import { Player, setPlayer } from "../../src/Player";
|
||||
import { PlayerObject } from "../../src/PersonObjects/Player/PlayerObject";
|
||||
jest.useFakeTimers();
|
||||
|
||||
// Direct tests of loading and saving.
|
||||
@ -151,6 +152,9 @@ test("load/saveAllServers", () => {
|
||||
// Feed a JSON object through loadAllServers/saveAllServers.
|
||||
// The object is a pruned set of servers that was extracted from a real (dev) game.
|
||||
jest.setSystemTime(123456789000);
|
||||
|
||||
setPlayer(new PlayerObject());
|
||||
Player.playtimeSinceLastAug = 123456;
|
||||
loadStandardServers();
|
||||
|
||||
// Re-stringify with indenting for nicer diffs
|
||||
|
Loading…
Reference in New Issue
Block a user