mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-24 10:12:53 +02:00
ENUMS: Initial Enum Helper rework + Reorganization (#596)
This commit is contained in:
@@ -10,6 +10,7 @@ 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.
|
||||
*/
|
||||
|
||||
// Exploits don't need an enum helper so they are not in an enums file
|
||||
export enum Exploit {
|
||||
Bypass = "Bypass",
|
||||
PrototypeTampering = "PrototypeTampering",
|
||||
@@ -27,7 +28,7 @@ export enum Exploit {
|
||||
EditSaveFile = "EditSaveFile",
|
||||
}
|
||||
|
||||
const names: Record<string, string> = {
|
||||
const names: Record<Exploit, string> = {
|
||||
Bypass: "by circumventing the ram cost of document.",
|
||||
EditSaveFile: "by editing your save file.",
|
||||
PrototypeTampering: "by tampering with Numbers prototype.",
|
||||
@@ -41,11 +42,12 @@ const names: Record<string, string> = {
|
||||
INeedARainbow: "by using the power of the rainbow.",
|
||||
};
|
||||
|
||||
export function ExploitName(exploit: string): string {
|
||||
export function ExploitName(exploit: Exploit): string {
|
||||
return names[exploit];
|
||||
}
|
||||
|
||||
// Needed in case player edits save file poorly
|
||||
export function sanitizeExploits(exploits: Exploit[]): Exploit[] {
|
||||
exploits = exploits.filter((e: Exploit) => Object.keys(Exploit).includes(e));
|
||||
exploits = exploits.filter((e: Exploit) => Object.values(Exploit).includes(e));
|
||||
return [...new Set(exploits)];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user