Using bladeburner and action classes as types

This commit is contained in:
Snarling 2022-09-20 02:15:58 -04:00
parent c510e47885
commit 2213d06159
34 changed files with 88 additions and 282 deletions

@ -3,10 +3,13 @@ import { getRandomInt } from "../utils/helpers/getRandomInt";
import { addOffset } from "../utils/helpers/addOffset"; import { addOffset } from "../utils/helpers/addOffset";
import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../utils/JSONReviver"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../utils/JSONReviver";
import { BladeburnerConstants } from "./data/Constants"; import { BladeburnerConstants } from "./data/Constants";
import { IBladeburner } from "./IBladeburner"; import { Bladeburner } from "./Bladeburner";
import { IAction, ISuccessChanceParams } from "./IAction";
import { Person } from "../PersonObjects/Person"; import { Person } from "../PersonObjects/Person";
interface ISuccessChanceParams {
est: boolean;
}
class StatsMultiplier { class StatsMultiplier {
[key: string]: number; [key: string]: number;
@ -41,7 +44,7 @@ export interface IActionParams {
teamCount?: number; teamCount?: number;
} }
export class Action implements IAction { export class Action {
name = ""; name = "";
// Difficulty scales with level. See getDifficulty() method // Difficulty scales with level. See getDifficulty() method
@ -153,7 +156,7 @@ export class Action implements IAction {
* Tests for success. Should be called when an action has completed * Tests for success. Should be called when an action has completed
* @param inst {Bladeburner} - Bladeburner instance * @param inst {Bladeburner} - Bladeburner instance
*/ */
attempt(inst: IBladeburner, person: Person): boolean { attempt(inst: Bladeburner, person: Person): boolean {
return Math.random() < this.getSuccessChance(inst, person); return Math.random() < this.getSuccessChance(inst, person);
} }
@ -162,7 +165,7 @@ export class Action implements IAction {
return 1; return 1;
} }
getActionTime(inst: IBladeburner, person: Person): number { getActionTime(inst: Bladeburner, person: Person): number {
const difficulty = this.getDifficulty(); const difficulty = this.getDifficulty();
let baseTime = difficulty / BladeburnerConstants.DifficultyToTimeFactor; let baseTime = difficulty / BladeburnerConstants.DifficultyToTimeFactor;
const skillFac = inst.skillMultipliers.actionTime; // Always < 1 const skillFac = inst.skillMultipliers.actionTime; // Always < 1
@ -183,16 +186,16 @@ export class Action implements IAction {
// For actions that have teams. To be implemented by subtypes. // For actions that have teams. To be implemented by subtypes.
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
getTeamSuccessBonus(inst: IBladeburner): number { getTeamSuccessBonus(inst: Bladeburner): number {
return 1; return 1;
} }
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
getActionTypeSkillSuccessBonus(inst: IBladeburner): number { getActionTypeSkillSuccessBonus(inst: Bladeburner): number {
return 1; return 1;
} }
getChaosCompetencePenalty(inst: IBladeburner, params: ISuccessChanceParams): number { getChaosCompetencePenalty(inst: Bladeburner, params: ISuccessChanceParams): number {
const city = inst.getCurrentCity(); const city = inst.getCurrentCity();
if (params.est) { if (params.est) {
return Math.pow(city.popEst / BladeburnerConstants.PopulationThreshold, BladeburnerConstants.PopulationExponent); return Math.pow(city.popEst / BladeburnerConstants.PopulationThreshold, BladeburnerConstants.PopulationExponent);
@ -201,7 +204,7 @@ export class Action implements IAction {
} }
} }
getChaosDifficultyBonus(inst: IBladeburner /*, params: ISuccessChanceParams*/): number { getChaosDifficultyBonus(inst: Bladeburner /*, params: ISuccessChanceParams*/): number {
const city = inst.getCurrentCity(); const city = inst.getCurrentCity();
if (city.chaos > BladeburnerConstants.ChaosThreshold) { if (city.chaos > BladeburnerConstants.ChaosThreshold) {
const diff = 1 + (city.chaos - BladeburnerConstants.ChaosThreshold); const diff = 1 + (city.chaos - BladeburnerConstants.ChaosThreshold);
@ -212,7 +215,7 @@ export class Action implements IAction {
return 1; return 1;
} }
getEstSuccessChance(inst: IBladeburner, person: Person): [number, number] { getEstSuccessChance(inst: Bladeburner, person: Person): [number, number] {
function clamp(x: number): number { function clamp(x: number): number {
return Math.max(0, Math.min(x, 1)); return Math.max(0, Math.min(x, 1));
} }
@ -233,7 +236,7 @@ export class Action implements IAction {
* @params - options: * @params - options:
* est (bool): Get success chance estimate instead of real success chance * est (bool): Get success chance estimate instead of real success chance
*/ */
getSuccessChance(inst: IBladeburner, person: Person, params: ISuccessChanceParams = { est: false }): number { getSuccessChance(inst: Bladeburner, person: Person, params: ISuccessChanceParams = { est: false }): number {
if (inst == null) { if (inst == null) {
throw new Error("Invalid Bladeburner instance passed into Action.getSuccessChance"); throw new Error("Invalid Bladeburner instance passed into Action.getSuccessChance");
} }

@ -12,11 +12,11 @@ export class BlackOperation extends Operation {
return 1.5; return 1.5;
} }
getChaosCompetencePenalty(/*inst: IBladeburner, params: ISuccessChanceParams*/): number { getChaosCompetencePenalty(/*inst: Bladeburner, params: ISuccessChanceParams*/): number {
return 1; return 1;
} }
getChaosDifficultyBonus(/*inst: IBladeburner, params: ISuccessChanceParams*/): number { getChaosDifficultyBonus(/*inst: Bladeburner, params: ISuccessChanceParams*/): number {
return 1; return 1;
} }

@ -1,5 +1,4 @@
import { Reviver, Generic_toJSON, Generic_fromJSON, IReviverValue } from "../utils/JSONReviver"; import { Reviver, Generic_toJSON, Generic_fromJSON, IReviverValue } from "../utils/JSONReviver";
import { IBladeburner } from "./IBladeburner";
import { IActionIdentifier } from "./IActionIdentifier"; import { IActionIdentifier } from "./IActionIdentifier";
import { ActionIdentifier } from "./ActionIdentifier"; import { ActionIdentifier } from "./ActionIdentifier";
import { ActionTypes } from "./data/ActionTypes"; import { ActionTypes } from "./data/ActionTypes";
@ -13,7 +12,7 @@ import { formatNumber } from "../utils/StringHelperFunctions";
import { Skills } from "./Skills"; import { Skills } from "./Skills";
import { Skill } from "./Skill"; import { Skill } from "./Skill";
import { City } from "./City"; import { City } from "./City";
import { IAction } from "./IAction"; import { Action } from "./Action";
import { Player } from "../Player"; import { Player } from "../Player";
import { createTaskTracker, ITaskTracker } from "../PersonObjects/ITaskTracker"; import { createTaskTracker, ITaskTracker } from "../PersonObjects/ITaskTracker";
import { Person } from "../PersonObjects/Person"; import { Person } from "../PersonObjects/Person";
@ -45,7 +44,7 @@ export interface BlackOpsAttempt {
action?: BlackOperation; action?: BlackOperation;
} }
export class Bladeburner implements IBladeburner { export class Bladeburner {
numHosp = 0; numHosp = 0;
moneyLost = 0; moneyLost = 0;
rank = 0; rank = 0;
@ -995,7 +994,7 @@ export class Bladeburner implements IBladeburner {
* @param action(Action obj) - Derived action class * @param action(Action obj) - Derived action class
* @param success(bool) - Whether action was successful * @param success(bool) - Whether action was successful
*/ */
getActionStats(action: IAction, person: Person, success: boolean): ITaskTracker { getActionStats(action: Action, person: Person, success: boolean): ITaskTracker {
const difficulty = action.getDifficulty(); const difficulty = action.getDifficulty();
/** /**
@ -1202,7 +1201,7 @@ export class Bladeburner implements IBladeburner {
} }
} }
getActionObject(actionId: IActionIdentifier): IAction | null { getActionObject(actionId: IActionIdentifier): Action | null {
/** /**
* Given an ActionIdentifier object, returns the corresponding * Given an ActionIdentifier object, returns the corresponding
* GeneralAction, Contract, Operation, or BlackOperation object * GeneralAction, Contract, Operation, or BlackOperation object

@ -1,4 +1,4 @@
import { IBladeburner } from "./IBladeburner"; import { Bladeburner } from "./Bladeburner";
import { Action, IActionParams } from "./Action"; import { Action, IActionParams } from "./Action";
import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../utils/JSONReviver"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../utils/JSONReviver";
@ -7,7 +7,7 @@ export class Contract extends Action {
super(params); super(params);
} }
getActionTypeSkillSuccessBonus(inst: IBladeburner): number { getActionTypeSkillSuccessBonus(inst: Bladeburner): number {
return inst.skillMultipliers.successChanceContract; return inst.skillMultipliers.successChanceContract;
} }

@ -1,72 +0,0 @@
import { IReviverValue } from "../utils/JSONReviver";
import { Person } from "../PersonObjects/Person";
import { IBladeburner } from "./IBladeburner";
interface IStatsMultiplier {
[key: string]: number;
hack: number;
str: number;
def: number;
dex: number;
agi: number;
cha: number;
int: number;
}
export interface ISuccessChanceParams {
est: boolean;
}
export interface IAction {
name: string;
// Difficulty scales with level. See getDifficulty() method
level: number;
maxLevel: number;
autoLevel: boolean;
baseDifficulty: number;
difficultyFac: number;
// Rank increase/decrease is affected by this exponent
rewardFac: number;
successes: number;
failures: number;
// All of these scale with level/difficulty
rankGain: number;
rankLoss: number;
hpLoss: number;
hpLost: number;
// Action Category. Current categories are stealth and kill
isStealth: boolean;
isKill: boolean;
/**
* Number of this contract remaining, and its growth rate
* Growth rate is an integer and the count will increase by that integer every "cycle"
*/
count: number;
// Weighting of each stat in determining action success rate
weights: IStatsMultiplier;
// Diminishing returns of stats (stat ^ decay where 0 <= decay <= 1)
decays: IStatsMultiplier;
teamCount: number;
getDifficulty(): number;
attempt(inst: IBladeburner, person: Person): boolean;
getActionTimePenalty(): number;
getActionTime(inst: IBladeburner, person: Person): number;
getTeamSuccessBonus(inst: IBladeburner): number;
getActionTypeSkillSuccessBonus(inst: IBladeburner): number;
getChaosCompetencePenalty(inst: IBladeburner, params: ISuccessChanceParams): number;
getChaosDifficultyBonus(inst: IBladeburner): number;
getEstSuccessChance(inst: IBladeburner, person: Person): [number, number];
getSuccessChance(inst: IBladeburner, person: Person, params: ISuccessChanceParams): number;
getSuccessesNeededForNextLevel(baseSuccessesPerLevel: number): number;
setMaxLevel(baseSuccessesPerLevel: number): void;
toJSON(): IReviverValue;
}

@ -1,124 +0,0 @@
import { IActionIdentifier } from "./IActionIdentifier";
import { City } from "./City";
import { Skill } from "./Skill";
import { IAction } from "./IAction";
import { Person } from "../PersonObjects/Person";
import { ITaskTracker } from "../PersonObjects/ITaskTracker";
import { WorkerScript } from "../Netscript/WorkerScript";
import { Contract } from "./Contract";
import { Operation } from "./Operation";
import { IReviverValue } from "../utils/JSONReviver";
import { BlackOpsAttempt } from "./Bladeburner";
export interface IBladeburner {
numHosp: number;
moneyLost: number;
rank: number;
maxRank: number;
skillPoints: number;
totalSkillPoints: number;
teamSize: number;
sleeveSize: number;
teamLost: number;
hpLost: number;
storedCycles: number;
randomEventCounter: number;
actionTimeToComplete: number;
actionTimeCurrent: number;
actionTimeOverflow: number;
action: IActionIdentifier;
cities: Record<string, City>;
city: string;
skills: Record<string, number>;
skillMultipliers: Record<string, number>;
staminaBonus: number;
maxStamina: number;
stamina: number;
contracts: Record<string, Contract>;
operations: Record<string, Operation>;
blackops: Record<string, boolean>;
logging: {
general: boolean;
contracts: boolean;
ops: boolean;
blackops: boolean;
events: boolean;
};
automateEnabled: boolean;
automateActionHigh: IActionIdentifier;
automateThreshHigh: number;
automateActionLow: IActionIdentifier;
automateThreshLow: number;
consoleHistory: string[];
consoleLogs: string[];
getCurrentCity(): City;
calculateStaminaPenalty(): number;
canAttemptBlackOp(actionId: IActionIdentifier): BlackOpsAttempt;
startAction(action: IActionIdentifier): void;
upgradeSkill(skill: Skill): void;
executeConsoleCommands(command: string): void;
postToConsole(input: string, saveToLogs?: boolean): void;
log(input: string): void;
resetAction(): void;
clearConsole(): void;
prestige(): void;
storeCycles(numCycles?: number): void;
getTypeAndNameFromActionId(actionId: IActionIdentifier): {
type: string;
name: string;
};
getContractNamesNetscriptFn(): string[];
getOperationNamesNetscriptFn(): string[];
getBlackOpNamesNetscriptFn(): string[];
getGeneralActionNamesNetscriptFn(): string[];
getSkillNamesNetscriptFn(): string[];
startActionNetscriptFn(type: string, name: string, workerScript: WorkerScript): boolean;
getActionTimeNetscriptFn(person: Person, type: string, name: string): number | string;
getActionEstimatedSuccessChanceNetscriptFn(person: Person, type: string, name: string): [number, number] | string;
getActionCountRemainingNetscriptFn(type: string, name: string, workerScript: WorkerScript): number;
getSkillLevelNetscriptFn(skillName: string, workerScript: WorkerScript): number;
getSkillUpgradeCostNetscriptFn(skillName: string, count: number, workerScript: WorkerScript): number;
upgradeSkillNetscriptFn(skillName: string, count: number, workerScript: WorkerScript): boolean;
getTeamSizeNetscriptFn(type: string, name: string, workerScript: WorkerScript): number;
setTeamSizeNetscriptFn(type: string, name: string, size: number, workerScript: WorkerScript): number;
joinBladeburnerFactionNetscriptFn(workerScript: WorkerScript): boolean;
getActionIdFromTypeAndName(type: string, name: string): IActionIdentifier | null;
executeStartConsoleCommand(args: string[]): void;
executeSkillConsoleCommand(args: string[]): void;
executeLogConsoleCommand(args: string[]): void;
executeHelpConsoleCommand(args: string[]): void;
executeAutomateConsoleCommand(args: string[]): void;
parseCommandArguments(command: string): string[];
executeConsoleCommand(command: string): void;
triggerMigration(sourceCityName: string): void;
triggerPotentialMigration(sourceCityName: string, chance: number): void;
randomEvent(): void;
getDiplomacyEffectiveness(person: Person): number;
getRecruitmentSuccessChance(person: Person): number;
getRecruitmentTime(person: Person): number;
resetSkillMultipliers(): void;
updateSkillMultipliers(): void;
completeOperation(success: boolean): void;
getActionObject(actionId: IActionIdentifier): IAction | null;
completeContract(success: boolean, actionIdent: IActionIdentifier): void;
completeAction(person: Person, actionIdent: IActionIdentifier, isPlayer?: boolean): ITaskTracker;
infiltrateSynthoidCommunities(): void;
changeRank(person: Person, change: number): void;
processAction(seconds: number): void;
calculateStaminaGainPerSecond(): number;
calculateMaxStamina(): void;
create(): void;
process(): void;
getActionStats(action: IAction, person: Person, success: boolean): ITaskTracker;
sleeveSupport(joining: boolean): void;
toJSON(): IReviverValue;
}

@ -1,4 +1,4 @@
import { IBladeburner } from "./IBladeburner"; import { Bladeburner } from "./Bladeburner";
import { BladeburnerConstants } from "./data/Constants"; import { BladeburnerConstants } from "./data/Constants";
import { Action, IActionParams } from "./Action"; import { Action, IActionParams } from "./Action";
import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../utils/JSONReviver"; import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../utils/JSONReviver";
@ -19,7 +19,7 @@ export class Operation extends Action {
} }
// For actions that have teams. To be implemented by subtypes. // For actions that have teams. To be implemented by subtypes.
getTeamSuccessBonus(inst: IBladeburner): number { getTeamSuccessBonus(inst: Bladeburner): number {
if (this.teamCount && this.teamCount > 0) { if (this.teamCount && this.teamCount > 0) {
this.teamCount = Math.min(this.teamCount, inst.teamSize); this.teamCount = Math.min(this.teamCount, inst.teamSize);
const teamMultiplier = Math.pow(this.teamCount, 0.05); const teamMultiplier = Math.pow(this.teamCount, 0.05);
@ -29,11 +29,11 @@ export class Operation extends Action {
return 1; return 1;
} }
getActionTypeSkillSuccessBonus(inst: IBladeburner): number { getActionTypeSkillSuccessBonus(inst: Bladeburner): number {
return inst.skillMultipliers.successChanceOperation; return inst.skillMultipliers.successChanceOperation;
} }
getChaosDifficultyBonus(inst: IBladeburner /*, params: ISuccessChanceParams*/): number { getChaosDifficultyBonus(inst: Bladeburner /*, params: ISuccessChanceParams*/): number {
const city = inst.getCurrentCity(); const city = inst.getCurrentCity();
if (city.chaos > BladeburnerConstants.ChaosThreshold) { if (city.chaos > BladeburnerConstants.ChaosThreshold) {
const diff = 1 + (city.chaos - BladeburnerConstants.ChaosThreshold); const diff = 1 + (city.chaos - BladeburnerConstants.ChaosThreshold);

@ -1,6 +1,6 @@
import React from "react"; import React from "react";
import { IAction } from "../IAction"; import { Action } from "../Action";
import { IBladeburner } from "../IBladeburner"; import { Bladeburner } from "../Bladeburner";
import { BladeburnerConstants } from "../data/Constants"; import { BladeburnerConstants } from "../data/Constants";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
@ -11,9 +11,9 @@ import ArrowDropUpIcon from "@mui/icons-material/ArrowDropUp";
import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown"; import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown";
interface IProps { interface IProps {
action: IAction; action: Action;
isActive: boolean; isActive: boolean;
bladeburner: IBladeburner; bladeburner: Bladeburner;
rerender: () => void; rerender: () => void;
} }

@ -4,14 +4,14 @@ import { ContractPage } from "./ContractPage";
import { OperationPage } from "./OperationPage"; import { OperationPage } from "./OperationPage";
import { BlackOpPage } from "./BlackOpPage"; import { BlackOpPage } from "./BlackOpPage";
import { SkillPage } from "./SkillPage"; import { SkillPage } from "./SkillPage";
import { IBladeburner } from "../IBladeburner"; import { Bladeburner } from "../Bladeburner";
import Tabs from "@mui/material/Tabs"; import Tabs from "@mui/material/Tabs";
import Tab from "@mui/material/Tab"; import Tab from "@mui/material/Tab";
import Box from "@mui/material/Box"; import Box from "@mui/material/Box";
interface IProps { interface IProps {
bladeburner: IBladeburner; bladeburner: Bladeburner;
} }
export function AllPages(props: IProps): React.ReactElement { export function AllPages(props: IProps): React.ReactElement {

@ -1,12 +1,12 @@
import React from "react"; import React from "react";
import { IAction } from "../IAction"; import { Action } from "../Action";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import Tooltip from "@mui/material/Tooltip"; import Tooltip from "@mui/material/Tooltip";
import Box from "@mui/material/Box"; import Box from "@mui/material/Box";
import Switch from "@mui/material/Switch"; import Switch from "@mui/material/Switch";
interface IProps { interface IProps {
action: IAction; action: Action;
rerender: () => void; rerender: () => void;
} }

@ -3,7 +3,7 @@ import { formatNumber, convertTimeMsToTimeElapsedString } from "../../utils/Stri
import { ActionTypes } from "../data/ActionTypes"; import { ActionTypes } from "../data/ActionTypes";
import { createProgressBarText } from "../../utils/helpers/createProgressBarText"; import { createProgressBarText } from "../../utils/helpers/createProgressBarText";
import { TeamSizeButton } from "./TeamSizeButton"; import { TeamSizeButton } from "./TeamSizeButton";
import { IBladeburner } from "../IBladeburner"; import { Bladeburner } from "../Bladeburner";
import { BlackOperation } from "../BlackOperation"; import { BlackOperation } from "../BlackOperation";
import { BlackOperations } from "../data/BlackOperations"; import { BlackOperations } from "../data/BlackOperations";
import { Player } from "../../Player"; import { Player } from "../../Player";
@ -15,7 +15,7 @@ import Typography from "@mui/material/Typography";
import Paper from "@mui/material/Paper"; import Paper from "@mui/material/Paper";
interface IProps { interface IProps {
bladeburner: IBladeburner; bladeburner: Bladeburner;
action: BlackOperation; action: BlackOperation;
} }

@ -2,10 +2,10 @@ import React from "react";
import { BlackOperations } from "../BlackOperations"; import { BlackOperations } from "../BlackOperations";
import { BlackOperation } from "../BlackOperation"; import { BlackOperation } from "../BlackOperation";
import { BlackOpElem } from "./BlackOpElem"; import { BlackOpElem } from "./BlackOpElem";
import { IBladeburner } from "../IBladeburner"; import { Bladeburner } from "../Bladeburner";
interface IProps { interface IProps {
bladeburner: IBladeburner; bladeburner: Bladeburner;
} }
export function BlackOpList(props: IProps): React.ReactElement { export function BlackOpList(props: IProps): React.ReactElement {

@ -1,6 +1,6 @@
import * as React from "react"; import * as React from "react";
import { BlackOpList } from "./BlackOpList"; import { BlackOpList } from "./BlackOpList";
import { IBladeburner } from "../IBladeburner"; import { Bladeburner } from "../Bladeburner";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import { FactionNames } from "../../Faction/data/FactionNames"; import { FactionNames } from "../../Faction/data/FactionNames";
import { Router } from "../../ui/GameRoot"; import { Router } from "../../ui/GameRoot";
@ -9,7 +9,7 @@ import { Button } from "@mui/material";
import { CorruptableText } from "../../ui/React/CorruptableText"; import { CorruptableText } from "../../ui/React/CorruptableText";
interface IProps { interface IProps {
bladeburner: IBladeburner; bladeburner: Bladeburner;
} }
export function BlackOpPage(props: IProps): React.ReactElement { export function BlackOpPage(props: IProps): React.ReactElement {

@ -1,5 +1,5 @@
import React, { useState, useRef, useEffect } from "react"; import React, { useState, useRef, useEffect } from "react";
import { IBladeburner } from "../IBladeburner"; import { Bladeburner } from "../Bladeburner";
import { KEY } from "../../utils/helpers/keyCodes"; import { KEY } from "../../utils/helpers/keyCodes";
import Paper from "@mui/material/Paper"; import Paper from "@mui/material/Paper";
@ -48,7 +48,7 @@ function Line(props: ILineProps): React.ReactElement {
} }
interface IProps { interface IProps {
bladeburner: IBladeburner; bladeburner: Bladeburner;
} }
export function Console(props: IProps): React.ReactElement { export function Console(props: IProps): React.ReactElement {

@ -3,8 +3,8 @@ import { ActionTypes } from "../data/ActionTypes";
import { createProgressBarText } from "../../utils/helpers/createProgressBarText"; import { createProgressBarText } from "../../utils/helpers/createProgressBarText";
import { formatNumber, convertTimeMsToTimeElapsedString } from "../../utils/StringHelperFunctions"; import { formatNumber, convertTimeMsToTimeElapsedString } from "../../utils/StringHelperFunctions";
import { Contracts } from "../data/Contracts"; import { Contracts } from "../data/Contracts";
import { IBladeburner } from "../IBladeburner"; import { Bladeburner } from "../Bladeburner";
import { IAction } from "../IAction"; import { Action } from "../Action";
import { Player } from "../../Player"; import { Player } from "../../Player";
import { SuccessChance } from "./SuccessChance"; import { SuccessChance } from "./SuccessChance";
import { CopyableText } from "../../ui/React/CopyableText"; import { CopyableText } from "../../ui/React/CopyableText";
@ -16,8 +16,8 @@ import Typography from "@mui/material/Typography";
import Paper from "@mui/material/Paper"; import Paper from "@mui/material/Paper";
interface IProps { interface IProps {
bladeburner: IBladeburner; bladeburner: Bladeburner;
action: IAction; action: Action;
} }
export function ContractElem(props: IProps): React.ReactElement { export function ContractElem(props: IProps): React.ReactElement {

@ -1,9 +1,9 @@
import React from "react"; import React from "react";
import { ContractElem } from "./ContractElem"; import { ContractElem } from "./ContractElem";
import { IBladeburner } from "../IBladeburner"; import { Bladeburner } from "../Bladeburner";
interface IProps { interface IProps {
bladeburner: IBladeburner; bladeburner: Bladeburner;
} }
export function ContractList(props: IProps): React.ReactElement { export function ContractList(props: IProps): React.ReactElement {

@ -1,10 +1,10 @@
import * as React from "react"; import * as React from "react";
import { ContractList } from "./ContractList"; import { ContractList } from "./ContractList";
import { IBladeburner } from "../IBladeburner"; import { Bladeburner } from "../Bladeburner";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
interface IProps { interface IProps {
bladeburner: IBladeburner; bladeburner: Bladeburner;
} }
export function ContractPage(props: IProps): React.ReactElement { export function ContractPage(props: IProps): React.ReactElement {

@ -2,8 +2,8 @@ import React, { useState } from "react";
import { ActionTypes } from "../data/ActionTypes"; import { ActionTypes } from "../data/ActionTypes";
import { createProgressBarText } from "../../utils/helpers/createProgressBarText"; import { createProgressBarText } from "../../utils/helpers/createProgressBarText";
import { formatNumber, convertTimeMsToTimeElapsedString } from "../../utils/StringHelperFunctions"; import { formatNumber, convertTimeMsToTimeElapsedString } from "../../utils/StringHelperFunctions";
import { IBladeburner } from "../IBladeburner"; import { Bladeburner } from "../Bladeburner";
import { IAction } from "../IAction"; import { Action } from "../Action";
import { GeneralActions } from "../data/GeneralActions"; import { GeneralActions } from "../data/GeneralActions";
import { Player } from "../../Player"; import { Player } from "../../Player";
import { CopyableText } from "../../ui/React/CopyableText"; import { CopyableText } from "../../ui/React/CopyableText";
@ -15,8 +15,8 @@ import Box from "@mui/material/Box";
import Paper from "@mui/material/Paper"; import Paper from "@mui/material/Paper";
interface IProps { interface IProps {
bladeburner: IBladeburner; bladeburner: Bladeburner;
action: IAction; action: Action;
} }
export function GeneralActionElem(props: IProps): React.ReactElement { export function GeneralActionElem(props: IProps): React.ReactElement {

@ -2,10 +2,10 @@ import React from "react";
import { GeneralActionElem } from "./GeneralActionElem"; import { GeneralActionElem } from "./GeneralActionElem";
import { Action } from "../Action"; import { Action } from "../Action";
import { GeneralActions } from "../GeneralActions"; import { GeneralActions } from "../GeneralActions";
import { IBladeburner } from "../IBladeburner"; import { Bladeburner } from "../Bladeburner";
interface IProps { interface IProps {
bladeburner: IBladeburner; bladeburner: Bladeburner;
} }
export function GeneralActionList(props: IProps): React.ReactElement { export function GeneralActionList(props: IProps): React.ReactElement {

@ -1,10 +1,10 @@
import * as React from "react"; import * as React from "react";
import { GeneralActionList } from "./GeneralActionList"; import { GeneralActionList } from "./GeneralActionList";
import { IBladeburner } from "../IBladeburner"; import { Bladeburner } from "../Bladeburner";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
interface IProps { interface IProps {
bladeburner: IBladeburner; bladeburner: Bladeburner;
} }
export function GeneralActionPage(props: IProps): React.ReactElement { export function GeneralActionPage(props: IProps): React.ReactElement {

@ -7,7 +7,7 @@ import { ActionLevel } from "./ActionLevel";
import { Autolevel } from "./Autolevel"; import { Autolevel } from "./Autolevel";
import { StartButton } from "./StartButton"; import { StartButton } from "./StartButton";
import { TeamSizeButton } from "./TeamSizeButton"; import { TeamSizeButton } from "./TeamSizeButton";
import { IBladeburner } from "../IBladeburner"; import { Bladeburner } from "../Bladeburner";
import { Operation } from "../Operation"; import { Operation } from "../Operation";
import { Operations } from "../data/Operations"; import { Operations } from "../data/Operations";
import { Player } from "../../Player"; import { Player } from "../../Player";
@ -17,7 +17,7 @@ import Typography from "@mui/material/Typography";
import Paper from "@mui/material/Paper"; import Paper from "@mui/material/Paper";
interface IProps { interface IProps {
bladeburner: IBladeburner; bladeburner: Bladeburner;
action: Operation; action: Operation;
} }

@ -1,9 +1,9 @@
import React from "react"; import React from "react";
import { OperationElem } from "./OperationElem"; import { OperationElem } from "./OperationElem";
import { IBladeburner } from "../IBladeburner"; import { Bladeburner } from "../Bladeburner";
interface IProps { interface IProps {
bladeburner: IBladeburner; bladeburner: Bladeburner;
} }
export function OperationList(props: IProps): React.ReactElement { export function OperationList(props: IProps): React.ReactElement {

@ -1,10 +1,10 @@
import * as React from "react"; import * as React from "react";
import { OperationList } from "./OperationList"; import { OperationList } from "./OperationList";
import { IBladeburner } from "../IBladeburner"; import { Bladeburner } from "../Bladeburner";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
interface IProps { interface IProps {
bladeburner: IBladeburner; bladeburner: Bladeburner;
} }
export function OperationPage(props: IProps): React.ReactElement { export function OperationPage(props: IProps): React.ReactElement {

@ -1,7 +1,7 @@
import React from "react"; import React from "react";
import { CopyableText } from "../../ui/React/CopyableText"; import { CopyableText } from "../../ui/React/CopyableText";
import { formatNumber } from "../../utils/StringHelperFunctions"; import { formatNumber } from "../../utils/StringHelperFunctions";
import { IBladeburner } from "../IBladeburner"; import { Bladeburner } from "../Bladeburner";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import IconButton from "@mui/material/IconButton"; import IconButton from "@mui/material/IconButton";
@ -13,7 +13,7 @@ import { Skill } from "../Skill";
interface IProps { interface IProps {
skill: Skill; skill: Skill;
bladeburner: IBladeburner; bladeburner: Bladeburner;
onUpgrade: () => void; onUpgrade: () => void;
} }

@ -1,10 +1,10 @@
import * as React from "react"; import * as React from "react";
import { SkillElem } from "./SkillElem"; import { SkillElem } from "./SkillElem";
import { Skills } from "../Skills"; import { Skills } from "../Skills";
import { IBladeburner } from "../IBladeburner"; import { Bladeburner } from "../Bladeburner";
interface IProps { interface IProps {
bladeburner: IBladeburner; bladeburner: Bladeburner;
onUpgrade: () => void; onUpgrade: () => void;
} }

@ -2,10 +2,10 @@ import React, { useState } from "react";
import { SkillList } from "./SkillList"; import { SkillList } from "./SkillList";
import { BladeburnerConstants } from "../data/Constants"; import { BladeburnerConstants } from "../data/Constants";
import { formatNumber } from "../../utils/StringHelperFunctions"; import { formatNumber } from "../../utils/StringHelperFunctions";
import { IBladeburner } from "../IBladeburner"; import { Bladeburner } from "../Bladeburner";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
interface IProps { interface IProps {
bladeburner: IBladeburner; bladeburner: Bladeburner;
} }
export function SkillPage(props: IProps): React.ReactElement { export function SkillPage(props: IProps): React.ReactElement {

@ -1,13 +1,13 @@
import React from "react"; import React from "react";
import { IBladeburner } from "../IBladeburner"; import { Bladeburner } from "../Bladeburner";
import { BlackOperation } from "../BlackOperation"; import { BlackOperation } from "../BlackOperation";
import { Player } from "../../Player"; import { Player } from "../../Player";
import Button from "@mui/material/Button"; import Button from "@mui/material/Button";
import { AugmentationNames } from "../../Augmentation/data/AugmentationNames"; import { AugmentationNames } from "../../Augmentation/data/AugmentationNames";
interface IProps { interface IProps {
bladeburner: IBladeburner; bladeburner: Bladeburner;
type: number; type: number;
name: string; name: string;
rerender: () => void; rerender: () => void;

@ -7,7 +7,7 @@ import { numeralWrapper } from "../../ui/numeralFormat";
import { Factions } from "../../Faction/Factions"; import { Factions } from "../../Faction/Factions";
import { Router } from "../../ui/GameRoot"; import { Router } from "../../ui/GameRoot";
import { joinFaction } from "../../Faction/FactionHelpers"; import { joinFaction } from "../../Faction/FactionHelpers";
import { IBladeburner } from "../IBladeburner"; import { Bladeburner } from "../Bladeburner";
import { TravelModal } from "./TravelModal"; import { TravelModal } from "./TravelModal";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
@ -18,7 +18,7 @@ import Paper from "@mui/material/Paper";
import { FactionNames } from "../../Faction/data/FactionNames"; import { FactionNames } from "../../Faction/data/FactionNames";
interface IProps { interface IProps {
bladeburner: IBladeburner; bladeburner: Bladeburner;
} }
export function Stats(props: IProps): React.ReactElement { export function Stats(props: IProps): React.ReactElement {

@ -2,13 +2,13 @@ import React from "react";
import { formatNumber } from "../../utils/StringHelperFunctions"; import { formatNumber } from "../../utils/StringHelperFunctions";
import { StealthIcon } from "./StealthIcon"; import { StealthIcon } from "./StealthIcon";
import { KillIcon } from "./KillIcon"; import { KillIcon } from "./KillIcon";
import { IAction } from "../IAction"; import { Action } from "../Action";
import { IBladeburner } from "../IBladeburner"; import { Bladeburner } from "../Bladeburner";
import { Player } from "../../Player"; import { Player } from "../../Player";
interface IProps { interface IProps {
bladeburner: IBladeburner; bladeburner: Bladeburner;
action: IAction; action: Action;
} }
export function SuccessChance(props: IProps): React.ReactElement { export function SuccessChance(props: IProps): React.ReactElement {

@ -1,12 +1,12 @@
import React, { useState } from "react"; import React, { useState } from "react";
import { Operation } from "../Operation"; import { Operation } from "../Operation";
import { IBladeburner } from "../IBladeburner"; import { Bladeburner } from "../Bladeburner";
import { TeamSizeModal } from "./TeamSizeModal"; import { TeamSizeModal } from "./TeamSizeModal";
import { formatNumber } from "../../utils/StringHelperFunctions"; import { formatNumber } from "../../utils/StringHelperFunctions";
import Button from "@mui/material/Button"; import Button from "@mui/material/Button";
interface IProps { interface IProps {
action: Operation; action: Operation;
bladeburner: IBladeburner; bladeburner: Bladeburner;
} }
export function TeamSizeButton(props: IProps): React.ReactElement { export function TeamSizeButton(props: IProps): React.ReactElement {
const [open, setOpen] = useState(false); const [open, setOpen] = useState(false);

@ -2,13 +2,13 @@ import React, { useState } from "react";
import { dialogBoxCreate } from "../../ui/React/DialogBox"; import { dialogBoxCreate } from "../../ui/React/DialogBox";
import { Modal } from "../../ui/React/Modal"; import { Modal } from "../../ui/React/Modal";
import { Action } from "../Action"; import { Action } from "../Action";
import { IBladeburner } from "../IBladeburner"; import { Bladeburner } from "../Bladeburner";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import Button from "@mui/material/Button"; import Button from "@mui/material/Button";
import TextField from "@mui/material/TextField"; import TextField from "@mui/material/TextField";
interface IProps { interface IProps {
bladeburner: IBladeburner; bladeburner: Bladeburner;
action: Action; action: Action;
open: boolean; open: boolean;
onClose: () => void; onClose: () => void;

@ -1,5 +1,5 @@
import React from "react"; import React from "react";
import { IBladeburner } from "../IBladeburner"; import { Bladeburner } from "../Bladeburner";
import { WorldMap } from "../../ui/React/WorldMap"; import { WorldMap } from "../../ui/React/WorldMap";
import { Modal } from "../../ui/React/Modal"; import { Modal } from "../../ui/React/Modal";
import { CityName } from "../../Locations/data/CityNames"; import { CityName } from "../../Locations/data/CityNames";
@ -8,7 +8,7 @@ import Typography from "@mui/material/Typography";
import Button from "@mui/material/Button"; import Button from "@mui/material/Button";
interface IProps { interface IProps {
bladeburner: IBladeburner; bladeburner: Bladeburner;
open: boolean; open: boolean;
onClose: () => void; onClose: () => void;
} }

@ -2,7 +2,7 @@ import { Player } from "../Player";
import { Bladeburner } from "../Bladeburner/Bladeburner"; import { Bladeburner } from "../Bladeburner/Bladeburner";
import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers"; import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers";
import { Bladeburner as INetscriptBladeburner, BladeburnerCurAction } from "../ScriptEditor/NetscriptDefinitions"; import { Bladeburner as INetscriptBladeburner, BladeburnerCurAction } from "../ScriptEditor/NetscriptDefinitions";
import { IAction } from "src/Bladeburner/IAction"; import { Action } from "src/Bladeburner/Action";
import { InternalAPI, NetscriptContext } from "src/Netscript/APIWrapper"; import { InternalAPI, NetscriptContext } from "src/Netscript/APIWrapper";
import { BlackOperation } from "../Bladeburner/BlackOperation"; import { BlackOperation } from "../Bladeburner/BlackOperation";
import { helpers } from "../Netscript/NetscriptHelpers"; import { helpers } from "../Netscript/NetscriptHelpers";
@ -31,7 +31,7 @@ export function NetscriptBladeburner(): InternalAPI<INetscriptBladeburner> {
} }
}; };
const getBladeburnerActionObject = function (ctx: NetscriptContext, type: string, name: string): IAction { const getBladeburnerActionObject = function (ctx: NetscriptContext, type: string, name: string): Action {
const bladeburner = Player.bladeburner; const bladeburner = Player.bladeburner;
if (bladeburner === null) throw new Error("Must have joined bladeburner"); if (bladeburner === null) throw new Error("Must have joined bladeburner");
const actionId = bladeburner.getActionIdFromTypeAndName(type, name); const actionId = bladeburner.getActionIdFromTypeAndName(type, name);

@ -15,7 +15,7 @@ import { LocationName } from "../../Locations/data/LocationNames";
import { IPlayerOwnedAugmentation } from "../../Augmentation/PlayerOwnedAugmentation"; import { IPlayerOwnedAugmentation } from "../../Augmentation/PlayerOwnedAugmentation";
import { ICorporation } from "../../Corporation/ICorporation"; import { ICorporation } from "../../Corporation/ICorporation";
import { IGang } from "../../Gang/IGang"; import { IGang } from "../../Gang/IGang";
import { IBladeburner } from "../../Bladeburner/IBladeburner"; import { Bladeburner } from "../../Bladeburner/Bladeburner";
import { HacknetNode } from "../../Hacknet/HacknetNode"; import { HacknetNode } from "../../Hacknet/HacknetNode";
import { HashManager } from "../../Hacknet/HashManager"; import { HashManager } from "../../Hacknet/HashManager";
@ -34,7 +34,7 @@ export class PlayerObject extends Person {
bitNodeN = 1; //current bitnode bitNodeN = 1; //current bitnode
corporation: ICorporation | null = null; corporation: ICorporation | null = null;
gang: IGang | null = null; gang: IGang | null = null;
bladeburner: IBladeburner | null = null; bladeburner: Bladeburner | null = null;
currentServer = ""; currentServer = "";
factions: string[] = []; factions: string[] = [];
factionInvitations: string[] = []; factionInvitations: string[] = [];