finish sleeve rework

This commit is contained in:
Olivier Gagnon
2022-07-28 02:46:34 -04:00
parent ebe953b498
commit 4549b0d467
22 changed files with 376 additions and 365 deletions
+10 -27
View File
@@ -16,6 +16,7 @@ import { SleeveTaskType } from "../SleeveTaskTypesEnum";
import { isSleeveClassWork } from "../Work/SleeveClassWork";
import { isSleeveFactionWork } from "../Work/SleeveFactionWork";
import { isSleeveCompanyWork } from "../Work/SleeveCompanyWork";
import { isSleeveCrimeWork } from "../Work/SleeveCrimeWork";
interface IProps {
sleeve: Sleeve;
@@ -97,35 +98,17 @@ export function EarningsElement(props: IProps): React.ReactElement {
const player = use.Player();
let data: (string | JSX.Element)[][] = [];
if (props.sleeve.currentTask === SleeveTaskType.Crime) {
if (isSleeveCrimeWork(props.sleeve.currentWork)) {
const gains = props.sleeve.currentWork.getExp();
data = [
[
`Money`,
<>
<Money money={parseFloat(props.sleeve.currentTaskLocation)} /> (on success)
</>,
],
[`Hacking Exp`, `${numeralWrapper.formatExp(props.sleeve.gainRatesForTask.hack)} (2x on success)`],
[`Strength Exp`, `${numeralWrapper.formatExp(props.sleeve.gainRatesForTask.str)} (2x on success)`],
[`Defense Exp`, `${numeralWrapper.formatExp(props.sleeve.gainRatesForTask.def)} (2x on success)`],
[`Dexterity Exp`, `${numeralWrapper.formatExp(props.sleeve.gainRatesForTask.dex)} (2x on success)`],
[`Agility Exp`, `${numeralWrapper.formatExp(props.sleeve.gainRatesForTask.agi)} (2x on success)`],
[`Charisma Exp`, `${numeralWrapper.formatExp(props.sleeve.gainRatesForTask.cha)} (2x on success)`],
[`Money:`, <Money money={5 * gains.money} />],
[`Hacking Exp:`, `${numeralWrapper.formatExp(5 * gains.hackExp)}`],
[`Strength Exp:`, `${numeralWrapper.formatExp(5 * gains.strExp)}`],
[`Defense Exp:`, `${numeralWrapper.formatExp(5 * gains.defExp)}`],
[`Dexterity Exp:`, `${numeralWrapper.formatExp(5 * gains.dexExp)}`],
[`Agility Exp:`, `${numeralWrapper.formatExp(5 * gains.agiExp)}`],
[`Charisma Exp:`, `${numeralWrapper.formatExp(5 * gains.chaExp)}`],
];
} else {
data = [
[`Money:`, <MoneyRate money={5 * props.sleeve.gainRatesForTask.money} />],
[`Hacking Exp:`, `${numeralWrapper.formatExp(5 * props.sleeve.gainRatesForTask.hack)} / sec`],
[`Strength Exp:`, `${numeralWrapper.formatExp(5 * props.sleeve.gainRatesForTask.str)} / sec`],
[`Defense Exp:`, `${numeralWrapper.formatExp(5 * props.sleeve.gainRatesForTask.def)} / sec`],
[`Dexterity Exp:`, `${numeralWrapper.formatExp(5 * props.sleeve.gainRatesForTask.dex)} / sec`],
[`Agility Exp:`, `${numeralWrapper.formatExp(5 * props.sleeve.gainRatesForTask.agi)} / sec`],
[`Charisma Exp:`, `${numeralWrapper.formatExp(5 * props.sleeve.gainRatesForTask.cha)} / sec`],
];
if (props.sleeve.currentTask === SleeveTaskType.Company || props.sleeve.currentTask === SleeveTaskType.Faction) {
const repGain: number = props.sleeve.getRepGain(player);
data.push([`Reputation:`, <ReputationRate reputation={5 * repGain} />]);
}
}
if (isSleeveClassWork(props.sleeve.currentWork)) {
const rates = props.sleeve.currentWork.calculateRates(player, props.sleeve);