mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-30 03:23:48 +01:00
added logic to rewward and invite to infiltrators on infil completion
This commit is contained in:
parent
0b171822df
commit
80edb744bf
@ -9,6 +9,7 @@ import Typography from "@mui/material/Typography";
|
|||||||
import Button from "@mui/material/Button";
|
import Button from "@mui/material/Button";
|
||||||
import MenuItem from "@mui/material/MenuItem";
|
import MenuItem from "@mui/material/MenuItem";
|
||||||
import Select, { SelectChangeEvent } from "@mui/material/Select";
|
import Select, { SelectChangeEvent } from "@mui/material/Select";
|
||||||
|
import { FactionNames } from "../../Faction/data/FactionNames";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
StartingDifficulty: number;
|
StartingDifficulty: number;
|
||||||
@ -23,6 +24,7 @@ export function Victory(props: IProps): React.ReactElement {
|
|||||||
const [faction, setFaction] = useState("none");
|
const [faction, setFaction] = useState("none");
|
||||||
|
|
||||||
function quitInfiltration(): void {
|
function quitInfiltration(): void {
|
||||||
|
handleInfiltrators();
|
||||||
router.toCity();
|
router.toCity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,6 +37,11 @@ export function Victory(props: IProps): React.ReactElement {
|
|||||||
levelBonus *
|
levelBonus *
|
||||||
BitNodeMultipliers.InfiltrationRep;
|
BitNodeMultipliers.InfiltrationRep;
|
||||||
|
|
||||||
|
// TODO: add two augmentations to infiltrators to increase this by 5 and * 2
|
||||||
|
const infiltratorsRepGain = 5;
|
||||||
|
const infiltratorFaction = Factions[FactionNames.Infiltrators];
|
||||||
|
const isMemberOfInfiltrators = infiltratorFaction && infiltratorFaction.isMember;
|
||||||
|
|
||||||
const moneyGain =
|
const moneyGain =
|
||||||
Math.pow(props.Reward + 1, 2) *
|
Math.pow(props.Reward + 1, 2) *
|
||||||
Math.pow(props.StartingDifficulty, 3) *
|
Math.pow(props.StartingDifficulty, 3) *
|
||||||
@ -43,11 +50,13 @@ export function Victory(props: IProps): React.ReactElement {
|
|||||||
BitNodeMultipliers.InfiltrationMoney;
|
BitNodeMultipliers.InfiltrationMoney;
|
||||||
|
|
||||||
function sell(): void {
|
function sell(): void {
|
||||||
|
handleInfiltrators();
|
||||||
player.gainMoney(moneyGain, "infiltration");
|
player.gainMoney(moneyGain, "infiltration");
|
||||||
quitInfiltration();
|
quitInfiltration();
|
||||||
}
|
}
|
||||||
|
|
||||||
function trade(): void {
|
function trade(): void {
|
||||||
|
handleInfiltrators();
|
||||||
if (faction === "none") return;
|
if (faction === "none") return;
|
||||||
Factions[faction].playerReputation += repGain;
|
Factions[faction].playerReputation += repGain;
|
||||||
quitInfiltration();
|
quitInfiltration();
|
||||||
@ -57,6 +66,13 @@ export function Victory(props: IProps): React.ReactElement {
|
|||||||
setFaction(event.target.value);
|
setFaction(event.target.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleInfiltrators(): void {
|
||||||
|
player.hasCompletedAnInfiltration = true;
|
||||||
|
if (isMemberOfInfiltrators) {
|
||||||
|
infiltratorFaction.playerReputation += infiltratorsRepGain;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Grid container spacing={3}>
|
<Grid container spacing={3}>
|
||||||
@ -65,7 +81,15 @@ export function Victory(props: IProps): React.ReactElement {
|
|||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={10}>
|
<Grid item xs={10}>
|
||||||
<Typography variant="h5" color="primary">
|
<Typography variant="h5" color="primary">
|
||||||
You can trade the confidential information you found for money or reputation.
|
You{" "}
|
||||||
|
{isMemberOfInfiltrators ? (
|
||||||
|
<>
|
||||||
|
have gained {infiltratorsRepGain} rep for {FactionNames.Infiltrators} and
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<></>
|
||||||
|
)}
|
||||||
|
can trade the confidential information you found for money or reputation.
|
||||||
</Typography>
|
</Typography>
|
||||||
<Select value={faction} onChange={changeDropdown}>
|
<Select value={faction} onChange={changeDropdown}>
|
||||||
<MenuItem key={"none"} value={"none"}>
|
<MenuItem key={"none"} value={"none"}>
|
||||||
|
@ -75,6 +75,7 @@ export interface IPlayer {
|
|||||||
terminalCommandHistory: string[];
|
terminalCommandHistory: string[];
|
||||||
lastUpdate: number;
|
lastUpdate: number;
|
||||||
totalPlaytime: number;
|
totalPlaytime: number;
|
||||||
|
hasCompletedAnInfiltration: boolean;
|
||||||
|
|
||||||
// Stats
|
// Stats
|
||||||
hacking: number;
|
hacking: number;
|
||||||
|
@ -84,6 +84,7 @@ export class PlayerObject implements IPlayer {
|
|||||||
lastUpdate: number;
|
lastUpdate: number;
|
||||||
lastSave: number;
|
lastSave: number;
|
||||||
totalPlaytime: number;
|
totalPlaytime: number;
|
||||||
|
hasCompletedAnInfiltration: boolean;
|
||||||
|
|
||||||
// Stats
|
// Stats
|
||||||
hacking: number;
|
hacking: number;
|
||||||
@ -466,6 +467,7 @@ export class PlayerObject implements IPlayer {
|
|||||||
this.lastUpdate = 0;
|
this.lastUpdate = 0;
|
||||||
this.lastSave = 0;
|
this.lastSave = 0;
|
||||||
this.totalPlaytime = 0;
|
this.totalPlaytime = 0;
|
||||||
|
this.hasCompletedAnInfiltration = true;
|
||||||
|
|
||||||
this.playtimeSinceLastAug = 0;
|
this.playtimeSinceLastAug = 0;
|
||||||
this.playtimeSinceLastBitnode = 0;
|
this.playtimeSinceLastBitnode = 0;
|
||||||
@ -483,11 +485,11 @@ export class PlayerObject implements IPlayer {
|
|||||||
// Let's get a hash of some semi-random stuff so we have something unique.
|
// Let's get a hash of some semi-random stuff so we have something unique.
|
||||||
this.identifier = cyrb53(
|
this.identifier = cyrb53(
|
||||||
"I-" +
|
"I-" +
|
||||||
new Date().getTime() +
|
new Date().getTime() +
|
||||||
navigator.userAgent +
|
navigator.userAgent +
|
||||||
window.innerWidth +
|
window.innerWidth +
|
||||||
window.innerHeight +
|
window.innerHeight +
|
||||||
getRandomInt(100, 999),
|
getRandomInt(100, 999),
|
||||||
);
|
);
|
||||||
|
|
||||||
this.init = generalMethods.init;
|
this.init = generalMethods.init;
|
||||||
|
@ -2086,6 +2086,12 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
|
|||||||
return allCompanies.includes(companyName) && getCompanyRep(companyName) > repNeeded;
|
return allCompanies.includes(companyName) && getCompanyRep(companyName) > repNeeded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Infiltrators
|
||||||
|
const InfiltratorsFac = Factions[FactionNames.Infiltrators];
|
||||||
|
if (this.hasCompletedAnInfiltration && !InfiltratorsFac.isMember && !InfiltratorsFac.alreadyInvited) {
|
||||||
|
invitedFactions.push(InfiltratorsFac);
|
||||||
|
}
|
||||||
|
|
||||||
//Illuminati
|
//Illuminati
|
||||||
const illuminatiFac = Factions[FactionNames.Illuminati];
|
const illuminatiFac = Factions[FactionNames.Illuminati];
|
||||||
if (
|
if (
|
||||||
|
@ -56,7 +56,7 @@ function possibleJobs(player: IPlayer, sleeve: Sleeve): string[] {
|
|||||||
|
|
||||||
function possibleFactions(player: IPlayer, sleeve: Sleeve): string[] {
|
function possibleFactions(player: IPlayer, sleeve: Sleeve): string[] {
|
||||||
// Array of all factions that other sleeves are working for
|
// Array of all factions that other sleeves are working for
|
||||||
const forbiddenFactions = [FactionNames.Bladeburners as string];
|
const forbiddenFactions = [FactionNames.Bladeburners as string, FactionNames.Infiltrators as string];
|
||||||
if (player.gang) {
|
if (player.gang) {
|
||||||
forbiddenFactions.push(player.gang.facName);
|
forbiddenFactions.push(player.gang.facName);
|
||||||
}
|
}
|
||||||
@ -76,9 +76,9 @@ function possibleFactions(player: IPlayer, sleeve: Sleeve): string[] {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return factions.filter(faction => {
|
return factions.filter((faction) => {
|
||||||
const facInfo = Factions[faction].getInfo();
|
const facInfo = Factions[faction].getInfo();
|
||||||
return facInfo.offerHackingWork || facInfo.offerFieldWork || facInfo.offerSecurityWork
|
return facInfo.offerHackingWork || facInfo.offerFieldWork || facInfo.offerSecurityWork;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,7 +279,7 @@ export function TaskSelector(props: IProps): React.ReactElement {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Select onChange={onS0Change} value={s0} sx={{ width: '100%' }}>
|
<Select onChange={onS0Change} value={s0} sx={{ width: "100%" }}>
|
||||||
{validActions.map((task) => (
|
{validActions.map((task) => (
|
||||||
<MenuItem key={task} value={task}>
|
<MenuItem key={task} value={task}>
|
||||||
{task}
|
{task}
|
||||||
@ -288,7 +288,7 @@ export function TaskSelector(props: IProps): React.ReactElement {
|
|||||||
</Select>
|
</Select>
|
||||||
{!(details.first.length === 1 && details.first[0] === "------") && (
|
{!(details.first.length === 1 && details.first[0] === "------") && (
|
||||||
<>
|
<>
|
||||||
<Select onChange={onS1Change} value={s1} sx={{ width: '100%' }}>
|
<Select onChange={onS1Change} value={s1} sx={{ width: "100%" }}>
|
||||||
{details.first.map((detail) => (
|
{details.first.map((detail) => (
|
||||||
<MenuItem key={detail} value={detail}>
|
<MenuItem key={detail} value={detail}>
|
||||||
{detail}
|
{detail}
|
||||||
@ -299,7 +299,7 @@ export function TaskSelector(props: IProps): React.ReactElement {
|
|||||||
)}
|
)}
|
||||||
{!(details2.length === 1 && details2[0] === "------") && (
|
{!(details2.length === 1 && details2[0] === "------") && (
|
||||||
<>
|
<>
|
||||||
<Select onChange={onS2Change} value={s2} sx={{ width: '100%' }}>
|
<Select onChange={onS2Change} value={s2} sx={{ width: "100%" }}>
|
||||||
{details2.map((detail) => (
|
{details2.map((detail) => (
|
||||||
<MenuItem key={detail} value={detail}>
|
<MenuItem key={detail} value={detail}>
|
||||||
{detail}
|
{detail}
|
||||||
|
Loading…
Reference in New Issue
Block a user