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";
|
|
|
|
|
|
|
|
import { Crimes } from "../../Crime/Crimes";
|
|
|
|
import { IPlayer } from "../../PersonObjects/IPlayer";
|
|
|
|
|
|
|
|
import { numeralWrapper } from "../../ui/numeralFormat";
|
|
|
|
import { AutoupdatingStdButton } from "../../ui/React/AutoupdatingStdButton";
|
|
|
|
|
|
|
|
type IProps = {
|
|
|
|
p: IPlayer;
|
|
|
|
}
|
|
|
|
|
|
|
|
export class SlumsLocation extends React.Component<IProps, any> {
|
2019-04-04 02:08:11 +02:00
|
|
|
/**
|
|
|
|
* Stores button styling that sets them all to block display
|
|
|
|
*/
|
2021-05-01 09:17:31 +02:00
|
|
|
btnStyle: any;
|
2019-04-04 02:08:11 +02:00
|
|
|
|
2019-04-01 11:23:25 +02:00
|
|
|
constructor(props: IProps) {
|
|
|
|
super(props);
|
|
|
|
|
2019-04-04 02:08:11 +02:00
|
|
|
this.btnStyle = { display: "block" };
|
|
|
|
|
2019-04-01 11:23:25 +02:00
|
|
|
this.shoplift = this.shoplift.bind(this);
|
|
|
|
this.robStore = this.robStore.bind(this);
|
|
|
|
this.mug = this.mug.bind(this);
|
|
|
|
this.larceny = this.larceny.bind(this);
|
|
|
|
this.dealDrugs = this.dealDrugs.bind(this);
|
|
|
|
this.bondForgery = this.bondForgery.bind(this);
|
|
|
|
this.traffickArms = this.traffickArms.bind(this);
|
|
|
|
this.homicide = this.homicide.bind(this);
|
|
|
|
this.grandTheftAuto = this.grandTheftAuto.bind(this);
|
|
|
|
this.kidnap = this.kidnap.bind(this);
|
|
|
|
this.assassinate = this.assassinate.bind(this);
|
|
|
|
this.heist = this.heist.bind(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
shoplift(e: React.MouseEvent<HTMLElement>): void {
|
|
|
|
if (!e.isTrusted) { return; }
|
|
|
|
Crimes.Shoplift.commit(this.props.p);
|
|
|
|
}
|
|
|
|
|
|
|
|
robStore(e: React.MouseEvent<HTMLElement>): void {
|
|
|
|
if (!e.isTrusted) { return; }
|
2019-04-04 02:08:11 +02:00
|
|
|
Crimes.RobStore.commit(this.props.p);
|
2019-04-01 11:23:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
mug(e: React.MouseEvent<HTMLElement>): void {
|
|
|
|
if (!e.isTrusted) { return; }
|
2019-04-04 02:08:11 +02:00
|
|
|
Crimes.Mug.commit(this.props.p);
|
2019-04-01 11:23:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
larceny(e: React.MouseEvent<HTMLElement>): void {
|
|
|
|
if (!e.isTrusted) { return; }
|
|
|
|
Crimes.Larceny.commit(this.props.p);
|
|
|
|
}
|
|
|
|
|
|
|
|
dealDrugs(e: React.MouseEvent<HTMLElement>): void {
|
|
|
|
if (!e.isTrusted) { return; }
|
|
|
|
Crimes.DealDrugs.commit(this.props.p);
|
|
|
|
}
|
|
|
|
|
|
|
|
bondForgery(e: React.MouseEvent<HTMLElement>): void {
|
|
|
|
if (!e.isTrusted) { return; }
|
|
|
|
Crimes.BondForgery.commit(this.props.p);
|
|
|
|
}
|
|
|
|
|
|
|
|
traffickArms(e: React.MouseEvent<HTMLElement>): void {
|
|
|
|
if (!e.isTrusted) { return; }
|
|
|
|
Crimes.TraffickArms.commit(this.props.p);
|
|
|
|
}
|
|
|
|
|
|
|
|
homicide(e: React.MouseEvent<HTMLElement>): void {
|
|
|
|
if (!e.isTrusted) { return; }
|
|
|
|
Crimes.Homicide.commit(this.props.p);
|
|
|
|
}
|
|
|
|
|
|
|
|
grandTheftAuto(e: React.MouseEvent<HTMLElement>): void {
|
|
|
|
if (!e.isTrusted) { return; }
|
|
|
|
Crimes.GrandTheftAuto.commit(this.props.p);
|
|
|
|
}
|
|
|
|
|
|
|
|
kidnap(e: React.MouseEvent<HTMLElement>): void {
|
|
|
|
if (!e.isTrusted) { return; }
|
|
|
|
Crimes.Kidnap.commit(this.props.p);
|
|
|
|
}
|
|
|
|
|
|
|
|
assassinate(e: React.MouseEvent<HTMLElement>): void {
|
|
|
|
if (!e.isTrusted) { return; }
|
|
|
|
Crimes.Assassination.commit(this.props.p);
|
|
|
|
}
|
|
|
|
|
|
|
|
heist(e: React.MouseEvent<HTMLElement>): void {
|
|
|
|
if (!e.isTrusted) { return; }
|
|
|
|
Crimes.Heist.commit(this.props.p);
|
|
|
|
}
|
|
|
|
|
2021-05-01 09:17:31 +02:00
|
|
|
render(): React.ReactNode {
|
2019-04-01 11:23:25 +02:00
|
|
|
const shopliftChance = Crimes.Shoplift.successRate(this.props.p);
|
|
|
|
const robStoreChance = Crimes.RobStore.successRate(this.props.p);
|
|
|
|
const mugChance = Crimes.Mug.successRate(this.props.p);
|
|
|
|
const larcenyChance = Crimes.Larceny.successRate(this.props.p);
|
|
|
|
const drugsChance = Crimes.DealDrugs.successRate(this.props.p);
|
|
|
|
const bondChance = Crimes.BondForgery.successRate(this.props.p);
|
|
|
|
const armsChance = Crimes.TraffickArms.successRate(this.props.p);
|
|
|
|
const homicideChance = Crimes.Homicide.successRate(this.props.p);
|
|
|
|
const gtaChance = Crimes.GrandTheftAuto.successRate(this.props.p);
|
|
|
|
const kidnapChance = Crimes.Kidnap.successRate(this.props.p);
|
|
|
|
const assassinateChance = Crimes.Assassination.successRate(this.props.p);
|
|
|
|
const heistChance = Crimes.Heist.successRate(this.props.p);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<AutoupdatingStdButton
|
|
|
|
intervalTime={5e3}
|
|
|
|
onClick={this.shoplift}
|
2019-04-04 02:08:11 +02:00
|
|
|
style={this.btnStyle}
|
2019-04-01 11:23:25 +02:00
|
|
|
text={`Shoplift (${numeralWrapper.formatPercentage(shopliftChance)} chance of success)`}
|
|
|
|
tooltip={"Attempt to shoplift from a low-end retailer"}
|
|
|
|
/>
|
|
|
|
<AutoupdatingStdButton
|
|
|
|
intervalTime={5e3}
|
|
|
|
onClick={this.robStore}
|
2019-04-04 02:08:11 +02:00
|
|
|
style={this.btnStyle}
|
2019-04-01 11:23:25 +02:00
|
|
|
text={`Rob store (${numeralWrapper.formatPercentage(robStoreChance)} chance of success)`}
|
|
|
|
tooltip={"Attempt to commit armed robbery on a high-end store"}
|
|
|
|
/>
|
|
|
|
<AutoupdatingStdButton
|
|
|
|
intervalTime={5e3}
|
|
|
|
onClick={this.mug}
|
2019-04-04 02:08:11 +02:00
|
|
|
style={this.btnStyle}
|
2019-04-01 11:23:25 +02:00
|
|
|
text={`Mug someone (${numeralWrapper.formatPercentage(mugChance)} chance of success)`}
|
|
|
|
tooltip={"Attempt to mug a random person on the street"}
|
|
|
|
/>
|
|
|
|
<AutoupdatingStdButton
|
|
|
|
intervalTime={5e3}
|
|
|
|
onClick={this.larceny}
|
2019-04-04 02:08:11 +02:00
|
|
|
style={this.btnStyle}
|
2019-04-01 11:23:25 +02:00
|
|
|
text={`Larceny (${numeralWrapper.formatPercentage(larcenyChance)} chance of success)`}
|
|
|
|
tooltip={"Attempt to rob property from someone's house"}
|
|
|
|
/>
|
|
|
|
<AutoupdatingStdButton
|
|
|
|
intervalTime={5e3}
|
|
|
|
onClick={this.dealDrugs}
|
2019-04-04 02:08:11 +02:00
|
|
|
style={this.btnStyle}
|
2019-04-01 11:23:25 +02:00
|
|
|
text={`Deal Drugs (${numeralWrapper.formatPercentage(drugsChance)} chance of success)`}
|
|
|
|
tooltip={"Attempt to deal drugs"}
|
|
|
|
/>
|
|
|
|
<AutoupdatingStdButton
|
|
|
|
intervalTime={5e3}
|
|
|
|
onClick={this.bondForgery}
|
2019-04-04 02:08:11 +02:00
|
|
|
style={this.btnStyle}
|
2019-04-01 11:23:25 +02:00
|
|
|
text={`Bond Forgery (${numeralWrapper.formatPercentage(bondChance)} chance of success)`}
|
|
|
|
tooltip={"Attempt to forge corporate bonds"}
|
|
|
|
/>
|
|
|
|
<AutoupdatingStdButton
|
|
|
|
intervalTime={5e3}
|
|
|
|
onClick={this.traffickArms}
|
2019-04-04 02:08:11 +02:00
|
|
|
style={this.btnStyle}
|
2019-04-01 11:23:25 +02:00
|
|
|
text={`Traffick illegal Arms (${numeralWrapper.formatPercentage(armsChance)} chance of success)`}
|
|
|
|
tooltip={"Attempt to smuggle illegal arms into the city"}
|
|
|
|
/>
|
|
|
|
<AutoupdatingStdButton
|
|
|
|
intervalTime={5e3}
|
|
|
|
onClick={this.homicide}
|
2019-04-04 02:08:11 +02:00
|
|
|
style={this.btnStyle}
|
2019-04-01 11:23:25 +02:00
|
|
|
text={`Homicide (${numeralWrapper.formatPercentage(homicideChance)} chance of success)`}
|
|
|
|
tooltip={"Attempt to murder a random person on the street"}
|
|
|
|
/>
|
|
|
|
<AutoupdatingStdButton
|
|
|
|
intervalTime={5e3}
|
|
|
|
onClick={this.grandTheftAuto}
|
2019-04-04 02:08:11 +02:00
|
|
|
style={this.btnStyle}
|
2019-04-01 11:23:25 +02:00
|
|
|
text={`Grand theft Auto (${numeralWrapper.formatPercentage(gtaChance)} chance of success)`}
|
|
|
|
tooltip={"Attempt to commit grand theft auto"}
|
|
|
|
/>
|
|
|
|
<AutoupdatingStdButton
|
|
|
|
intervalTime={5e3}
|
|
|
|
onClick={this.kidnap}
|
2019-04-04 02:08:11 +02:00
|
|
|
style={this.btnStyle}
|
2019-04-01 11:23:25 +02:00
|
|
|
text={`Kidnap and Ransom (${numeralWrapper.formatPercentage(kidnapChance)} chance of success)`}
|
|
|
|
tooltip={"Attempt to kidnap and ransom a high-profile-target"}
|
|
|
|
/>
|
|
|
|
<AutoupdatingStdButton
|
|
|
|
intervalTime={5e3}
|
|
|
|
onClick={this.assassinate}
|
2019-04-04 02:08:11 +02:00
|
|
|
style={this.btnStyle}
|
2019-04-01 11:23:25 +02:00
|
|
|
text={`Assassinate (${numeralWrapper.formatPercentage(assassinateChance)} chance of success)`}
|
|
|
|
tooltip={"Attempt to assassinate a high-profile target"}
|
|
|
|
/>
|
|
|
|
<AutoupdatingStdButton
|
|
|
|
intervalTime={5e3}
|
|
|
|
onClick={this.heist}
|
2019-04-04 02:08:11 +02:00
|
|
|
style={this.btnStyle}
|
2019-04-01 11:23:25 +02:00
|
|
|
text={`Heist (${numeralWrapper.formatPercentage(heistChance)} chance of success)`}
|
|
|
|
tooltip={"Attempt to pull off the ultimate heist"}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|