mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2025-02-17 10:23:44 +01:00
UI: FIX #2256 Hacknet server's upgrade tooltip were not handling RAM usage correctly.
Fix #2256 by using the correct formula to calculate the hashrate increase. Slightly revamp tooltip to display both theoric and effective increase. Add a discreet tooltip to the Production line which display details about hashrate and ram usage. Tested by running two script by intermittence on a loop on the hacknet server. Value displayed stay coherent all along.
This commit is contained in:
@ -60,15 +60,17 @@ export function HacknetServerElem(props: IProps): React.ReactElement {
|
|||||||
multiplier = Math.min(levelsToMax, purchaseMult as number);
|
multiplier = Math.min(levelsToMax, purchaseMult as number);
|
||||||
}
|
}
|
||||||
|
|
||||||
const increase =
|
const base_increase = calculateHashGainRate(node.level + multiplier, 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) -
|
- calculateHashGainRate(node.level, 0, node.maxRam, node.cores, props.player.hacknet_node_money_mult);
|
||||||
node.hashRate;
|
let 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={increase} />
|
+<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)
|
||||||
</Typography>
|
</Typography>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
@ -109,20 +111,43 @@ export function HacknetServerElem(props: IProps): React.ReactElement {
|
|||||||
multiplier = Math.min(levelsToMax, purchaseMult as number);
|
multiplier = Math.min(levelsToMax, purchaseMult as number);
|
||||||
}
|
}
|
||||||
|
|
||||||
const increase =
|
const base_increase =
|
||||||
calculateHashGainRate(
|
calculateHashGainRate(
|
||||||
node.level,
|
node.level,
|
||||||
0,
|
0,
|
||||||
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,
|
||||||
) - node.hashRate;
|
) - calculateHashGainRate(
|
||||||
|
node.level,
|
||||||
|
0,
|
||||||
|
node.maxRam,
|
||||||
|
node.cores,
|
||||||
|
props.player.hacknet_node_money_mult,
|
||||||
|
);
|
||||||
|
|
||||||
|
let modded_increase =
|
||||||
|
calculateHashGainRate(
|
||||||
|
node.level,
|
||||||
|
node.ramUsed,
|
||||||
|
node.maxRam * Math.pow(2, multiplier),
|
||||||
|
node.cores,
|
||||||
|
props.player.hacknet_node_money_mult,
|
||||||
|
) - calculateHashGainRate(
|
||||||
|
node.level,
|
||||||
|
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 = (
|
||||||
<Tooltip
|
<Tooltip
|
||||||
title={
|
title={
|
||||||
<Typography>
|
<Typography>
|
||||||
+<HashRate hashes={increase} />
|
+<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)
|
||||||
</Typography>
|
</Typography>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
@ -155,15 +180,17 @@ export function HacknetServerElem(props: IProps): React.ReactElement {
|
|||||||
multiplier = Math.min(levelsToMax, purchaseMult as number);
|
multiplier = Math.min(levelsToMax, purchaseMult as number);
|
||||||
}
|
}
|
||||||
|
|
||||||
const increase =
|
const base_increase = calculateHashGainRate(node.level, 0, node.maxRam, node.cores + multiplier, props.player.hacknet_node_money_mult)
|
||||||
calculateHashGainRate(node.level, 0, node.maxRam, node.cores + multiplier, props.player.hacknet_node_money_mult) -
|
- calculateHashGainRate(node.level, 0, node.maxRam, node.cores, props.player.hacknet_node_money_mult);
|
||||||
node.hashRate;
|
let 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 = (
|
||||||
<Tooltip
|
<Tooltip
|
||||||
title={
|
title={
|
||||||
<Typography>
|
<Typography>
|
||||||
+<HashRate hashes={increase} />
|
+<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)
|
||||||
</Typography>
|
</Typography>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
@ -232,9 +259,25 @@ export function HacknetServerElem(props: IProps): React.ReactElement {
|
|||||||
<Typography>Production:</Typography>
|
<Typography>Production:</Typography>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell colSpan={2}>
|
<TableCell colSpan={2}>
|
||||||
<Typography>
|
<Tooltip
|
||||||
<Hashes hashes={node.totalHashesGenerated} /> (<HashRate hashes={node.hashRate} />)
|
title={
|
||||||
</Typography>
|
<Typography>
|
||||||
|
<Hashes hashes={node.totalHashesGenerated} /> hashes producted by this server since last augment installation.
|
||||||
|
<br />
|
||||||
|
<HashRate hashes={node.hashRate} /> current production rate.
|
||||||
|
<br />
|
||||||
|
<HashRate hashes={node.hashRate * node.maxRam / (node.maxRam - node.ramUsed)} /> max production rate. (achieved when 100% Ram is allocated to it)
|
||||||
|
<br />
|
||||||
|
{numeralWrapper.formatRAM(node.ramUsed)} / {numeralWrapper.formatRAM(node.maxRam)} ({Math.round(100 * node.ramUsed / node.maxRam)}%) Ram allocated to script.
|
||||||
|
<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.
|
||||||
|
</Typography>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Typography>
|
||||||
|
<Hashes hashes={node.totalHashesGenerated} /> (<HashRate hashes={node.hashRate} />)
|
||||||
|
</Typography>
|
||||||
|
</Tooltip>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
<TableRow>
|
<TableRow>
|
||||||
|
Reference in New Issue
Block a user