/** * 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 { /** * Stores button styling that sets them all to block display */ btnStyle: object; constructor(props: IProps) { super(props); this.btnStyle = { display: "block" }; 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): void { if (!e.isTrusted) { return; } Crimes.Shoplift.commit(this.props.p); } robStore(e: React.MouseEvent): void { if (!e.isTrusted) { return; } Crimes.RobStore.commit(this.props.p); } mug(e: React.MouseEvent): void { if (!e.isTrusted) { return; } Crimes.Mug.commit(this.props.p); } larceny(e: React.MouseEvent): void { if (!e.isTrusted) { return; } Crimes.Larceny.commit(this.props.p); } dealDrugs(e: React.MouseEvent): void { if (!e.isTrusted) { return; } Crimes.DealDrugs.commit(this.props.p); } bondForgery(e: React.MouseEvent): void { if (!e.isTrusted) { return; } Crimes.BondForgery.commit(this.props.p); } traffickArms(e: React.MouseEvent): void { if (!e.isTrusted) { return; } Crimes.TraffickArms.commit(this.props.p); } homicide(e: React.MouseEvent): void { if (!e.isTrusted) { return; } Crimes.Homicide.commit(this.props.p); } grandTheftAuto(e: React.MouseEvent): void { if (!e.isTrusted) { return; } Crimes.GrandTheftAuto.commit(this.props.p); } kidnap(e: React.MouseEvent): void { if (!e.isTrusted) { return; } Crimes.Kidnap.commit(this.props.p); } assassinate(e: React.MouseEvent): void { if (!e.isTrusted) { return; } Crimes.Assassination.commit(this.props.p); } heist(e: React.MouseEvent): void { if (!e.isTrusted) { return; } Crimes.Heist.commit(this.props.p); } render() { 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 (
) } }