UI: Fix some DevMenu react errors, add number of exploits to savegame comparison (#825)

This commit is contained in:
missymae#2783 2023-10-02 21:28:16 -06:00 committed by GitHub
parent 7b00fcc5b1
commit 673efb427f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 54 additions and 30 deletions

@ -217,16 +217,13 @@ export function BladeburnerDev({ bladeburner }: { bladeburner: Bladeburner }): R
reset={wipeAllChaos} reset={wipeAllChaos}
/> />
</td> </td>
<td>
<Tooltip title="Wipe Active City Chaos"> <Tooltip title="Wipe Active City Chaos">
<IconButton <IconButton onClick={wipeActiveCityChaos} size="large" aria-label="clear-active-city-chaos">
onClick={wipeActiveCityChaos}
size="large"
arial-label="clear-active-city-chaos"
title="Clear Only Active City Chaos"
>
<DeleteIcon sx={{ fontSize: 40 }} /> <DeleteIcon sx={{ fontSize: 40 }} />
</IconButton> </IconButton>
</Tooltip> </Tooltip>
</td>
</tr> </tr>
<tr> <tr>
<td> <td>

@ -1,13 +1,13 @@
/* /*
The game cannot block every possible exploits. Specially since one of them is The game cannot block every possible exploit. Especially since one of them is
that you can just edit your save file and that's impractical to prevent. that you can just edit your save file, and that's impractical to prevent.
So instead we have source file minus 1. It is not obtained by destroying a So instead, we have "Source-File -1" ("negative one"). It is not obtained by destroying a
BitNode but instead it is awarded when the player finds innovative ways to break BitNode, but instead it is awarded when the player finds innovative ways to break
the game, this serves 2 purpose, [one] the developers don't have to spend time the game. This serves 2 purposes - [1] the developers don't have to spend time
trying to implement anti-cheat measures and [two] finding ways to break a trying to implement anti-cheat measures and [2] finding ways to break a
hacking game is very much in the spirit of the game. hacking game is very much a learning experience in the spirit of the game.
Source-File minus 1 is extremely weak because it can be fully level up quickly. Source-File minus 1 is extremely weak because it can be fully levelled up quickly.
*/ */
// Exploits don't need an enum helper so they are not in an enums file // Exploits don't need an enum helper so they are not in an enums file
@ -22,9 +22,10 @@ export enum Exploit {
YoureNotMeantToAccessThis = "YoureNotMeantToAccessThis", YoureNotMeantToAccessThis = "YoureNotMeantToAccessThis",
TrueRecursion = "TrueRecursion", TrueRecursion = "TrueRecursion",
INeedARainbow = "INeedARainbow", INeedARainbow = "INeedARainbow",
// To the players reading this. Yes you're supposed to add EditSaveFile by // To the players reading this:
// editing your save file, yes you could add them all, no we don't care // Yes, you're supposed to gain the EditSaveFile exploit by editing your real save file.
// that's not the point. // TBH, you could gain them all the same way, but that is not our challenge to you.
// You are the captain of your own ship.
EditSaveFile = "EditSaveFile", EditSaveFile = "EditSaveFile",
} }

