+ Joining this Faction will prevent you from joining its enemies
+
+ }
+ >
+
+
+ )}
+
+
+
+
+ {!props.player.hasGangWith(props.faction.name) && }
+
+ {props.joined && (
+
+ {getAugsLeft(props.faction, props.player)} Augmentations left
+
+ )}
+
+
+
+
+ {props.joined && (
+
+
+ {numeralWrapper.formatFavor(props.faction.favor)} favor
+
+
+ {numeralWrapper.formatReputation(props.faction.playerReputation)} rep
+
+
+ )}
+
+ );
+};
+
interface IProps {
player: IPlayer;
router: IRouter;
}
export function FactionsRoot(props: IProps): React.ReactElement {
+ const theme = useTheme();
const setRerender = useState(false)[1];
function rerender(): void {
setRerender((old) => !old);
@@ -35,99 +205,90 @@ export function FactionsRoot(props: IProps): React.ReactElement {
});
}, []);
- function openFaction(faction: Faction): void {
- props.router.toFaction(faction);
- }
-
- function openFactionAugPage(faction: Faction): void {
- props.router.toFaction(faction, true);
- }
-
- function acceptInvitation(event: React.MouseEvent, faction: string): void {
- if (!event.isTrusted) return;
- joinFaction(Factions[faction]);
- setRerender((x) => !x);
- }
-
- const getAugsLeft = (faction: Faction, player: IPlayer): number => {
- const augs = getFactionAugmentationsFiltered(player, faction);
-
- return augs.filter((augmentation: string) => !player.hasAugmentation(augmentation)).length;
- };
-
const allFactions = Object.values(FactionNames).map((faction) => faction as string);
- const allJoinedFactions = props.player.factions.slice(0);
+ const allJoinedFactions = [...props.player.factions];
allJoinedFactions.sort((a, b) => allFactions.indexOf(a) - allFactions.indexOf(b));
+ const invitations = props.player.factionInvitations;
return (
-
- Factions
-
- Throughout the game you may receive invitations from factions. There are many different factions, and each
- faction has different criteria for determining its potential members. Joining a faction and furthering its cause
- is crucial to progressing in the game and unlocking endgame content.
+
+
+ Factions
+
+ Throughout the game you may receive invitations from factions. There are many different factions, and each
+ faction has different criteria for determining its potential members. Joining a faction and furthering its
+ cause is crucial to progressing in the game and unlocking endgame content.
+
+ }
+ >
+
+
-
- Factions you have joined:
-
- {(allJoinedFactions.length > 0 && (
-
-
-
- )) || You haven't joined any factions.}
-
- Outstanding Faction Invitations
-
-
- Factions you have been invited to. You can accept these faction invitations at any time:
-
- {(props.player.factionInvitations.length > 0 && (
-
-