Fix blade corp gang equal 0

This commit is contained in:
Olivier Gagnon 2021-10-12 19:23:36 -04:00
parent 85aa67ac26
commit 6543e73f6f
4 changed files with 20 additions and 4 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -153,6 +153,17 @@ function evaluateVersionCompatibility(ver: string): void {
}
}
}
if (ver < "0.56.1") {
if (anyPlayer.bladeburner === 0) {
anyPlayer.bladeburner = null;
}
if (anyPlayer.gang === 0) {
anyPlayer.gang = null;
}
if (anyPlayer.corporation === 0) {
anyPlayer.corporation = null;
}
}
}
function loadGame(saveString: string): boolean {

@ -58,9 +58,10 @@ export class Script {
download(): void {
const filename = this.filename + ".js";
const file = new Blob([this.code], { type: "text/plain" });
if (window.navigator.msSaveOrOpenBlob) {
const navigator = window.navigator as any;
if (navigator.msSaveOrOpenBlob) {
// IE10+
window.navigator.msSaveOrOpenBlob(file, filename);
navigator.msSaveOrOpenBlob(file, filename);
} else {
// Others
const a = document.createElement("a"),
@ -112,6 +113,10 @@ export class Script {
this.markUpdated();
}
imports(): string[] {
return [];
}
// Serialize the current object to a JSON save state
toJSON(): any {
return Generic_toJSON("Script", this);