@ -92,9 +92,7 @@ export function NetscriptSingularity(): InternalAPI<ISingularity> {
} }
return res; return res;
}, },
getOwnedSourceFiles: () => () => { getOwnedSourceFiles: () => () => [...Player.sourceFiles].map(([n, lvl]) => ({ n, lvl })),
return [...Player.sourceFiles].map(([n, lvl]) => ({ n, lvl }));
},
getAugmentationFactions: (ctx) => (_augName) => { getAugmentationFactions: (ctx) => (_augName) => {
helpers.checkSingularityAccess(ctx); helpers.checkSingularityAccess(ctx);
const augName = getEnumHelper("AugmentationName").nsGetMember(ctx, _augName); const augName = getEnumHelper("AugmentationName").nsGetMember(ctx, _augName);

@ -178,7 +178,7 @@ export class PlayerObject extends Person implements IPlayer {
isMember("AugmentationName", ownedAug.name), isMember("AugmentationName", ownedAug.name),
); );
player.updateSkillLevels(); player.updateSkillLevels();
// Converstion code for Player.sourceFiles is here instead of normal save conversion area because it needs // Conversion code for Player.sourceFiles is here instead of normal save conversion area because it needs
// to happen earlier for use in the savegame comparison tool. // to happen earlier for use in the savegame comparison tool.
if (Array.isArray(player.sourceFiles)) { if (Array.isArray(player.sourceFiles)) {
// Expect pre-2.3 sourcefile format here. // Expect pre-2.3 sourcefile format here.

@ -70,6 +70,7 @@ export interface ImportPlayerData {
bitNode: number; bitNode: number;
bitNodeLevel: number; bitNodeLevel: number;
sourceFiles: number; sourceFiles: number;
exploits: number;
} }
class BitburnerSaveObject { class BitburnerSaveObject {
@ -232,6 +233,7 @@ class BitburnerSaveObject {
bitNode: importedPlayer.bitNodeN, bitNode: importedPlayer.bitNodeN,
bitNodeLevel: importedPlayer.sourceFileLvl(Player.bitNodeN) + 1, bitNodeLevel: importedPlayer.sourceFileLvl(Player.bitNodeN) + 1,
sourceFiles: [...importedPlayer.sourceFiles].reduce<number>((total, [__bn, lvl]) => (total += lvl), 0), sourceFiles: [...importedPlayer.sourceFiles].reduce<number>((total, [__bn, lvl]) => (total += lvl), 0),
exploits: importedPlayer.exploits.length,
}; };
data.playerData = playerData; data.playerData = playerData;

@ -80,11 +80,17 @@ export function initSourceFiles() {
<br /> <br />
<ul> <ul>
<li> <li>
<span>
The <code>getBitNodeMultipliers()</code> Netscript function The <code>getBitNodeMultipliers()</code> Netscript function
</span>
</li> </li>
<li>Permanent access to Formulas.exe</li>
<li> <li>
<span>Permanent access to Formulas.exe</span>
</li>
<li>
<span>
Access to BitNode multiplier information on the <b>Stats</b> page Access to BitNode multiplier information on the <b>Stats</b> page
</span>
</li> </li>
</ul> </ul>
It will also raise all of your hacking-related multipliers by: It will also raise all of your hacking-related multipliers by:

@ -301,7 +301,9 @@ export const ImportSave = (props: { importString: string; automatic: boolean }):
</TableRow> </TableRow>
<TableRow> <TableRow>
<TableCell>Source Files</TableCell> <Tooltip title="The total SF levels owned, except for SF-1 Exploit levels.">
<TableCell>Source File Levels</TableCell>
</Tooltip>
<TableCell>{currentData.playerData?.sourceFiles}</TableCell> <TableCell>{currentData.playerData?.sourceFiles}</TableCell>
<TableCell>{importData.playerData?.sourceFiles}</TableCell> <TableCell>{importData.playerData?.sourceFiles}</TableCell>
<TableCell> <TableCell>
@ -314,7 +316,24 @@ export const ImportSave = (props: { importString: string; automatic: boolean }):
</TableRow> </TableRow>
<TableRow> <TableRow>
<Tooltip title="Number of exploits owned.">
<TableCell>Exploits</TableCell>
</Tooltip>
<TableCell>{currentData.playerData?.exploits}</TableCell>
<TableCell>{importData.playerData?.exploits}</TableCell>
<TableCell>
{importData.playerData?.exploits !== currentData.playerData?.exploits && (
<ComparisonIcon
isBetter={(importData.playerData?.exploits ?? 0) > (currentData.playerData?.exploits ?? 0)}
/>
)}
</TableCell>
</TableRow>
<TableRow>
<Tooltip title="The player's current BitNode.">
<TableCell>BitNode</TableCell> <TableCell>BitNode</TableCell>
</Tooltip>
<TableCell> <TableCell>
{currentData.playerData?.bitNode}-{currentData.playerData?.bitNodeLevel} {currentData.playerData?.bitNode}-{currentData.playerData?.bitNodeLevel}
</TableCell> </TableCell>
@ -346,6 +365,7 @@ export const ImportSave = (props: { importString: string; automatic: boolean }):
<br /> <br />
</> </>
} }
additionalButton={<Button onClick={closeImportModal}>Cancel</Button>}
/> />
</Box> </Box>
</Box> </Box>