Merge branch 'dev' of github.com:danielyxie/bitburner into feature/grafting

This commit is contained in:
nickofolas
2022-03-19 10:27:49 -05:00
55 changed files with 1518 additions and 1262 deletions
@@ -65,6 +65,7 @@ import { serverMetadata } from "../../Server/data/servers";
import { SnackbarEvents } from "../../ui/React/Snackbar";
import { calculateClassEarnings } from "../formulas/work";
import { achievements } from "../../Achievements/Achievements";
import { FactionNames } from "../../Faction/data/FactionNames";
export function init(this: IPlayer): void {
/* Initialize Player's home computer */
@@ -615,8 +616,8 @@ export function process(this: IPlayer, router: IRouter, numCycles = 1): void {
router.toGrafting();
}
} else if (this.work(numCycles)) {
router.toCity();
}
router.toCity();
}
}
}
@@ -1565,20 +1566,20 @@ export function finishCrime(this: IPlayer, cancelled: boolean): string {
if (ws.disableLogs.ALL == null && ws.disableLogs.commitCrime == null) {
ws.scriptRef.log(
"SUCCESS: Crime successful! Gained " +
numeralWrapper.formatMoney(this.workMoneyGained) +
", " +
numeralWrapper.formatExp(this.workHackExpGained) +
" hack exp, " +
numeralWrapper.formatExp(this.workStrExpGained) +
" str exp, " +
numeralWrapper.formatExp(this.workDefExpGained) +
" def exp, " +
numeralWrapper.formatExp(this.workDexExpGained) +
" dex exp, " +
numeralWrapper.formatExp(this.workAgiExpGained) +
" agi exp, " +
numeralWrapper.formatExp(this.workChaExpGained) +
" cha exp.",
numeralWrapper.formatMoney(this.workMoneyGained) +
", " +
numeralWrapper.formatExp(this.workHackExpGained) +
" hack exp, " +
numeralWrapper.formatExp(this.workStrExpGained) +
" str exp, " +
numeralWrapper.formatExp(this.workDefExpGained) +
" def exp, " +
numeralWrapper.formatExp(this.workDexExpGained) +
" dex exp, " +
numeralWrapper.formatExp(this.workAgiExpGained) +
" agi exp, " +
numeralWrapper.formatExp(this.workChaExpGained) +
" cha exp.",
);
}
} else {
@@ -1617,18 +1618,18 @@ export function finishCrime(this: IPlayer, cancelled: boolean): string {
if (ws.disableLogs.ALL == null && ws.disableLogs.commitCrime == null) {
ws.scriptRef.log(
"FAIL: Crime failed! Gained " +
numeralWrapper.formatExp(this.workHackExpGained) +
" hack exp, " +
numeralWrapper.formatExp(this.workStrExpGained) +
" str exp, " +
numeralWrapper.formatExp(this.workDefExpGained) +
" def exp, " +
numeralWrapper.formatExp(this.workDexExpGained) +
" dex exp, " +
numeralWrapper.formatExp(this.workAgiExpGained) +
" agi exp, " +
numeralWrapper.formatExp(this.workChaExpGained) +
" cha exp.",
numeralWrapper.formatExp(this.workHackExpGained) +
" hack exp, " +
numeralWrapper.formatExp(this.workStrExpGained) +
" str exp, " +
numeralWrapper.formatExp(this.workDefExpGained) +
" def exp, " +
numeralWrapper.formatExp(this.workDexExpGained) +
" dex exp, " +
numeralWrapper.formatExp(this.workAgiExpGained) +
" agi exp, " +
numeralWrapper.formatExp(this.workChaExpGained) +
" cha exp.",
);
}
} else {
@@ -1811,7 +1812,6 @@ export function applyForJob(this: IPlayer, entryPosType: CompanyPosition, sing =
}
return false;
}
return false; //Same job, do nothing
}
}
@@ -2144,7 +2144,7 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
}
//Illuminati
const illuminatiFac = Factions["Illuminati"];
const illuminatiFac = Factions[FactionNames.Illuminati];
if (
!illuminatiFac.isBanned &&
!illuminatiFac.isMember &&
@@ -2161,7 +2161,7 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
}
//Daedalus
const daedalusFac = Factions["Daedalus"];
const daedalusFac = Factions[FactionNames.Daedalus];
if (
!daedalusFac.isBanned &&
!daedalusFac.isMember &&
@@ -2175,7 +2175,7 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
}
//The Covenant
const covenantFac = Factions["The Covenant"];
const covenantFac = Factions[FactionNames.TheCovenant];
if (
!covenantFac.isBanned &&
!covenantFac.isMember &&
@@ -2192,7 +2192,7 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
}
//ECorp
const ecorpFac = Factions["ECorp"];
const ecorpFac = Factions[FactionNames.ECorp];
if (
!ecorpFac.isBanned &&
!ecorpFac.isMember &&
@@ -2203,7 +2203,7 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
}
//MegaCorp
const megacorpFac = Factions["MegaCorp"];
const megacorpFac = Factions[FactionNames.MegaCorp];
if (
!megacorpFac.isBanned &&
!megacorpFac.isMember &&
@@ -2214,7 +2214,7 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
}
//Bachman & Associates
const bachmanandassociatesFac = Factions["Bachman & Associates"];
const bachmanandassociatesFac = Factions[FactionNames.BachmanAssociates];
if (
!bachmanandassociatesFac.isBanned &&
!bachmanandassociatesFac.isMember &&
@@ -2225,7 +2225,7 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
}
//Blade Industries
const bladeindustriesFac = Factions["Blade Industries"];
const bladeindustriesFac = Factions[FactionNames.BladeIndustries];
if (
!bladeindustriesFac.isBanned &&
!bladeindustriesFac.isMember &&
@@ -2236,7 +2236,7 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
}
//NWO
const nwoFac = Factions["NWO"];
const nwoFac = Factions[FactionNames.NWO];
if (
!nwoFac.isBanned &&
!nwoFac.isMember &&
@@ -2247,7 +2247,7 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
}
//Clarke Incorporated
const clarkeincorporatedFac = Factions["Clarke Incorporated"];
const clarkeincorporatedFac = Factions[FactionNames.ClarkeIncorporated];
if (
!clarkeincorporatedFac.isBanned &&
!clarkeincorporatedFac.isMember &&
@@ -2258,7 +2258,7 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
}
//OmniTek Incorporated
const omnitekincorporatedFac = Factions["OmniTek Incorporated"];
const omnitekincorporatedFac = Factions[FactionNames.OmniTekIncorporated];
if (
!omnitekincorporatedFac.isBanned &&
!omnitekincorporatedFac.isMember &&
@@ -2269,7 +2269,7 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
}
//Four Sigma
const foursigmaFac = Factions["Four Sigma"];
const foursigmaFac = Factions[FactionNames.FourSigma];
if (
!foursigmaFac.isBanned &&
!foursigmaFac.isMember &&
@@ -2280,7 +2280,7 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
}
//KuaiGong International
const kuaigonginternationalFac = Factions["KuaiGong International"];
const kuaigonginternationalFac = Factions[FactionNames.KuaiGongInternational];
if (
!kuaigonginternationalFac.isBanned &&
!kuaigonginternationalFac.isMember &&
@@ -2291,27 +2291,27 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
}
//Fulcrum Secret Technologies - If u've unlocked fulcrum secret technolgoies server and have a high rep with the company
const fulcrumsecrettechonologiesFac = Factions["Fulcrum Secret Technologies"];
const fulcrumsecrettechonologiesFac = Factions[FactionNames.FulcrumSecretTechnologies];
const fulcrumSecretServer = GetServer(SpecialServers.FulcrumSecretTechnologies);
if (!(fulcrumSecretServer instanceof Server)) throw new Error("Fulcrum Secret Technologies should be normal server");
if (!(fulcrumSecretServer instanceof Server)) throw new Error(`${FactionNames.FulcrumSecretTechnologies} should be normal server`);
if (fulcrumSecretServer == null) {
console.error("Could not find Fulcrum Secret Technologies Server");
console.error(`Could not find ${FactionNames.FulcrumSecretTechnologies} Server`);
} else if (
!fulcrumsecrettechonologiesFac.isBanned &&
!fulcrumsecrettechonologiesFac.isMember &&
!fulcrumsecrettechonologiesFac.alreadyInvited &&
fulcrumSecretServer.backdoorInstalled &&
checkMegacorpRequirements(LocationName.AevumFulcrumTechnologies, 250e3)
) {
invitedFactions.push(fulcrumsecrettechonologiesFac);
}
!fulcrumsecrettechonologiesFac.isBanned &&
!fulcrumsecrettechonologiesFac.isMember &&
!fulcrumsecrettechonologiesFac.alreadyInvited &&
fulcrumSecretServer.backdoorInstalled &&
checkMegacorpRequirements(LocationName.AevumFulcrumTechnologies, 250e3)
) {
invitedFactions.push(fulcrumsecrettechonologiesFac);
}
//BitRunners
const bitrunnersFac = Factions["BitRunners"];
const bitrunnersFac = Factions[FactionNames.BitRunners];
const bitrunnersServer = GetServer(SpecialServers.BitRunnersServer);
if (!(bitrunnersServer instanceof Server)) throw new Error("BitRunners should be normal server");
if (!(bitrunnersServer instanceof Server)) throw new Error(`${FactionNames.BitRunners} should be normal server`);
if (bitrunnersServer == null) {
console.error("Could not find BitRunners Server");
console.error(`Could not find ${FactionNames.BitRunners} Server`);
} else if (
!bitrunnersFac.isBanned &&
!bitrunnersFac.isMember &&
@@ -2323,11 +2323,11 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
//The Black Hand
const theblackhandFac = Factions["The Black Hand"];
const theblackhandFac = Factions[FactionNames.TheBlackHand];
const blackhandServer = GetServer(SpecialServers.TheBlackHandServer);
if (!(blackhandServer instanceof Server)) throw new Error("TheBlackHand should be normal server");
if (!(blackhandServer instanceof Server)) throw new Error(`${FactionNames.TheBlackHand} should be normal server`);
if (blackhandServer == null) {
console.error("Could not find The Black Hand Server");
console.error(`Could not find ${FactionNames.TheBlackHand} Server`);
} else if (
!theblackhandFac.isBanned &&
!theblackhandFac.isMember &&
@@ -2338,11 +2338,11 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
}
//NiteSec
const nitesecFac = Factions["NiteSec"];
const nitesecFac = Factions[FactionNames.NiteSec];
const nitesecServer = GetServer(SpecialServers.NiteSecServer);
if (!(nitesecServer instanceof Server)) throw new Error("NiteSec should be normal server");
if (!(nitesecServer instanceof Server)) throw new Error(`${FactionNames.NiteSec} should be normal server`);
if (nitesecServer == null) {
console.error("Could not find NiteSec Server");
console.error(`Could not find ${FactionNames.NiteSec} Server`);
} else if (
!nitesecFac.isBanned &&
!nitesecFac.isMember &&
@@ -2353,7 +2353,7 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
}
//Chongqing
const chongqingFac = Factions["Chongqing"];
const chongqingFac = Factions[FactionNames.Chongqing];
if (
!chongqingFac.isBanned &&
!chongqingFac.isMember &&
@@ -2365,7 +2365,7 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
}
//Sector-12
const sector12Fac = Factions["Sector-12"];
const sector12Fac = Factions[FactionNames.Sector12];
if (
!sector12Fac.isBanned &&
!sector12Fac.isMember &&
@@ -2377,7 +2377,7 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
}
//New Tokyo
const newtokyoFac = Factions["New Tokyo"];
const newtokyoFac = Factions[FactionNames.NewTokyo];
if (
!newtokyoFac.isBanned &&
!newtokyoFac.isMember &&
@@ -2389,7 +2389,7 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
}
//Aevum
const aevumFac = Factions["Aevum"];
const aevumFac = Factions[FactionNames.Aevum];
if (
!aevumFac.isBanned &&
!aevumFac.isMember &&
@@ -2401,7 +2401,7 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
}
//Ishima
const ishimaFac = Factions["Ishima"];
const ishimaFac = Factions[FactionNames.Ishima];
if (
!ishimaFac.isBanned &&
!ishimaFac.isMember &&
@@ -2413,7 +2413,7 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
}
//Volhaven
const volhavenFac = Factions["Volhaven"];
const volhavenFac = Factions[FactionNames.Volhaven];
if (
!volhavenFac.isBanned &&
!volhavenFac.isMember &&
@@ -2425,7 +2425,7 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
}
//Speakers for the Dead
const speakersforthedeadFac = Factions["Speakers for the Dead"];
const speakersforthedeadFac = Factions[FactionNames.SpeakersForTheDead];
if (
!speakersforthedeadFac.isBanned &&
!speakersforthedeadFac.isMember &&
@@ -2444,7 +2444,7 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
}
//The Dark Army
const thedarkarmyFac = Factions["The Dark Army"];
const thedarkarmyFac = Factions[FactionNames.TheDarkArmy];
if (
!thedarkarmyFac.isBanned &&
!thedarkarmyFac.isMember &&
@@ -2464,7 +2464,7 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
}
//The Syndicate
const thesyndicateFac = Factions["The Syndicate"];
const thesyndicateFac = Factions[FactionNames.TheSyndicate];
if (
!thesyndicateFac.isBanned &&
!thesyndicateFac.isMember &&
@@ -2484,7 +2484,7 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
}
//Silhouette
const silhouetteFac = Factions["Silhouette"];
const silhouetteFac = Factions[FactionNames.Silhouette];
if (
!silhouetteFac.isBanned &&
!silhouetteFac.isMember &&
@@ -2499,7 +2499,7 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
}
//Tetrads
const tetradsFac = Factions["Tetrads"];
const tetradsFac = Factions[FactionNames.Tetrads];
if (
!tetradsFac.isBanned &&
!tetradsFac.isMember &&
@@ -2515,7 +2515,7 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
}
//SlumSnakes
const slumsnakesFac = Factions["Slum Snakes"];
const slumsnakesFac = Factions[FactionNames.SlumSnakes];
if (
!slumsnakesFac.isBanned &&
!slumsnakesFac.isMember &&
@@ -2531,7 +2531,7 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
}
//Netburners
const netburnersFac = Factions["Netburners"];
const netburnersFac = Factions[FactionNames.Netburners];
let totalHacknetRam = 0;
let totalHacknetCores = 0;
let totalHacknetLevels = 0;
@@ -2563,7 +2563,7 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
}
//Tian Di Hui
const tiandihuiFac = Factions["Tian Di Hui"];
const tiandihuiFac = Factions[FactionNames.TianDiHui];
if (
!tiandihuiFac.isBanned &&
!tiandihuiFac.isMember &&
@@ -2576,11 +2576,11 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
}
//CyberSec
const cybersecFac = Factions["CyberSec"];
const cybersecFac = Factions[FactionNames.CyberSec];
const cybersecServer = GetServer(SpecialServers.CyberSecServer);
if (!(cybersecServer instanceof Server)) throw new Error("cybersec should be normal server");
if (!(cybersecServer instanceof Server)) throw new Error(`${FactionNames.CyberSec} should be normal server`);
if (cybersecServer == null) {
console.error("Could not find CyberSec Server");
console.error(`Could not find ${FactionNames.CyberSec} Server`);
} else if (
!cybersecFac.isBanned &&
!cybersecFac.isMember &&
@@ -2637,7 +2637,7 @@ export function gainCodingContractReward(this: IPlayer, reward: ICodingContractR
const totalGain = CONSTANTS.CodingContractBaseFactionRepGain * difficulty;
// Ignore Bladeburners and other special factions for this calculation
const specialFactions = ["Bladeburners"];
const specialFactions = [FactionNames.Bladeburners as string];
const factions = this.factions.slice().filter((f) => {
return !specialFactions.includes(f);
});
@@ -2656,7 +2656,6 @@ export function gainCodingContractReward(this: IPlayer, reward: ICodingContractR
Factions[facName].playerReputation += gainPerFaction;
}
return `Gained ${gainPerFaction} reputation for each of the following factions: ${factions.toString()}`;
break;
case CodingContractRewardType.CompanyReputation: {
if (reward.name == null || !(Companies[reward.name] instanceof Company)) {
//If no/invalid company was designated, just give rewards to all factions
+3 -2
View File
@@ -1,3 +1,4 @@
import { FactionNames } from '../../Faction/data/FactionNames';
import { Sleeve } from "./Sleeve";
import { IPlayer } from "../IPlayer";
@@ -80,10 +81,10 @@ export function findSleevePurchasableAugs(sleeve: Sleeve, p: IPlayer): Augmentat
}
for (const facName of p.factions) {
if (facName === "Bladeburners") {
if (facName === FactionNames.Bladeburners) {
continue;
}
if (facName === "Netburners") {
if (facName === FactionNames.Netburners) {
continue;
}
const fac: Faction | null = Factions[facName];
@@ -16,6 +16,7 @@ import { use } from "../../../ui/Context";
import { dialogBoxCreate } from "../../../ui/React/DialogBox";
import Typography from "@mui/material/Typography";
import Button from "@mui/material/Button";
import { FactionNames } from "../../../Faction/data/FactionNames";
interface IProps {
open: boolean;
@@ -76,7 +77,7 @@ export function CovenantPurchasesRoot(props: IProps): React.ReactElement {
<>
<Typography>
Purchase an additional Sleeves. These Duplicate Sleeves are permanent (they persist through BitNodes). You
can purchase a total of {MaxSleevesFromCovenant} from The Covenant.
can purchase a total of {MaxSleevesFromCovenant} from {FactionNames.TheCovenant}.
</Typography>
<Button disabled={purchaseDisabled} onClick={purchaseOnClick}>
Purchase -&nbsp;
+3 -2
View File
@@ -2,6 +2,7 @@ import React from "react";
import { Modal } from "../../../ui/React/Modal";
import Typography from "@mui/material/Typography";
import { FactionNames } from "../../../Faction/data/FactionNames";
interface IProps {
open: boolean;
@@ -90,7 +91,7 @@ export function FAQModal({ open, onClose }: IProps): React.ReactElement {
<Typography variant="h4">Why can't I buy the X Augmentation for my sleeve?</Typography>
<br />
<Typography>
Certain Augmentations, like Bladeburner-specific ones and NeuroFlux Governor, are not available for sleeves.
Certain Augmentations, like {FactionNames.Bladeburners}-specific ones and NeuroFlux Governor, are not available for sleeves.
</Typography>
<br />
<br />
@@ -109,7 +110,7 @@ export function FAQModal({ open, onClose }: IProps): React.ReactElement {
<br />
<br />
<Typography>
Memory can only be increased by purchasing upgrades from The Covenant. It is a persistent stat, meaning it
Memory can only be increased by purchasing upgrades from {FactionNames.TheCovenant}. It is a persistent stat, meaning it
never gets resets back to 1. The maximum possible value for a sleeve's memory is 100.
</Typography>
</>
@@ -50,74 +50,62 @@ export function SleeveAugmentationsModal(props: IProps): React.ReactElement {
return (
<Modal open={props.open} onClose={props.onClose}>
<>
<Typography>
You can purchase Augmentations for your Duplicate Sleeves. These Augmentations have the same effect as they
would for you. You can only purchase Augmentations that you have unlocked through Factions.
<br />
<br />
When purchasing an Augmentation for a Duplicate Sleeve, they are immediately installed. This means that the
Duplicate Sleeve will immediately lose all of its stat experience.
</Typography>
<Table size="small" padding="none">
<TableBody>
{availableAugs.map((aug) => {
return (
<TableRow key={aug.name}>
<TableCell>
<Button onClick={() => purchaseAugmentation(aug)} disabled={player.money < aug.startingCost}>
Buy
</Button>
</TableCell>
<TableCell>
<Box display="flex">
<Tooltip title={aug.stats || ""}>
<Typography>{aug.name}</Typography>
</Tooltip>
</Box>
</TableCell>
<TableCell>
<Money money={aug.startingCost} player={player} />
</TableCell>
</TableRow>
);
})}
</TableBody>
</Table>
<Box sx={{ mx: 1 }}>
<Typography>
You can purchase Augmentations for your Duplicate Sleeves. These Augmentations have the same effect as they
would for you. You can only purchase Augmentations that you have unlocked through Factions.
<br />
<br />
When purchasing an Augmentation for a Duplicate Sleeve, they are immediately installed. This means that the
Duplicate Sleeve will immediately lose all of its stat experience.
</Typography>
<Box component={Paper} sx={{ my: 1, p: 1 }}>
<Table size="small" padding="none">
<TableBody>
{availableAugs.map((aug) => {
return (
<TableRow key={aug.name}>
<TableCell>
<Button onClick={() => purchaseAugmentation(aug)} disabled={player.money < aug.startingCost}>
Buy
</Button>
</TableCell>
<TableCell>
<Box display="flex">
<Tooltip title={aug.stats || ""}>
<Typography>{aug.name}</Typography>
</Tooltip>
</Box>
</TableCell>
<TableCell>
<Money money={aug.startingCost} player={player} />
</TableCell>
</TableRow>
);
})}
</TableBody>
</Table>
</Box>
</Box>
{ownedAugNames.length > 0 && (
<>
<Typography>Owned Augmentations:</Typography>
{ownedAugNames.map((augName) => {
const aug = Augmentations[augName];
let tooltip = <></>;
if (typeof aug.info === "string") {
tooltip = (
<>
<span>{aug.info}</span>
<br />
<br />
{aug.stats}
</>
);
} else {
tooltip = (
<>
{aug.info}
<br />
<br />
{aug.stats}
</>
);
}
<Typography sx={{ mx: 1 }}>Owned Augmentations:</Typography>
<Box display="grid" sx={{ gridTemplateColumns: 'repeat(5, 1fr)', m: 1 }}>
{ownedAugNames.map((augName) => {
const aug = Augmentations[augName];
const info = typeof aug.info === "string" ? <span>{aug.info}</span> : aug.info
const tooltip = (<>{info}<br /><br />{aug.stats}</>);
return (
<Tooltip key={augName} title={<Typography>{tooltip}</Typography>}>
<Paper>
<Typography>{augName}</Typography>
</Paper>
</Tooltip>
);
})}
return (
<Tooltip key={augName} title={<Typography>{tooltip}</Typography>}>
<Paper sx={{ p: 1 }}>
<Typography>{augName}</Typography>
</Paper>
</Tooltip>
);
})}
</Box>
</>
)}
</>
+81 -101
View File
@@ -1,34 +1,29 @@
import React, { useState } from "react";
import {
Box,
Paper,
Typography,
Button,
Tooltip
} from "@mui/material";
import { CONSTANTS } from "../../../Constants";
import { Crimes } from "../../../Crime/Crimes";
import { numeralWrapper } from "../../../ui/numeralFormat";
import { createProgressBarText } from "../../../utils/helpers/createProgressBarText";
import { use } from "../../../ui/Context";
import { FactionWorkType } from "../../../Faction/FactionWorkTypeEnum";
import { Sleeve } from "../Sleeve";
import { SleeveTaskType } from "../SleeveTaskTypesEnum";
import { CONSTANTS } from "../../../Constants";
import { Crimes } from "../../../Crime/Crimes";
import { numeralWrapper } from "../../../ui/numeralFormat";
import { createProgressBarText } from "../../../utils/helpers/createProgressBarText";
import { SleeveAugmentationsModal } from "./SleeveAugmentationsModal";
import { TravelModal } from "./TravelModal";
import { Money } from "../../../ui/React/Money";
import { MoneyRate } from "../../../ui/React/MoneyRate";
import { use } from "../../../ui/Context";
import { ReputationRate } from "../../../ui/React/ReputationRate";
import { StatsElement } from "./StatsElement";
import { StatsElement, EarningsElement } from "./StatsElement";
import { MoreStatsModal } from "./MoreStatsModal";
import { MoreEarningsModal } from "./MoreEarningsModal";
import { TaskSelector } from "./TaskSelector";
import { FactionWorkType } from "../../../Faction/FactionWorkTypeEnum";
import { StatsTable } from "../../../ui/React/StatsTable";
import Typography from "@mui/material/Typography";
import Paper from "@mui/material/Paper";
import Grid from "@mui/material/Grid";
import Button from "@mui/material/Button";
import Tooltip from "@mui/material/Tooltip";
interface IProps {
sleeve: Sleeve;
@@ -141,86 +136,71 @@ export function SleeveElem(props: IProps): React.ReactElement {
console.error(`Invalid/Unrecognized taskValue in updateSleeveTaskDescription(): ${abc[0]}`);
}
let data: any[][] = [];
if (props.sleeve.currentTask === SleeveTaskType.Crime) {
data = [
[`Money`, <Money money={parseFloat(props.sleeve.currentTaskLocation)} />, `(on success)`],
[`Hacking Exp`, numeralWrapper.formatExp(props.sleeve.gainRatesForTask.hack), `(2x on success)`],
[`Strength Exp`, numeralWrapper.formatExp(props.sleeve.gainRatesForTask.str), `(2x on success)`],
[`Defense Exp`, numeralWrapper.formatExp(props.sleeve.gainRatesForTask.def), `(2x on success)`],
[`Dexterity Exp`, numeralWrapper.formatExp(props.sleeve.gainRatesForTask.dex), `(2x on success)`],
[`Agility Exp`, numeralWrapper.formatExp(props.sleeve.gainRatesForTask.agi), `(2x on success)`],
[`Charisma Exp`, numeralWrapper.formatExp(props.sleeve.gainRatesForTask.cha), `(2x on success)`],
];
} else {
data = [
[`Money:`, <MoneyRate money={5 * props.sleeve.gainRatesForTask.money} />],
[`Hacking Exp:`, `${numeralWrapper.formatExp(5 * props.sleeve.gainRatesForTask.hack)} / s`],
[`Strength Exp:`, `${numeralWrapper.formatExp(5 * props.sleeve.gainRatesForTask.str)} / s`],
[`Defense Exp:`, `${numeralWrapper.formatExp(5 * props.sleeve.gainRatesForTask.def)} / s`],
[`Dexterity Exp:`, `${numeralWrapper.formatExp(5 * props.sleeve.gainRatesForTask.dex)} / s`],
[`Agility Exp:`, `${numeralWrapper.formatExp(5 * props.sleeve.gainRatesForTask.agi)} / s`],
[`Charisma Exp:`, `${numeralWrapper.formatExp(5 * props.sleeve.gainRatesForTask.cha)} / s`],
];
if (props.sleeve.currentTask === SleeveTaskType.Company || props.sleeve.currentTask === SleeveTaskType.Faction) {
const repGain: number = props.sleeve.getRepGain(player);
data.push([`Reputation:`, <ReputationRate reputation={5 * repGain} />]);
}
}
return (
<>
<Grid container component={Paper}>
<Grid item xs={3}>
<StatsElement sleeve={props.sleeve} />
<Button onClick={() => setStatsOpen(true)}>More Stats</Button>
<Tooltip title={player.money < CONSTANTS.TravelCost ? <Typography>Insufficient funds</Typography> : ""}>
<span>
<Button onClick={() => setTravelOpen(true)} disabled={player.money < CONSTANTS.TravelCost}>
Travel
</Button>
</span>
</Tooltip>
<Tooltip
title={props.sleeve.shock < 100 ? <Typography>Unlocked when sleeve has fully recovered</Typography> : ""}
>
<span>
<Button onClick={() => setAugmentationsOpen(true)} disabled={props.sleeve.shock < 100}>
Manage Augmentations
</Button>
</span>
</Tooltip>
</Grid>
<Grid item xs={5}>
<TaskSelector player={player} sleeve={props.sleeve} setABC={setABC} />
<Typography>{desc}</Typography>
<Typography>
{props.sleeve.currentTask === SleeveTaskType.Crime &&
createProgressBarText({
progress: props.sleeve.currentTaskTime / props.sleeve.currentTaskMaxTime,
totalTicks: 25,
})}
</Typography>
<Button onClick={setTask}>Set Task</Button>
</Grid>
<Grid item xs={4}>
<StatsTable title="Earnings (Pre-Synchronization)" rows={data} />
<Button onClick={() => setEarningsOpen(true)}>More Earnings Info</Button>
</Grid>
</Grid>
<MoreStatsModal open={statsOpen} onClose={() => setStatsOpen(false)} sleeve={props.sleeve} />
<MoreEarningsModal open={earningsOpen} onClose={() => setEarningsOpen(false)} sleeve={props.sleeve} />
<TravelModal
open={travelOpen}
onClose={() => setTravelOpen(false)}
sleeve={props.sleeve}
rerender={props.rerender}
/>
<SleeveAugmentationsModal
open={augmentationsOpen}
onClose={() => setAugmentationsOpen(false)}
sleeve={props.sleeve}
/>
</>
<Box component={Paper} sx={{ width: 'auto' }}>
<Box sx={{ m: 1 }}>
<Box display="grid" sx={{ gridTemplateColumns: '1fr 1fr', width: '100%', gap: 1 }}>
<Box>
<StatsElement sleeve={props.sleeve} />
<Box display="grid" sx={{ gridTemplateColumns: '1fr 1fr', width: '100%' }}>
<Button onClick={() => setStatsOpen(true)}>More Stats</Button>
<Button onClick={() => setEarningsOpen(true)}>More Earnings Info</Button>
<Tooltip title={player.money < CONSTANTS.TravelCost ? <Typography>Insufficient funds</Typography> : ""}>
<span>
<Button
onClick={() => setTravelOpen(true)}
disabled={player.money < CONSTANTS.TravelCost}
sx={{ width: '100%', height: '100%' }}
>
Travel
</Button>
</span>
</Tooltip>
<Tooltip
title={props.sleeve.shock < 100 ? <Typography>Unlocked when sleeve has fully recovered</Typography> : ""}
>
<span>
<Button
onClick={() => setAugmentationsOpen(true)}
disabled={props.sleeve.shock < 100}
sx={{ width: '100%', height: '100%' }}
>
Manage Augmentations
</Button>
</span>
</Tooltip>
</Box>
</Box>
<Box>
<EarningsElement sleeve={props.sleeve} />
<Box>
<TaskSelector player={player} sleeve={props.sleeve} setABC={setABC} />
<Button onClick={setTask} sx={{ width: '100%' }}>Set Task</Button>
<Typography>{desc}</Typography>
<Typography>
{props.sleeve.currentTask === SleeveTaskType.Crime &&
createProgressBarText({
progress: props.sleeve.currentTaskTime / props.sleeve.currentTaskMaxTime,
totalTicks: 25,
})}
</Typography>
</Box>
</Box>
<MoreStatsModal open={statsOpen} onClose={() => setStatsOpen(false)} sleeve={props.sleeve} />
<MoreEarningsModal open={earningsOpen} onClose={() => setEarningsOpen(false)} sleeve={props.sleeve} />
<TravelModal
open={travelOpen}
onClose={() => setTravelOpen(false)}
sleeve={props.sleeve}
rerender={props.rerender}
/>
<SleeveAugmentationsModal
open={augmentationsOpen}
onClose={() => setAugmentationsOpen(false)}
sleeve={props.sleeve}
/>
</Box>
</Box>
</Box >
);
}
+30 -24
View File
@@ -1,12 +1,16 @@
import React, { useState, useEffect } from "react";
import {
Box,
Typography,
Button,
Container
} from "@mui/material";
import { use } from "../../../ui/Context";
import { SleeveElem } from "./SleeveElem";
import { FAQModal } from "./FAQModal";
import { use } from "../../../ui/Context";
import Typography from "@mui/material/Typography";
import Button from "@mui/material/Button";
import Link from "@mui/material/Link";
export function SleeveRoot(): React.ReactElement {
const player = use.Player();
@@ -23,27 +27,29 @@ export function SleeveRoot(): React.ReactElement {
return (
<>
<Typography variant="h4">Sleeves</Typography>
<Typography>
Duplicate Sleeves are MK-V Synthoids (synthetic androids) into which your consciousness has been copied. In
other words, these Synthoids contain a perfect duplicate of your mind.
<br />
<br />
Sleeves can be used to perform different tasks synchronously.
<br />
<br />
</Typography>
<Container disableGutters maxWidth="md" sx={{ mx: 0 }}>
<Typography variant="h4">Sleeves</Typography>
<Typography>
Duplicate Sleeves are MK-V Synthoids (synthetic androids) into which your consciousness has been copied. In
other words, these Synthoids contain a perfect duplicate of your mind.
<br />
<br />
Sleeves can be used to perform different tasks synchronously.
<br />
<br />
</Typography>
</Container>
<Button onClick={() => setFAQOpen(true)}>FAQ</Button>
<Link
target="_blank"
href="https://bitburner.readthedocs.io/en/latest/advancedgameplay/sleeves.html#duplicate-sleeves"
>
<Typography> Documentation</Typography>
</Link>
{player.sleeves.map((sleeve, i) => (
<SleeveElem key={i} rerender={rerender} sleeve={sleeve} />
))}
<Button href="https://bitburner.readthedocs.io/en/latest/advancedgameplay/sleeves.html#duplicate-sleeves" target="_blank">
Wiki Documentation
</Button>
<Box display="grid" sx={{ gridTemplateColumns: 'repeat(2, 1fr)', mt: 1 }}>
{player.sleeves.map((sleeve, i) => (
<SleeveElem key={i} rerender={rerender} sleeve={sleeve} />
))}
</Box>
<FAQModal open={FAQOpen} onClose={() => setFAQOpen(false)} />
</>
);
+101 -22
View File
@@ -1,31 +1,110 @@
import { Sleeve } from "../Sleeve";
import { numeralWrapper } from "../../../ui/numeralFormat";
import React from "react";
import { StatsTable } from "../../../ui/React/StatsTable";
import {
Typography,
Table,
TableBody,
TableCell,
TableRow,
} from "@mui/material";
import { numeralWrapper } from "../../../ui/numeralFormat";
import { Settings } from "../../../Settings/Settings";
import { StatsRow } from "../../../ui/React/StatsRow";
import { characterOverviewStyles as useStyles } from "../../../ui/React/CharacterOverview";
import { Money } from "../../../ui/React/Money";
import { MoneyRate } from "../../../ui/React/MoneyRate";
import { ReputationRate } from "../../../ui/React/ReputationRate";
import { use } from "../../../ui/Context";
import { Sleeve } from "../Sleeve";
import { SleeveTaskType } from "../SleeveTaskTypesEnum";
interface IProps {
sleeve: Sleeve;
}
export function StatsElement(props: IProps): React.ReactElement {
const rows = [
[
"HP: ",
<>
{numeralWrapper.formatHp(props.sleeve.hp)} / {numeralWrapper.formatHp(props.sleeve.max_hp)}
</>,
],
["City: ", <>{props.sleeve.city}</>],
["Hacking: ", <>{numeralWrapper.formatSkill(props.sleeve.hacking)}</>],
["Strength: ", <>{numeralWrapper.formatSkill(props.sleeve.strength)}</>],
["Defense: ", <>{numeralWrapper.formatSkill(props.sleeve.defense)}</>],
["Dexterity: ", <>{numeralWrapper.formatSkill(props.sleeve.dexterity)}</>],
["Agility: ", <>{numeralWrapper.formatSkill(props.sleeve.agility)}</>],
["Charisma: ", <>{numeralWrapper.formatSkill(props.sleeve.charisma)}</>],
["Shock: ", <>{numeralWrapper.formatSleeveShock(100 - props.sleeve.shock)}</>],
["Sync: ", <>{numeralWrapper.formatSleeveSynchro(props.sleeve.sync)}</>],
["Memory: ", <>{numeralWrapper.formatSleeveMemory(props.sleeve.memory)}</>],
];
return <StatsTable rows={rows} />;
const classes = useStyles();
return (
<Table sx={{ display: 'table', mb: 1, width: '100%' }}>
<TableBody>
<StatsRow name="City" color={Settings.theme.primary} data={{ content: props.sleeve.city }} />
<StatsRow name="HP" color={Settings.theme.hp}
data={{ content: `${numeralWrapper.formatHp(props.sleeve.hp)} / ${numeralWrapper.formatHp(props.sleeve.max_hp)}` }}
/>
<StatsRow name="Hacking" color={Settings.theme.hack} data={{ level: props.sleeve.hacking, exp: props.sleeve.hacking_exp }} />
<StatsRow name="Strength" color={Settings.theme.combat} data={{ level: props.sleeve.strength, exp: props.sleeve.strength_exp }} />
<StatsRow name="Defense" color={Settings.theme.combat} data={{ level: props.sleeve.defense, exp: props.sleeve.defense_exp }} />
<StatsRow name="Dexterity" color={Settings.theme.combat} data={{ level: props.sleeve.dexterity, exp: props.sleeve.dexterity_exp }} />
<StatsRow name="Agility" color={Settings.theme.combat} data={{ level: props.sleeve.agility, exp: props.sleeve.agility_exp }} />
<StatsRow name="Charisma" color={Settings.theme.cha} data={{ level: props.sleeve.charisma, exp: props.sleeve.charisma_exp }} />
<TableRow>
<TableCell classes={{ root: classes.cellNone }}>
<br />
</TableCell>
</TableRow>
<StatsRow name="Shock" color={Settings.theme.primary} data={{ content: numeralWrapper.formatSleeveShock(100 - props.sleeve.shock) }} />
<StatsRow name="Sync" color={Settings.theme.primary} data={{ content: numeralWrapper.formatSleeveSynchro(props.sleeve.sync) }} />
<StatsRow name="Memory" color={Settings.theme.primary} data={{ content: numeralWrapper.formatSleeveMemory(props.sleeve.memory) }} />
</TableBody>
</Table>
)
}
export function EarningsElement(props: IProps): React.ReactElement {
const classes = useStyles();
const player = use.Player();
let data: any[][] = [];
if (props.sleeve.currentTask === SleeveTaskType.Crime) {
data = [
[`Money`, <><Money money={parseFloat(props.sleeve.currentTaskLocation)} /> (on success)</>],
[`Hacking Exp`, `${numeralWrapper.formatExp(props.sleeve.gainRatesForTask.hack)} (2x on success)`],
[`Strength Exp`, `${numeralWrapper.formatExp(props.sleeve.gainRatesForTask.str)} (2x on success)`],
[`Defense Exp`, `${numeralWrapper.formatExp(props.sleeve.gainRatesForTask.def)} (2x on success)`],
[`Dexterity Exp`, `${numeralWrapper.formatExp(props.sleeve.gainRatesForTask.dex)} (2x on success)`],
[`Agility Exp`, `${numeralWrapper.formatExp(props.sleeve.gainRatesForTask.agi)} (2x on success)`],
[`Charisma Exp`, `${numeralWrapper.formatExp(props.sleeve.gainRatesForTask.cha)} (2x on success)`],
];
} else {
data = [
[`Money:`, <MoneyRate money={5 * props.sleeve.gainRatesForTask.money} />],
[`Hacking Exp:`, `${numeralWrapper.formatExp(5 * props.sleeve.gainRatesForTask.hack)} / sec`],
[`Strength Exp:`, `${numeralWrapper.formatExp(5 * props.sleeve.gainRatesForTask.str)} / sec`],
[`Defense Exp:`, `${numeralWrapper.formatExp(5 * props.sleeve.gainRatesForTask.def)} / sec`],
[`Dexterity Exp:`, `${numeralWrapper.formatExp(5 * props.sleeve.gainRatesForTask.dex)} / sec`],
[`Agility Exp:`, `${numeralWrapper.formatExp(5 * props.sleeve.gainRatesForTask.agi)} / sec`],
[`Charisma Exp:`, `${numeralWrapper.formatExp(5 * props.sleeve.gainRatesForTask.cha)} / sec`],
];
if (props.sleeve.currentTask === SleeveTaskType.Company || props.sleeve.currentTask === SleeveTaskType.Faction) {
const repGain: number = props.sleeve.getRepGain(player);
data.push([`Reputation:`, <ReputationRate reputation={5 * repGain} />]);
}
}
return (
<Table sx={{ display: 'table', mb: 1, width: '100%', lineHeight: 0 }}>
<TableBody>
<TableRow>
<TableCell classes={{ root: classes.cellNone }}>
<Typography variant='h6'>
Earnings
</Typography>
</TableCell>
</TableRow>
{data.map(([a, b]) => (
<TableRow key={a.toString() + b.toString()}>
<TableCell classes={{ root: classes.cellNone }}>
<Typography>{a}</Typography>
</TableCell>
<TableCell align="right" classes={{ root: classes.cellNone }}>
<Typography>{b}</Typography>
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
)
}
+5 -6
View File
@@ -9,6 +9,7 @@ import { Factions } from "../../../Faction/Factions";
import { FactionWorkType } from "../../../Faction/FactionWorkTypeEnum";
import Select, { SelectChangeEvent } from "@mui/material/Select";
import MenuItem from "@mui/material/MenuItem";
import { FactionNames } from "../../../Faction/data/FactionNames";
const universitySelectorOptions: string[] = [
"Study Computer Science",
@@ -55,7 +56,7 @@ function possibleJobs(player: IPlayer, sleeve: Sleeve): string[] {
function possibleFactions(player: IPlayer, sleeve: Sleeve): string[] {
// Array of all factions that other sleeves are working for
const forbiddenFactions = ["Bladeburners"];
const forbiddenFactions = [FactionNames.Bladeburners as string];
if (player.gang) {
forbiddenFactions.push(player.gang.facName);
}
@@ -278,7 +279,7 @@ export function TaskSelector(props: IProps): React.ReactElement {
return (
<>
<Select onChange={onS0Change} value={s0}>
<Select onChange={onS0Change} value={s0} sx={{ width: '100%' }}>
{validActions.map((task) => (
<MenuItem key={task} value={task}>
{task}
@@ -287,8 +288,7 @@ export function TaskSelector(props: IProps): React.ReactElement {
</Select>
{!(details.first.length === 1 && details.first[0] === "------") && (
<>
<br />
<Select onChange={onS1Change} value={s1}>
<Select onChange={onS1Change} value={s1} sx={{ width: '100%' }}>
{details.first.map((detail) => (
<MenuItem key={detail} value={detail}>
{detail}
@@ -299,8 +299,7 @@ export function TaskSelector(props: IProps): React.ReactElement {
)}
{!(details2.length === 1 && details2[0] === "------") && (
<>
<br />
<Select onChange={onS2Change} value={s2}>
<Select onChange={onS2Change} value={s2} sx={{ width: '100%' }}>
{details2.map((detail) => (
<MenuItem key={detail} value={detail}>
{detail}