From f2287b56965856dea710016979999dede5d3d8a1 Mon Sep 17 00:00:00 2001 From: Daniel Xie Date: Wed, 10 May 2017 12:42:46 -0500 Subject: [PATCH] Lots of changes, didn't keep track ofthem all --- css/menupages.css | 1 + index.html | 26 ++- src/Augmentations.js | 36 ++-- src/Company.js | 174 +++++++++++----- src/CompanyJobApplication.js | 36 +++- src/Constants.js | 19 +- src/Crimes.js | 2 +- src/Faction.js | 26 ++- src/FactionInfo.js | 22 +- src/HacknetNode.js | 25 ++- src/Location.js | 361 ++++++++++++++++++++------------- src/Netscript/Evaluator.js | 2 + src/Player.js | 176 ++++++++++++---- src/Prestige.js | 11 + src/Script.js | 57 ++++-- src/Server.js | 2 +- utils/JSONReviver.js | 1 + utils/PurchaseRamForHomeBox.js | 9 +- utils/PurchaseServerBox.js | 3 - 19 files changed, 668 insertions(+), 321 deletions(-) diff --git a/css/menupages.css b/css/menupages.css index 5d216f55d..9b2045289 100644 --- a/css/menupages.css +++ b/css/menupages.css @@ -315,6 +315,7 @@ div.faction-clear { margin-left: 10%; width: 99%; color: #66ff33; + overflow-y: scroll; } #augmentations-list li { diff --git a/index.html b/index.html index 6a6dc67eb..885066301 100644 --- a/index.html +++ b/index.html @@ -523,14 +523,18 @@ Apply for Software Job + Apply for Software Consultant Job Apply for IT Job Apply for Security Engineer Job Apply for Network Engineer Job Apply for Business Job + Apply for Business Consultant Job Apply for Security Job Apply to be an Agent Apply to be an Employee + Apply to be a Part-time Employee Apply to be a Waiter + Apply to be a Part-time Waiter Work @@ -549,17 +553,17 @@ Take Leadership course - Purchase 1GB Server - $50,000 - Purchase 2GB Server - $100,000 - Purchase 4GB Server - $250,000 - Purchase 8GB Server - $1,000,000 - Purchase 16GB Server - $4,000,000 - Purchase 32GB Server - $10,000,000 - Purchase 64GB Server - $20,000,000 - Purchase 128GB Server - $50,000,000 - Purchase 256GB Server - $100,000,000 - Purchase 512GB Server - $250,000,000 - Purchase 1TB Server - $750,000,000 + Purchase 1GB Server - $75,000 + Purchase 2GB Server - $150,000 + Purchase 4GB Server - $300,000 + Purchase 8GB Server - $600,000 + Purchase 16GB Server - $1,200,000 + Purchase 32GB Server - $2,400,000 + Purchase 64GB Server - $4,800,000 + Purchase 128GB Server - $9,600,000 + Purchase 256GB Server - $19,200,000 + Purchase 512GB Server - $38,400,000 + Purchase 1TB Server - $75,000,000 Purchase TOR Router - $100,000 Purchase RAM for Home computer diff --git a/src/Augmentations.js b/src/Augmentations.js index 777059f72..cfcb7128a 100644 --- a/src/Augmentations.js +++ b/src/Augmentations.js @@ -11,7 +11,7 @@ function Augmentation(name) { //Level - Only applicable for some augmentations // NeuroFlux Governor - this.level = 1; + this.level = 0; } Augmentation.prototype.setInfo = function(inf) { @@ -686,7 +686,7 @@ initAugmentations = function() { var ADRPheromone1 = new Augmentation(AugmentationNames.ADRPheromone1); ADRPheromone1.setRequirements(1500, 2000000); ADRPheromone1.setInfo("The body is genetically re-engineered so that it produces the ADR-V1 pheromone, " + - "an artificial pheromone discovered by scientists. The ADR-V1 pheromone, when excreted " + + "an artificial pheromone discovered by scientists. The ADR-V1 pheromone, when excreted, " + "triggers feelings of admiration and approval in other people.

" + "This augmentation:
" + "Increases the amount of reputation the player gains when working for a company by 10%
" + @@ -776,27 +776,23 @@ initAugmentations = function() { var oldAug = Augmentations[AugmentationNames.NeuroFluxGovernor]; NeuroFluxGovernor.owned = oldAug.owned; NeuroFluxGovernor.level = oldAug.level; - var mult = 1; - if (NeuroFluxGovernor.level > 1) { - mult = Math.pow(CONSTANTS.NeuroFluxGovernorLevelMult, NeuroFluxGovernor.level-1); - } + mult = Math.pow(CONSTANTS.NeuroFluxGovernorLevelMult, NeuroFluxGovernor.level); NeuroFluxGovernor.setRequirements(1000 * mult, 1000000 * mult); delete Augmentations[AugmentationNames.NeuroFluxGovernor]; } else { - NeuroFluxGovernor.setRequirements(1000, 1000000); - NeuroFluxGovernor.level = 1; + NeuroFluxGovernor.setRequirements(750, 1000000); } NeuroFluxGovernor.setInfo("A device that is embedded in the back of the neck. The NeuroFlux Governor " + "monitors and regulates nervous impulses coming to and from the spinal column, " + "essentially 'governing' the body. By doing so, it improves the functionality of the " + "body's nervous system.

