From ecc63eb07ef2b2e422cc4129cb397d965f6a9a37 Mon Sep 17 00:00:00 2001 From: Jesse Clark Date: Thu, 7 Dec 2023 17:53:28 -0800 Subject: [PATCH] FACTIONS: Fix for faction names staying scrambled after joining (#968) --- src/Faction/FactionHelpers.tsx | 6 +++++- src/Message/MessageHelpers.tsx | 2 +- test/jest/__snapshots__/FullSave.test.ts.snap | 6 +++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Faction/FactionHelpers.tsx b/src/Faction/FactionHelpers.tsx index 6436a6ecb..0c11cd018 100644 --- a/src/Faction/FactionHelpers.tsx +++ b/src/Faction/FactionHelpers.tsx @@ -3,7 +3,7 @@ import type { Faction } from "./Faction"; import { Augmentations } from "../Augmentation/Augmentations"; import { PlayerOwnedAugmentation } from "../Augmentation/PlayerOwnedAugmentation"; -import { AugmentationName } from "@enums"; +import { AugmentationName, FactionDiscovery } from "@enums"; import { currentNodeMults } from "../BitNode/BitNodeMultipliers"; import { Player } from "@player"; @@ -26,6 +26,7 @@ export function inviteToFaction(faction: Faction): void { if (faction.alreadyInvited || faction.isMember) return; Player.receiveInvite(faction.name); faction.alreadyInvited = true; + faction.discovery = FactionDiscovery.known; if (!Settings.SuppressFactionInvites) { InvitationEvent.emit(faction); } @@ -34,6 +35,9 @@ export function inviteToFaction(faction: Faction): void { export function joinFaction(faction: Faction): void { if (faction.isMember) return; faction.isMember = true; + faction.alreadyInvited = true; + faction.discovery = FactionDiscovery.known; + // Add this faction to player's faction list, keeping it in standard order Player.factions = getRecordKeys(Factions).filter((facName) => Factions[facName].isMember); diff --git a/src/Message/MessageHelpers.tsx b/src/Message/MessageHelpers.tsx index 077b03337..895fc36c8 100644 --- a/src/Message/MessageHelpers.tsx +++ b/src/Message/MessageHelpers.tsx @@ -124,7 +124,7 @@ const Messages: Record = { MessageFilename.Jumper2, "Do not try to save the world. There is no world to save. If " + "you want to find the truth, worry only about yourself. Ethics and " + - `morals will get you killed. \n\nWatch out for a hacking group known as ${FactionName.NiteSec}.` + + `morals will get you killed. \n\nKeep an eye out for a hacking group known as ${FactionName.NiteSec}.` + "\n\n-jump3R", FactionName.NiteSec, ), diff --git a/test/jest/__snapshots__/FullSave.test.ts.snap b/test/jest/__snapshots__/FullSave.test.ts.snap index 1e06c2046..1f366f984 100644 --- a/test/jest/__snapshots__/FullSave.test.ts.snap +++ b/test/jest/__snapshots__/FullSave.test.ts.snap @@ -308,7 +308,7 @@ exports[`Check Save File Continuity FactionsSave continuity 1`] = ` "Bladeburners": { "ctor": "Faction", "data": { - "discovery": "unknown", + "discovery": "known", "favor": 0, "playerReputation": 4000, }, @@ -340,7 +340,7 @@ exports[`Check Save File Continuity FactionsSave continuity 1`] = ` "CyberSec": { "ctor": "Faction", "data": { - "discovery": "unknown", + "discovery": "known", "favor": 20, "playerReputation": 1000000, }, @@ -476,7 +476,7 @@ exports[`Check Save File Continuity FactionsSave continuity 1`] = ` "Slum Snakes": { "ctor": "Faction", "data": { - "discovery": "unknown", + "discovery": "known", "favor": 0, "playerReputation": 0, },