2019-04-01 11:23:25 +02:00
|
|
|
/**
|
|
|
|
* React Subcomponent for displaying a location's UI, when that location is a slum
|
|
|
|
*
|
|
|
|
* This subcomponent renders all of the buttons for committing crimes
|
|
|
|
*/
|
|
|
|
import * as React from "react";
|
2021-09-25 21:34:12 +02:00
|
|
|
import Button from "@mui/material/Button";
|
|
|
|
import Tooltip from "@mui/material/Tooltip";
|
2019-04-01 11:23:25 +02:00
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
import { Crimes } from "../../Crime/Crimes";
|
2019-04-01 11:23:25 +02:00
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
import { numeralWrapper } from "../../ui/numeralFormat";
|
2021-09-18 01:43:08 +02:00
|
|
|
import { use } from "../../ui/Context";
|
2019-04-01 11:23:25 +02:00
|
|
|
|
2021-09-18 01:43:08 +02:00
|
|
|
export function SlumsLocation(): React.ReactElement {
|
|
|
|
const player = use.Player();
|
|
|
|
const router = use.Router();
|
|
|
|
function shoplift(e: React.MouseEvent<HTMLElement>): void {
|
2021-09-05 01:09:30 +02:00
|
|
|
if (!e.isTrusted) {
|
|
|
|
return;
|
2019-04-01 11:23:25 +02:00
|
|
|
}
|
2021-09-20 07:45:32 +02:00
|
|
|
Crimes.Shoplift.commit(router, player);
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2019-04-01 11:23:25 +02:00
|
|
|
|
2021-09-18 01:43:08 +02:00
|
|
|
function robStore(e: React.MouseEvent<HTMLElement>): void {
|
2021-09-05 01:09:30 +02:00
|
|
|
if (!e.isTrusted) {
|
|
|
|
return;
|
2019-04-01 11:23:25 +02:00
|
|
|
}
|
2021-09-20 07:45:32 +02:00
|
|
|
Crimes.RobStore.commit(router, player);
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2019-04-01 11:23:25 +02:00
|
|
|
|
2021-09-18 01:43:08 +02:00
|
|
|
function mug(e: React.MouseEvent<HTMLElement>): void {
|
2021-09-05 01:09:30 +02:00
|
|
|
if (!e.isTrusted) {
|
|
|
|
return;
|
2019-04-01 11:23:25 +02:00
|
|
|
}
|
2021-09-20 07:45:32 +02:00
|
|
|
Crimes.Mug.commit(router, player);
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2019-04-01 11:23:25 +02:00
|
|
|
|
2021-09-18 01:43:08 +02:00
|
|
|
function larceny(e: React.MouseEvent<HTMLElement>): void {
|
2021-09-05 01:09:30 +02:00
|
|
|
if (!e.isTrusted) {
|
|
|
|
return;
|
2019-04-01 11:23:25 +02:00
|
|
|
}
|
2021-09-20 07:45:32 +02:00
|
|
|
Crimes.Larceny.commit(router, player);
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2019-04-01 11:23:25 +02:00
|
|
|
|
2021-09-18 01:43:08 +02:00
|
|
|
function dealDrugs(e: React.MouseEvent<HTMLElement>): void {
|
2021-09-05 01:09:30 +02:00
|
|
|
if (!e.isTrusted) {
|
|
|
|
return;
|
2019-04-01 11:23:25 +02:00
|
|
|
}
|
2021-09-20 07:45:32 +02:00
|
|
|
Crimes.DealDrugs.commit(router, player);
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2019-04-01 11:23:25 +02:00
|
|
|
|
2021-09-18 01:43:08 +02:00
|
|
|
function bondForgery(e: React.MouseEvent<HTMLElement>): void {
|
2021-09-05 01:09:30 +02:00
|
|
|
if (!e.isTrusted) {
|
|
|
|
return;
|
2019-04-01 11:23:25 +02:00
|
|
|
}
|
2021-09-20 07:45:32 +02:00
|
|
|
Crimes.BondForgery.commit(router, player);
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2019-04-01 11:23:25 +02:00
|
|
|
|
2021-09-18 01:43:08 +02:00
|
|
|
function traffickArms(e: React.MouseEvent<HTMLElement>): void {
|
2021-09-05 01:09:30 +02:00
|
|
|
if (!e.isTrusted) {
|
|
|
|
return;
|
2019-04-01 11:23:25 +02:00
|
|
|
}
|
2021-09-20 07:45:32 +02:00
|
|
|
Crimes.TraffickArms.commit(router, player);
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2019-04-01 11:23:25 +02:00
|
|
|
|
2021-09-18 01:43:08 +02:00
|
|
|
function homicide(e: React.MouseEvent<HTMLElement>): void {
|
2021-09-05 01:09:30 +02:00
|
|
|
if (!e.isTrusted) {
|
|
|
|
return;
|
2019-04-01 11:23:25 +02:00
|
|
|
}
|
2021-09-20 07:45:32 +02:00
|
|
|
Crimes.Homicide.commit(router, player);
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2019-04-01 11:23:25 +02:00
|
|
|
|
2021-09-18 01:43:08 +02:00
|
|
|
function grandTheftAuto(e: React.MouseEvent<HTMLElement>): void {
|
2021-09-05 01:09:30 +02:00
|
|
|
if (!e.isTrusted) {
|
|
|
|
return;
|
2019-04-01 11:23:25 +02:00
|
|
|
}
|
2021-09-20 07:45:32 +02:00
|
|
|
Crimes.GrandTheftAuto.commit(router, player);
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2019-04-01 11:23:25 +02:00
|
|
|
|
2021-09-18 01:43:08 +02:00
|
|
|
function kidnap(e: React.MouseEvent<HTMLElement>): void {
|
2021-09-05 01:09:30 +02:00
|
|
|
if (!e.isTrusted) {
|
|
|
|
return;
|
2019-04-01 11:23:25 +02:00
|
|
|
}
|
2021-09-20 07:45:32 +02:00
|
|
|
Crimes.Kidnap.commit(router, player);
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2019-04-01 11:23:25 +02:00
|
|
|
|
2021-09-18 01:43:08 +02:00
|
|
|
function assassinate(e: React.MouseEvent<HTMLElement>): void {
|
2021-09-05 01:09:30 +02:00
|
|
|
if (!e.isTrusted) {
|
|
|
|
return;
|
2019-04-01 11:23:25 +02:00
|
|
|
}
|
2021-09-20 07:45:32 +02:00
|
|
|
Crimes.Assassination.commit(router, player);
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2019-04-01 11:23:25 +02:00
|
|
|
|
2021-09-18 01:43:08 +02:00
|
|
|
function heist(e: React.MouseEvent<HTMLElement>): void {
|
2021-09-05 01:09:30 +02:00
|
|
|
if (!e.isTrusted) {
|
|
|
|
return;
|
2019-04-01 11:23:25 +02:00
|
|
|
}
|
2021-09-20 07:45:32 +02:00
|
|
|
Crimes.Heist.commit(router, player);
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
|
|
|
|
2021-09-18 01:43:08 +02:00
|
|
|
const shopliftChance = Crimes.Shoplift.successRate(player);
|
|
|
|
const robStoreChance = Crimes.RobStore.successRate(player);
|
|
|
|
const mugChance = Crimes.Mug.successRate(player);
|
|
|
|
const larcenyChance = Crimes.Larceny.successRate(player);
|
|
|
|
const drugsChance = Crimes.DealDrugs.successRate(player);
|
|
|
|
const bondChance = Crimes.BondForgery.successRate(player);
|
|
|
|
const armsChance = Crimes.TraffickArms.successRate(player);
|
|
|
|
const homicideChance = Crimes.Homicide.successRate(player);
|
|
|
|
const gtaChance = Crimes.GrandTheftAuto.successRate(player);
|
|
|
|
const kidnapChance = Crimes.Kidnap.successRate(player);
|
|
|
|
const assassinateChance = Crimes.Assassination.successRate(player);
|
|
|
|
const heistChance = Crimes.Heist.successRate(player);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div>
|
2021-09-25 21:34:12 +02:00
|
|
|
<Tooltip title={<>Attempt to shoplift from a low-end retailer</>} disableInteractive>
|
|
|
|
<Button onClick={shoplift}>
|
|
|
|
Shoplift ({numeralWrapper.formatPercentage(shopliftChance)} chance of success)
|
|
|
|
</Button>
|
|
|
|
</Tooltip>
|
|
|
|
<br />
|
|
|
|
<Tooltip title={<>Attempt to commit armed robbery on a high-end store</>} disableInteractive>
|
|
|
|
<Button onClick={robStore}>
|
|
|
|
Rob store ({numeralWrapper.formatPercentage(robStoreChance)} chance of success)
|
|
|
|
</Button>
|
|
|
|
</Tooltip>
|
|
|
|
<br />
|
|
|
|
<Tooltip title={<>Attempt to mug a random person on the street</>} disableInteractive>
|
|
|
|
<Button onClick={mug}>Mug someone ({numeralWrapper.formatPercentage(mugChance)} chance of success)</Button>
|
|
|
|
</Tooltip>
|
|
|
|
<br />
|
|
|
|
<Tooltip title={<>Attempt to rob property from someone's house</>} disableInteractive>
|
|
|
|
<Button onClick={larceny}>Larceny ({numeralWrapper.formatPercentage(larcenyChance)} chance of success)</Button>
|
|
|
|
</Tooltip>
|
|
|
|
<br />
|
|
|
|
<Tooltip title={<>Attempt to deal drugs</>} disableInteractive>
|
|
|
|
<Button onClick={dealDrugs}>
|
|
|
|
Deal Drugs ({numeralWrapper.formatPercentage(drugsChance)} chance of success)
|
|
|
|
</Button>
|
|
|
|
</Tooltip>
|
|
|
|
<br />
|
|
|
|
<Tooltip title={<>Attempt to forge corporate bonds</>} disableInteractive>
|
|
|
|
<Button onClick={bondForgery}>
|
|
|
|
Bond Forgery ({numeralWrapper.formatPercentage(bondChance)} chance of success)
|
|
|
|
</Button>
|
|
|
|
</Tooltip>
|
|
|
|
<br />
|
|
|
|
<Tooltip title={<>Attempt to smuggle illegal arms into the city</>} disableInteractive>
|
|
|
|
<Button onClick={traffickArms}>
|
|
|
|
Traffick illegal Arms ({numeralWrapper.formatPercentage(armsChance)} chance of success)
|
|
|
|
</Button>
|
|
|
|
</Tooltip>
|
|
|
|
<br />
|
|
|
|
<Tooltip title={<>Attempt to murder a random person on the street</>} disableInteractive>
|
|
|
|
<Button onClick={homicide}>
|
|
|
|
Homicide ({numeralWrapper.formatPercentage(homicideChance)} chance of success)
|
|
|
|
</Button>
|
|
|
|
</Tooltip>
|
|
|
|
<br />
|
|
|
|
<Tooltip title={<>Attempt to commit grand theft auto</>} disableInteractive>
|
|
|
|
<Button onClick={grandTheftAuto}>
|
|
|
|
Grand theft Auto ({numeralWrapper.formatPercentage(gtaChance)} chance of success)
|
|
|
|
</Button>
|
|
|
|
</Tooltip>
|
|
|
|
<br />
|
|
|
|
<Tooltip title={<>Attempt to kidnap and ransom a high-profile-target</>} disableInteractive>
|
|
|
|
<Button onClick={kidnap}>
|
|
|
|
Kidnap and Ransom ({numeralWrapper.formatPercentage(kidnapChance)} chance of success)
|
|
|
|
</Button>
|
|
|
|
</Tooltip>
|
|
|
|
<br />
|
|
|
|
<Tooltip title={<>Attempt to assassinate a high-profile target</>} disableInteractive>
|
|
|
|
<Button onClick={assassinate}>
|
|
|
|
Assassinate ({numeralWrapper.formatPercentage(assassinateChance)} chance of success)
|
|
|
|
</Button>
|
|
|
|
</Tooltip>
|
|
|
|
<br />
|
|
|
|
<Tooltip title={<>Attempt to pull off the ultimate heist</>} disableInteractive>
|
|
|
|
<Button onClick={heist}>Heist ({numeralWrapper.formatPercentage(heistChance)} chance of success)</Button>
|
|
|
|
</Tooltip>
|
|
|
|
<br />
|
2021-09-18 01:43:08 +02:00
|
|
|
</div>
|
|
|
|
);
|
2019-04-01 11:23:25 +02:00
|
|
|
}
|