From 6e013e4e6ad19461c9f86acb85ae7660def94616 Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Sat, 4 Sep 2021 03:27:31 -0400 Subject: [PATCH] Change money to automatically color grey when something cannot be bought. --- css/styles.scss | 4 +++ src/Augmentation/Augmentation.tsx | 2 +- src/Bladeburner/ui/Stats.tsx | 2 +- src/Casino/Blackjack.tsx | 8 ++--- src/Casino/Roulette.tsx | 4 +-- src/Casino/SlotMachine.tsx | 2 +- src/DarkWeb/DarkWeb.tsx | 2 +- src/Faction/ui/DonateOption.tsx | 2 +- src/Faction/ui/PurchaseableAugmentation.tsx | 4 +-- src/Gang/ui/GangMemberUpgradePopup.tsx | 2 +- src/Hacknet/data/HashUpgradesMetadata.tsx | 4 +-- src/Infiltration/ui/Victory.tsx | 2 +- src/Locations/LocationsHelpers.tsx | 6 ++-- src/Locations/ui/CoresButton.tsx | 2 +- src/Locations/ui/GymLocation.tsx | 8 ++--- src/Locations/ui/HospitalLocation.tsx | 4 +-- src/Locations/ui/RamButton.tsx | 2 +- src/Locations/ui/TechVendorLocation.tsx | 2 +- src/Locations/ui/TorButton.tsx | 2 +- src/Locations/ui/UniversityLocation.tsx | 10 +++---- src/PersonObjects/Resleeving/ResleevingUI.tsx | 5 ++-- ...tationsUI.ts => SleeveAugmentationsUI.tsx} | 3 +- src/PersonObjects/Sleeve/SleeveUI.tsx | 7 +++-- .../Sleeve/ui/CovenantPurchasesRoot.tsx | 2 +- .../Sleeve/ui/CovenantSleeveMemoryUpgrade.tsx | 2 +- .../Sleeve/ui/MoreEarningsContent.tsx | 6 ++-- src/StockMarket/BuyingAndSelling.tsx | 12 ++++---- src/StockMarket/OrderProcessing.tsx | 4 +-- src/StockMarket/ui/InfoAndPurchases.tsx | 10 +++---- src/StockMarket/ui/StockTicker.tsx | 4 +-- src/StockMarket/ui/StockTickerOrder.tsx | 2 +- .../ui/StockTickerPositionText.tsx | 12 ++++---- src/ui/ActiveScripts/ScriptProduction.tsx | 6 ++-- .../ActiveScripts/WorkerScriptAccordion.tsx | 8 ++--- src/ui/CharacterInfo.tsx | 30 +++++++++---------- src/ui/React/Money.tsx | 14 +++++++-- src/ui/React/MoneyRate.tsx | 3 +- 37 files changed, 112 insertions(+), 92 deletions(-) rename src/PersonObjects/Sleeve/{SleeveAugmentationsUI.ts => SleeveAugmentationsUI.tsx} (97%) diff --git a/css/styles.scss b/css/styles.scss index ae6f1f2a9..0377e2865 100644 --- a/css/styles.scss +++ b/css/styles.scss @@ -345,6 +345,10 @@ a:visited { color: $light-yellow; } +.unbuyable { + color: #66CFBC; +} + .failure { color: $alert-red; text-shadow: 0 0 0 $alert-red; diff --git a/src/Augmentation/Augmentation.tsx b/src/Augmentation/Augmentation.tsx index 405052364..b0d1259c3 100644 --- a/src/Augmentation/Augmentation.tsx +++ b/src/Augmentation/Augmentation.tsx @@ -167,7 +167,7 @@ function generateStatsDescription(mults: IMap, programs?: string[], star desc = <>{desc}
+{f(mults.bladeburner_success_chance_mult-1)} Bladeburner Contracts and Operations success chance if(startingMoney) - desc = <>{desc}
Start with {Money(startingMoney)} after installing Augmentations. + desc = <>{desc}
Start with after installing Augmentations. if(programs) desc = <>{desc}
Start with {programs.join(' and ')} after installing Augmentations. diff --git a/src/Bladeburner/ui/Stats.tsx b/src/Bladeburner/ui/Stats.tsx index f2393cb11..103f6240b 100644 --- a/src/Bladeburner/ui/Stats.tsx +++ b/src/Bladeburner/ui/Stats.tsx @@ -97,7 +97,7 @@ export function Stats(props: IProps): React.ReactElement {

Team Size: {formatNumber(props.bladeburner.teamSize, 0)}

Team Members Lost: {formatNumber(props.bladeburner.teamLost, 0)}


Num Times Hospitalized: {props.bladeburner.numHosp}

-

Money Lost From Hospitalizations: {Money(props.bladeburner.moneyLost)}


+

Money Lost From Hospitalizations:


Current City: {props.bladeburner.city}

Est. Synthoid Population: {numeralWrapper.formatPopulation(props.bladeburner.getCurrentCity().popEst)} diff --git a/src/Casino/Blackjack.tsx b/src/Casino/Blackjack.tsx index e2ee8e957..8a41b1f1c 100644 --- a/src/Casino/Blackjack.tsx +++ b/src/Casino/Blackjack.tsx @@ -314,7 +314,7 @@ export class Blackjack extends Game { label={ <> {"Wager (Max: "} - {Money(MAX_BET)} + {")"} } @@ -333,7 +333,7 @@ export class Blackjack extends Game {

{"Total earnings this session: "} - {Money(gains)} +

@@ -404,13 +404,13 @@ export class Blackjack extends Game { {this.isPlayerWinResult(result) && ( <> {" You gained "} - {Money(this.state.bet)} + )} {result === Result.DealerWon && ( <> {" You lost "} - {Money(this.state.bet)} + )}

diff --git a/src/Casino/Roulette.tsx b/src/Casino/Roulette.tsx index 5cb2e833c..f48132013 100644 --- a/src/Casino/Roulette.tsx +++ b/src/Casino/Roulette.tsx @@ -202,10 +202,10 @@ export class Roulette extends Game { } if(playerWin) { gain = this.state.investment*this.state.strategy.payout; - status = <>won {Money(gain)}; + status = <>won ; } else { gain = -this.state.investment; - status = <>lost {Money(-gain)}; + status = <>lost ; } this.win(this.props.p, gain); this.setState({ diff --git a/src/Casino/SlotMachine.tsx b/src/Casino/SlotMachine.tsx index 149904e00..720ea06f8 100644 --- a/src/Casino/SlotMachine.tsx +++ b/src/Casino/SlotMachine.tsx @@ -170,7 +170,7 @@ export class SlotMachine extends Game { } this.setState({ - status: <>{gains>0?"gained":"lost"} {Money(Math.abs(gains))}, + status: <>{gains>0?"gained":"lost"} , canPlay: true, }) if(this.reachedLimit(this.props.p)) return; diff --git a/src/DarkWeb/DarkWeb.tsx b/src/DarkWeb/DarkWeb.tsx index c3369aaf6..c778d12b3 100644 --- a/src/DarkWeb/DarkWeb.tsx +++ b/src/DarkWeb/DarkWeb.tsx @@ -51,7 +51,7 @@ export function executeDarkwebTerminalCommand(commandArray: string[]): void { function listAllDarkwebItems(): void { for(const key in DarkWebItems) { const item = DarkWebItems[key]; - postElement(<>{item.program} - {Money(item.price)} - {item.description}); + postElement(<>{item.program} - - {item.description}); } } diff --git a/src/Faction/ui/DonateOption.tsx b/src/Faction/ui/DonateOption.tsx index d1c68039a..f4ec7aff6 100644 --- a/src/Faction/ui/DonateOption.tsx +++ b/src/Faction/ui/DonateOption.tsx @@ -60,7 +60,7 @@ export function DonateOption(props: IProps): React.ReactElement { const repGain = repFromDonation(amt, props.p); props.faction.playerReputation += repGain; dialogBoxCreate(<> - You just donated {Money(amt)} to {fac.name} to gain {Reputation(repGain)} reputation. + You just donated to {fac.name} to gain {Reputation(repGain)} reputation. ); props.rerender(); } diff --git a/src/Faction/ui/PurchaseableAugmentation.tsx b/src/Faction/ui/PurchaseableAugmentation.tsx index 7d9e5cfe6..c61a13320 100644 --- a/src/Faction/ui/PurchaseableAugmentation.tsx +++ b/src/Faction/ui/PurchaseableAugmentation.tsx @@ -119,10 +119,10 @@ export class PurchaseableAugmentation extends React.Component { } else if (this.aug.name !== AugmentationNames.NeuroFluxGovernor && (this.aug.owned || this.owned())) { disabled = true; } else if (this.hasReputation()) { - status = <>UNLOCKED (at {Reputation(repCost)} faction reputation) - {Money(moneyCost)}; + status = <>UNLOCKED (at {Reputation(repCost)} faction reputation) - ; } else { disabled = true; - status = <>LOCKED (Requires {Reputation(repCost)} faction reputation - {Money(moneyCost)}); + status = <>LOCKED (Requires {Reputation(repCost)} faction reputation - ); color = "red"; } diff --git a/src/Gang/ui/GangMemberUpgradePopup.tsx b/src/Gang/ui/GangMemberUpgradePopup.tsx index ce7b6e21a..0a21d4ae8 100644 --- a/src/Gang/ui/GangMemberUpgradePopup.tsx +++ b/src/Gang/ui/GangMemberUpgradePopup.tsx @@ -51,7 +51,7 @@ function GangMemberUpgradePanel(props: IPanelProps): React.ReactElement { setRerender(old => !old); } return ( - {upg.name} - {Money(props.gang.getUpgradeCost(upg))} + {upg.name} - ); } diff --git a/src/Hacknet/data/HashUpgradesMetadata.tsx b/src/Hacknet/data/HashUpgradesMetadata.tsx index db9d2a85b..6244d7dd2 100644 --- a/src/Hacknet/data/HashUpgradesMetadata.tsx +++ b/src/Hacknet/data/HashUpgradesMetadata.tsx @@ -10,14 +10,14 @@ export const HashUpgradesMetadata: IConstructorParams[] = [ costPerLevel: 4, desc: "Sell hashes for $1m", name: "Sell for Money", - effectText: (level: number): JSX.Element | null => (<>Sold for {Money(1e6*level)}), + effectText: (level: number): JSX.Element | null => (<>Sold for ), value: 1e6, }, { costPerLevel: 100, desc: "Sell hashes for $1b in Corporation funds", name: "Sell for Corporation Funds", - effectText: (level: number): JSX.Element | null => (<>Sold for {Money(1e9*level)} Corporation funds.), + effectText: (level: number): JSX.Element | null => (<>Sold for Corporation funds.), value: 1e9, }, { diff --git a/src/Infiltration/ui/Victory.tsx b/src/Infiltration/ui/Victory.tsx index 164d38886..e44f863b2 100644 --- a/src/Infiltration/ui/Victory.tsx +++ b/src/Infiltration/ui/Victory.tsx @@ -67,7 +67,7 @@ export function Victory(props: IProps): React.ReactElement { {"Trade for "}{Reputation(repGain)}{" reputation"}} /> - {"Sell for "}{Money(moneyGain)}} /> + {"Sell for "}} /> diff --git a/src/Locations/LocationsHelpers.tsx b/src/Locations/LocationsHelpers.tsx index 56d55c662..439bcefe9 100644 --- a/src/Locations/LocationsHelpers.tsx +++ b/src/Locations/LocationsHelpers.tsx @@ -79,7 +79,7 @@ export function createTravelPopup(destination: CityName, travelFn: TravelFunctio }); yesNoBoxCreate(Would you like to travel to {destination}? The trip will - cost {Money(cost)}.); + cost .); } /** @@ -107,7 +107,7 @@ export function createPurchaseServerPopup(ram: number, p: IPlayer): void { yesNoTxtInpBoxClose(); }); - yesNoTxtInpBoxCreate(<>Would you like to purchase a new server with {numeralWrapper.formatRAM(ram)} of RAM for {Money(cost)}? + yesNoTxtInpBoxCreate(<>Would you like to purchase a new server with {numeralWrapper.formatRAM(ram)} of RAM for ?

Please enter the server hostname below:
); } @@ -245,7 +245,7 @@ export function createUpgradeHomeCoresPopup(p: IPlayer): void { yesNoBoxCreate(<>Would you like to purchase an additional CPU Core for your home computer? Each CPU Core lets you start with an additional Core Node in Hacking Missions.

Purchasing an additional core (for a total of {p.getHomeComputer().cpuCores + 1}) will -cost {Money(cost)}); +cost ); } /** diff --git a/src/Locations/ui/CoresButton.tsx b/src/Locations/ui/CoresButton.tsx index 10930a96f..051293d98 100644 --- a/src/Locations/ui/CoresButton.tsx +++ b/src/Locations/ui/CoresButton.tsx @@ -59,6 +59,6 @@ export function CoresButton(props: IProps): React.ReactElement { disabled={!props.p.canAfford(cost)} onClick={buy} style={btnStyle} - text={<>Upgrade 'home' cores ({homeComputer.cpuCores} -> {homeComputer.cpuCores+1}) - {Money(cost)}} + text={<>Upgrade 'home' cores ({homeComputer.cpuCores} -> {homeComputer.cpuCores+1}) - } />); } diff --git a/src/Locations/ui/GymLocation.tsx b/src/Locations/ui/GymLocation.tsx index 100ca3847..fa4bbc0b9 100644 --- a/src/Locations/ui/GymLocation.tsx +++ b/src/Locations/ui/GymLocation.tsx @@ -77,22 +77,22 @@ export class GymLocation extends React.Component { Train Strength ({Money(cost)} / sec)} + text={<>Train Strength ( / sec)} /> Train Defense ({Money(cost)} / sec)} + text={<>Train Defense ( / sec)} /> Train Dexterity ({Money(cost)} / sec)} + text={<>Train Dexterity ( / sec)} /> Train Agility ({Money(cost)} / sec)} + text={<>Train Agility ( / sec)} /> ) diff --git a/src/Locations/ui/HospitalLocation.tsx b/src/Locations/ui/HospitalLocation.tsx index f8892d0f8..2528cdc78 100644 --- a/src/Locations/ui/HospitalLocation.tsx +++ b/src/Locations/ui/HospitalLocation.tsx @@ -60,7 +60,7 @@ export class HospitalLocation extends React.Component { currHp: this.props.p.hp, }); - dialogBoxCreate(<>You were healed to full health! The hospital billed you for {Money(cost)}); + dialogBoxCreate(<>You were healed to full health! The hospital billed you for ); } render(): React.ReactNode { @@ -70,7 +70,7 @@ export class HospitalLocation extends React.Component { Get treatment for wounds - {Money(cost)}} + text={<>Get treatment for wounds - } /> ) } diff --git a/src/Locations/ui/RamButton.tsx b/src/Locations/ui/RamButton.tsx index ace7cbc67..34ba08939 100644 --- a/src/Locations/ui/RamButton.tsx +++ b/src/Locations/ui/RamButton.tsx @@ -44,6 +44,6 @@ export function RamButton(props: IProps): React.ReactElement { disabled={!props.p.canAfford(cost)} onClick={buy} style={btnStyle} - text={<>Upgrade 'home' RAM ({homeComputer.maxRam}GB -> {homeComputer.maxRam*2}GB) - {Money(cost)}} + text={<>Upgrade 'home' RAM ({homeComputer.maxRam}GB -> {homeComputer.maxRam*2}GB) - } />); } diff --git a/src/Locations/ui/TechVendorLocation.tsx b/src/Locations/ui/TechVendorLocation.tsx index 92cf2ae5b..246b50c04 100644 --- a/src/Locations/ui/TechVendorLocation.tsx +++ b/src/Locations/ui/TechVendorLocation.tsx @@ -37,7 +37,7 @@ export function TechVendorLocation(props: IProps): React.ReactElement { key={i} onClick={() => createPurchaseServerPopup(i, props.p)} style={btnStyle} - text={<>Purchase {i}GB Server - {Money(cost)}} + text={<>Purchase {i}GB Server - } />, ) } diff --git a/src/Locations/ui/TorButton.tsx b/src/Locations/ui/TorButton.tsx index b3e78378f..db6ee2132 100644 --- a/src/Locations/ui/TorButton.tsx +++ b/src/Locations/ui/TorButton.tsx @@ -41,6 +41,6 @@ export function TorButton(props: IProps): React.ReactElement { disabled={!props.p.canAfford(CONSTANTS.TorRouterCost)} onClick={buy} style={btnStyle} - text={<>Purchase TOR router - {Money(CONSTANTS.TorRouterCost)}} + text={<>Purchase TOR router - } />); } diff --git a/src/Locations/ui/UniversityLocation.tsx b/src/Locations/ui/UniversityLocation.tsx index 6ceaafd71..fd0e1fe73 100644 --- a/src/Locations/ui/UniversityLocation.tsx +++ b/src/Locations/ui/UniversityLocation.tsx @@ -103,31 +103,31 @@ export class UniversityLocation extends React.Component { Take Data Structures course ({Money(dataStructuresCost)} / sec)} + text={<>Take Data Structures course ( / sec)} tooltip={earnHackingExpTooltip} /> Take Networks course ({Money(networksCost)} / sec)} + text={<>Take Networks course ( / sec)} tooltip={earnHackingExpTooltip} /> Take Algorithms course ({Money(algorithmsCost)} / sec)} + text={<>Take Algorithms course ( / sec)} tooltip={earnHackingExpTooltip} /> Take Management course ({Money(managementCost)} / sec)} + text={<>Take Management course ( / sec)} tooltip={earnCharismaExpTooltip} /> Take Leadership course ({Money(leadershipCost)} / sec)} + text={<>Take Leadership course ( / sec)} tooltip={earnCharismaExpTooltip} /> diff --git a/src/PersonObjects/Resleeving/ResleevingUI.tsx b/src/PersonObjects/Resleeving/ResleevingUI.tsx index 9dab831a9..008d7f785 100644 --- a/src/PersonObjects/Resleeving/ResleevingUI.tsx +++ b/src/PersonObjects/Resleeving/ResleevingUI.tsx @@ -254,6 +254,7 @@ function createResleeveUi(resleeve: Resleeve): IResleeveUIElems { costText: null, buyButton: null, }; + if(playerRef === null) return elems; if (!routing.isOn(Page.Resleeves)) { return elems; } @@ -334,7 +335,7 @@ function createResleeveUi(resleeve: Resleeve): IResleeveUIElems { const cost: number = resleeve.getCost(); elems.costPanel = createElement("div", { class: "resleeve-panel", width: "20%" }); elems.costText = createElement("p", { - innerHTML: `It costs ${renderToStaticMarkup(Money(cost))} ` + + innerHTML: `It costs ${renderToStaticMarkup()} ` + `to purchase this Sleeve.`, }); elems.buyButton = createElement("button", { @@ -343,7 +344,7 @@ function createResleeveUi(resleeve: Resleeve): IResleeveUIElems { clickListener: () => { if(playerRef == null) throw new Error("playerRef is null in buyButton.click()"); if (purchaseResleeve(resleeve, playerRef)) { - dialogBoxCreate((<>You re-sleeved for {Money(cost)}!), false); + dialogBoxCreate((<>You re-sleeved for !), false); } else { dialogBoxCreate(`You cannot afford to re-sleeve into this body`, false); } diff --git a/src/PersonObjects/Sleeve/SleeveAugmentationsUI.ts b/src/PersonObjects/Sleeve/SleeveAugmentationsUI.tsx similarity index 97% rename from src/PersonObjects/Sleeve/SleeveAugmentationsUI.ts rename to src/PersonObjects/Sleeve/SleeveAugmentationsUI.tsx index 2c020dfdb..55cbdb591 100644 --- a/src/PersonObjects/Sleeve/SleeveAugmentationsUI.ts +++ b/src/PersonObjects/Sleeve/SleeveAugmentationsUI.tsx @@ -2,6 +2,7 @@ * Module for handling the UI for purchasing Sleeve Augmentations * This UI is a popup, not a full page */ +import React from 'react'; import { Sleeve } from "./Sleeve"; import { findSleevePurchasableAugs } from "./SleeveHelpers"; @@ -102,7 +103,7 @@ export function createSleevePurchaseAugsPopup(sleeve: Sleeve, p: IPlayer): void innerHTML: [ `

${aug.name}


`, - `Cost: ${renderToStaticMarkup(Money(aug.startingCost))}

`, + `Cost: ${renderToStaticMarkup()}

`, `${info}`, ].join(" "), padding: "2px", diff --git a/src/PersonObjects/Sleeve/SleeveUI.tsx b/src/PersonObjects/Sleeve/SleeveUI.tsx index a1b0c9115..5b38fd4f1 100644 --- a/src/PersonObjects/Sleeve/SleeveUI.tsx +++ b/src/PersonObjects/Sleeve/SleeveUI.tsx @@ -1,6 +1,7 @@ /** * Module for handling the Sleeve UI */ +import React from 'react'; import { createSleevePurchaseAugsPopup } from "./SleeveAugmentationsUI"; import { Sleeve } from "./Sleeve"; import { SleeveTaskType } from "./SleeveTaskTypesEnum"; @@ -202,6 +203,7 @@ function createSleeveUi(sleeve: Sleeve, allSleeves: Sleeve[]): ISleeveUIElems { currentEarningsInfo: null, totalEarningsButton: null, } + if(playerRef === null) return elems; if (!routing.isOn(Page.Sleeves)) { return elems; } @@ -223,13 +225,14 @@ function createSleeveUi(sleeve: Sleeve, allSleeves: Sleeve[]): ISleeveUIElems { class: "std-button", innerText: "Travel", clickListener: () => { + if(playerRef === null) return; const popupId = "sleeve-travel-popup"; const popupArguments: HTMLElement[] = []; popupArguments.push(createPopupCloseButton(popupId, { class: "std-button" })); popupArguments.push(createElement("p", { innerHTML: "Have this sleeve travel to a different city. This affects " + "the gyms and universities at which this sleeve can study. " + - `Traveling to a different city costs ${renderToStaticMarkup(Money(CONSTANTS.TravelCost))}. ` + + `Traveling to a different city costs ${renderToStaticMarkup()}. ` + "It will also CANCEL the sleeve's current task (setting it to idle)", })); for (const cityName in Cities) { @@ -346,7 +349,7 @@ function updateSleeveUi(sleeve: Sleeve, elems: ISleeveUIElems): void { if (sleeve.currentTask === SleeveTaskType.Crime) { const data = [ - [`Money`, Money(parseFloat(sleeve.currentTaskLocation)), `(on success)`], + [`Money`, , `(on success)`], [`Hacking Exp`, numeralWrapper.formatExp(sleeve.gainRatesForTask.hack), `(2x on success)`], [`Strength Exp`, numeralWrapper.formatExp(sleeve.gainRatesForTask.str), `(2x on success)`], [`Defense Exp`, numeralWrapper.formatExp(sleeve.gainRatesForTask.def), `(2x on success)`], diff --git a/src/PersonObjects/Sleeve/ui/CovenantPurchasesRoot.tsx b/src/PersonObjects/Sleeve/ui/CovenantPurchasesRoot.tsx index 91fd3f8f3..6f1fd3070 100644 --- a/src/PersonObjects/Sleeve/ui/CovenantPurchasesRoot.tsx +++ b/src/PersonObjects/Sleeve/ui/CovenantPurchasesRoot.tsx @@ -75,7 +75,7 @@ export function CovenantPurchasesRoot(props: IProps): React.ReactElement {

Would you like to purchase an additional Duplicate Sleeve from The Covenant - for {Money(purchaseCost())}? + for ?


diff --git a/src/PersonObjects/Sleeve/ui/CovenantSleeveMemoryUpgrade.tsx b/src/PersonObjects/Sleeve/ui/CovenantSleeveMemoryUpgrade.tsx index d89789b5d..98880b897 100644 --- a/src/PersonObjects/Sleeve/ui/CovenantSleeveMemoryUpgrade.tsx +++ b/src/PersonObjects/Sleeve/ui/CovenantSleeveMemoryUpgrade.tsx @@ -79,7 +79,7 @@ export class CovenantSleeveMemoryUpgrade extends React.Component } else if (this.state.amt > maxMemory) { purchaseBtnContent = <>Memory cannot exceed 100?; } else { - purchaseBtnContent = <>Purchase {this.state.amt} memory - {Money(cost)}?; + purchaseBtnContent = <>Purchase {this.state.amt} memory - ?; } return ( diff --git a/src/PersonObjects/Sleeve/ui/MoreEarningsContent.tsx b/src/PersonObjects/Sleeve/ui/MoreEarningsContent.tsx index dde778947..9e51f5116 100644 --- a/src/PersonObjects/Sleeve/ui/MoreEarningsContent.tsx +++ b/src/PersonObjects/Sleeve/ui/MoreEarningsContent.tsx @@ -7,7 +7,7 @@ import { StatsTable } from "../../../ui/React/StatsTable"; export function MoreEarningsContent(sleeve: Sleeve): React.ReactElement { return (<> {StatsTable([ - ['Money ', Money(sleeve.earningsForTask.money)], + ['Money ', ], ['Hacking Exp ', numeralWrapper.formatExp(sleeve.earningsForTask.hack)], ['Strength Exp ', numeralWrapper.formatExp(sleeve.earningsForTask.str)], ['Defense Exp ', numeralWrapper.formatExp(sleeve.earningsForTask.def)], @@ -17,7 +17,7 @@ export function MoreEarningsContent(sleeve: Sleeve): React.ReactElement { ], 'Earnings for Current Task:')}
{StatsTable([ - ['Money: ', Money(sleeve.earningsForPlayer.money)], + ['Money: ', ], ['Hacking Exp: ', numeralWrapper.formatExp(sleeve.earningsForPlayer.hack)], ['Strength Exp: ', numeralWrapper.formatExp(sleeve.earningsForPlayer.str)], ['Defense Exp: ', numeralWrapper.formatExp(sleeve.earningsForPlayer.def)], @@ -27,7 +27,7 @@ export function MoreEarningsContent(sleeve: Sleeve): React.ReactElement { ], 'Total Earnings for Host Consciousness:')}
{StatsTable([ - ['Money: ', Money(sleeve.earningsForSleeves.money)], + ['Money: ', ], ['Hacking Exp: ', numeralWrapper.formatExp(sleeve.earningsForSleeves.hack)], ['Strength Exp: ', numeralWrapper.formatExp(sleeve.earningsForSleeves.str)], ['Defense Exp: ', numeralWrapper.formatExp(sleeve.earningsForSleeves.def)], diff --git a/src/StockMarket/BuyingAndSelling.tsx b/src/StockMarket/BuyingAndSelling.tsx index cbabd494e..bd12cf4c0 100644 --- a/src/StockMarket/BuyingAndSelling.tsx +++ b/src/StockMarket/BuyingAndSelling.tsx @@ -60,7 +60,7 @@ export function buyStock(stock: Stock, shares: number, workerScript: WorkerScrip if (workerScript) { workerScript.log("buyStock", `You do not have enough money to purchase this position. You need ${numeralWrapper.formatMoney(totalPrice)}.`); } else if (opts.suppressDialog !== true) { - dialogBoxCreate(<>You do not have enough money to purchase this. You need {Money(totalPrice)}); + dialogBoxCreate(<>You do not have enough money to purchase this. You need ); } return false; @@ -92,7 +92,7 @@ export function buyStock(stock: Stock, shares: number, workerScript: WorkerScrip `Paid ${numeralWrapper.formatMoney(CONSTANTS.StockMarketCommission)} in commission fees.` workerScript.log("buyStock", resultTxt) } else if (opts.suppressDialog !== true) { - dialogBoxCreate(<>Bought {numeralWrapper.formatShares(shares)} shares of {stock.symbol} for {Money(totalPrice)}. Paid {Money(CONSTANTS.StockMarketCommission)} in commission fees.); + dialogBoxCreate(<>Bought {numeralWrapper.formatShares(shares)} shares of {stock.symbol} for . Paid in commission fees.); } return true; @@ -150,7 +150,7 @@ export function sellStock(stock: Stock, shares: number, workerScript: WorkerScri `After commissions, you gained a total of ${numeralWrapper.formatMoney(gains)}.`; workerScript.log("sellStock", resultTxt) } else if (opts.suppressDialog !== true) { - dialogBoxCreate(<>Sold {numeralWrapper.formatShares(shares)} shares of {stock.symbol}. After commissions, you gained a total of {Money(gains)}.); + dialogBoxCreate(<>Sold {numeralWrapper.formatShares(shares)} shares of {stock.symbol}. After commissions, you gained a total of .); } return true; @@ -188,7 +188,7 @@ export function shortStock(stock: Stock, shares: number, workerScript: WorkerScr "money to purchase this short position. You need " + numeralWrapper.formatMoney(totalPrice)); } else if (opts.suppressDialog !== true) { - dialogBoxCreate(<>You do not have enough money to purchase this short position. You need {Money(totalPrice)}); + dialogBoxCreate(<>You do not have enough money to purchase this short position. You need ); } return false; @@ -222,7 +222,7 @@ export function shortStock(stock: Stock, shares: number, workerScript: WorkerScr `in commission fees.`; workerScript.log("shortStock", resultTxt); } else if (!opts.suppressDialog) { - dialogBoxCreate(<>Bought a short position of {numeralWrapper.formatShares(shares)} shares of {stock.symbol} for {Money(totalPrice)}. Paid {Money(CONSTANTS.StockMarketCommission)} in commission fees.); + dialogBoxCreate(<>Bought a short position of {numeralWrapper.formatShares(shares)} shares of {stock.symbol} for . Paid in commission fees.); } return true; @@ -287,7 +287,7 @@ export function sellShort(stock: Stock, shares: number, workerScript: WorkerScri `After commissions, you gained a total of ${numeralWrapper.formatMoney(totalGain)}`; workerScript.log("sellShort", resultTxt); } else if (!opts.suppressDialog) { - dialogBoxCreate(<>Sold your short position of {numeralWrapper.formatShares(shares)} shares of {stock.symbol}. After commissions, you gained a total of {Money(totalGain)}); + dialogBoxCreate(<>Sold your short position of {numeralWrapper.formatShares(shares)} shares of {stock.symbol}. After commissions, you gained a total of ); } return true; diff --git a/src/StockMarket/OrderProcessing.tsx b/src/StockMarket/OrderProcessing.tsx index f6a5e5d37..a44a71a59 100644 --- a/src/StockMarket/OrderProcessing.tsx +++ b/src/StockMarket/OrderProcessing.tsx @@ -150,7 +150,7 @@ function executeOrder(order: Order, refs: IProcessOrderRefs): void { for (let i = 0; i < stockOrders.length; ++i) { if (order == stockOrders[i]) { stockOrders.splice(i, 1); - dialogBoxCreate(<>{order.type} for {stock.symbol} @ {Money(order.price)} ({pos}) was filled ({numeralWrapper.formatShares(Math.round(order.shares))} shares)); + dialogBoxCreate(<>{order.type} for {stock.symbol} @ ({pos}) was filled ({numeralWrapper.formatShares(Math.round(order.shares))} shares)); refs.rerenderFn(); return; } @@ -160,7 +160,7 @@ function executeOrder(order: Order, refs: IProcessOrderRefs): void { console.error(order); } else { if (isBuy) { - dialogBoxCreate(<>Failed to execute {order.type} for {stock.symbol} @ {Money(order.price)} ({pos}). This is most likely because you do not have enough money or the order would exceed the stock's maximum number of shares); + dialogBoxCreate(<>Failed to execute {order.type} for {stock.symbol} @ ({pos}). This is most likely because you do not have enough money or the order would exceed the stock's maximum number of shares); } } } diff --git a/src/StockMarket/ui/InfoAndPurchases.tsx b/src/StockMarket/ui/InfoAndPurchases.tsx index a4bd49230..349959db4 100644 --- a/src/StockMarket/ui/InfoAndPurchases.tsx +++ b/src/StockMarket/ui/InfoAndPurchases.tsx @@ -107,7 +107,7 @@ export class InfoAndPurchases extends React.Component { Buy WSE Account - {Money(cost)}} + text={<>Buy WSE Account - } /> ) } @@ -125,7 +125,7 @@ export class InfoAndPurchases extends React.Component { disabled={!this.props.p.canAfford(cost) || !this.props.p.hasWseAccount} onClick={this.purchaseTixApiAccess} style={blockStyleMarkup} - text={<>Buy Trade Information eXchange (TIX) API Access - {Money(cost)}} + text={<>Buy Trade Information eXchange (TIX) API Access - } /> ) } @@ -145,7 +145,7 @@ export class InfoAndPurchases extends React.Component { Buy 4S Market Data Access - {Money(cost)}} + text={<>Buy 4S Market Data Access - } tooltip={"Lets you view additional pricing and volatility information about stocks"} /> ) @@ -174,7 +174,7 @@ export class InfoAndPurchases extends React.Component { Buy 4S Market Data TIX API Access - {Money(cost)}} + text={<>Buy 4S Market Data TIX API Access - } tooltip={"Let you access 4S Market Data through Netscript"} /> ) @@ -216,7 +216,7 @@ export class InfoAndPurchases extends React.Component { {this.renderPurchase4SMarketDataTixApiAccessButton()}

Commission Fees: Every transaction you make has - a {Money(CONSTANTS.StockMarketCommission)} commission fee. + a commission fee.


WARNING: When you reset after installing Augmentations, the Stock diff --git a/src/StockMarket/ui/StockTicker.tsx b/src/StockMarket/ui/StockTicker.tsx index a5165344e..dc6de5280 100644 --- a/src/StockMarket/ui/StockTicker.tsx +++ b/src/StockMarket/ui/StockTicker.tsx @@ -115,7 +115,7 @@ export class StockTicker extends React.Component { const cost = getBuyTransactionCost(stock, qty, this.state.position); if (cost == null) { return null; } - return <>Purchasing {numeralWrapper.formatShares(qty)} shares ({this.state.position === PositionTypes.Long ? "Long" : "Short"}) will cost {Money(cost)}.; + return <>Purchasing {numeralWrapper.formatShares(qty)} shares ({this.state.position === PositionTypes.Long ? "Long" : "Short"}) will cost .; } getQuantity(): number { @@ -140,7 +140,7 @@ export class StockTicker extends React.Component { const cost = getSellTransactionGain(stock, qty, this.state.position); if (cost == null) { return null; } - return <>Selling {numeralWrapper.formatShares(qty)} shares ({this.state.position === PositionTypes.Long ? "Long" : "Short"}) will result in a gain of {Money(cost)}.; + return <>Selling {numeralWrapper.formatShares(qty)} shares ({this.state.position === PositionTypes.Long ? "Long" : "Short"}) will result in a gain of .; } handleBuyButtonClick(): void { diff --git a/src/StockMarket/ui/StockTickerOrder.tsx b/src/StockMarket/ui/StockTickerOrder.tsx index e6d5b2b50..f055f80ce 100644 --- a/src/StockMarket/ui/StockTickerOrder.tsx +++ b/src/StockMarket/ui/StockTickerOrder.tsx @@ -29,7 +29,7 @@ export class StockTickerOrder extends React.Component { const order = this.props.order; const posTxt = order.pos === PositionTypes.Long ? "Long Position" : "Short Position"; - const txt = <>{order.type} - {posTxt} - {numeralWrapper.formatShares(order.shares)} @ {Money(order.price)} + const txt = <>{order.type} - {posTxt} - {numeralWrapper.formatShares(order.shares)} @ return (

  • diff --git a/src/StockMarket/ui/StockTickerPositionText.tsx b/src/StockMarket/ui/StockTickerPositionText.tsx index dbb1977aa..06a11b8bb 100644 --- a/src/StockMarket/ui/StockTickerPositionText.tsx +++ b/src/StockMarket/ui/StockTickerPositionText.tsx @@ -43,10 +43,10 @@ export class StockTickerPositionText extends React.Component { Shares: {numeralWrapper.formatShares(stock.playerShares)}


    - Average Price: {Money(stock.playerAvgPx)} (Total Cost: {Money(totalCost)}) + Average Price: (Total Cost:


    - Profit: {Money(gains)} ({numeralWrapper.formatPercentage(percentageGains)}) + Profit: ({numeralWrapper.formatPercentage(percentageGains)})


    ) @@ -75,10 +75,10 @@ export class StockTickerPositionText extends React.Component { Shares: {numeralWrapper.formatShares(stock.playerShortShares)}


    - Average Price: {Money(stock.playerAvgShortPx)} (Total Cost: {Money(totalCost)}) + Average Price: (Total Cost: )


    - Profit: {Money(gains)} ({numeralWrapper.formatPercentage(percentageGains)}) + Profit: ({numeralWrapper.formatPercentage(percentageGains)})


    ) @@ -96,13 +96,13 @@ export class StockTickerPositionText extends React.Component { Max Shares: {numeralWrapper.formatShares(stock.maxShares)}

    - Ask Price: {Money(stock.getAskPrice())} + Ask Price: See Investopedia for details on what this is


    - Bid Price: {Money(stock.getBidPrice())} + Bid Price: See Investopedia for details on what this is diff --git a/src/ui/ActiveScripts/ScriptProduction.tsx b/src/ui/ActiveScripts/ScriptProduction.tsx index d82d430dc..eac508871 100644 --- a/src/ui/ActiveScripts/ScriptProduction.tsx +++ b/src/ui/ActiveScripts/ScriptProduction.tsx @@ -26,18 +26,18 @@ export function ScriptProduction(props: IProps): React.ReactElement { Total online production of Active scripts:  - {Money(onlineProduction)} + / sec
    Total online production since last Aug installation:  - {Money(props.p.scriptProdSinceLastAug)} +  ( - {Money(prodRateSinceLastAug)} + / sec )

    diff --git a/src/ui/ActiveScripts/WorkerScriptAccordion.tsx b/src/ui/ActiveScripts/WorkerScriptAccordion.tsx index f055fd07a..5bb690bd1 100644 --- a/src/ui/ActiveScripts/WorkerScriptAccordion.tsx +++ b/src/ui/ActiveScripts/WorkerScriptAccordion.tsx @@ -53,13 +53,13 @@ export function WorkerScriptAccordion(props: IProps): React.ReactElement {
    Args: {arrayToString(props.workerScript.args)}
    Online Time: {convertTimeMsToTimeElapsedString(scriptRef.onlineRunningTime * 1e3)}
    Offline Time: {convertTimeMsToTimeElapsedString(scriptRef.offlineRunningTime * 1e3)}
    -
    Total online production: {Money(scriptRef.onlineMoneyMade)}
    +
    Total online production: 
    {(Array(26).join(" ") + numeralWrapper.formatExp(scriptRef.onlineExpGained) + " hacking exp")}
    -
    Online production rate: {Money(onlineMps)} / second
    +
    Online production rate:  / second
    {(Array(25).join(" ") + numeralWrapper.formatExp(onlineEps) + " hacking exp / second")}
    -
    Total offline production: {Money(scriptRef.offlineMoneyMade)}
    +
    Total offline production: 
    {(Array(27).join(" ") + numeralWrapper.formatExp(scriptRef.offlineExpGained) + " hacking exp")}
    -
    Offline production rate: {Money(offlineMps)} / second
    +
    Offline production rate:  / second
    {(Array(26).join(" ") + numeralWrapper.formatExp(offlineEps) +  " hacking exp / second")}
    ]]; + if (src.bladeburner) { parts.push([`Bladeburner:`, ]) } + if (src.codingcontract) { parts.push([`Coding Contracts:`, ]) } + if (src.work) { parts.push([`Company Work:`, ]) } + if (src.class) { parts.push([`Class:`, ]) } + if (src.corporation) { parts.push([`Corporation:`, ]) } + if (src.crime) { parts.push([`Crimes:`, ]) } + if (src.gang) { parts.push([`Gang:`, ]) } + if (src.hacking) { parts.push([`Hacking:`, ]) } + if (src.hacknetnode) { parts.push([`Hacknet Nodes:`, ]) } + if (src.hospitalization) { parts.push([`Hospitalization:`, ]) } + if (src.infiltration) { parts.push([`Infiltration:`, ]) } + if (src.stock) { parts.push([`Stock Market:`, ]) } + if (src.casino) { parts.push([`Casino:`, ]) } + if (src.sleeves) { parts.push([`Sleeves:`, ]) } return StatsTable(parts); } diff --git a/src/ui/React/Money.tsx b/src/ui/React/Money.tsx index eb2b2927d..4dd49c09d 100644 --- a/src/ui/React/Money.tsx +++ b/src/ui/React/Money.tsx @@ -1,6 +1,16 @@ import * as React from "react"; import { numeralWrapper } from "../../ui/numeralFormat"; +import { IPlayer } from "../../PersonObjects/IPlayer"; -export function Money(money: number | string): JSX.Element { - return {typeof money === 'number' ? numeralWrapper.formatMoney(money) : money} +interface IProps { + money: number | string; + player?: IPlayer; +} +export function Money(props: IProps): JSX.Element { + if(props.player !== undefined) { + if(typeof props.money !== 'number') throw new Error('if player if provided, money should be number, contact dev'); + if(!props.player.canAfford(props.money)) + return {numeralWrapper.formatMoney(props.money)} + } + return {typeof props.money === 'number' ? numeralWrapper.formatMoney(props.money) : props.money} } \ No newline at end of file diff --git a/src/ui/React/MoneyRate.tsx b/src/ui/React/MoneyRate.tsx index 6e03a06f5..611a94fe1 100644 --- a/src/ui/React/MoneyRate.tsx +++ b/src/ui/React/MoneyRate.tsx @@ -1,6 +1,7 @@ +import React from 'react'; import { numeralWrapper } from "../../ui/numeralFormat"; import { Money } from "../../ui/React/Money"; export function MoneyRate(money: number): JSX.Element { - return Money(`${numeralWrapper.formatMoney(money)} / sec`); + return ; } \ No newline at end of file