mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-05-06 23:57:49 +02:00
CODEBASE: Expand lint rules, and Aliases are stored as maps (#501)
This commit is contained in:
@@ -59,7 +59,7 @@ export class PlayerObject extends Person implements IPlayer {
|
||||
scriptProdSinceLastAug = 0;
|
||||
sleeves: Sleeve[] = [];
|
||||
sleevesFromCovenant = 0;
|
||||
sourceFiles: JSONMap<number, number> = new JSONMap();
|
||||
sourceFiles = new JSONMap<number, number>();
|
||||
exploits: Exploit[] = [];
|
||||
achievements: PlayerAchievement[] = [];
|
||||
terminalCommandHistory: string[] = [];
|
||||
|
||||
@@ -284,12 +284,10 @@ export function applyForJob(this: PlayerObject, entryPosType: CompanyPosition, s
|
||||
return false;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
const nextPos = getNextCompanyPositionHelper(pos);
|
||||
if (nextPos == null) break;
|
||||
if (company.hasPosition(nextPos) && this.isQualified(company, nextPos)) {
|
||||
pos = nextPos;
|
||||
} else break;
|
||||
let nextPos = getNextCompanyPositionHelper(pos);
|
||||
while (nextPos && company.hasPosition(nextPos) && this.isQualified(company, nextPos)) {
|
||||
pos = nextPos;
|
||||
nextPos = getNextCompanyPositionHelper(pos);
|
||||
}
|
||||
|
||||
//Check if player already has the assigned job
|
||||
|
||||
@@ -34,14 +34,15 @@ function getWorkDescription(sleeve: Sleeve, progress: number): string {
|
||||
`This sleeve is currently attempting to perform ${work.actionName}.\n\n` +
|
||||
`Progress: ${formatPercent(progress)}`
|
||||
);
|
||||
case WorkType.CRIME:
|
||||
case WorkType.CRIME: {
|
||||
const crime = work.getCrime();
|
||||
return (
|
||||
`This sleeve is currently attempting ${crime.workName} (Success Rate: ${formatPercent(
|
||||
crime.successRate(sleeve),
|
||||
)}).\n\n` + `Progress: ${formatPercent(progress)}`
|
||||
);
|
||||
case WorkType.FACTION:
|
||||
}
|
||||
case WorkType.FACTION: {
|
||||
// This isn't the way this should be handled...
|
||||
const workNames = {
|
||||
[FactionWorkType.field]: "Field Work",
|
||||
@@ -50,6 +51,7 @@ function getWorkDescription(sleeve: Sleeve, progress: number): string {
|
||||
};
|
||||
const doing = workNames[work.factionWorkType] ?? "nothing";
|
||||
return `This sleeve is currently doing ${doing} for ${work.factionName}.`;
|
||||
}
|
||||
case WorkType.INFILTRATE:
|
||||
return (
|
||||
"This sleeve is currently attempting to infiltrate synthoid communities to generate additional contracts and operations.\nThis activity is less efficient the more sleeves are assigned to it.\n\n" +
|
||||
|
||||
@@ -249,19 +249,20 @@ function getABC(sleeve: Sleeve): [string, string, string] {
|
||||
switch (work.type) {
|
||||
case WorkType.COMPANY:
|
||||
return ["Work for Company", work.companyName, "------"];
|
||||
case WorkType.FACTION:
|
||||
case WorkType.FACTION: {
|
||||
const workNames = {
|
||||
[FactionWorkType.field]: "Field Work",
|
||||
[FactionWorkType.hacking]: "Hacking Contracts",
|
||||
[FactionWorkType.security]: "Security Work",
|
||||
};
|
||||
return ["Work for Faction", work.factionName, workNames[work.factionWorkType] ?? ""];
|
||||
}
|
||||
case WorkType.BLADEBURNER:
|
||||
if (work.actionType === "Contracts") {
|
||||
return ["Perform Bladeburner Actions", "Take on contracts", work.actionName];
|
||||
}
|
||||
return ["Perform Bladeburner Actions", work.actionName, "------"];
|
||||
case WorkType.CLASS:
|
||||
case WorkType.CLASS: {
|
||||
if (!work.isGym()) return ["Take University Course", work.classType, work.location];
|
||||
const gymNames: Record<GymType, string> = {
|
||||
[GymType.strength]: "Train Strength",
|
||||
@@ -270,6 +271,7 @@ function getABC(sleeve: Sleeve): [string, string, string] {
|
||||
[GymType.agility]: "Train Agility",
|
||||
};
|
||||
return ["Workout at Gym", gymNames[work.classType as GymType], work.location];
|
||||
}
|
||||
case WorkType.CRIME:
|
||||
return ["Commit Crime", checkEnum(CrimeType, work.crimeType) ? work.crimeType : "Shoplift", "------"];
|
||||
case WorkType.SUPPORT:
|
||||
@@ -305,7 +307,7 @@ export function TaskSelector(props: IProps): React.ReactElement {
|
||||
props.setABC([s0, s1, details2[0]]);
|
||||
}
|
||||
|
||||
function onS0Change(event: SelectChangeEvent<string>): void {
|
||||
function onS0Change(event: SelectChangeEvent): void {
|
||||
const n = event.target.value;
|
||||
const detailsF = tasks[n];
|
||||
if (detailsF === undefined) throw new Error(`No function for task '${s0}'`);
|
||||
@@ -317,12 +319,12 @@ export function TaskSelector(props: IProps): React.ReactElement {
|
||||
props.setABC([n, details.first[0], details2[0]]);
|
||||
}
|
||||
|
||||
function onS1Change(event: SelectChangeEvent<string>): void {
|
||||
function onS1Change(event: SelectChangeEvent): void {
|
||||
setS1(event.target.value);
|
||||
props.setABC([s0, event.target.value, s2]);
|
||||
}
|
||||
|
||||
function onS2Change(event: SelectChangeEvent<string>): void {
|
||||
function onS2Change(event: SelectChangeEvent): void {
|
||||
setS2(event.target.value);
|
||||
props.setABC([s0, s1, event.target.value]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user