2022-03-30 20:59:53 +02:00
|
|
|
import { FactionNames } from "./Faction/data/FactionNames";
|
2022-12-30 02:28:53 +01:00
|
|
|
import { CityName } from "./Enums";
|
2022-04-14 19:19:51 +02:00
|
|
|
import { StaticAugmentations } from "./Augmentation/StaticAugmentations";
|
2021-09-09 05:47:34 +02:00
|
|
|
import { augmentationExists, initAugmentations } from "./Augmentation/AugmentationHelpers";
|
2019-04-11 10:37:40 +02:00
|
|
|
import { AugmentationNames } from "./Augmentation/data/AugmentationNames";
|
|
|
|
import { initBitNodeMultipliers } from "./BitNode/BitNode";
|
|
|
|
import { Companies, initCompanies } from "./Company/Companies";
|
|
|
|
import { resetIndustryResearchTrees } from "./Corporation/IndustryData";
|
|
|
|
import { Programs } from "./Programs/Programs";
|
|
|
|
import { Factions, initFactions } from "./Faction/Factions";
|
|
|
|
import { joinFaction } from "./Faction/FactionHelpers";
|
2019-05-05 06:03:40 +02:00
|
|
|
import { updateHashManagerCapacity } from "./Hacknet/HacknetHelpers";
|
|
|
|
import { prestigeWorkerScripts } from "./NetscriptWorker";
|
2022-10-10 00:42:14 +02:00
|
|
|
import { Player } from "@player";
|
2022-05-22 02:24:17 +02:00
|
|
|
import { recentScripts } from "./Netscript/RecentScripts";
|
2021-03-07 19:08:12 +01:00
|
|
|
import { resetPidCounter } from "./Netscript/Pid";
|
2021-09-05 01:09:30 +02:00
|
|
|
import { LiteratureNames } from "./Literature/data/LiteratureNames";
|
2018-03-12 20:39:04 +01:00
|
|
|
|
2021-10-07 22:56:01 +02:00
|
|
|
import { GetServer, AddToAllServers, initForeignServers, prestigeAllServers } from "./Server/AllServers";
|
2019-04-11 10:37:40 +02:00
|
|
|
import { prestigeHomeComputer } from "./Server/ServerHelpers";
|
2021-10-07 23:55:49 +02:00
|
|
|
import { SpecialServers } from "./Server/data/SpecialServers";
|
2022-10-20 06:38:19 +02:00
|
|
|
import { deleteStockMarket, initStockMarket } from "./StockMarket/StockMarket";
|
2021-09-16 08:52:45 +02:00
|
|
|
import { Terminal } from "./Terminal";
|
2019-02-09 03:46:30 +01:00
|
|
|
|
2021-09-25 20:42:57 +02:00
|
|
|
import { dialogBoxCreate } from "./ui/React/DialogBox";
|
2017-02-20 23:06:16 +01:00
|
|
|
|
2021-10-17 03:38:03 +02:00
|
|
|
import { staneksGift } from "./CotMG/Helper";
|
2021-10-23 21:22:58 +02:00
|
|
|
import { ProgramsSeen } from "./Programs/ui/ProgramsRoot";
|
|
|
|
import { InvitationsSeen } from "./Faction/ui/FactionsRoot";
|
2021-11-14 04:44:17 +01:00
|
|
|
import { CONSTANTS } from "./Constants";
|
2021-11-27 00:47:12 +01:00
|
|
|
import { LogBoxClearEvents } from "./ui/React/LogBoxManager";
|
2019-04-11 10:37:40 +02:00
|
|
|
|
|
|
|
const BitNode8StartingMoney = 250e6;
|
2018-06-03 03:37:56 +02:00
|
|
|
|
2019-04-13 03:22:46 +02:00
|
|
|
// Prestige by purchasing augmentation
|
2021-10-23 16:08:06 +02:00
|
|
|
export function prestigeAugmentation(): void {
|
2022-09-06 15:07:12 +02:00
|
|
|
initBitNodeMultipliers();
|
2021-09-05 01:09:30 +02:00
|
|
|
|
2021-11-30 09:02:04 +01:00
|
|
|
const maintainMembership = Player.factions.concat(Player.factionInvitations).filter(function (faction) {
|
2021-09-22 09:09:37 +02:00
|
|
|
return Factions[faction].getInfo().keep;
|
2021-09-13 21:39:25 +02:00
|
|
|
});
|
2021-09-05 01:09:30 +02:00
|
|
|
Player.prestigeAugmentation();
|
|
|
|
|
|
|
|
// Delete all Worker Scripts objects
|
|
|
|
prestigeWorkerScripts();
|
|
|
|
|
2021-09-24 23:07:53 +02:00
|
|
|
const homeComp = Player.getHomeComputer();
|
2021-09-05 01:09:30 +02:00
|
|
|
// Delete all servers except home computer
|
|
|
|
prestigeAllServers();
|
|
|
|
|
|
|
|
// Reset home computer (only the programs) and add to AllServers
|
|
|
|
AddToAllServers(homeComp);
|
2022-09-18 03:09:15 +02:00
|
|
|
prestigeHomeComputer(homeComp);
|
2021-09-05 01:09:30 +02:00
|
|
|
|
2022-09-14 20:02:12 +02:00
|
|
|
if (augmentationExists(AugmentationNames.Neurolink) && Player.hasAugmentation(AugmentationNames.Neurolink, true)) {
|
2021-09-05 01:09:30 +02:00
|
|
|
homeComp.programs.push(Programs.FTPCrackProgram.name);
|
|
|
|
homeComp.programs.push(Programs.RelaySMTPProgram.name);
|
|
|
|
}
|
2022-09-14 20:02:12 +02:00
|
|
|
if (augmentationExists(AugmentationNames.CashRoot) && Player.hasAugmentation(AugmentationNames.CashRoot, true)) {
|
2021-09-05 01:09:30 +02:00
|
|
|
Player.setMoney(1e6);
|
|
|
|
homeComp.programs.push(Programs.BruteSSHProgram.name);
|
|
|
|
}
|
2022-09-14 20:02:12 +02:00
|
|
|
if (augmentationExists(AugmentationNames.PCMatrix) && Player.hasAugmentation(AugmentationNames.PCMatrix, true)) {
|
2021-09-05 01:09:30 +02:00
|
|
|
homeComp.programs.push(Programs.DeepscanV1.name);
|
|
|
|
homeComp.programs.push(Programs.AutoLink.name);
|
|
|
|
}
|
|
|
|
|
2021-11-12 21:48:30 +01:00
|
|
|
if (Player.sourceFileLvl(5) > 0 || Player.bitNodeN === 5) {
|
2021-10-28 05:41:47 +02:00
|
|
|
homeComp.programs.push(Programs.Formulas.name);
|
|
|
|
}
|
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
// Re-create foreign servers
|
|
|
|
initForeignServers(Player.getHomeComputer());
|
|
|
|
|
|
|
|
// Gain favor for Companies
|
2022-01-16 01:45:03 +01:00
|
|
|
for (const member of Object.keys(Companies)) {
|
2021-09-05 01:09:30 +02:00
|
|
|
if (Companies.hasOwnProperty(member)) {
|
|
|
|
Companies[member].gainFavor();
|
2017-05-18 22:00:37 +02:00
|
|
|
}
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2017-07-27 04:56:14 +02:00
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
// Gain favor for factions
|
2022-01-16 01:45:03 +01:00
|
|
|
for (const member of Object.keys(Factions)) {
|
2021-09-05 01:09:30 +02:00
|
|
|
if (Factions.hasOwnProperty(member)) {
|
|
|
|
Factions[member].gainFavor();
|
2017-02-20 23:06:16 +01:00
|
|
|
}
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
|
|
|
|
2021-11-27 00:47:12 +01:00
|
|
|
// Stop a Terminal action if there is one.
|
2021-09-25 00:29:25 +02:00
|
|
|
if (Terminal.action !== null) {
|
2022-09-06 15:07:12 +02:00
|
|
|
Terminal.finishAction(true);
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2021-10-07 22:56:01 +02:00
|
|
|
Terminal.clear();
|
2021-11-27 00:47:12 +01:00
|
|
|
LogBoxClearEvents.emit();
|
2021-09-05 01:09:30 +02:00
|
|
|
|
|
|
|
// Re-initialize things - This will update any changes
|
|
|
|
initFactions(); // Factions must be initialized before augmentations
|
2021-09-17 03:19:53 +02:00
|
|
|
|
2021-11-27 17:44:48 +01:00
|
|
|
Player.factionInvitations = Player.factionInvitations.concat(maintainMembership);
|
2021-09-05 01:09:30 +02:00
|
|
|
initAugmentations(); // Calls reapplyAllAugmentations() and resets Player multipliers
|
|
|
|
Player.reapplyAllSourceFiles();
|
2023-01-02 16:35:52 +01:00
|
|
|
Player.hp.current = Player.hp.max;
|
2021-09-05 01:09:30 +02:00
|
|
|
initCompanies();
|
|
|
|
|
2022-03-19 19:15:31 +01:00
|
|
|
// Apply entropy from grafting
|
2022-03-29 20:09:17 +02:00
|
|
|
Player.applyEntropy(Player.entropy);
|
2022-03-19 19:15:31 +01:00
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
// Gang
|
2021-09-24 23:07:53 +02:00
|
|
|
const gang = Player.gang;
|
2022-09-27 21:14:34 +02:00
|
|
|
if (gang) {
|
2021-09-24 23:07:53 +02:00
|
|
|
const faction = Factions[gang.facName];
|
2022-09-27 21:14:34 +02:00
|
|
|
if (faction) joinFaction(faction);
|
2022-01-18 20:02:12 +01:00
|
|
|
const penalty = 0.95;
|
|
|
|
for (const m of gang.members) {
|
|
|
|
m.hack_asc_points *= penalty;
|
|
|
|
m.str_asc_points *= penalty;
|
|
|
|
m.def_asc_points *= penalty;
|
|
|
|
m.dex_asc_points *= penalty;
|
|
|
|
m.agi_asc_points *= penalty;
|
|
|
|
m.cha_asc_points *= penalty;
|
|
|
|
}
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
|
|
|
|
2022-01-09 05:01:08 +01:00
|
|
|
// BitNode 3: Corporatocracy
|
|
|
|
if (Player.bitNodeN === 3) {
|
|
|
|
homeComp.messages.push(LiteratureNames.CorporationManagementHandbook);
|
|
|
|
}
|
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
// Cancel Bladeburner action
|
2022-09-27 21:14:34 +02:00
|
|
|
if (Player.bladeburner) {
|
2021-09-05 01:09:30 +02:00
|
|
|
Player.bladeburner.prestige();
|
|
|
|
}
|
|
|
|
|
|
|
|
// BitNode 8: Ghost of Wall Street
|
|
|
|
if (Player.bitNodeN === 8) {
|
2021-11-12 03:35:26 +01:00
|
|
|
Player.money = BitNode8StartingMoney;
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2022-04-14 07:22:50 +02:00
|
|
|
if (Player.bitNodeN === 8 || Player.sourceFileLvl(8) > 0) {
|
2021-09-05 01:09:30 +02:00
|
|
|
Player.hasWseAccount = true;
|
|
|
|
Player.hasTixApiAccess = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Reset Stock market
|
|
|
|
if (Player.hasWseAccount) {
|
|
|
|
initStockMarket();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Red Pill
|
2022-09-14 20:02:12 +02:00
|
|
|
if (augmentationExists(AugmentationNames.TheRedPill) && Player.hasAugmentation(AugmentationNames.TheRedPill, true)) {
|
2021-10-07 23:55:49 +02:00
|
|
|
const WorldDaemon = GetServer(SpecialServers.WorldDaemon);
|
|
|
|
const DaedalusServer = GetServer(SpecialServers.DaedalusServer);
|
2021-09-05 01:09:30 +02:00
|
|
|
if (WorldDaemon && DaedalusServer) {
|
2021-10-07 23:55:49 +02:00
|
|
|
WorldDaemon.serversOnNetwork.push(DaedalusServer.hostname);
|
|
|
|
DaedalusServer.serversOnNetwork.push(WorldDaemon.hostname);
|
2017-07-22 00:54:55 +02:00
|
|
|
}
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2021-03-07 19:08:12 +01:00
|
|
|
|
2022-09-14 20:02:12 +02:00
|
|
|
if (
|
|
|
|
augmentationExists(AugmentationNames.StaneksGift1) &&
|
|
|
|
Player.hasAugmentation(AugmentationNames.StaneksGift1, true)
|
|
|
|
) {
|
2022-03-19 09:09:59 +01:00
|
|
|
joinFaction(Factions[FactionNames.ChurchOfTheMachineGod]);
|
2021-09-25 23:21:50 +02:00
|
|
|
}
|
|
|
|
|
2021-10-17 03:38:03 +02:00
|
|
|
staneksGift.prestigeAugmentation();
|
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
resetPidCounter();
|
2021-10-23 21:22:58 +02:00
|
|
|
ProgramsSeen.splice(0, ProgramsSeen.length);
|
|
|
|
InvitationsSeen.splice(0, InvitationsSeen.length);
|
2017-07-27 04:56:14 +02:00
|
|
|
}
|
2017-08-13 07:01:33 +02:00
|
|
|
|
2019-04-13 03:22:46 +02:00
|
|
|
// Prestige by destroying Bit Node and gaining a Source File
|
2021-10-23 16:08:06 +02:00
|
|
|
export function prestigeSourceFile(flume: boolean): void {
|
2022-09-06 15:07:12 +02:00
|
|
|
initBitNodeMultipliers();
|
2017-08-30 19:44:29 +02:00
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
Player.prestigeSourceFile();
|
|
|
|
prestigeWorkerScripts(); // Delete all Worker Scripts objects
|
2017-08-30 19:44:29 +02:00
|
|
|
|
2021-09-25 07:26:03 +02:00
|
|
|
const homeComp = Player.getHomeComputer();
|
2017-08-13 07:01:33 +02:00
|
|
|
|
2021-12-16 18:40:24 +01:00
|
|
|
// Stop a Terminal action if there is one.
|
|
|
|
if (Terminal.action !== null) {
|
2022-09-06 15:07:12 +02:00
|
|
|
Terminal.finishAction(true);
|
2021-12-16 18:40:24 +01:00
|
|
|
}
|
|
|
|
Terminal.clear();
|
|
|
|
LogBoxClearEvents.emit();
|
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
// Delete all servers except home computer
|
|
|
|
prestigeAllServers(); // Must be done before initForeignServers()
|
2017-08-30 19:44:29 +02:00
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
// Reset home computer (only the programs) and add to AllServers
|
|
|
|
AddToAllServers(homeComp);
|
2022-09-18 03:09:15 +02:00
|
|
|
prestigeHomeComputer(homeComp);
|
2017-08-13 07:01:33 +02:00
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
// Re-create foreign servers
|
|
|
|
initForeignServers(Player.getHomeComputer());
|
2017-08-13 07:01:33 +02:00
|
|
|
|
2022-04-14 07:22:50 +02:00
|
|
|
if (Player.sourceFileLvl(9) >= 2) {
|
2021-09-05 01:09:30 +02:00
|
|
|
homeComp.setMaxRam(128);
|
2022-04-14 07:22:50 +02:00
|
|
|
} else if (Player.sourceFileLvl(1) > 0) {
|
2021-09-05 01:09:30 +02:00
|
|
|
homeComp.setMaxRam(32);
|
|
|
|
} else {
|
|
|
|
homeComp.setMaxRam(8);
|
|
|
|
}
|
|
|
|
homeComp.cpuCores = 1;
|
2017-08-20 03:36:19 +02:00
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
// Reset favor for Companies
|
2022-01-16 01:45:03 +01:00
|
|
|
for (const member of Object.keys(Companies)) {
|
2021-09-05 01:09:30 +02:00
|
|
|
if (Companies.hasOwnProperty(member)) {
|
|
|
|
Companies[member].favor = 0;
|
2021-05-05 13:19:59 +02:00
|
|
|
}
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2021-05-05 13:19:59 +02:00
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
// Reset favor for factions
|
2022-01-16 01:45:03 +01:00
|
|
|
for (const member of Object.keys(Factions)) {
|
2021-09-05 01:09:30 +02:00
|
|
|
if (Factions.hasOwnProperty(member)) {
|
|
|
|
Factions[member].favor = 0;
|
2018-03-12 20:39:04 +01:00
|
|
|
}
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Stop a Terminal action if there is one
|
2021-09-25 00:29:25 +02:00
|
|
|
if (Terminal.action !== null) {
|
2022-09-06 15:07:12 +02:00
|
|
|
Terminal.finishAction(true);
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Delete all Augmentations
|
2022-04-14 19:19:51 +02:00
|
|
|
for (const name of Object.keys(StaticAugmentations)) {
|
|
|
|
if (StaticAugmentations.hasOwnProperty(name)) {
|
|
|
|
delete StaticAugmentations[name];
|
2018-05-02 19:38:11 +02:00
|
|
|
}
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
|
|
|
|
2022-10-09 07:25:31 +02:00
|
|
|
// Give levels of NeuroFluxGovernor for Source-File 12. Must be done here before Augmentations are recalculated
|
2022-04-14 07:22:50 +02:00
|
|
|
if (Player.sourceFileLvl(12) > 0) {
|
2021-09-05 01:09:30 +02:00
|
|
|
Player.augmentations.push({
|
|
|
|
name: AugmentationNames.NeuroFluxGovernor,
|
2022-04-14 07:22:50 +02:00
|
|
|
level: Player.sourceFileLvl(12),
|
2021-09-05 01:09:30 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
// Re-initialize things - This will update any changes
|
|
|
|
initFactions(); // Factions must be initialized before augmentations
|
|
|
|
initAugmentations(); // Calls reapplyAllAugmentations() and resets Player multipliers
|
|
|
|
Player.reapplyAllSourceFiles();
|
|
|
|
initCompanies();
|
|
|
|
|
2022-01-17 07:30:50 +01:00
|
|
|
if (Player.sourceFileLvl(5) > 0 || Player.bitNodeN === 5) {
|
2021-10-28 05:41:47 +02:00
|
|
|
homeComp.programs.push(Programs.Formulas.name);
|
|
|
|
}
|
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
// BitNode 3: Corporatocracy
|
|
|
|
if (Player.bitNodeN === 3) {
|
|
|
|
homeComp.messages.push(LiteratureNames.CorporationManagementHandbook);
|
|
|
|
dialogBoxCreate(
|
|
|
|
"You received a copy of the Corporation Management Handbook on your home computer. " +
|
2022-03-30 20:59:53 +02:00
|
|
|
"Read it if you need help getting started with Corporations!",
|
2021-09-05 01:09:30 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
// BitNode 8: Ghost of Wall Street
|
|
|
|
if (Player.bitNodeN === 8) {
|
2021-11-12 03:35:26 +01:00
|
|
|
Player.money = BitNode8StartingMoney;
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
2022-04-14 07:22:50 +02:00
|
|
|
if (Player.bitNodeN === 8 || Player.sourceFileLvl(8) > 0) {
|
2021-09-05 01:09:30 +02:00
|
|
|
Player.hasWseAccount = true;
|
|
|
|
Player.hasTixApiAccess = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Bit Node 10: Digital Carbon
|
|
|
|
if (Player.bitNodeN === 10) {
|
2021-09-09 05:47:34 +02:00
|
|
|
dialogBoxCreate("Visit VitaLife in New Tokyo if you'd like to purchase a new sleeve!");
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
|
|
|
|
2021-10-07 07:36:59 +02:00
|
|
|
if (Player.bitNodeN === 13) {
|
2022-03-19 09:09:59 +01:00
|
|
|
dialogBoxCreate(`Trouble is brewing in ${CityName.Chongqing}`);
|
2021-10-07 07:36:59 +02:00
|
|
|
}
|
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
// Reset Stock market, gang, and corporation
|
|
|
|
if (Player.hasWseAccount) {
|
|
|
|
initStockMarket();
|
|
|
|
} else {
|
|
|
|
deleteStockMarket();
|
|
|
|
}
|
|
|
|
|
|
|
|
resetIndustryResearchTrees();
|
|
|
|
|
|
|
|
// Source-File 9 (level 3) effect
|
2022-04-14 07:22:50 +02:00
|
|
|
if (Player.sourceFileLvl(9) >= 3) {
|
2021-09-05 01:09:30 +02:00
|
|
|
const hserver = Player.createHacknetServer();
|
|
|
|
|
|
|
|
hserver.level = 100;
|
|
|
|
hserver.cores = 10;
|
|
|
|
hserver.cache = 5;
|
2022-07-15 00:43:33 +02:00
|
|
|
hserver.updateHashRate(Player.mults.hacknet_node_money);
|
2021-09-05 01:09:30 +02:00
|
|
|
hserver.updateHashCapacity();
|
2022-09-06 15:07:12 +02:00
|
|
|
updateHashManagerCapacity();
|
2021-09-05 01:09:30 +02:00
|
|
|
}
|
|
|
|
|
2021-11-14 04:44:17 +01:00
|
|
|
if (Player.bitNodeN === 13) {
|
|
|
|
Player.money = CONSTANTS.TravelCost;
|
|
|
|
}
|
2021-10-17 03:38:03 +02:00
|
|
|
staneksGift.prestigeSourceFile();
|
|
|
|
|
2021-09-05 01:09:30 +02:00
|
|
|
// Gain int exp
|
2022-04-14 07:22:50 +02:00
|
|
|
if (Player.sourceFileLvl(5) !== 0 && !flume) Player.gainIntelligenceExp(300);
|
2021-09-05 01:09:30 +02:00
|
|
|
|
2022-05-22 02:24:17 +02:00
|
|
|
// Clear recent scripts
|
|
|
|
recentScripts.splice(0, recentScripts.length);
|
2021-09-05 01:09:30 +02:00
|
|
|
resetPidCounter();
|
2017-08-13 07:01:33 +02:00
|
|
|
}
|