" + - "This is a special augmentation because it can be leveled up. Each level of this augmentation " + - "increases all of the player's stats by 0.5%.") + "This is a special augmentation because it can be leveled up infinitely. Each level of this augmentation " + + "increases all of the player's stats and experience gains by 0.5%.") NeuroFluxGovernor.addToAllFactions(); AddToAugmentations(NeuroFluxGovernor); var Neurotrainer1 = new Augmentation(AugmentationNames.Neurotrainer1); - Neurotrainer1.setRequirements(1000, 750000); + Neurotrainer1.setRequirements(500, 750000); Neurotrainer1.setInfo("A decentralized cranial implant that improves the brain's ability to learn. It is " + "installed by releasing millions of nanobots into the human brain, each of which " + "attaches to a different neural pathway to enhance the brain's ability to retain " + @@ -1061,12 +1057,18 @@ applyAugmentation = function(aug, faction) { //Misc augmentations case AugmentationNames.NeuroFluxGovernor: - Player.hacking_mult *= 1.005; - Player.strength_mult *= 1.005; - Player.defense_mult *= 1.005; - Player.dexterity_mult *= 1.005; - Player.agility_mult *= 1.005; - Player.charisma_mult *= 1.005; + Player.hacking_mult *= 1.005; + Player.strength_mult *= 1.005; + Player.defense_mult *= 1.005; + Player.dexterity_mult *= 1.005; + Player.agility_mult *= 1.005; + Player.charisma_mult *= 1.005; + Player.hacking_exp_mult *= 1.005; + Player.strength_exp_mult *= 1.005; + Player.defense_exp_mult *= 1.005; + Player.dexterity_exp_mult *= 1.005; + Player.agility_exp_mult *= 1.005; + Player.charisma_exp_mult *= 1.005; ++aug.level; break; case AugmentationNames.Neurotrainer1: //Low Level diff --git a/src/Company.js b/src/Company.js index ee8c4062e..862fcd197 100644 --- a/src/Company.js +++ b/src/Company.js @@ -189,6 +189,26 @@ CompanyPosition.prototype.isAgentJob = function() { return false; } +CompanyPosition.prototype.isSoftwareConsultantJob = function() { + if (this.positionName == "Software Consultant" || + this.positionName == "Senior Software Consultant") {return true;} + return false; +} + +CompanyPosition.prototype.isBusinessConsultantJob = function() { + if (this.positionName == "Business Consultant" || + this.positionName == "Senior Business Consultant") {return true;} + return false; +} + +CompanyPosition.prototype.isPartTimeJob = function() { + if (this.isSoftwareConsultantJob() || + this.isBusinessConsultantJob() || + this.positionName == "Part-time Waiter" || + this.positionName == "Part-time Employee") {return true;} + return false; +} + CompanyPosition.prototype.toJSON = function() { return Generic_toJSON("CompanyPosition", this); } @@ -203,46 +223,58 @@ CompanyPositions = { //Constructor: CompanyPosition(name, reqHack, reqStr, reqDef, reqDex, reqAgi, reqCha, reqRep, salary) //Software - SoftwareIntern: new CompanyPosition("Software Engineering Intern", 1, 0, 0, 0, 0, 0, 0, 1.2), - JuniorDev: new CompanyPosition("Junior Software Engineer", 51, 0, 0, 0, 0, 0, 8000, 6), - SeniorDev: new CompanyPosition("Senior Software Engineer", 251, 0, 0, 0, 0, 51, 32000, 15), - LeadDev: new CompanyPosition("Lead Software Developer", 401, 0, 0, 0, 0, 151, 144000, 20), + SoftwareIntern: new CompanyPosition("Software Engineering Intern", 1, 0, 0, 0, 0, 0, 0, 2), + JuniorDev: new CompanyPosition("Junior Software Engineer", 51, 0, 0, 0, 0, 0, 8000, 10), + SeniorDev: new CompanyPosition("Senior Software Engineer", 251, 0, 0, 0, 0, 51, 32000, 40), + LeadDev: new CompanyPosition("Lead Software Developer", 401, 0, 0, 0, 0, 151, 144000, 120), + + //TODO Through darkweb, maybe? + FreelanceDeveloper: new CompanyPosition("Freelance Developer", 0, 0, 0, 0, 0, 0, 0, 0), + + SoftwareConsultant: new CompanyPosition("Software Consultant", 51, 0, 0, 0, 0, 0, 0, 8), + SeniorSoftwareConsultant: new CompanyPosition("Senior Software Consultant", 251, 0, 0, 0, 0, 51, 0, 32), //IT - ITIntern: new CompanyPosition("IT Intern", 1, 0, 0, 0, 0, 0, 0, 1), - ITAnalyst: new CompanyPosition("IT Analyst", 26, 0, 0, 0, 0, 0, 6000, 4), - ITManager: new CompanyPosition("IT Manager", 151, 0, 0, 0, 0, 51, 24000, 14), - SysAdmin: new CompanyPosition("Systems Administrator", 251, 0, 0, 0, 0, 76, 120000, 14), - SecurityEngineer: new CompanyPosition("Security Engineer", 151, 0, 0, 0, 0, 26, 28000, 12), - NetworkEngineer: new CompanyPosition("Network Engineer", 151, 0, 0, 0, 0, 26, 28000, 12), - NetworkAdministrator: new CompanyPosition("Network Administrator", 251, 0, 0, 0, 0, 76, 120000, 15), + ITIntern: new CompanyPosition("IT Intern", 1, 0, 0, 0, 0, 0, 0, 1.75), + ITAnalyst: new CompanyPosition("IT Analyst", 26, 0, 0, 0, 0, 0, 6000, 7.5), + ITManager: new CompanyPosition("IT Manager", 151, 0, 0, 0, 0, 51, 24000, 35), + SysAdmin: new CompanyPosition("Systems Administrator", 251, 0, 0, 0, 0, 76, 120000, 100), + SecurityEngineer: new CompanyPosition("Security Engineer", 151, 0, 0, 0, 0, 26, 28000, 35), + NetworkEngineer: new CompanyPosition("Network Engineer", 151, 0, 0, 0, 0, 26, 28000, 35), + NetworkAdministrator: new CompanyPosition("Network Administrator", 251, 0, 0, 0, 0, 76, 120000, 100), //Technology management - HeadOfSoftware: new CompanyPosition("Head of Software", 501, 0, 0, 0, 0, 251, 288000, 35), - HeadOfEngineering: new CompanyPosition("Head of Engineering", 501, 0, 0, 0, 0, 251, 576000, 40), - VicePresident: new CompanyPosition("Vice President of Technology", 601, 0, 0, 0, 0, 401, 1152000, 45), - CTO: new CompanyPosition("Chief Technology Officer", 751, 0, 0, 0, 0, 501, 4608000, 50), + HeadOfSoftware: new CompanyPosition("Head of Software", 501, 0, 0, 0, 0, 251, 288000, 250), + HeadOfEngineering: new CompanyPosition("Head of Engineering", 501, 0, 0, 0, 0, 251, 576000, 400), + VicePresident: new CompanyPosition("Vice President of Technology", 601, 0, 0, 0, 0, 401, 1152000, 600), + CTO: new CompanyPosition("Chief Technology Officer", 751, 0, 0, 0, 0, 501, 4608000, 750), //Business - BusinessIntern: new CompanyPosition("Business Intern", 1, 0, 0, 0, 0, 1, 0, 1.2), - BusinessAnalyst: new CompanyPosition("Business Analyst", 6, 0, 0, 0, 0, 51, 8000, 10), - BusinessManager: new CompanyPosition("Business Manager", 51, 0, 0, 0, 0, 101, 32000, 18), - OperationsManager: new CompanyPosition("Operations Manager", 51, 0, 0, 0, 0, 201, 144000, 22), - CFO: new CompanyPosition("Chief Financial Officer", 76, 0, 0, 0, 0, 501, 576000, 50), - CEO: new CompanyPosition("Chief Executive Officer", 101, 0, 0, 0, 0, 751, 4608000, 100), + BusinessIntern: new CompanyPosition("Business Intern", 1, 0, 0, 0, 0, 1, 0, 2.5), + BusinessAnalyst: new CompanyPosition("Business Analyst", 6, 0, 0, 0, 0, 51, 8000, 15), + BusinessManager: new CompanyPosition("Business Manager", 51, 0, 0, 0, 0, 101, 32000, 60), + OperationsManager: new CompanyPosition("Operations Manager", 51, 0, 0, 0, 0, 226, 144000, 180), + CFO: new CompanyPosition("Chief Financial Officer", 76, 0, 0, 0, 0, 501, 576000, 600), + CEO: new CompanyPosition("Chief Executive Officer", 101, 0, 0, 0, 0, 751, 4608000, 1000), + + BusinessConsultant: new CompanyPosition("Business Consultant", 6, 0, 0, 0, 0, 51, 0, 12), + SeniorBusinessConsultant: new CompanyPosition("Senior Business Consultant", 51, 0, 0, 0, 0, 226, 0, 150), //Non-tech/management jobs - Waiter: new CompanyPosition("Waiter", 0, 0, 0, 0, 0, 0, 0, .75), - Employee: new CompanyPosition("Employee", 0, 0, 0, 0, 0, 0, 0, .75), - PoliceOfficer: new CompanyPosition("Police Officer", 11, 101, 101, 101, 101, 51, 8000, 5), - PoliceChief: new CompanyPosition("Police Chief", 101, 301, 301, 301, 301, 151, 32000, 12), - SecurityGuard: new CompanyPosition("Security Guard", 0, 51, 51, 51, 51, 1, 0, 4), - SecurityOfficer: new CompanyPosition("Security Officer", 26, 151, 151, 151, 151, 51, 8000, 8), - SecuritySupervisor: new CompanyPosition("Security Supervisor", 26, 251, 251, 251, 251, 101, 32000, 15), - HeadOfSecurity: new CompanyPosition("Head of Security", 51, 501, 501, 501, 501, 151, 144000, 22), - FieldAgent: new CompanyPosition("Field Agent", 101, 101, 101, 101, 101, 101, 8000, 6), - SecretAgent: new CompanyPosition("Secret Agent", 201, 251, 251, 251, 251, 32000, 15), - SpecialOperative: new CompanyPosition("Special Operative", 251, 501, 501, 501, 501, 144000, 25), + PartTimeWaiter: new CompanyPosition("Part-time Waiter", 0, 0, 0, 0, 0, 0, 0, 1.5), + PartTimeEmployee: new CompanyPosition("Part-time Employee", 0, 0, 0, 0, 0, 0, 0, 1.5), + + Waiter: new CompanyPosition("Waiter", 0, 0, 0, 0, 0, 0, 0, 2), + Employee: new CompanyPosition("Employee", 0, 0, 0, 0, 0, 0, 0, 2), + PoliceOfficer: new CompanyPosition("Police Officer", 11, 101, 101, 101, 101, 51, 8000, 25), + PoliceChief: new CompanyPosition("Police Chief", 101, 301, 301, 301, 301, 151, 32000, 100), + SecurityGuard: new CompanyPosition("Security Guard", 0, 51, 51, 51, 51, 1, 0, 10), + SecurityOfficer: new CompanyPosition("Security Officer", 26, 151, 151, 151, 151, 51, 8000, 40), + SecuritySupervisor: new CompanyPosition("Security Supervisor", 26, 251, 251, 251, 251, 101, 32000, 80), + HeadOfSecurity: new CompanyPosition("Head of Security", 51, 501, 501, 501, 501, 151, 144000, 250), + FieldAgent: new CompanyPosition("Field Agent", 101, 101, 101, 101, 101, 101, 8000, 30), + SecretAgent: new CompanyPosition("Secret Agent", 201, 251, 251, 251, 251, 32000, 120), + SpecialOperative: new CompanyPosition("Special Operative", 251, 501, 501, 501, 501, 144000, 300), init: function() { //Argument order: hack, str, def, dex, agi, cha @@ -256,6 +288,11 @@ CompanyPositions = { CompanyPositions.LeadDev.setPerformanceParameters(70, 0, 0, 0, 0, 30); CompanyPositions.LeadDev.setExperienceGains(.5, 0, 0, 0, 0, .1); + CompanyPositions.SoftwareConsultant.setPerformanceParameters(80, 0, 0, 0, 0, 20); + CompanyPositions.SoftwareConsultant.setExperienceGains(.175, 0, 0, 0, 0, .03); + CompanyPositions.SeniorSoftwareConsultant.setPerformanceParameters(75, 0, 0, 0, 0, 25); + CompanyPositions.SeniorSoftwareConsultant.setExperienceGains(.35, 0, 0, 0, 0, .06); + //Security CompanyPositions.ITIntern.setPerformanceParameters(90, 0, 0, 0, 0, 10); CompanyPositions.ITIntern.setExperienceGains(.05, 0, 0, 0, 0, .01); @@ -296,12 +333,21 @@ CompanyPositions = { CompanyPositions.CEO.setPerformanceParameters(10, 0, 0, 0, 0, 90); CompanyPositions.CEO.setExperienceGains(.1, 0, 0, 0, 0, 1.5); + CompanyPositions.BusinessConsultant.setPerformanceParameters(20, 0, 0, 0, 0, 80); + CompanyPositions.BusinessConsultant.setExperienceGains(.015, 0, 0, 0, 0, .15); + CompanyPositions.SeniorBusinessConsultant.setPerformanceParameters(15, 0, 0, 0, 0, 85); + CompanyPositions.SeniorBusinessConsultant.setExperienceGains(.015, 0, 0, 0, 0, .3); + //Non-tech/management jobs - //TODO These parameters might need to be balanced + CompanyPositions.PartTimeWaiter.setPerformanceParameters(0, 10, 0, 10, 10, 70); + CompanyPositions.PartTimeWaiter.setExperienceGains(0, .0075, .0075, .0075, .0075, .04); + CompanyPositions.PartTimeEmployee.setPerformanceParameters(0, 10, 0, 10, 10, 70); + CompanyPositions.PartTimeEmployee.setExperienceGains(0, .0075, .0075, .0075, .0075, .03); + CompanyPositions.Waiter.setPerformanceParameters(0, 10, 0, 10, 10, 70); CompanyPositions.Waiter.setExperienceGains(0, .01, .01, .01, .01, .05); CompanyPositions.Employee.setPerformanceParameters(0, 10, 0, 10, 10, 70); - CompanyPositions.Employee.setExperienceGains(0, .01, .01, .01, .01, .015); + CompanyPositions.Employee.setExperienceGains(0, .01, .01, .01, .01, .04); CompanyPositions.SecurityGuard.setPerformanceParameters(5, 20, 20, 20, 20, 15); CompanyPositions.SecurityGuard.setExperienceGains(.01, .02, .02, .02, .02, .01); CompanyPositions.PoliceOfficer.setPerformanceParameters(5, 20, 20, 20, 20, 15); @@ -340,6 +386,11 @@ getNextCompanyPosition = function(currPos) { return CompanyPositions.HeadOfSoftware; } + //Software Consultant + if (currPos.positionName == CompanyPositions.SoftwareConsultant.positionName) { + return CompanyPositions.SeniorSoftwareConsultant; + } + //IT if (currPos.positionName == CompanyPositions.ITIntern.positionName) { return CompanyPositions.ITAnalyst; @@ -393,6 +444,11 @@ getNextCompanyPosition = function(currPos) { return CompanyPositions.CEO; } + //Business consultant + if (currPos.positionName == CompanyPositions.BusinessConsultant.positionName) { + return CompanyPositions.SeniorBusinessConsultant; + } + //Police if (currPos.positionName == CompanyPositions.PoliceOffier.positionName) { return CompanyPositions.PoliceChief; @@ -420,7 +476,7 @@ getNextCompanyPosition = function(currPos) { return null; } -/* Initialize all companies. Only called when creating new game. Otherwise companies are +/* Initialize all companies. Only called when creating new game/prestiging. Otherwise companies are * usually loaded from localStorage */ initCompanies = function() { /* Companies that also have servers */ @@ -570,6 +626,7 @@ initCompanies = function() { StormTechnologies.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev, + CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant, CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware, CompanyPositions.HeadOfEngineering, @@ -582,7 +639,8 @@ initCompanies = function() { DefComm.init(Locations.NewTokyoDefComm, 1.75, 1.75, 199); DefComm.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, - CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, + CompanyPositions.LeadDev, CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant, + CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware, CompanyPositions.HeadOfEngineering, CompanyPositions.CTO, CompanyPositions.CFO, CompanyPositions.CEO]); @@ -592,7 +650,8 @@ initCompanies = function() { HeliosLabs.init(Locations.VolhavenHeliosLabs, 1.8, 1.8, 199); HeliosLabs.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, - CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, + CompanyPositions.LeadDev, CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant, + CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware, CompanyPositions.HeadOfEngineering, CompanyPositions.CTO, CompanyPositions.CFO, CompanyPositions.CEO]); @@ -602,7 +661,8 @@ initCompanies = function() { VitaLife.init(Locations.NewTokyoVitaLife, 1.8, 1.8, 199); VitaLife.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, - CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, + CompanyPositions.LeadDev, CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant, + CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware, CompanyPositions.HeadOfEngineering, CompanyPositions.CTO, CompanyPositions.BusinessManager, @@ -613,7 +673,8 @@ initCompanies = function() { IcarusMicrosystems.init(Locations.Sector12IcarusMicrosystems, 1.9, 1.9, 199); IcarusMicrosystems.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, - CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, + CompanyPositions.LeadDev, CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant, + CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware, CompanyPositions.HeadOfEngineering, CompanyPositions.CTO, CompanyPositions.BusinessManager, @@ -624,7 +685,8 @@ initCompanies = function() { UniversalEnergy.init(Locations.Sector12UniversalEnergy, 2.0, 2.0, 199); UniversalEnergy.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, - CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, + CompanyPositions.LeadDev, CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant, + CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware, CompanyPositions.HeadOfEngineering, CompanyPositions.CTO, CompanyPositions.BusinessManager, @@ -635,7 +697,8 @@ initCompanies = function() { GalacticCybersystems.init(Locations.AevumGalacticCybersystems, 1.9, 1.9, 199); GalacticCybersystems.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, - CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, + CompanyPositions.LeadDev, CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant, + CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware, CompanyPositions.HeadOfEngineering, CompanyPositions.CTO, CompanyPositions.BusinessManager, @@ -701,6 +764,7 @@ initCompanies = function() { GlobalPharmaceuticals.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev, + CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant, CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware, CompanyPositions.CTO, CompanyPositions.BusinessAnalyst, @@ -714,6 +778,7 @@ initCompanies = function() { NovaMedical.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev, + CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant, CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware, CompanyPositions.CTO, CompanyPositions.BusinessAnalyst, @@ -751,7 +816,8 @@ initCompanies = function() { WatchdogSecurity.init(Locations.AevumWatchdogSecurity, 1.5, 1.5, 124); WatchdogSecurity.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, - CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, + CompanyPositions.LeadDev, CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant, + CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware, CompanyPositions.HeadOfEngineering, CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer, @@ -764,7 +830,8 @@ initCompanies = function() { LexoCorp.init(Locations.VolhavenLexoCorp, 1.4, 1.4, 99); LexoCorp.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, - CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, + CompanyPositions.LeadDev, CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant, + CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.HeadOfSoftware, CompanyPositions.CTO, CompanyPositions.BusinessIntern, CompanyPositions.BusinessAnalyst, @@ -784,7 +851,8 @@ initCompanies = function() { AlphaEnterprises.init(Locations.Sector12AlphaEnterprises, 1.5, 1.5, 99); AlphaEnterprises.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, - CompanyPositions.LeadDev, CompanyPositions.BusinessIntern, CompanyPositions.BusinessAnalyst, + CompanyPositions.LeadDev, CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant, + CompanyPositions.BusinessIntern, CompanyPositions.BusinessAnalyst, CompanyPositions.BusinessManager, CompanyPositions.OperationsManager]); AddToCompanies(AlphaEnterprises); @@ -809,7 +877,8 @@ initCompanies = function() { CompuTek.init(Locations.VolhavenCompuTek, 1.2, 1.2, 74); CompuTek.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, - CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, + CompanyPositions.LeadDev, CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant, + CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware, CompanyPositions.CTO]); @@ -819,7 +888,8 @@ initCompanies = function() { NetLinkTechnologies.init(Locations.AevumNetLinkTechnologies, 1.2, 1.2, 99); NetLinkTechnologies.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, - CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, + CompanyPositions.LeadDev, CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant, + CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware, CompanyPositions.CTO]); @@ -829,7 +899,8 @@ initCompanies = function() { CarmichaelSecurity.init(Locations.Sector12CarmichaelSecurity, 1.2, 1.2, 74); CarmichaelSecurity.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, - CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, + CompanyPositions.LeadDev, CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant, + CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware, CompanyPositions.HeadOfEngineering, CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer, @@ -840,26 +911,27 @@ initCompanies = function() { //"Low level" companies var FoodNStuff = new Company(); FoodNStuff.init(Locations.Sector12FoodNStuff, 1, 1, 0); - FoodNStuff.addPositions([CompanyPositions.Employee]); + FoodNStuff.addPositions([CompanyPositions.Employee, CompanyPositions.PartTimeEmployee]); AddToCompanies(FoodNStuff); var JoesGuns = new Company(); JoesGuns.init(Locations.Sector12JoesGuns, 1, 1, 0); - JoesGuns.addPositions([CompanyPositions.Employee]); + JoesGuns.addPositions([CompanyPositions.Employee, CompanyPositions.PartTimeEmployee]); AddToCompanies(JoesGuns); var OmegaSoftware = new Company(); OmegaSoftware.init(Locations.IshimaOmegaSoftware, 1.1, 1.1, 49); OmegaSoftware.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, - CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, + CompanyPositions.LeadDev, CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant, + CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.CTO, CompanyPositions.CEO]); AddToCompanies(OmegaSoftware); /* Companies that do not have servers */ var NoodleBar = new Company(); NoodleBar.init(Locations.NewTokyoNoodleBar, 1, 1, 0); - NoodleBar.addPositions([CompanyPositions.Waiter]); + NoodleBar.addPositions([CompanyPositions.Waiter, CompanyPositions.PartTimeWaiter]); AddToCompanies(NoodleBar); } diff --git a/src/CompanyJobApplication.js b/src/CompanyJobApplication.js index 2cbbd03b6..78802352c 100644 --- a/src/CompanyJobApplication.js +++ b/src/CompanyJobApplication.js @@ -125,6 +125,10 @@ PlayerObject.prototype.applyForSoftwareJob = function() { this.applyForJob(CompanyPositions.SoftwareIntern); } +PlayerObject.prototype.applyForSoftwareConsultantJob = function() { + this.applyForJob(CompanyPositions.SoftwareConsultant); +} + PlayerObject.prototype.applyForItJob = function() { this.applyForJob(CompanyPositions.ITIntern); } @@ -154,6 +158,10 @@ PlayerObject.prototype.applyForBusinessJob = function() { this.applyForJob(CompanyPositions.BusinessIntern); } +PlayerObject.prototype.applyForBusinessConsultantJob = function() { + this.applyForJob(CompanyPositions.BusinessConsultant); +} + PlayerObject.prototype.applyForSecurityJob = function() { //TODO If case for POlice departments this.applyForJob(CompanyPositions.SecurityGuard); @@ -173,7 +181,19 @@ PlayerObject.prototype.applyForEmployeeJob = function() { if (this.isQualified(company, CompanyPositions.Employee)) { this.companyName = company.companyName; this.companyPosition = CompanyPositions.Employee; - dialogBoxCreate("Congratulations, you are now employed at ", this.companyName, "", ""); + dialogBoxCreate("Congratulations, you are now employed at " + this.companyName); + Engine.loadLocationContent(); + } else { + dialogBoxCreate("Unforunately, you do not qualify for this position"); + } +} + +PlayerObject.prototype.applyForPartTimeEmployeeJob = function() { + var company = Companies[this.location]; //Company being applied to + if (this.isQualified(company, CompanyPositions.PartTimeEmployee)) { + this.companyName = company.companyName; + this.companyPosition = CompanyPositions.PartTimeEmployee; + dialogBoxCreate("Congratulations, you are now employed part-time at " + this.companyName); Engine.loadLocationContent(); } else { dialogBoxCreate("Unforunately, you do not qualify for this position"); @@ -185,7 +205,19 @@ PlayerObject.prototype.applyForWaiterJob = function() { if (this.isQualified(company, CompanyPositions.Waiter)) { this.companyName = company.companyName; this.companyPosition = CompanyPositions.Waiter; - dialogBoxCreate("Congratulations, you are now employed as a waiter at ", this.companyName, "", ""); + dialogBoxCreate("Congratulations, you are now employed as a waiter at " + this.companyName); + Engine.loadLocationContent(); + } else { + dialogBoxCreate("Unforunately, you do not qualify for this position"); + } +} + +PlayerObject.prototype.applyForPartTimeWaiterJob = function() { + var company = Companies[this.location]; //Company being applied to + if (this.isQualified(company, CompanyPositions.PartTimeWaiter)) { + this.companyName = company.companyName; + this.companyPosition = CompanyPositions.PartTimeWaiter; + dialogBoxCreate("Congratulations, you are now employed as a part-time waiter at " + this.companyName); Engine.loadLocationContent(); } else { dialogBoxCreate("Unforunately, you do not qualify for this position"); diff --git a/src/Constants.js b/src/Constants.js index 096c8861e..d25209afa 100644 --- a/src/Constants.js +++ b/src/Constants.js @@ -10,21 +10,23 @@ CONSTANTS = { CorpFactionRepRequirement: 250000, /* Base costs */ - BaseCostFor1GBOfRam: 50000, //1 GB of RAM + BaseCostFor1GBOfRamHome: 100000, + BaseCostFor1GBOfRamServer: 75000, //1 GB of RAM + BaseCostFor1GBOfRamHacknetNode: 50000, BaseCostForHacknetNode: 1000, BaseCostForHacknetNodeCore: 1000000, /* Hacknet Node constants */ - HacknetNodeMoneyGainPerLevel: 0.75, + HacknetNodeMoneyGainPerLevel: 1, HacknetNodePurchaseNextMult: 1.35, //Multiplier when purchasing an additional hacknet node HacknetNodeUpgradeLevelMult: 1.06, //Multiplier for cost when upgrading level - HacknetNodeUpgradeRamMult: 1.15, //Multiplier for cost when upgrading RAM + HacknetNodeUpgradeRamMult: 1.25, //Multiplier for cost when upgrading RAM HacknetNodeUpgradeCoreMult: 1.45, //Multiplier for cost when buying another core /* Augmentation */ //NeuroFlux Governor cost multiplier as you level up - NeuroFluxGovernorLevelMult: 1.08, + NeuroFluxGovernorLevelMult: 1.09, /* Script related things */ //Time (ms) it takes to run one operation in Netscript. @@ -71,6 +73,7 @@ CONSTANTS = { FactionWorkSecurity: "Faction Security Work", WorkTypeCompany: "Working for Company", + WorkTypeCompanyPartTime: "Working for Company part-time", WorkTypeFaction: "Working for Faction", WorkTypeCreateProgram: "Working on Create a Program", WorkTypeStudyClass: "Studying or Taking a class at university", @@ -82,12 +85,17 @@ CONSTANTS = { ClassAlgorithms: "taking an Algorithms course", ClassManagement: "taking a Management course", ClassLeadership: "taking a Leadership course", + ClassGymStrength: "training your strength at a gym", + ClassGymDefense: "training your defense at a gym", + ClassGymDexterity: "training your dexterity at a gym", + ClassGymAgility: "training your agility at a gym", ClassDataStructuresBaseCost: 1, ClassNetworksBaseCost: 5, ClassAlgorithmsBaseCost: 20, ClassManagementBaseCost: 10, ClassLeadershipBaseCost: 20, + ClassGymBaseCost: 15, CrimeShoplift: "shoplift", CrimeMug: "mug someone", @@ -298,8 +306,7 @@ CONSTANTS = { "Company/faction reputation
" + "Jobs and Faction memberships
" + "Programs
" + - "TOR router
" + - "Gym memberships

