mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2025-01-03 11:57:34 +01:00
Refactoring mostly done, still a few bugs and test to do.
This commit is contained in:
parent
8d550157bc
commit
99afb156fa
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,7 @@
|
|||||||
import { IActionIdentifier } from "./IActionIdentifier";
|
import { IActionIdentifier } from "./IActionIdentifier";
|
||||||
import { City } from "./City";
|
import { City } from "./City";
|
||||||
import { Skill } from "./Skill";
|
import { Skill } from "./Skill";
|
||||||
|
import { IAction } from "./IAction";
|
||||||
import { IPlayer } from "../PersonObjects/IPlayer";
|
import { IPlayer } from "../PersonObjects/IPlayer";
|
||||||
import { WorkerScript } from "../Netscript/WorkerScript";
|
import { WorkerScript } from "../Netscript/WorkerScript";
|
||||||
|
|
||||||
@ -74,4 +75,31 @@ export interface IBladeburner {
|
|||||||
getTeamSizeNetscriptFn(type: string, name: string, workerScript: WorkerScript): number;
|
getTeamSizeNetscriptFn(type: string, name: string, workerScript: WorkerScript): number;
|
||||||
setTeamSizeNetscriptFn(type: string, name: string, size: number, workerScript: WorkerScript): number;
|
setTeamSizeNetscriptFn(type: string, name: string, size: number, workerScript: WorkerScript): number;
|
||||||
joinBladeburnerFactionNetscriptFn(workerScript: WorkerScript): boolean;
|
joinBladeburnerFactionNetscriptFn(workerScript: WorkerScript): boolean;
|
||||||
}
|
getActionIdFromTypeAndName(type: string, name: string): IActionIdentifier | null;
|
||||||
|
executeStartConsoleCommand(player: IPlayer, args: string[]): void;
|
||||||
|
executeSkillConsoleCommand(args: string[]): void;
|
||||||
|
executeLogConsoleCommand(args: string[]): void;
|
||||||
|
executeHelpConsoleCommand(args: string[]): void;
|
||||||
|
executeAutomateConsoleCommand(args: string[]): void;
|
||||||
|
parseCommandArguments(command: string): string[];
|
||||||
|
executeConsoleCommand(player: IPlayer, command: string): void;
|
||||||
|
triggerMigration(sourceCityName: string): void;
|
||||||
|
triggerPotentialMigration(sourceCityName: string, chance: number): void;
|
||||||
|
randomEvent(): void;
|
||||||
|
gainActionStats(player: IPlayer, action: IAction, success: boolean): void;
|
||||||
|
getDiplomacyEffectiveness(player: IPlayer): number;
|
||||||
|
getRecruitmentSuccessChance(player: IPlayer): number;
|
||||||
|
getRecruitmentTime(player: IPlayer): number;
|
||||||
|
resetSkillMultipliers(): void;
|
||||||
|
updateSkillMultipliers(): void;
|
||||||
|
completeOperation(success: boolean): void;
|
||||||
|
getActionObject(actionId: IActionIdentifier): IAction | null;
|
||||||
|
completeContract(success: boolean): void;
|
||||||
|
completeAction(player: IPlayer): void;
|
||||||
|
changeRank(player: IPlayer, change: number): void;
|
||||||
|
processAction(player: IPlayer, seconds: number): void;
|
||||||
|
calculateStaminaGainPerSecond(player: IPlayer): number;
|
||||||
|
calculateMaxStamina(player: IPlayer): void;
|
||||||
|
create(): void;
|
||||||
|
process(player: IPlayer): void;
|
||||||
|
}
|
@ -10,7 +10,6 @@ import { createPopup } from "../../ui/React/createPopup";
|
|||||||
import { TeamSizePopup } from "./TeamSizePopup";
|
import { TeamSizePopup } from "./TeamSizePopup";
|
||||||
import { IBladeburner } from "../IBladeburner";
|
import { IBladeburner } from "../IBladeburner";
|
||||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||||
import { startAction } from "../Bladeburner";
|
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
bladeburner: IBladeburner;
|
bladeburner: IBladeburner;
|
||||||
@ -35,7 +34,7 @@ export function BlackOpElem(props: IProps): React.ReactElement {
|
|||||||
function onStart() {
|
function onStart() {
|
||||||
props.bladeburner.action.type = ActionTypes.BlackOperation;
|
props.bladeburner.action.type = ActionTypes.BlackOperation;
|
||||||
props.bladeburner.action.name = props.action.name;
|
props.bladeburner.action.name = props.action.name;
|
||||||
startAction(props.bladeburner, props.player, props.bladeburner.action);
|
props.bladeburner.startAction(props.player, props.bladeburner.action);
|
||||||
setRerender(old => !old);
|
setRerender(old => !old);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,6 @@ import { stealthIcon, killIcon } from "../data/Icons";
|
|||||||
import { BladeburnerConstants } from "../data/Constants";
|
import { BladeburnerConstants } from "../data/Constants";
|
||||||
import { IBladeburner } from "../IBladeburner";
|
import { IBladeburner } from "../IBladeburner";
|
||||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||||
import { startAction } from "../Bladeburner";
|
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
bladeburner: IBladeburner;
|
bladeburner: IBladeburner;
|
||||||
@ -29,19 +28,19 @@ export function ContractElem(props: IProps): React.ReactElement {
|
|||||||
function onStart() {
|
function onStart() {
|
||||||
props.bladeburner.action.type = ActionTypes.Contract;
|
props.bladeburner.action.type = ActionTypes.Contract;
|
||||||
props.bladeburner.action.name = props.action.name;
|
props.bladeburner.action.name = props.action.name;
|
||||||
startAction(props.bladeburner, props.player, props.bladeburner.action);
|
props.bladeburner.startAction(props.player, props.bladeburner.action);
|
||||||
setRerender(old => !old);
|
setRerender(old => !old);
|
||||||
}
|
}
|
||||||
|
|
||||||
function increaseLevel() {
|
function increaseLevel() {
|
||||||
++props.action.level;
|
++props.action.level;
|
||||||
if (isActive) startAction(props.bladeburner, props.player, props.bladeburner.action);
|
if (isActive) props.bladeburner.startAction(props.player, props.bladeburner.action);
|
||||||
setRerender(old => !old);
|
setRerender(old => !old);
|
||||||
}
|
}
|
||||||
|
|
||||||
function decreaseLevel() {
|
function decreaseLevel() {
|
||||||
--props.action.level;
|
--props.action.level;
|
||||||
if (isActive) startAction(props.bladeburner, props.player, props.bladeburner.action);
|
if (isActive) props.bladeburner.startAction(props.player, props.bladeburner.action);
|
||||||
setRerender(old => !old);
|
setRerender(old => !old);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,8 +10,6 @@ import { BladeburnerConstants } from "../data/Constants";
|
|||||||
import { IBladeburner } from "../IBladeburner";
|
import { IBladeburner } from "../IBladeburner";
|
||||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||||
|
|
||||||
import { startAction } from "../Bladeburner";
|
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
bladeburner: IBladeburner;
|
bladeburner: IBladeburner;
|
||||||
player: IPlayer;
|
player: IPlayer;
|
||||||
@ -26,7 +24,7 @@ export function GeneralActionElem(props: IProps): React.ReactElement {
|
|||||||
function onStart() {
|
function onStart() {
|
||||||
props.bladeburner.action.type = ActionTypes[(props.action.name as string)];
|
props.bladeburner.action.type = ActionTypes[(props.action.name as string)];
|
||||||
props.bladeburner.action.name = props.action.name;
|
props.bladeburner.action.name = props.action.name;
|
||||||
startAction(props.bladeburner, props.player, props.bladeburner.action);
|
props.bladeburner.startAction(props.player, props.bladeburner.action);
|
||||||
setRerender(old => !old);
|
setRerender(old => !old);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@ import { createPopup } from "../../ui/React/createPopup";
|
|||||||
import { TeamSizePopup } from "./TeamSizePopup";
|
import { TeamSizePopup } from "./TeamSizePopup";
|
||||||
import { IBladeburner } from "../IBladeburner";
|
import { IBladeburner } from "../IBladeburner";
|
||||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||||
import { startAction } from "../Bladeburner";
|
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
bladeburner: IBladeburner;
|
bladeburner: IBladeburner;
|
||||||
@ -31,7 +30,7 @@ export function OperationElem(props: IProps): React.ReactElement {
|
|||||||
function onStart() {
|
function onStart() {
|
||||||
props.bladeburner.action.type = ActionTypes.Operation;
|
props.bladeburner.action.type = ActionTypes.Operation;
|
||||||
props.bladeburner.action.name = props.action.name;
|
props.bladeburner.action.name = props.action.name;
|
||||||
startAction(props.bladeburner, props.player, props.bladeburner.action);
|
props.bladeburner.startAction(props.player, props.bladeburner.action);
|
||||||
setRerender(old => !old);
|
setRerender(old => !old);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,13 +45,13 @@ export function OperationElem(props: IProps): React.ReactElement {
|
|||||||
|
|
||||||
function increaseLevel() {
|
function increaseLevel() {
|
||||||
++props.action.level;
|
++props.action.level;
|
||||||
if (isActive) startAction(props.bladeburner, props.player, props.bladeburner.action);
|
if (isActive) props.bladeburner.startAction(props.player, props.bladeburner.action);
|
||||||
setRerender(old => !old);
|
setRerender(old => !old);
|
||||||
}
|
}
|
||||||
|
|
||||||
function decreaseLevel() {
|
function decreaseLevel() {
|
||||||
--props.action.level;
|
--props.action.level;
|
||||||
if (isActive) startAction(props.bladeburner, props.player, props.bladeburner.action);
|
if (isActive) props.bladeburner.startAction(props.player, props.bladeburner.action);
|
||||||
setRerender(old => !old);
|
setRerender(old => !old);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -884,7 +884,7 @@ const Engine = {
|
|||||||
}
|
}
|
||||||
if (Player.bladeburner instanceof Bladeburner) {
|
if (Player.bladeburner instanceof Bladeburner) {
|
||||||
try {
|
try {
|
||||||
ProcessBladeburner(Player.bladeburner, Player);
|
Player.bladeburner.process(Player);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
exceptionAlert("Exception caught in Bladeburner.process(): " + e);
|
exceptionAlert("Exception caught in Bladeburner.process(): " + e);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user