2017-02-20 23:06:16 +01:00
|
|
|
/* Prestige functions */
|
|
|
|
|
|
|
|
//Prestige by purchasing augmentation
|
|
|
|
function prestigeAugmentation() {
|
2017-05-05 03:08:44 +02:00
|
|
|
//Sum up lifetime/total statistics
|
2017-02-20 23:06:16 +01:00
|
|
|
Player.total_hacking += Player.hacking_skill;
|
|
|
|
Player.lifetime_hacking += Player.hacking_skill;
|
|
|
|
Player.total_strength += Player.strength;
|
|
|
|
Player.lifetime_strength += Player.strength;
|
|
|
|
Player.total_defense += Player.defense;
|
|
|
|
Player.lifetime_defense += Player.defense;
|
|
|
|
Player.total_dexterity += Player.dexterity;
|
|
|
|
Player.lifetime_dexterity += Player.dexterity;
|
|
|
|
Player.total_agility += Player.agility;
|
|
|
|
Player.lifetime_agility += Player.agility;
|
|
|
|
Player.total_charisma += Player.charisma;
|
|
|
|
Player.lifetime_charisma += Player.charisma;
|
|
|
|
|
2017-05-05 03:08:44 +02:00
|
|
|
//Crime statistics
|
|
|
|
Player.numTimesShopliftedTotal += Player.numTimesShoplifted;
|
|
|
|
Player.numTimesShopliftedLifetime += Player.numTimesShoplifted;
|
|
|
|
Player.numTimesShoplifted = 0;
|
|
|
|
Player.numPeopleMuggedTotal += Player.numPeopleMugged;
|
|
|
|
Player.numPeopleMuggedLifetime += Player.numPeopleMugged;
|
|
|
|
Player.numPeopleMugged = 0;
|
|
|
|
Player.numTimesDealtDrugsTotal += Player.numTimesDealtDrugs;
|
|
|
|
Player.numTimesDealtDrugsLifetime += Player.numTimesDealtDrugs;
|
|
|
|
Player.numTimesDealtDrugs = 0;
|
|
|
|
Player.numTimesTraffickArmsTotal += Player.numTimesTraffickArms;
|
|
|
|
Player.numTimesTraffickArmsLifetime += Player.numTimesTraffickArms;
|
|
|
|
Player.numTimesTraffickArms = 0;
|
|
|
|
Player.numPeopleKilledTotal += Player.numPeopleKilled;
|
|
|
|
Player.numPeopleKilledLifetime += Player.numPeopleKilled;
|
|
|
|
Player.numPeopleKilled = 0;
|
|
|
|
Player.numTimesKidnappedTotal += Player.numTimesKidnapped;
|
|
|
|
Player.numTimesKidnappedLifetime += Player.numTimesKidnapped;
|
|
|
|
Player.numTimesKidnapped = 0;
|
|
|
|
|
|
|
|
//Reset stats
|
2017-02-20 23:06:16 +01:00
|
|
|
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;
|
|
|
|
|
2017-05-07 00:19:18 +02:00
|
|
|
Player.money = 1000;
|
2017-05-08 16:33:26 +02:00
|
|
|
|
2017-02-20 23:06:16 +01:00
|
|
|
Player.city = Locations.Sector12;
|
|
|
|
Player.location = "";
|
|
|
|
|
|
|
|
Player.companyName = "";
|
|
|
|
Player.companyPosition = "";
|
|
|
|
|
|
|
|
Player.currentServer = "";
|
|
|
|
Player.discoveredServers = [];
|
|
|
|
Player.purchasedServers = [];
|
|
|
|
|
|
|
|
Player.factions = [];
|
|
|
|
|
|
|
|
Player.startAction = false;
|
|
|
|
Player.actionTime = 0;
|
|
|
|
|
|
|
|
Player.isWorking = false;
|
|
|
|
Player.currentWorkFactionName = "";
|
|
|
|
Player.currentWorkFactionDescription = "";
|
2017-05-05 03:08:44 +02:00
|
|
|
this.createProgramName = "";
|
|
|
|
this.className = "";
|
|
|
|
this.crimeType = "";
|
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;
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
2017-05-08 16:33:26 +02:00
|
|
|
var homeComp = null;
|
|
|
|
//Delete all servers except home computer
|
2017-02-20 23:06:16 +01:00
|
|
|
for (var member in AllServers) {
|
2017-05-08 16:33:26 +02:00
|
|
|
//Don't delete home computer
|
|
|
|
if (member == Player.homeComputer) {
|
|
|
|
homeComp = AllServers[member];
|
|
|
|
continue;
|
|
|
|
}
|
2017-02-20 23:06:16 +01:00
|
|
|
delete AllServers[member];
|
|
|
|
}
|
|
|
|
AllServers = {};
|
|
|
|
|
2017-05-08 16:33:26 +02:00
|
|
|
//Reset home computer (only the programs) and add to AllServers
|
|
|
|
homeComp.programs.length = 0;
|
|
|
|
homeComp.programs.push(Programs.NukeProgram);
|
|
|
|
addToAllServers(homeComp);
|
|
|
|
|
2017-05-05 03:08:44 +02:00
|
|
|
//Delete all running scripts objects
|
|
|
|
for (var i = 0; i < workerScripts.length; ++i) {
|
|
|
|
workerScripts[i].env.stopFlag = true;
|
|
|
|
}
|
|
|
|
//Delete active scripts display elements
|
|
|
|
var list = Engine.ActiveScriptsList.querySelectorAll('#active-scripts-list li');
|
|
|
|
for (var i = list.length-1; i >= 0; --i) {
|
|
|
|
Engine.deleteActiveScriptsItem(i);
|
|
|
|
}
|
|
|
|
workerScripts.length = 0;
|
|
|
|
|
|
|
|
//Delete Hacknet Nodes
|
|
|
|
Player.hacknetNodes.length = 0;
|
|
|
|
|
2017-02-20 23:06:16 +01:00
|
|
|
//Delete Special Server IPs
|
|
|
|
for (var member in SpecialServerIps) {
|
|
|
|
delete SpecialServerIps[member];
|
|
|
|
}
|
|
|
|
SpecialServersIps = null;
|
|
|
|
|
|
|
|
//Delete Companies
|
|
|
|
for (var member in Companies) {
|
|
|
|
delete Companies[member];
|
|
|
|
}
|
|
|
|
Companies = {};
|
|
|
|
|
2017-05-05 23:27:35 +02:00
|
|
|
//Reset Factions
|
2017-02-20 23:06:16 +01:00
|
|
|
for (var member in Factions) {
|
2017-05-05 23:27:35 +02:00
|
|
|
Factions[member].reset();
|
2017-02-20 23:06:16 +01:00
|
|
|
}
|
|
|
|
|
2017-05-07 10:22:50 +02:00
|
|
|
//Re-initialize Augmentations - This will update any changes
|
|
|
|
initAugmentations();
|
|
|
|
|
2017-02-20 23:06:16 +01:00
|
|
|
//Inititialization
|
|
|
|
SpecialServerIps = new SpecialServerIpsMap();
|
|
|
|
initForeignServers();
|
|
|
|
initCompanies();
|
2017-05-05 03:08:44 +02:00
|
|
|
|
|
|
|
Engine.loadTerminalContent();
|
2017-02-20 23:06:16 +01:00
|
|
|
}
|