2021-10-01 19:36:59 +02:00
|
|
|
/**
|
|
|
|
* React Component for the popup used to create a new gang.
|
|
|
|
*/
|
|
|
|
import React from "react";
|
|
|
|
import { Modal } from "../../ui/React/Modal";
|
|
|
|
import { use } from "../../ui/Context";
|
|
|
|
import Typography from "@mui/material/Typography";
|
|
|
|
import Button from "@mui/material/Button";
|
2022-03-18 11:07:29 +01:00
|
|
|
import { KEY } from "../../utils/helpers/keyCodes";
|
2022-03-19 09:09:59 +01:00
|
|
|
import { FactionNames } from "../data/FactionNames";
|
2021-10-01 19:36:59 +02:00
|
|
|
|
|
|
|
interface IProps {
|
|
|
|
open: boolean;
|
|
|
|
onClose: () => void;
|
|
|
|
facName: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export function CreateGangModal(props: IProps): React.ReactElement {
|
|
|
|
const player = use.Player();
|
|
|
|
const router = use.Router();
|
|
|
|
const combatGangText =
|
|
|
|
"This is a COMBAT gang. Members in this gang will have different tasks than HACKING gangs. " +
|
|
|
|
"Compared to hacking gangs, progression with combat gangs can be more difficult as territory management " +
|
|
|
|
"is more important. However, well-managed combat gangs can progress faster than hacking ones.";
|
|
|
|
|
|
|
|
const hackingGangText =
|
|
|
|
"This is a HACKING gang. Members in this gang will have different tasks than COMBAT gangs. " +
|
|
|
|
"Compared to combat gangs, progression with hacking gangs is more straightforward as territory warfare " +
|
|
|
|
"is not as important.";
|
|
|
|
|
|
|
|
function isHacking(): boolean {
|
2022-03-19 09:09:59 +01:00
|
|
|
return [FactionNames.NiteSec as string, FactionNames.TheBlackHand as string].includes(props.facName);
|
2021-10-01 19:36:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function createGang(): void {
|
|
|
|
player.startGang(props.facName, isHacking());
|
|
|
|
props.onClose();
|
|
|
|
router.toGang();
|
|
|
|
}
|
|
|
|
|
|
|
|
function onKeyUp(event: React.KeyboardEvent): void {
|
2022-03-18 10:43:56 +01:00
|
|
|
if (event.key === KEY.ENTER) createGang();
|
2021-10-01 19:36:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Modal open={props.open} onClose={props.onClose}>
|
|
|
|
<Typography>
|
|
|
|
Would you like to create a new Gang with {props.facName}?
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
Note that this will prevent you from creating a Gang with any other Faction until this BitNode is destroyed. It
|
|
|
|
also resets your reputation with this faction.
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
{isHacking() ? hackingGangText : combatGangText}
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
Other than hacking vs combat, there are NO differences between the Factions you can create a Gang with, and each
|
|
|
|
of these Factions have all Augmentations available.
|
|
|
|
</Typography>
|
|
|
|
<Button onClick={createGang} onKeyUp={onKeyUp} autoFocus>
|
|
|
|
Create Gang
|
|
|
|
</Button>
|
|
|
|
</Modal>
|
|
|
|
);
|
|
|
|
}
|