Merge pull request #4101 from Kelenius/UnhardcodeBBAndCorpDisabling

UI: Bitnode stats now show if BB/Corporation are disabled
This commit is contained in:
hydroflame 2022-09-23 00:43:19 -03:00 committed by GitHub
commit 9f922de50d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 25 additions and 9 deletions

@ -252,7 +252,7 @@ export function PlayerMultipliers(): React.ReactElement {
}, },
]; ];
if (Player.canAccessBladeburner()) { if (Player.canAccessBladeburner() && BitNodeMultipliers.BladeburnerRank > 0) {
rightColData.push( rightColData.push(
{ {
mult: "Bladeburner Success Chance", mult: "Bladeburner Success Chance",

@ -654,6 +654,7 @@ export function getBitNodeMultipliers(n: number, lvl: number): IBitNodeMultiplie
} }
case 8: { case 8: {
return Object.assign(mults, { return Object.assign(mults, {
BladeburnerRank: 0,
ScriptHackMoney: 0.3, ScriptHackMoney: 0.3,
ScriptHackMoneyGain: 0, ScriptHackMoneyGain: 0,
ManualHackMoney: 0, ManualHackMoney: 0,

@ -280,6 +280,14 @@ function BladeburnerMults({ mults }: IMultsProps): React.ReactElement {
const player = use.Player(); const player = use.Player();
if (!player.canAccessBladeburner()) return <></>; if (!player.canAccessBladeburner()) return <></>;
if (mults.BladeburnerRank == 0) {
const rows: IBNMultRows = {
BladeburnerRank: { name: "Disabled", content: "" },
};
return <BNMultTable sectionName="Bladeburner" rowData={rows} mults={mults} />;
}
const rows: IBNMultRows = { const rows: IBNMultRows = {
BladeburnerRank: { name: "Rank Gain" }, BladeburnerRank: { name: "Rank Gain" },
BladeburnerSkillCost: { name: "Skill Cost" }, BladeburnerSkillCost: { name: "Skill Cost" },
@ -323,6 +331,17 @@ function CorporationMults({ mults }: IMultsProps): React.ReactElement {
const player = use.Player(); const player = use.Player();
if (!player.canAccessCorporation()) return <></>; if (!player.canAccessCorporation()) return <></>;
if (mults.CorporationSoftcap < 0.15) {
const rows: IBNMultRows = {
CorporationSoftcap: {
name: "Disabled",
content: "",
},
};
return <BNMultTable sectionName="Corporation" rowData={rows} mults={mults} />;
}
const rows: IBNMultRows = { const rows: IBNMultRows = {
CorporationSoftcap: { CorporationSoftcap: {
name: "Corporation Softcap", name: "Corporation Softcap",

@ -83,7 +83,7 @@ export function SpecialLocation(props: IProps): React.ReactElement {
} }
function renderBladeburner(): React.ReactElement { function renderBladeburner(): React.ReactElement {
if (!player.canAccessBladeburner()) { if (!player.canAccessBladeburner() || BitNodeMultipliers.BladeburnerRank == 0) {
return <></>; return <></>;
} }
const text = inBladeburner ? "Enter Bladeburner Headquarters" : "Apply to Bladeburner Division"; const text = inBladeburner ? "Enter Bladeburner Headquarters" : "Apply to Bladeburner Division";

@ -397,8 +397,8 @@ export function NetscriptBladeburner(): InternalAPI<INetscriptBladeburner> {
}, },
joinBladeburnerDivision: (ctx: NetscriptContext) => (): boolean => { joinBladeburnerDivision: (ctx: NetscriptContext) => (): boolean => {
if (player.bitNodeN === 7 || player.sourceFileLvl(7) > 0) { if (player.bitNodeN === 7 || player.sourceFileLvl(7) > 0) {
if (player.bitNodeN === 8) { if (BitNodeMultipliers.BladeburnerRank == 0) {
return false; return false; // Disabled in this bitnode
} }
if (player.bladeburner instanceof Bladeburner) { if (player.bladeburner instanceof Bladeburner) {
return true; // Already member return true; // Already member

@ -2,10 +2,6 @@ import { Bladeburner } from "../../Bladeburner/Bladeburner";
import { IPlayer } from "../IPlayer"; import { IPlayer } from "../IPlayer";
export function canAccessBladeburner(this: IPlayer): boolean { export function canAccessBladeburner(this: IPlayer): boolean {
if (this.bitNodeN === 8) {
return false;
}
return this.bitNodeN === 6 || this.bitNodeN === 7 || this.sourceFileLvl(6) > 0 || this.sourceFileLvl(7) > 0; return this.bitNodeN === 6 || this.bitNodeN === 7 || this.sourceFileLvl(6) > 0 || this.sourceFileLvl(7) > 0;
} }

@ -532,7 +532,7 @@ export function CharacterStats(): React.ReactElement {
]} ]}
color={Settings.theme.combat} color={Settings.theme.combat}
/> />
{player.canAccessBladeburner() && ( {player.canAccessBladeburner() && BitNodeMultipliers.BladeburnerRank > 0 && (
<MultiplierTable <MultiplierTable
rows={[ rows={[
{ {