" + + "TOR router

" + "Here is everything you will KEEP when you install an Augmentation:

" + "Every Augmentation you have installed
" + "Scripts on your home computer
" + diff --git a/src/Crimes.js b/src/Crimes.js index ac5f776fe..c6c846c9a 100644 --- a/src/Crimes.js +++ b/src/Crimes.js @@ -26,7 +26,7 @@ function commitHomicideCrime() { function commitGrandTheftAutoCrime() { Player.crimeType = CONSTANTS.CrimeGrandTheftAuto; - Player.startCrime(8, 8, 8, 40, 20, 150000, 80000); //$1875/2, .1 exp/s, .5 exp/s, .25 exp/s + Player.startCrime(0, 8, 8, 8, 40, 20, 150000, 80000); //$1875/2, .1 exp/s, .5 exp/s, .25 exp/s } function commitKidnapCrime() { diff --git a/src/Faction.js b/src/Faction.js index 7e06a74a5..2219e0a81 100644 --- a/src/Faction.js +++ b/src/Faction.js @@ -309,42 +309,42 @@ PlayerObject.prototype.checkForFactionInvitations = function() { //Chongqing var chongqingFac = Factions["Chongqing"]; if (chongqingFac.isBanned == false && chongqingFac.isMember == false && - this.money >= 20000000 && this.location == Locations.Chongqing) { + this.money >= 20000000 && this.city == Locations.Chongqing) { invitedFactions.push(chongqingFac); } //Sector-12 var sector12Fac = Factions["Sector-12"]; if (sector12Fac.isBanned == false && sector12Fac.isMember == false && - this.money >= 15000000 && this.location == Locations.Sector12) { + this.money >= 15000000 && this.city == Locations.Sector12) { invitedFactions.push(sector12Fac); } //New Tokyo var newtokyoFac = Factions["New Tokyo"]; if (newtokyoFac.isBanned == false && newtokyoFac.isMember == false && - this.money >= 20000000 && this.location == Locations.NewTokyo) { + this.money >= 20000000 && this.city == Locations.NewTokyo) { invitedFactions.push(newtokyoFac); } //Aevum var aevumFac = Factions["Aevum"]; if (aevumFac.isBanned == false && aevumFac.isMember == false && - this.money >= 40000000 && this.location == Locations.Aevum) { + this.money >= 40000000 && this.city == Locations.Aevum) { invitedFactions.push(aevumFac); } //Ishima var ishimaFac = Factions["Ishima"]; if (ishimaFac.isBanned == false && ishimaFac.isMember == false && - this.money >= 30000000 && this.location == Locations.Ishima) { + this.money >= 30000000 && this.city == Locations.Ishima) { invitedFactions.push(ishimaFac); } //Volhaven var volhavenFac = Factions["Volhaven"]; if (volhavenFac.isBanned == false && volhavenFac.isMember == false && - this.money >= 50000000 && this.location == Locations.Volhaven) { + this.money >= 50000000 && this.city == Locations.Volhaven) { invitedFactions.push(volhavenFac); } @@ -362,7 +362,7 @@ PlayerObject.prototype.checkForFactionInvitations = function() { var thedarkarmyFac = Factions["The Dark Army"]; if (thedarkarmyFac.isBanned == false && thedarkarmyFac.isMember == false && this.hacking_skill >= 300 && this.strength >= 300 && this.defense >= 300 && - this.dexterity >= 300 && this.agility >= 300 && this.location == Locations.Chongqing && + this.dexterity >= 300 && this.agility >= 300 && this.city == Locations.Chongqing && this.numPeopleKilled >= 5 && this.karma <= -50 && this.companyName != Locations.Sector12CIA && this.companyName != Locations.Sector12NSA) { invitedFactions.push(thedarkarmyFac); @@ -373,7 +373,7 @@ PlayerObject.prototype.checkForFactionInvitations = function() { if (thesyndicateFac.isBanned == false && thesyndicateFac.isMember == false && this.hacking_skill >= 200 && this.strength >= 200 && this.defense >= 200 && this.dexterity >= 200 && this.agility >= 200 && - (this.location == Locations.Aevum || this.location == Locations.Sector12) && + (this.city == Locations.Aevum || this.city == Locations.Sector12) && this.money >= 10000000 && this.karma <= -100 && this.companyName != Locations.Sector12CIA && this.companyName != Locations.Sector12NSA) { invitedFactions.push(thesyndicateFac); @@ -406,11 +406,13 @@ PlayerObject.prototype.checkForFactionInvitations = function() { } //Tian Di Hui + console.log("here"); var tiandihuiFac = Factions["Tian Di Hui"]; if (tiandihuiFac.isBanned == false && tiandihuiFac.isMember == false && this.money >= 1000000 && this.hacking_skill >= 50 && - (this.location == Locations.Chongqing || this.location == Locations.NewTokyo || - this.location == Locations.Ishima)) { + (this.city == Locations.Chongqing || this.city == Locations.NewTokyo || + this.city == Locations.Ishima)) { + console.log("invited"); invitedFactions.push(tiandihuiFac); } @@ -748,7 +750,7 @@ displayFactionAugmentations = function(factionName) { aElem.setAttribute("class", "a-link-button-inactive"); pElem.innerHTML = "ALREADY OWNED"; } else if (faction.playerReputation >= req) { - aElem.setAttribute("class", "a-link-button"); + aElem.setAttribute("class", "a-link-button tooltip"); pElem.innerHTML = "UNLOCKED - $" + formatNumber(aug.baseCost * faction.augmentationPriceMult, 2); } else { aElem.setAttribute("class", "a-link-button-inactive"); @@ -762,6 +764,8 @@ displayFactionAugmentations = function(factionName) { aElem.innerHTML += " - Level " + (aug.level + 1); } + aElem.innerHTML += "" + aug.info + " "; + aElem.addEventListener("click", function() { purchaseAugmentationBoxCreate(aug, faction); }); diff --git a/src/FactionInfo.js b/src/FactionInfo.js index 1974931b7..4f2941715 100644 --- a/src/FactionInfo.js +++ b/src/FactionInfo.js @@ -2,17 +2,17 @@ //of each faction FactionInfo = { //Endgame - IlluminatiInfo: "Humanity never changes. No matter how civilized society becomes, it will eventually fall back\n" + - "into chaos. And out of this chaos, we will lead them to order.\n" + + IlluminatiInfo: "Humanity never changes. No matter how civilized society becomes, it will eventually fall back " + + "into chaos. And out of this chaos, we will lead them to order.

