2017-08-30 19:44:29 +02:00
|
|
|
import {deleteActiveScriptsItem} from "./ActiveScriptsUI.js";
|
|
|
|
import {Augmentations, augmentationExists,
|
|
|
|
initAugmentations, AugmentationNames} from "./Augmentations.js";
|
|
|
|
import {initBitNodeMultipliers} from "./BitNode.js";
|
|
|
|
import {Companies, Company, initCompanies} from "./Company.js";
|
|
|
|
import {Programs} from "./CreateProgram.js";
|
|
|
|
import {Engine} from "./engine.js";
|
|
|
|
import {Factions, Faction, initFactions,
|
|
|
|
joinFaction} from "./Faction.js";
|
|
|
|
import {Locations} from "./Location.js";
|
|
|
|
import {initMessages, Messages, Message} from "./Message.js";
|
|
|
|
import {WorkerScript, workerScripts,
|
|
|
|
prestigeWorkerScripts} from "./NetscriptWorker.js";
|
|
|
|
import {Player} from "./Player.js";
|
|
|
|
import {AllServers, AddToAllServers,
|
|
|
|
initForeignServers, Server,
|
|
|
|
prestigeAllServers,
|
|
|
|
prestigeHomeComputer} from "./Server.js";
|
|
|
|
import {SpecialServerIps, SpecialServerIpsMap,
|
|
|
|
prestigeSpecialServerIps,
|
|
|
|
SpecialServerNames} from "./SpecialServerIps.js";
|
|
|
|
import {initStockMarket, initSymbolToStockMap,
|
2017-08-31 19:19:28 +02:00
|
|
|
stockMarketContentCreated,
|
|
|
|
setStockMarketContentCreated} from "./StockMarket.js";
|
2017-08-30 19:44:29 +02:00
|
|
|
import {Terminal, postNetburnerText} from "./Terminal.js";
|
|
|
|
import Decimal from '../utils/decimal.js';
|
2017-02-20 23:06:16 +01:00
|
|
|
|
|
|
|
//Prestige by purchasing augmentation
|
|
|
|
function prestigeAugmentation() {
|
2017-08-13 07:01:33 +02:00
|
|
|
initBitNodeMultipliers();
|
2017-07-27 04:56:14 +02:00
|
|
|
|
2017-08-30 19:44:29 +02:00
|
|
|
Player.prestigeAugmentation();
|
2017-07-27 04:56:14 +02:00
|
|
|
|
2017-06-17 04:53:57 +02:00
|
|
|
//Delete all Worker Scripts objects
|
2017-08-30 19:44:29 +02:00
|
|
|
prestigeWorkerScripts();
|
2017-07-27 04:56:14 +02:00
|
|
|
|
2017-05-08 18:00:34 +02:00
|
|
|
var homeComp = Player.getHomeComputer();
|
2017-05-08 16:33:26 +02:00
|
|
|
//Delete all servers except home computer
|
2017-08-30 19:44:29 +02:00
|
|
|
prestigeAllServers();
|
|
|
|
|
2017-05-13 06:40:12 +02:00
|
|
|
//Delete Special Server IPs
|
2017-08-30 19:44:29 +02:00
|
|
|
prestigeSpecialServerIps(); //Must be done before initForeignServers()
|
2017-07-27 04:56:14 +02:00
|
|
|
|
2017-05-08 16:33:26 +02:00
|
|
|
//Reset home computer (only the programs) and add to AllServers
|
2017-08-30 19:44:29 +02:00
|
|
|
prestigeHomeComputer(homeComp);
|
|
|
|
|
2017-07-27 04:56:14 +02:00
|
|
|
if (augmentationExists(AugmentationNames.Neurolink) &&
|
2017-05-18 22:00:37 +02:00
|
|
|
Augmentations[AugmentationNames.Neurolink].owned) {
|
|
|
|
homeComp.programs.push(Programs.FTPCrackProgram);
|
|
|
|
homeComp.programs.push(Programs.RelaySMTPProgram);
|
2017-07-27 04:56:14 +02:00
|
|
|
}
|
|
|
|
if (augmentationExists(AugmentationNames.CashRoot) &&
|
2017-05-18 22:00:37 +02:00
|
|
|
Augmentations[AugmentationNames.CashRoot].owned) {
|
2017-08-30 19:44:29 +02:00
|
|
|
Player.setMoney(new Decimal(1000000));
|
2017-05-18 22:00:37 +02:00
|
|
|
homeComp.programs.push(Programs.BruteSSHProgram);
|
|
|
|
}
|
2017-08-30 19:44:29 +02:00
|
|
|
|
2017-05-08 18:00:34 +02:00
|
|
|
AddToAllServers(homeComp);
|
2017-07-27 04:56:14 +02:00
|
|
|
|
2017-05-12 20:12:32 +02:00
|
|
|
//Re-create foreign servers
|
|
|
|
initForeignServers();
|
2017-07-27 04:56:14 +02:00
|
|
|
|
2017-05-16 00:22:17 +02:00
|
|
|
//Darkweb is purchase-able
|
|
|
|
document.getElementById("location-purchase-tor").setAttribute("class", "a-link-button");
|
2017-07-27 04:56:14 +02:00
|
|
|
|
2017-06-20 18:11:33 +02:00
|
|
|
//Gain favor for Companies
|
2017-02-20 23:06:16 +01:00
|
|
|
for (var member in Companies) {
|
2017-05-10 22:21:15 +02:00
|
|
|
if (Companies.hasOwnProperty(member)) {
|
2017-06-20 18:11:33 +02:00
|
|
|
Companies[member].gainFavor();
|
2017-05-10 22:21:15 +02:00
|
|
|
}
|
2017-02-20 23:06:16 +01:00
|
|
|
}
|
2017-07-27 04:56:14 +02:00
|
|
|
|
2017-06-20 18:11:33 +02:00
|
|
|
//Gain favor for factions
|
2017-02-20 23:06:16 +01:00
|
|
|
for (var member in Factions) {
|
2017-05-10 22:21:15 +02:00
|
|
|
if (Factions.hasOwnProperty(member)) {
|
2017-06-20 18:11:33 +02:00
|
|
|
Factions[member].gainFavor();
|
2017-05-10 22:21:15 +02:00
|
|
|
}
|
2017-02-20 23:06:16 +01:00
|
|
|
}
|
2017-07-27 04:56:14 +02:00
|
|
|
|
2017-05-12 20:12:32 +02:00
|
|
|
//Stop a Terminal action if there is onerror
|
|
|
|
if (Engine._actionInProgress) {
|
|
|
|
Engine._actionInProgress = false;
|
|
|
|
Terminal.finishAction(true);
|
|
|
|
}
|
2017-07-27 04:56:14 +02:00
|
|
|
|
|
|
|
//Re-initialize things - This will update any changes
|
2017-06-26 01:39:17 +02:00
|
|
|
initFactions(); //Factions must be initialized before augmentations
|
2017-08-13 07:01:33 +02:00
|
|
|
initAugmentations(); //Calls reapplyAllAugmentations() and resets Player multipliers
|
|
|
|
Player.reapplyAllSourceFiles();
|
2017-02-20 23:06:16 +01:00
|
|
|
initCompanies();
|
2017-07-27 04:56:14 +02:00
|
|
|
|
2017-05-15 02:14:13 +02:00
|
|
|
//Clear terminal
|
|
|
|
$("#terminal tr:not(:last)").remove();
|
|
|
|
postNetburnerText();
|
2017-07-27 04:56:14 +02:00
|
|
|
|
2017-06-02 07:34:57 +02:00
|
|
|
//Messages
|
|
|
|
initMessages();
|
2017-07-27 04:56:14 +02:00
|
|
|
|
2017-07-22 00:54:55 +02:00
|
|
|
//Reset Stock market
|
2017-07-03 21:42:11 +02:00
|
|
|
if (Player.hasWseAccount) {
|
|
|
|
initStockMarket();
|
|
|
|
initSymbolToStockMap();
|
2017-08-31 19:19:28 +02:00
|
|
|
setStockMarketContentCreated(false);
|
2017-07-22 00:54:55 +02:00
|
|
|
var stockMarketList = document.getElementById("stock-market-list");
|
|
|
|
while(stockMarketList.firstChild) {
|
|
|
|
stockMarketList.removeChild(stockMarketList.firstChild);
|
|
|
|
}
|
2017-07-03 21:42:11 +02:00
|
|
|
}
|
2017-07-27 04:56:14 +02:00
|
|
|
|
2017-08-13 07:01:33 +02:00
|
|
|
//Gang, in BitNode 2
|
|
|
|
if (Player.bitNodeN == 2 && Player.inGang()) {
|
|
|
|
var faction = Factions[Player.gang.facName];
|
|
|
|
if (faction instanceof Faction) {
|
|
|
|
joinFaction(faction);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-07-22 00:54:55 +02:00
|
|
|
var mainMenu = document.getElementById("mainmenu-container");
|
|
|
|
mainMenu.style.visibility = "visible";
|
2017-09-13 16:22:22 +02:00
|
|
|
Terminal.resetTerminalInput();
|
2017-05-05 03:08:44 +02:00
|
|
|
Engine.loadTerminalContent();
|
2017-07-27 04:56:14 +02:00
|
|
|
|
2017-07-22 00:54:55 +02:00
|
|
|
//Red Pill
|
|
|
|
if (augmentationExists(AugmentationNames.TheRedPill) &&
|
|
|
|
Augmentations[AugmentationNames.TheRedPill].owned) {
|
|
|
|
var WorldDaemon = AllServers[SpecialServerIps[SpecialServerNames.WorldDaemon]];
|
|
|
|
var DaedalusServer = AllServers[SpecialServerIps[SpecialServerNames.DaedalusServer]];
|
|
|
|
if (WorldDaemon && DaedalusServer) {
|
|
|
|
WorldDaemon.serversOnNetwork.push(DaedalusServer.ip);
|
|
|
|
DaedalusServer.serversOnNetwork.push(WorldDaemon.ip);
|
|
|
|
}
|
|
|
|
}
|
2017-07-27 04:56:14 +02:00
|
|
|
}
|
2017-08-13 07:01:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
//Prestige by destroying Bit Node and gaining a Source File
|
|
|
|
function prestigeSourceFile() {
|
|
|
|
initBitNodeMultipliers();
|
|
|
|
|
|
|
|
//Crime statistics
|
2017-08-30 19:44:29 +02:00
|
|
|
Player.prestigeSourceFile();
|
2017-08-13 07:01:33 +02:00
|
|
|
|
|
|
|
//Delete all Worker Scripts objects
|
2017-08-30 19:44:29 +02:00
|
|
|
prestigeWorkerScripts();
|
2017-08-13 07:01:33 +02:00
|
|
|
|
|
|
|
var homeComp = Player.getHomeComputer();
|
2017-08-30 19:44:29 +02:00
|
|
|
|
2017-08-13 07:01:33 +02:00
|
|
|
//Delete all servers except home computer
|
2017-08-30 19:44:29 +02:00
|
|
|
prestigeAllServers(); //Must be done before initForeignServers()
|
|
|
|
|
2017-08-13 07:01:33 +02:00
|
|
|
//Delete Special Server IPs
|
2017-08-30 19:44:29 +02:00
|
|
|
prestigeSpecialServerIps();
|
2017-08-13 07:01:33 +02:00
|
|
|
|
|
|
|
//Reset home computer (only the programs) and add to AllServers
|
2017-08-30 19:44:29 +02:00
|
|
|
prestigeHomeComputer(homeComp);
|
|
|
|
|
2017-08-13 07:01:33 +02:00
|
|
|
var srcFile1Owned = false;
|
|
|
|
for (var i = 0; i < Player.sourceFiles.length; ++i) {
|
|
|
|
if (Player.sourceFiles[i].n == 1) {
|
|
|
|
srcFile1Owned = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (srcFile1Owned) {
|
2017-08-30 19:44:29 +02:00
|
|
|
homeComp.setMaxRam(32);
|
2017-08-13 07:01:33 +02:00
|
|
|
} else {
|
2017-08-30 19:44:29 +02:00
|
|
|
homeComp.setMaxRam(8);
|
2017-08-13 07:01:33 +02:00
|
|
|
}
|
2017-08-30 19:44:29 +02:00
|
|
|
|
2017-08-13 07:01:33 +02:00
|
|
|
AddToAllServers(homeComp);
|
|
|
|
|
|
|
|
//Re-create foreign servers
|
|
|
|
initForeignServers();
|
|
|
|
|
|
|
|
//Darkweb is purchase-able
|
|
|
|
document.getElementById("location-purchase-tor").setAttribute("class", "a-link-button");
|
|
|
|
|
|
|
|
//Reset favor for Companies
|
|
|
|
for (var member in Companies) {
|
|
|
|
if (Companies.hasOwnProperty(member)) {
|
|
|
|
Companies[member].favor = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//Reset favor for factions
|
|
|
|
for (var member in Factions) {
|
|
|
|
if (Factions.hasOwnProperty(member)) {
|
|
|
|
Factions[member].favor = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//Stop a Terminal action if there is one
|
|
|
|
if (Engine._actionInProgress) {
|
|
|
|
Engine._actionInProgress = false;
|
|
|
|
Terminal.finishAction(true);
|
|
|
|
}
|
|
|
|
|
2017-08-15 22:22:46 +02:00
|
|
|
//Delete all Augmentations
|
|
|
|
for (var name in Augmentations) {
|
|
|
|
if (Augmentations.hasOwnProperty(name)) {
|
|
|
|
delete Augmentations[name];
|
|
|
|
}
|
|
|
|
}
|
2017-08-20 03:36:19 +02:00
|
|
|
|
2017-08-13 07:01:33 +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();
|
|
|
|
|
|
|
|
//Clear terminal
|
|
|
|
$("#terminal tr:not(:last)").remove();
|
|
|
|
postNetburnerText();
|
|
|
|
|
|
|
|
//Messages
|
|
|
|
initMessages();
|
|
|
|
|
|
|
|
var mainMenu = document.getElementById("mainmenu-container");
|
|
|
|
mainMenu.style.visibility = "visible";
|
2017-09-13 16:22:22 +02:00
|
|
|
Terminal.resetTerminalInput();
|
2017-08-13 07:01:33 +02:00
|
|
|
Engine.loadTerminalContent();
|
2017-09-15 16:06:59 +02:00
|
|
|
|
|
|
|
//Gain int exp
|
|
|
|
Player.gainIntelligenceExp(5);
|
2017-08-13 07:01:33 +02:00
|
|
|
}
|
2017-08-30 19:44:29 +02:00
|
|
|
|
|
|
|
export {prestigeAugmentation, prestigeSourceFile};
|