mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-05-14 03:20:07 +02:00
No more player/router context
This commit is contained in:
@@ -7,7 +7,7 @@ import { Company } from "../../Company/Company";
|
||||
import { CompanyPosition } from "../../Company/CompanyPosition";
|
||||
import { getJobRequirementText } from "../../Company/GetJobRequirementText";
|
||||
|
||||
import { use } from "../../ui/Context";
|
||||
import { Player } from "../../Player";
|
||||
import Button from "@mui/material/Button";
|
||||
import Tooltip from "@mui/material/Tooltip";
|
||||
|
||||
@@ -19,10 +19,8 @@ type IProps = {
|
||||
};
|
||||
|
||||
export function ApplyToJobButton(props: IProps): React.ReactElement {
|
||||
const player = use.Player();
|
||||
|
||||
function getJobRequirementTooltip(): string {
|
||||
const pos = player.getNextCompanyPosition(props.company, props.entryPosType);
|
||||
const pos = Player.getNextCompanyPosition(props.company, props.entryPosType);
|
||||
if (pos == null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@ import { Locations } from "../Locations";
|
||||
import { Location } from "../Location";
|
||||
import { Settings } from "../../Settings/Settings";
|
||||
|
||||
import { use } from "../../ui/Context";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { Player } from "../../Player";
|
||||
import { Router } from "../../ui/GameRoot";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Button from "@mui/material/Button";
|
||||
import { LocationType } from "../LocationTypeEnum";
|
||||
@@ -37,19 +37,18 @@ const useStyles = makeStyles((theme: Theme) =>
|
||||
}),
|
||||
);
|
||||
|
||||
function toLocation(router: IRouter, location: Location): void {
|
||||
function toLocation(location: Location): void {
|
||||
if (location.name === LocationName.TravelAgency) {
|
||||
router.toTravel();
|
||||
Router.toTravel();
|
||||
} else if (location.name === LocationName.WorldStockExchange) {
|
||||
router.toStockMarket();
|
||||
Router.toStockMarket();
|
||||
} else {
|
||||
router.toLocation(location);
|
||||
Router.toLocation(location);
|
||||
}
|
||||
}
|
||||
|
||||
function LocationLetter(location: Location): React.ReactElement {
|
||||
location.types;
|
||||
const router = use.Router();
|
||||
const classes = useStyles();
|
||||
let L = "X";
|
||||
if (location.types.includes(LocationType.Company)) L = "C";
|
||||
@@ -68,7 +67,7 @@ function LocationLetter(location: Location): React.ReactElement {
|
||||
aria-label={location.name}
|
||||
key={location.name}
|
||||
className={classes.location}
|
||||
onClick={() => toLocation(router, location)}
|
||||
onClick={() => toLocation(location)}
|
||||
>
|
||||
<b>{L}</b>
|
||||
</span>
|
||||
@@ -147,11 +146,10 @@ function ASCIICity(props: IProps): React.ReactElement {
|
||||
}
|
||||
|
||||
function ListCity(props: IProps): React.ReactElement {
|
||||
const router = use.Router();
|
||||
const locationButtons = props.city.locations.map((locName) => {
|
||||
return (
|
||||
<React.Fragment key={locName}>
|
||||
<Button onClick={() => toLocation(router, Locations[locName])}>{locName}</Button>
|
||||
<Button onClick={() => toLocation(Locations[locName])}>{locName}</Button>
|
||||
<br />
|
||||
</React.Fragment>
|
||||
);
|
||||
@@ -161,8 +159,7 @@ function ListCity(props: IProps): React.ReactElement {
|
||||
}
|
||||
|
||||
export function LocationCity(): React.ReactElement {
|
||||
const player = use.Player();
|
||||
const city = Cities[player.city];
|
||||
const city = Cities[Player.city];
|
||||
return (
|
||||
<>
|
||||
<Typography>{city.name}</Typography>
|
||||
|
||||
@@ -21,7 +21,8 @@ import * as posNames from "../../Company/data/companypositionnames";
|
||||
|
||||
import { Reputation } from "../../ui/React/Reputation";
|
||||
import { Favor } from "../../ui/React/Favor";
|
||||
import { use } from "../../ui/Context";
|
||||
import { Router } from "../../ui/GameRoot";
|
||||
import { Player } from "../../Player";
|
||||
import { QuitJobModal } from "../../Company/ui/QuitJobModal";
|
||||
import { CompanyWork } from "../../Work/CompanyWork";
|
||||
|
||||
@@ -30,8 +31,6 @@ type IProps = {
|
||||
};
|
||||
|
||||
export function CompanyLocation(props: IProps): React.ReactElement {
|
||||
const p = use.Player();
|
||||
const router = use.Router();
|
||||
const [quitOpen, setQuitOpen] = useState(false);
|
||||
const setRerender = useState(false)[1];
|
||||
function rerender(): void {
|
||||
@@ -60,7 +59,7 @@ export function CompanyLocation(props: IProps): React.ReactElement {
|
||||
/**
|
||||
* Name of company position that player holds, if applicable
|
||||
*/
|
||||
const jobTitle = p.jobs[props.locName] ? p.jobs[props.locName] : null;
|
||||
const jobTitle = Player.jobs[props.locName] ? Player.jobs[props.locName] : null;
|
||||
|
||||
/**
|
||||
* CompanyPosition object for the job that the player holds at this company
|
||||
@@ -68,13 +67,13 @@ export function CompanyLocation(props: IProps): React.ReactElement {
|
||||
*/
|
||||
const companyPosition = jobTitle ? CompanyPositions[jobTitle] : null;
|
||||
|
||||
p.location = props.locName;
|
||||
Player.location = props.locName;
|
||||
|
||||
function applyForAgentJob(e: React.MouseEvent<HTMLElement>): void {
|
||||
if (!e.isTrusted) {
|
||||
return;
|
||||
}
|
||||
p.applyForAgentJob();
|
||||
Player.applyForAgentJob();
|
||||
rerender();
|
||||
}
|
||||
|
||||
@@ -82,7 +81,7 @@ export function CompanyLocation(props: IProps): React.ReactElement {
|
||||
if (!e.isTrusted) {
|
||||
return;
|
||||
}
|
||||
p.applyForBusinessConsultantJob();
|
||||
Player.applyForBusinessConsultantJob();
|
||||
rerender();
|
||||
}
|
||||
|
||||
@@ -90,7 +89,7 @@ export function CompanyLocation(props: IProps): React.ReactElement {
|
||||
if (!e.isTrusted) {
|
||||
return;
|
||||
}
|
||||
p.applyForBusinessJob();
|
||||
Player.applyForBusinessJob();
|
||||
rerender();
|
||||
}
|
||||
|
||||
@@ -98,7 +97,7 @@ export function CompanyLocation(props: IProps): React.ReactElement {
|
||||
if (!e.isTrusted) {
|
||||
return;
|
||||
}
|
||||
p.applyForEmployeeJob();
|
||||
Player.applyForEmployeeJob();
|
||||
rerender();
|
||||
}
|
||||
|
||||
@@ -106,7 +105,7 @@ export function CompanyLocation(props: IProps): React.ReactElement {
|
||||
if (!e.isTrusted) {
|
||||
return;
|
||||
}
|
||||
p.applyForItJob();
|
||||
Player.applyForItJob();
|
||||
rerender();
|
||||
}
|
||||
|
||||
@@ -114,7 +113,7 @@ export function CompanyLocation(props: IProps): React.ReactElement {
|
||||
if (!e.isTrusted) {
|
||||
return;
|
||||
}
|
||||
p.applyForPartTimeEmployeeJob();
|
||||
Player.applyForPartTimeEmployeeJob();
|
||||
rerender();
|
||||
}
|
||||
|
||||
@@ -122,7 +121,7 @@ export function CompanyLocation(props: IProps): React.ReactElement {
|
||||
if (!e.isTrusted) {
|
||||
return;
|
||||
}
|
||||
p.applyForPartTimeWaiterJob();
|
||||
Player.applyForPartTimeWaiterJob();
|
||||
rerender();
|
||||
}
|
||||
|
||||
@@ -130,7 +129,7 @@ export function CompanyLocation(props: IProps): React.ReactElement {
|
||||
if (!e.isTrusted) {
|
||||
return;
|
||||
}
|
||||
p.applyForSecurityJob();
|
||||
Player.applyForSecurityJob();
|
||||
rerender();
|
||||
}
|
||||
|
||||
@@ -138,7 +137,7 @@ export function CompanyLocation(props: IProps): React.ReactElement {
|
||||
if (!e.isTrusted) {
|
||||
return;
|
||||
}
|
||||
p.applyForSoftwareConsultantJob();
|
||||
Player.applyForSoftwareConsultantJob();
|
||||
rerender();
|
||||
}
|
||||
|
||||
@@ -146,7 +145,7 @@ export function CompanyLocation(props: IProps): React.ReactElement {
|
||||
if (!e.isTrusted) {
|
||||
return;
|
||||
}
|
||||
p.applyForSoftwareJob();
|
||||
Player.applyForSoftwareJob();
|
||||
rerender();
|
||||
}
|
||||
|
||||
@@ -154,7 +153,7 @@ export function CompanyLocation(props: IProps): React.ReactElement {
|
||||
if (!e.isTrusted) {
|
||||
return;
|
||||
}
|
||||
p.applyForWaiterJob();
|
||||
Player.applyForWaiterJob();
|
||||
rerender();
|
||||
}
|
||||
|
||||
@@ -166,7 +165,7 @@ export function CompanyLocation(props: IProps): React.ReactElement {
|
||||
if (!loc.infiltrationData)
|
||||
throw new Error(`trying to start infiltration at ${props.locName} but the infiltrationData is null`);
|
||||
|
||||
router.toInfiltration(loc);
|
||||
Router.toInfiltration(loc);
|
||||
}
|
||||
|
||||
function work(e: React.MouseEvent<HTMLElement>): void {
|
||||
@@ -176,14 +175,14 @@ export function CompanyLocation(props: IProps): React.ReactElement {
|
||||
|
||||
const pos = companyPosition;
|
||||
if (pos instanceof CompanyPosition) {
|
||||
p.startWork(
|
||||
Player.startWork(
|
||||
new CompanyWork({
|
||||
singularity: false,
|
||||
companyName: props.locName,
|
||||
}),
|
||||
);
|
||||
p.startFocusing();
|
||||
router.toWork();
|
||||
Player.startFocusing();
|
||||
Router.toWork();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { purchaseServer } from "../../Server/ServerPurchases";
|
||||
import { numeralWrapper } from "../../ui/numeralFormat";
|
||||
import { Money } from "../../ui/React/Money";
|
||||
import { Modal } from "../../ui/React/Modal";
|
||||
import { use } from "../../ui/Context";
|
||||
import { Player } from "../../Player";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import TextField from "@mui/material/TextField";
|
||||
import Button from "@mui/material/Button";
|
||||
@@ -21,7 +21,6 @@ interface IProps {
|
||||
}
|
||||
|
||||
export function PurchaseServerModal(props: IProps): React.ReactElement {
|
||||
const player = use.Player();
|
||||
const [hostname, setHostname] = useState("");
|
||||
|
||||
function tryToPurchaseServer(): void {
|
||||
@@ -56,7 +55,7 @@ export function PurchaseServerModal(props: IProps): React.ReactElement {
|
||||
placeholder="Unique Hostname"
|
||||
InputProps={{
|
||||
endAdornment: (
|
||||
<Button onClick={tryToPurchaseServer} disabled={!player.canAfford(props.cost) || hostname === ""}>
|
||||
<Button onClick={tryToPurchaseServer} disabled={!Player.canAfford(props.cost) || hostname === ""}>
|
||||
Buy
|
||||
</Button>
|
||||
),
|
||||
|
||||
@@ -10,132 +10,131 @@ import Tooltip from "@mui/material/Tooltip";
|
||||
import { Crimes } from "../../Crime/Crimes";
|
||||
|
||||
import { numeralWrapper } from "../../ui/numeralFormat";
|
||||
import { use } from "../../ui/Context";
|
||||
import { Router } from "../../ui/GameRoot";
|
||||
import { Player } from "../../Player";
|
||||
import { Box } from "@mui/material";
|
||||
|
||||
export function SlumsLocation(): React.ReactElement {
|
||||
const player = use.Player();
|
||||
const router = use.Router();
|
||||
function shoplift(e: React.MouseEvent<HTMLElement>): void {
|
||||
if (!e.isTrusted) {
|
||||
return;
|
||||
}
|
||||
Crimes.Shoplift.commit(player);
|
||||
router.toWork();
|
||||
player.focus = true;
|
||||
Crimes.Shoplift.commit();
|
||||
Router.toWork();
|
||||
Player.focus = true;
|
||||
}
|
||||
|
||||
function robStore(e: React.MouseEvent<HTMLElement>): void {
|
||||
if (!e.isTrusted) {
|
||||
return;
|
||||
}
|
||||
Crimes.RobStore.commit(player);
|
||||
router.toWork();
|
||||
player.focus = true;
|
||||
Crimes.RobStore.commit();
|
||||
Router.toWork();
|
||||
Player.focus = true;
|
||||
}
|
||||
|
||||
function mug(e: React.MouseEvent<HTMLElement>): void {
|
||||
if (!e.isTrusted) {
|
||||
return;
|
||||
}
|
||||
Crimes.Mug.commit(player);
|
||||
router.toWork();
|
||||
player.focus = true;
|
||||
Crimes.Mug.commit();
|
||||
Router.toWork();
|
||||
Player.focus = true;
|
||||
}
|
||||
|
||||
function larceny(e: React.MouseEvent<HTMLElement>): void {
|
||||
if (!e.isTrusted) {
|
||||
return;
|
||||
}
|
||||
Crimes.Larceny.commit(player);
|
||||
router.toWork();
|
||||
player.focus = true;
|
||||
Crimes.Larceny.commit();
|
||||
Router.toWork();
|
||||
Player.focus = true;
|
||||
}
|
||||
|
||||
function dealDrugs(e: React.MouseEvent<HTMLElement>): void {
|
||||
if (!e.isTrusted) {
|
||||
return;
|
||||
}
|
||||
Crimes.DealDrugs.commit(player);
|
||||
router.toWork();
|
||||
player.focus = true;
|
||||
Crimes.DealDrugs.commit();
|
||||
Router.toWork();
|
||||
Player.focus = true;
|
||||
}
|
||||
|
||||
function bondForgery(e: React.MouseEvent<HTMLElement>): void {
|
||||
if (!e.isTrusted) {
|
||||
return;
|
||||
}
|
||||
Crimes.BondForgery.commit(player);
|
||||
router.toWork();
|
||||
player.focus = true;
|
||||
Crimes.BondForgery.commit();
|
||||
Router.toWork();
|
||||
Player.focus = true;
|
||||
}
|
||||
|
||||
function traffickArms(e: React.MouseEvent<HTMLElement>): void {
|
||||
if (!e.isTrusted) {
|
||||
return;
|
||||
}
|
||||
Crimes.TraffickArms.commit(player);
|
||||
router.toWork();
|
||||
player.focus = true;
|
||||
Crimes.TraffickArms.commit();
|
||||
Router.toWork();
|
||||
Player.focus = true;
|
||||
}
|
||||
|
||||
function homicide(e: React.MouseEvent<HTMLElement>): void {
|
||||
if (!e.isTrusted) {
|
||||
return;
|
||||
}
|
||||
Crimes.Homicide.commit(player);
|
||||
router.toWork();
|
||||
player.focus = true;
|
||||
Crimes.Homicide.commit();
|
||||
Router.toWork();
|
||||
Player.focus = true;
|
||||
}
|
||||
|
||||
function grandTheftAuto(e: React.MouseEvent<HTMLElement>): void {
|
||||
if (!e.isTrusted) {
|
||||
return;
|
||||
}
|
||||
Crimes.GrandTheftAuto.commit(player);
|
||||
router.toWork();
|
||||
player.focus = true;
|
||||
Crimes.GrandTheftAuto.commit();
|
||||
Router.toWork();
|
||||
Player.focus = true;
|
||||
}
|
||||
|
||||
function kidnap(e: React.MouseEvent<HTMLElement>): void {
|
||||
if (!e.isTrusted) {
|
||||
return;
|
||||
}
|
||||
Crimes.Kidnap.commit(player);
|
||||
router.toWork();
|
||||
player.focus = true;
|
||||
Crimes.Kidnap.commit();
|
||||
Router.toWork();
|
||||
Player.focus = true;
|
||||
}
|
||||
|
||||
function assassinate(e: React.MouseEvent<HTMLElement>): void {
|
||||
if (!e.isTrusted) {
|
||||
return;
|
||||
}
|
||||
Crimes.Assassination.commit(player);
|
||||
router.toWork();
|
||||
player.focus = true;
|
||||
Crimes.Assassination.commit();
|
||||
Router.toWork();
|
||||
Player.focus = true;
|
||||
}
|
||||
|
||||
function heist(e: React.MouseEvent<HTMLElement>): void {
|
||||
if (!e.isTrusted) {
|
||||
return;
|
||||
}
|
||||
Crimes.Heist.commit(player);
|
||||
router.toWork();
|
||||
player.focus = true;
|
||||
Crimes.Heist.commit();
|
||||
Router.toWork();
|
||||
Player.focus = true;
|
||||
}
|
||||
|
||||
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);
|
||||
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 (
|
||||
<Box sx={{ display: "grid", width: "fit-content" }}>
|
||||
|
||||
@@ -21,7 +21,8 @@ import { AugmentationNames } from "../../Augmentation/data/AugmentationNames";
|
||||
import { Factions } from "../../Faction/Factions";
|
||||
import { joinFaction } from "../../Faction/FactionHelpers";
|
||||
|
||||
import { use } from "../../ui/Context";
|
||||
import { Router } from "../../ui/GameRoot";
|
||||
import { Player } from "../../Player";
|
||||
|
||||
import { dialogBoxCreate } from "../../ui/React/DialogBox";
|
||||
import { SnackbarEvents, ToastVariant } from "../../ui/React/Snackbar";
|
||||
@@ -41,27 +42,24 @@ type IProps = {
|
||||
};
|
||||
|
||||
export function SpecialLocation(props: IProps): React.ReactElement {
|
||||
const player = use.Player();
|
||||
const router = use.Router();
|
||||
const setRerender = useState(false)[1];
|
||||
const inBladeburner = player.inBladeburner();
|
||||
const inBladeburner = Player.inBladeburner();
|
||||
|
||||
/**
|
||||
* Click handler for Bladeburner button at Sector-12 NSA
|
||||
*/
|
||||
function handleBladeburner(): void {
|
||||
const p = player;
|
||||
if (p.inBladeburner()) {
|
||||
if (Player.inBladeburner()) {
|
||||
// Enter Bladeburner division
|
||||
router.toBladeburner();
|
||||
Router.toBladeburner();
|
||||
} else if (
|
||||
p.skills.strength >= 100 &&
|
||||
p.skills.defense >= 100 &&
|
||||
p.skills.dexterity >= 100 &&
|
||||
p.skills.agility >= 100
|
||||
Player.skills.strength >= 100 &&
|
||||
Player.skills.defense >= 100 &&
|
||||
Player.skills.dexterity >= 100 &&
|
||||
Player.skills.agility >= 100
|
||||
) {
|
||||
// Apply for Bladeburner division
|
||||
p.startBladeburner();
|
||||
Player.startBladeburner();
|
||||
dialogBoxCreate("You have been accepted into the Bladeburner division!");
|
||||
setRerender((old) => !old);
|
||||
|
||||
@@ -79,11 +77,11 @@ export function SpecialLocation(props: IProps): React.ReactElement {
|
||||
* Click handler for Resleeving button at New Tokyo VitaLife
|
||||
*/
|
||||
function handleGrafting(): void {
|
||||
router.toGrafting();
|
||||
Router.toGrafting();
|
||||
}
|
||||
|
||||
function renderBladeburner(): React.ReactElement {
|
||||
if (!player.canAccessBladeburner() || BitNodeMultipliers.BladeburnerRank === 0) {
|
||||
if (!Player.canAccessBladeburner() || BitNodeMultipliers.BladeburnerRank === 0) {
|
||||
return <></>;
|
||||
}
|
||||
const text = inBladeburner ? "Enter Bladeburner Headquarters" : "Apply to Bladeburner Division";
|
||||
@@ -99,32 +97,32 @@ export function SpecialLocation(props: IProps): React.ReactElement {
|
||||
function EatNoodles(): void {
|
||||
SnackbarEvents.emit("You ate some delicious noodles and feel refreshed", ToastVariant.SUCCESS, 2000);
|
||||
N00dles(); // This is the true power of the noodles.
|
||||
if (player.sourceFiles.length > 0) player.giveExploit(Exploit.N00dles);
|
||||
if (player.sourceFileLvl(5) > 0 || player.bitNodeN === 5) {
|
||||
player.exp.intelligence *= 1.0000000000000002;
|
||||
if (Player.sourceFiles.length > 0) Player.giveExploit(Exploit.N00dles);
|
||||
if (Player.sourceFileLvl(5) > 0 || Player.bitNodeN === 5) {
|
||||
Player.exp.intelligence *= 1.0000000000000002;
|
||||
}
|
||||
player.exp.hacking *= 1.0000000000000002;
|
||||
player.exp.strength *= 1.0000000000000002;
|
||||
player.exp.defense *= 1.0000000000000002;
|
||||
player.exp.agility *= 1.0000000000000002;
|
||||
player.exp.dexterity *= 1.0000000000000002;
|
||||
player.exp.charisma *= 1.0000000000000002;
|
||||
for (const node of player.hacknetNodes) {
|
||||
Player.exp.hacking *= 1.0000000000000002;
|
||||
Player.exp.strength *= 1.0000000000000002;
|
||||
Player.exp.defense *= 1.0000000000000002;
|
||||
Player.exp.agility *= 1.0000000000000002;
|
||||
Player.exp.dexterity *= 1.0000000000000002;
|
||||
Player.exp.charisma *= 1.0000000000000002;
|
||||
for (const node of Player.hacknetNodes) {
|
||||
if (node instanceof HacknetNode) {
|
||||
player.gainMoney(node.moneyGainRatePerSecond * 0.001, "other");
|
||||
Player.gainMoney(node.moneyGainRatePerSecond * 0.001, "other");
|
||||
} else {
|
||||
const server = GetServer(node);
|
||||
if (!(server instanceof HacknetServer)) throw new Error(`Server ${node} is not a hacknet server.`);
|
||||
player.hashManager.storeHashes(server.hashRate * 0.001);
|
||||
Player.hashManager.storeHashes(server.hashRate * 0.001);
|
||||
}
|
||||
}
|
||||
|
||||
if (player.bladeburner) {
|
||||
player.bladeburner.rank += 0.00001;
|
||||
if (Player.bladeburner) {
|
||||
Player.bladeburner.rank += 0.00001;
|
||||
}
|
||||
|
||||
if (player.corporation) {
|
||||
player.corporation.funds += player.corporation.revenue * 0.01;
|
||||
if (Player.corporation) {
|
||||
Player.corporation.funds += Player.corporation.revenue * 0.01;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,7 +136,7 @@ export function SpecialLocation(props: IProps): React.ReactElement {
|
||||
|
||||
function CreateCorporation(): React.ReactElement {
|
||||
const [open, setOpen] = useState(false);
|
||||
if (!player.canAccessCorporation()) {
|
||||
if (!Player.canAccessCorporation()) {
|
||||
return (
|
||||
<>
|
||||
<Typography>
|
||||
@@ -149,7 +147,7 @@ export function SpecialLocation(props: IProps): React.ReactElement {
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<Button disabled={!player.canAccessCorporation() || player.hasCorporation()} onClick={() => setOpen(true)}>
|
||||
<Button disabled={!Player.canAccessCorporation() || Player.hasCorporation()} onClick={() => setOpen(true)}>
|
||||
Create a Corporation
|
||||
</Button>
|
||||
<CreateCorporationModal open={open} onClose={() => setOpen(false)} />
|
||||
@@ -158,7 +156,7 @@ export function SpecialLocation(props: IProps): React.ReactElement {
|
||||
}
|
||||
|
||||
function renderGrafting(): React.ReactElement {
|
||||
if (!player.canAccessGrafting()) {
|
||||
if (!Player.canAccessGrafting()) {
|
||||
return <></>;
|
||||
}
|
||||
return (
|
||||
@@ -170,21 +168,21 @@ export function SpecialLocation(props: IProps): React.ReactElement {
|
||||
|
||||
function handleCotMG(): void {
|
||||
const faction = Factions[FactionNames.ChurchOfTheMachineGod];
|
||||
if (!player.factions.includes(FactionNames.ChurchOfTheMachineGod)) {
|
||||
if (!Player.factions.includes(FactionNames.ChurchOfTheMachineGod)) {
|
||||
joinFaction(faction);
|
||||
}
|
||||
if (
|
||||
!player.augmentations.some((a) => a.name === AugmentationNames.StaneksGift1) &&
|
||||
!player.queuedAugmentations.some((a) => a.name === AugmentationNames.StaneksGift1)
|
||||
!Player.augmentations.some((a) => a.name === AugmentationNames.StaneksGift1) &&
|
||||
!Player.queuedAugmentations.some((a) => a.name === AugmentationNames.StaneksGift1)
|
||||
) {
|
||||
applyAugmentation({ name: AugmentationNames.StaneksGift1, level: 1 });
|
||||
}
|
||||
|
||||
router.toStaneksGift();
|
||||
Router.toStaneksGift();
|
||||
}
|
||||
|
||||
function renderCotMG(): React.ReactElement {
|
||||
const toStanek = <Button onClick={() => router.toStaneksGift()}>Open Stanek's Gift</Button>;
|
||||
const toStanek = <Button onClick={() => Router.toStaneksGift()}>Open Stanek's Gift</Button>;
|
||||
// prettier-ignore
|
||||
const symbol = <Typography sx={{ lineHeight: '1em', whiteSpace: 'pre' }}>
|
||||
{" `` "}<br />
|
||||
@@ -215,7 +213,7 @@ export function SpecialLocation(props: IProps): React.ReactElement {
|
||||
{" sNNo-.`.-omNy` "}<br />
|
||||
{" -smNNNNmdo- "}<br />
|
||||
{" `..` "}</Typography>
|
||||
if (player.hasAugmentation(AugmentationNames.StaneksGift3, true)) {
|
||||
if (Player.hasAugmentation(AugmentationNames.StaneksGift3, true)) {
|
||||
return (
|
||||
<>
|
||||
<Typography>
|
||||
@@ -232,7 +230,7 @@ export function SpecialLocation(props: IProps): React.ReactElement {
|
||||
</>
|
||||
);
|
||||
}
|
||||
if (player.hasAugmentation(AugmentationNames.StaneksGift2, true)) {
|
||||
if (Player.hasAugmentation(AugmentationNames.StaneksGift2, true)) {
|
||||
return (
|
||||
<>
|
||||
<Typography>
|
||||
@@ -249,7 +247,7 @@ export function SpecialLocation(props: IProps): React.ReactElement {
|
||||
</>
|
||||
);
|
||||
}
|
||||
if (player.factions.includes(FactionNames.ChurchOfTheMachineGod)) {
|
||||
if (Player.factions.includes(FactionNames.ChurchOfTheMachineGod)) {
|
||||
return (
|
||||
<>
|
||||
<Typography>
|
||||
@@ -263,7 +261,7 @@ export function SpecialLocation(props: IProps): React.ReactElement {
|
||||
);
|
||||
}
|
||||
|
||||
if (!player.canAccessCotMG()) {
|
||||
if (!Player.canAccessCotMG()) {
|
||||
return (
|
||||
<>
|
||||
<Typography>
|
||||
@@ -278,8 +276,8 @@ export function SpecialLocation(props: IProps): React.ReactElement {
|
||||
}
|
||||
|
||||
if (
|
||||
player.augmentations.filter((a) => a.name !== AugmentationNames.NeuroFluxGovernor).length > 0 ||
|
||||
player.queuedAugmentations.filter((a) => a.name !== AugmentationNames.NeuroFluxGovernor).length > 0
|
||||
Player.augmentations.filter((a) => a.name !== AugmentationNames.NeuroFluxGovernor).length > 0 ||
|
||||
Player.queuedAugmentations.filter((a) => a.name !== AugmentationNames.NeuroFluxGovernor).length > 0
|
||||
) {
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -2,7 +2,6 @@ import React from "react";
|
||||
import { CONSTANTS } from "../../Constants";
|
||||
import { Money } from "../../ui/React/Money";
|
||||
import { Modal } from "../../ui/React/Modal";
|
||||
import { use } from "../../ui/Context";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Button from "@mui/material/Button";
|
||||
|
||||
@@ -15,7 +14,6 @@ interface IProps {
|
||||
}
|
||||
|
||||
export function TravelConfirmationModal(props: IProps): React.ReactElement {
|
||||
const player = use.Player();
|
||||
const cost = CONSTANTS.TravelCost;
|
||||
function travel(): void {
|
||||
props.travel();
|
||||
|
||||
@@ -10,7 +10,8 @@ import Button from "@mui/material/Button";
|
||||
import { Location } from "../Location";
|
||||
|
||||
import { Money } from "../../ui/React/Money";
|
||||
import { use } from "../../ui/Context";
|
||||
import { Router } from "../../ui/GameRoot";
|
||||
import { Player } from "../../Player";
|
||||
import { Box } from "@mui/material";
|
||||
|
||||
import { ClassWork, ClassType, Classes } from "../../Work/ClassWork";
|
||||
@@ -21,19 +22,16 @@ type IProps = {
|
||||
};
|
||||
|
||||
export function UniversityLocation(props: IProps): React.ReactElement {
|
||||
const player = use.Player();
|
||||
const router = use.Router();
|
||||
|
||||
function take(classType: ClassType): void {
|
||||
player.startWork(
|
||||
Player.startWork(
|
||||
new ClassWork({
|
||||
classType: classType,
|
||||
location: props.loc.name,
|
||||
singularity: false,
|
||||
}),
|
||||
);
|
||||
player.startFocusing();
|
||||
router.toWork();
|
||||
Player.startFocusing();
|
||||
Router.toWork();
|
||||
}
|
||||
|
||||
const dataStructuresCost = calculateCost(Classes[ClassType.DataStructures], props.loc);
|
||||
|
||||
Reference in New Issue
Block a user