diff --git a/src/BitNode/BitNode.tsx b/src/BitNode/BitNode.tsx index 0ba195c2c..47d08d652 100644 --- a/src/BitNode/BitNode.tsx +++ b/src/BitNode/BitNode.tsx @@ -288,7 +288,7 @@ export function initBitNodes() {
In this BitNode: diff --git a/src/Corporation/Corporation.ts b/src/Corporation/Corporation.ts index 0cfbc4018..f9b2fe350 100644 --- a/src/Corporation/Corporation.ts +++ b/src/Corporation/Corporation.ts @@ -150,7 +150,7 @@ export class Corporation { dialogBoxCreate( "There was an error calculating your Corporations funds and they got reset to 0. " + "This is a bug. Please report to game developer.\n\n" + - "(Your funds have been set to $150b for the inconvenience)", + `(Your funds have been set to ${formatMoney(150e9)} for the inconvenience)`, ); this.funds = 150e9; } diff --git a/src/Corporation/ui/modals/SellMaterialModal.tsx b/src/Corporation/ui/modals/SellMaterialModal.tsx index 5dab2c32b..476f72cf2 100644 --- a/src/Corporation/ui/modals/SellMaterialModal.tsx +++ b/src/Corporation/ui/modals/SellMaterialModal.tsx @@ -9,6 +9,8 @@ import { dialogBoxCreate } from "../../../ui/React/DialogBox"; import * as actions from "../../Actions"; import { KEY } from "../../../utils/KeyboardEventKey"; +import { formatMoney } from "../../../ui/formatNumber"; + interface IProps { open: boolean; onClose: () => void; @@ -62,8 +64,8 @@ export function SellMaterialModal(props: IProps): React.ReactElement {

When setting the sell price, you can use the 'MP' variable to designate a dynamically changing price that - depends on the market price. For example, if you set the sell price to 'MP+10' then it will always be sold at - $10 above the market price. + depends on the market price. For example, if you set the sell price to 'MP+10' then it will always be sold at{" "} + {formatMoney(10)} above the market price.
Enter the amount of money you would like to spend PER EMPLOYEE on this office party - + diff --git a/src/GameOptions/ui/NumericDisplayOptions.tsx b/src/GameOptions/ui/NumericDisplayOptions.tsx index 3484222be..c29ca8379 100644 --- a/src/GameOptions/ui/NumericDisplayOptions.tsx +++ b/src/GameOptions/ui/NumericDisplayOptions.tsx @@ -1,13 +1,16 @@ import React, { useState } from "react"; -import { MenuItem, Select, SelectChangeEvent, Typography } from "@mui/material"; +import { MenuItem, Select, SelectChangeEvent, TextField, Typography } from "@mui/material"; import { Settings } from "../../Settings/Settings"; import { OptionSwitch } from "../../ui/React/OptionSwitch"; import { GameOptionsPage } from "./GameOptionsPage"; import { FormatsNeedToChange } from "../../ui/formatNumber"; import { OptionsSlider } from "./OptionsSlider"; +const DEFAULT_CURRENCY_SYMBOL = "$"; + export const NumericDisplayPage = (): React.ReactElement => { const [locale, setLocale] = useState(Settings.Locale); + const [currencySymbol, setCurrencySymbol] = useState(Settings.CurrencySymbol); function handleFractionalDigitChange(_event: Event | React.SyntheticEvent, newValue: number | number[]): void { Settings.fractionalDigits = newValue as number; @@ -19,6 +22,15 @@ export const NumericDisplayPage = (): React.ReactElement => { Settings.Locale = event.target.value; FormatsNeedToChange.emit(); } + + // Handler for the text field (Currency Symbol) + function handleCurrencySymbolChange(event: React.ChangeEvent): void { + const raw = event.target.value; + setCurrencySymbol(raw); + Settings.CurrencySymbol = raw.trim() === "" ? DEFAULT_CURRENCY_SYMBOL : raw; + FormatsNeedToChange.emit(); + } + return ( { <>If this is set all references to memory will use GiB instead of GB, in accordance with IEC 60027-2. } /> - Locale: } value={locale} onChange={handleLocaleChange}> en bg cs @@ -104,6 +116,26 @@ export const NumericDisplayPage = (): React.ReactElement => { pl ru +
+ Currency Symbol: , + }} + value={currencySymbol} + onChange={handleCurrencySymbolChange} + placeholder={DEFAULT_CURRENCY_SYMBOL} + style={{ marginRight: "16px" }} + /> + { + Settings.CurrencySymbolAfterValue = newValue; + FormatsNeedToChange.emit(); + }} + text="Move the currency symbol to be after the value" + tooltip={<>If enabled, the currency symbol appears after the number (e.g., 100€ instead of €100)} + /> +
); }; diff --git a/src/Literature/Literatures.tsx b/src/Literature/Literatures.tsx index 8faf93832..2c0405b8f 100644 --- a/src/Literature/Literatures.tsx +++ b/src/Literature/Literatures.tsx @@ -50,8 +50,8 @@ export const Literatures: Record = {
Getting Started with Corporation
- To get started, visit the city hall in Sector-12 in order to create a corporation. This requires $150b of your - own money, but this $150b will get put into your corporation's funds. If you're in BitNode 3, you also have the + To get started, visit the city hall in Sector-12 in order to create a corporation. This requires 150e9 of your + own money, but this money will get put into your corporation's funds. If you're in BitNode 3, you also have the option to get seed money from the government in exchange for 500m shares. Your corporation can have many different divisions, each in a different industry. There are many different types of industries, each with different properties. To create your first division, click the "Expand" button at the top of the management UI. diff --git a/src/Settings/Settings.ts b/src/Settings/Settings.ts index 5bb390bdf..8f4673e34 100644 --- a/src/Settings/Settings.ts +++ b/src/Settings/Settings.ts @@ -196,6 +196,10 @@ export const Settings = { disableSuffixes: false, /** The default amount of digits displayed after the decimal separator. */ fractionalDigits: 3, + /** Currency symbol used for displaying money. */ + CurrencySymbol: "$", + /** Whether to show the currency symbol after the money value. */ + CurrencySymbolAfterValue: false, /** * Player-defined key bindings. Don't use this property directly. It must be merged with DefaultKeyBindings in * src\utils\KeyBindingUtils.ts. diff --git a/src/ui/formatNumber.ts b/src/ui/formatNumber.ts index 335206b60..5a04cdbf4 100644 --- a/src/ui/formatNumber.ts +++ b/src/ui/formatNumber.ts @@ -200,9 +200,12 @@ export const formatThreads = formatHp; /** Display an integer up to 999,999,999 before collapsing to suffixed form with 3 fractional digits */ export const formatSkill = (n: number) => formatNumber(n, 3, 1e9, true); -/** Display standard money formatting, including the preceding $. */ +/** Display standard money formatting, including the currency symbol. */ export const formatMoney = (n: number, useExponentialFormForSmallValue = false): string => { - return `$${!useExponentialFormForSmallValue || n === 0 || n >= 0.001 ? formatNumber(n) : n.toExponential(3)}`; + const value = !useExponentialFormForSmallValue || n === 0 || n >= 0.001 ? formatNumber(n) : n.toExponential(3); + return Settings.CurrencySymbolAfterValue + ? `${value}${Settings.CurrencySymbol}` + : `${Settings.CurrencySymbol}${value}`; }; /** Display a decimal number with increased precision (5 fractional digits) */