2022-05-03 00:31:40 +02:00
|
|
|
import { Box, Container, Paper, Table, TableBody, Tooltip } from "@mui/material";
|
|
|
|
import Button from "@mui/material/Button";
|
|
|
|
import Typography from "@mui/material/Typography";
|
|
|
|
import { uniqueId } from "lodash";
|
|
|
|
import React, { useEffect, useState } from "react";
|
|
|
|
import { Companies } from "../Company/Companies";
|
|
|
|
import { Company } from "../Company/Company";
|
2021-09-18 01:43:08 +02:00
|
|
|
import { CONSTANTS } from "../Constants";
|
2022-05-03 00:31:40 +02:00
|
|
|
import { LocationName } from "../Locations/data/LocationNames";
|
|
|
|
import { Locations } from "../Locations/Locations";
|
|
|
|
import { Settings } from "../Settings/Settings";
|
|
|
|
import { convertTimeMsToTimeElapsedString } from "../utils/StringHelperFunctions";
|
|
|
|
import { use } from "./Context";
|
2021-09-18 01:43:08 +02:00
|
|
|
import { numeralWrapper } from "./numeralFormat";
|
2022-05-03 00:31:40 +02:00
|
|
|
import { Money } from "./React/Money";
|
|
|
|
import { MoneyRate } from "./React/MoneyRate";
|
|
|
|
import { ProgressBar } from "./React/Progress";
|
2021-09-18 01:43:08 +02:00
|
|
|
import { Reputation } from "./React/Reputation";
|
|
|
|
import { ReputationRate } from "./React/ReputationRate";
|
2022-05-03 00:31:40 +02:00
|
|
|
import { StatsRow } from "./React/StatsRow";
|
2022-07-11 21:58:23 +02:00
|
|
|
import { WorkType } from "../utils/WorkType";
|
2022-07-07 08:00:23 +02:00
|
|
|
import { isCrimeWork } from "../Work/CrimeWork";
|
2022-07-07 23:28:23 +02:00
|
|
|
import { isClassWork } from "../Work/ClassWork";
|
2022-07-12 07:54:19 +02:00
|
|
|
import { newWorkStats, WorkStats } from "../Work/WorkStats";
|
2022-07-10 07:37:36 +02:00
|
|
|
import { isCreateProgramWork } from "../Work/CreateProgramWork";
|
|
|
|
import { isGraftingWork } from "../Work/GraftingWork";
|
2022-07-12 07:54:19 +02:00
|
|
|
import { isFactionWork } from "../Work/FactionWork";
|
|
|
|
import { FactionWorkType } from "../Work/data/FactionWorkType";
|
2021-09-18 01:43:08 +02:00
|
|
|
|
|
|
|
const CYCLES_PER_SEC = 1000 / CONSTANTS.MilliPerCycle;
|
|
|
|
|
2022-05-02 23:34:17 +02:00
|
|
|
interface IWorkInfo {
|
|
|
|
buttons: {
|
|
|
|
cancel: () => void;
|
|
|
|
unfocus?: () => void;
|
|
|
|
};
|
|
|
|
title: string | React.ReactElement;
|
|
|
|
|
|
|
|
description?: string | React.ReactElement;
|
|
|
|
gains?: (string | React.ReactElement)[];
|
|
|
|
progress?: {
|
|
|
|
elapsed?: number;
|
2022-05-03 00:31:40 +02:00
|
|
|
remaining?: number;
|
2022-05-02 23:34:17 +02:00
|
|
|
percentage?: number;
|
|
|
|
};
|
|
|
|
|
|
|
|
stopText: string;
|
|
|
|
stopTooltip?: string | React.ReactElement;
|
|
|
|
}
|
|
|
|
|
2022-07-12 07:54:19 +02:00
|
|
|
export function ExpRows(rate: WorkStats): React.ReactElement[] {
|
2022-07-07 23:28:23 +02:00
|
|
|
return [
|
2022-07-12 07:54:19 +02:00
|
|
|
rate.hackExp > 0 ? (
|
2022-07-07 23:28:23 +02:00
|
|
|
<StatsRow
|
|
|
|
name="Hacking Exp"
|
|
|
|
color={Settings.theme.hack}
|
|
|
|
data={{
|
2022-07-12 07:54:19 +02:00
|
|
|
content: `${numeralWrapper.formatExp(rate.hackExp * CYCLES_PER_SEC)} / sec`,
|
2022-07-07 23:28:23 +02:00
|
|
|
}}
|
|
|
|
/>
|
|
|
|
) : (
|
|
|
|
<></>
|
|
|
|
),
|
2022-07-12 07:54:19 +02:00
|
|
|
rate.strExp > 0 ? (
|
2022-07-07 23:28:23 +02:00
|
|
|
<StatsRow
|
|
|
|
name="Strength Exp"
|
|
|
|
color={Settings.theme.combat}
|
|
|
|
data={{
|
2022-07-12 07:54:19 +02:00
|
|
|
content: `${numeralWrapper.formatExp(rate.strExp * CYCLES_PER_SEC)} / sec`,
|
2022-07-07 23:28:23 +02:00
|
|
|
}}
|
|
|
|
/>
|
|
|
|
) : (
|
|
|
|
<></>
|
|
|
|
),
|
2022-07-12 07:54:19 +02:00
|
|
|
rate.defExp > 0 ? (
|
2022-07-07 23:28:23 +02:00
|
|
|
<StatsRow
|
|
|
|
name="Defense Exp"
|
|
|
|
color={Settings.theme.combat}
|
|
|
|
data={{
|
2022-07-12 07:54:19 +02:00
|
|
|
content: `${numeralWrapper.formatExp(rate.defExp * CYCLES_PER_SEC)} / sec`,
|
2022-07-07 23:28:23 +02:00
|
|
|
}}
|
|
|
|
/>
|
|
|
|
) : (
|
|
|
|
<></>
|
|
|
|
),
|
2022-07-12 07:54:19 +02:00
|
|
|
rate.dexExp > 0 ? (
|
2022-07-07 23:28:23 +02:00
|
|
|
<StatsRow
|
|
|
|
name="Dexterity Exp"
|
|
|
|
color={Settings.theme.combat}
|
|
|
|
data={{
|
2022-07-12 07:54:19 +02:00
|
|
|
content: `${numeralWrapper.formatExp(rate.dexExp * CYCLES_PER_SEC)} / sec`,
|
2022-07-07 23:28:23 +02:00
|
|
|
}}
|
|
|
|
/>
|
|
|
|
) : (
|
|
|
|
<></>
|
|
|
|
),
|
2022-07-12 07:54:19 +02:00
|
|
|
rate.agiExp > 0 ? (
|
2022-07-07 23:28:23 +02:00
|
|
|
<StatsRow
|
|
|
|
name="Agility Exp"
|
|
|
|
color={Settings.theme.combat}
|
|
|
|
data={{
|
2022-07-12 07:54:19 +02:00
|
|
|
content: `${numeralWrapper.formatExp(rate.agiExp * CYCLES_PER_SEC)} / sec`,
|
2022-07-07 23:28:23 +02:00
|
|
|
}}
|
|
|
|
/>
|
|
|
|
) : (
|
|
|
|
<></>
|
|
|
|
),
|
2022-07-12 07:54:19 +02:00
|
|
|
rate.chaExp > 0 ? (
|
2022-07-07 23:28:23 +02:00
|
|
|
<StatsRow
|
|
|
|
name="Charisma Exp"
|
|
|
|
color={Settings.theme.cha}
|
|
|
|
data={{
|
2022-07-12 07:54:19 +02:00
|
|
|
content: `${numeralWrapper.formatExp(rate.chaExp * CYCLES_PER_SEC)} / sec`,
|
2022-07-07 23:28:23 +02:00
|
|
|
}}
|
|
|
|
/>
|
|
|
|
) : (
|
|
|
|
<></>
|
|
|
|
),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2021-09-18 01:43:08 +02:00
|
|
|
export function WorkInProgressRoot(): React.ReactElement {
|
|
|
|
const setRerender = useState(false)[1];
|
|
|
|
function rerender(): void {
|
|
|
|
setRerender((old) => !old);
|
|
|
|
}
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
const id = setInterval(rerender, CONSTANTS.MilliPerCycle);
|
|
|
|
return () => clearInterval(id);
|
|
|
|
}, []);
|
2022-03-09 15:09:14 +01:00
|
|
|
|
2021-09-18 01:43:08 +02:00
|
|
|
const player = use.Player();
|
|
|
|
const router = use.Router();
|
2022-03-09 15:09:14 +01:00
|
|
|
|
2022-07-07 23:28:23 +02:00
|
|
|
let expGains = [
|
2022-05-03 00:31:40 +02:00
|
|
|
player.workHackExpGained > 0 ? (
|
|
|
|
<StatsRow
|
|
|
|
name="Hacking Exp"
|
|
|
|
color={Settings.theme.hack}
|
|
|
|
data={{
|
|
|
|
content: `${numeralWrapper.formatExp(player.workHackExpGained)} (${numeralWrapper.formatExp(
|
|
|
|
player.workHackExpGainRate * CYCLES_PER_SEC,
|
|
|
|
)} / sec)`,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
) : (
|
|
|
|
<></>
|
|
|
|
),
|
|
|
|
player.workStrExpGained > 0 ? (
|
|
|
|
<StatsRow
|
|
|
|
name="Strength Exp"
|
|
|
|
color={Settings.theme.combat}
|
|
|
|
data={{
|
|
|
|
content: `${numeralWrapper.formatExp(player.workStrExpGained)} (${numeralWrapper.formatExp(
|
|
|
|
player.workStrExpGainRate * CYCLES_PER_SEC,
|
|
|
|
)} / sec)`,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
) : (
|
|
|
|
<></>
|
|
|
|
),
|
|
|
|
player.workDefExpGained > 0 ? (
|
|
|
|
<StatsRow
|
|
|
|
name="Defense Exp"
|
|
|
|
color={Settings.theme.combat}
|
|
|
|
data={{
|
|
|
|
content: `${numeralWrapper.formatExp(player.workDefExpGained)} (${numeralWrapper.formatExp(
|
|
|
|
player.workDefExpGainRate * CYCLES_PER_SEC,
|
|
|
|
)} / sec)`,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
) : (
|
|
|
|
<></>
|
|
|
|
),
|
|
|
|
player.workDexExpGained > 0 ? (
|
|
|
|
<StatsRow
|
|
|
|
name="Dexterity Exp"
|
|
|
|
color={Settings.theme.combat}
|
|
|
|
data={{
|
|
|
|
content: `${numeralWrapper.formatExp(player.workDexExpGained)} (${numeralWrapper.formatExp(
|
|
|
|
player.workDexExpGainRate * CYCLES_PER_SEC,
|
|
|
|
)} / sec)`,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
) : (
|
|
|
|
<></>
|
|
|
|
),
|
|
|
|
player.workAgiExpGained > 0 ? (
|
|
|
|
<StatsRow
|
|
|
|
name="Agility Exp"
|
|
|
|
color={Settings.theme.combat}
|
|
|
|
data={{
|
|
|
|
content: `${numeralWrapper.formatExp(player.workAgiExpGained)} (${numeralWrapper.formatExp(
|
|
|
|
player.workAgiExpGainRate * CYCLES_PER_SEC,
|
|
|
|
)} / sec)`,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
) : (
|
|
|
|
<></>
|
|
|
|
),
|
|
|
|
player.workChaExpGained > 0 ? (
|
|
|
|
<StatsRow
|
|
|
|
name="Charisma Exp"
|
|
|
|
color={Settings.theme.cha}
|
|
|
|
data={{
|
|
|
|
content: `${numeralWrapper.formatExp(player.workChaExpGained)} (${numeralWrapper.formatExp(
|
|
|
|
player.workChaExpGainRate * CYCLES_PER_SEC,
|
|
|
|
)} / sec)`,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
) : (
|
|
|
|
<></>
|
|
|
|
),
|
|
|
|
];
|
|
|
|
|
2022-07-07 08:00:23 +02:00
|
|
|
let workInfo: IWorkInfo = {
|
|
|
|
buttons: {
|
|
|
|
cancel: () => undefined,
|
|
|
|
},
|
|
|
|
title: "",
|
|
|
|
stopText: "",
|
|
|
|
};
|
|
|
|
|
|
|
|
if (player.currentWork !== null) {
|
|
|
|
if (isCrimeWork(player.currentWork)) {
|
|
|
|
const crime = player.currentWork.getCrime();
|
2022-07-07 08:03:02 +02:00
|
|
|
const completion = ((player.currentWork.cyclesWorked * CONSTANTS._idleSpeed) / crime.time) * 100;
|
2022-07-07 08:00:23 +02:00
|
|
|
|
|
|
|
workInfo = {
|
|
|
|
buttons: {
|
|
|
|
cancel: () => {
|
|
|
|
router.toLocation(Locations[LocationName.Slums]);
|
|
|
|
player.finishNEWWork(true);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
title: `You are attempting to ${crime.type}`,
|
|
|
|
|
|
|
|
progress: {
|
|
|
|
remaining: crime.time - player.currentWork.cyclesWorked * CONSTANTS._idleSpeed,
|
|
|
|
percentage: completion,
|
|
|
|
},
|
|
|
|
|
|
|
|
stopText: "Cancel crime",
|
|
|
|
};
|
|
|
|
}
|
2022-07-07 23:28:23 +02:00
|
|
|
|
|
|
|
if (isClassWork(player.currentWork)) {
|
|
|
|
const classWork = player.currentWork;
|
|
|
|
function cancel(): void {
|
|
|
|
player.finishNEWWork(true);
|
|
|
|
router.toCity();
|
|
|
|
}
|
|
|
|
|
|
|
|
function unfocus(): void {
|
|
|
|
router.toCity();
|
|
|
|
player.stopFocusing();
|
|
|
|
}
|
|
|
|
|
|
|
|
let stopText = "";
|
|
|
|
if (classWork.isGym()) {
|
|
|
|
stopText = "Stop training at gym";
|
|
|
|
} else {
|
|
|
|
stopText = "Stop taking course";
|
|
|
|
}
|
|
|
|
|
|
|
|
const rates = classWork.calculateRates(player);
|
2022-07-12 07:54:19 +02:00
|
|
|
expGains = ExpRows(rates);
|
2022-07-07 23:28:23 +02:00
|
|
|
workInfo = {
|
|
|
|
buttons: {
|
|
|
|
cancel: cancel,
|
|
|
|
unfocus: unfocus,
|
|
|
|
},
|
|
|
|
title: (
|
|
|
|
<>
|
|
|
|
You are currently <b>{classWork.getClass().youAreCurrently}</b>
|
|
|
|
</>
|
|
|
|
),
|
|
|
|
|
|
|
|
gains: [
|
|
|
|
<StatsRow name="Total Cost" color={Settings.theme.money}>
|
|
|
|
<Typography>
|
|
|
|
<Money money={classWork.earnings.money} /> (<MoneyRate money={rates.money * CYCLES_PER_SEC} />)
|
|
|
|
</Typography>
|
|
|
|
</StatsRow>,
|
|
|
|
...expGains,
|
|
|
|
],
|
|
|
|
progress: {
|
|
|
|
elapsed: classWork.cyclesWorked * CONSTANTS._idleSpeed,
|
|
|
|
},
|
|
|
|
|
|
|
|
stopText: stopText,
|
|
|
|
};
|
|
|
|
}
|
2022-07-10 07:37:36 +02:00
|
|
|
|
|
|
|
if (isCreateProgramWork(player.currentWork)) {
|
|
|
|
const create = player.currentWork;
|
|
|
|
function cancel(): void {
|
|
|
|
player.finishNEWWork(true);
|
|
|
|
router.toTerminal();
|
|
|
|
}
|
|
|
|
function unfocus(): void {
|
|
|
|
router.toTerminal();
|
|
|
|
player.stopFocusing();
|
|
|
|
}
|
|
|
|
|
|
|
|
const completion = (create.unitCompleted / create.unitNeeded()) * 100;
|
|
|
|
|
|
|
|
workInfo = {
|
|
|
|
buttons: {
|
|
|
|
cancel: cancel,
|
|
|
|
unfocus: unfocus,
|
|
|
|
},
|
|
|
|
title: (
|
|
|
|
<>
|
|
|
|
You are currently working on coding <b>{create.programName}</b>
|
|
|
|
</>
|
|
|
|
),
|
|
|
|
|
|
|
|
progress: {
|
|
|
|
elapsed: create.cyclesWorked * CONSTANTS._idleSpeed,
|
|
|
|
percentage: completion,
|
|
|
|
},
|
|
|
|
|
|
|
|
stopText: "Stop creating program",
|
|
|
|
stopTooltip: "Your work will be saved and you can return to complete the program later.",
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isGraftingWork(player.currentWork)) {
|
|
|
|
const graft = player.currentWork;
|
|
|
|
function cancel(): void {
|
|
|
|
player.finishNEWWork(true);
|
|
|
|
router.toTerminal();
|
|
|
|
}
|
|
|
|
function unfocus(): void {
|
|
|
|
router.toTerminal();
|
|
|
|
player.stopFocusing();
|
|
|
|
}
|
|
|
|
|
|
|
|
workInfo = {
|
|
|
|
buttons: {
|
|
|
|
cancel: cancel,
|
|
|
|
unfocus: unfocus,
|
|
|
|
},
|
|
|
|
title: (
|
|
|
|
<>
|
|
|
|
You are currently working on grafting <b>{graft.augmentation}</b>
|
|
|
|
</>
|
|
|
|
),
|
|
|
|
|
|
|
|
progress: {
|
|
|
|
elapsed: graft.cyclesWorked * CONSTANTS._idleSpeed,
|
|
|
|
percentage: (graft.unitCompleted / graft.unitNeeded()) * 100,
|
|
|
|
},
|
|
|
|
|
|
|
|
stopText: "Stop grafting",
|
|
|
|
stopTooltip: (
|
|
|
|
<>
|
|
|
|
If you cancel, your work will <b>not</b> be saved, and the money you spent will <b>not</b> be returned
|
|
|
|
</>
|
|
|
|
),
|
|
|
|
};
|
|
|
|
}
|
2022-05-03 00:31:40 +02:00
|
|
|
|
2022-07-12 07:54:19 +02:00
|
|
|
if (isFactionWork(player.currentWork)) {
|
|
|
|
const faction = player.currentWork.getFaction();
|
2022-05-04 19:44:48 +02:00
|
|
|
if (!faction) {
|
|
|
|
workInfo = {
|
|
|
|
buttons: {
|
|
|
|
cancel: () => router.toFactions(),
|
|
|
|
},
|
|
|
|
title:
|
2022-07-12 07:54:19 +02:00
|
|
|
`You have not joined ${player.currentWork.factionName || "(Faction not found)"} at this time,` +
|
2022-05-04 19:44:48 +02:00
|
|
|
" please try again if you think this should have worked",
|
|
|
|
|
|
|
|
stopText: "Back to Factions",
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
function cancel(): void {
|
|
|
|
router.toFaction(faction);
|
2022-07-12 07:54:19 +02:00
|
|
|
player.finishNEWWork(true);
|
2022-05-04 19:44:48 +02:00
|
|
|
}
|
|
|
|
function unfocus(): void {
|
|
|
|
router.toFaction(faction);
|
|
|
|
player.stopFocusing();
|
|
|
|
}
|
|
|
|
|
2022-07-12 07:54:19 +02:00
|
|
|
const description = {
|
|
|
|
[FactionWorkType.HACKING]: "carrying out hacking contracts",
|
|
|
|
[FactionWorkType.FIELD]: "carrying out field missions",
|
|
|
|
[FactionWorkType.SECURITY]: "performing security detail",
|
|
|
|
};
|
|
|
|
|
|
|
|
const exp = player.currentWork.getExpRates(player);
|
|
|
|
|
2022-05-03 00:31:40 +02:00
|
|
|
workInfo = {
|
|
|
|
buttons: {
|
2022-05-04 19:44:48 +02:00
|
|
|
cancel: cancel,
|
|
|
|
unfocus: unfocus,
|
|
|
|
},
|
|
|
|
title: (
|
|
|
|
<>
|
2022-07-12 07:54:19 +02:00
|
|
|
You are currently {description[player.currentWork.factionWorkType]} for <b>{faction.name}</b>
|
2022-05-04 19:44:48 +02:00
|
|
|
</>
|
|
|
|
),
|
|
|
|
|
|
|
|
description: (
|
|
|
|
<>
|
2022-07-12 07:54:19 +02:00
|
|
|
Current Faction Reputation: <Reputation reputation={faction.playerReputation} /> (
|
|
|
|
<ReputationRate reputation={player.currentWork.getReputationRate(player) * CYCLES_PER_SEC} />)
|
2022-05-04 19:44:48 +02:00
|
|
|
</>
|
|
|
|
),
|
2022-07-12 07:54:19 +02:00
|
|
|
gains: ExpRows(exp),
|
2022-05-04 19:44:48 +02:00
|
|
|
progress: {
|
2022-07-12 07:54:19 +02:00
|
|
|
elapsed: player.currentWork.cyclesWorked * CONSTANTS._idleSpeed,
|
2022-05-03 00:31:40 +02:00
|
|
|
},
|
|
|
|
|
2022-05-04 19:44:48 +02:00
|
|
|
stopText: "Stop Faction work",
|
2022-05-03 00:31:40 +02:00
|
|
|
};
|
2021-09-18 01:43:08 +02:00
|
|
|
}
|
2022-07-12 07:54:19 +02:00
|
|
|
}
|
2022-05-04 19:44:48 +02:00
|
|
|
|
2022-07-12 07:54:19 +02:00
|
|
|
switch (player.workType) {
|
2022-05-04 20:42:48 +02:00
|
|
|
case WorkType.Company: {
|
2022-05-04 19:44:48 +02:00
|
|
|
const comp = Companies[player.companyName];
|
|
|
|
if (comp == null || !(comp instanceof Company)) {
|
|
|
|
workInfo = {
|
|
|
|
buttons: {
|
|
|
|
cancel: () => router.toTerminal(),
|
|
|
|
},
|
|
|
|
title:
|
|
|
|
`You cannot work for ${player.companyName || "(Company not found)"} at this time,` +
|
|
|
|
" please try again if you think this should have worked",
|
|
|
|
|
|
|
|
stopText: "Back to Terminal",
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
const companyRep = comp.playerReputation;
|
|
|
|
|
|
|
|
function cancel(): void {
|
|
|
|
player.finishWork(true);
|
|
|
|
router.toJob();
|
|
|
|
}
|
|
|
|
function unfocus(): void {
|
|
|
|
player.stopFocusing();
|
|
|
|
router.toJob();
|
|
|
|
}
|
|
|
|
|
|
|
|
const position = player.jobs[player.companyName];
|
|
|
|
|
|
|
|
const penalty = player.cancelationPenalty();
|
|
|
|
|
|
|
|
const penaltyString = penalty === 0.5 ? "half" : "three-quarters";
|
|
|
|
|
|
|
|
workInfo = {
|
|
|
|
buttons: {
|
|
|
|
cancel: cancel,
|
|
|
|
unfocus: unfocus,
|
|
|
|
},
|
|
|
|
title: (
|
|
|
|
<>
|
|
|
|
You are currently working as a <b>{position}</b> at <b>{player.companyName}</b>
|
|
|
|
</>
|
|
|
|
),
|
|
|
|
|
|
|
|
description: (
|
|
|
|
<>
|
|
|
|
Current Company Reputation: <Reputation reputation={companyRep} />
|
|
|
|
</>
|
|
|
|
),
|
|
|
|
gains: [
|
2022-05-03 00:56:02 +02:00
|
|
|
<StatsRow name="Money" color={Settings.theme.money}>
|
|
|
|
<Typography>
|
|
|
|
<Money money={player.workMoneyGained} /> (<MoneyRate money={player.workMoneyGainRate * CYCLES_PER_SEC} />)
|
|
|
|
</Typography>
|
2022-05-04 19:44:48 +02:00
|
|
|
</StatsRow>,
|
|
|
|
<StatsRow name="Company Reputation" color={Settings.theme.rep}>
|
|
|
|
<Typography>
|
|
|
|
<Reputation reputation={player.workRepGained} /> (
|
|
|
|
<ReputationRate reputation={player.workRepGainRate * CYCLES_PER_SEC} />)
|
|
|
|
</Typography>
|
|
|
|
</StatsRow>,
|
|
|
|
...expGains,
|
|
|
|
],
|
|
|
|
progress: {
|
|
|
|
elapsed: player.timeWorked,
|
|
|
|
},
|
2021-09-18 01:43:08 +02:00
|
|
|
|
2022-05-04 19:44:48 +02:00
|
|
|
stopText: "Stop working",
|
|
|
|
stopTooltip:
|
|
|
|
"You will automatically finish after working for 8 hours. You can cancel earlier if you wish" +
|
|
|
|
` but you will only gain ${penaltyString} of the reputation you've earned so far.`,
|
|
|
|
};
|
2022-01-09 21:22:23 +01:00
|
|
|
|
2022-05-04 19:44:48 +02:00
|
|
|
break;
|
2021-09-18 01:43:08 +02:00
|
|
|
}
|
|
|
|
|
2022-05-04 20:42:48 +02:00
|
|
|
case WorkType.CompanyPartTime: {
|
2022-05-04 19:44:48 +02:00
|
|
|
function cancel(): void {
|
|
|
|
player.finishWorkPartTime(true);
|
|
|
|
router.toJob();
|
|
|
|
}
|
|
|
|
function unfocus(): void {
|
|
|
|
player.stopFocusing();
|
|
|
|
router.toJob();
|
|
|
|
}
|
|
|
|
const comp = Companies[player.companyName];
|
|
|
|
let companyRep = 0;
|
|
|
|
if (comp == null || !(comp instanceof Company)) {
|
|
|
|
throw new Error(`Could not find Company: ${player.companyName}`);
|
|
|
|
}
|
|
|
|
companyRep = comp.playerReputation;
|
|
|
|
|
|
|
|
const position = player.jobs[player.companyName];
|
|
|
|
|
2022-05-03 00:31:40 +02:00
|
|
|
workInfo = {
|
|
|
|
buttons: {
|
2022-05-04 19:44:48 +02:00
|
|
|
cancel: cancel,
|
|
|
|
unfocus: unfocus,
|
|
|
|
},
|
|
|
|
title: (
|
|
|
|
<>
|
|
|
|
You are currently working as a <b>{position}</b> at <b>{player.companyName}</b>
|
|
|
|
</>
|
|
|
|
),
|
|
|
|
|
|
|
|
description: (
|
|
|
|
<>
|
|
|
|
Current Company Reputation: <Reputation reputation={companyRep} />
|
|
|
|
</>
|
|
|
|
),
|
|
|
|
gains: [
|
|
|
|
<StatsRow name="Money" color={Settings.theme.money}>
|
|
|
|
<Typography>
|
|
|
|
<Money money={player.workMoneyGained} /> (<MoneyRate money={player.workMoneyGainRate * CYCLES_PER_SEC} />)
|
|
|
|
</Typography>
|
|
|
|
</StatsRow>,
|
|
|
|
<StatsRow name="Company Reputation" color={Settings.theme.rep}>
|
|
|
|
<Typography>
|
|
|
|
<Reputation reputation={player.workRepGained} /> (
|
|
|
|
<ReputationRate reputation={player.workRepGainRate * CYCLES_PER_SEC} />)
|
|
|
|
</Typography>
|
|
|
|
</StatsRow>,
|
|
|
|
...expGains,
|
|
|
|
],
|
|
|
|
progress: {
|
|
|
|
elapsed: player.timeWorked,
|
2022-05-03 00:31:40 +02:00
|
|
|
},
|
|
|
|
|
2022-05-04 19:44:48 +02:00
|
|
|
stopText: "Stop working",
|
|
|
|
stopTooltip:
|
|
|
|
"You will automatically finish after working for 8 hours. You can cancel earlier if you wish" +
|
|
|
|
" and there will be no penalty because this is a part-time job.",
|
2022-05-03 00:31:40 +02:00
|
|
|
};
|
2022-05-04 19:44:48 +02:00
|
|
|
|
|
|
|
break;
|
2021-09-18 01:43:08 +02:00
|
|
|
}
|
2022-03-24 16:13:54 +01:00
|
|
|
|
2022-05-04 19:44:48 +02:00
|
|
|
default:
|
2022-07-07 08:00:23 +02:00
|
|
|
if (player.currentWork === null) {
|
|
|
|
router.toTerminal();
|
|
|
|
}
|
2022-05-03 00:31:40 +02:00
|
|
|
}
|
|
|
|
|
2022-07-07 08:00:23 +02:00
|
|
|
if (workInfo.title === "") {
|
2022-05-03 00:31:40 +02:00
|
|
|
return <></>;
|
2022-03-19 15:31:48 +01:00
|
|
|
}
|
|
|
|
|
2022-05-03 00:31:40 +02:00
|
|
|
const tooltipInfo =
|
|
|
|
typeof workInfo?.stopTooltip === "string" ? (
|
|
|
|
<Typography>{workInfo.stopTooltip}</Typography>
|
|
|
|
) : (
|
|
|
|
workInfo.stopTooltip || <></>
|
|
|
|
);
|
|
|
|
|
2022-05-02 23:34:17 +02:00
|
|
|
return (
|
|
|
|
<Container
|
|
|
|
maxWidth="md"
|
|
|
|
sx={{ display: "flex", flexDirection: "column", justifyContent: "center", height: "calc(100vh - 16px)" }}
|
|
|
|
>
|
|
|
|
<Paper sx={{ p: 1, mb: 1 }}>
|
|
|
|
<Typography variant="h6">{workInfo.title}</Typography>
|
|
|
|
<Typography>{workInfo.description}</Typography>
|
2022-05-03 00:31:40 +02:00
|
|
|
{workInfo.gains && (
|
|
|
|
<Table sx={{ mt: 1 }}>
|
|
|
|
<TableBody>
|
|
|
|
{workInfo.gains.map((row) => (
|
|
|
|
<React.Fragment key={uniqueId()}>{row}</React.Fragment>
|
|
|
|
))}
|
|
|
|
</TableBody>
|
|
|
|
</Table>
|
|
|
|
)}
|
2022-05-02 23:34:17 +02:00
|
|
|
</Paper>
|
|
|
|
<Paper sx={{ mb: 1, p: 1 }}>
|
|
|
|
{workInfo.progress !== undefined && (
|
|
|
|
<Box sx={{ mb: 1 }}>
|
|
|
|
<Box
|
|
|
|
display="grid"
|
|
|
|
sx={{
|
|
|
|
gridTemplateColumns: `repeat(${Object.keys(workInfo.progress).length}, 1fr)`,
|
|
|
|
width: "100%",
|
|
|
|
justifyItems: "center",
|
2022-05-03 00:31:40 +02:00
|
|
|
textAlign: "center",
|
2022-05-02 23:34:17 +02:00
|
|
|
}}
|
|
|
|
>
|
|
|
|
{workInfo.progress.elapsed !== undefined && (
|
|
|
|
<Typography>{convertTimeMsToTimeElapsedString(workInfo.progress.elapsed)} elapsed</Typography>
|
|
|
|
)}
|
2022-05-03 00:31:40 +02:00
|
|
|
{workInfo.progress.remaining !== undefined && (
|
|
|
|
<Typography>{convertTimeMsToTimeElapsedString(workInfo.progress.remaining)} remaining</Typography>
|
|
|
|
)}
|
2022-05-02 23:34:17 +02:00
|
|
|
{workInfo.progress.percentage !== undefined && (
|
|
|
|
<Typography>{workInfo.progress.percentage.toFixed(2)}% done</Typography>
|
|
|
|
)}
|
|
|
|
</Box>
|
|
|
|
{workInfo.progress.percentage !== undefined && (
|
|
|
|
<ProgressBar variant="determinate" value={workInfo.progress.percentage} color="primary" />
|
|
|
|
)}
|
|
|
|
</Box>
|
|
|
|
)}
|
2021-10-16 21:43:28 +02:00
|
|
|
|
2022-05-02 23:34:17 +02:00
|
|
|
<Box display="grid" sx={{ gridTemplateColumns: `repeat(${Object.keys(workInfo.buttons).length}, 1fr)` }}>
|
|
|
|
{workInfo.stopTooltip ? (
|
|
|
|
<Tooltip title={tooltipInfo}>
|
|
|
|
<Button onClick={workInfo.buttons.cancel}>{workInfo.stopText}</Button>
|
|
|
|
</Tooltip>
|
|
|
|
) : (
|
|
|
|
<Button onClick={workInfo.buttons.cancel}>{workInfo.stopText}</Button>
|
|
|
|
)}
|
|
|
|
{workInfo.buttons.unfocus && (
|
|
|
|
<Button onClick={workInfo.buttons.unfocus}>Do something else simultaneously</Button>
|
|
|
|
)}
|
|
|
|
</Box>
|
|
|
|
</Paper>
|
|
|
|
</Container>
|
|
|
|
);
|
2021-09-18 01:43:08 +02:00
|
|
|
}
|