mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-23 01:32:55 +02:00
Implement CrimeType enum
This commit is contained in:
@@ -30,7 +30,7 @@ import { WorkerScript } from "../Netscript/WorkerScript";
|
||||
import { HacknetServer } from "../Hacknet/HacknetServer";
|
||||
import { ISkillProgress } from "./formulas/skill";
|
||||
import { PlayerAchievement } from "../Achievements/Achievements";
|
||||
import { WorkType, ClassType } from "../utils/WorkType";
|
||||
import { WorkType, ClassType, CrimeType } from "../utils/WorkType";
|
||||
|
||||
export interface IPlayer {
|
||||
// Class members
|
||||
@@ -131,7 +131,7 @@ export interface IPlayer {
|
||||
timeWorkedCreateProgram: number;
|
||||
graftAugmentationName: string;
|
||||
timeWorkedGraftAugmentation: number;
|
||||
crimeType: string;
|
||||
crimeType: CrimeType | null;
|
||||
committingCrimeThruSingFn: boolean;
|
||||
singFnCrimeWorkerScript: WorkerScript | null;
|
||||
timeNeededToCompleteWork: number;
|
||||
@@ -224,7 +224,7 @@ export interface IPlayer {
|
||||
startCorporation(corpName: string, additionalShares?: number): void;
|
||||
startCrime(
|
||||
router: IRouter,
|
||||
crimeType: string,
|
||||
crimeType: CrimeType,
|
||||
hackExp: number,
|
||||
strExp: number,
|
||||
defExp: number,
|
||||
|
||||
@@ -38,7 +38,7 @@ import { PlayerAchievement } from "../../Achievements/Achievements";
|
||||
import { cyrb53 } from "../../utils/StringHelperFunctions";
|
||||
import { getRandomInt } from "../../utils/helpers/getRandomInt";
|
||||
import { CONSTANTS } from "../../Constants";
|
||||
import { WorkType, ClassType } from "../../utils/WorkType";
|
||||
import { WorkType, ClassType, CrimeType } from "../../utils/WorkType";
|
||||
|
||||
export class PlayerObject implements IPlayer {
|
||||
// Class members
|
||||
@@ -141,7 +141,7 @@ export class PlayerObject implements IPlayer {
|
||||
timeWorkedCreateProgram: number;
|
||||
graftAugmentationName: string;
|
||||
timeWorkedGraftAugmentation: number;
|
||||
crimeType: string;
|
||||
crimeType: CrimeType | null;
|
||||
committingCrimeThruSingFn: boolean;
|
||||
singFnCrimeWorkerScript: WorkerScript | null;
|
||||
timeNeededToCompleteWork: number;
|
||||
@@ -234,7 +234,7 @@ export class PlayerObject implements IPlayer {
|
||||
startCorporation: (corpName: string, additionalShares?: number) => void;
|
||||
startCrime: (
|
||||
router: IRouter,
|
||||
crimeType: string,
|
||||
crimeType: CrimeType,
|
||||
hackExp: number,
|
||||
strExp: number,
|
||||
defExp: number,
|
||||
@@ -433,7 +433,7 @@ export class PlayerObject implements IPlayer {
|
||||
|
||||
this.className = null;
|
||||
|
||||
this.crimeType = "";
|
||||
this.crimeType = null;
|
||||
|
||||
this.timeWorked = 0; //in m;
|
||||
this.timeWorkedCreateProgram = 0;
|
||||
|
||||
@@ -66,7 +66,7 @@ import { achievements } from "../../Achievements/Achievements";
|
||||
import { FactionNames } from "../../Faction/data/FactionNames";
|
||||
import { graftingIntBonus } from "../Grafting/GraftingHelpers";
|
||||
|
||||
import { WorkType, FactionWorkType, ClassType } from "../../utils/WorkType";
|
||||
import { WorkType, FactionWorkType, ClassType, CrimeType } from "../../utils/WorkType";
|
||||
|
||||
export function init(this: IPlayer): void {
|
||||
/* Initialize Player's home computer */
|
||||
@@ -143,7 +143,7 @@ export function prestigeAugmentation(this: PlayerObject): void {
|
||||
this.currentWorkFactionDescription = "";
|
||||
this.createProgramName = "";
|
||||
this.className = null;
|
||||
this.crimeType = "";
|
||||
this.crimeType = null;
|
||||
|
||||
this.workHackExpGainRate = 0;
|
||||
this.workStrExpGainRate = 0;
|
||||
@@ -1488,7 +1488,7 @@ export function finishClass(this: IPlayer, sing = false): string {
|
||||
export function startCrime(
|
||||
this: IPlayer,
|
||||
router: IRouter,
|
||||
crimeType: string,
|
||||
crimeType: CrimeType,
|
||||
hackExp: number,
|
||||
strExp: number,
|
||||
defExp: number,
|
||||
@@ -1536,7 +1536,7 @@ export function commitCrime(this: IPlayer, numCycles: number): boolean {
|
||||
export function finishCrime(this: IPlayer, cancelled: boolean): string {
|
||||
//Determine crime success/failure
|
||||
if (!cancelled) {
|
||||
if (determineCrimeSuccess(this, this.crimeType)) {
|
||||
if (determineCrimeSuccess(this, this.crimeType ?? "")) {
|
||||
//Handle Karma and crime statistics
|
||||
let crime = null;
|
||||
for (const i of Object.keys(Crimes)) {
|
||||
@@ -1669,7 +1669,7 @@ export function finishCrime(this: IPlayer, cancelled: boolean): string {
|
||||
this.committingCrimeThruSingFn = false;
|
||||
this.singFnCrimeWorkerScript = null;
|
||||
this.isWorking = false;
|
||||
this.crimeType = "";
|
||||
this.crimeType = null;
|
||||
this.resetWorkStatus();
|
||||
return "";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user