mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-18 12:15:44 +01:00
plenty of bf
This commit is contained in:
parent
ded230eaaf
commit
ef781a0627
26
dist/vendor.bundle.js
vendored
26
dist/vendor.bundle.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -86,7 +86,7 @@ export function SellMaterial(mat: Material, amt: string, price: string): void {
|
||||
if (price === "") price = "0";
|
||||
if (amt === "") amt = "0";
|
||||
let cost = price.replace(/\s+/g, "");
|
||||
cost = cost.replace(/[^-()\d/*+.MP]/g, ""); //Sanitize cost
|
||||
cost = cost.replace(/[^-()\d/*+.MPe]/g, ""); //Sanitize cost
|
||||
let temp = cost.replace(/MP/g, mat.bCost + "");
|
||||
try {
|
||||
temp = eval(temp);
|
||||
|
@ -19,6 +19,7 @@ import {
|
||||
import { createRandomIp } from "../utils/IPAddress";
|
||||
|
||||
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../utils/JSONReviver";
|
||||
import { IPlayer } from "../PersonObjects/IPlayer";
|
||||
|
||||
interface IConstructorParams {
|
||||
adminRights?: boolean;
|
||||
@ -122,6 +123,11 @@ export class HacknetServer extends BaseServer implements IHacknetNode {
|
||||
}
|
||||
}
|
||||
|
||||
updateRamUsed(ram: number, player: IPlayer): void {
|
||||
super.updateRamUsed(ram, player);
|
||||
this.updateHashRate(player.hacknet_node_money_mult);
|
||||
}
|
||||
|
||||
updateHashCapacity(): void {
|
||||
this.hashCapacity = 32 * Math.pow(2, this.cache);
|
||||
}
|
||||
|
@ -28,7 +28,9 @@ import { TableCell } from "../../ui/React/Table";
|
||||
import TableBody from "@mui/material/TableBody";
|
||||
import Table from "@mui/material/Table";
|
||||
import TableRow from "@mui/material/TableRow";
|
||||
import Tooltip from "@mui/material/Tooltip";
|
||||
import { numeralWrapper } from "../../ui/numeralFormat";
|
||||
import { calculateMoneyGainRate } from "../formulas/HacknetNodes";
|
||||
|
||||
interface IProps {
|
||||
node: HacknetNode;
|
||||
@ -43,9 +45,9 @@ export function HacknetNodeElem(props: IProps): React.ReactElement {
|
||||
const rerender = props.rerender;
|
||||
|
||||
// Upgrade Level Button
|
||||
let upgradeLevelContent;
|
||||
let upgradeLevelButton;
|
||||
if (node.level >= HacknetNodeConstants.MaxLevel) {
|
||||
upgradeLevelContent = <>MAX LEVEL</>;
|
||||
upgradeLevelButton = <Button disabled>MAX LEVEL</Button>;
|
||||
} else {
|
||||
let multiplier = 0;
|
||||
if (purchaseMult === "MAX") {
|
||||
@ -55,12 +57,23 @@ export function HacknetNodeElem(props: IProps): React.ReactElement {
|
||||
multiplier = Math.min(levelsToMax, purchaseMult as number);
|
||||
}
|
||||
|
||||
const increase =
|
||||
calculateMoneyGainRate(node.level + multiplier, node.ram, node.cores, props.player.hacknet_node_money_mult) -
|
||||
node.moneyGainRatePerSecond;
|
||||
const upgradeLevelCost = node.calculateLevelUpgradeCost(multiplier, props.player.hacknet_node_level_cost_mult);
|
||||
upgradeLevelContent = (
|
||||
<>
|
||||
+{multiplier} -
|
||||
<Money money={upgradeLevelCost} player={props.player} />
|
||||
</>
|
||||
upgradeLevelButton = (
|
||||
<Tooltip
|
||||
title={
|
||||
<Typography>
|
||||
+<MoneyRate money={increase} />
|
||||
</Typography>
|
||||
}
|
||||
>
|
||||
<Button onClick={upgradeLevelOnClick}>
|
||||
+{multiplier} -
|
||||
<Money money={upgradeLevelCost} player={props.player} />
|
||||
</Button>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
function upgradeLevelOnClick(): void {
|
||||
@ -72,9 +85,9 @@ export function HacknetNodeElem(props: IProps): React.ReactElement {
|
||||
rerender();
|
||||
}
|
||||
|
||||
let upgradeRamContent;
|
||||
let upgradeRAMButton;
|
||||
if (node.ram >= HacknetNodeConstants.MaxRam) {
|
||||
upgradeRamContent = <>MAX RAM</>;
|
||||
upgradeRAMButton = <Button disabled>MAX RAM</Button>;
|
||||
} else {
|
||||
let multiplier = 0;
|
||||
if (purchaseMult === "MAX") {
|
||||
@ -84,12 +97,27 @@ export function HacknetNodeElem(props: IProps): React.ReactElement {
|
||||
multiplier = Math.min(levelsToMax, purchaseMult as number);
|
||||
}
|
||||
|
||||
const increase =
|
||||
calculateMoneyGainRate(
|
||||
node.level,
|
||||
node.ram * Math.pow(2, multiplier),
|
||||
node.cores,
|
||||
props.player.hacknet_node_money_mult,
|
||||
) - node.moneyGainRatePerSecond;
|
||||
const upgradeRamCost = node.calculateRamUpgradeCost(multiplier, props.player.hacknet_node_ram_cost_mult);
|
||||
upgradeRamContent = (
|
||||
<>
|
||||
+{multiplier} -
|
||||
<Money money={upgradeRamCost} player={props.player} />
|
||||
</>
|
||||
upgradeRAMButton = (
|
||||
<Tooltip
|
||||
title={
|
||||
<Typography>
|
||||
+<MoneyRate money={increase} />
|
||||
</Typography>
|
||||
}
|
||||
>
|
||||
<Button onClick={upgradeRamOnClick}>
|
||||
+{multiplier} -
|
||||
<Money money={upgradeRamCost} player={props.player} />
|
||||
</Button>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
function upgradeRamOnClick(): void {
|
||||
@ -99,9 +127,17 @@ export function HacknetNodeElem(props: IProps): React.ReactElement {
|
||||
rerender();
|
||||
}
|
||||
|
||||
let upgradeCoresContent;
|
||||
function upgradeCoresOnClick(): void {
|
||||
const numUpgrades =
|
||||
purchaseMult === "MAX"
|
||||
? getMaxNumberCoreUpgrades(props.player, node, HacknetNodeConstants.MaxCores)
|
||||
: purchaseMult;
|
||||
purchaseCoreUpgrade(props.player, node, numUpgrades);
|
||||
rerender();
|
||||
}
|
||||
let upgradeCoresButton;
|
||||
if (node.cores >= HacknetNodeConstants.MaxCores) {
|
||||
upgradeCoresContent = <>MAX CORES</>;
|
||||
upgradeCoresButton = <Button disabled>MAX CORES</Button>;
|
||||
} else {
|
||||
let multiplier = 0;
|
||||
if (purchaseMult === "MAX") {
|
||||
@ -111,22 +147,25 @@ export function HacknetNodeElem(props: IProps): React.ReactElement {
|
||||
multiplier = Math.min(levelsToMax, purchaseMult as number);
|
||||
}
|
||||
|
||||
const increase =
|
||||
calculateMoneyGainRate(node.level, node.ram, node.cores + multiplier, props.player.hacknet_node_money_mult) -
|
||||
node.moneyGainRatePerSecond;
|
||||
const upgradeCoreCost = node.calculateCoreUpgradeCost(multiplier, props.player.hacknet_node_core_cost_mult);
|
||||
upgradeCoresContent = (
|
||||
<>
|
||||
+{multiplier} -
|
||||
<Money money={upgradeCoreCost} player={props.player} />
|
||||
</>
|
||||
upgradeCoresButton = (
|
||||
<Tooltip
|
||||
title={
|
||||
<Typography>
|
||||
+<MoneyRate money={increase} />
|
||||
</Typography>
|
||||
}
|
||||
>
|
||||
<Button onClick={upgradeCoresOnClick}>
|
||||
+{multiplier} -
|
||||
<Money money={upgradeCoreCost} player={props.player} />
|
||||
</Button>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
function upgradeCoresOnClick(): void {
|
||||
const numUpgrades =
|
||||
purchaseMult === "MAX"
|
||||
? getMaxNumberCoreUpgrades(props.player, node, HacknetNodeConstants.MaxCores)
|
||||
: purchaseMult;
|
||||
purchaseCoreUpgrade(props.player, node, numUpgrades);
|
||||
rerender();
|
||||
}
|
||||
|
||||
return (
|
||||
<Grid item component={Paper} p={1}>
|
||||
@ -155,9 +194,7 @@ export function HacknetNodeElem(props: IProps): React.ReactElement {
|
||||
<TableCell>
|
||||
<Typography>{node.level}</Typography>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Button onClick={upgradeLevelOnClick}>{upgradeLevelContent}</Button>
|
||||
</TableCell>
|
||||
<TableCell>{upgradeLevelButton}</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableCell>
|
||||
@ -166,9 +203,7 @@ export function HacknetNodeElem(props: IProps): React.ReactElement {
|
||||
<TableCell>
|
||||
<Typography>{numeralWrapper.formatRAM(node.ram)}</Typography>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Button onClick={upgradeRamOnClick}>{upgradeRamContent}</Button>
|
||||
</TableCell>
|
||||
<TableCell>{upgradeRAMButton}</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableCell>
|
||||
@ -177,9 +212,7 @@ export function HacknetNodeElem(props: IProps): React.ReactElement {
|
||||
<TableCell>
|
||||
<Typography>{node.cores}</Typography>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Button onClick={upgradeCoresOnClick}>{upgradeCoresContent}</Button>
|
||||
</TableCell>
|
||||
<TableCell>{upgradeCoresButton}</TableCell>
|
||||
</TableRow>
|
||||
</TableBody>
|
||||
</Table>
|
||||
|
@ -32,6 +32,8 @@ import TableBody from "@mui/material/TableBody";
|
||||
import Table from "@mui/material/Table";
|
||||
import TableRow from "@mui/material/TableRow";
|
||||
import { numeralWrapper } from "../../ui/numeralFormat";
|
||||
import { calculateHashGainRate } from "../formulas/HacknetServers";
|
||||
import Tooltip from "@mui/material/Tooltip";
|
||||
|
||||
interface IProps {
|
||||
node: HacknetServer;
|
||||
@ -46,9 +48,9 @@ export function HacknetServerElem(props: IProps): React.ReactElement {
|
||||
const rerender = props.rerender;
|
||||
|
||||
// Upgrade Level Button
|
||||
let upgradeLevelContent;
|
||||
let upgradeLevelButton;
|
||||
if (node.level >= HacknetServerConstants.MaxLevel) {
|
||||
upgradeLevelContent = <>MAX LEVEL</>;
|
||||
upgradeLevelButton = <Button disabled>MAX LEVEL</Button>;
|
||||
} else {
|
||||
let multiplier = 0;
|
||||
if (purchaseMult === "MAX") {
|
||||
@ -58,12 +60,23 @@ export function HacknetServerElem(props: IProps): React.ReactElement {
|
||||
multiplier = Math.min(levelsToMax, purchaseMult as number);
|
||||
}
|
||||
|
||||
const increase =
|
||||
calculateHashGainRate(node.level + multiplier, 0, node.maxRam, node.cores, props.player.hacknet_node_money_mult) -
|
||||
node.hashRate;
|
||||
const upgradeLevelCost = node.calculateLevelUpgradeCost(multiplier, props.player.hacknet_node_level_cost_mult);
|
||||
upgradeLevelContent = (
|
||||
<>
|
||||
+{multiplier} -
|
||||
<Money money={upgradeLevelCost} player={props.player} />
|
||||
</>
|
||||
upgradeLevelButton = (
|
||||
<Tooltip
|
||||
title={
|
||||
<Typography>
|
||||
+<HashRate hashes={increase} />
|
||||
</Typography>
|
||||
}
|
||||
>
|
||||
<Button onClick={upgradeLevelOnClick}>
|
||||
+{multiplier} -
|
||||
<Money money={upgradeLevelCost} player={props.player} />
|
||||
</Button>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
function upgradeLevelOnClick(): void {
|
||||
@ -75,10 +88,18 @@ export function HacknetServerElem(props: IProps): React.ReactElement {
|
||||
rerender();
|
||||
}
|
||||
|
||||
function upgradeRamOnClick(): void {
|
||||
let numUpgrades = purchaseMult;
|
||||
if (purchaseMult === "MAX") {
|
||||
numUpgrades = getMaxNumberRamUpgrades(props.player, node, HacknetServerConstants.MaxRam);
|
||||
}
|
||||
purchaseRamUpgrade(props.player, node, numUpgrades as number);
|
||||
rerender();
|
||||
}
|
||||
// Upgrade RAM Button
|
||||
let upgradeRamContent;
|
||||
let upgradeRamButton;
|
||||
if (node.maxRam >= HacknetServerConstants.MaxRam) {
|
||||
upgradeRamContent = <>MAX RAM</>;
|
||||
upgradeRamButton = <Button disabled>MAX RAM</Button>;
|
||||
} else {
|
||||
let multiplier = 0;
|
||||
if (purchaseMult === "MAX") {
|
||||
@ -88,27 +109,43 @@ export function HacknetServerElem(props: IProps): React.ReactElement {
|
||||
multiplier = Math.min(levelsToMax, purchaseMult as number);
|
||||
}
|
||||
|
||||
const increase =
|
||||
calculateHashGainRate(
|
||||
node.level,
|
||||
0,
|
||||
node.maxRam * Math.pow(2, multiplier),
|
||||
node.cores,
|
||||
props.player.hacknet_node_money_mult,
|
||||
) - node.hashRate;
|
||||
const upgradeRamCost = node.calculateRamUpgradeCost(multiplier, props.player.hacknet_node_ram_cost_mult);
|
||||
upgradeRamContent = (
|
||||
<>
|
||||
+{multiplier} -
|
||||
<Money money={upgradeRamCost} player={props.player} />
|
||||
</>
|
||||
upgradeRamButton = (
|
||||
<Tooltip
|
||||
title={
|
||||
<Typography>
|
||||
+<HashRate hashes={increase} />
|
||||
</Typography>
|
||||
}
|
||||
>
|
||||
<Button onClick={upgradeRamOnClick}>
|
||||
+{multiplier} -
|
||||
<Money money={upgradeRamCost} player={props.player} />
|
||||
</Button>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
function upgradeRamOnClick(): void {
|
||||
|
||||
function upgradeCoresOnClick(): void {
|
||||
let numUpgrades = purchaseMult;
|
||||
if (purchaseMult === "MAX") {
|
||||
numUpgrades = getMaxNumberRamUpgrades(props.player, node, HacknetServerConstants.MaxRam);
|
||||
numUpgrades = getMaxNumberCoreUpgrades(props.player, node, HacknetServerConstants.MaxCores);
|
||||
}
|
||||
purchaseRamUpgrade(props.player, node, numUpgrades as number);
|
||||
purchaseCoreUpgrade(props.player, node, numUpgrades as number);
|
||||
rerender();
|
||||
}
|
||||
|
||||
// Upgrade Cores Button
|
||||
let upgradeCoresContent;
|
||||
let upgradeCoresButton;
|
||||
if (node.cores >= HacknetServerConstants.MaxCores) {
|
||||
upgradeCoresContent = <>MAX CORES</>;
|
||||
upgradeCoresButton = <Button disabled>MAX CORES</Button>;
|
||||
} else {
|
||||
let multiplier = 0;
|
||||
if (purchaseMult === "MAX") {
|
||||
@ -118,27 +155,30 @@ export function HacknetServerElem(props: IProps): React.ReactElement {
|
||||
multiplier = Math.min(levelsToMax, purchaseMult as number);
|
||||
}
|
||||
|
||||
const increase =
|
||||
calculateHashGainRate(node.level, 0, node.maxRam, node.cores + multiplier, props.player.hacknet_node_money_mult) -
|
||||
node.hashRate;
|
||||
const upgradeCoreCost = node.calculateCoreUpgradeCost(multiplier, props.player.hacknet_node_core_cost_mult);
|
||||
upgradeCoresContent = (
|
||||
<>
|
||||
+{multiplier} -
|
||||
<Money money={upgradeCoreCost} player={props.player} />
|
||||
</>
|
||||
upgradeCoresButton = (
|
||||
<Tooltip
|
||||
title={
|
||||
<Typography>
|
||||
+<HashRate hashes={increase} />
|
||||
</Typography>
|
||||
}
|
||||
>
|
||||
<Button onClick={upgradeCoresOnClick}>
|
||||
+{multiplier} -
|
||||
<Money money={upgradeCoreCost} player={props.player} />
|
||||
</Button>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
function upgradeCoresOnClick(): void {
|
||||
let numUpgrades = purchaseMult;
|
||||
if (purchaseMult === "MAX") {
|
||||
numUpgrades = getMaxNumberCoreUpgrades(props.player, node, HacknetServerConstants.MaxCores);
|
||||
}
|
||||
purchaseCoreUpgrade(props.player, node, numUpgrades as number);
|
||||
rerender();
|
||||
}
|
||||
|
||||
// Upgrade Cache button
|
||||
let upgradeCacheContent;
|
||||
let upgradeCacheButton;
|
||||
if (node.cache >= HacknetServerConstants.MaxCache) {
|
||||
upgradeCacheContent = <>MAX CACHE</>;
|
||||
upgradeCacheButton = <Button disabled>MAX CACHE</Button>;
|
||||
} else {
|
||||
let multiplier = 0;
|
||||
if (purchaseMult === "MAX") {
|
||||
@ -149,11 +189,19 @@ export function HacknetServerElem(props: IProps): React.ReactElement {
|
||||
}
|
||||
|
||||
const upgradeCacheCost = node.calculateCacheUpgradeCost(multiplier);
|
||||
upgradeCacheContent = (
|
||||
<>
|
||||
+{multiplier} -
|
||||
<Money money={upgradeCacheCost} player={props.player} />
|
||||
</>
|
||||
upgradeCacheButton = (
|
||||
<Tooltip
|
||||
title={
|
||||
<Typography>
|
||||
+<Hashes hashes={32 * Math.pow(2, node.cache)} /> hashes
|
||||
</Typography>
|
||||
}
|
||||
>
|
||||
<Button onClick={upgradeCacheOnClick}>
|
||||
+{multiplier} -
|
||||
<Money money={upgradeCacheCost} player={props.player} />
|
||||
</Button>
|
||||
</Tooltip>
|
||||
);
|
||||
if (props.player.money < upgradeCacheCost) {
|
||||
} else {
|
||||
@ -205,9 +253,7 @@ export function HacknetServerElem(props: IProps): React.ReactElement {
|
||||
<TableCell>
|
||||
<Typography>{node.level}</Typography>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Button onClick={upgradeLevelOnClick}>{upgradeLevelContent}</Button>
|
||||
</TableCell>
|
||||
<TableCell>{upgradeLevelButton}</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableCell>
|
||||
@ -216,9 +262,7 @@ export function HacknetServerElem(props: IProps): React.ReactElement {
|
||||
<TableCell>
|
||||
<Typography>{numeralWrapper.formatRAM(node.maxRam)}</Typography>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Button onClick={upgradeRamOnClick}>{upgradeRamContent}</Button>
|
||||
</TableCell>
|
||||
<TableCell>{upgradeRamButton}</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableCell>
|
||||
@ -227,9 +271,7 @@ export function HacknetServerElem(props: IProps): React.ReactElement {
|
||||
<TableCell>
|
||||
<Typography>{node.cores}</Typography>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Button onClick={upgradeCoresOnClick}>{upgradeCoresContent}</Button>
|
||||
</TableCell>
|
||||
<TableCell>{upgradeCoresButton}</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableCell>
|
||||
@ -238,9 +280,7 @@ export function HacknetServerElem(props: IProps): React.ReactElement {
|
||||
<TableCell>
|
||||
<Typography>{node.cache}</Typography>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Button onClick={upgradeCacheOnClick}>{upgradeCacheContent}</Button>
|
||||
</TableCell>
|
||||
<TableCell>{upgradeCacheButton}</TableCell>
|
||||
</TableRow>
|
||||
</TableBody>
|
||||
</Table>
|
||||
|
@ -12,6 +12,7 @@ import { GetServer } from "../Server/AllServers";
|
||||
import { compareArrays } from "../utils/helpers/compareArrays";
|
||||
import { dialogBoxCreate } from "../ui/React/DialogBox";
|
||||
import { AddRecentScript } from "./RecentScripts";
|
||||
import { Player } from "../Player";
|
||||
|
||||
export function killWorkerScript(runningScriptObj: RunningScript, hostname: string, rerenderUi?: boolean): boolean;
|
||||
export function killWorkerScript(workerScript: WorkerScript): boolean;
|
||||
@ -110,8 +111,9 @@ function removeWorkerScript(workerScript: WorkerScript, rerenderUi = true): void
|
||||
}
|
||||
|
||||
// Recalculate ram used on that server
|
||||
server.ramUsed = 0;
|
||||
for (const rs of server.runningScripts) server.ramUsed += rs.ramUsage * rs.threads;
|
||||
|
||||
server.updateRamUsed(0, Player);
|
||||
for (const rs of server.runningScripts) server.updateRamUsed(server.ramUsed + rs.ramUsage * rs.threads, Player);
|
||||
|
||||
// Delete script from global pool (workerScripts)
|
||||
const res = workerScripts.delete(workerScript.pid);
|
||||
|
@ -33,6 +33,7 @@ import { sprintf } from "sprintf-js";
|
||||
import { parse } from "acorn";
|
||||
import { simple as walksimple } from "acorn-walk";
|
||||
import { areFilesEqual } from "./Terminal/DirectoryHelpers";
|
||||
import { Player } from "./Player";
|
||||
|
||||
// Netscript Ports are instantiated here
|
||||
export const NetscriptPorts: IPort[] = [];
|
||||
@ -490,7 +491,8 @@ function createAndAddWorkerScript(runningScriptObj: RunningScript, server: BaseS
|
||||
);
|
||||
return false;
|
||||
}
|
||||
server.ramUsed = roundToTwo(server.ramUsed + ramUsage);
|
||||
|
||||
server.updateRamUsed(roundToTwo(server.ramUsed + ramUsage), Player);
|
||||
|
||||
// Get the pid
|
||||
const pid = generateNextPid();
|
||||
|
@ -854,7 +854,7 @@ export function startFactionHackWork(this: IPlayer, router: IRouter, faction: Fa
|
||||
this.resetWorkStatus(CONSTANTS.WorkTypeFaction, faction.name, CONSTANTS.FactionWorkHacking);
|
||||
|
||||
this.workHackExpGainRate = 0.15 * this.hacking_exp_mult * BitNodeMultipliers.FactionWorkExpGain;
|
||||
this.workRepGainRate = getFactionFieldWorkRepGain(this, faction);
|
||||
this.workRepGainRate = getHackingWorkRepGain(this, faction);
|
||||
|
||||
this.factionWorkType = CONSTANTS.FactionWorkHacking;
|
||||
this.currentWorkFactionDescription = "carrying out hacking contracts";
|
||||
@ -872,6 +872,7 @@ export function startFactionFieldWork(this: IPlayer, router: IRouter, faction: F
|
||||
this.workAgiExpGainRate = 0.1 * this.agility_exp_mult * BitNodeMultipliers.FactionWorkExpGain;
|
||||
this.workChaExpGainRate = 0.1 * this.charisma_exp_mult * BitNodeMultipliers.FactionWorkExpGain;
|
||||
this.workRepGainRate = getFactionFieldWorkRepGain(this, faction);
|
||||
console.log(this.workRepGainRate);
|
||||
|
||||
this.factionWorkType = CONSTANTS.FactionWorkField;
|
||||
this.currentWorkFactionDescription = "carrying out field missions";
|
||||
@ -906,6 +907,7 @@ export function workForFaction(this: IPlayer, numCycles: number): boolean {
|
||||
break;
|
||||
case CONSTANTS.FactionWorkField:
|
||||
this.workRepGainRate = getFactionFieldWorkRepGain(this, faction);
|
||||
console.log(this.workRepGainRate);
|
||||
break;
|
||||
case CONSTANTS.FactionWorkSecurity:
|
||||
this.workRepGainRate = getFactionSecurityWorkRepGain(this, faction);
|
||||
@ -913,6 +915,12 @@ export function workForFaction(this: IPlayer, numCycles: number): boolean {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
let favorMult = 1 + faction.favor / 100;
|
||||
if (isNaN(favorMult)) {
|
||||
favorMult = 1;
|
||||
}
|
||||
this.workRepGainRate *= favorMult;
|
||||
this.workRepGainRate *= BitNodeMultipliers.FactionWorkRepGain;
|
||||
|
||||
//Cap the number of cycles being processed to whatever would put you at limit (20 hours)
|
||||
let overMax = false;
|
||||
|
4
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
4
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@ -1992,7 +1992,7 @@ export interface Singularity {
|
||||
*
|
||||
* @returns True if the installation was successful.
|
||||
*/
|
||||
installBackdoor(): Promise<boolean>;
|
||||
installBackdoor(): Promise<void>;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3607,7 +3607,7 @@ export interface NS extends Singularity {
|
||||
* @param growthAmount - Multiplicative factor by which the server is grown. Decimal form..
|
||||
* @returns The amount of grow calls needed to grow the specified server by the specified amount
|
||||
*/
|
||||
growthAnalyze(host: string, growthAmount: number): number;
|
||||
growthAnalyze(host: string, growthAmount: number, cores?: number): number;
|
||||
|
||||
/**
|
||||
* Calculate the security increase for a number of thread.
|
||||
|
@ -12,6 +12,7 @@ import { isScriptFilename } from "../Script/isScriptFilename";
|
||||
|
||||
import { createRandomIp } from "../utils/IPAddress";
|
||||
import { compareArrays } from "../utils/helpers/compareArrays";
|
||||
import { IPlayer } from "../PersonObjects/IPlayer";
|
||||
|
||||
interface IConstructorParams {
|
||||
adminRights?: boolean;
|
||||
@ -245,6 +246,10 @@ export class BaseServer {
|
||||
this.maxRam = ram;
|
||||
}
|
||||
|
||||
updateRamUsed(ram: number, player: IPlayer): void {
|
||||
this.ramUsed = ram;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write to a script file
|
||||
* Overwrites existing files. Creates new files if the script does not eixst
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { evaluateDirectoryPath, getAllParentDirectories } from "./DirectoryHelpers";
|
||||
import { getSubdirectories } from "./DirectoryServerHelpers";
|
||||
|
||||
import { Aliases, GlobalAliases } from "../Alias";
|
||||
import { Aliases, GlobalAliases, substituteAliases } from "../Alias";
|
||||
import { DarkWebItems } from "../DarkWeb/DarkWebItems";
|
||||
import { IPlayer } from "../PersonObjects/IPlayer";
|
||||
import { GetServer, GetAllServers } from "../Server/AllServers";
|
||||
@ -58,6 +58,7 @@ export async function determineAllPossibilitiesForTabCompletion(
|
||||
index: number,
|
||||
currPath = "",
|
||||
): Promise<string[]> {
|
||||
input = substituteAliases(input);
|
||||
let allPos: string[] = [];
|
||||
allPos = allPos.concat(Object.keys(GlobalAliases));
|
||||
const currServ = p.getCurrentServer();
|
||||
|
@ -3,5 +3,5 @@ import { numeralWrapper } from "../../ui/numeralFormat";
|
||||
import { Hashes } from "../../ui/React/Hashes";
|
||||
|
||||
export function HashRate({ hashes }: { hashes: number }): React.ReactElement {
|
||||
return <Hashes hashes={`${numeralWrapper.formatHashes(hashes)} / sec`} />;
|
||||
return <Hashes hashes={`${numeralWrapper.formatHashes(hashes)} h / s`} />;
|
||||
}
|
||||
|
@ -43,6 +43,7 @@ export function WorkInProgressRoot(): React.ReactElement {
|
||||
router.toFaction(faction);
|
||||
player.stopFocusing();
|
||||
}
|
||||
console.log(`${player.currentWorkFactionName} ${player.workRepGainRate}`);
|
||||
return (
|
||||
<Grid container direction="column" justifyContent="center" alignItems="center" style={{ minHeight: "100vh" }}>
|
||||
<Grid item>
|
||||
|
Loading…
Reference in New Issue
Block a user