mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-19 12:45:45 +01:00
refactor some stuff
This commit is contained in:
parent
a5088f1136
commit
0550bc188c
@ -33,7 +33,7 @@ export function StartButton(props: IProps): React.ReactElement {
|
||||
if (disabled) return;
|
||||
props.bladeburner.action.type = props.type;
|
||||
props.bladeburner.action.name = props.name;
|
||||
if (!player.hasAugmentation(AugmentationNames.BladesSimulacrum, true)) player.finishNEWWork(true);
|
||||
if (!player.hasAugmentation(AugmentationNames.BladesSimulacrum, true)) player.finishWork(true);
|
||||
props.bladeburner.startAction(player, props.bladeburner.action);
|
||||
props.rerender();
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ export class Crime {
|
||||
if (div <= 0) {
|
||||
div = 1;
|
||||
}
|
||||
p.startNEWWork(
|
||||
p.startWork(
|
||||
new CrimeWork({
|
||||
crimeType: this.type,
|
||||
singularity: workerScript !== null,
|
||||
|
@ -76,7 +76,7 @@ export function buyDarkwebItem(itemName: string): void {
|
||||
Player.getHomeComputer().pushProgram(item.program);
|
||||
// Cancel if the program is in progress of writing
|
||||
if (isCreateProgramWork(Player.currentWork) && Player.currentWork.programName === item.program) {
|
||||
Player.finishNEWWork(true);
|
||||
Player.finishWork(true);
|
||||
}
|
||||
|
||||
Terminal.print(
|
||||
|
@ -69,7 +69,7 @@ function MainPage({ faction, rerender, onAugmentations }: IMainProps): React.Rea
|
||||
}
|
||||
|
||||
function startFieldWork(faction: Faction): void {
|
||||
player.startNEWWork(
|
||||
player.startWork(
|
||||
new FactionWork({
|
||||
singularity: false,
|
||||
faction: faction.name,
|
||||
@ -80,7 +80,7 @@ function MainPage({ faction, rerender, onAugmentations }: IMainProps): React.Rea
|
||||
}
|
||||
|
||||
function startHackingContracts(faction: Faction): void {
|
||||
player.startNEWWork(
|
||||
player.startWork(
|
||||
new FactionWork({
|
||||
singularity: false,
|
||||
faction: faction.name,
|
||||
@ -91,7 +91,7 @@ function MainPage({ faction, rerender, onAugmentations }: IMainProps): React.Rea
|
||||
}
|
||||
|
||||
function startSecurityWork(faction: Faction): void {
|
||||
player.startNEWWork(
|
||||
player.startWork(
|
||||
new FactionWork({
|
||||
singularity: false,
|
||||
faction: faction.name,
|
||||
|
@ -176,7 +176,7 @@ export function CompanyLocation(props: IProps): React.ReactElement {
|
||||
|
||||
const pos = companyPosition;
|
||||
if (pos instanceof CompanyPosition) {
|
||||
p.startNEWWork(
|
||||
p.startWork(
|
||||
new CompanyWork({
|
||||
singularity: false,
|
||||
companyName: props.locName,
|
||||
|
@ -24,7 +24,7 @@ type IProps = {
|
||||
|
||||
export function GymLocation(props: IProps): React.ReactElement {
|
||||
function train(stat: ClassType): void {
|
||||
props.p.startNEWWork(
|
||||
props.p.startWork(
|
||||
new ClassWork({
|
||||
classType: stat,
|
||||
location: props.loc.name,
|
||||
|
@ -25,7 +25,7 @@ export function UniversityLocation(props: IProps): React.ReactElement {
|
||||
const router = use.Router();
|
||||
|
||||
function take(classType: ClassType): void {
|
||||
player.startNEWWork(
|
||||
player.startWork(
|
||||
new ClassWork({
|
||||
classType: classType,
|
||||
location: props.loc.name,
|
||||
|
@ -76,7 +76,7 @@ export function NetscriptGrafting(player: IPlayer): InternalAPI<IGrafting> {
|
||||
return false;
|
||||
}
|
||||
|
||||
player.startNEWWork(
|
||||
player.startWork(
|
||||
new GraftingWork({
|
||||
singularity: true,
|
||||
augmentation: augName,
|
||||
|
@ -49,7 +49,6 @@ 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";
|
||||
import { ClassWork, ClassType } from "../Work/ClassWork";
|
||||
import { CreateProgramWork, isCreateProgramWork } from "../Work/CreateProgramWork";
|
||||
import { FactionWork } from "../Work/FactionWork";
|
||||
@ -323,7 +322,7 @@ export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript
|
||||
_ctx.log(() => `Invalid class name: ${className}.`);
|
||||
return false;
|
||||
}
|
||||
player.startNEWWork(
|
||||
player.startWork(
|
||||
new ClassWork({
|
||||
classType: task,
|
||||
location: player.location,
|
||||
@ -408,25 +407,25 @@ export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript
|
||||
switch (stat.toLowerCase()) {
|
||||
case "strength".toLowerCase():
|
||||
case "str".toLowerCase():
|
||||
player.startNEWWork(
|
||||
player.startWork(
|
||||
new ClassWork({ classType: ClassType.GymStrength, location: player.location, singularity: true }),
|
||||
);
|
||||
break;
|
||||
case "defense".toLowerCase():
|
||||
case "def".toLowerCase():
|
||||
player.startNEWWork(
|
||||
player.startWork(
|
||||
new ClassWork({ classType: ClassType.GymDefense, location: player.location, singularity: true }),
|
||||
);
|
||||
break;
|
||||
case "dexterity".toLowerCase():
|
||||
case "dex".toLowerCase():
|
||||
player.startNEWWork(
|
||||
player.startWork(
|
||||
new ClassWork({ classType: ClassType.GymDexterity, location: player.location, singularity: true }),
|
||||
);
|
||||
break;
|
||||
case "agility".toLowerCase():
|
||||
case "agi".toLowerCase():
|
||||
player.startNEWWork(
|
||||
player.startWork(
|
||||
new ClassWork({ classType: ClassType.GymAgility, location: player.location, singularity: true }),
|
||||
);
|
||||
break;
|
||||
@ -526,7 +525,7 @@ export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript
|
||||
player.getHomeComputer().pushProgram(item.program);
|
||||
// Cancel if the program is in progress of writing
|
||||
if (isCreateProgramWork(player.currentWork) && player.currentWork.programName === item.program) {
|
||||
player.finishNEWWork(true);
|
||||
player.finishWork(true);
|
||||
}
|
||||
|
||||
player.loseMoney(item.price, "other");
|
||||
@ -725,7 +724,7 @@ export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript
|
||||
function (): boolean {
|
||||
_ctx.helper.checkSingularityAccess();
|
||||
const wasWorking = player.currentWork !== null;
|
||||
player.finishNEWWork(true);
|
||||
player.finishWork(true);
|
||||
return wasWorking;
|
||||
},
|
||||
upgradeHomeCores: (_ctx: NetscriptContext) =>
|
||||
@ -826,7 +825,7 @@ export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript
|
||||
|
||||
const wasFocused = player.focus;
|
||||
|
||||
player.startNEWWork(
|
||||
player.startWork(
|
||||
new CompanyWork({
|
||||
singularity: true,
|
||||
companyName: companyName,
|
||||
@ -994,7 +993,7 @@ export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript
|
||||
_ctx.log(() => `Faction '${faction.name}' do not need help with hacking contracts.`);
|
||||
return false;
|
||||
}
|
||||
player.startNEWWork(
|
||||
player.startWork(
|
||||
new FactionWork({
|
||||
singularity: true,
|
||||
factionWorkType: FactionWorkType.HACKING,
|
||||
@ -1017,7 +1016,7 @@ export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript
|
||||
_ctx.log(() => `Faction '${faction.name}' do not need help with field missions.`);
|
||||
return false;
|
||||
}
|
||||
player.startNEWWork(
|
||||
player.startWork(
|
||||
new FactionWork({
|
||||
singularity: true,
|
||||
factionWorkType: FactionWorkType.FIELD,
|
||||
@ -1040,7 +1039,7 @@ export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript
|
||||
_ctx.log(() => `Faction '${faction.name}' do not need help with security work.`);
|
||||
return false;
|
||||
}
|
||||
player.startNEWWork(
|
||||
player.startWork(
|
||||
new FactionWork({
|
||||
singularity: true,
|
||||
factionWorkType: FactionWorkType.SECURITY,
|
||||
@ -1158,7 +1157,7 @@ export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript
|
||||
return false;
|
||||
}
|
||||
|
||||
player.startNEWWork(
|
||||
player.startWork(
|
||||
new CreateProgramWork({
|
||||
programName: p.name,
|
||||
singularity: true,
|
||||
@ -1181,7 +1180,7 @@ export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript
|
||||
const crimeRoughName = _ctx.helper.string("crimeRoughName", _crimeRoughName);
|
||||
|
||||
if (player.currentWork !== null) {
|
||||
player.finishNEWWork(true);
|
||||
player.finishWork(true);
|
||||
}
|
||||
|
||||
// Set Location to slums
|
||||
|
@ -155,7 +155,7 @@ export const GraftingRoot = (): React.ReactElement => {
|
||||
open={graftOpen}
|
||||
onClose={() => setGraftOpen(false)}
|
||||
onConfirm={() => {
|
||||
player.startNEWWork(
|
||||
player.startWork(
|
||||
new GraftingWork({
|
||||
augmentation: selectedAug,
|
||||
singularity: false,
|
||||
|
@ -25,12 +25,10 @@ import { ICorporation } from "../Corporation/ICorporation";
|
||||
import { IGang } from "../Gang/IGang";
|
||||
import { IBladeburner } from "../Bladeburner/IBladeburner";
|
||||
import { ICodingContractReward } from "../CodingContracts";
|
||||
import { IRouter } from "../ui/Router";
|
||||
import { HacknetServer } from "../Hacknet/HacknetServer";
|
||||
import { ISkillProgress } from "./formulas/skill";
|
||||
import { PlayerAchievement } from "../Achievements/Achievements";
|
||||
import { IPerson } from "./IPerson";
|
||||
import { WorkType } from "../utils/WorkType";
|
||||
import { Work } from "src/Work/Work";
|
||||
|
||||
export interface IPlayer extends IPerson {
|
||||
@ -51,7 +49,6 @@ export interface IPlayer extends IPerson {
|
||||
hasWseAccount: boolean;
|
||||
hp: number;
|
||||
jobs: IMap<string>;
|
||||
init: () => void;
|
||||
karma: number;
|
||||
numPeopleKilled: number;
|
||||
location: LocationName;
|
||||
@ -129,9 +126,10 @@ export interface IPlayer extends IPerson {
|
||||
entropy: number;
|
||||
|
||||
// Methods
|
||||
startNEWWork(w: Work): void;
|
||||
processNEWWork(cycles: number): void;
|
||||
finishNEWWork(cancelled: boolean): void;
|
||||
init: () => void;
|
||||
startWork(w: Work): void;
|
||||
processWork(cycles: number): void;
|
||||
finishWork(cancelled: boolean): void;
|
||||
applyForAgentJob(sing?: boolean): boolean;
|
||||
applyForBusinessConsultantJob(sing?: boolean): boolean;
|
||||
applyForBusinessJob(sing?: boolean): boolean;
|
||||
@ -201,4 +199,5 @@ export interface IPlayer extends IPerson {
|
||||
canAccessCotMG(): boolean;
|
||||
sourceFileLvl(n: number): number;
|
||||
applyEntropy(stacks?: number): void;
|
||||
focusPenalty(): number;
|
||||
}
|
||||
|
67
src/PersonObjects/Multipliers.ts
Normal file
67
src/PersonObjects/Multipliers.ts
Normal file
@ -0,0 +1,67 @@
|
||||
export interface Multipliers {
|
||||
hacking_chance: number;
|
||||
hacking_speed: number;
|
||||
hacking_money: number;
|
||||
hacking_grow: number;
|
||||
hacking: number;
|
||||
hacking_exp: number;
|
||||
strength: number;
|
||||
strength_exp: number;
|
||||
defense: number;
|
||||
defense_exp: number;
|
||||
dexterity: number;
|
||||
dexterity_exp: number;
|
||||
agility: number;
|
||||
agility_exp: number;
|
||||
charisma: number;
|
||||
charisma_exp: number;
|
||||
hacknet_node_money: number;
|
||||
hacknet_node_purchase_cost: number;
|
||||
hacknet_node_ram_cost: number;
|
||||
hacknet_node_core_cost: number;
|
||||
hacknet_node_level_cost: number;
|
||||
company_rep: number;
|
||||
faction_rep: number;
|
||||
work_money: number;
|
||||
crime_success: number;
|
||||
crime_money: number;
|
||||
bladeburner_max_stamina: number;
|
||||
bladeburner_stamina_gain: number;
|
||||
bladeburner_analysis: number;
|
||||
bladeburner_success_chance: number;
|
||||
}
|
||||
|
||||
export const defaultMultipliers = (): Multipliers => {
|
||||
return {
|
||||
hacking_chance: 1,
|
||||
hacking_speed: 1,
|
||||
hacking_money: 1,
|
||||
hacking_grow: 1,
|
||||
hacking: 1,
|
||||
hacking_exp: 1,
|
||||
strength: 1,
|
||||
strength_exp: 1,
|
||||
defense: 1,
|
||||
defense_exp: 1,
|
||||
dexterity: 1,
|
||||
dexterity_exp: 1,
|
||||
agility: 1,
|
||||
agility_exp: 1,
|
||||
charisma: 1,
|
||||
charisma_exp: 1,
|
||||
hacknet_node_money: 1,
|
||||
hacknet_node_purchase_cost: 1,
|
||||
hacknet_node_ram_cost: 1,
|
||||
hacknet_node_core_cost: 1,
|
||||
hacknet_node_level_cost: 1,
|
||||
company_rep: 1,
|
||||
faction_rep: 1,
|
||||
work_money: 1,
|
||||
crime_success: 1,
|
||||
crime_money: 1,
|
||||
bladeburner_max_stamina: 1,
|
||||
bladeburner_stamina_gain: 1,
|
||||
bladeburner_analysis: 1,
|
||||
bladeburner_success_chance: 1,
|
||||
};
|
||||
};
|
@ -140,9 +140,9 @@ export class PlayerObject implements IPlayer {
|
||||
entropy: number;
|
||||
|
||||
// Methods
|
||||
startNEWWork: (w: Work) => void;
|
||||
processNEWWork: (cycles: number) => void;
|
||||
finishNEWWork: (cancelled: boolean) => void;
|
||||
startWork: (w: Work) => void;
|
||||
processWork: (cycles: number) => void;
|
||||
finishWork: (cancelled: boolean) => void;
|
||||
applyForAgentJob: (sing?: boolean) => boolean;
|
||||
applyForBusinessConsultantJob: (sing?: boolean) => boolean;
|
||||
applyForBusinessJob: (sing?: boolean) => boolean;
|
||||
@ -226,6 +226,7 @@ export class PlayerObject implements IPlayer {
|
||||
canAccessCotMG: () => boolean;
|
||||
sourceFileLvl: (n: number) => number;
|
||||
applyEntropy: (stacks?: number) => void;
|
||||
focusPenalty: () => number;
|
||||
|
||||
constructor() {
|
||||
//Skills and stats
|
||||
@ -409,9 +410,9 @@ export class PlayerObject implements IPlayer {
|
||||
this.gainIntelligenceExp = generalMethods.gainIntelligenceExp;
|
||||
this.gainStats = generalMethods.gainStats;
|
||||
this.queryStatFromString = generalMethods.queryStatFromString;
|
||||
this.startNEWWork = workMethods.start;
|
||||
this.processNEWWork = workMethods.process;
|
||||
this.finishNEWWork = workMethods.finish;
|
||||
this.startWork = workMethods.start;
|
||||
this.processWork = workMethods.process;
|
||||
this.finishWork = workMethods.finish;
|
||||
this.startFocusing = generalMethods.startFocusing;
|
||||
this.stopFocusing = generalMethods.stopFocusing;
|
||||
this.takeDamage = generalMethods.takeDamage;
|
||||
@ -477,6 +478,7 @@ export class PlayerObject implements IPlayer {
|
||||
this.sourceFileLvl = generalMethods.sourceFileLvl;
|
||||
|
||||
this.applyEntropy = augmentationMethods.applyEntropy;
|
||||
this.focusPenalty = generalMethods.focusPenalty;
|
||||
}
|
||||
|
||||
whoAmI(): string {
|
||||
|
@ -37,21 +37,13 @@ import { SpecialServers } from "../../Server/data/SpecialServers";
|
||||
import { applySourceFile } from "../../SourceFile/applySourceFile";
|
||||
import { applyExploit } from "../../Exploits/applyExploits";
|
||||
import { SourceFiles } from "../../SourceFile/SourceFiles";
|
||||
import { influenceStockThroughCompanyWork } from "../../StockMarket/PlayerInfluencing";
|
||||
import { getHospitalizationCost } from "../../Hospital/Hospital";
|
||||
import { HacknetServer } from "../../Hacknet/HacknetServer";
|
||||
|
||||
import { numeralWrapper } from "../../ui/numeralFormat";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { MoneySourceTracker } from "../../utils/MoneySourceTracker";
|
||||
import { dialogBoxCreate } from "../../ui/React/DialogBox";
|
||||
import { convertTimeMsToTimeElapsedString } from "../../utils/StringHelperFunctions";
|
||||
|
||||
import { Reputation } from "../../ui/React/Reputation";
|
||||
import { Money } from "../../ui/React/Money";
|
||||
|
||||
import React from "react";
|
||||
import { serverMetadata } from "../../Server/data/servers";
|
||||
import { SnackbarEvents, ToastVariant } from "../../ui/React/Snackbar";
|
||||
import { achievements } from "../../Achievements/Achievements";
|
||||
import { FactionNames } from "../../Faction/data/FactionNames";
|
||||
@ -59,7 +51,6 @@ import { ITaskTracker } from "../ITaskTracker";
|
||||
import { IPerson } from "../IPerson";
|
||||
import { Player } from "../../Player";
|
||||
|
||||
import { WorkType } from "../../utils/WorkType";
|
||||
import { isCompanyWork } from "../../Work/CompanyWork";
|
||||
|
||||
export function init(this: IPlayer): void {
|
||||
@ -617,7 +608,7 @@ export function getNextCompanyPosition(
|
||||
|
||||
export function quitJob(this: IPlayer, company: string, _sing = false): void {
|
||||
if (isCompanyWork(this.currentWork) && this.currentWork.companyName === company) {
|
||||
this.finishNEWWork(true);
|
||||
this.finishWork(true);
|
||||
}
|
||||
delete this.jobs[company];
|
||||
if (this.companyName === company) {
|
||||
@ -1487,3 +1478,11 @@ export function sourceFileLvl(this: IPlayer, n: number): number {
|
||||
if (!sf) return 0;
|
||||
return sf.lvl;
|
||||
}
|
||||
|
||||
export function focusPenalty(this: IPlayer): number {
|
||||
let focus = 1;
|
||||
if (!this.hasAugmentation(AugmentationNames["NeuroreceptorManager"])) {
|
||||
focus = this.focus ? 1 : CONSTANTS.BaseFocusBonus;
|
||||
}
|
||||
return focus;
|
||||
}
|
@ -11,7 +11,7 @@ export function process(this: IPlayer, cycles = 1): void {
|
||||
if (this.currentWork === null) return;
|
||||
const finished = this.currentWork.process(this, cycles);
|
||||
if (finished) {
|
||||
this.finishNEWWork(false);
|
||||
this.finishWork(false);
|
||||
}
|
||||
}
|
||||
export function finish(this: IPlayer, cancelled: boolean): void {
|
||||
|
@ -97,7 +97,7 @@ export function ProgramsRoot(): React.ReactElement {
|
||||
sx={{ my: 1, width: "100%" }}
|
||||
onClick={(event) => {
|
||||
if (!event.isTrusted) return;
|
||||
player.startNEWWork(
|
||||
player.startWork(
|
||||
new CreateProgramWork({ player: player, singularity: false, programName: program.name }),
|
||||
);
|
||||
player.startFocusing();
|
||||
|
@ -5,9 +5,7 @@ import { CONSTANTS } from "../Constants";
|
||||
import { determineCrimeSuccess } from "../Crime/CrimeHelpers";
|
||||
import { Crimes } from "../Crime/Crimes";
|
||||
import { IPlayer } from "../PersonObjects/IPlayer";
|
||||
import { numeralWrapper } from "../ui/numeralFormat";
|
||||
import { dialogBoxCreate } from "../ui/React/DialogBox";
|
||||
import { Money } from "../ui/React/Money";
|
||||
import { CrimeType } from "../utils/WorkType";
|
||||
import { Work, WorkType } from "./Work";
|
||||
|
||||
@ -20,10 +18,12 @@ export const isCrimeWork = (w: Work | null): w is CrimeWork => w !== null && w.t
|
||||
|
||||
export class CrimeWork extends Work {
|
||||
crimeType: CrimeType;
|
||||
unitCompleted: number;
|
||||
|
||||
constructor(params?: CrimeWorkParams) {
|
||||
super(WorkType.CRIME, params?.singularity ?? true);
|
||||
this.crimeType = params?.crimeType ?? CrimeType.Shoplift;
|
||||
this.unitCompleted = 0;
|
||||
}
|
||||
|
||||
getCrime(): Crime {
|
||||
@ -35,11 +35,15 @@ export class CrimeWork extends Work {
|
||||
process(player: IPlayer, cycles = 1): boolean {
|
||||
this.cyclesWorked += cycles;
|
||||
const time = Object.values(Crimes).find((c) => c.type === this.crimeType)?.time ?? 0;
|
||||
return this.cyclesWorked * CONSTANTS._idleSpeed >= time;
|
||||
this.unitCompleted += CONSTANTS._idleSpeed * cycles;
|
||||
if (this.unitCompleted >= time) {
|
||||
this.commit(player);
|
||||
this.unitCompleted -= time;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
finish(player: IPlayer, cancelled: boolean): void {
|
||||
if (cancelled) return;
|
||||
commit(player: IPlayer): void {
|
||||
let crime = null;
|
||||
for (const i of Object.keys(Crimes)) {
|
||||
if (Crimes[i].type == this.crimeType) {
|
||||
@ -53,6 +57,7 @@ export class CrimeWork extends Work {
|
||||
);
|
||||
return;
|
||||
}
|
||||
const focusPenalty = player.focusPenalty();
|
||||
// exp times 2 because were trying to maintain the same numbers as before the conversion
|
||||
// Technically the definition of Crimes should have the success numbers and failure should divide by 4
|
||||
let hackExp = crime.hacking_exp * 2;
|
||||
@ -64,9 +69,9 @@ export class CrimeWork extends Work {
|
||||
let karma = crime.karma;
|
||||
const success = determineCrimeSuccess(player, crime.type);
|
||||
if (success) {
|
||||
player.gainMoney(crime.money, "crime");
|
||||
player.gainMoney(crime.money * focusPenalty, "crime");
|
||||
player.numPeopleKilled += crime.kills;
|
||||
player.gainIntelligenceExp(crime.intelligence_exp);
|
||||
player.gainIntelligenceExp(crime.intelligence_exp * focusPenalty);
|
||||
} else {
|
||||
hackExp /= 4;
|
||||
StrExp /= 4;
|
||||
@ -76,42 +81,17 @@ export class CrimeWork extends Work {
|
||||
ChaExp /= 4;
|
||||
karma /= 4;
|
||||
}
|
||||
player.gainHackingExp(hackExp * focusPenalty);
|
||||
player.gainStrengthExp(StrExp * focusPenalty);
|
||||
player.gainDefenseExp(DefExp * focusPenalty);
|
||||
player.gainDexterityExp(DexExp * focusPenalty);
|
||||
player.gainAgilityExp(AgiExp * focusPenalty);
|
||||
player.gainCharismaExp(ChaExp * focusPenalty);
|
||||
player.karma -= karma * focusPenalty;
|
||||
}
|
||||
|
||||
player.gainHackingExp(hackExp);
|
||||
player.gainStrengthExp(StrExp);
|
||||
player.gainDefenseExp(DefExp);
|
||||
player.gainDexterityExp(DexExp);
|
||||
player.gainAgilityExp(AgiExp);
|
||||
player.gainCharismaExp(ChaExp);
|
||||
player.karma -= karma;
|
||||
|
||||
if (!this.singularity) {
|
||||
dialogBoxCreate(
|
||||
<>
|
||||
Crime {success ? "successful" : "failed"}!
|
||||
<br />
|
||||
<br />
|
||||
You gained:
|
||||
{success && (
|
||||
<>
|
||||
<br />
|
||||
<Money money={crime.money} />
|
||||
</>
|
||||
)}
|
||||
<br />
|
||||
{numeralWrapper.formatExp(hackExp)} hacking experience <br />
|
||||
{numeralWrapper.formatExp(StrExp)} strength experience
|
||||
<br />
|
||||
{numeralWrapper.formatExp(DefExp)} defense experience
|
||||
<br />
|
||||
{numeralWrapper.formatExp(DexExp)} dexterity experience
|
||||
<br />
|
||||
{numeralWrapper.formatExp(AgiExp)} agility experience
|
||||
<br />
|
||||
{numeralWrapper.formatExp(ChaExp)} charisma experience
|
||||
</>,
|
||||
);
|
||||
}
|
||||
finish(player: IPlayer, cancelled: boolean): void {
|
||||
if (cancelled) return;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,3 @@
|
||||
import { AugmentationNames } from "../Augmentation/data/AugmentationNames";
|
||||
import { CONSTANTS } from "../Constants";
|
||||
import { IPlayer } from "../PersonObjects/IPlayer";
|
||||
|
||||
export interface WorkStats {
|
||||
|
@ -50,8 +50,6 @@ 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;
|
||||
@ -96,7 +94,7 @@ const Engine: {
|
||||
|
||||
Terminal.process(Router, Player, numCycles);
|
||||
|
||||
Player.processNEWWork(numCycles);
|
||||
Player.processWork(numCycles);
|
||||
|
||||
// Update stock prices
|
||||
if (Player.hasWseAccount) {
|
||||
@ -295,7 +293,7 @@ const Engine: {
|
||||
loadAllRunningScripts(Player); // This also takes care of offline production for those scripts
|
||||
if (Player.currentWork !== null) {
|
||||
Player.focus = true;
|
||||
Player.processNEWWork(numCyclesOffline);
|
||||
Player.processWork(numCyclesOffline);
|
||||
} else {
|
||||
for (let i = 0; i < Player.factions.length; i++) {
|
||||
const facName = Player.factions[i];
|
||||
|
@ -152,7 +152,7 @@ function Work(): React.ReactElement {
|
||||
let innerText = <></>;
|
||||
if (isCrimeWork(player.currentWork)) {
|
||||
const crime = player.currentWork.getCrime();
|
||||
const perc = ((player.currentWork.cyclesWorked * CONSTANTS._idleSpeed) / crime.time) * 100;
|
||||
const perc = (player.currentWork.unitCompleted / crime.time) * 100;
|
||||
|
||||
details = <>{player.currentWork.crimeType}</>;
|
||||
header = <>You are attempting to {player.currentWork.crimeType}</>;
|
||||
|
@ -18,7 +18,6 @@ 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";
|
||||
import { isCrimeWork } from "../Work/CrimeWork";
|
||||
import { isClassWork } from "../Work/ClassWork";
|
||||
import { WorkStats } from "../Work/WorkStats";
|
||||
@ -145,13 +144,13 @@ export function WorkInProgressRoot(): React.ReactElement {
|
||||
if (player.currentWork !== null) {
|
||||
if (isCrimeWork(player.currentWork)) {
|
||||
const crime = player.currentWork.getCrime();
|
||||
const completion = ((player.currentWork.cyclesWorked * CONSTANTS._idleSpeed) / crime.time) * 100;
|
||||
const completion = (player.currentWork.unitCompleted / crime.time) * 100;
|
||||
|
||||
workInfo = {
|
||||
buttons: {
|
||||
cancel: () => {
|
||||
router.toLocation(Locations[LocationName.Slums]);
|
||||
player.finishNEWWork(true);
|
||||
player.finishWork(true);
|
||||
},
|
||||
unfocus: () => {
|
||||
router.toCity();
|
||||
@ -161,18 +160,18 @@ export function WorkInProgressRoot(): React.ReactElement {
|
||||
title: `You are attempting to ${crime.type}`,
|
||||
|
||||
progress: {
|
||||
remaining: crime.time - player.currentWork.cyclesWorked * CONSTANTS._idleSpeed,
|
||||
remaining: crime.time - player.currentWork.unitCompleted,
|
||||
percentage: completion,
|
||||
},
|
||||
|
||||
stopText: "Cancel crime",
|
||||
stopText: "Stop commiting crime",
|
||||
};
|
||||
}
|
||||
|
||||
if (isClassWork(player.currentWork)) {
|
||||
const classWork = player.currentWork;
|
||||
function cancel(): void {
|
||||
player.finishNEWWork(true);
|
||||
player.finishWork(true);
|
||||
router.toCity();
|
||||
}
|
||||
|
||||
@ -219,7 +218,7 @@ export function WorkInProgressRoot(): React.ReactElement {
|
||||
if (isCreateProgramWork(player.currentWork)) {
|
||||
const create = player.currentWork;
|
||||
function cancel(): void {
|
||||
player.finishNEWWork(true);
|
||||
player.finishWork(true);
|
||||
router.toTerminal();
|
||||
}
|
||||
function unfocus(): void {
|
||||
@ -253,7 +252,7 @@ export function WorkInProgressRoot(): React.ReactElement {
|
||||
if (isGraftingWork(player.currentWork)) {
|
||||
const graft = player.currentWork;
|
||||
function cancel(): void {
|
||||
player.finishNEWWork(true);
|
||||
player.finishWork(true);
|
||||
router.toTerminal();
|
||||
}
|
||||
function unfocus(): void {
|
||||
@ -303,7 +302,7 @@ export function WorkInProgressRoot(): React.ReactElement {
|
||||
|
||||
function cancel(): void {
|
||||
router.toFaction(faction);
|
||||
player.finishNEWWork(true);
|
||||
player.finishWork(true);
|
||||
}
|
||||
function unfocus(): void {
|
||||
router.toFaction(faction);
|
||||
@ -362,7 +361,7 @@ export function WorkInProgressRoot(): React.ReactElement {
|
||||
const companyRep = comp.playerReputation;
|
||||
|
||||
function cancel(): void {
|
||||
player.finishNEWWork(true);
|
||||
player.finishWork(true);
|
||||
router.toJob();
|
||||
}
|
||||
function unfocus(): void {
|
||||
|
@ -1,14 +1,3 @@
|
||||
export enum WorkType {
|
||||
None = "",
|
||||
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",
|
||||
}
|
||||
|
||||
export enum CrimeType {
|
||||
None = "",
|
||||
Shoplift = "shoplift",
|
||||
|
Loading…
Reference in New Issue
Block a user