mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-26 17:43:48 +01:00
Refactor WorkType
to an enum
This commit is contained in:
parent
cc5e89208e
commit
4a8e99b170
@ -66,13 +66,6 @@ export const CONSTANTS: {
|
||||
FactionWorkHacking: string;
|
||||
FactionWorkField: string;
|
||||
FactionWorkSecurity: string;
|
||||
WorkTypeCompany: string;
|
||||
WorkTypeCompanyPartTime: string;
|
||||
WorkTypeFaction: string;
|
||||
WorkTypeCreateProgram: string;
|
||||
WorkTypeStudyClass: string;
|
||||
WorkTypeCrime: string;
|
||||
WorkTypeGraftAugmentation: string;
|
||||
ClassStudyComputerScience: string;
|
||||
ClassDataStructures: string;
|
||||
ClassNetworks: string;
|
||||
@ -227,14 +220,6 @@ export const CONSTANTS: {
|
||||
FactionWorkField: "Faction Field Work",
|
||||
FactionWorkSecurity: "Faction Security Work",
|
||||
|
||||
WorkTypeCompany: "Working for Company",
|
||||
WorkTypeCompanyPartTime: "Working for Company part-time",
|
||||
WorkTypeFaction: "Working for Faction",
|
||||
WorkTypeCreateProgram: "Working on Create a Program",
|
||||
WorkTypeStudyClass: "Studying or Taking a class at university",
|
||||
WorkTypeCrime: "Committing a crime",
|
||||
WorkTypeGraftAugmentation: "Grafting an Augmentation",
|
||||
|
||||
ClassStudyComputerScience: "studying Computer Science",
|
||||
ClassDataStructures: "taking a Data Structures course",
|
||||
ClassNetworks: "taking a Networks course",
|
||||
|
@ -2460,7 +2460,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
|
||||
crime_money_mult: Player.crime_money_mult,
|
||||
crime_success_mult: Player.crime_success_mult,
|
||||
isWorking: Player.isWorking,
|
||||
workType: Player.workType,
|
||||
workType: Player.workType ?? "", // Avoids breaking scripts that for some reason rely on this
|
||||
currentWorkFactionName: Player.currentWorkFactionName,
|
||||
currentWorkFactionDescription: Player.currentWorkFactionDescription,
|
||||
workHackExpGainRate: Player.workHackExpGainRate,
|
||||
|
@ -49,6 +49,7 @@ import { InternalAPI, NetscriptContext } from "src/Netscript/APIWrapper";
|
||||
import { BlackOperationNames } from "../Bladeburner/data/BlackOperationNames";
|
||||
import { enterBitNode } from "../RedPill";
|
||||
import { FactionNames } from "../Faction/data/FactionNames";
|
||||
import { WorkType } from "../utils/WorkType";
|
||||
|
||||
export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript): InternalAPI<ISingularity> {
|
||||
const getAugmentation = function (_ctx: NetscriptContext, name: string): Augmentation {
|
||||
@ -650,11 +651,11 @@ export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript
|
||||
}
|
||||
if (
|
||||
!(
|
||||
player.workType == CONSTANTS.WorkTypeFaction ||
|
||||
player.workType == CONSTANTS.WorkTypeCompany ||
|
||||
player.workType == CONSTANTS.WorkTypeCompanyPartTime ||
|
||||
player.workType == CONSTANTS.WorkTypeCreateProgram ||
|
||||
player.workType == CONSTANTS.WorkTypeStudyClass
|
||||
player.workType === WorkType.Faction ||
|
||||
player.workType === WorkType.Company ||
|
||||
player.workType === WorkType.CompanyPartTime ||
|
||||
player.workType === WorkType.CreateProgram ||
|
||||
player.workType === WorkType.StudyClass
|
||||
)
|
||||
) {
|
||||
throw _ctx.helper.makeRuntimeErrorMsg("Cannot change focus for current job");
|
||||
|
@ -30,6 +30,7 @@ import { WorkerScript } from "../Netscript/WorkerScript";
|
||||
import { HacknetServer } from "../Hacknet/HacknetServer";
|
||||
import { ISkillProgress } from "./formulas/skill";
|
||||
import { PlayerAchievement } from "../Achievements/Achievements";
|
||||
import { WorkType } from "../utils/WorkType";
|
||||
|
||||
export interface IPlayer {
|
||||
// Class members
|
||||
@ -137,7 +138,7 @@ export interface IPlayer {
|
||||
focus: boolean;
|
||||
className: string;
|
||||
currentWorkFactionName: string;
|
||||
workType: string;
|
||||
workType: WorkType | null;
|
||||
workCostMult: number;
|
||||
workExpMult: number;
|
||||
currentWorkFactionDescription: string;
|
||||
@ -269,7 +270,7 @@ export interface IPlayer {
|
||||
prestigeSourceFile(): void;
|
||||
calculateSkill(exp: number, mult?: number): number;
|
||||
calculateSkillProgress(exp: number, mult?: number): ISkillProgress;
|
||||
resetWorkStatus(generalType?: string, group?: string, workType?: string): void;
|
||||
resetWorkStatus(generalType?: WorkType, group?: string, workType?: string): void;
|
||||
getWorkHackExpGain(): number;
|
||||
getWorkStrExpGain(): number;
|
||||
getWorkDefExpGain(): number;
|
||||
|
@ -38,6 +38,7 @@ import { PlayerAchievement } from "../../Achievements/Achievements";
|
||||
import { cyrb53 } from "../../utils/StringHelperFunctions";
|
||||
import { getRandomInt } from "../../utils/helpers/getRandomInt";
|
||||
import { CONSTANTS } from "../../Constants";
|
||||
import { WorkType } from "../../utils/WorkType";
|
||||
|
||||
export class PlayerObject implements IPlayer {
|
||||
// Class members
|
||||
@ -147,7 +148,7 @@ export class PlayerObject implements IPlayer {
|
||||
focus: boolean;
|
||||
className: string;
|
||||
currentWorkFactionName: string;
|
||||
workType: string;
|
||||
workType: WorkType | null;
|
||||
workCostMult: number;
|
||||
workExpMult: number;
|
||||
currentWorkFactionDescription: string;
|
||||
@ -280,7 +281,7 @@ export class PlayerObject implements IPlayer {
|
||||
prestigeSourceFile: () => void;
|
||||
calculateSkill: (exp: number, mult?: number) => number;
|
||||
calculateSkillProgress: (exp: number, mult?: number) => ISkillProgress;
|
||||
resetWorkStatus: (generalType?: string, group?: string, workType?: string) => void;
|
||||
resetWorkStatus: (generalType?: WorkType, group?: string, workType?: string) => void;
|
||||
getWorkHackExpGain: () => number;
|
||||
getWorkStrExpGain: () => number;
|
||||
getWorkDefExpGain: () => number;
|
||||
@ -398,7 +399,7 @@ export class PlayerObject implements IPlayer {
|
||||
//Flags/variables for working (Company, Faction, Creating Program, Taking Class)
|
||||
this.isWorking = false;
|
||||
this.focus = false;
|
||||
this.workType = "";
|
||||
this.workType = null;
|
||||
this.workCostMult = 1;
|
||||
this.workExpMult = 1;
|
||||
|
||||
|
@ -66,6 +66,8 @@ import { achievements } from "../../Achievements/Achievements";
|
||||
import { FactionNames } from "../../Faction/data/FactionNames";
|
||||
import { graftingIntBonus } from "../Grafting/GraftingHelpers";
|
||||
|
||||
import { WorkType } from "../../utils/WorkType";
|
||||
|
||||
export function init(this: IPlayer): void {
|
||||
/* Initialize Player's home computer */
|
||||
const t_homeComp = safetlyCreateUniqueServer({
|
||||
@ -500,8 +502,8 @@ export function queryStatFromString(this: IPlayer, str: string): number {
|
||||
}
|
||||
|
||||
/******* Working functions *******/
|
||||
export function resetWorkStatus(this: IPlayer, generalType?: string, group?: string, workType?: string): void {
|
||||
if (this.workType !== CONSTANTS.WorkTypeFaction && generalType === this.workType && group === this.companyName)
|
||||
export function resetWorkStatus(this: IPlayer, generalType?: WorkType, group?: string, workType?: string): void {
|
||||
if (this.workType !== WorkType.Faction && generalType === this.workType && group === this.companyName)
|
||||
return;
|
||||
if (generalType === this.workType && group === this.currentWorkFactionName && workType === this.factionWorkType)
|
||||
return;
|
||||
@ -534,7 +536,7 @@ export function resetWorkStatus(this: IPlayer, generalType?: string, group?: str
|
||||
this.createProgramName = "";
|
||||
this.graftAugmentationName = "";
|
||||
this.className = "";
|
||||
this.workType = "";
|
||||
this.workType = null;
|
||||
}
|
||||
|
||||
export function processWorkEarnings(this: IPlayer, numCycles = 1): void {
|
||||
@ -569,10 +571,10 @@ export function processWorkEarnings(this: IPlayer, numCycles = 1): void {
|
||||
|
||||
/* Working for Company */
|
||||
export function startWork(this: IPlayer, companyName: string): void {
|
||||
this.resetWorkStatus(CONSTANTS.WorkTypeCompany, companyName);
|
||||
this.resetWorkStatus(WorkType.Company, companyName);
|
||||
this.isWorking = true;
|
||||
this.companyName = companyName;
|
||||
this.workType = CONSTANTS.WorkTypeCompany;
|
||||
this.workType = WorkType.Company;
|
||||
|
||||
this.workHackExpGainRate = this.getWorkHackExpGain();
|
||||
this.workStrExpGainRate = this.getWorkStrExpGain();
|
||||
@ -589,27 +591,27 @@ export function startWork(this: IPlayer, companyName: string): void {
|
||||
export function process(this: IPlayer, router: IRouter, numCycles = 1): void {
|
||||
// Working
|
||||
if (this.isWorking) {
|
||||
if (this.workType == CONSTANTS.WorkTypeFaction) {
|
||||
if (this.workType === WorkType.Faction) {
|
||||
if (this.workForFaction(numCycles)) {
|
||||
router.toFaction(Factions[this.currentWorkFactionName]);
|
||||
}
|
||||
} else if (this.workType == CONSTANTS.WorkTypeCreateProgram) {
|
||||
} else if (this.workType === WorkType.CreateProgram) {
|
||||
if (this.createProgramWork(numCycles)) {
|
||||
router.toTerminal();
|
||||
}
|
||||
} else if (this.workType == CONSTANTS.WorkTypeStudyClass) {
|
||||
} else if (this.workType === WorkType.StudyClass) {
|
||||
if (this.takeClass(numCycles)) {
|
||||
router.toCity();
|
||||
}
|
||||
} else if (this.workType == CONSTANTS.WorkTypeCrime) {
|
||||
} else if (this.workType === WorkType.Crime) {
|
||||
if (this.commitCrime(numCycles)) {
|
||||
router.toLocation(Locations[LocationName.Slums]);
|
||||
}
|
||||
} else if (this.workType == CONSTANTS.WorkTypeCompanyPartTime) {
|
||||
} else if (this.workType === WorkType.CompanyPartTime) {
|
||||
if (this.workPartTime(numCycles)) {
|
||||
router.toCity();
|
||||
}
|
||||
} else if (this.workType === CONSTANTS.WorkTypeGraftAugmentation) {
|
||||
} else if (this.workType === WorkType.GraftAugmentation) {
|
||||
if (this.graftAugmentationWork(numCycles)) {
|
||||
router.toGrafting();
|
||||
}
|
||||
@ -765,10 +767,10 @@ export function finishWork(this: IPlayer, cancelled: boolean, sing = false): str
|
||||
}
|
||||
|
||||
export function startWorkPartTime(this: IPlayer, companyName: string): void {
|
||||
this.resetWorkStatus(CONSTANTS.WorkTypeCompanyPartTime, companyName);
|
||||
this.resetWorkStatus(WorkType.CompanyPartTime, companyName);
|
||||
this.isWorking = true;
|
||||
this.companyName = companyName;
|
||||
this.workType = CONSTANTS.WorkTypeCompanyPartTime;
|
||||
this.workType = WorkType.CompanyPartTime;
|
||||
|
||||
this.workHackExpGainRate = this.getWorkHackExpGain();
|
||||
this.workStrExpGainRate = this.getWorkStrExpGain();
|
||||
@ -881,14 +883,14 @@ export function startFactionWork(this: IPlayer, faction: Faction): void {
|
||||
this.workRepGainRate *= BitNodeMultipliers.FactionWorkRepGain;
|
||||
|
||||
this.isWorking = true;
|
||||
this.workType = CONSTANTS.WorkTypeFaction;
|
||||
this.workType = WorkType.Faction;
|
||||
this.currentWorkFactionName = faction.name;
|
||||
|
||||
this.timeNeededToCompleteWork = CONSTANTS.MillisecondsPer20Hours;
|
||||
}
|
||||
|
||||
export function startFactionHackWork(this: IPlayer, faction: Faction): void {
|
||||
this.resetWorkStatus(CONSTANTS.WorkTypeFaction, faction.name, CONSTANTS.FactionWorkHacking);
|
||||
this.resetWorkStatus(WorkType.Faction, faction.name, CONSTANTS.FactionWorkHacking);
|
||||
|
||||
this.workHackExpGainRate = 0.15 * this.hacking_exp_mult * BitNodeMultipliers.FactionWorkExpGain;
|
||||
this.workRepGainRate = getHackingWorkRepGain(this, faction);
|
||||
@ -900,7 +902,7 @@ export function startFactionHackWork(this: IPlayer, faction: Faction): void {
|
||||
}
|
||||
|
||||
export function startFactionFieldWork(this: IPlayer, faction: Faction): void {
|
||||
this.resetWorkStatus(CONSTANTS.WorkTypeFaction, faction.name, CONSTANTS.FactionWorkField);
|
||||
this.resetWorkStatus(WorkType.Faction, faction.name, CONSTANTS.FactionWorkField);
|
||||
|
||||
this.workHackExpGainRate = 0.1 * this.hacking_exp_mult * BitNodeMultipliers.FactionWorkExpGain;
|
||||
this.workStrExpGainRate = 0.1 * this.strength_exp_mult * BitNodeMultipliers.FactionWorkExpGain;
|
||||
@ -917,7 +919,7 @@ export function startFactionFieldWork(this: IPlayer, faction: Faction): void {
|
||||
}
|
||||
|
||||
export function startFactionSecurityWork(this: IPlayer, faction: Faction): void {
|
||||
this.resetWorkStatus(CONSTANTS.WorkTypeFaction, faction.name, CONSTANTS.FactionWorkSecurity);
|
||||
this.resetWorkStatus(WorkType.Faction, faction.name, CONSTANTS.FactionWorkSecurity);
|
||||
|
||||
this.workHackExpGainRate = 0.05 * this.hacking_exp_mult * BitNodeMultipliers.FactionWorkExpGain;
|
||||
this.workStrExpGainRate = 0.15 * this.strength_exp_mult * BitNodeMultipliers.FactionWorkExpGain;
|
||||
@ -1261,7 +1263,7 @@ export function getWorkRepGain(this: IPlayer): number {
|
||||
export function startCreateProgramWork(this: IPlayer, programName: string, time: number, reqLevel: number): void {
|
||||
this.resetWorkStatus();
|
||||
this.isWorking = true;
|
||||
this.workType = CONSTANTS.WorkTypeCreateProgram;
|
||||
this.workType = WorkType.CreateProgram;
|
||||
|
||||
//Time needed to complete work affected by hacking skill (linearly based on
|
||||
//ratio of (your skill - required level) to MAX skill)
|
||||
@ -1338,7 +1340,7 @@ export function finishCreateProgramWork(this: IPlayer, cancelled: boolean): stri
|
||||
export function startGraftAugmentationWork(this: IPlayer, augmentationName: string, time: number): void {
|
||||
this.resetWorkStatus();
|
||||
this.isWorking = true;
|
||||
this.workType = CONSTANTS.WorkTypeGraftAugmentation;
|
||||
this.workType = WorkType.GraftAugmentation;
|
||||
|
||||
this.timeNeededToCompleteWork = time;
|
||||
this.graftAugmentationName = augmentationName;
|
||||
@ -1395,7 +1397,7 @@ export function finishGraftAugmentationWork(this: IPlayer, cancelled: boolean, s
|
||||
export function startClass(this: IPlayer, costMult: number, expMult: number, className: string): void {
|
||||
this.resetWorkStatus();
|
||||
this.isWorking = true;
|
||||
this.workType = CONSTANTS.WorkTypeStudyClass;
|
||||
this.workType = WorkType.StudyClass;
|
||||
this.workCostMult = costMult;
|
||||
this.workExpMult = expMult;
|
||||
this.className = className;
|
||||
@ -1503,7 +1505,7 @@ export function startCrime(
|
||||
this.resetWorkStatus();
|
||||
this.isWorking = true;
|
||||
this.focus = true;
|
||||
this.workType = CONSTANTS.WorkTypeCrime;
|
||||
this.workType = WorkType.Crime;
|
||||
|
||||
if (workerscript !== null) {
|
||||
this.committingCrimeThruSingFn = true;
|
||||
@ -1681,25 +1683,25 @@ export function singularityStopWork(this: IPlayer): string {
|
||||
}
|
||||
let res = ""; //Earnings text for work
|
||||
switch (this.workType) {
|
||||
case CONSTANTS.WorkTypeStudyClass:
|
||||
case WorkType.StudyClass:
|
||||
res = this.finishClass(true);
|
||||
break;
|
||||
case CONSTANTS.WorkTypeCompany:
|
||||
case WorkType.Company:
|
||||
res = this.finishWork(true, true);
|
||||
break;
|
||||
case CONSTANTS.WorkTypeCompanyPartTime:
|
||||
case WorkType.CompanyPartTime:
|
||||
res = this.finishWorkPartTime(true);
|
||||
break;
|
||||
case CONSTANTS.WorkTypeFaction:
|
||||
case WorkType.Faction:
|
||||
res = this.finishFactionWork(true, true);
|
||||
break;
|
||||
case CONSTANTS.WorkTypeCreateProgram:
|
||||
case WorkType.CreateProgram:
|
||||
res = this.finishCreateProgramWork(true);
|
||||
break;
|
||||
case CONSTANTS.WorkTypeCrime:
|
||||
case WorkType.Crime:
|
||||
res = this.finishCrime(true);
|
||||
break;
|
||||
case CONSTANTS.WorkTypeGraftAugmentation:
|
||||
case WorkType.GraftAugmentation:
|
||||
res = this.finishGraftAugmentationWork(true, true);
|
||||
break;
|
||||
default:
|
||||
@ -1793,7 +1795,7 @@ export function applyForJob(this: IPlayer, entryPosType: CompanyPosition, sing =
|
||||
}
|
||||
|
||||
this.jobs[company.name] = pos.name;
|
||||
if (!this.isWorking || !this.workType.includes("Working for Company")) this.companyName = company.name;
|
||||
if (!this.isWorking || this.workType !== WorkType.Company) this.companyName = company.name;
|
||||
|
||||
if (!sing) {
|
||||
dialogBoxCreate("Congratulations! You were offered a new job at " + company.name + " as a " + pos.name + "!");
|
||||
@ -1842,7 +1844,7 @@ export function getNextCompanyPosition(
|
||||
}
|
||||
|
||||
export function quitJob(this: IPlayer, company: string, _sing = false): void {
|
||||
if (this.isWorking == true && this.workType.includes("Working for Company") && this.companyName == company) {
|
||||
if (this.isWorking == true && this.workType !== WorkType.Company && this.companyName == company) {
|
||||
this.finishWork(true);
|
||||
}
|
||||
delete this.jobs[company];
|
||||
|
@ -50,6 +50,8 @@ import { setupUncaughtPromiseHandler } from "./UncaughtPromiseHandler";
|
||||
import { Button, Typography } from "@mui/material";
|
||||
import { SnackbarEvents, ToastVariant } from "./ui/React/Snackbar";
|
||||
|
||||
import { WorkType } from "./utils/WorkType";
|
||||
|
||||
const Engine: {
|
||||
_lastUpdate: number;
|
||||
updateGame: (numCycles?: number) => void;
|
||||
@ -292,20 +294,27 @@ const Engine: {
|
||||
loadAllRunningScripts(Player); // This also takes care of offline production for those scripts
|
||||
if (Player.isWorking) {
|
||||
Player.focus = true;
|
||||
if (Player.workType == CONSTANTS.WorkTypeFaction) {
|
||||
Player.workForFaction(numCyclesOffline);
|
||||
} else if (Player.workType == CONSTANTS.WorkTypeCreateProgram) {
|
||||
Player.createProgramWork(numCyclesOffline);
|
||||
} else if (Player.workType == CONSTANTS.WorkTypeStudyClass) {
|
||||
Player.takeClass(numCyclesOffline);
|
||||
} else if (Player.workType == CONSTANTS.WorkTypeCrime) {
|
||||
Player.commitCrime(numCyclesOffline);
|
||||
} else if (Player.workType == CONSTANTS.WorkTypeCompanyPartTime) {
|
||||
Player.workPartTime(numCyclesOffline);
|
||||
} else if (Player.workType === CONSTANTS.WorkTypeGraftAugmentation) {
|
||||
Player.graftAugmentationWork(numCyclesOffline);
|
||||
} else {
|
||||
Player.work(numCyclesOffline);
|
||||
switch (Player.workType) {
|
||||
case WorkType.Faction:
|
||||
Player.workForFaction(numCyclesOffline);
|
||||
break;
|
||||
case WorkType.CreateProgram:
|
||||
Player.createProgramWork(numCyclesOffline);
|
||||
break;
|
||||
case WorkType.StudyClass:
|
||||
Player.takeClass(numCyclesOffline);
|
||||
break;
|
||||
case WorkType.Crime:
|
||||
Player.commitCrime(numCyclesOffline);
|
||||
break;
|
||||
case WorkType.CompanyPartTime:
|
||||
Player.workPartTime(numCyclesOffline);
|
||||
break;
|
||||
case WorkType.GraftAugmentation:
|
||||
Player.graftAugmentationWork(numCyclesOffline);
|
||||
break;
|
||||
default:
|
||||
Player.work(numCyclesOffline);
|
||||
}
|
||||
} else {
|
||||
for (let i = 0; i < Player.factions.length; i++) {
|
||||
|
@ -25,7 +25,8 @@ import { StatsProgressOverviewCell } from "./StatsProgressBar";
|
||||
import { BitNodeMultipliers } from "../../BitNode/BitNodeMultipliers";
|
||||
|
||||
import { Box, Tooltip } from "@mui/material";
|
||||
import { CONSTANTS } from "../../Constants";
|
||||
|
||||
import { WorkType } from "../../utils/WorkType";
|
||||
|
||||
interface IProps {
|
||||
save: () => void;
|
||||
@ -144,8 +145,8 @@ function Work(): React.ReactElement {
|
||||
let header = <></>;
|
||||
let innerText = <></>;
|
||||
switch (player.workType) {
|
||||
case CONSTANTS.WorkTypeCompanyPartTime:
|
||||
case CONSTANTS.WorkTypeCompany:
|
||||
case WorkType.CompanyPartTime:
|
||||
case WorkType.Company:
|
||||
details = (
|
||||
<>
|
||||
{player.jobs[player.companyName]} at <strong>{player.companyName}</strong>
|
||||
@ -162,7 +163,7 @@ function Work(): React.ReactElement {
|
||||
</>
|
||||
);
|
||||
break;
|
||||
case CONSTANTS.WorkTypeFaction:
|
||||
case WorkType.Faction:
|
||||
details = (
|
||||
<>
|
||||
{player.factionWorkType} for <strong>{player.currentWorkFactionName}</strong>
|
||||
@ -179,12 +180,12 @@ function Work(): React.ReactElement {
|
||||
</>
|
||||
);
|
||||
break;
|
||||
case CONSTANTS.WorkTypeStudyClass:
|
||||
case WorkType.StudyClass:
|
||||
details = <>{player.workType}</>;
|
||||
header = <>You are {player.className}</>;
|
||||
innerText = <>{convertTimeMsToTimeElapsedString(player.timeWorked)}</>;
|
||||
break;
|
||||
case CONSTANTS.WorkTypeCreateProgram:
|
||||
case WorkType.CreateProgram:
|
||||
details = <>Coding {player.createProgramName}</>;
|
||||
header = <>Creating a program</>;
|
||||
innerText = (
|
||||
@ -194,7 +195,7 @@ function Work(): React.ReactElement {
|
||||
</>
|
||||
);
|
||||
break;
|
||||
case CONSTANTS.WorkTypeGraftAugmentation:
|
||||
case WorkType.GraftAugmentation:
|
||||
details = <>Grafting {player.graftAugmentationName}</>;
|
||||
header = <>Grafting an Augmentation</>;
|
||||
innerText = (
|
||||
|
@ -19,6 +19,7 @@ import { ProgressBar } from "./React/Progress";
|
||||
import { Reputation } from "./React/Reputation";
|
||||
import { ReputationRate } from "./React/ReputationRate";
|
||||
import { StatsRow } from "./React/StatsRow";
|
||||
import { WorkType } from "../utils/WorkType";
|
||||
|
||||
const CYCLES_PER_SEC = 1000 / CONSTANTS.MilliPerCycle;
|
||||
|
||||
@ -139,7 +140,7 @@ export function WorkInProgressRoot(): React.ReactElement {
|
||||
let workInfo: IWorkInfo | null;
|
||||
|
||||
switch (player.workType) {
|
||||
case CONSTANTS.WorkTypeFaction: {
|
||||
case WorkType.Faction: {
|
||||
const faction = Factions[player.currentWorkFactionName];
|
||||
if (!faction) {
|
||||
workInfo = {
|
||||
@ -208,7 +209,7 @@ export function WorkInProgressRoot(): React.ReactElement {
|
||||
break;
|
||||
}
|
||||
|
||||
case CONSTANTS.WorkTypeStudyClass: {
|
||||
case WorkType.StudyClass: {
|
||||
const className = player.className;
|
||||
function cancel(): void {
|
||||
player.finishClass(true);
|
||||
@ -262,7 +263,7 @@ export function WorkInProgressRoot(): React.ReactElement {
|
||||
break;
|
||||
}
|
||||
|
||||
case CONSTANTS.WorkTypeCompany: {
|
||||
case WorkType.Company: {
|
||||
const comp = Companies[player.companyName];
|
||||
if (comp == null || !(comp instanceof Company)) {
|
||||
workInfo = {
|
||||
@ -337,7 +338,7 @@ export function WorkInProgressRoot(): React.ReactElement {
|
||||
break;
|
||||
}
|
||||
|
||||
case CONSTANTS.WorkTypeCompanyPartTime: {
|
||||
case WorkType.CompanyPartTime: {
|
||||
function cancel(): void {
|
||||
player.finishWorkPartTime(true);
|
||||
router.toJob();
|
||||
@ -398,7 +399,7 @@ export function WorkInProgressRoot(): React.ReactElement {
|
||||
break;
|
||||
}
|
||||
|
||||
case CONSTANTS.WorkTypeCrime: {
|
||||
case WorkType.Crime: {
|
||||
const completion = Math.round((player.timeWorked / player.timeNeededToCompleteWork) * 100);
|
||||
|
||||
workInfo = {
|
||||
@ -421,7 +422,7 @@ export function WorkInProgressRoot(): React.ReactElement {
|
||||
break;
|
||||
}
|
||||
|
||||
case CONSTANTS.WorkTypeCreateProgram: {
|
||||
case WorkType.CreateProgram: {
|
||||
function cancel(): void {
|
||||
player.finishCreateProgramWork(true);
|
||||
router.toTerminal();
|
||||
@ -456,7 +457,7 @@ export function WorkInProgressRoot(): React.ReactElement {
|
||||
break;
|
||||
}
|
||||
|
||||
case CONSTANTS.WorkTypeGraftAugmentation: {
|
||||
case WorkType.GraftAugmentation: {
|
||||
function cancel(): void {
|
||||
player.finishGraftAugmentationWork(true);
|
||||
router.toTerminal();
|
||||
|
9
src/utils/WorkType.ts
Normal file
9
src/utils/WorkType.ts
Normal file
@ -0,0 +1,9 @@
|
||||
export enum WorkType {
|
||||
Company = "Working for Company",
|
||||
CompanyPartTime = "Working for Company part-time",
|
||||
Faction = "Working for Faction",
|
||||
CreateProgram = "Working on Create a Program",
|
||||
StudyClass = "Studying or Taking a class at university",
|
||||
Crime = "Committing a crime",
|
||||
GraftAugmentation = "Grafting an Augmentation",
|
||||
}
|
Loading…
Reference in New Issue
Block a user