" + "We are the Invisible Hand. We are forever.", - DaedalusInfo: "If all of human \n" + - "history is but a single lesson, it is that the individual may be remembered, but the organization \n" + - "persists and thrives. A single artist, a single general, a single hero or a single villain may all die,\n" + - "but it is impossible to kill a people, a nation, an idea -- except when that idea has grown weak and is \n" + - "overpowered by one that is stronger. -- The Doctrine of the Mighty\n\n" + - "Surrender yourself. Give up your empty individuality to become part of something great, something eternal.\n" + - "Become a slave. Submit your mind, body, and soul. Only then can you set yourself free.\n\n" + + DaedalusInfo: "If all of human " + + "history is but a single lesson, it is that the individual may be remembered, but the organization " + + "persists and thrives. A single artist, a single general, a single hero or a single villain may all die, " + + "but it is impossible to kill a people, a nation, an idea -- except when that idea has grown weak and is " + + "overpowered by one that is stronger. -- The Doctrine of the Mighty

" + + "Surrender yourself. Give up your empty individuality to become part of something great, something eternal. " + + "Become a slave. Submit your mind, body, and soul. Only then can you set yourself free.

" + "Only then can you discover immortality.", CovenantInfo: "Yesterday we obeyed kings and bent our necks to emperors. Today we kneel only to truth.", @@ -25,7 +25,7 @@ FactionInfo = { MegaCorpInfo: "MegaCorp does things that others don't. We imagine. We create. We invent. We build things that\n" + "others have never even dreamed of. Our work fills the world's needs for food, water, power, and\n" + "transporation on an unprecendented scale, in ways that no other company can.\n\n" + - "In its labs and factories and on the ground with customers, MegaCorp is ushering in a new era for the world.", + "In our labs and factories and on the ground with customers, MegaCorp is ushering in a new era for the world.", BachmanAndAssociatesInfo: "TODO", @@ -115,7 +115,7 @@ FactionInfo = { //Earlygame factions - factions the player will prestige with early on that don't //belong in other categories - NetburnersInfo: "~~HACKNET BURNERS~~", + NetburnersInfo: "~~//*>?>\\~~", TianDiHuiInfo: "Obey Heaven and Work Righteousness", CyberSecInfo: "The Internet is the first thing that humanity has built that humanity doesn’t understand,\n" + diff --git a/src/HacknetNode.js b/src/HacknetNode.js index dac43e46e..89e38c991 100644 --- a/src/HacknetNode.js +++ b/src/HacknetNode.js @@ -16,13 +16,15 @@ HacknetNode.prototype.updateMoneyGainRate = function() { //How much extra $/s is gained per level var gainPerLevel = CONSTANTS.HacknetNodeMoneyGainPerLevel; - //Each CPU core doubles the speed. Every 1GB of ram adds 10% increase + //Each CPU core doubles the speed. Every 1GB of ram adds 20% increase this.moneyGainRatePerSecond = (this.level * gainPerLevel) * - Math.pow(1.1, this.ram-1) * + Math.pow(1.2, this.ram-1) * this.numCores * Player.hacknet_node_money_mult; if (isNaN(this.moneyGainRatePerSecond)) { throw new Error("Money gain rate calculated for Hacknet Node is NaN"); } + + updateTotalHacknetProduction(); } HacknetNode.prototype.calculateLevelUpgradeCost = function() { @@ -46,7 +48,7 @@ HacknetNode.prototype.calculateRamUpgradeCost = function() { //Calculate cost //Base cost of RAM is 50k per 1GB...but lets have this increase by 10% for every time //the RAM has been upgraded - var cost = this.ram * CONSTANTS.BaseCostFor1GBOfRam; + var cost = this.ram * CONSTANTS.BaseCostFor1GBOfRamHacknetNode; var mult = Math.pow(CONSTANTS.HacknetNodeUpgradeRamMult, numUpgrades); return cost * mult * Player.hacknet_node_ram_cost_mult; } @@ -116,6 +118,16 @@ purchaseHacknet = function() { Player.hacknetNodes.push(node); displayHacknetNodesContent(); + updateTotalHacknetProduction(); +} + +//Calculates the total production from all HacknetNodes +updateTotalHacknetProduction = function() { + var total = 0; + for (var i = 0; i < Player.hacknetNodes.length; ++i) { + total += Player.hacknetNodes[i].moneyGainRatePerSecond; + } + Player.totalHacknetNodeProduction = total; } getCostOfNextHacknetNode = function() { @@ -129,9 +141,6 @@ getCostOfNextHacknetNode = function() { displayHacknetNodesContent = function() { //Update Hacknet Nodes button var newPurchaseButton = clearEventListeners("hacknet-nodes-purchase-button"); - //var purchaseButton = document.getElementById("hacknet-nodes-purchase-button"); - //var newPurchaseButton = purchaseButton.cloneNode(true); - //purchaseButton.parentNode.replaceChild(newPurchaseButton, purchaseButton); newPurchaseButton.addEventListener("click", function() { purchaseHacknet(); @@ -164,7 +173,9 @@ updateHacknetNodesContent = function() { } //Update player's money - document.getElementById("hacknet-nodes-money").innerHTML = "Money: $" + formatNumber(Player.money, 2); + var moneyElem = document.getElementById("hacknet-nodes-money"); + moneyElem.innerHTML = "Money: $" + formatNumber(Player.money, 2) + "
" + + "Total production from all Hacknet Nodes: $" + formatNumber(Player.totalHacknetNodeProduction, 2); //Update information in each owned hacknet node for (var i = 0; i < Player.hacknetNodes.length; ++i) { diff --git a/src/Location.js b/src/Location.js index 7afeb32e0..22ca01c89 100644 --- a/src/Location.js +++ b/src/Location.js @@ -87,71 +87,75 @@ displayLocationContent = function() { console.log("displayLocationContent() called with location " + Player.location) } - var returnToWorld = document.getElementById("location-return-to-world-button"); + var returnToWorld = document.getElementById("location-return-to-world-button"); - var locationName = document.getElementById("location-name"); + var locationName = document.getElementById("location-name"); - var locationInfo = document.getElementById("location-info"); + var locationInfo = document.getElementById("location-info"); - var softwareJob = document.getElementById("location-software-job"); - var itJob = document.getElementById("location-it-job"); - var securityEngineerJob = document.getElementById("location-security-engineer-job"); - var networkEngineerJob = document.getElementById("location-network-engineer-job"); - var businessJob = document.getElementById("location-business-job"); - var securityJob = document.getElementById("location-security-job"); - var agentJob = document.getElementById("location-agent-job"); - var employeeJob = document.getElementById("location-employee-job"); - var waiterJob = document.getElementById("location-waiter-job"); - - var work = document.getElementById("location-work"); - - var jobTitle = document.getElementById("location-job-title"); - var jobReputation = document.getElementById("location-job-reputation"); - - var gymTrainStr = document.getElementById("location-gym-train-str"); - var gymTrainDef = document.getElementById("location-gym-train-def"); - var gymTrainDex = document.getElementById("location-gym-train-dex"); - var gymTrainAgi = document.getElementById("location-gym-train-agi"); + var softwareJob = document.getElementById("location-software-job"); + var softwareConsultantJob = document.getElementById("location-software-consultant-job") + var itJob = document.getElementById("location-it-job"); + var securityEngineerJob = document.getElementById("location-security-engineer-job"); + var networkEngineerJob = document.getElementById("location-network-engineer-job"); + var businessJob = document.getElementById("location-business-job"); + var businessConsultantJob = document.getElementById("location-business-consultant-job"); + var securityJob = document.getElementById("location-security-job"); + var agentJob = document.getElementById("location-agent-job"); + var employeeJob = document.getElementById("location-employee-job"); + var employeePartTimeJob = document.getElementById("location-parttime-employee-job"); + var waiterJob = document.getElementById("location-waiter-job"); + var waiterPartTimeJob = document.getElementById("location-parttime-waiter-job"); - var studyComputerScience= document.getElementById("location-study-computer-science"); - var classDataStructures = document.getElementById("location-data-structures-class"); - var classNetworks = document.getElementById("location-networks-class"); - var classAlgorithms = document.getElementById("location-algorithms-class"); - var classManagement = document.getElementById("location-management-class"); - var classLeadership = document.getElementById("location-leadership-class"); - - var purchase1gb = document.getElementById("location-purchase-1gb"); - var purchase2gb = document.getElementById("location-purchase-2gb"); - var purchase4gb = document.getElementById("location-purchase-4gb"); - var purchase8gb = document.getElementById("location-purchase-8gb"); - var purchase16gb = document.getElementById("location-purchase-16gb"); - var purchase32gb = document.getElementById("location-purchase-32gb"); - var purchase64gb = document.getElementById("location-purchase-64gb"); - var purchase128gb = document.getElementById("location-purchase-128gb"); - var purchase256gb = document.getElementById("location-purchase-256gb"); - var purchase512gb = document.getElementById("location-purchase-512gb"); - var purchase1tb = document.getElementById("location-purchase-1tb"); - var purchaseTor = document.getElementById("location-purchase-tor"); - var purchaseHomeRam = document.getElementById("location-purchase-home-ram"); - - var travelAgencyText = document.getElementById("location-travel-agency-text"); - var travelToAevum = document.getElementById("location-travel-to-aevum"); - var travelToChongqing = document.getElementById("location-travel-to-chongqing"); - var travelToSector12 = document.getElementById("location-travel-to-sector12"); - var travelToNewTokyo = document.getElementById("location-travel-to-newtokyo"); - var travelToIshima = document.getElementById("location-travel-to-ishima"); - var travelToVolhaven = document.getElementById("location-travel-to-volhaven"); - - var slumsDescText = document.getElementById("location-slums-description"); - var slumsShoplift = document.getElementById("location-slums-shoplift"); - var slumsMug = document.getElementById("location-slums-mug"); - var slumsDealDrugs = document.getElementById("location-slums-deal-drugs"); - var slumsTrafficArms = document.getElementById("location-slums-traffic-arms"); - var slumsHomicide = document.getElementById("location-slums-homicide"); - var slumsGta = document.getElementById("location-slums-gta"); - var slumsKidnap = document.getElementById("location-slums-kidnap"); - var slumsAssassinate = document.getElementById("location-slums-assassinate"); - var slumsHeist = document.getElementById("location-slums-heist"); + var work = clearEventListeners("location-work"); + + var jobTitle = document.getElementById("location-job-title"); + var jobReputation = document.getElementById("location-job-reputation"); + + var gymTrainStr = document.getElementById("location-gym-train-str"); + var gymTrainDef = document.getElementById("location-gym-train-def"); + var gymTrainDex = document.getElementById("location-gym-train-dex"); + var gymTrainAgi = document.getElementById("location-gym-train-agi"); + + var studyComputerScience = document.getElementById("location-study-computer-science"); + var classDataStructures = document.getElementById("location-data-structures-class"); + var classNetworks = document.getElementById("location-networks-class"); + var classAlgorithms = document.getElementById("location-algorithms-class"); + var classManagement = document.getElementById("location-management-class"); + var classLeadership = document.getElementById("location-leadership-class"); + + var purchase1gb = document.getElementById("location-purchase-1gb"); + var purchase2gb = document.getElementById("location-purchase-2gb"); + var purchase4gb = document.getElementById("location-purchase-4gb"); + var purchase8gb = document.getElementById("location-purchase-8gb"); + var purchase16gb = document.getElementById("location-purchase-16gb"); + var purchase32gb = document.getElementById("location-purchase-32gb"); + var purchase64gb = document.getElementById("location-purchase-64gb"); + var purchase128gb = document.getElementById("location-purchase-128gb"); + var purchase256gb = document.getElementById("location-purchase-256gb"); + var purchase512gb = document.getElementById("location-purchase-512gb"); + var purchase1tb = document.getElementById("location-purchase-1tb"); + var purchaseTor = document.getElementById("location-purchase-tor"); + var purchaseHomeRam = document.getElementById("location-purchase-home-ram"); + + var travelAgencyText = document.getElementById("location-travel-agency-text"); + var travelToAevum = document.getElementById("location-travel-to-aevum"); + var travelToChongqing = document.getElementById("location-travel-to-chongqing"); + var travelToSector12 = document.getElementById("location-travel-to-sector12"); + var travelToNewTokyo = document.getElementById("location-travel-to-newtokyo"); + var travelToIshima = document.getElementById("location-travel-to-ishima"); + var travelToVolhaven = document.getElementById("location-travel-to-volhaven"); + + var slumsDescText = document.getElementById("location-slums-description"); + var slumsShoplift = document.getElementById("location-slums-shoplift"); + var slumsMug = document.getElementById("location-slums-mug"); + var slumsDealDrugs = document.getElementById("location-slums-deal-drugs"); + var slumsTrafficArms = document.getElementById("location-slums-traffic-arms"); + var slumsHomicide = document.getElementById("location-slums-homicide"); + var slumsGta = document.getElementById("location-slums-gta"); + var slumsKidnap = document.getElementById("location-slums-kidnap"); + var slumsAssassinate = document.getElementById("location-slums-assassinate"); + var slumsHeist = document.getElementById("location-slums-heist"); var loc = Player.location; @@ -165,14 +169,18 @@ displayLocationContent = function() { locationInfo.style.display = "block"; softwareJob.style.display = "none"; + softwareConsultantJob.style.display = "none"; itJob.style.display = "none"; securityEngineerJob.style.display = "none"; networkEngineerJob.style.display = "none"; businessJob.style.display = "none"; + businessConsultantJob.style.display = "none"; securityJob.style.display = "none"; agentJob.style.display = "none"; employeeJob.style.display = "none"; + employeePartTimeJob.style.display = "none"; waiterJob.style.display = "none"; + waiterPartTimeJob.style.display = "none"; softwareJob.innerHTML = "Apply for Software Job"; itJob.innerHTML = "Apply for IT Job"; @@ -242,16 +250,22 @@ displayLocationContent = function() { jobReputation.innerHTML = "Company reputation: " + (company.playerReputation.toFixed(4)).toLocaleString(); work.style.display = "block"; + var currPos = Player.companyPosition; + work.addEventListener("click", function() { - Player.startWork(); + if (currPos.isPartTimeJob()) { + Player.startWorkPartTime(); + } else { + Player.startWork(); + } return false; }); - var currPos = Player.companyPosition; - //Change the text for the corresponding position from "Apply for X Job" to "Apply for promotion" if (currPos.isSoftwareJob()) { softwareJob.innerHTML = "Apply for a promotion (Software)"; + } else if (currPos.isSoftwareConsultantJob()) { + softwareConsultantJob.innerHTML = "Apply for a promotion (Software Consultant)"; } else if (currPos.isITJob()) { itJob.innerHTML = "Apply for a promotion (IT)"; } else if (currPos.isSecurityEngineerJob()) { @@ -260,6 +274,8 @@ displayLocationContent = function() { networkEngineerJob.innerHTML = "Apply for a promotion (Network Engineer)"; } else if (currPos.isBusinessJob()) { businessJob.innerHTML = "Apply for a promotion (Business)"; + } else if (currPos.isBusinessConsultantJob()) { + businessConsultantJob.innerHTML = "Apply for a promotion (Business Consultant)"; } else if (currPos.isSecurityJob()) { securityJob.innerHTML = "Apply for a promotion (Security)"; } else if (currPos.isAgentJob()) { @@ -281,8 +297,7 @@ displayLocationContent = function() { break; case Locations.AevumSummitUniveristy: - var costMult = 3; - var expMult = 2; + var costMult = 4, expMult = 3; displayUniversityLocationContent(costMult); setUniversityLocationButtons(costMult, expMult); break; @@ -359,6 +374,7 @@ displayLocationContent = function() { locationInfo.innerHTML = Companies[loc].info; softwareJob.style.display = "block"; + softwareConsultantJob.style.display = "block"; itJob.style.display = "block"; securityEngineerJob.style.display = "block"; networkEngineerJob.style.display = "block"; @@ -369,6 +385,7 @@ displayLocationContent = function() { locationInfo.innerHTML = Companies[loc].info; softwareJob.style.display = "block"; + softwareConsultantJob.style.display = "block"; itJob.style.display = "block"; securityEngineerJob.style.display = "block"; networkEngineerJob.style.display = "block"; @@ -394,6 +411,7 @@ displayLocationContent = function() { locationInfo.innerHTML = Companies[loc].info; softwareJob.style.display = "block"; + softwareConsultantJob.style.display = "block"; itJob.style.display = "block"; securityEngineerJob.style.display = "block"; networkEngineerJob.style.display = "block"; @@ -406,18 +424,16 @@ displayLocationContent = function() { purchaseHomeRam.style.display = "block"; break; - case Locations.AevumCrushFitnessGym: - gymTrainStr.style.display = "block"; - gymTrainDef.style.display = "block"; - gymTrainDex.style.display = "block"; - gymTrainAgi.style.display = "block"; + case Locations.AevumCrushFitnessGym: + var costMult = 2, expMult = 1.5; + displayGymLocationContent(costMult); + setGymLocationButtons(costMult, expMult); break; case Locations.AevumSnapFitnessGym: - gymTrainStr.style.display = "block"; - gymTrainDef.style.display = "block"; - gymTrainDex.style.display = "block"; - gymTrainAgi.style.display = "block"; + var costMult = 6, expMult = 4; + displayGymLocationContent(costMult); + setGymLocationButtons(costMult, expMult); break; case Locations.ChongqingTravelAgency: @@ -462,8 +478,7 @@ displayLocationContent = function() { break; case Locations.Sector12RothmanUniversity: - var costMult = 2; - var expMult = 1; + var costMult = 3, expMult = 2; displayUniversityLocationContent(costMult); setUniversityLocationButtons(costMult, expMult); break; @@ -505,6 +520,7 @@ displayLocationContent = function() { locationInfo.innerHTML = Companies[loc].info; softwareJob.style.display = "block"; + softwareConsultantJob.style.display = "block"; itJob.style.display = "block"; securityEngineerJob.style.display = "block"; networkEngineerJob.style.display = "block"; @@ -515,6 +531,7 @@ displayLocationContent = function() { locationInfo.innerHTML = Companies[loc].info; softwareJob.style.display = "block"; + softwareConsultantJob.style.display = "block"; itJob.style.display = "block"; securityEngineerJob.style.display = "block"; networkEngineerJob.style.display = "block"; @@ -558,6 +575,7 @@ displayLocationContent = function() { locationInfo.innerHTML = Companies[loc].info; softwareJob.style.display = "block"; + softwareConsultantJob.style.display = "block"; businessJob.style.display = "block"; purchase1gb.style.display = "block"; purchase2gb.style.display = "block"; @@ -570,6 +588,7 @@ displayLocationContent = function() { locationInfo.innerHTML = Companies[loc].info; softwareJob.style.display = "block"; + softwareConsultantJob.style.display = "block"; itJob.style.display = "block"; securityEngineerJob.style.display = "block"; networkEngineerJob.style.display = "block"; @@ -581,26 +600,26 @@ displayLocationContent = function() { locationInfo.innerHTML = Companies[loc].info; employeeJob.style.display = "block"; + employeePartTimeJob.style.display = "block"; break; case Locations.Sector12JoesGuns: locationInfo.innerHTML = Companies[loc].info; employeeJob.style.display = "block"; + employeePartTimeJob.style.display = "block"; break; case Locations.Sector12IronGym: - gymTrainStr.style.display = "block"; - gymTrainDef.style.display = "block"; - gymTrainDex.style.display = "block"; - gymTrainAgi.style.display = "block"; + var costMult = 1, expMult = 1; + displayGymLocationContent(costMult); + setGymLocationButtons(costMult, expMult); break; case Locations.Sector12PowerhouseGym: - gymTrainStr.style.display = "block"; - gymTrainDef.style.display = "block"; - gymTrainDex.style.display = "block"; - gymTrainAgi.style.display = "block"; + var costMult = 10, expMult = 7.5; + displayGymLocationContent(costMult); + setGymLocationButtons(costMult, expMult); break; case Locations.NewTokyoTravelAgency: @@ -616,6 +635,7 @@ displayLocationContent = function() { locationInfo.innerHTML = Companies[loc].info; softwareJob.style.display = "block"; + softwareConsultantJob.style.display = "block"; itJob.style.display = "block"; securityEngineerJob.style.display = "block"; networkEngineerJob.style.display = "block"; @@ -626,6 +646,7 @@ displayLocationContent = function() { locationInfo.innerHTML = Companies[loc].info; softwareJob.style.display = "block"; + softwareConsultantJob.style.display = "block"; itJob.style.display = "block"; securityEngineerJob.style.display = "block"; networkEngineerJob.style.display = "block"; @@ -636,6 +657,7 @@ displayLocationContent = function() { locationInfo.innerHTML = Companies[loc].info; softwareJob.style.display = "block"; + softwareConsultantJob.style.display = "block"; itJob.style.display = "block"; securityEngineerJob.style.display = "block"; networkEngineerJob.style.display = "block"; @@ -647,6 +669,7 @@ displayLocationContent = function() { locationInfo.innerHTML = Companies[loc].info; waiterJob.style.display = "block"; + waitPartTimeJob.style.display = "block"; break; @@ -663,6 +686,7 @@ displayLocationContent = function() { locationInfo.innerHTML = Companies[loc].info; softwareJob.style.display = "block"; + softwareConsultantJob.style.display = "block"; itJob.style.display = "block"; securityEngineerJob.style.display = "block"; networkEngineerJob.style.display = "block"; @@ -683,6 +707,7 @@ displayLocationContent = function() { locationInfo.innerHTML = Companies[loc].info; softwareJob.style.display = "block"; + softwareConsultantJob.style.display = "block"; itJob.style.display = "block"; securityEngineerJob.style.display = "block"; networkEngineerJob.style.display = "block"; @@ -693,6 +718,7 @@ displayLocationContent = function() { locationInfo.innerHTML = Companies[loc].info; softwareJob.style.display = "block"; + softwareConsultantJob.style.display = "block"; itJob.style.display = "block"; businessJob.style.display = "block"; @@ -714,8 +740,7 @@ displayLocationContent = function() { break; case Locations.VolhavenZBInstituteOfTechnology: - var costMult = 4; - var expMult = 3; + var costMult = 5, expMult = 4; displayUniversityLocationContent(costMult); setUniversityLocationButtons(costMult, expMult); break; @@ -751,6 +776,7 @@ displayLocationContent = function() { locationInfo.innerHTML = Companies[loc].info; softwareJob.style.display = "block"; + softwareConsultantJob.style.display = "block"; itJob.style.display = "block"; securityEngineerJob.style.display = "block"; networkEngineerJob.style.display = "block"; @@ -772,6 +798,7 @@ displayLocationContent = function() { locationInfo.innerHTML = Companies[loc].info; softwareJob.style.display = "block"; + softwareConsultantJob.style.display = "block"; itJob.style.display = "block"; securityEngineerJob.style.display = "block"; networkEngineerJob.style.display = "block"; @@ -792,6 +819,7 @@ displayLocationContent = function() { locationInfo.innerHTML = Companies[loc].info; softwareJob.style.display = "block"; + softwareConsultantJob.style.display = "block"; itJob.style.display = "block"; securityEngineerJob.style.display = "block"; networkEngineerJob.style.display = "block"; @@ -807,10 +835,9 @@ displayLocationContent = function() { break; case Locations.VolhavenMilleniumFitnessGym: - gymTrainStr.style.display = "block"; - gymTrainDef.style.display = "block"; - gymTrainDex.style.display = "block"; - gymTrainAgi.style.display = "block"; + var costMult = 3, expMult = 2.5; + displayGymLocationContent(costMult); + setGymLocationButtons(costMult, expMult); break; //All Slums @@ -865,6 +892,7 @@ displayLocationContent = function() { } //Make the "Apply to be Employee and Waiter" texts disappear if you already hold the job + //Includes part-time stuff if (loc == Player.companyName) { var currPos = Player.companyPosition; @@ -872,6 +900,10 @@ displayLocationContent = function() { employeeJob.style.display = "none"; } else if (currPos.positionName == CompanyPositions.Waiter.positionName) { waiterJob.style.display = "none"; + } else if (currPos.positionName == CompanyPositions.PartTimeEmploye.positionName) { + employeePartTimeJob.style.display = "none"; + } else if (currPos.positionName == CompanyPositions.PartTimeWaiter.positionName) { + waiterPartTimeJob.style.display = "none"; } } } @@ -1287,23 +1319,22 @@ initLocationButtons = function() { //Buttons to interact at a location (apply for job/promotion, train, purchase, etc.) - var softwareJob = document.getElementById("location-software-job"); - var itJob = document.getElementById("location-it-job"); - var securityEngineerJob = document.getElementById("location-security-engineer-job"); - var networkEngineerJob = document.getElementById("location-network-engineer-job"); - var businessJob = document.getElementById("location-business-job"); - var securityJob = document.getElementById("location-security-job"); - var agentJob = document.getElementById("location-agent-job"); - var employeeJob = document.getElementById("location-employee-job"); - var waiterJob = document.getElementById("location-waiter-job"); + var softwareJob = document.getElementById("location-software-job"); + var softwareConsultantJob = document.getElementById("location-software-consultant-job") + var itJob = document.getElementById("location-it-job"); + var securityEngineerJob = document.getElementById("location-security-engineer-job"); + var networkEngineerJob = document.getElementById("location-network-engineer-job"); + var businessJob = document.getElementById("location-business-job"); + var businessConsultantJob = document.getElementById("location-business-consultant-job"); + var securityJob = document.getElementById("location-security-job"); + var agentJob = document.getElementById("location-agent-job"); + var employeeJob = document.getElementById("location-employee-job"); + var employeePartTimeJob = document.getElementById("location-parttime-employee-job"); + var waiterJob = document.getElementById("location-waiter-job"); + var waiterPartTimeJob = document.getElementById("location-parttime-waiter-job"); var work = document.getElementById("location-work"); - var gymTrainStr = document.getElementById("location-gym-train-str"); - var gymTrainDef = document.getElementById("location-gym-train-def"); - var gymTrainDex = document.getElementById("location-gym-train-dex"); - var gymTrainAgi = document.getElementById("location-gym-train-agi"); - var purchase1gb = document.getElementById("location-purchase-1gb"); var purchase2gb = document.getElementById("location-purchase-2gb"); var purchase4gb = document.getElementById("location-purchase-4gb"); @@ -1340,6 +1371,11 @@ initLocationButtons = function() { return false; }); + softwareConsultantJob.addEventListener("click", function() { + Player.applyForSoftwareConsultantJob(); + return false; + }); + itJob.addEventListener("click", function() { Player.applyForSoftwareJob() return false; @@ -1360,6 +1396,11 @@ initLocationButtons = function() { return false; }); + businessConsultantJob.addEventListener("click", function() { + Player.applyForBusinessConsultantJob(); + return false; + }); + securityJob.addEventListener("click", function() { Player.applyForSecurityJob(); return false; @@ -1375,63 +1416,73 @@ initLocationButtons = function() { return false; }); + employeePartTimeJob.addEventListener("click", function() { + Player.applyForPartTimeEmployeeJob(); + return false; + }); + waiterJob.addEventListener("click", function() { Player.applyForWaiterJob(); return false; }); + waiterPartTimeJob.addEventListener("click", function() { + Player.applyForPartTimeWaiterJob(); + return false; + }); + purchase1gb.addEventListener("click", function() { - purchaseServerBoxCreate(1, 50000); + purchaseServerBoxCreate(1, 1 * CONSTANTS.BaseCostFor1GBOfRamServer); return false; }); purchase2gb.addEventListener("click", function() { - purchaseServerBoxCreate(2, 100000); + purchaseServerBoxCreate(2, 2 * CONSTANTS.BaseCostFor1GBOfRamServer); return false; }); purchase4gb.addEventListener("click", function() { - purchaseServerBoxCreate(4, 250000); + purchaseServerBoxCreate(4, 4 * CONSTANTS.BaseCostFor1GBOfRamServer); return false; }); purchase8gb.addEventListener("click", function() { - purchaseServerBoxCreate(8, 1000000); + purchaseServerBoxCreate(8, 8 * CONSTANTS.BaseCostFor1GBOfRamServer); return false; }); purchase16gb.addEventListener("click", function() { - purchaseServerBoxCreate(16, 4000000); + purchaseServerBoxCreate(16, 16 * CONSTANTS.BaseCostFor1GBOfRamServer); return false; }); purchase32gb.addEventListener("click", function() { - purchaseServerBoxCreate(32, 10000000); + purchaseServerBoxCreate(32, 32 * CONSTANTS.BaseCostFor1GBOfRamServer); return false; }); purchase64gb.addEventListener("click", function() { - purchaseServerBoxCreate(64, 20000000); + purchaseServerBoxCreate(64, 64 * CONSTANTS.BaseCostFor1GBOfRamServer); return false; }); purchase128gb.addEventListener("click", function() { - purchaseServerBoxCreate(128, 50000000); + purchaseServerBoxCreate(128, 128 * CONSTANTS.BaseCostFor1GBOfRamServer); return false; }); purchase256gb.addEventListener("click", function() { - purchaseServerBoxCreate(256, 100000000); + purchaseServerBoxCreate(256, 256 * CONSTANTS.BaseCostFor1GBOfRamServer); return false; }); purchase512gb.addEventListener("click", function() { - purchaseServerBoxCreate(512, 250000000); + purchaseServerBoxCreate(512, 512 * CONSTANTS.BaseCostFor1GBOfRamServer); return false; }); purchase1tb.addEventListener("click", function() { - purchaseServerBoxCreate(1024, 750000000); + purchaseServerBoxCreate(1024, 1024 * CONSTANTS.BaseCostFor1GBOfRamServer); return false; }); @@ -1575,60 +1626,92 @@ displayUniversityLocationContent = function(costMult) { //Update button text to show cost classDataStructuresButton.innerHTML = "Take Data Structures course ($" + dataStructuresCost + " / sec)"; - classNetworksButton.innerHTML = "Take Networks course ($" + networksCost + " / second)"; - classAlgorithmsButton.innerHTML = "Take Algorithms course ($" + algorithmsCost + " / second)"; - classManagementButton.innerHTML = "Take Management course ($" + managementCost + " / second)"; - classLeadershipButton.innerHTML = "Take Leadership course ($" + leadershipCost + " / second)"; + classNetworksButton.innerHTML = "Take Networks course ($" + networksCost + " / sec)"; + classAlgorithmsButton.innerHTML = "Take Algorithms course ($" + algorithmsCost + " / sec)"; + classManagementButton.innerHTML = "Take Management course ($" + managementCost + " / sec)"; + classLeadershipButton.innerHTML = "Take Leadership course ($" + leadershipCost + " / sec)"; } setUniversityLocationButtons = function(costMult, expMult) { - var studyComputerScience= document.getElementById("location-study-computer-science"); - var classDataStructures = document.getElementById("location-data-structures-class"); - var classNetworks = document.getElementById("location-networks-class"); - var classAlgorithms = document.getElementById("location-algorithms-class"); - var classManagement = document.getElementById("location-management-class"); - var classLeadership = document.getElementById("location-leadership-class"); - - var newStudyCS = studyComputerScience.cloneNode(true); - studyComputerScience.parentNode.replaceChild(newStudyCS, studyComputerScience) + var newStudyCS = clearEventListeners("location-study-computer-science"); newStudyCS.addEventListener("click", function() { Player.startClass(costMult, expMult, CONSTANTS.ClassStudyComputerScience); return false; }); - var newClassDataStructures = classDataStructures.cloneNode(true); - classDataStructures.parentNode.replaceChild(newClassDataStructures, classDataStructures); + var newClassDataStructures = clearEventListeners("location-data-structures-class"); newClassDataStructures.addEventListener("click", function() { Player.startClass(costMult, expMult, CONSTANTS.ClassDataStructures); return false; }); - var newClassNetworks = classNetworks.cloneNode(true); - classNetworks.parentNode.replaceChild(newClassNetworks, classNetworks); + var newClassNetworks = clearEventListeners("location-networks-class"); newClassNetworks.addEventListener("click", function() { Player.startClass(costMult, expMult, CONSTANTS.ClassNetworks); return false; }); - var newClassAlgorithms = classAlgorithms.cloneNode(true); - classAlgorithms.parentNode.replaceChild(newClassAlgorithms, classAlgorithms); + var newClassAlgorithms = clearEventListeners("location-algorithms-class"); newClassAlgorithms.addEventListener("click", function() { Player.startClass(costMult, expMult, CONSTANTS.ClassAlgorithms); return false; }); - var newClassManagement = classManagement.cloneNode(true); - classManagement.parentNode.replaceChild(newClassManagement, classManagement); + var newClassManagement = clearEventListeners("location-management-class"); newClassManagement.addEventListener("click", function() { Player.startClass(costMult, expMult, CONSTANTS.ClassManagement); return false; }); - var newClassLeadership = classLeadership.cloneNode(true); - classLeadership.parentNode.replaceChild(newClassLeadership, classLeadership); + var newClassLeadership = clearEventListeners("location-leadership-class"); newClassLeadership.addEventListener("click", function() { Player.startClass(costMult, expMult, CONSTANTS.ClassLeadership); return false; }); } +displayGymLocationContent = function(costMult) { + var gymStrButton = document.getElementById("location-gym-train-str"); + var gymDefButton = document.getElementById("location-gym-train-def"); + var gymDexButton = document.getElementById("location-gym-train-dex"); + var gymAgiButton = document.getElementById("location-gym-train-agi"); + gymStrButton.style.display = "block"; + gymDefButton.style.display = "block"; + gymDexButton.style.display = "block"; + gymAgiButton.style.display = "block"; + + //Costs (per second) + var cost = CONSTANTS.ClassGymBaseCost * costMult; + + //Update button text to show cost + gymStrButton.innerHTML = "Train Strength ($" + cost + " / sec)"; + gymDefButton.innerHTML = "Train Defense ($" + cost + " / sec)"; + gymDexButton.innerHTML = "Train Dexterity ($" + cost + " / sec)"; + gymAgiButton.innerHTML = "Train Agility ($" + cost + " / sec)"; +} + +setGymLocationButtons = function(costMult, expMult) { + var gymStr = clearEventListeners("location-gym-train-str"); + gymStr.addEventListener("click", function() { + Player.startClass(costMult, expMult, CONSTANTS.ClassGymStrength); + return false; + }); + + var gymDef = clearEventListeners("location-gym-train-def"); + gymDef.addEventListener("click", function() { + Player.startClass(costMult, expMult, CONSTANTS.ClassGymDefense); + return false; + }); + + var gymDex = clearEventListeners("location-gym-train-dex"); + gymDex.addEventListener("click", function() { + Player.startClass(costMult, expMult, CONSTANTS.ClassGymDexterity); + return false; + }); + + var gymAgi = clearEventListeners("location-gym-train-agi"); + gymAgi.addEventListener("click", function() { + Player.startClass(costMult, expMult, CONSTANTS.ClassGymAgility); + return false; + }); +} diff --git a/src/Netscript/Evaluator.js b/src/Netscript/Evaluator.js index 1af0897ff..a3f1667a6 100644 --- a/src/Netscript/Evaluator.js +++ b/src/Netscript/Evaluator.js @@ -254,6 +254,8 @@ function evaluate(exp, workerScript) { server.moneyAvailable -= moneyGained; Player.gainMoney(moneyGained); workerScript.scriptRef.onlineMoneyMade += moneyGained; + console.log("About to add to moneystolenmap for " + server.hostname); + workerScript.scriptRef.moneyStolenMap[server.ip] += moneyGained; Player.gainHackingExp(expGainedOnSuccess); workerScript.scriptRef.onlineExpGained += expGainedOnSuccess; diff --git a/src/Player.js b/src/Player.js index f01fc352d..ff1127044 100644 --- a/src/Player.js +++ b/src/Player.js @@ -75,10 +75,11 @@ function PlayerObject() { this.companyPosition = ""; //CompanyPosition object //Servers - this.currentServer = ""; //IP address of Server currently being accessed through terminal - this.discoveredServers = []; //IP addresses of secret servers not in the network that you have discovered - this.purchasedServers = []; - this.hacknetNodes = []; + this.currentServer = ""; //IP address of Server currently being accessed through terminal + this.discoveredServers = []; //IP addresses of secret servers not in the network that you have discovered + this.purchasedServers = []; + this.hacknetNodes = []; + this.totalHacknetNodeProduction = 0; //Factions this.factions = []; //Names of all factions player has joined @@ -384,11 +385,7 @@ PlayerObject.prototype.finishWork = function(cancelled) { this.updateSkillLevels(); - var txt = ""; - if (cancelled) { - txt = "You worked a short shift of " + convertTimeMsToTimeElapsedString(this.timeWorked) + "

