mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-26 09:33:49 +01:00
Change money to automatically color grey when something cannot be bought.
This commit is contained in:
parent
3a943e0e50
commit
6e013e4e6a
@ -345,6 +345,10 @@ a:visited {
|
|||||||
color: $light-yellow;
|
color: $light-yellow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.unbuyable {
|
||||||
|
color: #66CFBC;
|
||||||
|
}
|
||||||
|
|
||||||
.failure {
|
.failure {
|
||||||
color: $alert-red;
|
color: $alert-red;
|
||||||
text-shadow: 0 0 0 $alert-red;
|
text-shadow: 0 0 0 $alert-red;
|
||||||
|
@ -167,7 +167,7 @@ function generateStatsDescription(mults: IMap<number>, programs?: string[], star
|
|||||||
desc = <>{desc}<br />+{f(mults.bladeburner_success_chance_mult-1)} Bladeburner Contracts and Operations success chance</>
|
desc = <>{desc}<br />+{f(mults.bladeburner_success_chance_mult-1)} Bladeburner Contracts and Operations success chance</>
|
||||||
|
|
||||||
if(startingMoney)
|
if(startingMoney)
|
||||||
desc = <>{desc}<br />Start with {Money(startingMoney)} after installing Augmentations.</>
|
desc = <>{desc}<br />Start with <Money money={startingMoney} /> after installing Augmentations.</>
|
||||||
|
|
||||||
if(programs)
|
if(programs)
|
||||||
desc = <>{desc}<br />Start with {programs.join(' and ')} after installing Augmentations.</>
|
desc = <>{desc}<br />Start with {programs.join(' and ')} after installing Augmentations.</>
|
||||||
|
@ -97,7 +97,7 @@ export function Stats(props: IProps): React.ReactElement {
|
|||||||
<p>Team Size: {formatNumber(props.bladeburner.teamSize, 0)}</p>
|
<p>Team Size: {formatNumber(props.bladeburner.teamSize, 0)}</p>
|
||||||
<p>Team Members Lost: {formatNumber(props.bladeburner.teamLost, 0)}</p><br />
|
<p>Team Members Lost: {formatNumber(props.bladeburner.teamLost, 0)}</p><br />
|
||||||
<p>Num Times Hospitalized: {props.bladeburner.numHosp}</p>
|
<p>Num Times Hospitalized: {props.bladeburner.numHosp}</p>
|
||||||
<p>Money Lost From Hospitalizations: {Money(props.bladeburner.moneyLost)}</p><br />
|
<p>Money Lost From Hospitalizations: <Money money={props.bladeburner.moneyLost} /></p><br />
|
||||||
<p>Current City: {props.bladeburner.city}</p>
|
<p>Current City: {props.bladeburner.city}</p>
|
||||||
<p className="tooltip" style={{display: 'inline-block'}}>
|
<p className="tooltip" style={{display: 'inline-block'}}>
|
||||||
Est. Synthoid Population: {numeralWrapper.formatPopulation(props.bladeburner.getCurrentCity().popEst)}
|
Est. Synthoid Population: {numeralWrapper.formatPopulation(props.bladeburner.getCurrentCity().popEst)}
|
||||||
|
@ -314,7 +314,7 @@ export class Blackjack extends Game<Props, State> {
|
|||||||
label={
|
label={
|
||||||
<>
|
<>
|
||||||
{"Wager (Max: "}
|
{"Wager (Max: "}
|
||||||
{Money(MAX_BET)}
|
<Money money={MAX_BET} />
|
||||||
{")"}
|
{")"}
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
@ -333,7 +333,7 @@ export class Blackjack extends Game<Props, State> {
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
{"Total earnings this session: "}
|
{"Total earnings this session: "}
|
||||||
{Money(gains)}
|
<Money money={gains} />
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -404,13 +404,13 @@ export class Blackjack extends Game<Props, State> {
|
|||||||
{this.isPlayerWinResult(result) && (
|
{this.isPlayerWinResult(result) && (
|
||||||
<>
|
<>
|
||||||
{" You gained "}
|
{" You gained "}
|
||||||
{Money(this.state.bet)}
|
<Money money={this.state.bet} />
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{result === Result.DealerWon && (
|
{result === Result.DealerWon && (
|
||||||
<>
|
<>
|
||||||
{" You lost "}
|
{" You lost "}
|
||||||
{Money(this.state.bet)}
|
<Money money={this.state.bet} />
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</p>
|
</p>
|
||||||
|
@ -202,10 +202,10 @@ export class Roulette extends Game<IProps, IState> {
|
|||||||
}
|
}
|
||||||
if(playerWin) {
|
if(playerWin) {
|
||||||
gain = this.state.investment*this.state.strategy.payout;
|
gain = this.state.investment*this.state.strategy.payout;
|
||||||
status = <>won {Money(gain)}</>;
|
status = <>won <Money money={gain} /></>;
|
||||||
} else {
|
} else {
|
||||||
gain = -this.state.investment;
|
gain = -this.state.investment;
|
||||||
status = <>lost {Money(-gain)}</>;
|
status = <>lost <Money money={-gain} /></>;
|
||||||
}
|
}
|
||||||
this.win(this.props.p, gain);
|
this.win(this.props.p, gain);
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@ -170,7 +170,7 @@ export class SlotMachine extends Game<IProps, IState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
status: <>{gains>0?"gained":"lost"} {Money(Math.abs(gains))}</>,
|
status: <>{gains>0?"gained":"lost"} <Money money={Math.abs(gains)} /></>,
|
||||||
canPlay: true,
|
canPlay: true,
|
||||||
})
|
})
|
||||||
if(this.reachedLimit(this.props.p)) return;
|
if(this.reachedLimit(this.props.p)) return;
|
||||||
|
@ -51,7 +51,7 @@ export function executeDarkwebTerminalCommand(commandArray: string[]): void {
|
|||||||
function listAllDarkwebItems(): void {
|
function listAllDarkwebItems(): void {
|
||||||
for(const key in DarkWebItems) {
|
for(const key in DarkWebItems) {
|
||||||
const item = DarkWebItems[key];
|
const item = DarkWebItems[key];
|
||||||
postElement(<>{item.program} - {Money(item.price)} - {item.description}</>);
|
postElement(<>{item.program} - <Money money={item.price} player={Player} /> - {item.description}</>);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ export function DonateOption(props: IProps): React.ReactElement {
|
|||||||
const repGain = repFromDonation(amt, props.p);
|
const repGain = repFromDonation(amt, props.p);
|
||||||
props.faction.playerReputation += repGain;
|
props.faction.playerReputation += repGain;
|
||||||
dialogBoxCreate(<>
|
dialogBoxCreate(<>
|
||||||
You just donated {Money(amt)} to {fac.name} to gain {Reputation(repGain)} reputation.
|
You just donated <Money money={amt} /> to {fac.name} to gain {Reputation(repGain)} reputation.
|
||||||
</>);
|
</>);
|
||||||
props.rerender();
|
props.rerender();
|
||||||
}
|
}
|
||||||
|
@ -119,10 +119,10 @@ export class PurchaseableAugmentation extends React.Component<IProps, any> {
|
|||||||
} else if (this.aug.name !== AugmentationNames.NeuroFluxGovernor && (this.aug.owned || this.owned())) {
|
} else if (this.aug.name !== AugmentationNames.NeuroFluxGovernor && (this.aug.owned || this.owned())) {
|
||||||
disabled = true;
|
disabled = true;
|
||||||
} else if (this.hasReputation()) {
|
} else if (this.hasReputation()) {
|
||||||
status = <>UNLOCKED (at {Reputation(repCost)} faction reputation) - {Money(moneyCost)}</>;
|
status = <>UNLOCKED (at {Reputation(repCost)} faction reputation) - <Money money={moneyCost} player={this.props.p} /></>;
|
||||||
} else {
|
} else {
|
||||||
disabled = true;
|
disabled = true;
|
||||||
status = <>LOCKED (Requires {Reputation(repCost)} faction reputation - {Money(moneyCost)})</>;
|
status = <>LOCKED (Requires {Reputation(repCost)} faction reputation - <Money money={moneyCost} player={this.props.p} />)</>;
|
||||||
color = "red";
|
color = "red";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ function GangMemberUpgradePanel(props: IPanelProps): React.ReactElement {
|
|||||||
setRerender(old => !old);
|
setRerender(old => !old);
|
||||||
}
|
}
|
||||||
return (<a key={upg.name} className="a-link-button tooltip" style={{margin:"2px", padding:"2px", display:"block", fontSize:"11px"}} onClick={onClick}>
|
return (<a key={upg.name} className="a-link-button tooltip" style={{margin:"2px", padding:"2px", display:"block", fontSize:"11px"}} onClick={onClick}>
|
||||||
{upg.name} - {Money(props.gang.getUpgradeCost(upg))}
|
{upg.name} - <Money money={props.gang.getUpgradeCost(upg)} player={props.player} />
|
||||||
<span className={left?"tooltiptextleft":"tooltiptext"} dangerouslySetInnerHTML={{__html: upg.desc}} />
|
<span className={left?"tooltiptextleft":"tooltiptext"} dangerouslySetInnerHTML={{__html: upg.desc}} />
|
||||||
</a>);
|
</a>);
|
||||||
}
|
}
|
||||||
|
@ -10,14 +10,14 @@ export const HashUpgradesMetadata: IConstructorParams[] = [
|
|||||||
costPerLevel: 4,
|
costPerLevel: 4,
|
||||||
desc: "Sell hashes for $1m",
|
desc: "Sell hashes for $1m",
|
||||||
name: "Sell for Money",
|
name: "Sell for Money",
|
||||||
effectText: (level: number): JSX.Element | null => (<>Sold for {Money(1e6*level)}</>),
|
effectText: (level: number): JSX.Element | null => (<>Sold for <Money money={1e6*level} /></>),
|
||||||
value: 1e6,
|
value: 1e6,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
costPerLevel: 100,
|
costPerLevel: 100,
|
||||||
desc: "Sell hashes for $1b in Corporation funds",
|
desc: "Sell hashes for $1b in Corporation funds",
|
||||||
name: "Sell for 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 <Money money={1e9*level} /> Corporation funds.</>),
|
||||||
value: 1e9,
|
value: 1e9,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -67,7 +67,7 @@ export function Victory(props: IProps): React.ReactElement {
|
|||||||
<StdButton onClick={trade} text={<>{"Trade for "}{Reputation(repGain)}{" reputation"}</>} />
|
<StdButton onClick={trade} text={<>{"Trade for "}{Reputation(repGain)}{" reputation"}</>} />
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={3}>
|
<Grid item xs={3}>
|
||||||
<StdButton onClick={sell} text={<>{"Sell for "}{Money(moneyGain)}</>} />
|
<StdButton onClick={sell} text={<>{"Sell for "}<Money money={moneyGain} /></>} />
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={3}>
|
<Grid item xs={3}>
|
||||||
<StdButton onClick={quitInfiltration} text={"Quit"} />
|
<StdButton onClick={quitInfiltration} text={"Quit"} />
|
||||||
|
@ -79,7 +79,7 @@ export function createTravelPopup(destination: CityName, travelFn: TravelFunctio
|
|||||||
});
|
});
|
||||||
|
|
||||||
yesNoBoxCreate(<span>Would you like to travel to {destination}? The trip will
|
yesNoBoxCreate(<span>Would you like to travel to {destination}? The trip will
|
||||||
cost {Money(cost)}.</span>);
|
cost <Money money={cost} />.</span>);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -107,7 +107,7 @@ export function createPurchaseServerPopup(ram: number, p: IPlayer): void {
|
|||||||
yesNoTxtInpBoxClose();
|
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 <Money money={cost} player={p} />?
|
||||||
<br /><br />Please enter the server hostname below:<br />
|
<br /><br />Please enter the server hostname below:<br />
|
||||||
</>);
|
</>);
|
||||||
}
|
}
|
||||||
@ -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
|
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.<br /><br />
|
lets you start with an additional Core Node in Hacking Missions.<br /><br />
|
||||||
Purchasing an additional core (for a total of {p.getHomeComputer().cpuCores + 1}) will
|
Purchasing an additional core (for a total of {p.getHomeComputer().cpuCores + 1}) will
|
||||||
cost {Money(cost)}</>);
|
cost <Money money={cost} player={p} /></>);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -59,6 +59,6 @@ export function CoresButton(props: IProps): React.ReactElement {
|
|||||||
disabled={!props.p.canAfford(cost)}
|
disabled={!props.p.canAfford(cost)}
|
||||||
onClick={buy}
|
onClick={buy}
|
||||||
style={btnStyle}
|
style={btnStyle}
|
||||||
text={<>Upgrade 'home' cores ({homeComputer.cpuCores} -> {homeComputer.cpuCores+1}) - {Money(cost)}</>}
|
text={<>Upgrade 'home' cores ({homeComputer.cpuCores} -> {homeComputer.cpuCores+1}) - <Money money={cost} player={props.p} /></>}
|
||||||
/>);
|
/>);
|
||||||
}
|
}
|
||||||
|
@ -77,22 +77,22 @@ export class GymLocation extends React.Component<IProps, any> {
|
|||||||
<StdButton
|
<StdButton
|
||||||
onClick={this.trainStrength}
|
onClick={this.trainStrength}
|
||||||
style={this.btnStyle}
|
style={this.btnStyle}
|
||||||
text={<>Train Strength ({Money(cost)} / sec)</>}
|
text={<>Train Strength (<Money money={cost} player={this.props.p} /> / sec)</>}
|
||||||
/>
|
/>
|
||||||
<StdButton
|
<StdButton
|
||||||
onClick={this.trainDefense}
|
onClick={this.trainDefense}
|
||||||
style={this.btnStyle}
|
style={this.btnStyle}
|
||||||
text={<>Train Defense ({Money(cost)} / sec)</>}
|
text={<>Train Defense (<Money money={cost} player={this.props.p} /> / sec)</>}
|
||||||
/>
|
/>
|
||||||
<StdButton
|
<StdButton
|
||||||
onClick={this.trainDexterity}
|
onClick={this.trainDexterity}
|
||||||
style={this.btnStyle}
|
style={this.btnStyle}
|
||||||
text={<>Train Dexterity ({Money(cost)} / sec)</>}
|
text={<>Train Dexterity (<Money money={cost} player={this.props.p} /> / sec)</>}
|
||||||
/>
|
/>
|
||||||
<StdButton
|
<StdButton
|
||||||
onClick={this.trainAgility}
|
onClick={this.trainAgility}
|
||||||
style={this.btnStyle}
|
style={this.btnStyle}
|
||||||
text={<>Train Agility ({Money(cost)} / sec)</>}
|
text={<>Train Agility (<Money money={cost} player={this.props.p} /> / sec)</>}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
@ -60,7 +60,7 @@ export class HospitalLocation extends React.Component<IProps, IState> {
|
|||||||
currHp: this.props.p.hp,
|
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 <Money money={cost} /></>);
|
||||||
}
|
}
|
||||||
|
|
||||||
render(): React.ReactNode {
|
render(): React.ReactNode {
|
||||||
@ -70,7 +70,7 @@ export class HospitalLocation extends React.Component<IProps, IState> {
|
|||||||
<AutoupdatingStdButton
|
<AutoupdatingStdButton
|
||||||
onClick={this.getHealed}
|
onClick={this.getHealed}
|
||||||
style={this.btnStyle}
|
style={this.btnStyle}
|
||||||
text={<>Get treatment for wounds - {Money(cost)}</>}
|
text={<>Get treatment for wounds - <Money money={cost} player={this.props.p} /></>}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,6 @@ export function RamButton(props: IProps): React.ReactElement {
|
|||||||
disabled={!props.p.canAfford(cost)}
|
disabled={!props.p.canAfford(cost)}
|
||||||
onClick={buy}
|
onClick={buy}
|
||||||
style={btnStyle}
|
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) - <Money money={cost} player={props.p} /></>}
|
||||||
/>);
|
/>);
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ export function TechVendorLocation(props: IProps): React.ReactElement {
|
|||||||
key={i}
|
key={i}
|
||||||
onClick={() => createPurchaseServerPopup(i, props.p)}
|
onClick={() => createPurchaseServerPopup(i, props.p)}
|
||||||
style={btnStyle}
|
style={btnStyle}
|
||||||
text={<>Purchase {i}GB Server - {Money(cost)}</>}
|
text={<>Purchase {i}GB Server - <Money money={cost} player={props.p} /></>}
|
||||||
/>,
|
/>,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,6 @@ export function TorButton(props: IProps): React.ReactElement {
|
|||||||
disabled={!props.p.canAfford(CONSTANTS.TorRouterCost)}
|
disabled={!props.p.canAfford(CONSTANTS.TorRouterCost)}
|
||||||
onClick={buy}
|
onClick={buy}
|
||||||
style={btnStyle}
|
style={btnStyle}
|
||||||
text={<>Purchase TOR router - {Money(CONSTANTS.TorRouterCost)}</>}
|
text={<>Purchase TOR router - <Money money={CONSTANTS.TorRouterCost} player={props.p} /></>}
|
||||||
/>);
|
/>);
|
||||||
}
|
}
|
||||||
|
@ -103,31 +103,31 @@ export class UniversityLocation extends React.Component<IProps, any> {
|
|||||||
<StdButton
|
<StdButton
|
||||||
onClick={this.dataStructures}
|
onClick={this.dataStructures}
|
||||||
style={this.btnStyle}
|
style={this.btnStyle}
|
||||||
text={<>Take Data Structures course ({Money(dataStructuresCost)} / sec)</>}
|
text={<>Take Data Structures course (<Money money={dataStructuresCost} player={this.props.p} /> / sec)</>}
|
||||||
tooltip={earnHackingExpTooltip}
|
tooltip={earnHackingExpTooltip}
|
||||||
/>
|
/>
|
||||||
<StdButton
|
<StdButton
|
||||||
onClick={this.networks}
|
onClick={this.networks}
|
||||||
style={this.btnStyle}
|
style={this.btnStyle}
|
||||||
text={<>Take Networks course ({Money(networksCost)} / sec)</>}
|
text={<>Take Networks course (<Money money={networksCost} player={this.props.p} /> / sec)</>}
|
||||||
tooltip={earnHackingExpTooltip}
|
tooltip={earnHackingExpTooltip}
|
||||||
/>
|
/>
|
||||||
<StdButton
|
<StdButton
|
||||||
onClick={this.algorithms}
|
onClick={this.algorithms}
|
||||||
style={this.btnStyle}
|
style={this.btnStyle}
|
||||||
text={<>Take Algorithms course ({Money(algorithmsCost)} / sec)</>}
|
text={<>Take Algorithms course (<Money money={algorithmsCost} player={this.props.p} /> / sec)</>}
|
||||||
tooltip={earnHackingExpTooltip}
|
tooltip={earnHackingExpTooltip}
|
||||||
/>
|
/>
|
||||||
<StdButton
|
<StdButton
|
||||||
onClick={this.management}
|
onClick={this.management}
|
||||||
style={this.btnStyle}
|
style={this.btnStyle}
|
||||||
text={<>Take Management course ({Money(managementCost)} / sec)</>}
|
text={<>Take Management course (<Money money={managementCost} player={this.props.p} /> / sec)</>}
|
||||||
tooltip={earnCharismaExpTooltip}
|
tooltip={earnCharismaExpTooltip}
|
||||||
/>
|
/>
|
||||||
<StdButton
|
<StdButton
|
||||||
onClick={this.leadership}
|
onClick={this.leadership}
|
||||||
style={this.btnStyle}
|
style={this.btnStyle}
|
||||||
text={<>Take Leadership course ({Money(leadershipCost)} / sec)</>}
|
text={<>Take Leadership course (<Money money={leadershipCost} player={this.props.p} /> / sec)</>}
|
||||||
tooltip={earnCharismaExpTooltip}
|
tooltip={earnCharismaExpTooltip}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -254,6 +254,7 @@ function createResleeveUi(resleeve: Resleeve): IResleeveUIElems {
|
|||||||
costText: null,
|
costText: null,
|
||||||
buyButton: null,
|
buyButton: null,
|
||||||
};
|
};
|
||||||
|
if(playerRef === null) return elems;
|
||||||
|
|
||||||
if (!routing.isOn(Page.Resleeves)) { return elems; }
|
if (!routing.isOn(Page.Resleeves)) { return elems; }
|
||||||
|
|
||||||
@ -334,7 +335,7 @@ function createResleeveUi(resleeve: Resleeve): IResleeveUIElems {
|
|||||||
const cost: number = resleeve.getCost();
|
const cost: number = resleeve.getCost();
|
||||||
elems.costPanel = createElement("div", { class: "resleeve-panel", width: "20%" });
|
elems.costPanel = createElement("div", { class: "resleeve-panel", width: "20%" });
|
||||||
elems.costText = createElement("p", {
|
elems.costText = createElement("p", {
|
||||||
innerHTML: `It costs ${renderToStaticMarkup(Money(cost))} ` +
|
innerHTML: `It costs ${renderToStaticMarkup(<Money money={cost} player={playerRef} />)} ` +
|
||||||
`to purchase this Sleeve.`,
|
`to purchase this Sleeve.`,
|
||||||
});
|
});
|
||||||
elems.buyButton = createElement("button", {
|
elems.buyButton = createElement("button", {
|
||||||
@ -343,7 +344,7 @@ function createResleeveUi(resleeve: Resleeve): IResleeveUIElems {
|
|||||||
clickListener: () => {
|
clickListener: () => {
|
||||||
if(playerRef == null) throw new Error("playerRef is null in buyButton.click()");
|
if(playerRef == null) throw new Error("playerRef is null in buyButton.click()");
|
||||||
if (purchaseResleeve(resleeve, playerRef)) {
|
if (purchaseResleeve(resleeve, playerRef)) {
|
||||||
dialogBoxCreate((<>You re-sleeved for {Money(cost)}!</>), false);
|
dialogBoxCreate((<>You re-sleeved for <Money money={cost} />!</>), false);
|
||||||
} else {
|
} else {
|
||||||
dialogBoxCreate(`You cannot afford to re-sleeve into this body`, false);
|
dialogBoxCreate(`You cannot afford to re-sleeve into this body`, false);
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
* Module for handling the UI for purchasing Sleeve Augmentations
|
* Module for handling the UI for purchasing Sleeve Augmentations
|
||||||
* This UI is a popup, not a full page
|
* This UI is a popup, not a full page
|
||||||
*/
|
*/
|
||||||
|
import React from 'react';
|
||||||
import { Sleeve } from "./Sleeve";
|
import { Sleeve } from "./Sleeve";
|
||||||
import { findSleevePurchasableAugs } from "./SleeveHelpers";
|
import { findSleevePurchasableAugs } from "./SleeveHelpers";
|
||||||
|
|
||||||
@ -102,7 +103,7 @@ export function createSleevePurchaseAugsPopup(sleeve: Sleeve, p: IPlayer): void
|
|||||||
innerHTML:
|
innerHTML:
|
||||||
[
|
[
|
||||||
`<h2>${aug.name}</h2><br>`,
|
`<h2>${aug.name}</h2><br>`,
|
||||||
`Cost: ${renderToStaticMarkup(Money(aug.startingCost))}<br><br>`,
|
`Cost: ${renderToStaticMarkup(<Money money={aug.startingCost} player={p} />)}<br><br>`,
|
||||||
`${info}`,
|
`${info}`,
|
||||||
].join(" "),
|
].join(" "),
|
||||||
padding: "2px",
|
padding: "2px",
|
@ -1,6 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Module for handling the Sleeve UI
|
* Module for handling the Sleeve UI
|
||||||
*/
|
*/
|
||||||
|
import React from 'react';
|
||||||
import { createSleevePurchaseAugsPopup } from "./SleeveAugmentationsUI";
|
import { createSleevePurchaseAugsPopup } from "./SleeveAugmentationsUI";
|
||||||
import { Sleeve } from "./Sleeve";
|
import { Sleeve } from "./Sleeve";
|
||||||
import { SleeveTaskType } from "./SleeveTaskTypesEnum";
|
import { SleeveTaskType } from "./SleeveTaskTypesEnum";
|
||||||
@ -202,6 +203,7 @@ function createSleeveUi(sleeve: Sleeve, allSleeves: Sleeve[]): ISleeveUIElems {
|
|||||||
currentEarningsInfo: null,
|
currentEarningsInfo: null,
|
||||||
totalEarningsButton: null,
|
totalEarningsButton: null,
|
||||||
}
|
}
|
||||||
|
if(playerRef === null) return elems;
|
||||||
|
|
||||||
if (!routing.isOn(Page.Sleeves)) { return elems; }
|
if (!routing.isOn(Page.Sleeves)) { return elems; }
|
||||||
|
|
||||||
@ -223,13 +225,14 @@ function createSleeveUi(sleeve: Sleeve, allSleeves: Sleeve[]): ISleeveUIElems {
|
|||||||
class: "std-button",
|
class: "std-button",
|
||||||
innerText: "Travel",
|
innerText: "Travel",
|
||||||
clickListener: () => {
|
clickListener: () => {
|
||||||
|
if(playerRef === null) return;
|
||||||
const popupId = "sleeve-travel-popup";
|
const popupId = "sleeve-travel-popup";
|
||||||
const popupArguments: HTMLElement[] = [];
|
const popupArguments: HTMLElement[] = [];
|
||||||
popupArguments.push(createPopupCloseButton(popupId, { class: "std-button" }));
|
popupArguments.push(createPopupCloseButton(popupId, { class: "std-button" }));
|
||||||
popupArguments.push(createElement("p", {
|
popupArguments.push(createElement("p", {
|
||||||
innerHTML: "Have this sleeve travel to a different city. This affects " +
|
innerHTML: "Have this sleeve travel to a different city. This affects " +
|
||||||
"the gyms and universities at which this sleeve can study. " +
|
"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(<Money money={CONSTANTS.TravelCost} player={playerRef} />)}. ` +
|
||||||
"It will also CANCEL the sleeve's current task (setting it to idle)",
|
"It will also CANCEL the sleeve's current task (setting it to idle)",
|
||||||
}));
|
}));
|
||||||
for (const cityName in Cities) {
|
for (const cityName in Cities) {
|
||||||
@ -346,7 +349,7 @@ function updateSleeveUi(sleeve: Sleeve, elems: ISleeveUIElems): void {
|
|||||||
|
|
||||||
if (sleeve.currentTask === SleeveTaskType.Crime) {
|
if (sleeve.currentTask === SleeveTaskType.Crime) {
|
||||||
const data = [
|
const data = [
|
||||||
[`Money`, Money(parseFloat(sleeve.currentTaskLocation)), `(on success)`],
|
[`Money`, <Money money={parseFloat(sleeve.currentTaskLocation)} />, `(on success)`],
|
||||||
[`Hacking Exp`, numeralWrapper.formatExp(sleeve.gainRatesForTask.hack), `(2x on success)`],
|
[`Hacking Exp`, numeralWrapper.formatExp(sleeve.gainRatesForTask.hack), `(2x on success)`],
|
||||||
[`Strength Exp`, numeralWrapper.formatExp(sleeve.gainRatesForTask.str), `(2x on success)`],
|
[`Strength Exp`, numeralWrapper.formatExp(sleeve.gainRatesForTask.str), `(2x on success)`],
|
||||||
[`Defense Exp`, numeralWrapper.formatExp(sleeve.gainRatesForTask.def), `(2x on success)`],
|
[`Defense Exp`, numeralWrapper.formatExp(sleeve.gainRatesForTask.def), `(2x on success)`],
|
||||||
|
@ -75,7 +75,7 @@ export function CovenantPurchasesRoot(props: IProps): React.ReactElement {
|
|||||||
<PopupCloseButton popup={PopupId} text={"Close"} />
|
<PopupCloseButton popup={PopupId} text={"Close"} />
|
||||||
<p>
|
<p>
|
||||||
Would you like to purchase an additional Duplicate Sleeve from The Covenant
|
Would you like to purchase an additional Duplicate Sleeve from The Covenant
|
||||||
for {Money(purchaseCost())}?
|
for <Money money={purchaseCost()} player={props.p} />?
|
||||||
</p>
|
</p>
|
||||||
<br />
|
<br />
|
||||||
<p>
|
<p>
|
||||||
|
@ -79,7 +79,7 @@ export class CovenantSleeveMemoryUpgrade extends React.Component<IProps, IState>
|
|||||||
} else if (this.state.amt > maxMemory) {
|
} else if (this.state.amt > maxMemory) {
|
||||||
purchaseBtnContent = <>Memory cannot exceed 100?</>;
|
purchaseBtnContent = <>Memory cannot exceed 100?</>;
|
||||||
} else {
|
} else {
|
||||||
purchaseBtnContent = <>Purchase {this.state.amt} memory - {Money(cost)}?</>;
|
purchaseBtnContent = <>Purchase {this.state.amt} memory - <Money money={cost} player={this.props.p} />?</>;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -7,7 +7,7 @@ import { StatsTable } from "../../../ui/React/StatsTable";
|
|||||||
export function MoreEarningsContent(sleeve: Sleeve): React.ReactElement {
|
export function MoreEarningsContent(sleeve: Sleeve): React.ReactElement {
|
||||||
return (<>
|
return (<>
|
||||||
{StatsTable([
|
{StatsTable([
|
||||||
['Money ', Money(sleeve.earningsForTask.money)],
|
['Money ', <Money money={sleeve.earningsForTask.money} />],
|
||||||
['Hacking Exp ', numeralWrapper.formatExp(sleeve.earningsForTask.hack)],
|
['Hacking Exp ', numeralWrapper.formatExp(sleeve.earningsForTask.hack)],
|
||||||
['Strength Exp ', numeralWrapper.formatExp(sleeve.earningsForTask.str)],
|
['Strength Exp ', numeralWrapper.formatExp(sleeve.earningsForTask.str)],
|
||||||
['Defense Exp ', numeralWrapper.formatExp(sleeve.earningsForTask.def)],
|
['Defense Exp ', numeralWrapper.formatExp(sleeve.earningsForTask.def)],
|
||||||
@ -17,7 +17,7 @@ export function MoreEarningsContent(sleeve: Sleeve): React.ReactElement {
|
|||||||
], 'Earnings for Current Task:')}
|
], 'Earnings for Current Task:')}
|
||||||
<br />
|
<br />
|
||||||
{StatsTable([
|
{StatsTable([
|
||||||
['Money: ', Money(sleeve.earningsForPlayer.money)],
|
['Money: ', <Money money={sleeve.earningsForPlayer.money} />],
|
||||||
['Hacking Exp: ', numeralWrapper.formatExp(sleeve.earningsForPlayer.hack)],
|
['Hacking Exp: ', numeralWrapper.formatExp(sleeve.earningsForPlayer.hack)],
|
||||||
['Strength Exp: ', numeralWrapper.formatExp(sleeve.earningsForPlayer.str)],
|
['Strength Exp: ', numeralWrapper.formatExp(sleeve.earningsForPlayer.str)],
|
||||||
['Defense Exp: ', numeralWrapper.formatExp(sleeve.earningsForPlayer.def)],
|
['Defense Exp: ', numeralWrapper.formatExp(sleeve.earningsForPlayer.def)],
|
||||||
@ -27,7 +27,7 @@ export function MoreEarningsContent(sleeve: Sleeve): React.ReactElement {
|
|||||||
], 'Total Earnings for Host Consciousness:')}
|
], 'Total Earnings for Host Consciousness:')}
|
||||||
<br />
|
<br />
|
||||||
{StatsTable([
|
{StatsTable([
|
||||||
['Money: ', Money(sleeve.earningsForSleeves.money)],
|
['Money: ', <Money money={sleeve.earningsForSleeves.money} />],
|
||||||
['Hacking Exp: ', numeralWrapper.formatExp(sleeve.earningsForSleeves.hack)],
|
['Hacking Exp: ', numeralWrapper.formatExp(sleeve.earningsForSleeves.hack)],
|
||||||
['Strength Exp: ', numeralWrapper.formatExp(sleeve.earningsForSleeves.str)],
|
['Strength Exp: ', numeralWrapper.formatExp(sleeve.earningsForSleeves.str)],
|
||||||
['Defense Exp: ', numeralWrapper.formatExp(sleeve.earningsForSleeves.def)],
|
['Defense Exp: ', numeralWrapper.formatExp(sleeve.earningsForSleeves.def)],
|
||||||
|
@ -60,7 +60,7 @@ export function buyStock(stock: Stock, shares: number, workerScript: WorkerScrip
|
|||||||
if (workerScript) {
|
if (workerScript) {
|
||||||
workerScript.log("buyStock", `You do not have enough money to purchase this position. You need ${numeralWrapper.formatMoney(totalPrice)}.`);
|
workerScript.log("buyStock", `You do not have enough money to purchase this position. You need ${numeralWrapper.formatMoney(totalPrice)}.`);
|
||||||
} else if (opts.suppressDialog !== true) {
|
} 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 <Money money={totalPrice} /></>);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -92,7 +92,7 @@ export function buyStock(stock: Stock, shares: number, workerScript: WorkerScrip
|
|||||||
`Paid ${numeralWrapper.formatMoney(CONSTANTS.StockMarketCommission)} in commission fees.`
|
`Paid ${numeralWrapper.formatMoney(CONSTANTS.StockMarketCommission)} in commission fees.`
|
||||||
workerScript.log("buyStock", resultTxt)
|
workerScript.log("buyStock", resultTxt)
|
||||||
} else if (opts.suppressDialog !== true) {
|
} 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 <Money money={totalPrice} />. Paid <Money money={CONSTANTS.StockMarketCommission} /> in commission fees.</>);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
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)}.`;
|
`After commissions, you gained a total of ${numeralWrapper.formatMoney(gains)}.`;
|
||||||
workerScript.log("sellStock", resultTxt)
|
workerScript.log("sellStock", resultTxt)
|
||||||
} else if (opts.suppressDialog !== true) {
|
} 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 <Money money={gains} />.</>);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -188,7 +188,7 @@ export function shortStock(stock: Stock, shares: number, workerScript: WorkerScr
|
|||||||
"money to purchase this short position. You need " +
|
"money to purchase this short position. You need " +
|
||||||
numeralWrapper.formatMoney(totalPrice));
|
numeralWrapper.formatMoney(totalPrice));
|
||||||
} else if (opts.suppressDialog !== true) {
|
} 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 <Money money={totalPrice} /></>);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -222,7 +222,7 @@ export function shortStock(stock: Stock, shares: number, workerScript: WorkerScr
|
|||||||
`in commission fees.`;
|
`in commission fees.`;
|
||||||
workerScript.log("shortStock", resultTxt);
|
workerScript.log("shortStock", resultTxt);
|
||||||
} else if (!opts.suppressDialog) {
|
} 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 <Money money={totalPrice} />. Paid <Money money={CONSTANTS.StockMarketCommission} /> in commission fees.</>);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
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)}`;
|
`After commissions, you gained a total of ${numeralWrapper.formatMoney(totalGain)}`;
|
||||||
workerScript.log("sellShort", resultTxt);
|
workerScript.log("sellShort", resultTxt);
|
||||||
} else if (!opts.suppressDialog) {
|
} 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 <Money money={totalGain} /></>);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -150,7 +150,7 @@ function executeOrder(order: Order, refs: IProcessOrderRefs): void {
|
|||||||
for (let i = 0; i < stockOrders.length; ++i) {
|
for (let i = 0; i < stockOrders.length; ++i) {
|
||||||
if (order == stockOrders[i]) {
|
if (order == stockOrders[i]) {
|
||||||
stockOrders.splice(i, 1);
|
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} @ <Money money={order.price} /> ({pos}) was filled ({numeralWrapper.formatShares(Math.round(order.shares))} shares)</>);
|
||||||
refs.rerenderFn();
|
refs.rerenderFn();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -160,7 +160,7 @@ function executeOrder(order: Order, refs: IProcessOrderRefs): void {
|
|||||||
console.error(order);
|
console.error(order);
|
||||||
} else {
|
} else {
|
||||||
if (isBuy) {
|
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} @ <Money 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</>);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ export class InfoAndPurchases extends React.Component<IProps, any> {
|
|||||||
<StdButton
|
<StdButton
|
||||||
disabled={!this.props.p.canAfford(cost)}
|
disabled={!this.props.p.canAfford(cost)}
|
||||||
onClick={this.purchaseWseAccount}
|
onClick={this.purchaseWseAccount}
|
||||||
text={<>Buy WSE Account - {Money(cost)}</>}
|
text={<>Buy WSE Account - <Money money={cost} player={this.props.p} /></>}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -125,7 +125,7 @@ export class InfoAndPurchases extends React.Component<IProps, any> {
|
|||||||
disabled={!this.props.p.canAfford(cost) || !this.props.p.hasWseAccount}
|
disabled={!this.props.p.canAfford(cost) || !this.props.p.hasWseAccount}
|
||||||
onClick={this.purchaseTixApiAccess}
|
onClick={this.purchaseTixApiAccess}
|
||||||
style={blockStyleMarkup}
|
style={blockStyleMarkup}
|
||||||
text={<>Buy Trade Information eXchange (TIX) API Access - {Money(cost)}</>}
|
text={<>Buy Trade Information eXchange (TIX) API Access - <Money money={cost} player={this.props.p} /></>}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -145,7 +145,7 @@ export class InfoAndPurchases extends React.Component<IProps, any> {
|
|||||||
<StdButton
|
<StdButton
|
||||||
disabled={!this.props.p.canAfford(cost) || !this.props.p.hasWseAccount}
|
disabled={!this.props.p.canAfford(cost) || !this.props.p.hasWseAccount}
|
||||||
onClick={this.purchase4SMarketData}
|
onClick={this.purchase4SMarketData}
|
||||||
text={<>Buy 4S Market Data Access - {Money(cost)}</>}
|
text={<>Buy 4S Market Data Access - <Money money={cost} player={this.props.p} /></>}
|
||||||
tooltip={"Lets you view additional pricing and volatility information about stocks"}
|
tooltip={"Lets you view additional pricing and volatility information about stocks"}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
@ -174,7 +174,7 @@ export class InfoAndPurchases extends React.Component<IProps, any> {
|
|||||||
<StdButton
|
<StdButton
|
||||||
disabled={!this.props.p.canAfford(cost)}
|
disabled={!this.props.p.canAfford(cost)}
|
||||||
onClick={this.purchase4SMarketDataTixApiAccess}
|
onClick={this.purchase4SMarketDataTixApiAccess}
|
||||||
text={<>Buy 4S Market Data TIX API Access - {Money(cost)}</>}
|
text={<>Buy 4S Market Data TIX API Access - <Money money={cost} player={this.props.p} /></>}
|
||||||
tooltip={"Let you access 4S Market Data through Netscript"}
|
tooltip={"Let you access 4S Market Data through Netscript"}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
@ -216,7 +216,7 @@ export class InfoAndPurchases extends React.Component<IProps, any> {
|
|||||||
{this.renderPurchase4SMarketDataTixApiAccessButton()}
|
{this.renderPurchase4SMarketDataTixApiAccessButton()}
|
||||||
<p>
|
<p>
|
||||||
Commission Fees: Every transaction you make has
|
Commission Fees: Every transaction you make has
|
||||||
a {Money(CONSTANTS.StockMarketCommission)} commission fee.
|
a <Money money={CONSTANTS.StockMarketCommission} player={this.props.p} /> commission fee.
|
||||||
</p><br />
|
</p><br />
|
||||||
<p>
|
<p>
|
||||||
WARNING: When you reset after installing Augmentations, the Stock
|
WARNING: When you reset after installing Augmentations, the Stock
|
||||||
|
@ -115,7 +115,7 @@ export class StockTicker extends React.Component<IProps, IState> {
|
|||||||
const cost = getBuyTransactionCost(stock, qty, this.state.position);
|
const cost = getBuyTransactionCost(stock, qty, this.state.position);
|
||||||
if (cost == null) { return null; }
|
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 <Money money={cost} />.</>;
|
||||||
}
|
}
|
||||||
|
|
||||||
getQuantity(): number {
|
getQuantity(): number {
|
||||||
@ -140,7 +140,7 @@ export class StockTicker extends React.Component<IProps, IState> {
|
|||||||
const cost = getSellTransactionGain(stock, qty, this.state.position);
|
const cost = getSellTransactionGain(stock, qty, this.state.position);
|
||||||
if (cost == null) { return null; }
|
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 <Money money={cost} />.</>;
|
||||||
}
|
}
|
||||||
|
|
||||||
handleBuyButtonClick(): void {
|
handleBuyButtonClick(): void {
|
||||||
|
@ -29,7 +29,7 @@ export class StockTickerOrder extends React.Component<IProps, any> {
|
|||||||
const order = this.props.order;
|
const order = this.props.order;
|
||||||
|
|
||||||
const posTxt = order.pos === PositionTypes.Long ? "Long Position" : "Short Position";
|
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)} @ <Money money={order.price} /></>
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<li>
|
<li>
|
||||||
|
@ -43,10 +43,10 @@ export class StockTickerPositionText extends React.Component<IProps, any> {
|
|||||||
Shares: {numeralWrapper.formatShares(stock.playerShares)}
|
Shares: {numeralWrapper.formatShares(stock.playerShares)}
|
||||||
</p><br />
|
</p><br />
|
||||||
<p>
|
<p>
|
||||||
Average Price: {Money(stock.playerAvgPx)} (Total Cost: {Money(totalCost)})
|
Average Price: <Money money={stock.playerAvgPx} /> (Total Cost: <Money money={totalCost} />
|
||||||
</p><br />
|
</p><br />
|
||||||
<p>
|
<p>
|
||||||
Profit: {Money(gains)} ({numeralWrapper.formatPercentage(percentageGains)})
|
Profit: <Money money={gains} /> ({numeralWrapper.formatPercentage(percentageGains)})
|
||||||
</p><br />
|
</p><br />
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
@ -75,10 +75,10 @@ export class StockTickerPositionText extends React.Component<IProps, any> {
|
|||||||
Shares: {numeralWrapper.formatShares(stock.playerShortShares)}
|
Shares: {numeralWrapper.formatShares(stock.playerShortShares)}
|
||||||
</p><br />
|
</p><br />
|
||||||
<p>
|
<p>
|
||||||
Average Price: {Money(stock.playerAvgShortPx)} (Total Cost: {Money(totalCost)})
|
Average Price: <Money money={stock.playerAvgShortPx} /> (Total Cost: <Money money={totalCost} />)
|
||||||
</p><br />
|
</p><br />
|
||||||
<p>
|
<p>
|
||||||
Profit: {Money(gains)} ({numeralWrapper.formatPercentage(percentageGains)})
|
Profit: <Money money={gains} /> ({numeralWrapper.formatPercentage(percentageGains)})
|
||||||
</p><br />
|
</p><br />
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
@ -96,13 +96,13 @@ export class StockTickerPositionText extends React.Component<IProps, any> {
|
|||||||
Max Shares: {numeralWrapper.formatShares(stock.maxShares)}
|
Max Shares: {numeralWrapper.formatShares(stock.maxShares)}
|
||||||
</p>
|
</p>
|
||||||
<p className={"tooltip"} >
|
<p className={"tooltip"} >
|
||||||
Ask Price: {Money(stock.getAskPrice())}
|
Ask Price: <Money money={stock.getAskPrice()} />
|
||||||
<span className={"tooltiptext"}>
|
<span className={"tooltiptext"}>
|
||||||
See Investopedia for details on what this is
|
See Investopedia for details on what this is
|
||||||
</span>
|
</span>
|
||||||
</p><br />
|
</p><br />
|
||||||
<p className={"tooltip"} >
|
<p className={"tooltip"} >
|
||||||
Bid Price: {Money(stock.getBidPrice())}
|
Bid Price: <Money money={stock.getBidPrice()} />
|
||||||
<span className={"tooltiptext"}>
|
<span className={"tooltiptext"}>
|
||||||
See Investopedia for details on what this is
|
See Investopedia for details on what this is
|
||||||
</span>
|
</span>
|
||||||
|
@ -26,18 +26,18 @@ export function ScriptProduction(props: IProps): React.ReactElement {
|
|||||||
Total online production of Active scripts:
|
Total online production of Active scripts:
|
||||||
<span className="money-gold">
|
<span className="money-gold">
|
||||||
<span id="active-scripts-total-production-active">
|
<span id="active-scripts-total-production-active">
|
||||||
{Money(onlineProduction)}
|
<Money money={onlineProduction} />
|
||||||
</span> / sec
|
</span> / sec
|
||||||
</span><br />
|
</span><br />
|
||||||
|
|
||||||
Total online production since last Aug installation:
|
Total online production since last Aug installation:
|
||||||
<span id="active-scripts-total-prod-aug-total" className="money-gold">
|
<span id="active-scripts-total-prod-aug-total" className="money-gold">
|
||||||
{Money(props.p.scriptProdSinceLastAug)}
|
<Money money={props.p.scriptProdSinceLastAug} />
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
(<span className="money-gold">
|
(<span className="money-gold">
|
||||||
<span id="active-scripts-total-prod-aug-avg" className="money-gold">
|
<span id="active-scripts-total-prod-aug-avg" className="money-gold">
|
||||||
{Money(prodRateSinceLastAug)}
|
<Money money={prodRateSinceLastAug} />
|
||||||
</span> / sec
|
</span> / sec
|
||||||
</span>)
|
</span>)
|
||||||
</p>
|
</p>
|
||||||
|
@ -53,13 +53,13 @@ export function WorkerScriptAccordion(props: IProps): React.ReactElement {
|
|||||||
<pre>Args: {arrayToString(props.workerScript.args)}</pre>
|
<pre>Args: {arrayToString(props.workerScript.args)}</pre>
|
||||||
<pre>Online Time: {convertTimeMsToTimeElapsedString(scriptRef.onlineRunningTime * 1e3)}</pre>
|
<pre>Online Time: {convertTimeMsToTimeElapsedString(scriptRef.onlineRunningTime * 1e3)}</pre>
|
||||||
<pre>Offline Time: {convertTimeMsToTimeElapsedString(scriptRef.offlineRunningTime * 1e3)}</pre>
|
<pre>Offline Time: {convertTimeMsToTimeElapsedString(scriptRef.offlineRunningTime * 1e3)}</pre>
|
||||||
<pre>Total online production: {Money(scriptRef.onlineMoneyMade)}</pre>
|
<pre>Total online production: <Money money={scriptRef.onlineMoneyMade} /></pre>
|
||||||
<pre>{(Array(26).join(" ") + numeralWrapper.formatExp(scriptRef.onlineExpGained) + " hacking exp")}</pre>
|
<pre>{(Array(26).join(" ") + numeralWrapper.formatExp(scriptRef.onlineExpGained) + " hacking exp")}</pre>
|
||||||
<pre>Online production rate: {Money(onlineMps)} / second</pre>
|
<pre>Online production rate: <Money money={onlineMps} /> / second</pre>
|
||||||
<pre>{(Array(25).join(" ") + numeralWrapper.formatExp(onlineEps) + " hacking exp / second")}</pre>
|
<pre>{(Array(25).join(" ") + numeralWrapper.formatExp(onlineEps) + " hacking exp / second")}</pre>
|
||||||
<pre>Total offline production: {Money(scriptRef.offlineMoneyMade)}</pre>
|
<pre>Total offline production: <Money money={scriptRef.offlineMoneyMade} /></pre>
|
||||||
<pre>{(Array(27).join(" ") + numeralWrapper.formatExp(scriptRef.offlineExpGained) + " hacking exp")}</pre>
|
<pre>{(Array(27).join(" ") + numeralWrapper.formatExp(scriptRef.offlineExpGained) + " hacking exp")}</pre>
|
||||||
<pre>Offline production rate: {Money(offlineMps)} / second</pre>
|
<pre>Offline production rate: <Money money={offlineMps} /> / second</pre>
|
||||||
<pre>{(Array(26).join(" ") + numeralWrapper.formatExp(offlineEps) + " hacking exp / second")}</pre>
|
<pre>{(Array(26).join(" ") + numeralWrapper.formatExp(offlineEps) + " hacking exp / second")}</pre>
|
||||||
|
|
||||||
<AccordionButton
|
<AccordionButton
|
||||||
|
@ -47,21 +47,21 @@ export function CharacterInfo(p: IPlayer): React.ReactElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function convertMoneySourceTrackerToString(src: MoneySourceTracker): React.ReactElement {
|
function convertMoneySourceTrackerToString(src: MoneySourceTracker): React.ReactElement {
|
||||||
const parts: any[][] = [[`Total:`, Money(src.total)]];
|
const parts: any[][] = [[`Total:`, <Money money={src.total} />]];
|
||||||
if (src.bladeburner) { parts.push([`Bladeburner:`, Money(src.bladeburner)]) }
|
if (src.bladeburner) { parts.push([`Bladeburner:`, <Money money={src.bladeburner} />]) }
|
||||||
if (src.codingcontract) { parts.push([`Coding Contracts:`, Money(src.codingcontract)]) }
|
if (src.codingcontract) { parts.push([`Coding Contracts:`, <Money money={src.codingcontract} />]) }
|
||||||
if (src.work) { parts.push([`Company Work:`, Money(src.work)]) }
|
if (src.work) { parts.push([`Company Work:`, <Money money={src.work} />]) }
|
||||||
if (src.class) { parts.push([`Class:`, Money(src.class)]) }
|
if (src.class) { parts.push([`Class:`, <Money money={src.class} />]) }
|
||||||
if (src.corporation) { parts.push([`Corporation:`, Money(src.corporation)]) }
|
if (src.corporation) { parts.push([`Corporation:`, <Money money={src.corporation} />]) }
|
||||||
if (src.crime) { parts.push([`Crimes:`, Money(src.crime)]) }
|
if (src.crime) { parts.push([`Crimes:`, <Money money={src.crime} />]) }
|
||||||
if (src.gang) { parts.push([`Gang:`, Money(src.gang)]) }
|
if (src.gang) { parts.push([`Gang:`, <Money money={src.gang} />]) }
|
||||||
if (src.hacking) { parts.push([`Hacking:`, Money(src.hacking)]) }
|
if (src.hacking) { parts.push([`Hacking:`, <Money money={src.hacking} />]) }
|
||||||
if (src.hacknetnode) { parts.push([`Hacknet Nodes:`, Money(src.hacknetnode)]) }
|
if (src.hacknetnode) { parts.push([`Hacknet Nodes:`, <Money money={src.hacknetnode} />]) }
|
||||||
if (src.hospitalization) { parts.push([`Hospitalization:`, Money(src.hospitalization)]) }
|
if (src.hospitalization) { parts.push([`Hospitalization:`, <Money money={src.hospitalization} />]) }
|
||||||
if (src.infiltration) { parts.push([`Infiltration:`, Money(src.infiltration)]) }
|
if (src.infiltration) { parts.push([`Infiltration:`, <Money money={src.infiltration} />]) }
|
||||||
if (src.stock) { parts.push([`Stock Market:`, Money(src.stock)]) }
|
if (src.stock) { parts.push([`Stock Market:`, <Money money={src.stock} />]) }
|
||||||
if (src.casino) { parts.push([`Casino:`, Money(src.casino)]) }
|
if (src.casino) { parts.push([`Casino:`, <Money money={src.casino} />]) }
|
||||||
if (src.sleeves) { parts.push([`Sleeves:`, Money(src.sleeves)]) }
|
if (src.sleeves) { parts.push([`Sleeves:`, <Money money={src.sleeves} />]) }
|
||||||
|
|
||||||
return StatsTable(parts);
|
return StatsTable(parts);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,16 @@
|
|||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { numeralWrapper } from "../../ui/numeralFormat";
|
import { numeralWrapper } from "../../ui/numeralFormat";
|
||||||
|
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||||
|
|
||||||
export function Money(money: number | string): JSX.Element {
|
interface IProps {
|
||||||
return <span className={"money-gold samefont"}>{typeof money === 'number' ? numeralWrapper.formatMoney(money) : money}</span>
|
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 <span className={"unbuyable samefont"}>{numeralWrapper.formatMoney(props.money)}</span>
|
||||||
|
}
|
||||||
|
return <span className={"money-gold samefont"}>{typeof props.money === 'number' ? numeralWrapper.formatMoney(props.money) : props.money}</span>
|
||||||
}
|
}
|
@ -1,6 +1,7 @@
|
|||||||
|
import React from 'react';
|
||||||
import { numeralWrapper } from "../../ui/numeralFormat";
|
import { numeralWrapper } from "../../ui/numeralFormat";
|
||||||
import { Money } from "../../ui/React/Money";
|
import { Money } from "../../ui/React/Money";
|
||||||
|
|
||||||
export function MoneyRate(money: number): JSX.Element {
|
export function MoneyRate(money: number): JSX.Element {
|
||||||
return Money(`${numeralWrapper.formatMoney(money)} / sec`);
|
return <Money money={`${numeralWrapper.formatMoney(money)} / sec`} />;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user