From 673efb427f12e36bbe1c662bf75fbafba5dcb257 Mon Sep 17 00:00:00 2001 From: missymae#2783 <141260118+myCatsName@users.noreply.github.com> Date: Mon, 2 Oct 2023 21:28:16 -0600 Subject: [PATCH] UI: Fix some DevMenu react errors, add number of exploits to savegame comparison (#825) --- src/DevMenu/ui/BladeburnerDev.tsx | 17 +++++++---------- src/Exploits/Exploit.ts | 23 ++++++++++++----------- src/NetscriptFunctions/Singularity.ts | 4 +--- src/PersonObjects/Player/PlayerObject.ts | 2 +- src/SaveObject.ts | 2 ++ src/SourceFile/SourceFiles.tsx | 12 +++++++++--- src/ui/React/ImportSave/ImportSave.tsx | 24 ++++++++++++++++++++++-- 7 files changed, 54 insertions(+), 30 deletions(-) diff --git a/src/DevMenu/ui/BladeburnerDev.tsx b/src/DevMenu/ui/BladeburnerDev.tsx index 8c0eb64cc..94f6ea8de 100644 --- a/src/DevMenu/ui/BladeburnerDev.tsx +++ b/src/DevMenu/ui/BladeburnerDev.tsx @@ -217,16 +217,13 @@ export function BladeburnerDev({ bladeburner }: { bladeburner: Bladeburner }): R reset={wipeAllChaos} /> - - - - - + + + + + + + diff --git a/src/Exploits/Exploit.ts b/src/Exploits/Exploit.ts index 27c259099..b62ff044d 100644 --- a/src/Exploits/Exploit.ts +++ b/src/Exploits/Exploit.ts @@ -1,13 +1,13 @@ /* -The game cannot block every possible exploits. Specially since one of them is -that you can just edit your save file and that's impractical to prevent. +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. -So instead we have source file minus 1. It is not obtained by destroying a -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 -trying to implement anti-cheat measures and [two] finding ways to break a -hacking game is very much in the spirit of the game. -Source-File minus 1 is extremely weak because it can be fully level up quickly. +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 +the game. This serves 2 purposes - [1] the developers don't have to spend time +trying to implement anti-cheat measures and [2] finding ways to break a +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 levelled up quickly. */ // Exploits don't need an enum helper so they are not in an enums file @@ -22,9 +22,10 @@ export enum Exploit { YoureNotMeantToAccessThis = "YoureNotMeantToAccessThis", TrueRecursion = "TrueRecursion", INeedARainbow = "INeedARainbow", - // To the players reading this. Yes you're supposed to add EditSaveFile by - // editing your save file, yes you could add them all, no we don't care - // that's not the point. + // To the players reading this: + // Yes, you're supposed to gain the EditSaveFile exploit by editing your real save file. + // 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", } diff --git a/src/NetscriptFunctions/Singularity.ts b/src/NetscriptFunctions/Singularity.ts index d52bf8dc3..a0d1aa523 100644 --- a/src/NetscriptFunctions/Singularity.ts +++ b/src/NetscriptFunctions/Singularity.ts @@ -92,9 +92,7 @@ export function NetscriptSingularity(): InternalAPI { } return res; }, - getOwnedSourceFiles: () => () => { - return [...Player.sourceFiles].map(([n, lvl]) => ({ n, lvl })); - }, + getOwnedSourceFiles: () => () => [...Player.sourceFiles].map(([n, lvl]) => ({ n, lvl })), getAugmentationFactions: (ctx) => (_augName) => { helpers.checkSingularityAccess(ctx); const augName = getEnumHelper("AugmentationName").nsGetMember(ctx, _augName); diff --git a/src/PersonObjects/Player/PlayerObject.ts b/src/PersonObjects/Player/PlayerObject.ts index c662e1348..52ceb31ea 100644 --- a/src/PersonObjects/Player/PlayerObject.ts +++ b/src/PersonObjects/Player/PlayerObject.ts @@ -178,7 +178,7 @@ export class PlayerObject extends Person implements IPlayer { isMember("AugmentationName", ownedAug.name), ); 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. if (Array.isArray(player.sourceFiles)) { // Expect pre-2.3 sourcefile format here. diff --git a/src/SaveObject.ts b/src/SaveObject.ts index 2ba63f345..288621fbb 100644 --- a/src/SaveObject.ts +++ b/src/SaveObject.ts @@ -70,6 +70,7 @@ export interface ImportPlayerData { bitNode: number; bitNodeLevel: number; sourceFiles: number; + exploits: number; } class BitburnerSaveObject { @@ -232,6 +233,7 @@ class BitburnerSaveObject { bitNode: importedPlayer.bitNodeN, bitNodeLevel: importedPlayer.sourceFileLvl(Player.bitNodeN) + 1, sourceFiles: [...importedPlayer.sourceFiles].reduce((total, [__bn, lvl]) => (total += lvl), 0), + exploits: importedPlayer.exploits.length, }; data.playerData = playerData; diff --git a/src/SourceFile/SourceFiles.tsx b/src/SourceFile/SourceFiles.tsx index 9dec74bf4..a58e95101 100644 --- a/src/SourceFile/SourceFiles.tsx +++ b/src/SourceFile/SourceFiles.tsx @@ -80,11 +80,17 @@ export function initSourceFiles() {
It will also raise all of your hacking-related multipliers by: diff --git a/src/ui/React/ImportSave/ImportSave.tsx b/src/ui/React/ImportSave/ImportSave.tsx index 028e6b971..b71e0cef8 100644 --- a/src/ui/React/ImportSave/ImportSave.tsx +++ b/src/ui/React/ImportSave/ImportSave.tsx @@ -301,7 +301,9 @@ export const ImportSave = (props: { importString: string; automatic: boolean }): - Source Files + + Source File Levels + {currentData.playerData?.sourceFiles} {importData.playerData?.sourceFiles} @@ -314,7 +316,24 @@ export const ImportSave = (props: { importString: string; automatic: boolean }): - BitNode + + Exploits + + {currentData.playerData?.exploits} + {importData.playerData?.exploits} + + {importData.playerData?.exploits !== currentData.playerData?.exploits && ( + (currentData.playerData?.exploits ?? 0)} + /> + )} + + + + + + BitNode + {currentData.playerData?.bitNode}-{currentData.playerData?.bitNodeLevel} @@ -346,6 +365,7 @@ export const ImportSave = (props: { importString: string; automatic: boolean }):
} + additionalButton={} />