" + - "Since you cancelled your work early, you only gained half of the experience, money, and reputation you earned.

" + - "You earned a total of:
" + + var txt = "You earned a total of:
" + "$" + formatNumber(this.workMoneyGained / cancMult, 2) + "
" + formatNumber(this.workRepGained / cancMult, 4) + " reputation for the company
" + formatNumber(this.workHackExpGained / cancMult, 4) + " hacking exp
" + @@ -398,25 +395,18 @@ PlayerObject.prototype.finishWork = function(cancelled) { formatNumber(this.workAgiExpGained / cancMult, 4) + " agility exp
" + formatNumber(this.workChaExpGained / cancMult, 4) + " charisma exp
"; + if (cancelled) { + txt = "You worked a short shift of " + convertTimeMsToTimeElapsedString(this.timeWorked) + "

" + + "Since you cancelled your work early, you only gained half of the experience, money, and reputation you earned.

" + txt; } else { txt = "You worked a full shift of 8 hours!

" + - "You earned a total of:
" + - "$" + formatNumber(this.workMoneyGained / cancMult, 2) + "
" + - formatNumber(this.workRepGained / cancMult, 4) + " reputation for the company
" + - formatNumber(this.workHackExpGained / cancMult, 4) + " hacking exp
" + - formatNumber(this.workStrExpGained / cancMult, 4) + " strength exp
" + - formatNumber(this.workDefExpGained / cancMult, 4) + " defense exp
" + - formatNumber(this.workDexExpGained / cancMult, 4) + " dexterity exp
" + - formatNumber(this.workAgiExpGained / cancMult, 4) + " agility exp
" + - formatNumber(this.workChaExpGained / cancMult, 4) + " charisma exp
"; + "You earned a total of:
" + txt; } dialogBoxCreate(txt); var mainMenu = document.getElementById("mainmenu-container"); mainMenu.style.visibility = "visible"; - this.isWorking = false; - Engine.loadTerminalContent(); } @@ -436,12 +426,8 @@ PlayerObject.prototype.startWork = function() { this.timeNeededToCompleteWork = CONSTANTS.MillisecondsPer8Hours; - var cancelButton = document.getElementById("work-in-progress-cancel-button"); - //Remove all old event listeners from Cancel button - var newCancelButton = cancelButton.cloneNode(true); - cancelButton.parentNode.replaceChild(newCancelButton, cancelButton); - + var newCancelButton = clearEventListeners("work-in-progress-cancel-button"); newCancelButton.addEventListener("click", function() { Player.finishWork(true); return false; @@ -479,6 +465,7 @@ PlayerObject.prototype.work = function(numCycles) { this.workRepGained = this.workRepGainRate * maxCycles; this.workMoneyGained = this.workMoneyGainRate * maxCycles; this.finishWork(false); + return; } var txt = document.getElementById("work-in-progress-text"); @@ -494,13 +481,114 @@ PlayerObject.prototype.work = function(numCycles) { formatNumber(this.workDexExpGained, 4) + " (" + formatNumber(this.workDexExpGainRate * cyclesPerSec, 4) + " / sec) dexterity exp
" + formatNumber(this.workAgiExpGained, 4) + " (" + formatNumber(this.workAgiExpGainRate * cyclesPerSec, 4) + " / sec) agility exp

