mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-22 01:03:01 +02:00
UI: Added new locale-aware and configurable number formatting (#354)
This commit is contained in:
@@ -3,7 +3,7 @@ import { WorkerScript } from "./WorkerScript";
|
||||
import { GetAllServers, GetServer } from "../Server/AllServers";
|
||||
import { Player } from "@player";
|
||||
import { ScriptDeath } from "./ScriptDeath";
|
||||
import { numeralWrapper } from "../ui/numeralFormat";
|
||||
import { formatExp, formatMoney, formatRam, formatThreads } from "../ui/formatNumber";
|
||||
import { ScriptArg } from "./ScriptArg";
|
||||
import { CityName } from "../Enums";
|
||||
import { BasicHGWOptions, RunningScript as IRunningScript, Person as IPerson } from "@nsdefs";
|
||||
@@ -354,8 +354,8 @@ function updateDynamicRam(ctx: NetscriptContext, ramCost: number): void {
|
||||
This is probably because you somehow circumvented the static RAM calculation.
|
||||
|
||||
Threads: ${threads}
|
||||
Dynamic RAM Usage: ${numeralWrapper.formatRAM(ws.dynamicRamUsage)} per thread
|
||||
Static RAM Usage: ${numeralWrapper.formatRAM(ws.ramUsage)} per thread
|
||||
Dynamic RAM Usage: ${formatRam(ws.dynamicRamUsage)} per thread
|
||||
Static RAM Usage: ${formatRam(ws.ramUsage)} per thread
|
||||
|
||||
One of these could be the reason:
|
||||
* Using eval() to get a reference to a ns function
|
||||
@@ -448,7 +448,7 @@ function hack(
|
||||
`Executing on '${server.hostname}' in ${convertTimeMsToTimeElapsedString(
|
||||
hackingTime * 1000,
|
||||
true,
|
||||
)} (t=${numeralWrapper.formatThreads(threads)})`,
|
||||
)} (t=${formatThreads(threads)})`,
|
||||
);
|
||||
|
||||
return helpers.netscriptDelay(ctx, hackingTime * 1000).then(function () {
|
||||
@@ -495,9 +495,9 @@ function hack(
|
||||
log(
|
||||
ctx,
|
||||
() =>
|
||||
`Successfully hacked '${server.hostname}' for ${numeralWrapper.formatMoney(
|
||||
moneyGained,
|
||||
)} and ${numeralWrapper.formatExp(expGainedOnSuccess)} exp (t=${numeralWrapper.formatThreads(threads)})`,
|
||||
`Successfully hacked '${server.hostname}' for ${formatMoney(moneyGained)} and ${formatExp(
|
||||
expGainedOnSuccess,
|
||||
)} exp (t=${formatThreads(threads)})`,
|
||||
);
|
||||
server.fortify(CONSTANTS.ServerFortifyAmount * Math.min(threads, maxThreadNeeded));
|
||||
if (stock) {
|
||||
@@ -514,9 +514,9 @@ function hack(
|
||||
log(
|
||||
ctx,
|
||||
() =>
|
||||
`Failed to hack '${server.hostname}'. Gained ${numeralWrapper.formatExp(
|
||||
expGainedOnFailure,
|
||||
)} exp (t=${numeralWrapper.formatThreads(threads)})`,
|
||||
`Failed to hack '${server.hostname}'. Gained ${formatExp(expGainedOnFailure)} exp (t=${formatThreads(
|
||||
threads,
|
||||
)})`,
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user