mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-17 06:48:42 +02:00
format & lint
This commit is contained in:
@@ -153,10 +153,7 @@ export function getMaxNumberRamUpgrades(nodeObj: HacknetNode | HacknetServer, ma
|
||||
}
|
||||
|
||||
// Calculate the maximum number of times the Player can afford to upgrade a Hacknet Node's cores
|
||||
export function getMaxNumberCoreUpgrades(
|
||||
nodeObj: HacknetNode | HacknetServer,
|
||||
maxLevel: number,
|
||||
): number {
|
||||
export function getMaxNumberCoreUpgrades(nodeObj: HacknetNode | HacknetServer, maxLevel: number): number {
|
||||
if (maxLevel == null) {
|
||||
throw new Error(`getMaxNumberCoreUpgrades() called without maxLevel arg`);
|
||||
}
|
||||
|
||||
@@ -77,9 +77,7 @@ export function HacknetNodeElem(props: IProps): React.ReactElement {
|
||||
}
|
||||
function upgradeLevelOnClick(): void {
|
||||
const numUpgrades =
|
||||
purchaseMult === "MAX"
|
||||
? getMaxNumberLevelUpgrades(node, HacknetNodeConstants.MaxLevel)
|
||||
: purchaseMult;
|
||||
purchaseMult === "MAX" ? getMaxNumberLevelUpgrades(node, HacknetNodeConstants.MaxLevel) : purchaseMult;
|
||||
purchaseLevelUpgrade(node, numUpgrades);
|
||||
rerender();
|
||||
}
|
||||
@@ -128,9 +126,7 @@ export function HacknetNodeElem(props: IProps): React.ReactElement {
|
||||
|
||||
function upgradeCoresOnClick(): void {
|
||||
const numUpgrades =
|
||||
purchaseMult === "MAX"
|
||||
? getMaxNumberCoreUpgrades(node, HacknetNodeConstants.MaxCores)
|
||||
: purchaseMult;
|
||||
purchaseMult === "MAX" ? getMaxNumberCoreUpgrades(node, HacknetNodeConstants.MaxCores) : purchaseMult;
|
||||
purchaseCoreUpgrade(node, numUpgrades);
|
||||
rerender();
|
||||
}
|
||||
|
||||
@@ -60,13 +60,8 @@ export function HacknetServerElem(props: IProps): React.ReactElement {
|
||||
}
|
||||
|
||||
const base_increase =
|
||||
calculateHashGainRate(
|
||||
node.level + multiplier,
|
||||
0,
|
||||
node.maxRam,
|
||||
node.cores,
|
||||
Player.mults.hacknet_node_money,
|
||||
) - calculateHashGainRate(node.level, 0, node.maxRam, node.cores, Player.mults.hacknet_node_money);
|
||||
calculateHashGainRate(node.level + multiplier, 0, node.maxRam, node.cores, Player.mults.hacknet_node_money) -
|
||||
calculateHashGainRate(node.level, 0, node.maxRam, node.cores, Player.mults.hacknet_node_money);
|
||||
const modded_increase = (base_increase * (node.maxRam - node.ramUsed)) / node.maxRam;
|
||||
|
||||
const upgradeLevelCost = node.calculateLevelUpgradeCost(multiplier, Player.mults.hacknet_node_level_cost);
|
||||
@@ -136,8 +131,7 @@ export function HacknetServerElem(props: IProps): React.ReactElement {
|
||||
node.maxRam * Math.pow(2, multiplier),
|
||||
node.cores,
|
||||
Player.mults.hacknet_node_money,
|
||||
) -
|
||||
calculateHashGainRate(node.level, node.ramUsed, node.maxRam, node.cores, Player.mults.hacknet_node_money);
|
||||
) - calculateHashGainRate(node.level, node.ramUsed, node.maxRam, node.cores, Player.mults.hacknet_node_money);
|
||||
|
||||
const upgradeRamCost = node.calculateRamUpgradeCost(multiplier, Player.mults.hacknet_node_ram_cost);
|
||||
upgradeRamButton = (
|
||||
@@ -183,13 +177,8 @@ export function HacknetServerElem(props: IProps): React.ReactElement {
|
||||
}
|
||||
|
||||
const base_increase =
|
||||
calculateHashGainRate(
|
||||
node.level,
|
||||
0,
|
||||
node.maxRam,
|
||||
node.cores + multiplier,
|
||||
Player.mults.hacknet_node_money,
|
||||
) - calculateHashGainRate(node.level, 0, node.maxRam, node.cores, Player.mults.hacknet_node_money);
|
||||
calculateHashGainRate(node.level, 0, node.maxRam, node.cores + multiplier, Player.mults.hacknet_node_money) -
|
||||
calculateHashGainRate(node.level, 0, node.maxRam, node.cores, Player.mults.hacknet_node_money);
|
||||
const modded_increase = (base_increase * (node.maxRam - node.ramUsed)) / node.maxRam;
|
||||
|
||||
const upgradeCoreCost = node.calculateCoreUpgradeCost(multiplier, Player.mults.hacknet_node_core_cost);
|
||||
|
||||
Reference in New Issue
Block a user