" + formatNumber(this.workChaExpGained, 4) + " (" + formatNumber(this.workChaExpGainRate * cyclesPerSec, 4) + " / sec) charisma exp

" + - - "You will automatically finish after working for 8 hours. You can cancel earlier if you wish,
" + "but you will only gain half of the experience, money, and reputation you've earned so far." } +PlayerObject.prototype.startWorkPartTime = function() { + this.resetWorkStatus(); + this.isWorking = true; + this.workType = CONSTANTS.WorkTypeCompanyPartTime; + + this.workHackExpGainRate = this.getWorkHackExpGain(); + this.workStrExpGainRate = this.getWorkStrExpGain(); + this.workDefExpGainRate = this.getWorkDefExpGain(); + this.workDexExpGainRate = this.getWorkDexExpGain(); + this.workAgiExpGainRate = this.getWorkAgiExpGain(); + this.workChaExpGainRate = this.getWorkChaExpGain(); + this.workRepGainRate = this.getWorkRepGain(); + this.workMoneyGainRate = this.getWorkMoneyGain(); + + this.timeNeededToCompleteWork = CONSTANTS.MillisecondsPer8Hours; + + var newCancelButton = clearEventListeners("work-in-progress-cancel-button"); + newCancelButton.addEventListener("click", function() { + Player.finishWorkPartTime(); + return false; + }); + + //Display Work In Progress Screen + Engine.loadWorkInProgressContent(); +} + +PlayerObject.prototype.workPartTime = function(numCycles) { + this.workRepGainRate = this.getWorkRepGain(); + + this.workHackExpGained += this.workHackExpGainRate * numCycles; + this.workStrExpGained += this.workStrExpGainRate * numCycles; + this.workDefExpGained += this.workDefExpGainRate * numCycles; + this.workDexExpGained += this.workDexExpGainRate * numCycles; + this.workAgiExpGained += this.workAgiExpGainRate * numCycles; + this.workChaExpGained += this.workChaExpGainRate * numCycles; + this.workRepGained += this.workRepGainRate * numCycles; + this.workMoneyGained += this.workMoneyGainRate * numCycles; + + var cyclesPerSec = 1000 / Engine._idleSpeed; + + this.timeWorked += Engine._idleSpeed * numCycles; + + //If timeWorked == 8 hours, then finish. You can only gain 8 hours worth of exp and money + if (this.timeWorked >= CONSTANTS.MillisecondsPer8Hours) { + var maxCycles = CONSTANTS.GameCyclesPer8Hours; + this.workHackExpGained = this.workHackExpGainRate * maxCycles; + this.workStrExpGained = this.workStrExpGainRate * maxCycles; + this.workDefExpGained = this.workDefExpGainRate * maxCycles; + this.workDexExpGained = this.workDexExpGainRate * maxCycles; + this.workAgiExpGained = this.workAgiExpGainRate * maxCycles; + this.workChaExpGained = this.workChaExpGainRate * maxCycles; + this.workRepGained = this.workRepGainRate * maxCycles; + this.workMoneyGained = this.workMoneyGainRate * maxCycles; + this.finishWorkPartTime(); + return; + } + + var txt = document.getElementById("work-in-progress-text"); + txt.innerHTML = "You are currently working as a " + this.companyPosition.positionName + + " at " + Player.companyName + "

