From 699ae2e967dcde30848ec90e1b5cab7e1764597d Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Sun, 20 Mar 2022 23:27:53 -0400 Subject: [PATCH] with SLEEVE_8, fix workForFaction --- src/Achievements/Achievements.ts | 6 +- src/NetscriptFunctions/Singularity.ts | 88 ++------------------------- src/ui/React/AlertManager.tsx | 3 +- 3 files changed, 9 insertions(+), 88 deletions(-) diff --git a/src/Achievements/Achievements.ts b/src/Achievements/Achievements.ts index 66057f147..7059f2ec3 100644 --- a/src/Achievements/Achievements.ts +++ b/src/Achievements/Achievements.ts @@ -58,7 +58,9 @@ function bitNodeFinishedState(): boolean { const wd = GetServer(SpecialServers.WorldDaemon); if (!(wd instanceof Server)) return false; if (wd.backdoorInstalled) return true; - return Player.bladeburner !== null && Player.bladeburner.blackops.hasOwnProperty(BlackOperationNames.OperationDaedalus); + return ( + Player.bladeburner !== null && Player.bladeburner.blackops.hasOwnProperty(BlackOperationNames.OperationDaedalus) + ); } function hasAccessToSF(player: PlayerObject, bn: number): boolean { @@ -564,7 +566,7 @@ export const achievements: IMap = { ...achievementData["SLEEVE_8"], Icon: "SLEEVE8", Visible: () => hasAccessToSF(Player, 10), - Condition: () => Player.sleeves.length === 8, + Condition: () => Player.sleeves.length === 8 && Player.sourceFileLvl(10) === 3, }, INDECISIVE: { ...achievementData["INDECISIVE"], diff --git a/src/NetscriptFunctions/Singularity.ts b/src/NetscriptFunctions/Singularity.ts index af2e4a001..4ab802921 100644 --- a/src/NetscriptFunctions/Singularity.ts +++ b/src/NetscriptFunctions/Singularity.ts @@ -43,6 +43,7 @@ import { calculateHackingTime } from "../Hacking"; import { Server } from "../Server/Server"; import { netscriptCanHack } from "../Hacking/netscriptCanHack"; import { FactionNames } from "../Faction/data/FactionNames"; +import { FactionInfos } from "../Faction/FactionInfo"; export function NetscriptSingularity( player: IPlayer, @@ -1038,93 +1039,12 @@ export function NetscriptSingularity( const fac = Factions[name]; // Arrays listing factions that allow each time of work - const hackAvailable = [ - FactionNames.Illuminati as string, - FactionNames.Daedalus as string, - FactionNames.TheCovenant as string, - FactionNames.ECorp as string, - FactionNames.MegaCorp as string, - FactionNames.BachmanAssociates as string, - FactionNames.Bladeburners as string, - FactionNames.NWO as string, - FactionNames.ClarkeIncorporated as string, - FactionNames.OmniTekIncorporated as string, - FactionNames.FourSigma as string, - FactionNames.KuaiGongInternational as string, - FactionNames.FulcrumSecretTechnologies as string, - FactionNames.BitRunners as string, - FactionNames.TheBlackHand as string, - FactionNames.NiteSec as string, - FactionNames.Chongqing as string, - FactionNames.Sector12 as string, - FactionNames.NewTokyo as string, - FactionNames.Aevum as string, - FactionNames.Ishima as string, - FactionNames.Volhaven as string, - FactionNames.SpeakersForTheDead as string, - FactionNames.TheDarkArmy as string, - FactionNames.TheSyndicate as string, - FactionNames.Silhouette as string, - FactionNames.Netburners as string, - FactionNames.TianDiHui as string, - FactionNames.CyberSec as string, - ]; - const fdWkAvailable = [ - FactionNames.Illuminati as string, - FactionNames.Daedalus as string, - FactionNames.TheCovenant as string, - FactionNames.ECorp as string, - FactionNames.MegaCorp as string, - FactionNames.BachmanAssociates as string, - FactionNames.Bladeburners as string, - FactionNames.NWO as string, - FactionNames.ClarkeIncorporated as string, - FactionNames.OmniTekIncorporated as string, - FactionNames.FourSigma as string, - FactionNames.KuaiGongInternational as string, - FactionNames.TheBlackHand as string, - FactionNames.Chongqing as string, - FactionNames.Sector12 as string, - FactionNames.NewTokyo as string, - FactionNames.Aevum as string, - FactionNames.Ishima as string, - FactionNames.Volhaven as string, - FactionNames.SpeakersForTheDead as string, - FactionNames.TheDarkArmy as string, - FactionNames.TheSyndicate as string, - FactionNames.Silhouette as string, - FactionNames.Tetrads as string, - FactionNames.SlumSnakes as string, - ]; - const scWkAvailable = [ - FactionNames.ECorp as string, - FactionNames.MegaCorp as string, - FactionNames.BachmanAssociates as string, - FactionNames.Bladeburners as string, - FactionNames.NWO as string, - FactionNames.ClarkeIncorporated as string, - FactionNames.OmniTekIncorporated as string, - FactionNames.FourSigma as string, - FactionNames.KuaiGongInternational as string, - FactionNames.FulcrumSecretTechnologies as string, - FactionNames.Chongqing as string, - FactionNames.Sector12 as string, - FactionNames.NewTokyo as string, - FactionNames.Aevum as string, - FactionNames.Ishima as string, - FactionNames.Volhaven as string, - FactionNames.SpeakersForTheDead as string, - FactionNames.TheSyndicate as string, - FactionNames.Tetrads as string, - FactionNames.SlumSnakes as string, - FactionNames.TianDiHui as string, - ]; switch (type.toLowerCase()) { case "hacking": case "hacking contracts": case "hackingcontracts": - if (!hackAvailable.includes(fac.name)) { + if (!FactionInfos[fac.name].offerHackingWork) { workerScript.log("workForFaction", () => `Faction '${fac.name}' do not need help with hacking contracts.`); return false; } @@ -1141,7 +1061,7 @@ export function NetscriptSingularity( case "field": case "fieldwork": case "field work": - if (!fdWkAvailable.includes(fac.name)) { + if (!FactionInfos[fac.name].offerFieldWork) { workerScript.log("workForFaction", () => `Faction '${fac.name}' do not need help with field missions.`); return false; } @@ -1158,7 +1078,7 @@ export function NetscriptSingularity( case "security": case "securitywork": case "security work": - if (!scWkAvailable.includes(fac.name)) { + if (!FactionInfos[fac.name].offerSecurityWork) { workerScript.log("workForFaction", () => `Faction '${fac.name}' do not need help with security work.`); return false; } diff --git a/src/ui/React/AlertManager.tsx b/src/ui/React/AlertManager.tsx index dd5d28c32..5ee31528d 100644 --- a/src/ui/React/AlertManager.tsx +++ b/src/ui/React/AlertManager.tsx @@ -66,8 +66,7 @@ export function AlertManager(): React.ReactElement { {alerts.length > 0 && ( - {typeof alerts[0].text === "string" && {alerts[0].text}} - {typeof alerts[0].text !== "string" && alerts[0].text} + {alerts[0].text} )}