mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-05-02 05:47:14 +02:00
run auto fix lint
This commit is contained in:
@@ -324,7 +324,7 @@ export async function calculateRamUsage(codeCopy, otherScripts) {
|
||||
loadedFns: {},
|
||||
env: {
|
||||
vars: RamCosts,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
+17
-17
@@ -11,7 +11,7 @@ import { post } from "../ui/postToTerminal";
|
||||
import {
|
||||
Generic_fromJSON,
|
||||
Generic_toJSON,
|
||||
Reviver
|
||||
Reviver,
|
||||
} from "../../utils/JSONReviver";
|
||||
import { getTimestamp } from "../../utils/helpers/getTimestamp";
|
||||
|
||||
@@ -29,44 +29,44 @@ export class RunningScript {
|
||||
dataMap: IMap<number[]> = {};
|
||||
|
||||
// Script filename
|
||||
filename: string = "";
|
||||
filename = "";
|
||||
|
||||
// This script's logs. An array of log entries
|
||||
logs: string[] = [];
|
||||
|
||||
// Flag indicating whether the logs have been updated since
|
||||
// the last time the UI was updated
|
||||
logUpd: boolean = false;
|
||||
logUpd = false;
|
||||
|
||||
// Total amount of hacking experience earned from this script when offline
|
||||
offlineExpGained: number = 0;
|
||||
offlineExpGained = 0;
|
||||
|
||||
// Total amount of money made by this script when offline
|
||||
offlineMoneyMade: number = 0;
|
||||
offlineMoneyMade = 0;
|
||||
|
||||
// Number of seconds that the script has been running offline
|
||||
offlineRunningTime: number = 0.01;
|
||||
offlineRunningTime = 0.01;
|
||||
|
||||
// Total amount of hacking experience earned from this script when online
|
||||
onlineExpGained: number = 0;
|
||||
onlineExpGained = 0;
|
||||
|
||||
// Total amount of money made by this script when online
|
||||
onlineMoneyMade: number = 0;
|
||||
onlineMoneyMade = 0;
|
||||
|
||||
// Number of seconds that this script has been running online
|
||||
onlineRunningTime: number = 0.01;
|
||||
onlineRunningTime = 0.01;
|
||||
|
||||
// Process ID. Must be an integer and equals the PID of corresponding WorkerScript
|
||||
pid: number = -1;
|
||||
pid = -1;
|
||||
|
||||
// How much RAM this script uses for ONE thread
|
||||
ramUsage: number = 0;
|
||||
ramUsage = 0;
|
||||
|
||||
// IP of the server on which this script is running
|
||||
server: string = "";
|
||||
server = "";
|
||||
|
||||
// Number of threads that this script is running with
|
||||
threads: number = 1;
|
||||
threads = 1;
|
||||
|
||||
constructor(script: Script | null = null, args: any[] = []) {
|
||||
if (script == null) { return; }
|
||||
@@ -91,7 +91,7 @@ export class RunningScript {
|
||||
}
|
||||
|
||||
displayLog(): void {
|
||||
for (var i = 0; i < this.logs.length; ++i) {
|
||||
for (let i = 0; i < this.logs.length; ++i) {
|
||||
post(this.logs[i]);
|
||||
}
|
||||
}
|
||||
@@ -101,7 +101,7 @@ export class RunningScript {
|
||||
}
|
||||
|
||||
// Update the moneyStolen and numTimesHack maps when hacking
|
||||
recordHack(serverIp: string, moneyGained: number, n: number=1) {
|
||||
recordHack(serverIp: string, moneyGained: number, n=1) {
|
||||
if (this.dataMap[serverIp] == null || this.dataMap[serverIp].constructor !== Array) {
|
||||
this.dataMap[serverIp] = [0, 0, 0, 0];
|
||||
}
|
||||
@@ -110,7 +110,7 @@ export class RunningScript {
|
||||
}
|
||||
|
||||
// Update the grow map when calling grow()
|
||||
recordGrow(serverIp: string, n: number=1) {
|
||||
recordGrow(serverIp: string, n=1) {
|
||||
if (this.dataMap[serverIp] == null || this.dataMap[serverIp].constructor !== Array) {
|
||||
this.dataMap[serverIp] = [0, 0, 0, 0];
|
||||
}
|
||||
@@ -118,7 +118,7 @@ export class RunningScript {
|
||||
}
|
||||
|
||||
// Update the weaken map when calling weaken() {
|
||||
recordWeaken(serverIp: string, n: number=1) {
|
||||
recordWeaken(serverIp: string, n=1) {
|
||||
if (this.dataMap[serverIp] == null || this.dataMap[serverIp].constructor !== Array) {
|
||||
this.dataMap[serverIp] = [0, 0, 0, 0];
|
||||
}
|
||||
|
||||
+10
-10
@@ -12,7 +12,7 @@ import { setTimeoutRef } from "../utils/SetTimeoutRef";
|
||||
import {
|
||||
Generic_fromJSON,
|
||||
Generic_toJSON,
|
||||
Reviver
|
||||
Reviver,
|
||||
} from "../../utils/JSONReviver";
|
||||
import { roundToTwo } from "../../utils/helpers/roundToTwo";
|
||||
|
||||
@@ -25,13 +25,13 @@ export class Script {
|
||||
}
|
||||
|
||||
// Code for this script
|
||||
code: string = "";
|
||||
code = "";
|
||||
|
||||
// Filename for the script file
|
||||
filename: string = "";
|
||||
filename = "";
|
||||
|
||||
// url of the script if any, only for NS2.
|
||||
url: string = "";
|
||||
url = "";
|
||||
|
||||
// The dynamic module generated for this script when it is run.
|
||||
// This is only applicable for NetscriptJS
|
||||
@@ -46,12 +46,12 @@ export class Script {
|
||||
dependencies: ScriptUrl[] = [];
|
||||
|
||||
// Amount of RAM this Script requres to run
|
||||
ramUsage: number = 0;
|
||||
ramUsage = 0;
|
||||
|
||||
// IP of server that this script is on.
|
||||
server: string = "";
|
||||
server = "";
|
||||
|
||||
constructor(fn: string="", code: string="", server: string="", otherScripts: Script[]=[]) {
|
||||
constructor(fn="", code="", server="", otherScripts: Script[]=[]) {
|
||||
this.filename = fn;
|
||||
this.code = code;
|
||||
this.ramUsage = 0;
|
||||
@@ -59,7 +59,7 @@ export class Script {
|
||||
this.module = "";
|
||||
this.moduleSequenceNumber = ++globalModuleSequenceNumber;
|
||||
if (this.code !== "") { this.updateRamUsage(otherScripts); }
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Download the script as a file
|
||||
@@ -70,7 +70,7 @@ export class Script {
|
||||
if (window.navigator.msSaveOrOpenBlob) {// IE10+
|
||||
window.navigator.msSaveOrOpenBlob(file, filename);
|
||||
} else { // Others
|
||||
var a = document.createElement("a"),
|
||||
const a = document.createElement("a"),
|
||||
url = URL.createObjectURL(file);
|
||||
a.href = url;
|
||||
a.download = filename;
|
||||
@@ -119,7 +119,7 @@ export class Script {
|
||||
* @param {Script[]} otherScripts - Other scripts on the server. Used to process imports
|
||||
*/
|
||||
async updateRamUsage(otherScripts: Script[]) {
|
||||
var res = await calculateRamUsage(this.code, otherScripts);
|
||||
const res = await calculateRamUsage(this.code, otherScripts);
|
||||
if (res > 0) {
|
||||
this.ramUsage = roundToTwo(res);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import { FconfSettings } from "../Fconf/FconfSettings";
|
||||
import {
|
||||
iTutorialSteps,
|
||||
iTutorialNextStep,
|
||||
ITutorial
|
||||
ITutorial,
|
||||
} from "../InteractiveTutorial";
|
||||
import { Player } from "../Player";
|
||||
import { AceEditor } from "../ScriptEditor/Ace";
|
||||
@@ -31,7 +31,7 @@ import { dialogBoxCreate } from "../../utils/DialogBox";
|
||||
import {
|
||||
Reviver,
|
||||
Generic_toJSON,
|
||||
Generic_fromJSON
|
||||
Generic_fromJSON,
|
||||
} from "../../utils/JSONReviver";
|
||||
import { compareArrays } from "../../utils/helpers/compareArrays";
|
||||
import { createElement } from "../../utils/uiHelpers/createElement";
|
||||
@@ -56,12 +56,12 @@ export function scriptEditorInit() {
|
||||
editor.beautifyScript();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
// Text that displays RAM calculation
|
||||
scriptEditorRamText = createElement("p", {
|
||||
display:"inline-block", margin:"10px", id:"script-editor-status-text"
|
||||
display:"inline-block", margin:"10px", id:"script-editor-status-text",
|
||||
});
|
||||
|
||||
// Label for checkbox (defined below)
|
||||
@@ -70,7 +70,7 @@ export function scriptEditorInit() {
|
||||
innerText:"Dynamic RAM Usage Checker", color:"white",
|
||||
tooltip:"Enable/Disable the dynamic RAM Usage display. You may " +
|
||||
"want to disable it for very long scripts because there may be " +
|
||||
"performance issues"
|
||||
"performance issues",
|
||||
});
|
||||
|
||||
// Checkbox for enabling/disabling dynamic RAM calculation
|
||||
@@ -97,7 +97,7 @@ export function scriptEditorInit() {
|
||||
clickListener:()=>{
|
||||
saveAndCloseScriptEditor();
|
||||
return false;
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
// Add all buttons to the UI
|
||||
|
||||
Reference in New Issue
Block a user