BUGFIX: BitVerse does not show all BN multipliers in some cases (#2045)

This commit is contained in:
catloversg
2025-05-11 12:40:28 +07:00
committed by GitHub
parent 3a6f85d684
commit b1b560b6c6
7 changed files with 43 additions and 24 deletions
@@ -25,11 +25,14 @@ import { canAccessBitNodeFeature } from "../BitNodeUtils";
interface IProps {
n: number;
level?: number;
hideMultsIfCannotAccessFeature: boolean;
}
export function BitnodeMultiplierDescription({ n, level }: IProps): React.ReactElement {
export function BitNodeMultiplierDescription({ n, level, hideMultsIfCannotAccessFeature }: IProps): React.ReactElement {
const [open, setOpen] = React.useState(false);
if (n === 1) return <></>;
if (n === 1) {
return <></>;
}
return (
<Box component={Paper} sx={{ mt: 1, p: 1 }}>
@@ -38,13 +41,17 @@ export function BitnodeMultiplierDescription({ n, level }: IProps): React.ReactE
{open ? <ExpandLess color="primary" /> : <ExpandMore color="primary" />}
</ListItemButton>
<Collapse in={open}>
<BitNodeMultipliersDisplay n={n} level={level} />
<BitNodeMultipliersDisplay
n={n}
level={level}
hideMultsIfCannotAccessFeature={hideMultsIfCannotAccessFeature}
/>
</Collapse>
</Box>
);
}
export const BitNodeMultipliersDisplay = ({ n, level }: IProps): React.ReactElement => {
export const BitNodeMultipliersDisplay = ({ n, level, hideMultsIfCannotAccessFeature }: IProps): React.ReactElement => {
// If a level argument has been provided, use that as the multiplier level
// If not, then we have to assume that we want the next level up from the
// current node's source file, so we get the min of that, the SF's max level,
@@ -64,10 +71,10 @@ export const BitNodeMultipliersDisplay = ({ n, level }: IProps): React.ReactElem
<CrimeMults n={n} mults={mults} />
<InfiltrationMults n={n} mults={mults} />
<CompanyMults n={n} mults={mults} />
<GangMults n={n} mults={mults} />
<CorporationMults n={n} mults={mults} />
<BladeburnerMults n={n} mults={mults} />
<StanekMults n={n} mults={mults} />
<GangMults n={n} mults={mults} hideMultsIfCannotAccessFeature={hideMultsIfCannotAccessFeature} />
<CorporationMults n={n} mults={mults} hideMultsIfCannotAccessFeature={hideMultsIfCannotAccessFeature} />
<BladeburnerMults n={n} mults={mults} hideMultsIfCannotAccessFeature={hideMultsIfCannotAccessFeature} />
<StanekMults n={n} mults={mults} hideMultsIfCannotAccessFeature={hideMultsIfCannotAccessFeature} />
<GoMults n={n} mults={mults} />
</Box>
);
@@ -130,6 +137,10 @@ interface IMultsProps {
mults: BitNodeMultipliers;
}
interface IEndGameMultsProps extends IMultsProps {
hideMultsIfCannotAccessFeature: boolean;
}
function GeneralMults({ mults }: IMultsProps): React.ReactElement {
const rows: IBNMultRows = {
WorldDaemonDifficulty: { name: `${SpecialServers.WorldDaemon} Difficulty` },
@@ -265,7 +276,7 @@ function HackingMults({ mults }: IMultsProps): React.ReactElement {
ManualHackMoney: {
name: "Money Gained From Manual Hack",
color: Settings.theme.money,
tooltipText: `Influences how much money the player actually gains when they hack a server via the terminal. This is different from "Stolen Money From Hack". When the player hack a server via the terminal, the amount of money in that server is reduced, but they do not gain that same amount.`,
tooltipText: `Influences how much money the player actually gains when they hack a server via the terminal. This is different from "Stolen Money From Hack". When the player hacks a server via the terminal, the amount of money in that server is reduced, but they do not gain that same amount.`,
},
ScriptHackMoney: {
name: "Stolen Money From Hack",
@@ -315,8 +326,10 @@ function InfiltrationMults({ mults }: IMultsProps): React.ReactElement {
return <BNMultTable sectionName="Infiltration" rowData={rows} mults={mults} />;
}
function BladeburnerMults({ mults }: IMultsProps): React.ReactElement {
if (!Player.canAccessBladeburner()) return <></>;
function BladeburnerMults({ mults, hideMultsIfCannotAccessFeature }: IEndGameMultsProps): React.ReactElement {
if (!Player.canAccessBladeburner() && hideMultsIfCannotAccessFeature) {
return <></>;
}
if (mults.BladeburnerRank === 0) {
const rows: IBNMultRows = {
@@ -334,8 +347,10 @@ function BladeburnerMults({ mults }: IMultsProps): React.ReactElement {
return <BNMultTable sectionName="Bladeburner" rowData={rows} mults={mults} />;
}
function StanekMults({ mults }: IMultsProps): React.ReactElement {
if (!Player.canAccessCotMG()) return <></>;
function StanekMults({ mults, hideMultsIfCannotAccessFeature }: IEndGameMultsProps): React.ReactElement {
if (!Player.canAccessCotMG() && hideMultsIfCannotAccessFeature) {
return <></>;
}
const extraSize = mults.StaneksGiftExtraSize.toFixed(5);
const rows: IBNMultRows = {
@@ -349,8 +364,10 @@ function StanekMults({ mults }: IMultsProps): React.ReactElement {
return <BNMultTable sectionName="Stanek's Gift" rowData={rows} mults={mults} />;
}
function GangMults({ mults }: IMultsProps): React.ReactElement {
if (!canAccessBitNodeFeature(2)) return <></>;
function GangMults({ mults, hideMultsIfCannotAccessFeature }: IEndGameMultsProps): React.ReactElement {
if (!canAccessBitNodeFeature(2) && hideMultsIfCannotAccessFeature) {
return <></>;
}
const rows: IBNMultRows = {
GangSoftcap: {
@@ -363,8 +380,10 @@ function GangMults({ mults }: IMultsProps): React.ReactElement {
return <BNMultTable sectionName="Gang" rowData={rows} mults={mults} />;
}
function CorporationMults({ mults }: IMultsProps): React.ReactElement {
if (!Player.canAccessCorporation()) return <></>;
function CorporationMults({ mults, hideMultsIfCannotAccessFeature }: IEndGameMultsProps): React.ReactElement {
if (!Player.canAccessCorporation() && hideMultsIfCannotAccessFeature) {
return <></>;
}
if (mults.CorporationSoftcap < 0.15) {
const rows: IBNMultRows = {
+2 -2
View File
@@ -7,7 +7,7 @@ import { BitNodes } from "../BitNode";
import { Modal } from "../../ui/React/Modal";
import Typography from "@mui/material/Typography";
import Button from "@mui/material/Button";
import { BitnodeMultiplierDescription } from "./BitnodeMultipliersDescription";
import { BitNodeMultiplierDescription } from "./BitnodeMultipliersDescription";
import { BitNodeAdvancedOptions } from "./BitNodeAdvancedOptions";
import { JSONMap } from "../../Types/Jsonable";
@@ -105,7 +105,7 @@ export function PortalModal(props: IProps): React.ReactElement {
<br />
<br />
<Typography component="div">{bitNode.info}</Typography>
<BitnodeMultiplierDescription n={props.n} level={newLevel} />
<BitNodeMultiplierDescription n={props.n} level={newLevel} hideMultsIfCannotAccessFeature={false} />
<BitNodeAdvancedOptions
targetBitNode={props.n}
currentSourceFiles={currentSourceFiles}