Added Prestiging

This commit is contained in:
Daniel Xie 2017-02-20 16:06:16 -06:00
parent 4a60874a3a
commit fa456c48b6
6 changed files with 380 additions and 123 deletions

@ -50,8 +50,6 @@ AddToAugmentations = function(aug) {
//TODO Set descriptions for all //TODO Set descriptions for all
//TODO Something that decreases RAM usage of scripts //TODO Something that decreases RAM usage of scripts
//TODO SOmething that increases rate at which you gain faction respect
// Similarly. something that helps you gain company reputation
initAugmentations = function() { initAugmentations = function() {
//Combat stat augmentations //Combat stat augmentations
var Targeting1 = new Augmentation("Augmented Targeting I"); var Targeting1 = new Augmentation("Augmented Targeting I");
@ -171,7 +169,7 @@ initAugmentations = function() {
ArtificialSynapticPotentiation.addToFactions("The Black Hand", "NiteSec"); ArtificialSynapticPotentiation.addToFactions("The Black Hand", "NiteSec");
AddToAugmentations(ArtificialSynapticPotentiation); AddToAugmentations(ArtificialSynapticPotentiation);
var EnhancedMyelinSheathing = new Augmentation("Enhanced Myelin Sheating"); var EnhancedMyelinSheathing = new Augmentation("Enhanced Myelin Sheathing");
EnhancedMyelinSheathing.setRequirements(900000, 850000000);) EnhancedMyelinSheathing.setRequirements(900000, 850000000);)
EnhancedMyelinSheating.addToFactions("Fulcrum Secret Technologies", "BitRunners", "The Black Hand"); EnhancedMyelinSheating.addToFactions("Fulcrum Secret Technologies", "BitRunners", "The Black Hand");
AddToAugmentations(EnhancedMyelinSheathing); AddToAugmentations(EnhancedMyelinSheathing);
@ -187,7 +185,7 @@ initAugmentations = function() {
AddToAugmentations(NeuralRetentionEnhancement); AddToAugmentations(NeuralRetentionEnhancement);
var DataJack = new Augmentation("DataJack"); var DataJack = new Augmentation("DataJack");
DataJack.setRequirements(750000, 750000000); DataJack.setRequirements(750000, 75000000);
DataJack.addToFactions("BitRunners", "The Black Hand", "NiteSec", "Chongqing", "New Tokyo"); DataJack.addToFactions("BitRunners", "The Black Hand", "NiteSec", "Chongqing", "New Tokyo");
AddToAugmentations(DataJack); AddToAugmentations(DataJack);
@ -294,141 +292,202 @@ applyAugmentation = function(aug, faction) {
switch(aug.name) { switch(aug.name) {
//Combat stat augmentations //Combat stat augmentations
case "Augmented Targeting I": case "Augmented Targeting I":
//Dex 5% Player.dexterity_mult *= 1.1;
break; break;
case "Augmented Targeting II": case "Augmented Targeting II":
//Dex 5% Player.dexterity_mult *= 1.2;
break; break;
case "Augmented Targeting III": case "Augmented Targeting III":
//Dex 5% Player.dexterity_mult *= 1.5;
break; break;
case "Synthetic Heart": case "Synthetic Heart": //High level
//Agi and Str - HIGH LEVEL Player.agility_mult *= 2.0;
Player.strength_mult *= 2.0;
break; break;
case "Synfibril Muscle": case "Synfibril Muscle": //Medium-high level
//Strength and Defense - MED HIGH LEVEL Player.strength_mult *= 1.5;
Player.defense_mult *= 1.5;
break; break;
case "Combat Rib I": case "Combat Rib I":
//Str and Defense 5% //Str and Defense 5%
Player.strength_mult *= 1.1;
Player.defense_mult *= 1.1;
break; break;
case "Combat Rib II": case "Combat Rib II":
Player.strength_mult *= 1.2;
Player.defense_mult *= 1.2;
break; break;
case "Combat Rib III": case "Combat Rib III":
Player.strength_mult *= 1.3;
Player.defense_mult *= 1.3;
break; break;
case "Nanofiber Weave": case "Nanofiber Weave": //Med level
//str + Defense - MED LEVEL Player.strength_mult *= 1.3;
Player.defense_mult *= 1.3;
break; break;
case "NEMEAN Subdermal Weave": case "NEMEAN Subdermal Weave": //High level
//Defense - HIGH LEVEL Player.defense_mult *= 2.5;
break; break;
case "Wired Reflexes": case "Wired Reflexes": //Low level
//Agility - Low level Player.agility_mult *= 1.05;
break; break;
case "Graphene Bone Lacings": case "Graphene Bone Lacings": //High level
//Strength defense - HIGH level Player.strength_mult *= 2;
Player.defense_mult *= 2;
break; break;
case "Bionic Spine": case "Bionic Spine": //Med level
//Everything - Medium level Player.strength_mult *= 1.2;
Player.defense_mult *= 1.2;
Player.agility_mult *= 1.2;
Player.dexterity_mult *= 1.2;
break; break;
case "Graphene Bionic Spine Upgrade": case "Graphene Bionic Spine Upgrade": //High level
//Everything - high level Player.strength_mult *= 2;
Player.defense_mult *= 2;
Player.agility_mult *= 2;
Player.dexterity_mult *= 2;
break; break;
case "Bionic Legs": case "Bionic Legs": //Med level
//Agi - Med level Player.agility_mult *= 1.5;
break; break;
case "Graphene Bionic Legs Upgrade": case "Graphene Bionic Legs Upgrade": //High level
//Agi - HIGH level player.agility_mult *= 3.0;
break; break;
//Labor stats augmentations //Labor stats augmentations
case "Enhanced Social Interaction Implant": case "Enhanced Social Interaction Implant": //Med-high level
//Charisma 10% - Med high level Player.charisma_mult *= 1.5;
Player.charisma_exp_mult *= 1.5;
break; break;
case "Speech Processor Implant": case "Speech Processor Implant": //Med level
//Charisma 5% - Med level Player.charisma_mult *= 1.2;
break; break;
//Hacking augmentations //Hacking augmentations
case "Artificial Bio-neural Network Implant": case "Artificial Bio-neural Network Implant": //Med level
//Hacking speed and money gained - MED Level Player.hacking_speed_mult *= .98;
Player.hacking_money_mult *= 1.1;
Player.hacking_mult *= 1.1;
break; break;
case "Artificial Synaptic Potentiation": case "Artificial Synaptic Potentiation": //Med level
//Hacking speed - MED Level Player.hacking_speed_mult *= .99;
Player.hacking_chance_mult *= 1.01;
break; break;
case "Enhanced Myelin Sheating": case "Enhanced Myelin Sheathing": //Med level
//Hacking speed and exp gain - MED Level Player.hacking_speed_mult *= .99;
Player.hacking_exp_mult *= 1.05;
Player.hacking_mult *= 1.05;
break; break;
case "Synaptic Enhancement Implant": case "Synaptic Enhancement Implant": //Low Level
//Hacking speed - LOw level Player.hacking_speed_mult *= .99;
break; break;
case "Neural-Retention Enhancement": case "Neural-Retention Enhancement": //Med level
//Gain 10% more hacking exp - med level Player.hacking_exp_mult *= 1.4;
break; break;
case "DataJack": case "DataJack": //Med low level
//5% more money from hacking - med low level Player.hacking_money_mult *= 1.2;
break; break;
case "Embedded Netburner Module": case "Embedded Netburner Module": //Medium level
//Doesn't give anyhting itself but allows user to install Player.hacking_mult *= 1.01;
//ENM upgrades in the future, which are very powerful
//Med level
break; break;
case "Embedded Netburner Module Core Implant": case "Embedded Netburner Module Core Implant": //Medium level
//Hacking speed, money gained, and exp gained - Med level Player.hacking_speed_mult *= .98;
Player.hacking_money_mult *= 1.1;
Player.hacking_chance_mult *= 1.02;
Player.hacking_exp_mult *= 1.1;
Player.hacking_mult *= 1.01;
break; break;
case "Embedded Netburner Module Core V2 Upgrade": case "Embedded Netburner Module Core V2 Upgrade": //Medium high level
//Hacking speed, money gained, and exp gained - Med High Level Player.hacking_speed_mult *= .95;
Player.hacking_money_mult *= 1.5;
Player.hacking_chance_mult *= 1.05;
Player.hacking_exp_mult *= 1.5;
Player.hacking_mult *= 1.05;
break; break;
case "Embedded Netburner Module Core V3 Upgrade": case "Embedded Netburner Module Core V3 Upgrade": //High level
//Hacking speed, money gained, and exp gained - High level Player.hacking_speed_mult *= .95;
Player.hacking_money_mult *= 1.5;
Player.hacking_chance_mult *= 1.1;
Player.hacking_exp_mult *= 2.0;
Player.hacking_mult *= 1.1;
break; break;
case "Embedded Netburner Module Analyze Engine": case "Embedded Netburner Module Analyze Engine": //High level
//Hacking speed 20% - High level //Hacking speed 20% - High level
Player.hacking_speed_mult *= 0.9;
break; break;
case "Embedded Netburner Module Direct Memory Access Upgrade": case "Embedded Netburner Module Direct Memory Access Upgrade": //High level
//Money hacked 20% - High level //Money hacked 20% - High level
Player.hacking_money_mult *= 1.5;
Player.hacking_chance_mult *= 1.2;
break; break;
case "Neuralstimulator": case "Neuralstimulator": //Medium Level
//Hacking speed, money gained, and exp gained - Med level Player.hacking_speed_mult *= .99;
break; Player.hacking_chance_mult *= 1.1;
case "PC Direct-Neural Interface NeuroNet Injector": Player.hacking_exp_mult *= 1.2;
//Hacking speed increases
break; break;
//Work augmentations //Work augmentations
case "Nuoptimal Nootropic Injector Implant": case "Nuoptimal Nootropic Injector Implant": //Low medium level
//Increase in gains for software, IT, and Business jobs - Low Med Level Player.company_rep_mult *= 1.1;
break; break;
case "Speech Enhancement": case "Speech Enhancement": //Low level
//Increase in business jobs and reputation gained - Low Level Player.company_rep_mult *= 1.05;
Player.charisma_mult *= 1.05;
break; break;
case "FocusWire": case "FocusWire": //Med level
//Increase in all gains and reputation gained - Med Level Player.hacking_exp_mult *= 1.1;
Player.strength_exp_mult *= 1.1;
Player.defense_exp_mult *= 1.1;
Player.dexterity_exp_mult *= 1.1;
Player.agility_exp_mult *= 1.1;
Player.charisma_exp_mult *= 1.1;
Player.company_rep_mult *= 1.05;
Player.work_money_mult *= 1.05;
break; break;
case "PC Direct-Neural Interface": case "PC Direct-Neural Interface": //Med level
//Allows people to directly communicate interface with PCs..which helps with Software and IT jobs Player.company_rep_mult *= 1.1;
//Med level Player.hacking_mult *= 1.1;
break; break;
case "PC Direct-Neural Interface Optimization Submodule": case "PC Direct-Neural Interface Optimization Submodule": //High level
//Allows u to better optimize code/pc when connecting with PC DNI..helps with software/IT jobs //Allows u to better optimize code/pc when connecting with PC DNI..helps with software/IT jobs
//High level Player.company_rep_mult *= 1.2;
Player.hacking_mult *= 1.2;
break; break;
case "PC Direct-Neural Interface NeuroNet Injector": case "PC Direct-Neural Interface NeuroNet Injector": //High level
//Allow you to use ur brain as aneural net on a computer lol...increases everything Player.company_rep_mult *= 1.1;
//High Level Player.hacking_mult *= 1.1;
Player.hacking_speed_mult *= .98;
break; break;
//Misc augmentations //Misc augmentations
case "Neurotrainer I": case "Neurotrainer I": //Low Level
//Increase all exp gains - Low level Player.hacking_exp_mult *= 1.05;
Player.strength_exp_mult *= 1.05;
Player.defense_exp_mult *= 1.05;
Player.dexterity_exp_mult *= 1.05;
Player.agility_exp_mult *= 1.05;
this.charisma_exp_mult *= 1.05;
break; break;
case "Neurotrainer II": case "Neurotrainer II": //Medium level
//Increase all exp gains - Med level Player.hacking_exp_mult *= 1.1;
Player.strength_exp_mult *= 1.1;
Player.defense_exp_mult *= 1.1;
Player.dexterity_exp_mult *= 1.1;
Player.agility_exp_mult *= 1.1;
Player.charisma_exp_mult *= 1.1;
break; break;
case "Neurotrainer III": case "Neurotrainer III": //High Level
//Increase all exp gains - High Level Player.hacking_exp_mult *= 1.2;
Player.strength_exp_mult *= 1.2;
Player.defense_exp_mult *= 1.2;
Player.dexterity_exp_mult *= 1.2;
Player.agility_exp_mult *= 1.2;
Player.charisma_exp_mult *= 1.2;
break; break;
case "HyperSight Corneal Implant": case "HyperSight Corneal Implant": //Medium high level
//Increases sight..which increases dex..hacking speed + money? - Med high level Player.dexterity_mult *= 1.5;
Player.hacking_speed_mult *= .99;
Player.hacking_money_mult *= 1.1;
break; break;
default: default:
@ -438,4 +497,6 @@ applyAugmentation = function(aug, faction) {
aug.owned = true; aug.owned = true;
aug.factionInstalledBy = faction.name; aug.factionInstalledBy = faction.name;
Player.augmentations.push(aug.name);
++Player.numAugmentations;
} }

@ -522,7 +522,7 @@ function apply_op(op, a, b) {
//The same as Player's calculateHackingChance() function but takes in the server as an argument //The same as Player's calculateHackingChance() function but takes in the server as an argument
function scriptCalculateHackingChance(server) { function scriptCalculateHackingChance(server) {
var difficultyMult = (100 - server.hackDifficulty) / 100; var difficultyMult = (100 - server.hackDifficulty) / 100;
var skillMult = (Player.hacking_chance_multiplier * Player.hacking_skill); var skillMult = (Player.hacking_chance_mult * Player.hacking_skill);
var skillChance = (skillMult - server.requiredHackingSkill) / skillMult; var skillChance = (skillMult - server.requiredHackingSkill) / skillMult;
return (skillChance * difficultyMult); return (skillChance * difficultyMult);
} }
@ -531,7 +531,7 @@ function scriptCalculateHackingChance(server) {
function scriptCalculateHackingTime(server) { function scriptCalculateHackingTime(server) {
var difficultyMult = server.requiredHackingSkill * server.hackDifficulty; var difficultyMult = server.requiredHackingSkill * server.hackDifficulty;
var skillFactor = (difficultyMult + 500) / (Player.hacking_skill + 50); var skillFactor = (difficultyMult + 500) / (Player.hacking_skill + 50);
var hackingTime = skillFactor * Player.hacking_speed_multiplier; //This is in seconds var hackingTime = skillFactor * Player.hacking_speed_mult; //This is in seconds
return hackingTime; return hackingTime;
} }
@ -544,7 +544,7 @@ function scriptCalculateExpGain(server) {
function scriptCalculatePercentMoneyHacked(server) { function scriptCalculatePercentMoneyHacked(server) {
var difficultyMult = (100 - server.hackDifficulty) / 100; var difficultyMult = (100 - server.hackDifficulty) / 100;
var skillMult = (Player.hacking_skill - (server.requiredHackingSkill - 1)) / Player.hacking_skill; var skillMult = (Player.hacking_skill - (server.requiredHackingSkill - 1)) / Player.hacking_skill;
var percentMoneyHacked = difficultyMult * skillMult * Player.hacking_money_multiplier; var percentMoneyHacked = difficultyMult * skillMult * Player.hacking_money_mult;
console.log("Percent money hacked calculated to be: " + percentMoneyHacked); console.log("Percent money hacked calculated to be: " + percentMoneyHacked);
return percentMoneyHacked; return percentMoneyHacked;
} }

@ -14,10 +14,10 @@ function PlayerObject() {
//Intelligence, perhaps? //Intelligence, perhaps?
//Hacking multipliers //Hacking multipliers
this.hacking_chance_multiplier = 2; //Increase through ascensions/augmentations this.hacking_chance_mult = 2; //Increase through ascensions/augmentations
//this.hacking_speed_multiplier = 5; //Decrease through ascensions/augmentations //this.hacking_speed_mult = 5; //Decrease through ascensions/augmentations
this.hacking_speed_multiplier = 1; //Make it faster for debugging this.hacking_speed_mult = 1; //Make it faster for debugging
this.hacking_money_multiplier = .001; //Increase through ascensions/augmentations. Can't go above 1 this.hacking_money_mult = .001; //Increase through ascensions/augmentations. Can't go above 1
//Note: "Lifetime" refers to current ascension, "total" refers to the entire game history //Note: "Lifetime" refers to current ascension, "total" refers to the entire game history
//Accumulative stats and skills //Accumulative stats and skills
@ -42,6 +42,13 @@ function PlayerObject() {
this.agility_exp = 0; this.agility_exp = 0;
this.charisma_exp = 0; this.charisma_exp = 0;
this.hacking_mult = 1;
this.strength_mult = 1;
this.defense_mult = 1;
this.dexterity_mult = 1;
this.agility_mult = 1;
this.charisma_mult = 1;
this.hacking_exp_mult = 1; this.hacking_exp_mult = 1;
this.strength_exp_mult = 1; this.strength_exp_mult = 1;
this.defense_exp_mult = 1; this.defense_exp_mult = 1;
@ -151,12 +158,12 @@ PlayerObject.prototype.calculateSkill = function(exp) {
PlayerObject.prototype.updateSkillLevels = function() { PlayerObject.prototype.updateSkillLevels = function() {
//TODO Account for total and lifetime stats for achievements and stuff //TODO Account for total and lifetime stats for achievements and stuff
this.hacking_skill = this.calculateSkill(this.hacking_exp); this.hacking_skill = Math.floor(this.calculateSkill(this.hacking_exp) * this.hacking_mult);
this.strength = this.calculateSkill(this.strength_exp); this.strength = Math.floor(this.calculateSkill(this.strength_exp) * this.strength_mult);
this.defense = this.calculateSkill(this.defense_exp); this.defense = Math.floor(this.calculateSkill(this.defense_exp) * this.defense_mult);
this.dexterity = this.calculateSkill(this.dexterity_exp); this.dexterity = Math.floor(this.calculateSkill(this.dexterity_exp) * this.dexterity_mult);
this.agility = this.calculateSkill(this.agility_exp); this.agility = Math.floor(this.calculateSkill(this.agility_exp) * this.agility_mult);
this.charisma = this.calculateSkill(this.charisma_exp); this.charisma = Math.floor(this.calculateSkill(this.charisma_exp) * this.charisma_mult);
} }
//Calculates the chance of hacking a server //Calculates the chance of hacking a server
@ -166,7 +173,7 @@ PlayerObject.prototype.updateSkillLevels = function() {
// (hacking_chance_multiplier * hacking_skill) 100 // (hacking_chance_multiplier * hacking_skill) 100
PlayerObject.prototype.calculateHackingChance = function() { PlayerObject.prototype.calculateHackingChance = function() {
var difficultyMult = (100 - this.getCurrentServer().hackDifficulty) / 100; var difficultyMult = (100 - this.getCurrentServer().hackDifficulty) / 100;
var skillMult = (this.hacking_chance_multiplier * this.hacking_skill); var skillMult = (this.hacking_chance_mult * this.hacking_skill);
var skillChance = (skillMult - this.getCurrentServer().requiredHackingSkill) / skillMult; var skillChance = (skillMult - this.getCurrentServer().requiredHackingSkill) / skillMult;
return (skillChance * difficultyMult); return (skillChance * difficultyMult);
} }
@ -179,7 +186,7 @@ PlayerObject.prototype.calculateHackingChance = function() {
PlayerObject.prototype.calculateHackingTime = function() { PlayerObject.prototype.calculateHackingTime = function() {
var difficultyMult = this.getCurrentServer().requiredHackingSkill * this.getCurrentServer().hackDifficulty; var difficultyMult = this.getCurrentServer().requiredHackingSkill * this.getCurrentServer().hackDifficulty;
var skillFactor = (difficultyMult + 500) / (this.hacking_skill + 100); var skillFactor = (difficultyMult + 500) / (this.hacking_skill + 100);
return skillFactor * this.hacking_speed_multiplier; return skillFactor * this.hacking_speed_mult;
} }
//Calculates the PERCENTAGE of a server's money that the player will hack from the server if successful //Calculates the PERCENTAGE of a server's money that the player will hack from the server if successful
@ -190,7 +197,7 @@ PlayerObject.prototype.calculateHackingTime = function() {
PlayerObject.prototype.calculatePercentMoneyHacked = function() { PlayerObject.prototype.calculatePercentMoneyHacked = function() {
var difficultyMult = (100 - this.getCurrentServer().hackDifficulty) / 100; var difficultyMult = (100 - this.getCurrentServer().hackDifficulty) / 100;
var skillMult = (this.hacking_skill - (this.getCurrentServer().requiredHackingSkill - 1)) / this.hacking_skill; var skillMult = (this.hacking_skill - (this.getCurrentServer().requiredHackingSkill - 1)) / this.hacking_skill;
var percentMoneyHacked = difficultyMult * skillMult * this.hacking_money_multiplier; var percentMoneyHacked = difficultyMult * skillMult * this.hacking_money_mult;
console.log("Percent money hacked calculated to be: " + percentMoneyHacked); console.log("Percent money hacked calculated to be: " + percentMoneyHacked);
return percentMoneyHacked; return percentMoneyHacked;
} }
@ -384,20 +391,20 @@ PlayerObject.prototype.finishFactionWork = function(cancelled, faction) {
var faction = Factions[this.currentWorkFactionName]; var faction = Factions[this.currentWorkFactionName];
faction.playerReputation += (this.workRepGained); faction.playerReputation += (this.workRepGained);
this.gainMoney(this.workMoneyGained / cancMult); this.gainMoney(this.workMoneyGained);
this.updateSkillLevels(); this.updateSkillLevels();
var txt = "You worked for your faction " + faction.name + " for a total of " + convertTimeMsToTimeElapsedString(this.timeWorked) + " <br><br> " + var txt = "You worked for your faction " + faction.name + " for a total of " + convertTimeMsToTimeElapsedString(this.timeWorked) + " <br><br> " +
"You earned a total of: <br>" + "You earned a total of: <br>" +
"$" + (this.workMoneyGained / cancMult).toFixed(2) + "<br>" + "$" + (this.workMoneyGained).toFixed(2) + "<br>" +
(this.workRepGained / cancMult).toFixed(3) + " reputation for the company <br>" + (this.workRepGained).toFixed(3) + " reputation for the company <br>" +
(this.workHackExpGained / cancMult).toFixed(3) + " hacking exp <br>" + (this.workHackExpGained).toFixed(3) + " hacking exp <br>" +
(this.workStrExpGained / cancMult).toFixed(3) + " strength exp <br>" + (this.workStrExpGained).toFixed(3) + " strength exp <br>" +
(this.workDefExpGained / cancMult).toFixed(3) + " defense exp <br>" + (this.workDefExpGained).toFixed(3) + " defense exp <br>" +
(this.workDexExpGained / cancMult).toFixed(3) + " dexterity exp <br>" + (this.workDexExpGained).toFixed(3) + " dexterity exp <br>" +
(this.workAgiExpGained / cancMult).toFixed(3) + " agility exp <br>" + (this.workAgiExpGained).toFixed(3) + " agility exp <br>" +
(this.workChaExpGained / cancMult).toFixed(3) + " charisma exp<br>"; (this.workChaExpGained).toFixed(3) + " charisma exp<br>";
dialogBoxCreate(txt); dialogBoxCreate(txt);
var mainMenu = document.getElementById("mainmenu-container"); var mainMenu = document.getElementById("mainmenu-container");

110
src/Prestige.js Normal file

@ -0,0 +1,110 @@
/* Prestige functions */
//Prestige by purchasing augmentation
function prestigeAugmentation() {
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;
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 = 0;
Player.homeComputer = "";
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 = "";
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 servers
for (var member in AllServers) {
delete AllServers[member];
}
AllServers = {};
//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 = {};
//Delete Factions
for (var member in Factions) {
delete Factions[member];
}
Factions = {};
//Inititialization
SpecialServerIps = new SpecialServerIpsMap();
Player.init();
initForeignServers();
initCompanies();
initFactions();
CompanyPositions.init();
}

@ -77,12 +77,14 @@ var Engine = {
var CompaniesSave = JSON.stringify(Companies); var CompaniesSave = JSON.stringify(Companies);
var FactionsSave = JSON.stringify(Factions); var FactionsSave = JSON.stringify(Factions);
var SpecialServerIpsSave = JSON.stringify(SpecialServerIps); var SpecialServerIpsSave = JSON.stringify(SpecialServerIps);
var AugmentationsSave = JSON.stringify(Augmentations);
window.localStorage.setItem("netburnerPlayerSave", PlayerSave); window.localStorage.setItem("netburnerPlayerSave", PlayerSave);
window.localStorage.setItem("netburnerAllServersSave", AllServersSave); window.localStorage.setItem("netburnerAllServersSave", AllServersSave);
window.localStorage.setItem("netburnerCompaniesSave", CompaniesSave); window.localStorage.setItem("netburnerCompaniesSave", CompaniesSave);
window.localStorage.setItem("netburnerFactionsSave", FactionsSave); window.localStorage.setItem("netburnerFactionsSave", FactionsSave);
window.localStorage.setItem("netburnerSpecialServerIpsSave", SpecialServerIpsSave); window.localStorage.setItem("netburnerSpecialServerIpsSave", SpecialServerIpsSave);
window.localStorage.setItem("netburnerAugmentationsSave", AugmentationsSave);
console.log("Game saved to local storage"); console.log("Game saved to local storage");
}, },
@ -105,18 +107,23 @@ var Engine = {
} else if (!window.localStorage.getItem("netburnerSpecialServerIpsSave")) { } else if (!window.localStorage.getItem("netburnerSpecialServerIpsSave")) {
console.log("No Special Server Ips save to load"); console.log("No Special Server Ips save to load");
return false; return false;
} else if (!window.localStorage.getItem("netburnerAugmentationsSave")) {
console.log("No Augmentations save to load");
return false;
} else { } else {
var PlayerSave = window.localStorage.getItem("netburnerPlayerSave"); var PlayerSave = window.localStorage.getItem("netburnerPlayerSave");
var AllServersSave = window.localStorage.getItem("netburnerAllServersSave"); var AllServersSave = window.localStorage.getItem("netburnerAllServersSave");
var CompaniesSave = window.localStorage.getItem("netburnerCompaniesSave"); var CompaniesSave = window.localStorage.getItem("netburnerCompaniesSave");
var FactionsSave = window.localStorage.getItem("netburnerFactionsSave"); var FactionsSave = window.localStorage.getItem("netburnerFactionsSave");
var SpecialServerIpsSave = window.localStorage.getItem("netburnerSpecialServerIpsSave"); var SpecialServerIpsSave = window.localStorage.getItem("netburnerSpecialServerIpsSave");
var AugmentationsSave = window.localStorage.getItem("netburnerAugmentationsSave");
Player = JSON.parse(PlayerSave, Reviver); Player = JSON.parse(PlayerSave, Reviver);
AllServers = JSON.parse(AllServersSave, Reviver); AllServers = JSON.parse(AllServersSave, Reviver);
Companies = JSON.parse(CompaniesSave, Reviver); Companies = JSON.parse(CompaniesSave, Reviver);
Factions = JSON.parse(FactionsSave, Reviver); Factions = JSON.parse(FactionsSave, Reviver);
SpecialServerIps = JSON.parse(SpecialServerIpsSave, Reviver); SpecialServerIps = JSON.parse(SpecialServerIpsSave, Reviver);
Augmentations = JSON.parse(AugmentationsSave, Reviver);
return true; return true;
} }
}, },
@ -144,6 +151,10 @@ var Engine = {
if (window.localStorage.getItem("netburnerSpecialServerIpsSave")) { if (window.localStorage.getItem("netburnerSpecialServerIpsSave")) {
window.localStorage.removeItem("netburnerSpecialServerIpsSave"); window.localStorage.removeItem("netburnerSpecialServerIpsSave");
} }
if (window.localStorage.getItem("netburnerAugmentationsSave")) {
window.localStorage.removeItem("netburnerAugmentationsSave");
}
}, },
/* Load content when a main menu button is clicked */ /* Load content when a main menu button is clicked */
@ -274,20 +285,20 @@ var Engine = {
Engine.Display.characterInfo.innerHTML = 'Current City: ' + Player.city + '<br><br>' + Engine.Display.characterInfo.innerHTML = 'Current City: ' + Player.city + '<br><br>' +
'Employer: ' + Player.companyName + '<br><br>' + 'Employer: ' + Player.companyName + '<br><br>' +
'Job Title: ' + companyPosition + '<br><br><br><br>' + 'Job Title: ' + companyPosition + '<br><br><br><br>' +
'Money: $' + Player.money.toFixed(2) + '<br><br>' + 'Money: $' + (Player.money.toFixed(2)).toLocaleString() + '<br><br>' +
'Hacking Level: ' + Player.hacking_skill + '<br><br>' + 'Hacking Level: ' + (Player.hacking_skill).toLocaleString() + '<br><br>' +
'Strength: ' + Player.strength + '<br><br>' + 'Strength: ' + (Player.strength.toLocaleString() + '<br><br>' +
'Defense: ' + Player.defense + '<br><br>' + 'Defense: ' + (Player.defense).toLocaleString() + '<br><br>' +
'Dexterity: ' + Player.dexterity + '<br><br>' + 'Dexterity: ' + (Player.dexterity).toLocaleString() + '<br><br>' +
'Agility: ' + Player.agility + '<br><br>' + 'Agility: ' + (Player.agility).toLocaleString() + '<br><br>' +
'Charisma: ' + Player.charisma + '<br><br>' + 'Charisma: ' + (Player.charisma).toLocaleString() + '<br><br>' +
'Servers owned: ' + Player.purchasedServers.length + '<br><br>' + 'Servers owned: ' + Player.purchasedServers.length + '<br><br>' +
'Hacking experience: ' + Player.hacking_exp.toFixed(4) + '<br><br>' + 'Hacking experience: ' + (Player.hacking_exp.toFixed(4)).toLocaleString() + '<br><br>' +
'Strength experience: ' + Player.strength_exp.toFixed(4) + '<br><br>' + 'Strength experience: ' + (Player.strength_exp.toFixed(4)).toLocaleString() + '<br><br>' +
'Defense experience: ' + Player.defense_exp.toFixed(4) + '<br><br>' + 'Defense experience: ' + (Player.defense_exp.toFixed(4)).toLocaleString() + '<br><br>' +
'Dexterity experience: ' + Player.dexterity_exp.toFixed(4) + '<br><br>' + 'Dexterity experience: ' + (Player.dexterity_exp.toFixed(4)).toLocaleString() + '<br><br>' +
'Agility experience: ' + Player.agility_exp.toFixed(4) + '<br><br>' + 'Agility experience: ' + (Player.agility_exp.toFixed(4)).toLocaleString() + '<br><br>' +
'Charisma experience: ' + Player.charisma_exp.toFixed(4) + '<br><br>'; 'Charisma experience: ' + (Player.charisma_exp.toFixed(4)).toLocaleString() + '<br><br>';
}, },
/* Display locations in the world*/ /* Display locations in the world*/
@ -709,7 +720,7 @@ var Engine = {
initCompanies(); initCompanies();
initFactions(); initFactions();
CompanyPositions.init(); CompanyPositions.init();
initAugmentations();
} }
//Message at the top of terminal //Message at the top of terminal

@ -40,7 +40,75 @@ purchaseAugmentationBoxCreate = function(aug, fac) {
confirmButton.parentNode.replaceChild(newConfirmButton, confirmButton); confirmButton.parentNode.replaceChild(newConfirmButton, confirmButton);
newConfirmButton.addEventListener("click", function() { newConfirmButton.addEventListener("click", function() {
if (Player.money >= (aug.baseCost * fac.augmentationPriceMult)) {
//TODO Requirements for specific augmentations (e.g Embedded Netburner Module b4 its upgrades)
if (aug.name == "Augmented Targeting II") {
var targeting1 = Augmentations["Augmented Targeting I"];
if (targeting1 == null) {
console.log("ERROR: Could not find Augmented Targeting I");
return;
}
if (targeting1.owned == false) {
dialogBoxCreate("You must first install Augmented Targeting I before you can upgrade it to Augmented Targeting II");
}
} else if (aug.name == "Augmented Targeting III") {
var targeting2 = Augmentations["Augmented Targeting II"];
if (targeting2 == null) {
console.log("ERROR: Could not find Augmented Targeting II");
return;
}
if (targeting2.owned == false) {
dialogBoxCreate("You must first install Augmented Targeting II before you can upgrade it to Augmented Targeting III");
}
} else if (aug.name == "Combat Rib II") {
var combatRib1 = Augmentations["Combat Rib I"];
if (combatRib1 == null) {
console.log("ERROR: Could not find Combat Rib I");
return;
}
if (combatRib1.owned == false) {
dialogBoxCreate("You must first install Combat Rib I before you can upgrade it to Combat Rib II");
}
} else if (aug.name == "Combat Rib III") {
var combatRib2 = Augmentations["Combat Rib II"];
if (combatRib2 == null) {
console.log("ERROR: Could not find Combat Rib II");
return;
}
if (combatRib2.owned == false) {
dialogBoxCreate("You must first install Combat Rib II before you can upgrade it to Combat Rib III");
}
} else if (aug.name == "Embedded Netburner Module Core V2 Upgrade") {
var coreImplant = Augmentations["Embedded Netburner Module Core Implant"];
if (coreImplant == null) {
console.log("ERROR: Could not find ENM Core Implant");
return;
}
if (coreImplant.owned == false) {
dialogBoxCreate("You must first install Embedded Netburner Module Core Implant before you can upgrade it to V2");
}
} else if (aug.name == "Embedded Netburner Module Core V3 Upgrade") {
var v2Upgrade = Augmentations["Embedded Netburner Module Core V2 Upgrade"];
if (v2Upgrade == null) {
console.log("ERROR: Could not find ENM Core V2 upgrade");
return;
}
if (v2Upgrade.owned == false) {
dialogBoxCreate("you must first install Embedded Netburner Module Core V2 Upgrade before you can upgrade it to V3");
}
} else if (aug.name == "Embedded Netburner Module Core Implant" ||
aug.name == "Embedded Netburner Module Analyze Engine" ||
aug.name == "Embedded Netburner Module Direct Memory Access Upgrade") {
var enm = Augmentations["Embedded Netburner Module"];
if (enm == null) {
console.log("ERROR: Could not find ENM");
return;
}
if (enm.owned == false) {
dialogBoxCreate("You must first install the Embedded Netburner Module before installing any upgrades to it");
}
} else if (Player.money >= (aug.baseCost * fac.augmentationPriceMult)) {
applyAugmentation(aug, fac); applyAugmentation(aug, fac);
//TODO Make this text better //TODO Make this text better
dialogBoxCreate("You slowly drift to sleep as " + fac.name + "'s scientists put you under <br>" + dialogBoxCreate("You slowly drift to sleep as " + fac.name + "'s scientists put you under <br>" +