mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-18 05:33:54 +01:00
fix corp softcap
This commit is contained in:
parent
88b4a7d862
commit
eb6f016ac1
32
dist/vendor.bundle.js
vendored
32
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
@ -32,6 +32,7 @@ export function StartButton(props: IProps): React.ReactElement {
|
||||
if (disabled) return;
|
||||
props.bladeburner.action.type = props.type;
|
||||
props.bladeburner.action.name = props.name;
|
||||
player.singularityStopWork();
|
||||
props.bladeburner.startAction(player, props.bladeburner.action);
|
||||
props.rerender();
|
||||
}
|
||||
|
@ -127,14 +127,7 @@ function getRandomReward(): ICodingContractReward {
|
||||
reward.type = sanitizeRewardType(reward.type);
|
||||
|
||||
// Add additional information based on the reward type
|
||||
const factionsThatAllowHacking = Player.factions.filter((fac) => {
|
||||
try {
|
||||
return Factions[fac].getInfo().offerHackingWork;
|
||||
} catch (e) {
|
||||
console.error(`Error when trying to filter Hacking Factions for Coding Contract Generation: ${e}`);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
const factionsThatAllowHacking = Player.factions.filter((fac) => Factions[fac].getInfo().offerHackingWork);
|
||||
|
||||
switch (reward.type) {
|
||||
case CodingContractRewardType.FactionReputation: {
|
||||
|
@ -152,7 +152,7 @@ export class Corporation {
|
||||
const totalDividends = (this.dividendPercentage / 100) * cycleProfit;
|
||||
const dividendsPerShare = totalDividends / this.totalShares;
|
||||
const dividends = this.numShares * dividendsPerShare * (1 - this.dividendTaxPercentage / 100);
|
||||
return Math.pow(dividends, BitNodeMultipliers.CorporationSoftcap);
|
||||
return Math.pow(dividends, BitNodeMultipliers.CorporationSoftCap);
|
||||
}
|
||||
|
||||
determineValuation(): number {
|
||||
|
@ -47,6 +47,11 @@ function Upgrade({ n, division }: INodeProps): React.ReactElement {
|
||||
);
|
||||
}
|
||||
|
||||
let color: "primary" | "info" = "primary";
|
||||
if (n.researched) {
|
||||
color = "info";
|
||||
}
|
||||
|
||||
const but = (
|
||||
<Box>
|
||||
<Tooltip
|
||||
@ -59,7 +64,7 @@ function Upgrade({ n, division }: INodeProps): React.ReactElement {
|
||||
}
|
||||
>
|
||||
<span>
|
||||
<Button disabled={disabled} onClick={research}>
|
||||
<Button color={color} disabled={disabled && !n.researched} onClick={research}>
|
||||
{n.text}
|
||||
</Button>
|
||||
</span>
|
||||
|
@ -50,7 +50,7 @@ export function purchaseHacknet(player: IPlayer): number {
|
||||
if (!player.canAfford(cost)) {
|
||||
return -1;
|
||||
}
|
||||
player.loseMoney(cost, "hacknet");
|
||||
player.loseMoney(cost, "hacknet_expenses");
|
||||
player.createHacknetServer();
|
||||
updateHashManagerCapacity(player);
|
||||
|
||||
@ -69,7 +69,7 @@ export function purchaseHacknet(player: IPlayer): number {
|
||||
const name = "hacknet-node-" + numOwned;
|
||||
const node = new HacknetNode(name, player.hacknet_node_money_mult);
|
||||
|
||||
player.loseMoney(cost, "hacknet");
|
||||
player.loseMoney(cost, "hacknet_expenses");
|
||||
player.hacknetNodes.push(node);
|
||||
|
||||
return numOwned;
|
||||
@ -266,7 +266,7 @@ export function purchaseLevelUpgrade(player: IPlayer, node: HacknetNode | Hackne
|
||||
return false;
|
||||
}
|
||||
|
||||
player.loseMoney(cost, "hacknet");
|
||||
player.loseMoney(cost, "hacknet_expenses");
|
||||
node.upgradeLevel(sanitizedLevels, player.hacknet_node_money_mult);
|
||||
|
||||
return true;
|
||||
@ -305,7 +305,7 @@ export function purchaseRamUpgrade(player: IPlayer, node: HacknetNode | HacknetS
|
||||
return false;
|
||||
}
|
||||
|
||||
player.loseMoney(cost, "hacknet");
|
||||
player.loseMoney(cost, "hacknet_expenses");
|
||||
node.upgradeRam(sanitizedLevels, player.hacknet_node_money_mult);
|
||||
|
||||
return true;
|
||||
@ -336,7 +336,7 @@ export function purchaseCoreUpgrade(player: IPlayer, node: HacknetNode | Hacknet
|
||||
return false;
|
||||
}
|
||||
|
||||
player.loseMoney(cost, "hacknet");
|
||||
player.loseMoney(cost, "hacknet_expenses");
|
||||
node.upgradeCore(sanitizedLevels, player.hacknet_node_money_mult);
|
||||
|
||||
return true;
|
||||
@ -364,7 +364,7 @@ export function purchaseCacheUpgrade(player: IPlayer, node: HacknetServer, level
|
||||
return false;
|
||||
}
|
||||
|
||||
player.loseMoney(cost, "hacknet");
|
||||
player.loseMoney(cost, "hacknet_expenses");
|
||||
node.upgradeCache(sanitizedLevels);
|
||||
|
||||
return true;
|
||||
|
@ -32,6 +32,7 @@ import { sprintf } from "sprintf-js";
|
||||
|
||||
import { parse } from "acorn";
|
||||
import { simple as walksimple } from "acorn-walk";
|
||||
import { areFilesEqual } from "./Terminal/DirectoryHelpers";
|
||||
|
||||
// Netscript Ports are instantiated here
|
||||
export const NetscriptPorts: IPort[] = [];
|
||||
@ -676,38 +677,38 @@ export function runScriptFromScript(
|
||||
|
||||
// Check if the script exists and if it does run it
|
||||
for (let i = 0; i < server.scripts.length; ++i) {
|
||||
if (server.scripts[i].filename === scriptname) {
|
||||
// Check for admin rights and that there is enough RAM availble to run
|
||||
const script = server.scripts[i];
|
||||
let ramUsage = script.ramUsage;
|
||||
threads = Math.round(Number(threads));
|
||||
if (threads === 0) {
|
||||
return 0;
|
||||
}
|
||||
ramUsage = ramUsage * threads;
|
||||
const ramAvailable = server.maxRam - server.ramUsed;
|
||||
|
||||
if (server.hasAdminRights == false) {
|
||||
workerScript.log(caller, `You do not have root access on '${server.hostname}'`);
|
||||
return 0;
|
||||
} else if (ramUsage > ramAvailable) {
|
||||
workerScript.log(
|
||||
caller,
|
||||
`Cannot run script '${scriptname}' (t=${threads}) on '${server.hostname}' because there is not enough available RAM!`,
|
||||
);
|
||||
return 0;
|
||||
} else {
|
||||
// Able to run script
|
||||
workerScript.log(
|
||||
caller,
|
||||
`'${scriptname}' on '${server.hostname}' with ${threads} threads and args: ${arrayToString(args)}.`,
|
||||
);
|
||||
const runningScriptObj = new RunningScript(script, args);
|
||||
runningScriptObj.threads = threads;
|
||||
|
||||
return startWorkerScript(runningScriptObj, server, workerScript);
|
||||
}
|
||||
if (!areFilesEqual(server.scripts[i].filename, scriptname)) continue;
|
||||
// Check for admin rights and that there is enough RAM availble to run
|
||||
const script = server.scripts[i];
|
||||
let ramUsage = script.ramUsage;
|
||||
threads = Math.round(Number(threads));
|
||||
if (threads === 0) {
|
||||
return 0;
|
||||
}
|
||||
ramUsage = ramUsage * threads;
|
||||
const ramAvailable = server.maxRam - server.ramUsed;
|
||||
|
||||
if (server.hasAdminRights == false) {
|
||||
workerScript.log(caller, `You do not have root access on '${server.hostname}'`);
|
||||
return 0;
|
||||
} else if (ramUsage > ramAvailable) {
|
||||
workerScript.log(
|
||||
caller,
|
||||
`Cannot run script '${scriptname}' (t=${threads}) on '${server.hostname}' because there is not enough available RAM!`,
|
||||
);
|
||||
return 0;
|
||||
} else {
|
||||
// Able to run script
|
||||
workerScript.log(
|
||||
caller,
|
||||
`'${scriptname}' on '${server.hostname}' with ${threads} threads and args: ${arrayToString(args)}.`,
|
||||
);
|
||||
const runningScriptObj = new RunningScript(script, args);
|
||||
runningScriptObj.threads = threads;
|
||||
|
||||
return startWorkerScript(runningScriptObj, server, workerScript);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
workerScript.log(caller, `Could not find script '${scriptname}' on '${server.hostname}'`);
|
||||
|
@ -265,3 +265,9 @@ export function evaluateFilePath(path: string, currPath?: string): string | null
|
||||
|
||||
return "/" + reconstructedPath.join("/");
|
||||
}
|
||||
|
||||
export function areFilesEqual(f0: string, f1: string): boolean {
|
||||
if (!f0.startsWith("/")) f0 = "/" + f0;
|
||||
if (!f1.startsWith("/")) f1 = "/" + f1;
|
||||
return f0 === f1;
|
||||
}
|
||||
|
@ -200,6 +200,9 @@ function MoneyModal({ open, onClose }: IMoneyModalProps): React.ReactElement {
|
||||
if (src.hacknet) {
|
||||
parts.push([`Hacknet Nodes:`, <Money money={src.hacknet} />]);
|
||||
}
|
||||
if (src.hacknet_expenses) {
|
||||
parts.push([`Hacknet Nodes Expenses:`, <Money money={src.hacknet_expenses} />]);
|
||||
}
|
||||
if (src.hospitalization) {
|
||||
parts.push([`Hospitalization:`, <Money money={src.hospitalization} />]);
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ export class MoneySourceTracker {
|
||||
gang = 0;
|
||||
hacking = 0;
|
||||
hacknet = 0;
|
||||
hacknet_expenses = 0;
|
||||
hospitalization = 0;
|
||||
infiltration = 0;
|
||||
sleeves = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user