" + + "You have been working for " + convertTimeMsToTimeElapsedString(this.timeWorked) + "

" + + "You have earned:

" + + "$" + formatNumber(this.workMoneyGained, 2) + " ($" + formatNumber(this.workMoneyGainRate * cyclesPerSec, 2) + " / sec)

" + + formatNumber(this.workRepGained, 4) + " (" + formatNumber(this.workRepGainRate * cyclesPerSec, 4) + " / sec) reputation for this company

" + + formatNumber(this.workHackExpGained, 4) + " (" + formatNumber(this.workHackExpGainRate * cyclesPerSec, 4) + " / sec) hacking exp

" + + formatNumber(this.workStrExpGained, 4) + " (" + formatNumber(this.workStrExpGainRate * cyclesPerSec, 4) + " / sec) strength exp
" + + formatNumber(this.workDefExpGained, 4) + " (" + formatNumber(this.workDefExpGainRate * cyclesPerSec, 4) + " / sec) defense exp
" + + formatNumber(this.workDexExpGained, 4) + " (" + formatNumber(this.workDexExpGainRate * cyclesPerSec, 4) + " / sec) dexterity exp
" + + formatNumber(this.workAgiExpGained, 4) + " (" + formatNumber(this.workAgiExpGainRate * cyclesPerSec, 4) + " / sec) agility exp

" + + formatNumber(this.workChaExpGained, 4) + " (" + formatNumber(this.workChaExpGainRate * cyclesPerSec, 4) + " / sec) charisma exp

" + + "You will automatically finish after working for 8 hours. You can cancel earlier if you wish,
" + + "and there will be no penalty because this is a part-time job."; + +} + +PlayerObject.prototype.finishWorkPartTime = function() { + this.gainWorkExp(cancMult); + + var company = Companies[this.companyName]; + company.playerReputation += (this.workRepGained / cancMult); + + this.gainMoney(this.workMoneyGained / cancMult); + + this.updateSkillLevels(); + + var txt = "You earned a total of:
" + + "$" + formatNumber(this.workMoneyGained / cancMult, 2) + "
" + + formatNumber(this.workRepGained / cancMult, 4) + " reputation for the company
" + + formatNumber(this.workHackExpGained / cancMult, 4) + " hacking exp
" + + formatNumber(this.workStrExpGained / cancMult, 4) + " strength exp
" + + formatNumber(this.workDefExpGained / cancMult, 4) + " defense exp
" + + formatNumber(this.workDexExpGained / cancMult, 4) + " dexterity exp
" + + formatNumber(this.workAgiExpGained / cancMult, 4) + " agility exp
" + + formatNumber(this.workChaExpGained / cancMult, 4) + " charisma exp
"; + txt = "You worked for " + convertTimeMsToTimeElapsedString(this.timeWorked) + ".

