Update HacknetServerElem.tsx

Actually ran prettier this time.
Apparently fixed my lint install : no error, no warning.
This commit is contained in:
borisflagell 2022-04-21 19:20:16 +02:00
parent 4fa65322fe
commit a7045a2343

@ -60,17 +60,18 @@ export function HacknetServerElem(props: IProps): React.ReactElement {
multiplier = Math.min(levelsToMax, purchaseMult as number); multiplier = Math.min(levelsToMax, purchaseMult as number);
} }
const base_increase = calculateHashGainRate(node.level + multiplier, 0, node.maxRam, node.cores, props.player.hacknet_node_money_mult) const base_increase =
- calculateHashGainRate(node.level, 0, node.maxRam, node.cores, props.player.hacknet_node_money_mult); calculateHashGainRate(node.level + multiplier, 0, node.maxRam, node.cores, props.player.hacknet_node_money_mult) -
const modded_increase = base_increase * (node.maxRam - node.ramUsed) / node.maxRam; calculateHashGainRate(node.level, 0, node.maxRam, node.cores, props.player.hacknet_node_money_mult);
const modded_increase = (base_increase * (node.maxRam - node.ramUsed)) / node.maxRam;
const upgradeLevelCost = node.calculateLevelUpgradeCost(multiplier, props.player.hacknet_node_level_cost_mult); const upgradeLevelCost = node.calculateLevelUpgradeCost(multiplier, props.player.hacknet_node_level_cost_mult);
upgradeLevelButton = ( upgradeLevelButton = (
<Tooltip <Tooltip
title={ title={
<Typography> <Typography>
+<HashRate hashes={base_increase} /> (base increase, attained when no script is running) <br /> +<HashRate hashes={base_increase} /> (base increase, attained when no script is running) <br />
+<HashRate hashes={modded_increase} /> (effective increase, taking current RAM usage into account) +<HashRate hashes={modded_increase} /> (effective increase, taking current RAM usage into account)
</Typography> </Typography>
} }
> >
@ -118,28 +119,17 @@ export function HacknetServerElem(props: IProps): React.ReactElement {
node.maxRam * Math.pow(2, multiplier), node.maxRam * Math.pow(2, multiplier),
node.cores, node.cores,
props.player.hacknet_node_money_mult, props.player.hacknet_node_money_mult,
) - calculateHashGainRate( ) - calculateHashGainRate(node.level, 0, node.maxRam, node.cores, props.player.hacknet_node_money_mult);
node.level,
0,
node.maxRam,
node.cores,
props.player.hacknet_node_money_mult,
);
const modded_increase = const modded_increase =
calculateHashGainRate( calculateHashGainRate(
node.level, node.level,
node.ramUsed, node.ramUsed,
node.maxRam * Math.pow(2, multiplier), node.maxRam * Math.pow(2, multiplier),
node.cores, node.cores,
props.player.hacknet_node_money_mult, props.player.hacknet_node_money_mult,
) - calculateHashGainRate( ) -
node.level, calculateHashGainRate(node.level, node.ramUsed, node.maxRam, node.cores, props.player.hacknet_node_money_mult);
node.ramUsed,
node.maxRam,
node.cores,
props.player.hacknet_node_money_mult,
);
const upgradeRamCost = node.calculateRamUpgradeCost(multiplier, props.player.hacknet_node_ram_cost_mult); const upgradeRamCost = node.calculateRamUpgradeCost(multiplier, props.player.hacknet_node_ram_cost_mult);
upgradeRamButton = ( upgradeRamButton = (
@ -180,9 +170,10 @@ export function HacknetServerElem(props: IProps): React.ReactElement {
multiplier = Math.min(levelsToMax, purchaseMult as number); multiplier = Math.min(levelsToMax, purchaseMult as number);
} }
const base_increase = calculateHashGainRate(node.level, 0, node.maxRam, node.cores + multiplier, props.player.hacknet_node_money_mult) const base_increase =
- calculateHashGainRate(node.level, 0, node.maxRam, node.cores, props.player.hacknet_node_money_mult); calculateHashGainRate(node.level, 0, node.maxRam, node.cores + multiplier, props.player.hacknet_node_money_mult) -
const modded_increase = base_increase * (node.maxRam - node.ramUsed) / node.maxRam; calculateHashGainRate(node.level, 0, node.maxRam, node.cores, props.player.hacknet_node_money_mult);
const modded_increase = (base_increase * (node.maxRam - node.ramUsed)) / node.maxRam;
const upgradeCoreCost = node.calculateCoreUpgradeCost(multiplier, props.player.hacknet_node_core_cost_mult); const upgradeCoreCost = node.calculateCoreUpgradeCost(multiplier, props.player.hacknet_node_core_cost_mult);
upgradeCoresButton = ( upgradeCoresButton = (
@ -262,15 +253,19 @@ export function HacknetServerElem(props: IProps): React.ReactElement {
<Tooltip <Tooltip
title={ title={
<Typography> <Typography>
<Hashes hashes={node.totalHashesGenerated} /> hashes producted by this server since last augment installation. <Hashes hashes={node.totalHashesGenerated} /> hashes producted by this server since last augment
installation.
<br /> <br />
<HashRate hashes={node.hashRate} /> current production rate. <HashRate hashes={node.hashRate} /> current production rate.
<br /> <br />
<HashRate hashes={node.hashRate * node.maxRam / (node.maxRam - node.ramUsed)} /> max production rate. (achieved when 100% Ram is allocated to it) <HashRate hashes={(node.hashRate * node.maxRam) / (node.maxRam - node.ramUsed)} /> max production
rate. (achieved when 100% Ram is allocated to it)
<br /> <br />
{numeralWrapper.formatRAM(node.ramUsed)} / {numeralWrapper.formatRAM(node.maxRam)} ({Math.round(100 * node.ramUsed / node.maxRam)}%) Ram allocated to script. {numeralWrapper.formatRAM(node.ramUsed)} / {numeralWrapper.formatRAM(node.maxRam)} (
{Math.round((100 * node.ramUsed) / node.maxRam)}%) Ram allocated to script.
<br /> <br />
{numeralWrapper.formatRAM(node.maxRam - node.ramUsed)} / {numeralWrapper.formatRAM(node.maxRam)} ({Math.round(100 * (node.maxRam - node.ramUsed) / node.maxRam)}%) Ram allocated to hash production. {numeralWrapper.formatRAM(node.maxRam - node.ramUsed)} / {numeralWrapper.formatRAM(node.maxRam)} (
{Math.round((100 * (node.maxRam - node.ramUsed)) / node.maxRam)}%) Ram allocated to hash production.
</Typography> </Typography>
} }
> >