mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-21 21:52:30 +01:00
Fixed merge conflicts in Kline--numeral-updates
This commit is contained in:
commit
ba469f49c5
7
src/Script.js
Normal file → Executable file
7
src/Script.js
Normal file → Executable file
@ -31,15 +31,14 @@ import {AllServers, processSingleServerGrowth} from "./Server";
|
||||
import {Settings} from "./Settings";
|
||||
import {post} from "./ui/postToTerminal";
|
||||
import {TextFile} from "./TextFile";
|
||||
|
||||
import {parse, Node} from "../utils/acorn";
|
||||
import {Page, routing} from "./ui/navigationTracking";
|
||||
import numeral from "numeral/min/numeral.min";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||
import {Reviver, Generic_toJSON,
|
||||
Generic_fromJSON} from "../utils/JSONReviver";
|
||||
import {compareArrays} from "../utils/helpers/compareArrays";
|
||||
import {createElement} from "../utils/uiHelpers/createElement";
|
||||
import {formatNumber} from "../utils/StringHelperFunctions";
|
||||
import {getTimestamp} from "../utils/helpers/getTimestamp";
|
||||
import {roundToTwo} from "../utils/helpers/roundToTwo";
|
||||
|
||||
@ -252,7 +251,7 @@ function updateScriptEditorContent() {
|
||||
var codeCopy = code.repeat(1);
|
||||
var ramUsage = calculateRamUsage(codeCopy);
|
||||
if (ramUsage !== -1) {
|
||||
scriptEditorRamText.innerText = "RAM: " + formatNumber(ramUsage, 2).toString() + "GB";
|
||||
scriptEditorRamText.innerText = "RAM: " + numeral(ramUsage).format('0.00') + " GB";
|
||||
} else {
|
||||
scriptEditorRamText.innerText = "RAM: Syntax Error";
|
||||
}
|
||||
@ -875,7 +874,7 @@ function scriptCalculateOfflineProduction(runningScriptObj) {
|
||||
console.log(runningScriptObj.filename + " called grow() on " + serv.hostname + " " + timesGrown + " times while offline");
|
||||
runningScriptObj.log("Called grow() on " + serv.hostname + " " + timesGrown + " times while offline");
|
||||
var growth = processSingleServerGrowth(serv, timesGrown * 450);
|
||||
runningScriptObj.log(serv.hostname + " grown by " + formatNumber(growth * 100 - 100, 6) + "% from grow() calls made while offline");
|
||||
runningScriptObj.log(serv.hostname + " grown by " + numeral(growth * 100 - 100).format('0.000000%') + " from grow() calls made while offline");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,9 +34,8 @@ import {Settings} from "./Settings";
|
||||
import {SpecialServerIps,
|
||||
SpecialServerNames} from "./SpecialServerIps";
|
||||
import {TextFile, getTextFile} from "./TextFile";
|
||||
|
||||
import {containsAllStrings, longestCommonStart,
|
||||
formatNumber} from "../utils/StringHelperFunctions";
|
||||
import {containsAllStrings,
|
||||
longestCommonStart} from "../utils/StringHelperFunctions";
|
||||
import {Page, routing} from "./ui/navigationTracking";
|
||||
import {KEY} from "../utils/helpers/keyCodes";
|
||||
import {addOffset} from "../utils/helpers/addOffset";
|
||||
@ -691,11 +690,11 @@ let Terminal = {
|
||||
|
||||
server.fortify(CONSTANTS.ServerFortifyAmount);
|
||||
|
||||
post("Hack successful! Gained $" + formatNumber(moneyGained, 2) + " and " + formatNumber(expGainedOnSuccess, 4) + " hacking EXP");
|
||||
post("Hack successful! Gained " + numeral(moneyGained).format('($0,0.00)') + " and " + numeral(expGainedOnSuccess).format('0.0000') + " hacking EXP");
|
||||
} else { //Failure
|
||||
//Player only gains 25% exp for failure? TODO Can change this later to balance
|
||||
Player.gainHackingExp(expGainedOnFailure)
|
||||
post("Failed to hack " + server.hostname + ". Gained " + formatNumber(expGainedOnFailure, 4) + " hacking EXP");
|
||||
post("Failed to hack " + server.hostname + ". Gained " + numeral(expGainedOnFailure).format('0.0000') + " hacking EXP");
|
||||
}
|
||||
}
|
||||
|
||||
@ -718,11 +717,12 @@ let Terminal = {
|
||||
else {rootAccess = "NO";}
|
||||
post("Root Access: " + rootAccess);
|
||||
post("Required hacking skill: " + currServ.requiredHackingSkill);
|
||||
post("Server security level: " + formatNumber(currServ.hackDifficulty, 3));
|
||||
post("Chance to hack: " + formatNumber(calculateHackingChance(currServ) * 100, 2) + "%");
|
||||
post("Time to hack: " + formatNumber(calculateHackingTime(currServ), 3) + " seconds");
|
||||
post("Total money available on server: $" + formatNumber(currServ.moneyAvailable, 2));
|
||||
post("Server security level: " + numeral(currServ.hackDifficulty).format('0.000a'));
|
||||
post("Chance to hack: " + numeral(calculateHackingChance(currServ) * 100).format('0.00%'));
|
||||
post("Time to hack: " + numeral(calculateHackingTime(currServ)).format('0.000') + " seconds");
|
||||
post("Total money available on server: $" + numeral(currServ.moneyAvailable).format('$0,0.00'));
|
||||
post("Required number of open ports for NUKE: " + currServ.numOpenPortsRequired);
|
||||
|
||||
if (currServ.sshPortOpen) {
|
||||
post("SSH port: Open")
|
||||
} else {
|
||||
@ -1186,7 +1186,7 @@ let Terminal = {
|
||||
var scriptBaseRamUsage = currServ.scripts[i].ramUsage;
|
||||
var ramUsage = scriptBaseRamUsage * numThreads;
|
||||
|
||||
post("This script requires " + formatNumber(ramUsage, 2) + "GB of RAM to run for " + numThreads + " thread(s)");
|
||||
post("This script requires " + numeral(ramUsage).format('0.00') + " GB of RAM to run for " + numThreads + " thread(s)");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1551,7 +1551,7 @@ let Terminal = {
|
||||
var spacesThread = Array(numSpacesThread+1).join(" ");
|
||||
|
||||
//Calculate and transform RAM usage
|
||||
ramUsage = formatNumber(script.scriptRef.ramUsage * script.threads, 2).toString() + "GB";
|
||||
ramUsage = numeral(script.scriptRef.ramUsage * script.threads).format('0.00') + " GB";
|
||||
|
||||
var entry = [script.filename, spacesScript, script.threads, spacesThread, ramUsage];
|
||||
post(entry.join(""));
|
||||
@ -1764,9 +1764,9 @@ let Terminal = {
|
||||
if (commandArray.length != 1) {
|
||||
post("Incorrect usage of free command. Usage: free"); return;
|
||||
}
|
||||
post("Total: " + formatNumber(Player.getCurrentServer().maxRam, 2) + " GB");
|
||||
post("Used: " + formatNumber(Player.getCurrentServer().ramUsed, 2) + " GB");
|
||||
post("Available: " + formatNumber(Player.getCurrentServer().maxRam - Player.getCurrentServer().ramUsed, 2) + " GB");
|
||||
post("Total: " + numeral(Player.getCurrentServer().maxRam).format('0.00') + " GB");
|
||||
post("Used: " + numeral(Player.getCurrentServer().ramUsed,).format('0.00') + " GB");
|
||||
post("Available: " + numeral(Player.getCurrentServer().maxRam - Player.getCurrentServer().ramUsed).format('0.00') + " GB");
|
||||
},
|
||||
|
||||
//First called when the "run [program]" command is called. Checks to see if you
|
||||
@ -1887,9 +1887,9 @@ let Terminal = {
|
||||
post("Server base security level: " + targetServer.baseDifficulty);
|
||||
post("Server current security level: " + targetServer.hackDifficulty);
|
||||
post("Server growth rate: " + targetServer.serverGrowth);
|
||||
post("Netscript hack() execution time: " + formatNumber(calculateHackingTime(targetServer), 1) + "s");
|
||||
post("Netscript grow() execution time: " + formatNumber(calculateGrowTime(targetServer), 1) + "s");
|
||||
post("Netscript weaken() execution time: " + formatNumber(calculateWeakenTime(targetServer), 1) + "s");
|
||||
post("Netscript hack() execution time: " + numeral(scriptCalculateHackingTime(targetServer)).format('0.0') + "s");
|
||||
post("Netscript grow() execution time: " + numeral(scriptCalculateGrowTime(targetServer)).format('0.0') + "s");
|
||||
post("Netscript weaken() execution time: " + numeral(scriptCalculateWeakenTime(targetServer)).format('0.0') + "s");
|
||||
};
|
||||
programHandlers[Programs.AutoLink.name] = () => {
|
||||
post("This executable cannot be run.");
|
||||
|
Loading…
Reference in New Issue
Block a user