" + txt; + dialogBoxCreate(txt); + + var mainMenu = document.getElementById("mainmenu-container"); + mainMenu.style.visibility = "visible"; + this.isWorking = false; + Engine.loadTerminalContent(); +} + /* Working for Faction */ PlayerObject.prototype.finishFactionWork = function(cancelled, faction) { this.gainWorkExp(); @@ -805,11 +893,11 @@ PlayerObject.prototype.startClass = function(costMult, expMult, className) { var baseAlgorithmsExp = 2.0; var baseManagementExp = 1.0; var baseLeadershipExp = 2.0; + var baseGymExp = 1.0; //Find cost and exp gain per game cycle - var cost = 0; - var hackExp = 0; - var chaExp = 0; + var cost = 0; + var hackExp = 0, strExp = 0, defExp = 0, dexExp = 0, agiExp = 0, chaExp = 0; switch (className) { case CONSTANTS.ClassStudyComputerScience: hackExp = baseStudyComputerScienceExp * expMult / gameCPS; @@ -834,6 +922,22 @@ PlayerObject.prototype.startClass = function(costMult, expMult, className) { cost = CONSTANTS.ClassLeadershipBaseCost * costMult / gameCPS; chaExp = baseLeadershipExp * expMult / gameCPS; break; + case CONSTANTS.ClassGymStrength: + cost = CONSTANTS.ClassGymBaseCost * costMult / gameCPS; + strExp = baseGymExp * expMult / gameCPS; + break; + case CONSTANTS.ClassGymDefense: + cost = CONSTANTS.ClassGymBaseCost * costMult / gameCPS; + defExp = baseGymExp * expMult / gameCPS; + break; + case CONSTANTS.ClassGymDexterity: + cost = CONSTANTS.ClassGymBaseCost * costMult / gameCPS; + dexExp = baseGymExp * expMult / gameCPS; + break; + case CONSTANTS.ClassGymAgility: + cost = CONSTANTS.ClassGymBaseCost * costMult / gameCPS; + agiExp = baseGymExp * expMult / gameCPS; + break; default: throw new Error("ERR: Invalid/unregocnized class name"); return; @@ -841,6 +945,10 @@ PlayerObject.prototype.startClass = function(costMult, expMult, className) { this.workMoneyLossRate = cost; this.workHackExpGainRate = hackExp * this.hacking_exp_mult; + this.workStrExpGainRate = strExp * this.strength_exp_mult; + this.workDefExpGainRate = defExp * this.defense_exp_mult; + this.workDexExpGainRate = dexExp * this.dexterity_exp_mult; + this.workAgiExpGainRate = agiExp * this.agility_exp_mult; this.workChaExpGainRate = chaExp * this.charisma_exp_mult; var cancelButton = document.getElementById("work-in-progress-cancel-button"); @@ -933,12 +1041,8 @@ PlayerObject.prototype.startCrime = function(hackExp, strExp, defExp, dexExp, ag this.timeNeededToCompleteWork = time; - var cancelButton = document.getElementById("work-in-progress-cancel-button"); - //Remove all old event listeners from Cancel button - var newCancelButton = cancelButton.cloneNode(true); - cancelButton.parentNode.replaceChild(newCancelButton, cancelButton); - + var newCancelButton = clearEventListeners("work-in-progress-cancel-button") newCancelButton.addEventListener("click", function() { Player.finishCrime(true); return false; @@ -955,6 +1059,8 @@ PlayerObject.prototype.commitCrime = function (numCycles) { var percent = Math.round(Player.timeWorked / Player.timeNeededToCompleteWork * 100); var numBars = Math.round(percent / 5); + if (numBars < 0) {numBars = 0;} + if (numBars > 20) {numBars = 20;} var progressBar = "[" + Array(numBars+1).join("|") + Array(20 - numBars + 1).join(" ") + "]"; var txt = document.getElementById("work-in-progress-text"); diff --git a/src/Prestige.js b/src/Prestige.js index c6e37e56c..e8971703e 100644 --- a/src/Prestige.js +++ b/src/Prestige.js @@ -125,6 +125,16 @@ function prestigeAugmentation() { Player.currentServer = homeComp.ip; Player.homeComputer = homeComp.ip; AddToAllServers(homeComp); + //Reset statistics of all scripts on home computer + for (var i = 0; i < homeComp.scripts.length; ++i) { + var s = homeComp.scripts[i]; + s.offlineRunningTime = 0.01; //Seconds + s.offlineMoneyMade = 0; + s.offlineExpGained = 0; + s.onlineRunningTime = 0.01; //Seconds + s.onlineMoneyMade = 0; + s.onlineExpGained = 0; + } //Delete all running scripts objects for (var i = 0; i < workerScripts.length; ++i) { @@ -139,6 +149,7 @@ function prestigeAugmentation() { //Delete Hacknet Nodes Player.hacknetNodes.length = 0; + Player.totalHacknetNodeProduction = 0; //Delete Special Server IPs for (var member in SpecialServerIps) { diff --git a/src/Script.js b/src/Script.js index dd9536622..e8efd17b8 100644 --- a/src/Script.js +++ b/src/Script.js @@ -110,6 +110,7 @@ function Script() { this.onlineMoneyMade = 0; this.onlineExpGained = 0; + this.moneyStolenMap = new AllServersToMoneyMap(); }; //Get the script data from the Script Editor and save it to the object @@ -211,41 +212,57 @@ scriptCalculateOfflineProduction = function(script) { var thisUpdate = new Date().getTime(); var lastUpdate = Player.lastUpdate; var timePassed = (thisUpdate - lastUpdate) / 1000; //Seconds - console.log("Offline for " + timePassed.toString() + " seconds"); + console.log("Offline for " + timePassed + " seconds"); //Calculate the "confidence" rating of the script's true production. This is based //entirely off of time. We will arbitrarily say that if a script has been running for //4 hours (14400 sec) then we are completely confident in its ability var confidence = (script.onlineRunningTime) / 14400; if (confidence >= 1) {confidence = 1;} - console.log("onlineRunningTime: " + script.onlineRunningTime.toString()); - console.log("Confidence: " + confidence.toString()); - - //A script's offline production will always be at most half of its online production. - var production = (1/2) * (script.onlineMoneyMade / script.onlineRunningTime) * timePassed; - production *= confidence; - + console.log("onlineRunningTime: " + script.onlineRunningTime); + console.log("Confidence: " + confidence); + + var totalOfflineProduction = 0; + for (var ip in script.moneyStolenMap) { + if (script.moneyStolenMap.hasOwnProperty(ip)) { + if (script.moneyStolenMap[ip] == 0) {continue;} + var serv = AllServers[ip]; + var production = 0.5 * script.moneyStolenMap[ip] / script.onlineRunningTime * timePassed; + production *= confidence; + if (production > serv.moneyAvailable) { + production = serv.moneyAvailable; + } + totalOfflineProduction += production; + Player.gainMoney(production); + console.log(script.filename + " generated $" + production + " while offline by hacking " + serv.hostname); + serv.moneyAvailable -= production; + if (serv.moneyAvailable < 0) {serv.moneyAvailable = 0;} + } + } + + //A script's offline production will always be at most half of its online production. var expGain = (1/2) * (script.onlineExpGained / script.onlineRunningTime) * timePassed; expGain *= confidence; - //Account for production in Player and server) - var server = AllServers[script.server]; - if (production > server.moneyAvailable) { - production = server.moneyAvailable; - } - - Player.gainMoney(production); Player.gainHackingExp(expGain); - server.moneyAvailable -= production; - if (server.moneyAvailable < 0) {server.moneyAvailable = 0;} - //Update script stats - script.offlineMoneyMade += production; + script.offlineMoneyMade += totalOfflineProduction; script.offlineRunningTime += timePassed; script.offlineExpGained += expGain; //DEBUG var serverName = AllServers[script.server].hostname; - console.log(script.filename + " from server " + serverName + " generated $" + production.toString() + " while offline"); + console.log(script.filename + " from server " + serverName + " generated $" + totalOfflineProduction + " TOTAL while offline"); +} + +//Creates a function that creates a map/dictionary with the IP of each existing server as +//a key, and 0 as the value. This is used to keep track of how much money a script +//hacks from that server +function AllServersToMoneyMap() { + for (var ip in AllServers) { + if (AllServers.hasOwnProperty(ip)) { + this[ip] = 0; + } + } } \ No newline at end of file diff --git a/src/Server.js b/src/Server.js index b8686484b..e3fdaa6a0 100644 --- a/src/Server.js +++ b/src/Server.js @@ -427,7 +427,7 @@ initForeignServers = function() { var NectarNightclubServer = new Server(); NectarNightclubServer.init(createRandomIp(), "nectar-net", "Nectar Nightclub Network", true, false, false, false, 2); - NectarNightclubServer.setHackingParameters(20, 6500000, 20, 25); + NectarNightclubServer.setHackingParameters(20, 650000, 20, 25); NectarNightclubServer.setPortProperties(0); AddToAllServers(NectarNightclubServer); diff --git a/utils/JSONReviver.js b/utils/JSONReviver.js index f83e6ffea..b1080ff35 100644 --- a/utils/JSONReviver.js +++ b/utils/JSONReviver.js @@ -9,6 +9,7 @@ function Reviver(key, value) { var ctor; if (value == null) { console.log("Reviver WRONGLY called with key: " + key + ", and value: " + value); + return 0; } if (typeof value === "object" && typeof value.ctor === "string" && diff --git a/utils/PurchaseRamForHomeBox.js b/utils/PurchaseRamForHomeBox.js index aa6587b3b..6de7c9bbe 100644 --- a/utils/PurchaseRamForHomeBox.js +++ b/utils/PurchaseRamForHomeBox.js @@ -34,10 +34,10 @@ purchaseRamForHomeBoxCreate = function() { var numUpgrades = Math.log2(currentRam); //Calculate cost - //Base cost of RAM is 50k per 1GB...but lets have this increase by 10% for every time + //Base cost of RAM is 50k per 1GB...but lets have this increase by 21% for every time //the RAM has been upgraded - var cost = currentRam * CONSTANTS.BaseCostFor1GBOfRam; - var mult = Math.pow(1.1, numUpgrades); + var cost = currentRam * CONSTANTS.BaseCostFor1GBOfRamHome; + var mult = Math.pow(1.21, numUpgrades); cost = cost * mult; purchaseRamForHomeBoxSetText("Would you like to purchase additional RAM for your home computer?

" + @@ -48,9 +48,6 @@ purchaseRamForHomeBoxCreate = function() { //Clear old event listeners from Confirm button var newConfirmButton = clearEventListeners("purchase-ram-for-home-box-confirm"); - //var confirmButton = document.getElementById("purchase-ram-for-home-box-confirm"); - //var newConfirmButton = confirmButton.cloneNode(true); - //confirmButton.parentNode.replaceChild(newConfirmButton, confirmButton); newConfirmButton.addEventListener("click", function() { purchaseRamForHomeBoxClose(); purchaseRamForHomeComputer(cost); diff --git a/utils/PurchaseServerBox.js b/utils/PurchaseServerBox.js index fbaf78a89..10c73a840 100644 --- a/utils/PurchaseServerBox.js +++ b/utils/PurchaseServerBox.js @@ -32,9 +32,6 @@ purchaseServerBoxCreate = function(ram, cost) { //Clear old event listeners from Confirm button var newConfirmButton = clearEventListeners("purchase-server-box-confirm"); - //var confirmButton = document.getElementById("purchase-server-box-confirm"); - //var newConfirmButton = confirmButton.cloneNode(true); - //confirmButton.parentNode.replaceChild(newConfirmButton, confirmButton); newConfirmButton.addEventListener("click", function() { purchaseServerBoxClose(); purchaseServer(ram, cost);