convert faction work to new work system

This commit is contained in:
Olivier Gagnon
2022-07-12 01:54:19 -04:00
parent e86a42716c
commit f7805c4a51
28 changed files with 299 additions and 404 deletions
+18 -17
View File
@@ -31,6 +31,8 @@ import { isClassWork } from "../../Work/ClassWork";
import { CONSTANTS } from "../../Constants";
import { isCreateProgramWork } from "../../Work/CreateProgramWork";
import { isGraftingWork } from "../../Work/GraftingWork";
import { isFactionWork } from "../../Work/FactionWork";
import { ReputationRate } from "./ReputationRate";
interface IProps {
save: () => void;
@@ -172,6 +174,22 @@ function Work(): React.ReactElement {
</>
);
}
if (isFactionWork(player.currentWork)) {
const factionWork = player.currentWork;
header = (
<>
Working for <strong>{factionWork.factionName}</strong>
</>
);
innerText = (
<>
<Reputation reputation={factionWork.getFaction().playerReputation} /> rep
<br />(
<ReputationRate reputation={factionWork.getReputationRate(player) * (1000 / CONSTANTS._idleSpeed)} />)
</>
);
}
switch (player.workType) {
case WorkType.CompanyPartTime:
case WorkType.Company:
@@ -191,23 +209,6 @@ function Work(): React.ReactElement {
</>
);
break;
case WorkType.Faction:
details = (
<>
{player.factionWorkType} for <strong>{player.currentWorkFactionName}</strong>
</>
);
header = (
<>
Working for <strong>{player.currentWorkFactionName}</strong>
</>
);
innerText = (
<>
+<Reputation reputation={player.workRepGained} /> rep
</>
);
break;
}
return (