mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-19 22:23:51 +01:00
Format, but git forgot this last time
This commit is contained in:
parent
3886e31a45
commit
9d18118208
@ -138,7 +138,7 @@ export function NetscriptBladeburner(
|
||||
if (bladeburner === null) throw new Error("Should not be called without Bladeburner");
|
||||
try {
|
||||
const time = bladeburner.getActionTimeNetscriptFn(player, type, name);
|
||||
if(typeof time === 'string'){
|
||||
if (typeof time === "string") {
|
||||
const errorLogText = `Invalid action: type='${type}' name='${name}'`;
|
||||
workerScript.log("bladeburner.getActionTime", () => errorLogText);
|
||||
return -1;
|
||||
@ -158,7 +158,7 @@ export function NetscriptBladeburner(
|
||||
if (bladeburner === null) throw new Error("Should not be called without Bladeburner");
|
||||
try {
|
||||
const chance = bladeburner.getActionEstimatedSuccessChanceNetscriptFn(player, type, name);
|
||||
if(typeof chance === 'string'){
|
||||
if (typeof chance === "string") {
|
||||
const errorLogText = `Invalid action: type='${type}' name='${name}'`;
|
||||
workerScript.log("bladeburner.getActionTime", () => errorLogText);
|
||||
return [-1, -1];
|
||||
|
@ -4,61 +4,61 @@
|
||||
import { ITaskTracker } from "./ITaskTracker";
|
||||
|
||||
export interface IPerson {
|
||||
// Stats
|
||||
hacking: number;
|
||||
strength: number;
|
||||
defense: number;
|
||||
dexterity: number;
|
||||
agility: number;
|
||||
charisma: number;
|
||||
intelligence: number;
|
||||
hp: number;
|
||||
max_hp: number;
|
||||
money: number;
|
||||
// Stats
|
||||
hacking: number;
|
||||
strength: number;
|
||||
defense: number;
|
||||
dexterity: number;
|
||||
agility: number;
|
||||
charisma: number;
|
||||
intelligence: number;
|
||||
hp: number;
|
||||
max_hp: number;
|
||||
money: number;
|
||||
|
||||
// Experience
|
||||
hacking_exp: number;
|
||||
strength_exp: number;
|
||||
defense_exp: number;
|
||||
dexterity_exp: number;
|
||||
agility_exp: number;
|
||||
charisma_exp: number;
|
||||
intelligence_exp: number;
|
||||
// Experience
|
||||
hacking_exp: number;
|
||||
strength_exp: number;
|
||||
defense_exp: number;
|
||||
dexterity_exp: number;
|
||||
agility_exp: number;
|
||||
charisma_exp: number;
|
||||
intelligence_exp: number;
|
||||
|
||||
// Multipliers
|
||||
hacking_exp_mult: number;
|
||||
strength_exp_mult: number;
|
||||
defense_exp_mult: number;
|
||||
dexterity_exp_mult: number;
|
||||
agility_exp_mult: number;
|
||||
charisma_exp_mult: number;
|
||||
hacking_mult: number;
|
||||
strength_mult: number;
|
||||
defense_mult: number;
|
||||
dexterity_mult: number;
|
||||
agility_mult: number;
|
||||
charisma_mult: number;
|
||||
// Multipliers
|
||||
hacking_exp_mult: number;
|
||||
strength_exp_mult: number;
|
||||
defense_exp_mult: number;
|
||||
dexterity_exp_mult: number;
|
||||
agility_exp_mult: number;
|
||||
charisma_exp_mult: number;
|
||||
hacking_mult: number;
|
||||
strength_mult: number;
|
||||
defense_mult: number;
|
||||
dexterity_mult: number;
|
||||
agility_mult: number;
|
||||
charisma_mult: number;
|
||||
|
||||
company_rep_mult: number;
|
||||
faction_rep_mult: number;
|
||||
company_rep_mult: number;
|
||||
faction_rep_mult: number;
|
||||
|
||||
crime_money_mult: number;
|
||||
crime_success_mult: number;
|
||||
crime_money_mult: number;
|
||||
crime_success_mult: number;
|
||||
|
||||
bladeburner_analysis_mult: number;
|
||||
bladeburner_analysis_mult: number;
|
||||
|
||||
getIntelligenceBonus(weight: number): number;
|
||||
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;
|
||||
takeDamage(amt: number): boolean;
|
||||
regenerateHp: (amt: number) => void;
|
||||
queryStatFromString: (str: string) => number;
|
||||
whoAmI: () => string;
|
||||
}
|
||||
getIntelligenceBonus(weight: number): number;
|
||||
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;
|
||||
takeDamage(amt: number): boolean;
|
||||
regenerateHp: (amt: number) => void;
|
||||
queryStatFromString: (str: string) => number;
|
||||
whoAmI: () => string;
|
||||
}
|
||||
|
@ -1,25 +1,25 @@
|
||||
// Interface that defines a generic object used to track experience/money
|
||||
// earnings for tasks
|
||||
export interface ITaskTracker {
|
||||
hack: number;
|
||||
str: number;
|
||||
def: number;
|
||||
dex: number;
|
||||
agi: number;
|
||||
cha: number;
|
||||
int: number;
|
||||
money: number;
|
||||
}
|
||||
hack: number;
|
||||
str: number;
|
||||
def: number;
|
||||
dex: number;
|
||||
agi: number;
|
||||
cha: number;
|
||||
int: number;
|
||||
money: number;
|
||||
}
|
||||
|
||||
export function createTaskTracker(): ITaskTracker {
|
||||
return {
|
||||
hack: 0,
|
||||
str: 0,
|
||||
def: 0,
|
||||
dex: 0,
|
||||
agi: 0,
|
||||
cha: 0,
|
||||
int: 0,
|
||||
money: 0,
|
||||
};
|
||||
}
|
||||
export function createTaskTracker(): ITaskTracker {
|
||||
return {
|
||||
hack: 0,
|
||||
str: 0,
|
||||
def: 0,
|
||||
dex: 0,
|
||||
agi: 0,
|
||||
cha: 0,
|
||||
int: 0,
|
||||
money: 0,
|
||||
};
|
||||
}
|
||||
|
@ -304,8 +304,8 @@ export class PlayerObject implements IPlayer {
|
||||
graftAugmentationWork: (numCycles: number) => boolean;
|
||||
finishGraftAugmentationWork: (cancelled: boolean) => string;
|
||||
applyEntropy: (stacks?: number) => void;
|
||||
whoAmI(): string{
|
||||
return 'Player';
|
||||
whoAmI(): string {
|
||||
return "Player";
|
||||
}
|
||||
|
||||
constructor() {
|
||||
|
@ -225,7 +225,7 @@ export class Sleeve extends Person {
|
||||
const bb = p.bladeburner;
|
||||
if (bb === null) {
|
||||
const errorLogText = `bladeburner is null`;
|
||||
console.error(`Function: sleeves.finishTask; Message: '${errorLogText}'`)
|
||||
console.error(`Function: sleeves.finishTask; Message: '${errorLogText}'`);
|
||||
this.resetTaskStatus(p);
|
||||
return retValue;
|
||||
}
|
||||
@ -240,25 +240,25 @@ export class Sleeve extends Person {
|
||||
let type: string;
|
||||
let name: string;
|
||||
if (this.bbAction === "Take on Contracts") {
|
||||
type = 'Contracts';
|
||||
type = "Contracts";
|
||||
name = this.bbContract;
|
||||
} else {
|
||||
type = 'General';
|
||||
type = "General";
|
||||
name = this.bbAction;
|
||||
}
|
||||
|
||||
const actionIdent = bb.getActionIdFromTypeAndName(type, name);
|
||||
if(actionIdent === null) {
|
||||
if (actionIdent === null) {
|
||||
const errorLogText = `Invalid action: type='${type}' name='${name}'`;
|
||||
console.error(`Function: sleeves.finishTask; Message: '${errorLogText}'`)
|
||||
console.error(`Function: sleeves.finishTask; Message: '${errorLogText}'`);
|
||||
this.resetTaskStatus(p);
|
||||
return retValue;
|
||||
}
|
||||
|
||||
const action = bb.getActionObject(actionIdent);
|
||||
if((action?.count ?? 0) > 0) {
|
||||
if ((action?.count ?? 0) > 0) {
|
||||
const bbRetValue = bb.completeAction(p, this, actionIdent);
|
||||
if(bbRetValue) {
|
||||
if (bbRetValue) {
|
||||
retValue = this.gainExperience(p, bbRetValue);
|
||||
this.gainMoney(p, bbRetValue);
|
||||
|
||||
@ -633,13 +633,13 @@ export class Sleeve extends Person {
|
||||
* Resets all parameters used to keep information about the current task
|
||||
*/
|
||||
resetTaskStatus(p: IPlayer): void {
|
||||
if (this.bbAction == 'Support main sleeve') {
|
||||
if (this.bbAction == "Support main sleeve") {
|
||||
p.bladeburner?.sleeveSupport(false);
|
||||
}
|
||||
if (this.currentTask == SleeveTaskType.Class) {
|
||||
const retVal = createTaskTracker();
|
||||
retVal.int = CONSTANTS.IntelligenceClassBaseExpGain * Math.round(this.currentTaskTime / 1000);
|
||||
this.gainExperience(p, retVal);//Wont be shared with other sleeves
|
||||
this.gainExperience(p, retVal); //Wont be shared with other sleeves
|
||||
}
|
||||
this.earningsForTask = createTaskTracker();
|
||||
this.gainRatesForTask = createTaskTracker();
|
||||
@ -1080,23 +1080,23 @@ export class Sleeve extends Person {
|
||||
this.gainRatesForTask.agi = 0;
|
||||
this.gainRatesForTask.cha = 0;
|
||||
this.gainRatesForTask.money = 0;
|
||||
this.currentTaskLocation = '';
|
||||
this.currentTaskLocation = "";
|
||||
|
||||
let time = 0;
|
||||
switch (action) {
|
||||
case "Field Analysis":
|
||||
time = this.getBladeburnerActionTime(p, 'General', action);
|
||||
time = this.getBladeburnerActionTime(p, "General", action);
|
||||
this.gainRatesForTask.hack = 20 * this.hacking_exp_mult;
|
||||
this.gainRatesForTask.cha = 20 * this.charisma_exp_mult;
|
||||
break;
|
||||
case "Recruitment":
|
||||
time = this.getBladeburnerActionTime(p, 'General', action);
|
||||
time = this.getBladeburnerActionTime(p, "General", action);
|
||||
const recruitTime = (p.bladeburner?.getRecruitmentTime(this) ?? 0) * 1000;
|
||||
this.gainRatesForTask.cha = 2 * BladeburnerConstants.BaseStatGain * recruitTime;
|
||||
this.currentTaskLocation = (p.bladeburner?.getRecruitmentSuccessChance(this) ?? 0).toString() + '%';
|
||||
this.currentTaskLocation = (p.bladeburner?.getRecruitmentSuccessChance(this) ?? 0).toString() + "%";
|
||||
break;
|
||||
case "Diplomacy":
|
||||
time = this.getBladeburnerActionTime(p, 'General', action);
|
||||
time = this.getBladeburnerActionTime(p, "General", action);
|
||||
break;
|
||||
case "Infiltrate synthoids":
|
||||
time = 60000;
|
||||
@ -1106,9 +1106,9 @@ export class Sleeve extends Person {
|
||||
time = 0;
|
||||
break;
|
||||
case "Take on Contracts":
|
||||
time = this.getBladeburnerActionTime(p, 'Contracts', contract);
|
||||
this.contractGainRates(p, 'Contracts', contract);
|
||||
this.currentTaskLocation = this.contractSuccessChance(p, 'Contracts', contract);
|
||||
time = this.getBladeburnerActionTime(p, "Contracts", contract);
|
||||
this.contractGainRates(p, "Contracts", contract);
|
||||
this.currentTaskLocation = this.contractSuccessChance(p, "Contracts", contract);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1121,41 +1121,41 @@ export class Sleeve extends Person {
|
||||
|
||||
contractSuccessChance(p: IPlayer, type: string, name: string): string {
|
||||
const bb = p.bladeburner;
|
||||
if(bb === null){
|
||||
if (bb === null) {
|
||||
const errorLogText = `bladeburner is null`;
|
||||
console.error(`Function: sleeves.contractSuccessChance; Message: '${errorLogText}'`)
|
||||
return '0%';
|
||||
console.error(`Function: sleeves.contractSuccessChance; Message: '${errorLogText}'`);
|
||||
return "0%";
|
||||
}
|
||||
const chances = bb.getActionEstimatedSuccessChanceNetscriptFn(this, type, name);
|
||||
if(typeof chances === 'string'){
|
||||
console.error(`Function: sleeves.contractSuccessChance; Message: '${chances}'`)
|
||||
return '0%';
|
||||
if (typeof chances === "string") {
|
||||
console.error(`Function: sleeves.contractSuccessChance; Message: '${chances}'`);
|
||||
return "0%";
|
||||
}
|
||||
if(chances[0] >= 1) {
|
||||
return '100%';
|
||||
if (chances[0] >= 1) {
|
||||
return "100%";
|
||||
} else {
|
||||
return `${chances[0]*100}% - ${chances[1]*100}%`;
|
||||
return `${chances[0] * 100}% - ${chances[1] * 100}%`;
|
||||
}
|
||||
}
|
||||
|
||||
contractGainRates(p: IPlayer, type: string, name: string): void {
|
||||
const bb = p.bladeburner;
|
||||
if(bb === null){
|
||||
if (bb === null) {
|
||||
const errorLogText = `bladeburner is null`;
|
||||
console.error(`Function: sleeves.contractGainRates; Message: '${errorLogText}'`)
|
||||
console.error(`Function: sleeves.contractGainRates; Message: '${errorLogText}'`);
|
||||
return;
|
||||
}
|
||||
const actionIdent = bb.getActionIdFromTypeAndName(type, name);
|
||||
if(actionIdent === null) {
|
||||
if (actionIdent === null) {
|
||||
const errorLogText = `Invalid action: type='${type}' name='${name}'`;
|
||||
console.error(`Function: sleeves.contractGainRates; Message: '${errorLogText}'`)
|
||||
console.error(`Function: sleeves.contractGainRates; Message: '${errorLogText}'`);
|
||||
this.resetTaskStatus(p);
|
||||
return;
|
||||
}
|
||||
const action = bb.getActionObject(actionIdent);
|
||||
if(action === null) {
|
||||
if (action === null) {
|
||||
const errorLogText = `Invalid action: type='${type}' name='${name}'`;
|
||||
console.error(`Function: sleeves.contractGainRates; Message: '${errorLogText}'`)
|
||||
console.error(`Function: sleeves.contractGainRates; Message: '${errorLogText}'`);
|
||||
this.resetTaskStatus(p);
|
||||
return;
|
||||
}
|
||||
@ -1167,28 +1167,30 @@ 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
|
||||
getBladeburnerActionTime(p: IPlayer, type: string, name: string): number {
|
||||
//Maybe find workerscript and use original
|
||||
const bb = p.bladeburner;
|
||||
if(bb === null){
|
||||
if (bb === null) {
|
||||
const errorLogText = `bladeburner is null`;
|
||||
console.error(`Function: sleeves.getBladeburnerActionTime; Message: '${errorLogText}'`)
|
||||
console.error(`Function: sleeves.getBladeburnerActionTime; Message: '${errorLogText}'`);
|
||||
return -1;
|
||||
}
|
||||
|
||||
const time = bb.getActionTimeNetscriptFn(this, type, name);
|
||||
if(typeof time === 'string'){
|
||||
if (typeof time === "string") {
|
||||
const errorLogText = `Invalid action: type='${type}' name='${name}'`;
|
||||
console.error(`Function: sleeves.getBladeburnerActionTime; Message: '${errorLogText}'`)
|
||||
console.error(`Function: sleeves.getBladeburnerActionTime; Message: '${errorLogText}'`);
|
||||
return -1;
|
||||
} else {
|
||||
return time;
|
||||
}
|
||||
}
|
||||
|
||||
takeDamage(amt: number):boolean {
|
||||
takeDamage(amt: number): boolean {
|
||||
if (typeof amt !== "number") {
|
||||
console.warn(`Player.takeDamage() called without a numeric argument: ${amt}`);
|
||||
return false;
|
||||
@ -1205,7 +1207,7 @@ export class Sleeve extends Person {
|
||||
}
|
||||
|
||||
whoAmI(): string {
|
||||
return 'Sleeve';
|
||||
return "Sleeve";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -114,11 +114,16 @@ export function SleeveElem(props: IProps): React.ReactElement {
|
||||
desc = <>This sleeve is currently working out at {props.sleeve.currentTaskLocation}.</>;
|
||||
break;
|
||||
case SleeveTaskType.Bladeburner:
|
||||
let contract = '';
|
||||
if (props.sleeve.bbContract !== '------') {
|
||||
let contract = "";
|
||||
if (props.sleeve.bbContract !== "------") {
|
||||
contract = ` - ${props.sleeve.bbContract} (Success Rate: ${props.sleeve.currentTaskLocation})`;
|
||||
}
|
||||
desc = <>This sleeve is currently attempting to {props.sleeve.bbAction}{contract}</>
|
||||
desc = (
|
||||
<>
|
||||
This sleeve is currently attempting to {props.sleeve.bbAction}
|
||||
{contract}
|
||||
</>
|
||||
);
|
||||
break;
|
||||
case SleeveTaskType.Recovery:
|
||||
desc = (
|
||||
@ -186,10 +191,10 @@ export function SleeveElem(props: IProps): React.ReactElement {
|
||||
</Button>
|
||||
<Typography>{desc}</Typography>
|
||||
<Typography>
|
||||
{(props.sleeve.currentTask === SleeveTaskType.Crime
|
||||
|| props.sleeve.currentTask === SleeveTaskType.Bladeburner)
|
||||
&& props.sleeve.currentTaskMaxTime > 0
|
||||
&& createProgressBarText({
|
||||
{(props.sleeve.currentTask === SleeveTaskType.Crime ||
|
||||
props.sleeve.currentTask === SleeveTaskType.Bladeburner) &&
|
||||
props.sleeve.currentTaskMaxTime > 0 &&
|
||||
createProgressBarText({
|
||||
progress: props.sleeve.currentTaskTime / props.sleeve.currentTaskMaxTime,
|
||||
totalTicks: 25,
|
||||
})}
|
||||
|
@ -22,7 +22,14 @@ const universitySelectorOptions: string[] = [
|
||||
|
||||
const gymSelectorOptions: string[] = ["Train Strength", "Train Defense", "Train Dexterity", "Train Agility"];
|
||||
|
||||
const bladeburnerSelectorOptions: string[] = ["Field Analysis", "Recruitment", "Diplomacy", "Infiltrate synthoids", "Support main sleeve", "Take on Contracts"];
|
||||
const bladeburnerSelectorOptions: string[] = [
|
||||
"Field Analysis",
|
||||
"Recruitment",
|
||||
"Diplomacy",
|
||||
"Infiltrate synthoids",
|
||||
"Support main sleeve",
|
||||
"Take on Contracts",
|
||||
];
|
||||
|
||||
interface IProps {
|
||||
sleeve: Sleeve;
|
||||
@ -86,7 +93,7 @@ function possibleFactions(player: IPlayer, sleeve: Sleeve): string[] {
|
||||
|
||||
function possibleContracts(player: IPlayer, sleeve: Sleeve): string[] {
|
||||
const bb = player.bladeburner;
|
||||
if(bb === null){
|
||||
if (bb === null) {
|
||||
return ["------"];
|
||||
}
|
||||
let contracts = bb.getContractNamesNetscriptFn();
|
||||
@ -94,12 +101,11 @@ function possibleContracts(player: IPlayer, sleeve: Sleeve): string[] {
|
||||
if (sleeve === otherSleeve) {
|
||||
continue;
|
||||
}
|
||||
if (otherSleeve.currentTask === SleeveTaskType.Bladeburner
|
||||
&& otherSleeve.bbAction == 'Take on Contracts') {
|
||||
contracts = contracts.filter(x => x != otherSleeve.bbContract);
|
||||
if (otherSleeve.currentTask === SleeveTaskType.Bladeburner && otherSleeve.bbAction == "Take on Contracts") {
|
||||
contracts = contracts.filter((x) => x != otherSleeve.bbContract);
|
||||
}
|
||||
}
|
||||
if(contracts.length === 0){
|
||||
if (contracts.length === 0) {
|
||||
return ["------"];
|
||||
}
|
||||
return contracts;
|
||||
@ -194,12 +200,13 @@ const tasks: {
|
||||
return {
|
||||
first: bladeburnerSelectorOptions,
|
||||
second: (s1: string) => {
|
||||
if(s1 === "Take on Contracts"){
|
||||
if (s1 === "Take on Contracts") {
|
||||
return possibleContracts(player, sleeve);
|
||||
} else {
|
||||
return ["------"];
|
||||
}
|
||||
} };
|
||||
},
|
||||
};
|
||||
},
|
||||
"Shock Recovery": (): ITaskDetails => {
|
||||
return { first: ["------"], second: () => ["------"] };
|
||||
|
Loading…
Reference in New Issue
Block a user