mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-22 07:33:48 +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);
|
Player.gainHackingExp(expGain);
|
||||||
|
|
||||||
const moneyGain =
|
const moneyGain =
|
||||||
(runningScript.onlineMoneyMade / runningScript.onlineRunningTime) * timePassed * CONSTANTS.OfflineHackingIncome;
|
(runningScript.onlineMoneyMade / Player.playtimeSinceLastAug) * timePassed * CONSTANTS.OfflineHackingIncome;
|
||||||
// money is given to player during engine load
|
// money is given to player during engine load
|
||||||
Player.scriptProdSinceLastAug += moneyGain;
|
Player.scriptProdSinceLastAug += moneyGain;
|
||||||
|
|
||||||
|
@ -3,7 +3,8 @@ import "../../src/Player";
|
|||||||
import { loadAllServers, saveAllServers } from "../../src/Server/AllServers";
|
import { loadAllServers, saveAllServers } from "../../src/Server/AllServers";
|
||||||
import { loadAllRunningScripts } from "../../src/NetscriptWorker";
|
import { loadAllRunningScripts } from "../../src/NetscriptWorker";
|
||||||
import { Settings } from "../../src/Settings/Settings";
|
import { Settings } from "../../src/Settings/Settings";
|
||||||
|
import { Player, setPlayer } from "../../src/Player";
|
||||||
|
import { PlayerObject } from "../../src/PersonObjects/Player/PlayerObject";
|
||||||
jest.useFakeTimers();
|
jest.useFakeTimers();
|
||||||
|
|
||||||
// Direct tests of loading and saving.
|
// Direct tests of loading and saving.
|
||||||
@ -151,6 +152,9 @@ test("load/saveAllServers", () => {
|
|||||||
// Feed a JSON object through loadAllServers/saveAllServers.
|
// Feed a JSON object through loadAllServers/saveAllServers.
|
||||||
// The object is a pruned set of servers that was extracted from a real (dev) game.
|
// The object is a pruned set of servers that was extracted from a real (dev) game.
|
||||||
jest.setSystemTime(123456789000);
|
jest.setSystemTime(123456789000);
|
||||||
|
|
||||||
|
setPlayer(new PlayerObject());
|
||||||
|
Player.playtimeSinceLastAug = 123456;
|
||||||
loadStandardServers();
|
loadStandardServers();
|
||||||
|
|
||||||
// Re-stringify with indenting for nicer diffs
|
// Re-stringify with indenting for nicer diffs
|
||||||
|
Loading…
Reference in New Issue
Block a user