mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-23 08:03:48 +01:00
Clean up
linter
This commit is contained in:
parent
d1388a62aa
commit
0406272942
@ -38,7 +38,6 @@ import { WorkerScript } from "../Netscript/WorkerScript";
|
||||
import { FactionNames } from "../Faction/data/FactionNames";
|
||||
import { BlackOperationNames } from "./data/BlackOperationNames";
|
||||
import { KEY } from "../utils/helpers/keyCodes";
|
||||
import { Player } from "src/Player";
|
||||
|
||||
interface BlackOpsAttempt {
|
||||
error?: string;
|
||||
@ -1022,7 +1021,7 @@ export class Bladeburner implements IBladeburner {
|
||||
const unweightedGain = time * BladeburnerConstants.BaseStatGain * successMult * difficultyMult;
|
||||
const unweightedIntGain = time * BladeburnerConstants.BaseIntGain * successMult * difficultyMult;
|
||||
const skillMult = this.skillMultipliers.expGain;
|
||||
|
||||
|
||||
return {
|
||||
hack: unweightedGain * action.weights.hack * skillMult,
|
||||
str: unweightedGain * action.weights.str * skillMult,
|
||||
@ -1136,7 +1135,7 @@ export class Bladeburner implements IBladeburner {
|
||||
const losses = getRandomInt(0, max);
|
||||
this.teamSize -= losses;
|
||||
if(this.teamSize < this.sleeveSize) {
|
||||
let sup = player.sleeves.filter(x => x.bbAction == 'Support main sleeve');
|
||||
const sup = player.sleeves.filter(x => x.bbAction == 'Support main sleeve');
|
||||
for(let i = 0; i > (this.teamSize-this.sleeveSize); i--){
|
||||
const r = Math.floor(Math.random() * sup.length);
|
||||
sup[r].takeDamage(sup[r].max_hp);
|
||||
@ -1314,7 +1313,7 @@ export class Bladeburner implements IBladeburner {
|
||||
this.log(`${person.whoAmI()}: ` + action.name + " successfully completed! Gained " + formatNumber(gain, 3) + " rank");
|
||||
} else if (!isOperation && this.logging.contracts) {
|
||||
this.log(
|
||||
`${person.whoAmI()}: ` +
|
||||
`${person.whoAmI()}: ` +
|
||||
action.name +
|
||||
" contract successfully completed! Gained " +
|
||||
formatNumber(gain, 3) +
|
||||
@ -1422,7 +1421,7 @@ export class Bladeburner implements IBladeburner {
|
||||
|
||||
if (this.logging.blackops) {
|
||||
this.log(
|
||||
`${person.whoAmI()}: ` +
|
||||
`${person.whoAmI()}: ` +
|
||||
action.name +
|
||||
" failed! Lost " +
|
||||
formatNumber(rankLoss, 1) +
|
||||
@ -1440,7 +1439,7 @@ export class Bladeburner implements IBladeburner {
|
||||
const losses = getRandomInt(1, teamLossMax);
|
||||
this.teamSize -= losses;
|
||||
if(this.teamSize < this.sleeveSize) {
|
||||
let sup = player.sleeves.filter(x => x.bbAction == 'Support main sleeve');
|
||||
const sup = player.sleeves.filter(x => x.bbAction == 'Support main sleeve');
|
||||
for(let i = 0; i > (this.teamSize-this.sleeveSize); i--){
|
||||
const r = Math.floor(Math.random() * sup.length);
|
||||
sup[r].takeDamage(sup[r].max_hp);
|
||||
@ -1472,7 +1471,7 @@ export class Bladeburner implements IBladeburner {
|
||||
this.staminaBonus += staminaGain;
|
||||
if (this.logging.general) {
|
||||
this.log(
|
||||
`${person.whoAmI()}: ` +
|
||||
`${person.whoAmI()}: ` +
|
||||
"Training completed. Gained: " +
|
||||
formatNumber(strExpGain, 1) +
|
||||
" str exp, " +
|
||||
@ -1509,7 +1508,7 @@ export class Bladeburner implements IBladeburner {
|
||||
this.getCurrentCity().improvePopulationEstimateByPercentage(eff * this.skillMultipliers.successChanceEstimate);
|
||||
if (this.logging.general) {
|
||||
this.log(
|
||||
`${person.whoAmI()}: ` +
|
||||
`${person.whoAmI()}: ` +
|
||||
`Field analysis completed. Gained ${formatNumber(rankGain, 2)} rank, ` +
|
||||
`${formatNumber(hackingExpGain, 1)} hacking exp, and ` +
|
||||
`${formatNumber(charismaExpGain, 1)} charisma exp`,
|
||||
@ -1655,7 +1654,7 @@ export class Bladeburner implements IBladeburner {
|
||||
this.actionTimeOverflow = 0;
|
||||
if (this.actionTimeCurrent >= this.actionTimeToComplete) {
|
||||
this.actionTimeOverflow = this.actionTimeCurrent - this.actionTimeToComplete;
|
||||
let retValue = this.completeAction(player, player, this.action);
|
||||
const retValue = this.completeAction(player, player, this.action);
|
||||
player.gainMoney(retValue.money, "bladeburner");
|
||||
player.gainStats(retValue);
|
||||
// Operation Daedalus
|
||||
|
@ -137,7 +137,7 @@ export function NetscriptBladeburner(
|
||||
const bladeburner = player.bladeburner;
|
||||
if (bladeburner === null) throw new Error("Should not be called without Bladeburner");
|
||||
try {
|
||||
let time = bladeburner.getActionTimeNetscriptFn(player, type, name);
|
||||
const time = bladeburner.getActionTimeNetscriptFn(player, type, name);
|
||||
if(typeof time === 'string'){
|
||||
const errorLogText = `Invalid action: type='${type}' name='${name}'`;
|
||||
workerScript.log("bladeburner.getActionTime", () => errorLogText);
|
||||
@ -157,7 +157,7 @@ export function NetscriptBladeburner(
|
||||
const bladeburner = player.bladeburner;
|
||||
if (bladeburner === null) throw new Error("Should not be called without Bladeburner");
|
||||
try {
|
||||
let chance = bladeburner.getActionEstimatedSuccessChanceNetscriptFn(player, type, name);
|
||||
const chance = bladeburner.getActionEstimatedSuccessChanceNetscriptFn(player, type, name);
|
||||
if(typeof chance === 'string'){
|
||||
const errorLogText = `Invalid action: type='${type}' name='${name}'`;
|
||||
workerScript.log("bladeburner.getActionTime", () => errorLogText);
|
||||
|
@ -15,7 +15,7 @@ export interface IPerson {
|
||||
hp: number;
|
||||
max_hp: number;
|
||||
money: number;
|
||||
|
||||
|
||||
// Experience
|
||||
hacking_exp: number;
|
||||
strength_exp: number;
|
||||
@ -24,7 +24,7 @@ export interface IPerson {
|
||||
agility_exp: number;
|
||||
charisma_exp: number;
|
||||
intelligence_exp: number;
|
||||
|
||||
|
||||
// Multipliers
|
||||
hacking_exp_mult: number;
|
||||
strength_exp_mult: number;
|
||||
@ -46,7 +46,7 @@ export interface IPerson {
|
||||
crime_success_mult: number;
|
||||
|
||||
bladeburner_analysis_mult: number;
|
||||
|
||||
|
||||
getIntelligenceBonus(weight: number): number;
|
||||
gainHackingExp(exp: number): void;
|
||||
gainStrengthExp(exp: number): void;
|
||||
@ -61,4 +61,4 @@ export interface IPerson {
|
||||
regenerateHp: (amt: number) => void;
|
||||
queryStatFromString: (str: string) => number;
|
||||
whoAmI: () => string;
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ export interface ITaskTracker {
|
||||
int: number;
|
||||
money: number;
|
||||
}
|
||||
|
||||
|
||||
export function createTaskTracker(): ITaskTracker {
|
||||
return {
|
||||
hack: 0,
|
||||
@ -22,4 +22,4 @@ export interface ITaskTracker {
|
||||
int: 0,
|
||||
money: 0,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -89,6 +89,18 @@ export abstract class Person implements IPerson {
|
||||
*/
|
||||
city: CityName = CityName.Sector12;
|
||||
|
||||
gainHackingExp: (exp: number) => void;
|
||||
gainStrengthExp: (exp: number) => void;
|
||||
gainDefenseExp: (exp: number) => void;
|
||||
gainDexterityExp: (exp: number) => void;
|
||||
gainAgilityExp: (exp: number) => void;
|
||||
gainCharismaExp: (exp: number) => void;
|
||||
gainIntelligenceExp: (exp: number) => void;
|
||||
gainStats: (retValue: ITaskTracker) => void;
|
||||
calculateSkill: (exp: number, mult: number) => number;
|
||||
regenerateHp: (amt: number) => void;
|
||||
queryStatFromString: (str: string) => number;
|
||||
|
||||
/**
|
||||
* Updates this object's multipliers for the given augmentation
|
||||
*/
|
||||
@ -226,17 +238,6 @@ export abstract class Person implements IPerson {
|
||||
|
||||
abstract whoAmI(): string;
|
||||
|
||||
gainHackingExp: (exp: number) => void;
|
||||
gainStrengthExp: (exp: number) => void;
|
||||
gainDefenseExp: (exp: number) => void;
|
||||
gainDexterityExp: (exp: number) => void;
|
||||
gainAgilityExp: (exp: number) => void;
|
||||
gainCharismaExp: (exp: number) => void;
|
||||
gainIntelligenceExp: (exp: number) => void;
|
||||
gainStats: (retValue: ITaskTracker) => void;
|
||||
calculateSkill: (exp: number, mult: number) => number;
|
||||
regenerateHp: (amt: number) => void;
|
||||
queryStatFromString: (str: string) => number;
|
||||
constructor() {
|
||||
this.gainHackingExp = generalMethods.gainHackingExp;
|
||||
this.gainStrengthExp = generalMethods.gainStrengthExp;
|
||||
@ -252,4 +253,4 @@ export abstract class Person implements IPerson {
|
||||
}
|
||||
}
|
||||
|
||||
Reviver.constructors.Person = Person;
|
||||
Reviver.constructors.Person = Person;
|
||||
|
@ -189,7 +189,7 @@ export class Sleeve extends Person {
|
||||
*/
|
||||
finishTask(p: IPlayer): ITaskTracker {
|
||||
let retValue: ITaskTracker = createTaskTracker(); // Amount of exp to be gained by other sleeves
|
||||
|
||||
|
||||
if (this.currentTask === SleeveTaskType.Crime) {
|
||||
// For crimes, all experience and money is gained at the end
|
||||
if (this.currentTaskTime >= this.currentTaskMaxTime) {
|
||||
@ -229,7 +229,7 @@ export class Sleeve extends Person {
|
||||
this.resetTaskStatus(p);
|
||||
return retValue;
|
||||
}
|
||||
|
||||
|
||||
if (this.currentTaskTime >= this.currentTaskMaxTime) {
|
||||
if (this.bbAction === "Infiltrate synthoids") {
|
||||
bb.infiltrateSynthoidCommunities();
|
||||
@ -637,7 +637,7 @@ export class Sleeve extends Person {
|
||||
p.bladeburner?.sleeveSupport(false);
|
||||
}
|
||||
if (this.currentTask == SleeveTaskType.Class) {
|
||||
let retVal = createTaskTracker();
|
||||
const retVal = createTaskTracker();
|
||||
retVal.int = CONSTANTS.IntelligenceClassBaseExpGain * Math.round(this.currentTaskTime / 1000);
|
||||
this.gainExperience(p, retVal);//Wont be shared with other sleeves
|
||||
}
|
||||
@ -1091,7 +1091,7 @@ export class Sleeve extends Person {
|
||||
break;
|
||||
case "Recruitment":
|
||||
time = this.getBladeburnerActionTime(p, 'General', action);
|
||||
const recruitTime = p.bladeburner?.getRecruitmentTime(this) ?? 0 * 1000;
|
||||
const recruitTime = (p.bladeburner?.getRecruitmentTime(this) ?? 0) * 1000;
|
||||
this.gainRatesForTask.cha = 2 * BladeburnerConstants.BaseStatGain * recruitTime;
|
||||
this.currentTaskLocation = (p.bladeburner?.getRecruitmentSuccessChance(this) ?? 0).toString() + '%';
|
||||
break;
|
||||
@ -1167,7 +1167,7 @@ export class Sleeve extends Person {
|
||||
this.gainRatesForTask.agi = retValue.agi;
|
||||
this.gainRatesForTask.cha = retValue.cha;
|
||||
const rewardMultiplier = Math.pow(action.rewardFac, action.level - 1);
|
||||
this.gainRatesForTask.money = BladeburnerConstants.ContractBaseMoneyGain * rewardMultiplier * bb.skillMultipliers.money;;
|
||||
this.gainRatesForTask.money = BladeburnerConstants.ContractBaseMoneyGain * rewardMultiplier * bb.skillMultipliers.money;
|
||||
}
|
||||
|
||||
getBladeburnerActionTime(p: IPlayer, type: string, name: string): number{//Maybe find workerscript and use original
|
||||
@ -1177,7 +1177,7 @@ export class Sleeve extends Person {
|
||||
console.error(`Function: sleeves.getBladeburnerActionTime; Message: '${errorLogText}'`)
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
const time = bb.getActionTimeNetscriptFn(this, type, name);
|
||||
if(typeof time === 'string'){
|
||||
const errorLogText = `Invalid action: type='${type}' name='${name}'`;
|
||||
|
@ -186,8 +186,8 @@ export function SleeveElem(props: IProps): React.ReactElement {
|
||||
</Button>
|
||||
<Typography>{desc}</Typography>
|
||||
<Typography>
|
||||
{(props.sleeve.currentTask === SleeveTaskType.Crime
|
||||
|| props.sleeve.currentTask === SleeveTaskType.Bladeburner)
|
||||
{(props.sleeve.currentTask === SleeveTaskType.Crime
|
||||
|| props.sleeve.currentTask === SleeveTaskType.Bladeburner)
|
||||
&& props.sleeve.currentTaskMaxTime > 0
|
||||
&& createProgressBarText({
|
||||
progress: props.sleeve.currentTaskTime / props.sleeve.currentTaskMaxTime,
|
||||
|
@ -10,7 +10,6 @@ import { FactionWorkType } from "../../../Faction/FactionWorkTypeEnum";
|
||||
import Select, { SelectChangeEvent } from "@mui/material/Select";
|
||||
import MenuItem from "@mui/material/MenuItem";
|
||||
import { FactionNames } from "../../../Faction/data/FactionNames";
|
||||
import { Contract } from "../../../Bladeburner/Contract";
|
||||
|
||||
const universitySelectorOptions: string[] = [
|
||||
"Study Computer Science",
|
||||
@ -95,7 +94,7 @@ function possibleContracts(player: IPlayer, sleeve: Sleeve): string[] {
|
||||
if (sleeve === otherSleeve) {
|
||||
continue;
|
||||
}
|
||||
if (otherSleeve.currentTask === SleeveTaskType.Bladeburner
|
||||
if (otherSleeve.currentTask === SleeveTaskType.Bladeburner
|
||||
&& otherSleeve.bbAction == 'Take on Contracts') {
|
||||
contracts = contracts.filter(x => x != otherSleeve.bbContract);
|
||||
}
|
||||
@ -192,8 +191,8 @@ const tasks: {
|
||||
return { first: gymSelectorOptions, second: () => gyms };
|
||||
},
|
||||
"Perform Bladeburner Actions": (player: IPlayer, sleeve: Sleeve): ITaskDetails => {
|
||||
return {
|
||||
first: bladeburnerSelectorOptions,
|
||||
return {
|
||||
first: bladeburnerSelectorOptions,
|
||||
second: (s1: string) => {
|
||||
if(s1 === "Take on Contracts"){
|
||||
return possibleContracts(player, sleeve);
|
||||
|
Loading…
Reference in New Issue
Block a user