2017-02-20 23:06:16 +01:00
|
|
|
/* Prestige functions */
|
|
|
|
|
|
|
|
//Prestige by purchasing augmentation
|
|
|
|
function prestigeAugmentation() {
|
2017-08-13 07:01:33 +02:00
|
|
|
initBitNodeMultipliers();
|
2017-07-27 04:56:14 +02:00
|
|
|
|
2017-05-05 03:08:44 +02:00
|
|
|
//Crime statistics
|
|
|
|
Player.numTimesShoplifted = 0;
|
|
|
|
Player.numPeopleMugged = 0;
|
|
|
|
Player.numTimesDealtDrugs = 0;
|
|
|
|
Player.numTimesTraffickArms = 0;
|
|
|
|
Player.numPeopleKilled = 0;
|
2017-05-08 18:00:34 +02:00
|
|
|
Player.numTimesGrandTheftAuto = 0;
|
2017-05-05 03:08:44 +02:00
|
|
|
Player.numTimesKidnapped = 0;
|
2017-05-08 18:00:34 +02:00
|
|
|
Player.numTimesHeist = 0;
|
2017-07-27 04:56:14 +02:00
|
|
|
|
2017-05-08 18:00:34 +02:00
|
|
|
Player.karma = 0;
|
2017-07-27 04:56:14 +02:00
|
|
|
|
2017-05-05 03:08:44 +02:00
|
|
|
//Reset stats
|
2017-02-20 23:06:16 +01:00
|
|
|
Player.hacking_skill = 1;
|
2017-07-27 04:56:14 +02:00
|
|
|
|
2017-02-20 23:06:16 +01:00
|
|
|
Player.strength = 1;
|
|
|
|
Player.defense = 1;
|
|
|
|
Player.dexterity = 1;
|
|
|
|
Player.agility = 1;
|
2017-07-27 04:56:14 +02:00
|
|
|
|
2017-02-20 23:06:16 +01:00
|
|
|
Player.charisma = 1;
|
2017-07-27 04:56:14 +02:00
|
|
|
|
2017-02-20 23:06:16 +01:00
|
|
|
Player.hacking_exp = 0;
|
|
|
|
Player.strength_exp = 0;
|
|
|
|
Player.defense_exp = 0;
|
|
|
|
Player.dexterity_exp = 0;
|
|
|
|
Player.agility_exp = 0;
|
|
|
|
Player.charisma_exp = 0;
|
2017-07-27 04:56:14 +02:00
|
|
|
|
2017-07-29 18:25:40 +02:00
|
|
|
Player.money = new Decimal(1000);
|
2017-07-27 04:56:14 +02:00
|
|
|
|
2017-02-20 23:06:16 +01:00
|
|
|
Player.city = Locations.Sector12;
|
|
|
|
Player.location = "";
|
2017-07-27 04:56:14 +02:00
|
|
|
|
2017-02-20 23:06:16 +01:00
|
|
|
Player.companyName = "";
|
|
|
|
Player.companyPosition = "";
|
2017-07-27 04:56:14 +02:00
|
|
|
|
2017-02-20 23:06:16 +01:00
|
|
|
Player.currentServer = "";
|
|
|
|
Player.discoveredServers = [];
|
|
|
|
Player.purchasedServers = [];
|
2017-07-27 04:56:14 +02:00
|
|
|
|
2017-02-20 23:06:16 +01:00
|
|
|
Player.factions = [];
|
2017-07-27 04:56:14 +02:00
|
|
|
Player.factionInvitations = [];
|
|
|
|
|
2017-06-26 01:39:17 +02:00
|
|
|
Player.queuedAugmentations = [];
|
2017-07-27 04:56:14 +02:00
|
|
|
|
2017-02-20 23:06:16 +01:00
|
|
|
Player.startAction = false;
|
|
|
|
Player.actionTime = 0;
|
2017-07-27 04:56:14 +02:00
|
|
|
|
2017-02-20 23:06:16 +01:00
|
|
|
Player.isWorking = false;
|
|
|
|
Player.currentWorkFactionName = "";
|
|
|
|
Player.currentWorkFactionDescription = "";
|
2017-05-05 03:08:44 +02:00
|
|
|
this.createProgramName = "";
|
|
|
|
this.className = "";
|
|
|
|
this.crimeType = "";
|
2017-07-27 04:56:14 +02:00
|
|
|
|
2017-02-20 23:06:16 +01:00
|
|
|
Player.workHackExpGainRate = 0;
|
|
|
|
Player.workStrExpGainRate = 0;
|
|
|
|
Player.workDefExpGainRate = 0;
|
|
|
|
Player.workDexExpGainRate = 0;
|
|
|
|
Player.workAgiExpGainRate = 0;
|
|
|
|
Player.workChaExpGainRate = 0;
|
|
|
|
Player.workRepGainRate = 0;
|
|
|
|
Player.workMoneyGainRate = 0;
|
2017-07-27 04:56:14 +02:00
|
|
|
|
2017-02-20 23:06:16 +01:00
|
|
|
Player.workHackExpGained = 0;
|
|
|
|
Player.workStrExpGained = 0;
|
|
|
|
Player.workDefExpGained = 0;
|
|
|
|
Player.workDexExpGained = 0;
|
|
|
|
Player.workAgiExpGained = 0;
|
|
|
|
Player.workChaExpGained = 0;
|
|
|
|
Player.workRepGained = 0;
|
|
|
|
Player.workMoneyGained = 0;
|
2017-07-27 04:56:14 +02:00
|
|
|
|
2017-02-20 23:06:16 +01:00
|
|
|
Player.timeWorked = 0;
|
2017-07-27 04:56:14 +02:00
|
|
|
|
2017-02-20 23:06:16 +01:00
|
|
|
Player.lastUpdate = new Date().getTime();
|
2017-07-27 04:56:14 +02:00
|
|
|
|
2017-06-17 04:53:57 +02:00
|
|
|
//Delete all Worker Scripts objects
|
2017-05-30 05:52:06 +02:00
|
|
|
for (var i = 0; i < workerScripts.length; ++i) {
|
2017-06-07 02:37:38 +02:00
|
|
|
deleteActiveScriptsItem(workerScripts[i]);
|
2017-05-30 05:52:06 +02:00
|
|
|
workerScripts[i].env.stopFlag = true;
|
|
|
|
}
|
2017-06-07 02:37:38 +02:00
|
|
|
workerScripts.length = 0;
|
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-02-20 23:06:16 +01:00
|
|
|
for (var member in AllServers) {
|
|
|
|
delete AllServers[member];
|
|
|
|
}
|
|
|
|
AllServers = {};
|
2017-05-13 06:40:12 +02:00
|
|
|
//Delete Special Server IPs
|
|
|
|
for (var member in SpecialServerIps) {
|
|
|
|
delete SpecialServerIps[member];
|
|
|
|
}
|
|
|
|
SpecialServersIps = null;
|
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
|
|
|
|
homeComp.programs.length = 0;
|
2017-05-08 18:00:34 +02:00
|
|
|
homeComp.runningScripts = [];
|
|
|
|
homeComp.serversOnNetwork = [];
|
|
|
|
homeComp.isConnectedTo = true;
|
|
|
|
homeComp.ramUsed = 0;
|
2017-05-08 16:33:26 +02:00
|
|
|
homeComp.programs.push(Programs.NukeProgram);
|
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-07-29 18:25:40 +02:00
|
|
|
Player.money = new Decimal(1000000);
|
2017-05-18 22:00:37 +02:00
|
|
|
homeComp.programs.push(Programs.BruteSSHProgram);
|
|
|
|
}
|
2017-05-08 18:00:34 +02:00
|
|
|
Player.currentServer = homeComp.ip;
|
|
|
|
Player.homeComputer = homeComp.ip;
|
|
|
|
AddToAllServers(homeComp);
|
2017-07-27 04:56:14 +02:00
|
|
|
|
2017-05-12 20:12:32 +02:00
|
|
|
//Re-create foreign servers
|
2017-05-12 20:52:02 +02:00
|
|
|
SpecialServerIps = new SpecialServerIpsMap(); //Must be done before initForeignServers()
|
2017-05-12 20:12:32 +02:00
|
|
|
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-05-10 19:42:46 +02:00
|
|
|
//Reset statistics of all scripts on home computer
|
|
|
|
for (var i = 0; i < homeComp.scripts.length; ++i) {
|
|
|
|
var s = homeComp.scripts[i];
|
|
|
|
}
|
2017-06-02 18:49:14 +02:00
|
|
|
//Delete messages on home computer
|
|
|
|
homeComp.messages.length = 0;
|
2017-07-27 04:56:14 +02:00
|
|
|
|
2017-05-05 03:08:44 +02:00
|
|
|
//Delete Hacknet Nodes
|
|
|
|
Player.hacknetNodes.length = 0;
|
2017-05-10 19:42:46 +02:00
|
|
|
Player.totalHacknetNodeProduction = 0;
|
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-07-22 00:54:55 +02:00
|
|
|
stockMarketContentCreated = false;
|
|
|
|
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-06-19 16:54:11 +02:00
|
|
|
Player.playtimeSinceLastAug = 0;
|
2017-07-27 04:56:14 +02:00
|
|
|
|
2017-07-22 00:54:55 +02:00
|
|
|
var mainMenu = document.getElementById("mainmenu-container");
|
|
|
|
mainMenu.style.visibility = "visible";
|
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
|
|
|
|
Player.numTimesShoplifted = 0;
|
|
|
|
Player.numPeopleMugged = 0;
|
|
|
|
Player.numTimesDealtDrugs = 0;
|
|
|
|
Player.numTimesTraffickArms = 0;
|
|
|
|
Player.numPeopleKilled = 0;
|
|
|
|
Player.numTimesGrandTheftAuto = 0;
|
|
|
|
Player.numTimesKidnapped = 0;
|
|
|
|
Player.numTimesHeist = 0;
|
|
|
|
|
|
|
|
Player.karma = 0;
|
|
|
|
|
|
|
|
//Reset stats
|
|
|
|
Player.hacking_skill = 1;
|
|
|
|
|
|
|
|
Player.strength = 1;
|
|
|
|
Player.defense = 1;
|
|
|
|
Player.dexterity = 1;
|
|
|
|
Player.agility = 1;
|
|
|
|
|
|
|
|
Player.charisma = 1;
|
|
|
|
|
|
|
|
Player.hacking_exp = 0;
|
|
|
|
Player.strength_exp = 0;
|
|
|
|
Player.defense_exp = 0;
|
|
|
|
Player.dexterity_exp = 0;
|
|
|
|
Player.agility_exp = 0;
|
|
|
|
Player.charisma_exp = 0;
|
|
|
|
|
|
|
|
Player.money = new Decimal(1000);
|
|
|
|
|
|
|
|
Player.city = Locations.Sector12;
|
|
|
|
Player.location = "";
|
|
|
|
|
|
|
|
Player.companyName = "";
|
|
|
|
Player.companyPosition = "";
|
|
|
|
|
|
|
|
Player.currentServer = "";
|
|
|
|
Player.discoveredServers = [];
|
|
|
|
Player.purchasedServers = [];
|
|
|
|
|
|
|
|
Player.factions = [];
|
|
|
|
Player.factionInvitations = [];
|
|
|
|
|
|
|
|
Player.queuedAugmentations = [];
|
|
|
|
Player.augmentations = [];
|
|
|
|
|
|
|
|
Player.startAction = false;
|
|
|
|
Player.actionTime = 0;
|
|
|
|
|
|
|
|
Player.isWorking = false;
|
|
|
|
Player.currentWorkFactionName = "";
|
|
|
|
Player.currentWorkFactionDescription = "";
|
|
|
|
this.createProgramName = "";
|
|
|
|
this.className = "";
|
|
|
|
this.crimeType = "";
|
|
|
|
|
|
|
|
Player.workHackExpGainRate = 0;
|
|
|
|
Player.workStrExpGainRate = 0;
|
|
|
|
Player.workDefExpGainRate = 0;
|
|
|
|
Player.workDexExpGainRate = 0;
|
|
|
|
Player.workAgiExpGainRate = 0;
|
|
|
|
Player.workChaExpGainRate = 0;
|
|
|
|
Player.workRepGainRate = 0;
|
|
|
|
Player.workMoneyGainRate = 0;
|
|
|
|
|
|
|
|
Player.workHackExpGained = 0;
|
|
|
|
Player.workStrExpGained = 0;
|
|
|
|
Player.workDefExpGained = 0;
|
|
|
|
Player.workDexExpGained = 0;
|
|
|
|
Player.workAgiExpGained = 0;
|
|
|
|
Player.workChaExpGained = 0;
|
|
|
|
Player.workRepGained = 0;
|
|
|
|
Player.workMoneyGained = 0;
|
|
|
|
|
|
|
|
Player.timeWorked = 0;
|
|
|
|
|
|
|
|
Player.lastUpdate = new Date().getTime();
|
|
|
|
|
|
|
|
//Delete all Worker Scripts objects
|
|
|
|
for (var i = 0; i < workerScripts.length; ++i) {
|
|
|
|
deleteActiveScriptsItem(workerScripts[i]);
|
|
|
|
workerScripts[i].env.stopFlag = true;
|
|
|
|
}
|
|
|
|
workerScripts.length = 0;
|
|
|
|
|
|
|
|
var homeComp = Player.getHomeComputer();
|
|
|
|
//Delete all servers except home computer
|
|
|
|
for (var member in AllServers) {
|
|
|
|
delete AllServers[member];
|
|
|
|
}
|
|
|
|
AllServers = {};
|
|
|
|
//Delete Special Server IPs
|
|
|
|
for (var member in SpecialServerIps) {
|
|
|
|
delete SpecialServerIps[member];
|
|
|
|
}
|
|
|
|
SpecialServersIps = null;
|
|
|
|
|
|
|
|
//Reset home computer (only the programs) and add to AllServers
|
|
|
|
homeComp.programs.length = 0;
|
|
|
|
homeComp.runningScripts = [];
|
|
|
|
homeComp.serversOnNetwork = [];
|
|
|
|
homeComp.isConnectedTo = true;
|
|
|
|
homeComp.ramUsed = 0;
|
|
|
|
homeComp.programs.push(Programs.NukeProgram);
|
|
|
|
var srcFile1Owned = false;
|
|
|
|
for (var i = 0; i < Player.sourceFiles.length; ++i) {
|
|
|
|
if (Player.sourceFiles[i].n == 1) {
|
|
|
|
srcFile1Owned = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (srcFile1Owned) {
|
|
|
|
homeComp.maxRam = 32;
|
|
|
|
} else {
|
|
|
|
homeComp.maxRam = 8;
|
|
|
|
}
|
|
|
|
Player.currentServer = homeComp.ip;
|
|
|
|
Player.homeComputer = homeComp.ip;
|
|
|
|
AddToAllServers(homeComp);
|
|
|
|
|
|
|
|
//Re-create foreign servers
|
|
|
|
SpecialServerIps = new SpecialServerIpsMap(); //Must be done before initForeignServers()
|
|
|
|
initForeignServers();
|
|
|
|
|
|
|
|
//Darkweb is purchase-able
|
|
|
|
document.getElementById("location-purchase-tor").setAttribute("class", "a-link-button");
|
|
|
|
|
|
|
|
//Reset statistics of all scripts on home computer
|
|
|
|
for (var i = 0; i < homeComp.scripts.length; ++i) {
|
|
|
|
var s = homeComp.scripts[i];
|
|
|
|
}
|
|
|
|
//Delete messages on home computer
|
|
|
|
homeComp.messages.length = 0;
|
|
|
|
|
|
|
|
//Delete Hacknet Nodes
|
|
|
|
Player.hacknetNodes.length = 0;
|
|
|
|
Player.totalHacknetNodeProduction = 0;
|
|
|
|
|
|
|
|
//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);
|
|
|
|
}
|
|
|
|
|
|
|
|
//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();
|
|
|
|
|
|
|
|
//Gang
|
|
|
|
Player.gang = null;
|
|
|
|
|
|
|
|
//Reset Stock market
|
|
|
|
Player.hasWseAccount = false;
|
|
|
|
|
|
|
|
Player.playtimeSinceLastAug = 0;
|
|
|
|
|
|
|
|
var mainMenu = document.getElementById("mainmenu-container");
|
|
|
|
mainMenu.style.visibility = "visible";
|
|
|
|
Engine.loadTerminalContent();
|
|
|
|
}
|