diff --git a/src/Augmentation/AugmentationHelpers.tsx b/src/Augmentation/AugmentationHelpers.tsx index 5da4d7228..44c0f64ba 100644 --- a/src/Augmentation/AugmentationHelpers.tsx +++ b/src/Augmentation/AugmentationHelpers.tsx @@ -8,7 +8,6 @@ import { CONSTANTS } from "../Constants"; import { Factions, factionExists } from "../Faction/Factions"; import { Player } from "../Player"; import { prestigeAugmentation } from "../Prestige"; -import { SourceFileFlags } from "../SourceFile/SourceFileFlags"; import { dialogBoxCreate } from "../ui/React/DialogBox"; import { clearObject } from "../utils/helpers/clearObject"; @@ -73,7 +72,7 @@ function initAugmentations(): void { } function getBaseAugmentationPriceMultiplier(): number { - return CONSTANTS.MultipleAugMultiplier * [1, 0.96, 0.94, 0.93][SourceFileFlags[11]]; + return CONSTANTS.MultipleAugMultiplier * [1, 0.96, 0.94, 0.93][Player.sourceFileLvl(11)]; } export function getGenericAugmentationPriceMultiplier(): number { return Math.pow(getBaseAugmentationPriceMultiplier(), Player.queuedAugmentations.length); diff --git a/src/Augmentation/ui/PlayerMultipliers.tsx b/src/Augmentation/ui/PlayerMultipliers.tsx index b5ec5edd7..c8cadc341 100644 --- a/src/Augmentation/ui/PlayerMultipliers.tsx +++ b/src/Augmentation/ui/PlayerMultipliers.tsx @@ -7,7 +7,6 @@ import * as React from "react"; import { BitNodeMultipliers } from "../../BitNode/BitNodeMultipliers"; import { Player } from "../../Player"; import { Settings } from "../../Settings/Settings"; -import { SourceFileFlags } from "../../SourceFile/SourceFileFlags"; import { numeralWrapper } from "../../ui/numeralFormat"; import { Augmentations } from "../Augmentations"; @@ -35,7 +34,7 @@ interface IBitNodeModifiedStatsProps { function BitNodeModifiedStats(props: IBitNodeModifiedStatsProps): React.ReactElement { // If player doesn't have SF5 or if the property isn't affected by BitNode mults - if (props.mult === 1 || SourceFileFlags[5] === 0) + if (props.mult === 1 || Player.sourceFileLvl(5) === 0) return {numeralWrapper.formatPercentage(props.base)}; return ( diff --git a/src/BitNode/ui/BitverseRoot.tsx b/src/BitNode/ui/BitverseRoot.tsx index 8894593e6..1b4c2558a 100644 --- a/src/BitNode/ui/BitverseRoot.tsx +++ b/src/BitNode/ui/BitverseRoot.tsx @@ -1,5 +1,4 @@ import React, { useState } from "react"; -import { SourceFileFlags } from "../../SourceFile/SourceFileFlags"; import { IRouter } from "../../ui/Router"; import { BitNodes } from "../BitNode"; import { enterBitNode } from "../../RedPill"; @@ -128,12 +127,6 @@ export function BitverseRoot(props: IProps): React.ReactElement { const destroyed = player.bitNodeN; const [destroySequence, setDestroySequence] = useState(!props.quick); - // Update NextSourceFileFlags - const nextSourceFileFlags = SourceFileFlags.slice(); - if (!props.flume) { - if (nextSourceFileFlags[destroyed] < 3) ++nextSourceFileFlags[destroyed]; - } - if (destroySequence) { return ( { + const lvl = player.sourceFileLvl(n); + if (n !== destroyed) { + return lvl; + } + const max = n === 12 ? Infinity : 3; + return Math.min(max, lvl + 1); + }; + if (Settings.DisableASCIIArt) { return ( <> @@ -177,7 +179,7 @@ export function BitverseRoot(props: IProps): React.ReactElement { ); } + + const n = nextSourceFileLvl; return ( // prettier-ignore <> @@ -229,19 +233,19 @@ export function BitverseRoot(props: IProps): React.ReactElement { O | | | \| | O / _/ | / O | |/ | | | O | | | |O / | | O / | O O | | \ O| | | | | | |/ \/ / __| | |/ \ | \ | |__ \ \/ \| | | - \| O | |_/ |\| \ \__| \_| | O |/ + \| O | |_/ |\| \ \__| \_| | O |/ | | |_/ | | \| / | \_| | | \| / \| | / / \ |/ - | | | / | | - | | | | | | | + | | | / | | + | | | | | | | | | | / / \ \ | | | - \| | / / \ \ | |/ + \| | / / \ \ | |/ \ | / / | | \ \ | / - \ \JUMP 3R | | | | | | R3 PMUJ/ / + \ \JUMP 3R | | | | | | R3 PMUJ/ / \|| | | | | | | | | ||/ \| \_ | | | | | | _/ |/ \ \| / \ / \ |/ / - |/ | | \| + |/ | | \| | | | | | | | | \JUMP3R|JUMP|3R| |R3|PMUJ|R3PMUJ/
diff --git a/src/Faction/FactionHelpers.tsx b/src/Faction/FactionHelpers.tsx index 729eb15be..27e5f2816 100644 --- a/src/Faction/FactionHelpers.tsx +++ b/src/Faction/FactionHelpers.tsx @@ -15,7 +15,6 @@ import { getFactionSecurityWorkRepGain, getFactionFieldWorkRepGain, } from "../PersonObjects/formulas/reputation"; -import { SourceFileFlags } from "../SourceFile/SourceFileFlags"; import { dialogBoxCreate } from "../ui/React/DialogBox"; import { InvitationEvent } from "./ui/InvitationModal"; @@ -120,13 +119,14 @@ export function purchaseAugmentation(aug: Augmentation, fac: Faction, sing = fal aug.baseCost = 750e3 * mult * BitNodeMultipliers.AugmentationMoneyCost; for (let i = 0; i < Player.queuedAugmentations.length - 1; ++i) { - aug.baseCost *= CONSTANTS.MultipleAugMultiplier * [1, 0.96, 0.94, 0.93][SourceFileFlags[11]]; + aug.baseCost *= CONSTANTS.MultipleAugMultiplier * [1, 0.96, 0.94, 0.93][Player.sourceFileLvl(11)]; } } for (const name of Object.keys(Augmentations)) { if (Augmentations.hasOwnProperty(name)) { - Augmentations[name].baseCost *= CONSTANTS.MultipleAugMultiplier * [1, 0.96, 0.94, 0.93][SourceFileFlags[11]]; + Augmentations[name].baseCost *= + CONSTANTS.MultipleAugMultiplier * [1, 0.96, 0.94, 0.93][Player.sourceFileLvl(11)]; } } diff --git a/src/Hacknet/HacknetHelpers.tsx b/src/Hacknet/HacknetHelpers.tsx index e8e9bab74..e17bdd289 100644 --- a/src/Hacknet/HacknetHelpers.tsx +++ b/src/Hacknet/HacknetHelpers.tsx @@ -21,12 +21,11 @@ import { iTutorialSteps, iTutorialNextStep, ITutorial } from "../InteractiveTuto import { IPlayer } from "../PersonObjects/IPlayer"; import { GetServer } from "../Server/AllServers"; import { Server } from "../Server/Server"; -import { SourceFileFlags } from "../SourceFile/SourceFileFlags"; // Returns a boolean indicating whether the player has Hacknet Servers // (the upgraded form of Hacknet Nodes) export function hasHacknetServers(player: IPlayer): boolean { - return player.bitNodeN === 9 || SourceFileFlags[9] > 0; + return player.bitNodeN === 9 || player.sourceFileLvl(9) > 0; } export function purchaseHacknet(player: IPlayer): number { diff --git a/src/NetscriptFunctions.ts b/src/NetscriptFunctions.ts index c5bcf067f..e0e1da770 100644 --- a/src/NetscriptFunctions.ts +++ b/src/NetscriptFunctions.ts @@ -40,7 +40,6 @@ import { } from "./Server/ServerHelpers"; import { getPurchaseServerCost, getPurchaseServerLimit, getPurchaseServerMaxRam } from "./Server/ServerPurchases"; import { Server } from "./Server/Server"; -import { SourceFileFlags } from "./SourceFile/SourceFileFlags"; import { influenceStockThroughServerHack, influenceStockThroughServerGrow } from "./StockMarket/PlayerInfluencing"; import { isValidFilePath, removeLeadingSlash } from "./Terminal/DirectoryHelpers"; @@ -1548,7 +1547,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { }, getBitNodeMultipliers: function (): IBNMults { updateDynamicRam("getBitNodeMultipliers", getRamCost(Player, "getBitNodeMultipliers")); - if (SourceFileFlags[5] <= 0 && Player.bitNodeN !== 5) { + if (Player.sourceFileLvl(5) <= 0 && Player.bitNodeN !== 5) { throw makeRuntimeErrorMsg("getBitNodeMultipliers", "Requires Source-File 5 to run."); } const copy = Object.assign({}, BitNodeMultipliers); diff --git a/src/NetscriptFunctions/Sleeve.ts b/src/NetscriptFunctions/Sleeve.ts index 6d383161e..6b7751001 100644 --- a/src/NetscriptFunctions/Sleeve.ts +++ b/src/NetscriptFunctions/Sleeve.ts @@ -2,7 +2,6 @@ import { INetscriptHelper } from "./INetscriptHelper"; import { IPlayer } from "../PersonObjects/IPlayer"; import { getRamCost } from "../Netscript/RamCostGenerator"; import { FactionWorkType } from "../Faction/FactionWorkTypeEnum"; -import { SourceFileFlags } from "../SourceFile/SourceFileFlags"; import { SleeveTaskType } from "../PersonObjects/Sleeve/SleeveTaskTypesEnum"; import { WorkerScript } from "../Netscript/WorkerScript"; import { findSleevePurchasableAugs } from "../PersonObjects/Sleeve/SleeveHelpers"; @@ -20,7 +19,7 @@ import { export function NetscriptSleeve(player: IPlayer, workerScript: WorkerScript, helper: INetscriptHelper): ISleeve { const checkSleeveAPIAccess = function (func: string): void { - if (player.bitNodeN !== 10 && !SourceFileFlags[10]) { + if (player.bitNodeN !== 10 && !player.sourceFileLvl(10)) { throw helper.makeRuntimeErrorMsg( `sleeve.${func}`, "You do not currently have access to the Sleeve API. This is either because you are not in BitNode-10 or because you do not have Source-File 10", diff --git a/src/PersonObjects/Player/PlayerObjectBladeburnerMethods.ts b/src/PersonObjects/Player/PlayerObjectBladeburnerMethods.ts index ba031464c..f601eae55 100644 --- a/src/PersonObjects/Player/PlayerObjectBladeburnerMethods.ts +++ b/src/PersonObjects/Player/PlayerObjectBladeburnerMethods.ts @@ -1,5 +1,4 @@ import { Bladeburner } from "../../Bladeburner/Bladeburner"; -import { SourceFileFlags } from "../../SourceFile/SourceFileFlags"; import { IPlayer } from "../IPlayer"; export function canAccessBladeburner(this: IPlayer): boolean { @@ -7,7 +6,7 @@ export function canAccessBladeburner(this: IPlayer): boolean { return false; } - return this.bitNodeN === 6 || this.bitNodeN === 7 || SourceFileFlags[6] > 0 || SourceFileFlags[7] > 0; + return this.bitNodeN === 6 || this.bitNodeN === 7 || this.sourceFileLvl(6) > 0 || this.sourceFileLvl(7) > 0; } export function inBladeburner(this: IPlayer): boolean { diff --git a/src/PersonObjects/Player/PlayerObjectCorporationMethods.ts b/src/PersonObjects/Player/PlayerObjectCorporationMethods.ts index 9916b2c41..c853aceae 100644 --- a/src/PersonObjects/Player/PlayerObjectCorporationMethods.ts +++ b/src/PersonObjects/Player/PlayerObjectCorporationMethods.ts @@ -3,11 +3,10 @@ import { CorporationUnlockUpgradeIndex, CorporationUnlockUpgrades, } from "../../Corporation/data/CorporationUnlockUpgrades"; -import { SourceFileFlags } from "../../SourceFile/SourceFileFlags"; import { IPlayer } from "../IPlayer"; export function canAccessCorporation(this: IPlayer): boolean { - return this.bitNodeN === 3 || SourceFileFlags[3] > 0; + return this.bitNodeN === 3 || this.sourceFileLvl(3) > 0; } export function hasCorporation(this: IPlayer): boolean { @@ -22,7 +21,7 @@ export function startCorporation(this: IPlayer, corpName: string, additionalShar name: corpName, }); - if (SourceFileFlags[3] === 3) { + if (this.sourceFileLvl(3) === 3) { const warehouseApi = CorporationUnlockUpgrades[CorporationUnlockUpgradeIndex.WarehouseAPI].index; const OfficeApi = CorporationUnlockUpgrades[CorporationUnlockUpgradeIndex.OfficeAPI].index; diff --git a/src/PersonObjects/Player/PlayerObjectGangMethods.ts b/src/PersonObjects/Player/PlayerObjectGangMethods.ts index 6d64ed105..b9c781fb2 100644 --- a/src/PersonObjects/Player/PlayerObjectGangMethods.ts +++ b/src/PersonObjects/Player/PlayerObjectGangMethods.ts @@ -1,7 +1,6 @@ import { Factions } from "../../Faction/Factions"; import { Faction } from "../../Faction/Faction"; import { Gang } from "../../Gang/Gang"; -import { SourceFileFlags } from "../../SourceFile/SourceFileFlags"; import { IPlayer } from "../IPlayer"; // Amount of negative karma needed to manage a gang in BitNodes other than 2 @@ -11,7 +10,7 @@ export function canAccessGang(this: IPlayer): boolean { if (this.bitNodeN === 2) { return true; } - if (SourceFileFlags[2] <= 0) { + if (this.sourceFileLvl(2) <= 0) { return false; } diff --git a/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx b/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx index 33dbeb024..ae8d1bb27 100644 --- a/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx +++ b/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx @@ -45,7 +45,6 @@ import { SpecialServers } from "../../Server/data/SpecialServers"; import { applySourceFile } from "../../SourceFile/applySourceFile"; import { applyExploit } from "../../Exploits/applyExploits"; import { SourceFiles } from "../../SourceFile/SourceFiles"; -import { SourceFileFlags } from "../../SourceFile/SourceFileFlags"; import { influenceStockThroughCompanyWork } from "../../StockMarket/PlayerInfluencing"; import { getHospitalizationCost } from "../../Hospital/Hospital"; import { WorkerScript } from "../../Netscript/WorkerScript"; @@ -121,7 +120,7 @@ export function prestigeAugmentation(this: PlayerObject): void { this.queuedAugmentations = []; - const numSleeves = Math.min(3, SourceFileFlags[10] + (this.bitNodeN === 10 ? 1 : 0)) + this.sleevesFromCovenant; + const numSleeves = Math.min(3, this.sourceFileLvl(10) + (this.bitNodeN === 10 ? 1 : 0)) + this.sleevesFromCovenant; if (this.sleeves.length > numSleeves) this.sleeves.length = numSleeves; for (let i = this.sleeves.length; i < numSleeves; i++) { this.sleeves.push(new Sleeve(this)); @@ -467,7 +466,7 @@ export function gainIntelligenceExp(this: IPlayer, exp: number): void { console.error("ERROR: NaN passed into Player.gainIntelligenceExp()"); return; } - if (SourceFileFlags[5] > 0 || this.intelligence > 0) { + if (this.sourceFileLvl(5) > 0 || this.intelligence > 0) { this.intelligence_exp += exp; this.intelligence = Math.floor(this.calculateSkill(this.intelligence_exp)); } @@ -1037,7 +1036,7 @@ export function getWorkMoneyGain(this: IPlayer): number { // If player has SF-11, calculate salary multiplier from favor let bn11Mult = 1; const company = Companies[this.companyName]; - if (SourceFileFlags[11] > 0) { + if (this.sourceFileLvl(11) > 0) { bn11Mult = 1 + company.favor / 100; } @@ -2700,7 +2699,7 @@ export function gotoLocation(this: IPlayer, to: LocationName): boolean { } export function canAccessGrafting(this: IPlayer): boolean { - return this.bitNodeN === 10 || SourceFileFlags[10] > 0; + return this.bitNodeN === 10 || this.sourceFileLvl(10) > 0; } export function giveExploit(this: IPlayer, exploit: Exploit): void { @@ -2738,7 +2737,7 @@ export function setMult(this: IPlayer, name: string, mult: number): void { } export function canAccessCotMG(this: IPlayer): boolean { - return this.bitNodeN === 13 || SourceFileFlags[13] > 0; + return this.bitNodeN === 13 || this.sourceFileLvl(13) > 0; } export function sourceFileLvl(this: IPlayer, n: number): number { diff --git a/src/Prestige.ts b/src/Prestige.ts index 518847522..36e2c7acb 100755 --- a/src/Prestige.ts +++ b/src/Prestige.ts @@ -20,7 +20,7 @@ import { LiteratureNames } from "./Literature/data/LiteratureNames"; import { GetServer, AddToAllServers, initForeignServers, prestigeAllServers } from "./Server/AllServers"; import { prestigeHomeComputer } from "./Server/ServerHelpers"; -import { SourceFileFlags, updateSourceFileFlags } from "./SourceFile/SourceFileFlags"; +import { updateSourceFileFlags } from "./SourceFile/SourceFileFlags"; import { SpecialServers } from "./Server/data/SpecialServers"; import { deleteStockMarket, initStockMarket, initSymbolToStockMap } from "./StockMarket/StockMarket"; import { Terminal } from "./Terminal"; @@ -139,7 +139,7 @@ export function prestigeAugmentation(): void { if (Player.bitNodeN === 8) { Player.money = BitNode8StartingMoney; } - if (Player.bitNodeN === 8 || SourceFileFlags[8] > 0) { + if (Player.bitNodeN === 8 || Player.sourceFileLvl(8) > 0) { Player.hasWseAccount = true; Player.hasTixApiAccess = true; } @@ -198,9 +198,9 @@ export function prestigeSourceFile(flume: boolean): void { // Re-create foreign servers initForeignServers(Player.getHomeComputer()); - if (SourceFileFlags[9] >= 2) { + if (Player.sourceFileLvl(9) >= 2) { homeComp.setMaxRam(128); - } else if (SourceFileFlags[1] > 0) { + } else if (Player.sourceFileLvl(1) > 0) { homeComp.setMaxRam(32); } else { homeComp.setMaxRam(8); @@ -234,10 +234,10 @@ export function prestigeSourceFile(flume: boolean): void { } // Give levels of NeuroFluxGoverner for Source-File 12. Must be done here before Augmentations are recalculated - if (SourceFileFlags[12] > 0) { + if (Player.sourceFileLvl(12) > 0) { Player.augmentations.push({ name: AugmentationNames.NeuroFluxGovernor, - level: SourceFileFlags[12], + level: Player.sourceFileLvl(12), }); } @@ -264,7 +264,7 @@ export function prestigeSourceFile(flume: boolean): void { if (Player.bitNodeN === 8) { Player.money = BitNode8StartingMoney; } - if (Player.bitNodeN === 8 || SourceFileFlags[8] > 0) { + if (Player.bitNodeN === 8 || Player.sourceFileLvl(8) > 0) { Player.hasWseAccount = true; Player.hasTixApiAccess = true; } @@ -292,7 +292,7 @@ export function prestigeSourceFile(flume: boolean): void { Player.bladeburner = null; // Source-File 9 (level 3) effect - if (SourceFileFlags[9] >= 3) { + if (Player.sourceFileLvl(9) >= 3) { const hserver = Player.createHacknetServer(); hserver.level = 100; @@ -309,7 +309,7 @@ export function prestigeSourceFile(flume: boolean): void { staneksGift.prestigeSourceFile(); // Gain int exp - if (SourceFileFlags[5] !== 0 && !flume) Player.gainIntelligenceExp(300); + if (Player.sourceFileLvl(5) !== 0 && !flume) Player.gainIntelligenceExp(300); resetPidCounter(); } diff --git a/src/RedPill.tsx b/src/RedPill.tsx index ef538a250..2c49116bf 100644 --- a/src/RedPill.tsx +++ b/src/RedPill.tsx @@ -5,7 +5,6 @@ import React from "react"; import { Player } from "./Player"; import { prestigeSourceFile } from "./Prestige"; import { PlayerOwnedSourceFile } from "./SourceFile/PlayerOwnedSourceFile"; -import { SourceFileFlags } from "./SourceFile/SourceFileFlags"; import { SourceFiles } from "./SourceFile/SourceFiles"; import { dialogBoxCreate } from "./ui/React/DialogBox"; @@ -69,7 +68,7 @@ function giveSourceFile(bitNodeNumber: number): void { export function enterBitNode(router: IRouter, flume: boolean, destroyedBitNode: number, newBitNode: number): void { if (!flume) { giveSourceFile(destroyedBitNode); - } else if (SourceFileFlags[5] === 0 && newBitNode !== 5) { + } else if (Player.sourceFileLvl(5) === 0 && newBitNode !== 5) { Player.intelligence = 0; Player.intelligence_exp = 0; } diff --git a/src/SaveObject.tsx b/src/SaveObject.tsx index 5179f0d2e..8cf6d29b2 100755 --- a/src/SaveObject.tsx +++ b/src/SaveObject.tsx @@ -6,7 +6,6 @@ import { loadAllGangs, AllGangs } from "./Gang/AllGangs"; import { Player, loadPlayer } from "./Player"; import { saveAllServers, loadAllServers, GetAllServers } from "./Server/AllServers"; import { Settings } from "./Settings/Settings"; -import { SourceFileFlags } from "./SourceFile/SourceFileFlags"; import { loadStockMarket, StockMarket } from "./StockMarket/StockMarket"; import { staneksGift, loadStaneksGift } from "./CotMG/Helper"; @@ -126,7 +125,7 @@ class BitburnerSaveObject { // Save file name is based on current timestamp and BitNode const epochTime = Math.round(Date.now() / 1000); const bn = Player.bitNodeN; - let filename = `bitburnerSave_${epochTime}_BN${bn}x${SourceFileFlags[bn]}.json`; + let filename = `bitburnerSave_${epochTime}_BN${bn}x${Player.sourceFileLvl(bn) + 1}.json`; if (isRecovery) filename = "RECOVERY" + filename; return filename; } diff --git a/src/StockMarket/ui/StockTicker.tsx b/src/StockMarket/ui/StockTicker.tsx index 66cbf5134..e81baf439 100644 --- a/src/StockMarket/ui/StockTicker.tsx +++ b/src/StockMarket/ui/StockTicker.tsx @@ -16,7 +16,6 @@ import { OrderTypes } from "../data/OrderTypes"; import { PositionTypes } from "../data/PositionTypes"; import { IPlayer } from "../../PersonObjects/IPlayer"; -import { SourceFileFlags } from "../../SourceFile/SourceFileFlags"; import { numeralWrapper } from "../../ui/numeralFormat"; import { Money } from "../../ui/React/Money"; @@ -288,12 +287,12 @@ export function StockTicker(props: IProps): React.ReactElement { // Whether the player has access to orders besides market orders (limit/stop) function hasOrderAccess(): boolean { - return props.p.bitNodeN === 8 || SourceFileFlags[8] >= 3; + return props.p.bitNodeN === 8 || props.p.sourceFileLvl(8) >= 3; } // Whether the player has access to shorting stocks function hasShortAccess(): boolean { - return props.p.bitNodeN === 8 || SourceFileFlags[8] >= 2; + return props.p.bitNodeN === 8 || props.p.sourceFileLvl(8) >= 2; } return ( diff --git a/src/StockMarket/ui/StockTickerPositionText.tsx b/src/StockMarket/ui/StockTickerPositionText.tsx index 3a8386f15..6bccf1852 100644 --- a/src/StockMarket/ui/StockTickerPositionText.tsx +++ b/src/StockMarket/ui/StockTickerPositionText.tsx @@ -9,7 +9,6 @@ import { Stock } from "../Stock"; import { IPlayer } from "../../PersonObjects/IPlayer"; import { numeralWrapper } from "../../ui/numeralFormat"; import { Money } from "../../ui/React/Money"; -import { SourceFileFlags } from "../../SourceFile/SourceFileFlags"; import Typography from "@mui/material/Typography"; import Tooltip from "@mui/material/Tooltip"; import Box from "@mui/material/Box"; @@ -67,7 +66,7 @@ function ShortPosition(props: IProps): React.ReactElement { percentageGains = 0; } - if (props.p.bitNodeN === 8 || SourceFileFlags[8] >= 2) { + if (props.p.bitNodeN === 8 || props.p.sourceFileLvl(8) >= 2) { return ( <> diff --git a/src/ui/CharacterStats.tsx b/src/ui/CharacterStats.tsx index 0c24fb734..43df51bcd 100644 --- a/src/ui/CharacterStats.tsx +++ b/src/ui/CharacterStats.tsx @@ -6,7 +6,6 @@ import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers"; import { HacknetServerConstants } from "../Hacknet/data/Constants"; import { getPurchaseServerLimit } from "../Server/ServerPurchases"; import { Settings } from "../Settings/Settings"; -import { SourceFileFlags } from "../SourceFile/SourceFileFlags"; import { MoneySourceTracker } from "../utils/MoneySourceTracker"; import { convertTimeMsToTimeElapsedString } from "../utils/StringHelperFunctions"; import { use } from "./Context"; @@ -44,6 +43,7 @@ interface MultTableProps { } function MultiplierTable(props: MultTableProps): React.ReactElement { + const player = use.Player(); return ( @@ -52,7 +52,7 @@ function MultiplierTable(props: MultTableProps): React.ReactElement { value = data[1] as number, modded = data[2] as number | null; - if (modded && modded !== value && SourceFileFlags[5] > 0) { + if (modded && modded !== value && player.sourceFileLvl(5) > 0) { return ( <> @@ -88,7 +88,7 @@ function CurrentBitNode(): React.ReactElement { - BitNode {player.bitNodeN}: {BitNodes[index].name} (Level {lvl}) + BitNode {player.bitNodeN}: {BitNodes[index].name} (Level {lvl + 1}) {BitNodes[index].info} @@ -270,11 +270,13 @@ export function CharacterStats(): React.ReactElement { data={{ content: `${player.purchasedServers.length} / ${getPurchaseServerLimit()}` }} /> 0 ? "Servers" : "Nodes"} owned`} + name={`Hacknet ${player.bitNodeN === 9 || player.sourceFileLvl(9) > 0 ? "Servers" : "Nodes"} owned`} color={Settings.theme.primary} data={{ content: `${player.hacknetNodes.length}${ - player.bitNodeN === 9 || SourceFileFlags[9] > 0 ? ` / ${HacknetServerConstants.MaxServers}` : "" + player.bitNodeN === 9 || player.sourceFileLvl(9) > 0 + ? ` / ${HacknetServerConstants.MaxServers}` + : "" }`, }} /> @@ -320,7 +322,7 @@ export function CharacterStats(): React.ReactElement { color={Settings.theme.cha} data={{ level: player.charisma, exp: player.charisma_exp }} /> - {player.intelligence > 0 && (player.bitNodeN === 5 || SourceFileFlags[5] > 0) && ( + {player.intelligence > 0 && (player.bitNodeN === 5 || player.sourceFileLvl(5) > 0) && ( Multipliers - {SourceFileFlags[5] > 0 && ( + {player.sourceFileLvl(5) > 0 && (