mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-17 14:59:16 +02:00
[refactor] Moved 'printArray' to 'arrayToString' TS file
This commit is contained in:
@@ -5,9 +5,9 @@ import {workerScripts,
|
||||
import {Player} from "./Player";
|
||||
import {getServer} from "./Server";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||
import {printArray,
|
||||
createAccordionElement, removeElement,
|
||||
import {createAccordionElement, removeElement,
|
||||
removeChildrenFromElement} from "../utils/HelperFunctions";
|
||||
import {arrayToString} from "../utils/helpers/arrayToString";
|
||||
import {createElement} from "../utils/uiHelpers/createElement";
|
||||
import {exceptionAlert} from "../utils/helpers/exceptionAlert";
|
||||
import {logBoxCreate} from "../utils/LogBox";
|
||||
@@ -112,7 +112,7 @@ function addActiveScriptsItem(workerscript) {
|
||||
//Threads, args, kill/log button
|
||||
panel.appendChild(createElement("p", {
|
||||
innerHTML: "Threads: " + workerscript.scriptRef.threads + "<br>" +
|
||||
"Args: " + printArray(workerscript.args)
|
||||
"Args: " + arrayToString(workerscript.args)
|
||||
}));
|
||||
var panelText = createElement("p", {
|
||||
innerText:"Loading...", fontSize:"14px",
|
||||
|
||||
@@ -9,7 +9,7 @@ import {Script, findRunningScript,
|
||||
RunningScript} from "./Script";
|
||||
|
||||
import {parse, Node} from "../utils/acorn";
|
||||
import {printArray} from "../utils/HelperFunctions";
|
||||
import {arrayToString} from "../utils/helpers/arrayToString";
|
||||
import {isValidIPAddress} from "../utils/helpers/isValidIPAddress";
|
||||
import {isString} from "../utils/helpers/isString";
|
||||
|
||||
@@ -872,7 +872,7 @@ function runScriptFromScript(server, scriptname, args, workerScript, threads=1)
|
||||
} else {
|
||||
//Able to run script
|
||||
if(workerScript.disableLogs.ALL == null && workerScript.disableLogs.exec == null && workerScript.disableLogs.run == null && workerScript.disableLogs.spawn == null) {
|
||||
workerScript.scriptRef.log("Running script: " + scriptname + " on " + server.hostname + " with " + threads + " threads and args: " + printArray(args) + ". May take a few seconds to start up...");
|
||||
workerScript.scriptRef.log("Running script: " + scriptname + " on " + server.hostname + " with " + threads + " threads and args: " + arrayToString(args) + ". May take a few seconds to start up...");
|
||||
}
|
||||
var runningScriptObj = new RunningScript(script, args);
|
||||
runningScriptObj.threads = threads;
|
||||
|
||||
@@ -48,7 +48,8 @@ import {NetscriptPort} from "./NetscriptPort";
|
||||
|
||||
import Decimal from "decimal.js";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||
import {printArray, powerOfTwo} from "../utils/HelperFunctions";
|
||||
import {powerOfTwo} from "../utils/HelperFunctions";
|
||||
import {arrayToString} from "../utils/helpers/arrayToString";
|
||||
import {createRandomIp} from "../utils/IPAddress";
|
||||
import {formatNumber, isHTML} from "../utils/StringHelperFunctions";
|
||||
import {isString} from "../utils/helpers/isString";
|
||||
@@ -686,18 +687,18 @@ function NetscriptFunctions(workerScript) {
|
||||
}
|
||||
var runningScriptObj = findRunningScript(filename, argsForKillTarget, server);
|
||||
if (runningScriptObj == null) {
|
||||
workerScript.scriptRef.log("kill() failed. No such script "+ filename + " on " + server.hostname + " with args: " + printArray(argsForKillTarget));
|
||||
workerScript.scriptRef.log("kill() failed. No such script "+ filename + " on " + server.hostname + " with args: " + arrayToString(argsForKillTarget));
|
||||
return false;
|
||||
}
|
||||
var res = killWorkerScript(runningScriptObj, server.ip);
|
||||
if (res) {
|
||||
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.kill == null) {
|
||||
workerScript.scriptRef.log("Killing " + filename + " on " + server.hostname + " with args: " + printArray(argsForKillTarget) + ". May take up to a few minutes for the scripts to die...");
|
||||
workerScript.scriptRef.log("Killing " + filename + " on " + server.hostname + " with args: " + arrayToString(argsForKillTarget) + ". May take up to a few minutes for the scripts to die...");
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.kill == null) {
|
||||
workerScript.scriptRef.log("kill() failed. No such script "+ filename + " on " + server.hostname + " with args: " + printArray(argsForKillTarget));
|
||||
workerScript.scriptRef.log("kill() failed. No such script "+ filename + " on " + server.hostname + " with args: " + arrayToString(argsForKillTarget));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -1978,7 +1979,7 @@ function NetscriptFunctions(workerScript) {
|
||||
}
|
||||
var runningScriptObj = findRunningScript(scriptname, argsForScript, server);
|
||||
if (runningScriptObj == null) {
|
||||
workerScript.scriptRef.log("getScriptIncome() failed. No such script "+ scriptname + " on " + server.hostname + " with args: " + printArray(argsForScript));
|
||||
workerScript.scriptRef.log("getScriptIncome() failed. No such script "+ scriptname + " on " + server.hostname + " with args: " + arrayToString(argsForScript));
|
||||
return -1;
|
||||
}
|
||||
return runningScriptObj.onlineMoneyMade / runningScriptObj.onlineRunningTime;
|
||||
@@ -2008,7 +2009,7 @@ function NetscriptFunctions(workerScript) {
|
||||
}
|
||||
var runningScriptObj = findRunningScript(scriptname, argsForScript, server);
|
||||
if (runningScriptObj == null) {
|
||||
workerScript.scriptRef.log("getScriptExpGain() failed. No such script "+ scriptname + " on " + server.hostname + " with args: " + printArray(argsForScript));
|
||||
workerScript.scriptRef.log("getScriptExpGain() failed. No such script "+ scriptname + " on " + server.hostname + " with args: " + arrayToString(argsForScript));
|
||||
return -1;
|
||||
}
|
||||
return runningScriptObj.onlineExpGained / runningScriptObj.onlineRunningTime;
|
||||
|
||||
@@ -16,7 +16,8 @@ import {Settings} from "./Settings";
|
||||
|
||||
import {parse} from "../utils/acorn";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||
import {compareArrays, printArray} from "../utils/HelperFunctions";
|
||||
import {compareArrays} from "../utils/HelperFunctions";
|
||||
import {arrayToString} from "../utils/helpers/arrayToString";
|
||||
import {roundToTwo} from "../utils/helpers/roundToTwo";
|
||||
import {isString} from "../utils/StringHelperFunctions";
|
||||
|
||||
@@ -319,7 +320,7 @@ function runScriptsLoop() {
|
||||
|
||||
dialogBoxCreate("Script runtime error: <br>Server Ip: " + serverIp +
|
||||
"<br>Script name: " + scriptName +
|
||||
"<br>Args:" + printArray(w.args) + "<br>" + errorMsg);
|
||||
"<br>Args:" + arrayToString(w.args) + "<br>" + errorMsg);
|
||||
w.scriptRef.log("Script crashed with runtime error");
|
||||
} else {
|
||||
w.scriptRef.log("Script killed");
|
||||
@@ -379,7 +380,7 @@ function addWorkerScript(runningScriptObj, server) {
|
||||
var ramAvailable = server.maxRam - server.ramUsed;
|
||||
if (ramUsage > ramAvailable) {
|
||||
dialogBoxCreate("Not enough RAM to run script " + runningScriptObj.filename + " with args " +
|
||||
printArray(runningScriptObj.args) + ". This likely occurred because you re-loaded " +
|
||||
arrayToString(runningScriptObj.args) + ". This likely occurred because you re-loaded " +
|
||||
"the game and the script's RAM usage increased (either because of an update to the game or " +
|
||||
"your changes to the script.)");
|
||||
return;
|
||||
|
||||
@@ -37,7 +37,7 @@ import {containsAllStrings, longestCommonStart,
|
||||
formatNumber} from "../utils/StringHelperFunctions";
|
||||
import {addOffset} from "../utils/helpers/addOffset";
|
||||
import {isString} from "../utils/helpers/isString";
|
||||
import {printArray} from "../utils/HelperFunctions";
|
||||
import {arrayToString} from "../utils/helpers/arrayToString";
|
||||
import {logBoxCreate} from "../utils/LogBox";
|
||||
import {yesNoBoxCreate,
|
||||
yesNoBoxGetYesButton,
|
||||
@@ -2035,7 +2035,7 @@ let Terminal = {
|
||||
return;
|
||||
} else {
|
||||
//Able to run script
|
||||
post("Running script with " + numThreads + " thread(s) and args: " + printArray(args) + ".");
|
||||
post("Running script with " + numThreads + " thread(s) and args: " + arrayToString(args) + ".");
|
||||
post("May take a few seconds to start up the process...");
|
||||
var runningScriptObj = new RunningScript(script, args);
|
||||
runningScriptObj.threads = numThreads;
|
||||
|
||||
Reference in New Issue
Block a user