mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-26 03:00:56 +02:00
merge dev
This commit is contained in:
+9
-27
@@ -5,9 +5,8 @@ import { Factions, loadFactions } from "./Faction/Factions";
|
||||
import { loadAllGangs, AllGangs } from "./Gang/AllGangs";
|
||||
import { loadMessages, initMessages, Messages } from "./Message/MessageHelpers";
|
||||
import { Player, loadPlayer } from "./Player";
|
||||
import { AllServers, loadAllServers } from "./Server/AllServers";
|
||||
import { saveAllServers, loadAllServers } from "./Server/AllServers";
|
||||
import { Settings } from "./Settings/Settings";
|
||||
import { loadSpecialServerIps, SpecialServerIps } from "./Server/SpecialServerIps";
|
||||
import { SourceFileFlags } from "./SourceFile/SourceFileFlags";
|
||||
import { loadStockMarket, StockMarket } from "./StockMarket/StockMarket";
|
||||
import { staneksGift, loadStaneksGift } from "./CotMG/Helper";
|
||||
@@ -29,7 +28,6 @@ class BitburnerSaveObject {
|
||||
AllServersSave = "";
|
||||
CompaniesSave = "";
|
||||
FactionsSave = "";
|
||||
SpecialServerIpsSave = "";
|
||||
AliasesSave = "";
|
||||
GlobalAliasesSave = "";
|
||||
MessagesSave = "";
|
||||
@@ -43,24 +41,9 @@ class BitburnerSaveObject {
|
||||
getSaveString(): string {
|
||||
this.PlayerSave = JSON.stringify(Player);
|
||||
|
||||
// Delete all logs from all running scripts
|
||||
const TempAllServers = JSON.parse(JSON.stringify(AllServers), Reviver);
|
||||
for (const ip in TempAllServers) {
|
||||
const server = TempAllServers[ip];
|
||||
if (server == null) {
|
||||
continue;
|
||||
}
|
||||
for (let i = 0; i < server.runningScripts.length; ++i) {
|
||||
const runningScriptObj = server.runningScripts[i];
|
||||
runningScriptObj.logs.length = 0;
|
||||
runningScriptObj.logs = [];
|
||||
}
|
||||
}
|
||||
|
||||
this.AllServersSave = JSON.stringify(TempAllServers);
|
||||
this.AllServersSave = saveAllServers();
|
||||
this.CompaniesSave = JSON.stringify(Companies);
|
||||
this.FactionsSave = JSON.stringify(Factions);
|
||||
this.SpecialServerIpsSave = JSON.stringify(SpecialServerIps);
|
||||
this.AliasesSave = JSON.stringify(Aliases);
|
||||
this.GlobalAliasesSave = JSON.stringify(GlobalAliases);
|
||||
this.MessagesSave = JSON.stringify(Messages);
|
||||
@@ -173,7 +156,6 @@ function loadGame(saveString: string): boolean {
|
||||
loadAllServers(saveObj.AllServersSave);
|
||||
loadCompanies(saveObj.CompaniesSave);
|
||||
loadFactions(saveObj.FactionsSave);
|
||||
loadSpecialServerIps(saveObj.SpecialServerIpsSave);
|
||||
|
||||
if (saveObj.hasOwnProperty("StaneksGiftSave")) {
|
||||
loadStaneksGift(saveObj.StaneksGiftSave);
|
||||
@@ -241,6 +223,13 @@ function loadGame(saveString: string): boolean {
|
||||
console.error("ERROR: Failed to parse last export bonus Settings " + err);
|
||||
}
|
||||
}
|
||||
if (Player.inGang() && saveObj.hasOwnProperty("AllGangsSave")) {
|
||||
try {
|
||||
loadAllGangs(saveObj.AllGangsSave);
|
||||
} catch (e) {
|
||||
console.error("ERROR: Failed to parse AllGangsSave: " + e);
|
||||
}
|
||||
}
|
||||
if (saveObj.hasOwnProperty("VersionSave")) {
|
||||
try {
|
||||
const ver = JSON.parse(saveObj.VersionSave, Reviver);
|
||||
@@ -258,13 +247,6 @@ function loadGame(saveString: string): boolean {
|
||||
} else {
|
||||
createNewUpdateText();
|
||||
}
|
||||
if (Player.inGang() && saveObj.hasOwnProperty("AllGangsSave")) {
|
||||
try {
|
||||
loadAllGangs(saveObj.AllGangsSave);
|
||||
} catch (e) {
|
||||
console.error("ERROR: Failed to parse AllGangsSave: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user