rm SourceFileFlags

This commit is contained in:
Olivier Gagnon
2022-04-14 01:22:50 -04:00
parent eae4eb2a31
commit 62d15ff3a1
17 changed files with 58 additions and 65 deletions
@@ -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 {
@@ -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;
@@ -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;
}
@@ -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 {