mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2025-03-08 19:32:31 +01:00
UI: Hash upgrade descriptions use number formatting options (#996)
This commit is contained in:
@ -1,8 +1,10 @@
|
|||||||
|
import type { ReactNode } from "react";
|
||||||
|
|
||||||
/** Object representing an upgrade that can be purchased with hashes */
|
/** Object representing an upgrade that can be purchased with hashes */
|
||||||
export interface IConstructorParams {
|
export interface HashUpgradeParams {
|
||||||
cost?: number;
|
cost?: number;
|
||||||
costPerLevel: number;
|
costPerLevel: number;
|
||||||
desc: string;
|
desc: ReactNode;
|
||||||
hasTargetServer?: boolean;
|
hasTargetServer?: boolean;
|
||||||
hasTargetCompany?: boolean;
|
hasTargetCompany?: boolean;
|
||||||
name: string;
|
name: string;
|
||||||
@ -26,7 +28,7 @@ export class HashUpgrade {
|
|||||||
costPerLevel = 0;
|
costPerLevel = 0;
|
||||||
|
|
||||||
/** Description of what the upgrade does */
|
/** Description of what the upgrade does */
|
||||||
desc = "";
|
desc: ReactNode = "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Boolean indicating that this upgrade's effect affects a single server,
|
* Boolean indicating that this upgrade's effect affects a single server,
|
||||||
@ -47,7 +49,7 @@ export class HashUpgrade {
|
|||||||
// The meaning varies between different upgrades
|
// The meaning varies between different upgrades
|
||||||
value = 0;
|
value = 0;
|
||||||
|
|
||||||
constructor(p: IConstructorParams) {
|
constructor(p: HashUpgradeParams) {
|
||||||
if (p.cost != null) {
|
if (p.cost != null) {
|
||||||
this.cost = p.cost;
|
this.cost = p.cost;
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,12 @@
|
|||||||
* Map of all Hash Upgrades
|
* Map of all Hash Upgrades
|
||||||
* Key = Hash name, Value = HashUpgrade object
|
* Key = Hash name, Value = HashUpgrade object
|
||||||
*/
|
*/
|
||||||
import { HashUpgrade, IConstructorParams } from "./HashUpgrade";
|
import { HashUpgrade, HashUpgradeParams } from "./HashUpgrade";
|
||||||
import { HashUpgradesMetadata } from "./data/HashUpgradesMetadata";
|
import { HashUpgradesMetadata } from "./data/HashUpgradesMetadata";
|
||||||
|
|
||||||
export const HashUpgrades: Record<string, HashUpgrade> = {};
|
export const HashUpgrades: Record<string, HashUpgrade> = {};
|
||||||
|
|
||||||
function createHashUpgrade(p: IConstructorParams): void {
|
function createHashUpgrade(p: HashUpgradeParams): void {
|
||||||
HashUpgrades[p.name] = new HashUpgrade(p);
|
HashUpgrades[p.name] = new HashUpgrade(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,14 +1,18 @@
|
|||||||
// Metadata used to construct all Hash Upgrades
|
// Metadata used to construct all Hash Upgrades
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { IConstructorParams } from "../HashUpgrade";
|
import { HashUpgradeParams } from "../HashUpgrade";
|
||||||
import { formatInt } from "../../ui/formatNumber";
|
import { formatInt } from "../../ui/formatNumber";
|
||||||
import { Money } from "../../ui/React/Money";
|
import { Money } from "../../ui/React/Money";
|
||||||
|
|
||||||
export const HashUpgradesMetadata: IConstructorParams[] = [
|
export const HashUpgradesMetadata: HashUpgradeParams[] = [
|
||||||
{
|
{
|
||||||
cost: 4,
|
cost: 4,
|
||||||
costPerLevel: 4,
|
costPerLevel: 4,
|
||||||
desc: "Sell hashes for $1m",
|
desc: (
|
||||||
|
<>
|
||||||
|
Sell hashes for <Money money={1e6} />
|
||||||
|
</>
|
||||||
|
),
|
||||||
name: "Sell for Money",
|
name: "Sell for Money",
|
||||||
effectText: (level: number): JSX.Element | null => (
|
effectText: (level: number): JSX.Element | null => (
|
||||||
<>
|
<>
|
||||||
@ -19,7 +23,11 @@ export const HashUpgradesMetadata: IConstructorParams[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
costPerLevel: 100,
|
costPerLevel: 100,
|
||||||
desc: "Sell hashes for $1b in Corporation funds",
|
desc: (
|
||||||
|
<>
|
||||||
|
Sell hashes for <Money money={1e9} /> in Corporation funds
|
||||||
|
</>
|
||||||
|
),
|
||||||
name: "Sell for Corporation Funds",
|
name: "Sell for Corporation Funds",
|
||||||
effectText: (level: number): JSX.Element | null => (
|
effectText: (level: number): JSX.Element | null => (
|
||||||
<>
|
<>
|
||||||
@ -33,18 +41,20 @@ export const HashUpgradesMetadata: IConstructorParams[] = [
|
|||||||
desc:
|
desc:
|
||||||
"Use hashes to decrease the minimum security of a single server by 2%. " +
|
"Use hashes to decrease the minimum security of a single server by 2%. " +
|
||||||
"Note that a server's minimum security cannot go below 1. This effect persists " +
|
"Note that a server's minimum security cannot go below 1. This effect persists " +
|
||||||
"until you install Augmentations (since servers are reset at that time).",
|
"until you install Augmentations (since servers are reset at that time)",
|
||||||
hasTargetServer: true,
|
hasTargetServer: true,
|
||||||
name: "Reduce Minimum Security",
|
name: "Reduce Minimum Security",
|
||||||
value: 0.98,
|
value: 0.98,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
costPerLevel: 50,
|
costPerLevel: 50,
|
||||||
desc:
|
desc: (
|
||||||
"Use hashes to increase the maximum amount of money on a single server by 2%. " +
|
<>
|
||||||
"Note that a server's maximum money is soft capped above $10t. " +
|
Use hashes to increase the maximum amount of money on a single server by 2%. This effect persists until you
|
||||||
"This effect persists until you install Augmentations (since servers " +
|
install Augmentations (since servers are reset at that time). Note that a server's maximum money is soft capped
|
||||||
"are reset at that time).",
|
above <Money money={10e12} />
|
||||||
|
</>
|
||||||
|
),
|
||||||
hasTargetServer: true,
|
hasTargetServer: true,
|
||||||
name: "Increase Maximum Money",
|
name: "Increase Maximum Money",
|
||||||
value: 1.02,
|
value: 1.02,
|
||||||
|
Reference in New Issue
Block a user