* 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:
hydroflame
2021-03-31 00:45:21 -04:00
committed by GitHub
parent ff097db1e2
commit e572c6dad8
127 changed files with 2772 additions and 1125 deletions
+69
View File
@@ -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();