mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-26 03:00:56 +02:00
v0.51.0 (#826)
* Hash upgrades and Bladeburner skills can now be clicked to copy to clipboard * Aug purchase confirmation popup displays money in 0.000a format * Character now displays hacknet server info properly * Character,Info now displays hacknet server info correctly. * Formulas (#825) Formulas API v0.1 * Make all money the same color, same for reputation, format all numbers consistently. * rename a lot of the formulas function to no longer contain calculate * added hacking related formulas * removed unused variable * v0.51.0
This commit is contained in:
@@ -48,16 +48,85 @@ class NumeralFormatter {
|
||||
return this.format(n, "0.000a");
|
||||
}
|
||||
|
||||
formatHp(n: number): string {
|
||||
return this.format(n, "0.0");
|
||||
}
|
||||
|
||||
formatMoney(n: number): string {
|
||||
return this.format(n, "$0.000a");
|
||||
}
|
||||
|
||||
formatSkill(n: number): string {
|
||||
return this.format(n, "0,0");
|
||||
}
|
||||
|
||||
formatExp(n: number): string {
|
||||
return this.format(n, "0.000a");
|
||||
}
|
||||
|
||||
formatHashes(n: number): string {
|
||||
return this.format(n, "0.000a");
|
||||
}
|
||||
|
||||
formatReputation(n: number): string {
|
||||
return this.format(n, "0.000a");
|
||||
}
|
||||
|
||||
formatFavor(n: number): string {
|
||||
return this.format(n, "0,0");
|
||||
}
|
||||
|
||||
formatRAM(n: number): string {
|
||||
return this.format(n, "0.00")+"GB";
|
||||
}
|
||||
|
||||
formatPercentage(n: number, decimalPlaces: number=2): string {
|
||||
const formatter: string = "0." + "0".repeat(decimalPlaces) + "%";
|
||||
return this.format(n, formatter);
|
||||
}
|
||||
|
||||
formatServerSecurity(n: number, decimalPlaces: number=2): string {
|
||||
return this.format(n, "0,0.000");
|
||||
}
|
||||
|
||||
formatRespect(n: number): string {
|
||||
return this.format(n, "0.00000a");
|
||||
}
|
||||
|
||||
formatWanted(n: number): string {
|
||||
return this.format(n, "0.00000a");
|
||||
}
|
||||
|
||||
formatMultiplier(n: number): string {
|
||||
return this.format(n, "0,0.00");
|
||||
}
|
||||
|
||||
formatShock(n: number): string {
|
||||
return this.format(n, "0,0.000");
|
||||
}
|
||||
|
||||
formatSync(n: number): string {
|
||||
return this.format(n, "0,0.000");
|
||||
}
|
||||
|
||||
formatMemory(n: number): string {
|
||||
return this.format(n, "0");
|
||||
}
|
||||
|
||||
formatPopulation(n: number): string {
|
||||
return this.format(n, "0.000a");
|
||||
}
|
||||
|
||||
formatStamina(n: number): string {
|
||||
return this.format(n, "0.0");
|
||||
}
|
||||
|
||||
formatShares(n: number): string {
|
||||
if (n < 1000) {
|
||||
return this.format(n, "0");
|
||||
}
|
||||
return this.format(n, "0.000a");
|
||||
}
|
||||
}
|
||||
|
||||
export const numeralWrapper = new NumeralFormatter();
|
||||
|
||||
Reference in New Issue
Block a user