diff --git a/index.html b/index.html index 81b29d3f4..be43ffc65 100644 --- a/index.html +++ b/index.html @@ -502,6 +502,11 @@

Factions

Lists all factions you have joined

+

+

Outstanding Faction Invitations

+

Lists factions you have been invited to, as well as factions you have previously rejected. + You can accept these faction invitations at any times

+ @@ -651,19 +656,19 @@

---------------

- 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 + 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 @@ -928,7 +933,7 @@ - @@ -946,7 +951,7 @@ - @@ -954,6 +959,31 @@ + +
+ + +
+ + +
+ + +
+
diff --git a/src/Company.js b/src/Company.js index e487a5c94..78839ccb2 100644 --- a/src/Company.js +++ b/src/Company.js @@ -8,12 +8,12 @@ function Company(name, salaryMult, expMult, jobStatReqOffset) { this.perks = []; //Available Perks this.salaryMultiplier = salaryMult; //Multiplier for base salary this.expMultiplier = expMult; //Multiplier for base exp gain - + //The additional levels you need in the relevant stat to qualify for a job. //E.g the offset for a megacorporation will be high, let's say 200, so the - //stat level you'd need to get an intern job would be 200 instead of 1. - this.jobStatReqOffset = jobStatReqOffset; - + //stat level you'd need to get an intern job would be 200 instead of 1. + this.jobStatReqOffset = jobStatReqOffset; + //Player-related properties for company this.isPlayerEmployed = false; this.playerPosition = ""; //Name (only name, not object) of the current position player holds @@ -69,7 +69,7 @@ function CompanyPosition(name, reqHack, reqStr, reqDef, reqDex, reqAgi, reqCha, this.requiredAgility = reqAgi; this.requiredCharisma = reqCha; this.requiredReputation = reqRep; - + //Base salary for a position. This will be multiplied by a company-specific multiplier. Better companies will have //higher multipliers. // @@ -77,7 +77,7 @@ function CompanyPosition(name, reqHack, reqStr, reqDef, reqDex, reqAgi, reqCha, this.baseSalary = salary; }; -//Set the parameters that are used to determine how good/effective the Player is at a job. +//Set the parameters that are used to determine how good/effective the Player is at a job. //The Player's "effectiveness" at a job determines how much reputation he gains when he works // //NOTE: These parameters should total to 100, such that each parameter represents a "weighting" of how @@ -116,7 +116,7 @@ CompanyPosition.prototype.calculateJobPerformance = function(hacking, str, def, var dexRatio = this.dexterityEffectiveness * dex / CONSTANTS.MaxSkillLevel; var agiRatio = this.agilityEffectiveness * agi / CONSTANTS.MaxSkillLevel; var chaRatio = this.charismaEffectiveness * cha / CONSTANTS.MaxSkillLevel; - + var reputationGain = this.positionMultiplier * (hackRatio + strRatio + defRatio + dexRatio + agiRatio + chaRatio) / 100; if (isNaN(reputationGain)) { console.log("ERROR: Code should not reach here"); @@ -126,13 +126,13 @@ CompanyPosition.prototype.calculateJobPerformance = function(hacking, str, def, } CompanyPosition.prototype.isSoftwareJob = function() { - if (this.positionName == "Software Engineering Intern" || - this.positionName == "Junior Software Engineer" || - this.positionName == "Senior Software Engineer" || - this.positionName == "Lead Software Developer" || + if (this.positionName == "Software Engineering Intern" || + this.positionName == "Junior Software Engineer" || + this.positionName == "Senior Software Engineer" || + this.positionName == "Lead Software Developer" || this.positionName == "Head of Software" || - this.positionName == "Head of Engineering" || - this.positionName == "Vice President of Technology" || + this.positionName == "Head of Engineering" || + this.positionName == "Vice President of Technology" || this.positionName == "Chief Technology Officer") { return true; } @@ -140,9 +140,9 @@ CompanyPosition.prototype.isSoftwareJob = function() { } CompanyPosition.prototype.isITJob = function() { - if (this.positionName == "IT Intern" || - this.positionName == "IT Analyst" || - this.positionName == "IT Manager" || + if (this.positionName == "IT Intern" || + this.positionName == "IT Analyst" || + this.positionName == "IT Manager" || this.positionName == "Systems Administrator") { return true; } @@ -187,8 +187,8 @@ CompanyPosition.prototype.isSecurityJob = function() { } CompanyPosition.prototype.isAgentJob = function() { - if (this.positionName == "Field Agent" || - this.positionName == "Secret Agent" || + if (this.positionName == "Field Agent" || + this.positionName == "Secret Agent" || this.positionName == "Special Operative") { return true; } @@ -196,7 +196,7 @@ CompanyPosition.prototype.isAgentJob = function() { } CompanyPosition.prototype.isSoftwareConsultantJob = function() { - if (this.positionName == "Software Consultant" || + if (this.positionName == "Software Consultant" || this.positionName == "Senior Software Consultant") {return true;} return false; } @@ -209,7 +209,7 @@ CompanyPosition.prototype.isBusinessConsultantJob = function() { CompanyPosition.prototype.isPartTimeJob = function() { if (this.isSoftwareConsultantJob() || - this.isBusinessConsultantJob() || + this.isBusinessConsultantJob() || this.positionName == "Part-time Waiter" || this.positionName == "Part-time Employee") {return true;} return false; @@ -233,13 +233,13 @@ CompanyPositions = { JuniorDev: new CompanyPosition("Junior Software Engineer", 51, 0, 0, 0, 0, 0, 8000, 32), SeniorDev: new CompanyPosition("Senior Software Engineer", 251, 0, 0, 0, 0, 51, 40000, 63), LeadDev: new CompanyPosition("Lead Software Developer", 401, 0, 0, 0, 0, 151, 200000, 210), - + //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, 22), SeniorSoftwareConsultant: new CompanyPosition("Senior Software Consultant", 251, 0, 0, 0, 0, 51, 0, 45), - + //IT ITIntern: new CompanyPosition("IT Intern", 1, 0, 0, 0, 0, 0, 0, 11), ITAnalyst: new CompanyPosition("IT Analyst", 26, 0, 0, 0, 0, 0, 7000, 25), @@ -248,13 +248,13 @@ CompanyPositions = { SecurityEngineer: new CompanyPosition("Security Engineer", 151, 0, 0, 0, 0, 26, 35000, 55), NetworkEngineer: new CompanyPosition("Network Engineer", 151, 0, 0, 0, 0, 26, 35000, 55), NetworkAdministrator: new CompanyPosition("Network Administrator", 251, 0, 0, 0, 0, 76, 175000, 165), - + //Technology management HeadOfSoftware: new CompanyPosition("Head of Software", 501, 0, 0, 0, 0, 251, 400000, 330), HeadOfEngineering: new CompanyPosition("Head of Engineering", 501, 0, 0, 0, 0, 251, 800000, 660), VicePresident: new CompanyPosition("Vice President of Technology", 601, 0, 0, 0, 0, 401, 1600000, 990), CTO: new CompanyPosition("Chief Technology Officer", 751, 0, 0, 0, 0, 501, 3200000, 1100), - + //Business BusinessIntern: new CompanyPosition("Business Intern", 1, 0, 0, 0, 0, 1, 0, 18), BusinessAnalyst: new CompanyPosition("Business Analyst", 6, 0, 0, 0, 0, 51, 8000, 42), @@ -262,14 +262,14 @@ CompanyPositions = { OperationsManager: new CompanyPosition("Operations Manager", 51, 0, 0, 0, 0, 226, 200000, 275), CFO: new CompanyPosition("Chief Financial Officer", 76, 0, 0, 0, 0, 501, 800000, 800), CEO: new CompanyPosition("Chief Executive Officer", 101, 0, 0, 0, 0, 751, 3200000, 1500), - + BusinessConsultant: new CompanyPosition("Business Consultant", 6, 0, 0, 0, 0, 51, 0, 28), SeniorBusinessConsultant: new CompanyPosition("Senior Business Consultant", 51, 0, 0, 0, 0, 226, 0, 175), - + //Non-tech/management jobs PartTimeWaiter: new CompanyPosition("Part-time Waiter", 0, 0, 0, 0, 0, 0, 0, 9), PartTimeEmployee: new CompanyPosition("Part-time Employee", 0, 0, 0, 0, 0, 0, 0, 9), - + Waiter: new CompanyPosition("Waiter", 0, 0, 0, 0, 0, 0, 0, 11), Employee: new CompanyPosition("Employee", 0, 0, 0, 0, 0, 0, 0, 11), PoliceOfficer: new CompanyPosition("Police Officer", 11, 101, 101, 101, 101, 51, 8000, 36), @@ -281,7 +281,7 @@ CompanyPositions = { FieldAgent: new CompanyPosition("Field Agent", 101, 101, 101, 101, 101, 101, 8000, 55), SecretAgent: new CompanyPosition("Secret Agent", 201, 251, 251, 251, 251, 201, 32000, 190), SpecialOperative: new CompanyPosition("Special Operative", 251, 501, 501, 501, 501, 251, 162000, 425), - + init: function() { //Argument order: hack, str, def, dex, agi, cha //Software @@ -293,12 +293,12 @@ CompanyPositions = { CompanyPositions.SeniorDev.setExperienceGains(.3, 0, 0, 0, 0, .08); CompanyPositions.LeadDev.setPerformanceParameters(75, 0, 0, 0, 0, 25, 1.5); CompanyPositions.LeadDev.setExperienceGains(.5, 0, 0, 0, 0, .1); - + CompanyPositions.SoftwareConsultant.setPerformanceParameters(80, 0, 0, 0, 0, 20, 1); CompanyPositions.SoftwareConsultant.setExperienceGains(.08, 0, 0, 0, 0, .03); CompanyPositions.SeniorSoftwareConsultant.setPerformanceParameters(75, 0, 0, 0, 0, 25, 1.2); CompanyPositions.SeniorSoftwareConsultant.setExperienceGains(.25, 0, 0, 0, 0, .06); - + //Security CompanyPositions.ITIntern.setPerformanceParameters(90, 0, 0, 0, 0, 10, 0.9); CompanyPositions.ITIntern.setExperienceGains(.04, 0, 0, 0, 0, .01); @@ -314,7 +314,7 @@ CompanyPositions = { CompanyPositions.NetworkEngineer.setExperienceGains(0.4, 0, 0, 0, 0, .05); CompanyPositions.NetworkAdministrator.setPerformanceParameters(80, 0, 0, 0, 0, 20, 1.3); CompanyPositions.NetworkAdministrator.setExperienceGains(0.5, 0, 0, 0, 0, .1); - + //Technology management CompanyPositions.HeadOfSoftware.setPerformanceParameters(75, 0, 0, 0, 0, 25, 1.6); CompanyPositions.HeadOfSoftware.setExperienceGains(1, 0, 0, 0, 0, .5); @@ -324,7 +324,7 @@ CompanyPositions = { CompanyPositions.VicePresident.setExperienceGains(1.2, 0, 0, 0, 0, .6); CompanyPositions.CTO.setPerformanceParameters(65, 0, 0, 0, 0, 35, 2); CompanyPositions.CTO.setExperienceGains(1.5, 0, 0, 0, 1); - + //Business CompanyPositions.BusinessIntern.setPerformanceParameters(10, 0, 0, 0, 0, 90, 0.9); CompanyPositions.BusinessIntern.setExperienceGains(.01, 0, 0, 0, 0, .08); @@ -338,18 +338,18 @@ CompanyPositions = { CompanyPositions.CFO.setExperienceGains(.05, 0, 0, 0, 0, 1); CompanyPositions.CEO.setPerformanceParameters(10, 0, 0, 0, 0, 90, 1.75); CompanyPositions.CEO.setExperienceGains(.1, 0, 0, 0, 0, 1.5); - + CompanyPositions.BusinessConsultant.setPerformanceParameters(20, 0, 0, 0, 0, 80, 1); CompanyPositions.BusinessConsultant.setExperienceGains(.015, 0, 0, 0, 0, .15); CompanyPositions.SeniorBusinessConsultant.setPerformanceParameters(15, 0, 0, 0, 0, 85, 1.2); CompanyPositions.SeniorBusinessConsultant.setExperienceGains(.015, 0, 0, 0, 0, .3); - + //Non-tech/management jobs 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); @@ -378,12 +378,13 @@ CompanyPositions = { //Returns the next highest position in the company for the relevant career/field //I.E returns what your next job would be if you qualify for a promotion getNextCompanyPosition = function(currPos) { + if (currPos == null) {return null;} //Software if (currPos.positionName == CompanyPositions.SoftwareIntern.positionName) { return CompanyPositions.JuniorDev; } if (currPos.positionName == CompanyPositions.JuniorDev.positionName) { - return CompanyPositions.SeniorDev; + return CompanyPositions.SeniorDev; } if (currPos.positionName == CompanyPositions.SeniorDev.positionName) { return CompanyPositions.LeadDev; @@ -391,12 +392,12 @@ getNextCompanyPosition = function(currPos) { if (currPos.positionName == CompanyPositions.LeadDev.positionName) { return CompanyPositions.HeadOfSoftware; } - + //Software Consultant if (currPos.positionName == CompanyPositions.SoftwareConsultant.positionName) { return CompanyPositions.SeniorSoftwareConsultant; } - + //IT if (currPos.positionName == CompanyPositions.ITIntern.positionName) { return CompanyPositions.ITAnalyst; @@ -410,7 +411,7 @@ getNextCompanyPosition = function(currPos) { if (currPos.positionName == CompanyPositions.SysAdmin.positionName) { return CompanyPositions.HeadOfEngineering; } - + //Security/Network Engineer if (currPos.positionName == CompanyPositions.SecurityEngineer.positionName) { return CompanyPositions.HeadOfEngineering; @@ -421,7 +422,7 @@ getNextCompanyPosition = function(currPos) { if (currPos.positionName == CompanyPositions.NetworkAdministrator.positionName) { return CompanyPositions.HeadOfEngineering; } - + //Technology management if (currPos.positionName == CompanyPositions.HeadOfSoftware.positionName) { return CompanyPositions.HeadOfEngineering; @@ -432,7 +433,7 @@ getNextCompanyPosition = function(currPos) { if (currPos.positionName == CompanyPositions.VicePresident.positionName) { return CompanyPositions.CTO; } - + //Business if (currPos.positionName == CompanyPositions.BusinessIntern.positionName) { return CompanyPositions.BusinessAnalyst; @@ -449,17 +450,17 @@ getNextCompanyPosition = function(currPos) { if (currPos.positionName == CompanyPositions.CFO.positionName) { return CompanyPositions.CEO; } - + //Business consultant if (currPos.positionName == CompanyPositions.BusinessConsultant.positionName) { return CompanyPositions.SeniorBusinessConsultant; } - + //Police if (currPos.positionName == CompanyPositions.PoliceOfficer.positionName) { return CompanyPositions.PoliceChief; } - + //Security if (currPos.positionName == CompanyPositions.SecurityGuard.positionName) { return CompanyPositions.SecurityOfficer; @@ -478,7 +479,7 @@ getNextCompanyPosition = function(currPos) { if (currPos.positionName == CompanyPositions.SecretAgent.positionName) { return CompanyPositions.SpecialOperative; } - + return null; } @@ -503,7 +504,7 @@ initCompanies = function() { delete Companies[Locations.AevumECorp]; } AddToCompanies(ECorp); - + var MegaCorp = new Company(Locations.Sector12MegaCorp, 3.0, 3.0, 249); MegaCorp.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern, @@ -520,7 +521,7 @@ initCompanies = function() { delete Companies[Locations.Sector12MegaCorp]; } AddToCompanies(MegaCorp); - + var BachmanAndAssociates = new Company(Locations.AevumBachmanAndAssociates, 2.6, 2.6, 224); BachmanAndAssociates.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern, @@ -537,7 +538,7 @@ initCompanies = function() { delete Companies[Locations.AevumBachmanAndAssociates]; } AddToCompanies(BachmanAndAssociates); - + var BladeIndustries = new Company(Locations.Sector12BladeIndustries, 2.75, 2.75, 224); BladeIndustries.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern, @@ -554,7 +555,7 @@ initCompanies = function() { delete Companies[Locations.Sector12BladeIndustries]; } AddToCompanies(BladeIndustries); - + var NWO = new Company(Locations.VolhavenNWO, 2.75, 2.75, 249); NWO.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern, @@ -571,7 +572,7 @@ initCompanies = function() { delete Companies[Locations.VolhavenNWO]; } AddToCompanies(NWO); - + var ClarkeIncorporated = new Company(Locations.AevumClarkeIncorporated, 2.25, 2.25, 224); ClarkeIncorporated.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern, @@ -588,7 +589,7 @@ initCompanies = function() { delete Companies[Locations.AevumClarkeIncorporated]; } AddToCompanies(ClarkeIncorporated); - + var OmniTekIncorporated = new Company(Locations.VolhavenOmniTekIncorporated, 2.25, 2.25, 224); OmniTekIncorporated.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern, @@ -605,7 +606,7 @@ initCompanies = function() { delete Companies[Locations.VolhavenOmniTekIncorporated]; } AddToCompanies(OmniTekIncorporated); - + var FourSigma = new Company(Locations.Sector12FourSigma, 2.5, 2.5, 224); FourSigma.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern, @@ -622,7 +623,7 @@ initCompanies = function() { delete Companies[Locations.Sector12FourSigma]; } AddToCompanies(FourSigma); - + var KuaiGongInternational = new Company(Locations.ChongqingKuaiGongInternational, 2.2, 2.2, 224); KuaiGongInternational.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern, @@ -639,7 +640,7 @@ initCompanies = function() { delete Companies[Locations.ChongqingKuaiGongInternational]; } AddToCompanies(KuaiGongInternational); - + //Technology and communication companies ("Large" servers) var FulcrumTechnologies = new Company(Locations.AevumFulcrumTechnologies, 2.0, 2.0, 224); FulcrumTechnologies.addPositions([ @@ -656,7 +657,7 @@ initCompanies = function() { delete Companies[Locations.AevumFulcrumTechnologies]; } AddToCompanies(FulcrumTechnologies); - + var StormTechnologies = new Company(Locations.IshimaStormTechnologies, 1.8, 1.8, 199); StormTechnologies.addPositions([ CompanyPositions.SoftwareIntern, @@ -665,7 +666,7 @@ initCompanies = function() { CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware, CompanyPositions.HeadOfEngineering, - CompanyPositions.VicePresident, CompanyPositions.CTO, + CompanyPositions.VicePresident, CompanyPositions.CTO, CompanyPositions.BusinessIntern, CompanyPositions.BusinessAnalyst, CompanyPositions.BusinessManager, CompanyPositions.OperationsManager, CompanyPositions.CFO, CompanyPositions.CEO]); @@ -674,12 +675,12 @@ initCompanies = function() { delete Companies[Locations.IshimaStormTechnologies]; } AddToCompanies(StormTechnologies); - + var DefComm = new Company(Locations.NewTokyoDefComm, 1.75, 1.75, 199); DefComm.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev, CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant, - CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, + CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware, CompanyPositions.HeadOfEngineering, CompanyPositions.CTO, CompanyPositions.CEO]); @@ -688,12 +689,12 @@ initCompanies = function() { delete Companies[Locations.NewTokyoDefComm]; } AddToCompanies(DefComm); - + var HeliosLabs = new Company(Locations.VolhavenHeliosLabs, 1.8, 1.8, 199); HeliosLabs.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev, CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant, - CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, + CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware, CompanyPositions.HeadOfEngineering, CompanyPositions.CTO, CompanyPositions.CEO]); @@ -701,16 +702,16 @@ initCompanies = function() { HeliosLabs.favor = Companies[Locations.VolhavenHeliosLabs].favor; delete Companies[Locations.VolhavenHeliosLabs]; } - AddToCompanies(HeliosLabs); - + AddToCompanies(HeliosLabs); + var VitaLife = new Company(Locations.NewTokyoVitaLife, 1.8, 1.8, 199); VitaLife.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev, CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant, - CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, + CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware, - CompanyPositions.HeadOfEngineering, CompanyPositions.CTO, + CompanyPositions.HeadOfEngineering, CompanyPositions.CTO, CompanyPositions.BusinessIntern, CompanyPositions.BusinessAnalyst, CompanyPositions.BusinessManager, CompanyPositions.OperationsManager, CompanyPositions.CFO, CompanyPositions.CEO]); if (companyExists(Locations.NewTokyoVitaLife)) { @@ -718,15 +719,15 @@ initCompanies = function() { delete Companies[Locations.NewTokyoVitaLife]; } AddToCompanies(VitaLife); - + var IcarusMicrosystems = new Company(Locations.Sector12IcarusMicrosystems, 1.9, 1.9, 199); IcarusMicrosystems.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev, CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant, - CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, + CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware, - CompanyPositions.HeadOfEngineering, CompanyPositions.CTO, + CompanyPositions.HeadOfEngineering, CompanyPositions.CTO, CompanyPositions.BusinessIntern, CompanyPositions.BusinessAnalyst, CompanyPositions.BusinessManager, CompanyPositions.OperationsManager, CompanyPositions.CFO, CompanyPositions.CEO]); if (companyExists(Locations.Sector12IcarusMicrosystems)) { @@ -734,31 +735,31 @@ initCompanies = function() { delete Companies[Locations.Sector12IcarusMicrosystems]; } AddToCompanies(IcarusMicrosystems); - + var UniversalEnergy = new Company(Locations.Sector12UniversalEnergy, 2.0, 2.0, 199); UniversalEnergy.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev, CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant, - CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, + CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware, - CompanyPositions.HeadOfEngineering, CompanyPositions.CTO, + CompanyPositions.HeadOfEngineering, CompanyPositions.CTO, CompanyPositions.BusinessIntern, CompanyPositions.BusinessAnalyst, CompanyPositions.BusinessManager, CompanyPositions.OperationsManager, CompanyPositions.CFO, CompanyPositions.CEO]); if (companyExists(Locations.Sector12UniversalEnergy)) { UniversalEnergy.favor = Companies[Locations.Sector12UniversalEnergy].favor; delete Companies[Locations.Sector12UniversalEnergy]; } - AddToCompanies(UniversalEnergy); - + AddToCompanies(UniversalEnergy); + var GalacticCybersystems = new Company(Locations.AevumGalacticCybersystems, 1.9, 1.9, 199); GalacticCybersystems.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev, CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant, - CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, + CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware, - CompanyPositions.HeadOfEngineering, CompanyPositions.CTO, + CompanyPositions.HeadOfEngineering, CompanyPositions.CTO, CompanyPositions.BusinessIntern, CompanyPositions.BusinessAnalyst, CompanyPositions.BusinessManager, CompanyPositions.OperationsManager, CompanyPositions.CFO, CompanyPositions.CEO]); if (companyExists(Locations.AevumGalacticCybersystems)) { @@ -766,12 +767,12 @@ initCompanies = function() { delete Companies[Locations.AevumGalacticCybersystems]; } AddToCompanies(GalacticCybersystems); - + //Defense Companies ("Large" Companies) var AeroCorp = new Company(Locations.AevumAeroCorp, 1.7, 1.7, 199); AeroCorp.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, - CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, + CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware, CompanyPositions.HeadOfEngineering, CompanyPositions.CTO, @@ -783,11 +784,11 @@ initCompanies = function() { delete Companies[Locations.AevumAeroCorp]; } AddToCompanies(AeroCorp); - + var OmniaCybersystems = new Company(Locations.VolhavenOmniaCybersystems, 1.7, 1.7, 199); OmniaCybersystems.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, - CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, + CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware, CompanyPositions.HeadOfEngineering, CompanyPositions.CTO, @@ -799,11 +800,11 @@ initCompanies = function() { delete Companies[Locations.VolhavenOmniaCybersystems]; } AddToCompanies(OmniaCybersystems); - + var SolarisSpaceSystems = new Company(Locations.ChongqingSolarisSpaceSystems, 1.7, 1.7, 199); SolarisSpaceSystems.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, - CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, + CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware, CompanyPositions.HeadOfEngineering, CompanyPositions.CTO, @@ -815,11 +816,11 @@ initCompanies = function() { delete Companies[Locations.ChongqingSolarisSpaceSystems]; } AddToCompanies(SolarisSpaceSystems); - + var DeltaOne = new Company(Locations.Sector12DeltaOne, 1.6, 1.6, 199); DeltaOne.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, - CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, + CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware, CompanyPositions.HeadOfEngineering, CompanyPositions.CTO, @@ -831,7 +832,7 @@ initCompanies = function() { delete Companies[Locations.Sector12DeltaOne]; } AddToCompanies(DeltaOne); - + //Health, medicine, pharmaceutical companies ("Large" servers) var GlobalPharmaceuticals = new Company(Locations.NewTokyoGlobalPharmaceuticals, 1.8, 1.8, 224); GlobalPharmaceuticals.addPositions([ @@ -849,7 +850,7 @@ initCompanies = function() { delete Companies[Locations.NewTokyoGlobalPharmaceuticals]; } AddToCompanies(GlobalPharmaceuticals); - + var NovaMedical = new Company(Locations.IshimaNovaMedical, 1.75, 1.75, 199); NovaMedical.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern, @@ -868,7 +869,7 @@ initCompanies = function() { AddToCompanies(NovaMedical); //Other large companies - var CIA = new Company(Locations.Sector12CIA, 2.0, 2.0, 149); + var CIA = new Company(Locations.Sector12CIA, 2.0, 2.0, 149); CIA.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, @@ -882,7 +883,7 @@ initCompanies = function() { delete Companies[Locations.Sector12CIA]; } AddToCompanies(CIA); - + var NSA = new Company(Locations.Sector12NSA, 2.0, 2.0, 149); NSA.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, @@ -897,7 +898,7 @@ initCompanies = function() { delete Companies[Locations.Sector12NSA]; } AddToCompanies(NSA); - + var WatchdogSecurity = new Company(Locations.AevumWatchdogSecurity, 1.5, 1.5, 124); WatchdogSecurity.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, @@ -913,7 +914,7 @@ initCompanies = function() { delete Companies[Locations.AevumWatchdogSecurity]; } AddToCompanies(WatchdogSecurity); - + //"Medium level" companies var LexoCorp = new Company(Locations.VolhavenLexoCorp, 1.4, 1.4, 99); LexoCorp.addPositions([ @@ -923,14 +924,14 @@ initCompanies = function() { CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.HeadOfSoftware, CompanyPositions.CTO, CompanyPositions.BusinessIntern, CompanyPositions.BusinessAnalyst, - CompanyPositions.OperationsManager, CompanyPositions.CFO, CompanyPositions.CEO, + CompanyPositions.OperationsManager, CompanyPositions.CFO, CompanyPositions.CEO, CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer, CompanyPositions.HeadOfSecurity]); if (companyExists(Locations.VolhavenLexoCorp)) { LexoCorp.favor = Companies[Locations.VolhavenLexoCorp].favor; delete Companies[Locations.VolhavenLexoCorp]; } AddToCompanies(LexoCorp); - + var RhoConstruction = new Company(Locations.AevumRhoConstruction, 1.3, 1.3, 49); RhoConstruction.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, @@ -941,7 +942,7 @@ initCompanies = function() { delete Companies[Locations.AevumRhoConstruction]; } AddToCompanies(RhoConstruction); - + var AlphaEnterprises = new Company(Locations.Sector12AlphaEnterprises, 1.5, 1.5, 99); AlphaEnterprises.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, @@ -953,7 +954,7 @@ initCompanies = function() { delete Companies[Locations.Sector12AlphaEnterprises]; } AddToCompanies(AlphaEnterprises); - + var AevumPolice = new Company(Locations.AevumPolice, 1.3, 1.3, 99); AevumPolice.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, @@ -963,11 +964,11 @@ initCompanies = function() { delete Companies[Locations.AevumPolice]; } AddToCompanies(AevumPolice); - + var SysCoreSecurities = new Company(Locations.VolhavenSysCoreSecurities, 1.3, 1.3, 124); SysCoreSecurities.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, - CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, + CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware, CompanyPositions.CTO]); @@ -976,12 +977,12 @@ initCompanies = function() { delete Companies[Locations.VolhavenSysCoreSecurities]; } AddToCompanies(SysCoreSecurities); - + var CompuTek = new Company(Locations.VolhavenCompuTek, 1.2, 1.2, 74); CompuTek.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev, CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant, - CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, + CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware, CompanyPositions.CTO]); @@ -990,12 +991,12 @@ initCompanies = function() { delete Companies[Locations.VolhavenCompuTek]; } AddToCompanies(CompuTek); - + var NetLinkTechnologies = new Company(Locations.AevumNetLinkTechnologies, 1.2, 1.2, 99); NetLinkTechnologies.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev, CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant, - CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, + CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware, CompanyPositions.CTO]); @@ -1004,11 +1005,11 @@ initCompanies = function() { delete Companies[Locations.AevumNetLinkTechnologies]; } AddToCompanies(NetLinkTechnologies); - + var CarmichaelSecurity = new Company(Locations.Sector12CarmichaelSecurity, 1.2, 1.2, 74); CarmichaelSecurity.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, - CompanyPositions.LeadDev, CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant, + CompanyPositions.LeadDev, CompanyPositions.SoftwareConsultant, CompanyPositions.SeniorSoftwareConsultant, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware, @@ -1020,7 +1021,7 @@ initCompanies = function() { delete Companies[Locations.Sector12CarmichaelSecurity]; } AddToCompanies(CarmichaelSecurity); - + //"Low level" companies var FoodNStuff = new Company(Locations.Sector12FoodNStuff, 1, 1, 0); FoodNStuff.addPositions([CompanyPositions.Employee, CompanyPositions.PartTimeEmployee]); @@ -1029,7 +1030,7 @@ initCompanies = function() { delete Companies[Locations.Sector12FoodNStuff]; } AddToCompanies(FoodNStuff); - + var JoesGuns = new Company(Locations.Sector12JoesGuns, 1, 1, 0); JoesGuns.addPositions([CompanyPositions.Employee, CompanyPositions.PartTimeEmployee]); if (companyExists(Locations.Sector12JoesGuns)) { @@ -1037,7 +1038,7 @@ initCompanies = function() { delete Companies[Locations.Sector12JoesGuns]; } AddToCompanies(JoesGuns); - + var OmegaSoftware = new Company(Locations.IshimaOmegaSoftware, 1.1, 1.1, 49); OmegaSoftware.addPositions([ CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, @@ -1049,7 +1050,7 @@ initCompanies = function() { delete Companies[Locations.IshimaOmegaSoftware]; } AddToCompanies(OmegaSoftware); - + /* Companies that do not have servers */ var NoodleBar = new Company(Locations.NewTokyoNoodleBar, 1, 1, 0); NoodleBar.addPositions([CompanyPositions.Waiter, CompanyPositions.PartTimeWaiter]); @@ -1071,4 +1072,4 @@ AddToCompanies = function (company) { function companyExists(name) { return Companies.hasOwnProperty(name); -} \ No newline at end of file +} diff --git a/src/CompanyJobApplication.js b/src/CompanyJobApplication.js index 0e1b60b21..d32ce9f03 100644 --- a/src/CompanyJobApplication.js +++ b/src/CompanyJobApplication.js @@ -2,7 +2,7 @@ //Determines the job that the Player should get (if any) at the current //company -PlayerObject.prototype.applyForJob = function(entryPosType) { +PlayerObject.prototype.applyForJob = function(entryPosType) { var currCompany = ""; if (this.companyName != "") { currCompany = Companies[this.companyName]; @@ -12,26 +12,26 @@ PlayerObject.prototype.applyForJob = function(entryPosType) { currPositionName = this.companyPosition.positionName; } var company = Companies[this.location]; //Company being applied to - + var pos = entryPosType; - + if (!this.isQualified(company, pos)) { var reqText = getJobRequirementText(company, pos); dialogBoxCreate("Unforunately, you do not qualify for this position
" + reqText); return; } - + while (true) { if (Engine.Debug) {console.log("Determining qualification for next Company Position");} var newPos = getNextCompanyPosition(pos); - + if (newPos == null) { if (Engine.Debug) { console.log("Player already at highest position, cannot go any higher"); } break; } - + //Check if this company has this position if (company.hasPosition(newPos)) { if (!this.isQualified(company, newPos)) { @@ -42,9 +42,9 @@ PlayerObject.prototype.applyForJob = function(entryPosType) { } else { break; } - + } - + //Check if the determined job is the same as the player's current job if (currCompany != "") { if (currCompany.companyName == company.companyName && @@ -52,12 +52,12 @@ PlayerObject.prototype.applyForJob = function(entryPosType) { var nextPos = getNextCompanyPosition(pos); var reqText = getJobRequirementText(company, nextPos); dialogBoxCreate("Unfortunately, you do not qualify for a promotion
" + reqText); - + return; //Same job, do nothing } } - - + + //Lose reputation from a Company if you are leaving it for another job var leaveCompany = false; var oldCompanyName = ""; @@ -72,22 +72,22 @@ PlayerObject.prototype.applyForJob = function(entryPosType) { } } } - + this.companyName = company.companyName; this.companyPosition = pos; - + if (leaveCompany) { - dialogBoxCreate("Congratulations! You were offered a new job at " + this.companyName + " as a " + - pos.positionName + "!
" + - "You lost 1000 reputation at your old company " + oldCompanyName + " because you left."); + dialogBoxCreate("Congratulations! You were offered a new job at " + this.companyName + " as a " + + pos.positionName + "!
" + + "You lost 1000 reputation at your old company " + oldCompanyName + " because you left."); } else { dialogBoxCreate("Congratulations! You were offered a new job at " + this.companyName + " as a " + pos.positionName + "!"); } - + Engine.loadLocationContent(); } -function getJobRequirementText(company, pos) { +function getJobRequirementText(company, pos, tooltiptext=false) { var reqText = ""; var offset = company.jobStatReqOffset; var reqHacking = pos.requiredHacking > 0 ? pos.requiredHacking+offset : 0; @@ -97,19 +97,61 @@ function getJobRequirementText(company, pos) { var reqAgility = pos.requiredDexterity > 0 ? pos.requiredDexterity+offset : 0; var reqCharisma = pos.requiredCharisma > 0 ? pos.requiredCharisma+offset : 0; var reqRep = pos.requiredReputation; - var reqText = "(Requires "; - if (reqHacking > 0) {reqText += (reqHacking + " hacking, ");} - if (reqStrength > 0) {reqText += (reqStrength + " strength, ");} - if (reqDefense > 0) {reqText += (reqDefense + " defense, ");} - if (reqDexterity > 0) {reqText += (reqDexterity + " dexterity, ");} - if (reqAgility > 0) {reqText += (reqAgility + " agility, ");} - if (reqCharisma > 0) {reqText += (reqCharisma + " charisma, ");} - if (reqRep > 1) {reqText += (reqRep + " reputation, ");} - reqText = reqText.substring(0, reqText.length - 2); - reqText += ")"; + if (tooltiptext) { + reqText = "Requires:
"; + reqText += (reqHacking.toString() + " hacking
"); + reqText += (reqStrength.toString() + " strength
"); + reqText += (reqDefense.toString() + " defense
"); + reqText += (reqDexterity.toString() + " dexterity
"); + reqText += (reqAgility.toString() + " agility
"); + reqText += (reqCharisma.toString() + " charisma
"); + reqText += (reqRep.toString() + " and reputation"); + } else { + reqText = "(Requires "; + if (reqHacking > 0) {reqText += (reqHacking + " hacking, ");} + if (reqStrength > 0) {reqText += (reqStrength + " strength, ");} + if (reqDefense > 0) {reqText += (reqDefense + " defense, ");} + if (reqDexterity > 0) {reqText += (reqDexterity + " dexterity, ");} + if (reqAgility > 0) {reqText += (reqAgility + " agility, ");} + if (reqCharisma > 0) {reqText += (reqCharisma + " charisma, ");} + if (reqRep > 1) {reqText += (reqRep + " reputation, ");} + reqText = reqText.substring(0, reqText.length - 2); + reqText += ")"; + } return reqText; } +//Returns your next position at a company given the field (software, business, etc.) +PlayerObject.prototype.getNextCompanyPosition = function(company, entryPosType) { + var currCompany = null; + if (this.companyName != "") { + currCompany = Companies[this.companyName]; + } + + //Not employed at this company, so return the entry position + if (currCompany == null || (currCompany.companyName != company.companyName)) { + return entryPosType; + } + + //If the entry pos type and the player's current position have the same type, + //return the player's "nextCompanyPosition". Otherwise return the entryposType + //Employed at this company, so just return the next position if it exists. + if ((this.companyPosition.isSoftwareJob() && entryPosType.isSoftwareJob()) || + (this.companyPosition.isITJob() && entryPosType.isITJob()) || + (this.companyPosition.isSecurityEngineerJob() && entryPosType.isSecurityEngineerJob()) || + (this.companyPosition.isNetworkEngineerJob() && entryPosType.isNetworkEngineerJob()) || + (this.companyPosition.isSecurityJob() && entryPosType.isSecurityJob()) || + (this.companyPosition.isAgentJob() && entryPosTypeisAgentJob()) || + (this.companyPosition.isSoftwareConsultantJob() && entryPosType.isSoftwareConsultantJob()) || + (this.companyPosition.isBusinessConsultantJob() && entryPosType.isBusinessConsultantJob()) || + (this.companyPosition.isPartTimeJob() && entryPosType.isPartTimeJob())) { + return getNextCompanyPosition(this.companyPosition); + } + + + return entryPosType; +} + PlayerObject.prototype.applyForSoftwareJob = function() { this.applyForJob(CompanyPositions.SoftwareIntern); } @@ -222,10 +264,10 @@ PlayerObject.prototype.isQualified = function(company, position) { var reqDexterity = position.requiredDexterity > 0 ? position.requiredDexterity+offset : 0; var reqAgility = position.requiredDexterity > 0 ? position.requiredDexterity+offset : 0; var reqCharisma = position.requiredCharisma > 0 ? position.requiredCharisma+offset : 0; - + if (this.hacking_skill >= reqHacking && this.strength >= reqStrength && - this.defense >= reqDefense && + this.defense >= reqDefense && this.dexterity >= reqDexterity && this.agility >= reqAgility && this.charisma >= reqCharisma && @@ -233,4 +275,4 @@ PlayerObject.prototype.isQualified = function(company, position) { return true; } return false; -} \ No newline at end of file +} diff --git a/src/Constants.js b/src/Constants.js index 47a51f977..3f4e67479 100644 --- a/src/Constants.js +++ b/src/Constants.js @@ -1,5 +1,5 @@ CONSTANTS = { - Version: "0.26.1", + Version: "0.26.2", //Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience //and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then @@ -61,9 +61,7 @@ CONSTANTS = { ScriptHasRootAccessRamCost: 0.05, ScriptGetHostnameRamCost: 0.05, ScriptGetHackingLevelRamCost: 0.05, - ScriptGetServerMoneyRamCost: 0.1, - ScriptGetServerSecurityRamCost: 0.1, - ScriptGetServerReqdHackRamCost: 0.1, + ScriptGetServerCost: 0.1, ScriptFileExistsRamCost: 0.1, ScriptIsRunningRamCost: 0.1, ScriptOperatorRamCost: 0.01, @@ -86,6 +84,8 @@ CONSTANTS = { ServerFortifyAmount: 0.002, //Amount by which server's security increases when its hacked/grown ServerWeakenAmount: 0.05, //Amount by which server's security decreases when weakened + PurchasedServerLimit: 25, + //Augmentation Constants AugmentationCostMultiplier: 5, //Used for balancing costs without having to readjust every Augmentation cost AugmentationRepMultiplier: 2.5, //Used for balancing rep cost without having to readjust every value @@ -678,7 +678,20 @@ CONSTANTS = { "World Stock Exchange account and TIX API Access
", LatestUpdate: - "V0.26.1
" + + "v0.26.2
" + + "-Major rebalancing and randomization of the amount of money that servers start with
" + + "-Significantly lowered hacking exp gain from hacking servers. The exp gain for higher-level servers was lowered more than " + + "that of low level servers. (~16% for lower level servers, up to ~25% for higher-level servers)
" + + "-Added deleteServer() Netscript function
" + + "-You can now purchase a maximum of 25 servers each run (Deleting a server will allow you to purchase a new one)
" + + "-Added autocompletion for './' Terminal command
" + + "-Darkweb prices now displayed properly using toLocaleString()
" + + "-Added NOT operator (!) and negation operator(-), so negative numbers should be functional now
" + + "-Rejected faction invitations will now show up as 'Outstanding Faction Invites' in the Factions page. These " + + "can be accepted at any point in the future
" + + "-Added a few more configurable game settings for suppressing messages and faction invitations
" + + "-Added tooltips for company job requirements

" + + "v0.26.1
" + "-Added autocompletion for aliases
" + "-Added getServerRam() Netscript function()
" + "-Added getLevelUpgradeCost(n), getRamUpgradeCost(), getCoreUpgradeCost() functions for Netscript Hacknet Node API
" + diff --git a/src/DarkWeb.js b/src/DarkWeb.js index 9c3bfd377..25c574dd7 100644 --- a/src/DarkWeb.js +++ b/src/DarkWeb.js @@ -6,11 +6,11 @@ checkIfConnectedToDarkweb = function() { if (!isValidIPAddress(darkwebIp)) {return;} if (darkwebIp == Player.getCurrentServer().ip) { post("You are now connected to the dark web. From the dark web you can purchase illegal items. " + - "Use the 'buy -l' command to display a list of all the items you can buy. Use 'buy [item-name] " + + "Use the 'buy -l' command to display a list of all the items you can buy. Use 'buy [item-name] " + "to purchase an item"); } } - + } //Handler for dark web commands. The terminal's executeCommand() function will pass @@ -41,9 +41,39 @@ executeDarkwebTerminalCommand = function(commandArray) { listAllDarkwebItems = function() { for (var item in DarkWebItems) { if (DarkWebItems.hasOwnProperty(item)) { - post(DarkWebItems[item]); + var item = DarkWebItems[item]; + //Convert string using toLocaleString + var split = item.split(" - "); + if (split.length == 3 && split[1].charAt(0) == '$') { + split[1] = split[1].slice(1); + split[1] = split[1].replace(/,/g, ''); + var price = parseFloat(split[1]); + if (isNaN(price)) { + post(item); + return; + } + price = formatNumber(price, 0); + split[1] = "$" + price.toString(); + post(split.join(" - ")); + } else { + post(item); + } } } + + var priceString = split[1]; + //Check for errors + if (priceString.length == 0 || priceString.charAt(0) != '$') { + return -1; + } + //Remove dollar sign and commas + priceString = priceString.slice(1); + priceString = priceString.replace(/,/g, ''); + + //Convert string to numeric + var price = parseFloat(priceString); + if (isNaN(price)) {return -1;} + else {return price;} } buyDarkwebItem = function(itemName) { @@ -52,7 +82,7 @@ buyDarkwebItem = function(itemName) { if (price > 0 && Player.money >= price) { Player.loseMoney(price); Player.getHomeComputer().programs.push(Programs.BruteSSHProgram); - post("You have purchased the BruteSSH.exe program. The new program " + + post("You have purchased the BruteSSH.exe program. The new program " + "can be found on your home computer."); } else { post("Not enough money to purchase " + itemName); @@ -62,7 +92,7 @@ buyDarkwebItem = function(itemName) { if (price > 0 && Player.money >= price) { Player.loseMoney(price); Player.getHomeComputer().programs.push(Programs.FTPCrackProgram); - post("You have purchased the FTPCrack.exe program. The new program " + + post("You have purchased the FTPCrack.exe program. The new program " + "can be found on your home computer."); } else { post("Not enough money to purchase " + itemName); @@ -72,7 +102,7 @@ buyDarkwebItem = function(itemName) { if (price > 0 && Player.money >= price) { Player.loseMoney(price); Player.getHomeComputer().programs.push(Programs.RelaySMTPProgram); - post("You have purchased the relaySMTP.exe program. The new program " + + post("You have purchased the relaySMTP.exe program. The new program " + "can be found on your home computer."); } else { post("Not enough money to purchase " + itemName); @@ -82,7 +112,7 @@ buyDarkwebItem = function(itemName) { if (price > 0 && Player.money >= price) { Player.loseMoney(price); Player.getHomeComputer().programs.push(Programs.HTTPWormProgram); - post("You have purchased the HTTPWorm.exe program. The new program " + + post("You have purchased the HTTPWorm.exe program. The new program " + "can be found on your home computer."); } else { post("Not enough money to purchase " + itemName); @@ -92,7 +122,7 @@ buyDarkwebItem = function(itemName) { if (price > 0 && Player.money >= price) { Player.loseMoney(price); Player.getHomeComputer().programs.push(Programs.SQLInjectProgram); - post("You have purchased the SQLInject.exe program. The new program " + + post("You have purchased the SQLInject.exe program. The new program " + "can be found on your home computer."); } else { post("Not enough money to purchase " + itemName); @@ -102,7 +132,7 @@ buyDarkwebItem = function(itemName) { if (price > 0 && Player.money >= price) { Player.loseMoney(price); Player.getHomeComputer().programs.push(Programs.DeepscanV1); - post("You have purchased the DeepscanV1.exe program. The new program " + + post("You have purchased the DeepscanV1.exe program. The new program " + "can be found on your home computer."); } else { post("Not enough money to purchase " + itemName); @@ -112,7 +142,7 @@ buyDarkwebItem = function(itemName) { if (price > 0 && Player.money >= price) { Player.loseMoney(price); Player.getHomeComputer().programs.push(Programs.DeepscanV2); - post("You have purchased the DeepscanV2.exe program. The new program " + + post("You have purchased the DeepscanV2.exe program. The new program " + "can be found on your home computer."); } else { post("Not enough money to purchase " + itemName); @@ -133,7 +163,7 @@ parseDarkwebItemPrice = function(itemDesc) { //Remove dollar sign and commas priceString = priceString.slice(1); priceString = priceString.replace(/,/g, ''); - + //Convert string to numeric var price = parseFloat(priceString); if (isNaN(price)) {return -1;} @@ -151,4 +181,4 @@ DarkWebItems = { SQLInjectProgram: Programs.SQLInjectProgram + " - $250,000,000 - Opens up SQL Ports", DeepScanV1Program: Programs.DeepscanV1 + " - $500,000 - Enables 'scan-analyze' with a depth up to 5", DeepScanV2Program: Programs.DeepscanV2 + " - $25,000,000 - Enables 'scan-analyze' with a depth up to 10", -} \ No newline at end of file +} diff --git a/src/Faction.js b/src/Faction.js index c07041e91..af23322f3 100644 --- a/src/Faction.js +++ b/src/Faction.js @@ -630,7 +630,12 @@ PlayerObject.prototype.checkForFactionInvitations = function() { } inviteToFaction = function(faction) { - factionInvitationBoxCreate(faction); + if (Settings.SuppressFactionInvites) { + faction.alreadyInvited = true; + Player.factionInvitations.push(faction.name); + } else { + factionInvitationBoxCreate(faction); + } } joinFaction = function(faction) { diff --git a/src/Location.js b/src/Location.js index b2f206e7b..ca73b4be1 100644 --- a/src/Location.js +++ b/src/Location.js @@ -1,6 +1,6 @@ /* Display Location Content when visiting somewhere in the World*/ - + Locations = { //Cities Aevum: "Aevum", @@ -10,7 +10,7 @@ Locations = { NewTokyo: "New Tokyo", Ishima: "Ishima", Volhaven: "Volhaven", - + //Aevum Locations AevumTravelAgency: "Aevum Travel Agency", AevumSummitUniversity: "Summit University", @@ -22,18 +22,18 @@ Locations = { AevumGalacticCybersystems: "Galactic Cybersystems", AevumWatchdogSecurity: "Watchdog Security", AevumRhoConstruction: "Rho Construction", - AevumPolice: "Aevum Police Headquarters", + AevumPolice: "Aevum Police Headquarters", AevumNetLinkTechnologies: "NetLink Technologies", AevumCrushFitnessGym: "Crush Fitness Gym", AevumSnapFitnessGym: "Snap Fitness Gym", AevumSlums: "Aevum Slums", - + //Chongqing locations - ChongqingTravelAgency: "Chongqing Travel Agency", + ChongqingTravelAgency: "Chongqing Travel Agency", ChongqingKuaiGongInternational: "KuaiGong International", ChongqingSolarisSpaceSystems: "Solaris Space Systems", ChongqingSlums: "Chongqing Slums", - + //Sector 12 Sector12TravelAgency: "Sector-12 Travel Agency", Sector12RothmanUniversity: "Rothman University", @@ -52,7 +52,7 @@ Locations = { Sector12IronGym: "Iron Gym", Sector12PowerhouseGym: "Powerhouse Gym", Sector12Slums: "Sector-12 Slums", - + //New Tokyo NewTokyoTravelAgency: "New Tokyo Travel Agency", NewTokyoDefComm: "DefComm", @@ -60,14 +60,14 @@ Locations = { NewTokyoGlobalPharmaceuticals: "Global Pharmaceuticals", NewTokyoNoodleBar: "Noodle Bar", NewTokyoSlums: "New Tokyo Slums", - + //Ishima IshimaTravelAgency: "Ishima Travel Agency", IshimaStormTechnologies: "Storm Technologies", IshimaNovaMedical: "Nova Medical", IshimaOmegaSoftware: "Omega Software", IshimaSlums: "Ishima Slums", - + //Volhaven VolhavenTravelAgency: "Volhaven Travel Agency", VolhavenZBInstituteOfTechnology: "ZB Institute of Technology", @@ -80,7 +80,7 @@ Locations = { VolhavenCompuTek: "CompuTek", VolhavenMilleniumFitnessGym: "Millenium Fitness Gym", VolhavenSlums: "Volhaven Slums", - + //Generic locations Hospital: "Hospital", WorldStockExchange: "World Stock Exchange", @@ -90,9 +90,9 @@ displayLocationContent = function() { if (Engine.debug) { console.log("displayLocationContent() called with location " + Player.location) } - + var returnToWorld = document.getElementById("location-return-to-world-button"); - + var locationName = document.getElementById("location-name"); var locationInfo = document.getElementById("location-info"); @@ -110,28 +110,28 @@ displayLocationContent = function() { 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 = clearEventListeners("location-work"); - + var jobTitle = document.getElementById("location-job-title"); var jobReputation = document.getElementById("location-job-reputation"); var companyFavor = document.getElementById("location-company-favor"); var locationTxtDiv1 = document.getElementById("location-text-divider-1"); var locationTxtDiv2 = document.getElementById("location-text-divider-2"); var locationTxtDiv3 = document.getElementById("location-text-divider-3"); - + 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 purchase2gb = document.getElementById("location-purchase-2gb"); var purchase4gb = document.getElementById("location-purchase-4gb"); var purchase8gb = document.getElementById("location-purchase-8gb"); @@ -144,7 +144,7 @@ displayLocationContent = function() { 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"); @@ -152,11 +152,11 @@ displayLocationContent = function() { 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 infiltrate = clearEventListeners("location-infiltrate"); - + var hospitalTreatment = document.getElementById("location-hospital-treatment"); - + var slumsDescText = document.getElementById("location-slums-description"); var slumsShoplift = document.getElementById("location-slums-shoplift"); var slumsMug = document.getElementById("location-slums-mug"); @@ -167,9 +167,9 @@ displayLocationContent = function() { 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; - + returnToWorld.addEventListener("click", function() { Engine.loadWorldContent(); }); @@ -178,7 +178,7 @@ displayLocationContent = function() { locationName.style.display = "block"; locationInfo.style.display = "block"; - + softwareJob.style.display = "none"; softwareConsultantJob.style.display = "none"; itJob.style.display = "none"; @@ -192,7 +192,7 @@ displayLocationContent = function() { employeePartTimeJob.style.display = "none"; waiterJob.style.display = "none"; waiterPartTimeJob.style.display = "none"; - + softwareJob.innerHTML = "Apply for Software Job"; softwareConsultantJob.innerHTML = "Apply for a Software Consultant job"; itJob.innerHTML = "Apply for IT Job"; @@ -206,21 +206,21 @@ displayLocationContent = function() { employeePartTimeJob.innerHTML = "Apply to be a Part-time Employee"; waiterJob.innerHTML = "Apply to be a Waiter"; waiterPartTimeJob.innerHTML = "Apply to be a Part-time Waiter" - + work.style.display = "none"; - + gymTrainStr.style.display = "none"; gymTrainDef.style.display = "none"; gymTrainDex.style.display = "none"; gymTrainAgi.style.display = "none"; - + studyComputerScience.style.display = "none"; classDataStructures.style.display = "none"; classNetworks.style.display = "none"; classAlgorithms.style.display = "none"; classManagement.style.display = "none"; classLeadership.style.display = "none"; - + purchase2gb.style.display = "none"; purchase4gb.style.display = "none"; purchase8gb.style.display = "none"; @@ -233,7 +233,7 @@ displayLocationContent = function() { purchase1tb.style.display = "none"; purchaseTor.style.display = "none"; purchaseHomeRam.style.display = "none"; - + purchase2gb.innerHTML = "Purchase 2GB Server - $" + formatNumber(2*CONSTANTS.BaseCostFor1GBOfRamServer, 2); purchase4gb.innerHTML = "Purchase 4GB Server - $" + formatNumber(4*CONSTANTS.BaseCostFor1GBOfRamServer, 2); purchase8gb.innerHTML = "Purchase 8GB Server - $" + formatNumber(8*CONSTANTS.BaseCostFor1GBOfRamServer, 2); @@ -245,7 +245,7 @@ displayLocationContent = function() { purchase512gb.innerHTML = "Purchase 512GB Server - $" + formatNumber(512*CONSTANTS.BaseCostFor1GBOfRamServer, 2); purchase1tb.innerHTML = "Purchase 1TB Server - $" + formatNumber(1024*CONSTANTS.BaseCostFor1GBOfRamServer, 2); purchaseTor.innerHTML = "Purchase TOR Router - $" + formatNumber(CONSTANTS.TorRouterCost, 2); - + travelAgencyText.style.display = "none"; travelToAevum.style.display = "none"; travelToChongqing.style.display = "none"; @@ -253,11 +253,11 @@ displayLocationContent = function() { travelToNewTokyo.style.display = "none"; travelToIshima.style.display = "none"; travelToVolhaven.style.display = "none"; - + infiltrate.style.display = "none"; - + hospitalTreatment.style.display = "none"; - + slumsDescText.style.display = "none"; slumsShoplift.style.display = "none"; slumsMug.style.display = "none"; @@ -268,12 +268,12 @@ displayLocationContent = function() { slumsKidnap.style.display = "none"; slumsAssassinate.style.display = "none"; slumsHeist.style.display = "none"; - + //Check if the player is employed at this Location. If he is, display the "Work" button, //update the job title, etc. if (loc == Player.companyName) { var company = Companies[loc]; - + jobTitle.style.display = "block"; jobReputation.style.display = "inline"; companyFavor.style.display = "inline"; @@ -281,19 +281,19 @@ displayLocationContent = function() { locationTxtDiv2.style.display = "block"; locationTxtDiv3.style.display = "block"; jobTitle.innerHTML = "Job Title: " + Player.companyPosition.positionName; - jobReputation.innerHTML = "Company reputation: " + formatNumber(company.playerReputation, 4) + - "You will earn " + + jobReputation.innerHTML = "Company reputation: " + formatNumber(company.playerReputation, 4) + + "You will earn " + formatNumber(company.playerReputation / CONSTANTS.CompanyReputationToFavor, 4) + " faction favor upon resetting after installing an Augmentation"; - companyFavor.innerHTML = "Company Favor: " + formatNumber(company.favor, 4) + - "Company favor increases the rate at which " + - "you earn reputation for this company by 1% per favor. Company favor " + + companyFavor.innerHTML = "Company Favor: " + formatNumber(company.favor, 4) + + "Company favor increases the rate at which " + + "you earn reputation for this company by 1% per favor. Company favor " + "is gained whenever you reset after installing an Augmentation. The amount of " + "favor you gain depends on how much reputation you have with the company"; work.style.display = "block"; - + var currPos = Player.companyPosition; - + work.addEventListener("click", function() { if (currPos.isPartTimeJob()) { Player.startWorkPartTime(); @@ -302,7 +302,7 @@ displayLocationContent = function() { } return false; }); - + //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)"; @@ -331,13 +331,28 @@ displayLocationContent = function() { locationTxtDiv2.style.display = "none"; locationTxtDiv3.style.display = "none"; } - + //Calculate hospital Cost if (Player.hp < 0) {Player.hp = 0;} var hospitalTreatmentCost = (Player.max_hp - Player.hp) * CONSTANTS.HospitalCostPerHp; - + + //Set tooltip for job requirements + setJobRequirementTooltip(loc, CompanyPositions.SoftwareIntern, softwareJob); + setJobRequirementTooltip(loc, CompanyPositions.SoftwareConsultant, softwareConsultantJob); + setJobRequirementTooltip(loc, CompanyPositions.ITIntern, itJob); + setJobRequirementTooltip(loc, CompanyPositions.SecurityEngineer, securityEngineerJob); + setJobRequirementTooltip(loc, CompanyPositions.NetworkEngineer, networkEngineerJob); + setJobRequirementTooltip(loc, CompanyPositions.BusinessIntern, businessJob); + setJobRequirementTooltip(loc, CompanyPositions.BusinessConsultant, businessConsultantJob); + setJobRequirementTooltip(loc, CompanyPositions.SecurityGuard, securityJob); + setJobRequirementTooltip(loc, CompanyPositions.FieldAgent, agentJob); + setJobRequirementTooltip(loc, CompanyPositions.Employee, employeeJob); + setJobRequirementTooltip(loc, CompanyPositions.PartTimeEmployee, employeePartTimeJob); + setJobRequirementTooltip(loc, CompanyPositions.Waiter, waiterJob); + setJobRequirementTooltip(loc, CompanyPositions.PartTimeWaiter, waiterPartTimeJob); + switch (loc) { - case Locations.AevumTravelAgency: + case Locations.AevumTravelAgency: travelAgencyText.style.display = "block"; travelToChongqing.style.display = "block"; travelToSector12.style.display = "block"; @@ -345,106 +360,106 @@ displayLocationContent = function() { travelToIshima.style.display = "block"; travelToVolhaven.style.display = "block"; break; - + case Locations.AevumSummitUniversity: var costMult = 4, expMult = 3; displayUniversityLocationContent(costMult); setUniversityLocationButtons(costMult, expMult); break; - - case Locations.AevumECorp: + + case Locations.AevumECorp: locationInfo.innerHTML = Companies[loc].info; - + softwareJob.style.display = "block"; itJob.style.display = "block"; securityEngineerJob.style.display = "block"; networkEngineerJob.style.display = "block"; businessJob.style.display = "block"; securityJob.style.display = "block"; - + purchase128gb.style.display = "block"; purchase256gb.style.display = "block"; purchase512gb.style.display = "block"; purchase1tb.style.display = "block"; purchaseTor.style.display = "block"; purchaseHomeRam.style.display = "block"; - setInfiltrateButton(infiltrate, Locations.AevumECorp, + setInfiltrateButton(infiltrate, Locations.AevumECorp, 6000, 116, 150, 9.5); break; - - case Locations.AevumBachmanAndAssociates: + + case Locations.AevumBachmanAndAssociates: locationInfo.innerHTML = Companies[loc].info; - + softwareJob.style.display = "block"; itJob.style.display = "block"; securityEngineerJob.style.display = "block"; networkEngineerJob.style.display = "block"; businessJob.style.display = "block"; securityJob.style.display = "block"; - setInfiltrateButton(infiltrate, Locations.AevumBachmanAndAssociates, + setInfiltrateButton(infiltrate, Locations.AevumBachmanAndAssociates, 1500, 42, 60, 6.5); break; - case Locations.AevumClarkeIncorporated: + case Locations.AevumClarkeIncorporated: locationInfo.innerHTML = Companies[loc].info; - + softwareJob.style.display = "block"; itJob.style.display = "block"; securityEngineerJob.style.display = "block"; networkEngineerJob.style.display = "block"; businessJob.style.display = "block"; securityJob.style.display = "block"; - setInfiltrateButton(infiltrate, Locations.AevumClarkeIncorporated, + setInfiltrateButton(infiltrate, Locations.AevumClarkeIncorporated, 2400, 34, 75, 6); break; - case Locations.AevumFulcrumTechnologies: + case Locations.AevumFulcrumTechnologies: locationInfo.innerHTML = Companies[loc].info; - + softwareJob.style.display = "block"; itJob.style.display = "block"; securityEngineerJob.style.display = "block"; networkEngineerJob.style.display = "block"; businessJob.style.display = "block"; - + purchase128gb.style.display = "block"; purchase256gb.style.display = "block"; purchase512gb.style.display = "block"; purchase1tb.style.display = "block"; purchaseTor.style.display = "block"; purchaseHomeRam.style.display = "block"; - setInfiltrateButton(infiltrate, Locations.AevumFulcrumTechnologies, + setInfiltrateButton(infiltrate, Locations.AevumFulcrumTechnologies, 6000, 96, 100, 10); break; - case Locations.AevumAeroCorp: + case Locations.AevumAeroCorp: locationInfo.innerHTML = Companies[loc].info; - + softwareJob.style.display = "block"; itJob.style.display = "block"; securityEngineerJob.style.display = "block"; networkEngineerJob.style.display = "block"; securityJob.style.display = "block"; - setInfiltrateButton(infiltrate, Locations.AevumAeroCorp, + setInfiltrateButton(infiltrate, Locations.AevumAeroCorp, 2000, 32, 50, 7); break; - case Locations.AevumGalacticCybersystems: + case Locations.AevumGalacticCybersystems: 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"; businessJob.style.display = "block"; - setInfiltrateButton(infiltrate, Locations.AevumGalacticCybersystems, + setInfiltrateButton(infiltrate, Locations.AevumGalacticCybersystems, 1400, 30, 50, 6); break; - case Locations.AevumWatchdogSecurity: + case Locations.AevumWatchdogSecurity: locationInfo.innerHTML = Companies[loc].info; - + softwareJob.style.display = "block"; softwareConsultantJob.style.display = "block"; itJob.style.display = "block"; @@ -452,37 +467,37 @@ displayLocationContent = function() { networkEngineerJob.style.display = "block"; securityJob.style.display = "block"; agentJob.style.display = "block"; - setInfiltrateButton(infiltrate, Locations.AevumWatchdogSecurity, + setInfiltrateButton(infiltrate, Locations.AevumWatchdogSecurity, 850, 16, 30, 5); break; - case Locations.AevumRhoConstruction: + case Locations.AevumRhoConstruction: locationInfo.innerHTML = Companies[loc].info; - + softwareJob.style.display = "block"; - businessJob.style.display = "block"; - setInfiltrateButton(infiltrate, Locations.AevumRhoConstruction, + businessJob.style.display = "block"; + setInfiltrateButton(infiltrate, Locations.AevumRhoConstruction, 600, 12, 20, 3); break; - case Locations.AevumPolice: + case Locations.AevumPolice: locationInfo.innerHTML = Companies[loc].info; - + softwareJob.style.display = "block"; securityJob.style.display = "block"; - setInfiltrateButton(infiltrate, Locations.AevumPolice, + setInfiltrateButton(infiltrate, Locations.AevumPolice, 700, 14, 25, 3.5); break; - case Locations.AevumNetLinkTechnologies: + case Locations.AevumNetLinkTechnologies: 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"; - + purchase2gb.style.display = "block"; purchase4gb.style.display = "block"; purchase8gb.style.display = "block"; @@ -498,24 +513,24 @@ displayLocationContent = function() { setGymLocationButtons(costMult, expMult); break; - case Locations.AevumSnapFitnessGym: + case Locations.AevumSnapFitnessGym: var costMult = 6, expMult = 4; displayGymLocationContent(costMult); setGymLocationButtons(costMult, expMult); break; - case Locations.ChongqingTravelAgency: + case Locations.ChongqingTravelAgency: travelAgencyText.style.display = "block"; travelToAevum.style.display = "block"; travelToSector12.style.display = "block"; travelToNewTokyo.style.display = "block"; travelToIshima.style.display = "block"; - travelToVolhaven.style.display = "block"; + travelToVolhaven.style.display = "block"; break; case Locations.ChongqingKuaiGongInternational: locationInfo.innerHTML = Companies[loc].info; - + softwareJob.style.display = "block"; itJob.style.display = "block"; securityEngineerJob.style.display = "block"; @@ -526,9 +541,9 @@ displayLocationContent = function() { 5500, 48, 100, 10); break; - case Locations.ChongqingSolarisSpaceSystems: + case Locations.ChongqingSolarisSpaceSystems: locationInfo.innerHTML = Companies[loc].info; - + softwareJob.style.display = "block"; itJob.style.display = "block"; securityEngineerJob.style.display = "block"; @@ -539,7 +554,7 @@ displayLocationContent = function() { break; - case Locations.Sector12TravelAgency: + case Locations.Sector12TravelAgency: travelAgencyText.style.display = "block"; travelToAevum.style.display = "block"; travelToChongqing.style.display = "block"; @@ -547,16 +562,16 @@ displayLocationContent = function() { travelToIshima.style.display = "block"; travelToVolhaven.style.display = "block"; break; - + case Locations.Sector12RothmanUniversity: var costMult = 3, expMult = 2; displayUniversityLocationContent(costMult); setUniversityLocationButtons(costMult, expMult); break; - case Locations.Sector12MegaCorp: + case Locations.Sector12MegaCorp: locationInfo.innerHTML = Companies[loc].info; - + softwareJob.style.display = "block"; itJob.style.display = "block"; securityEngineerJob.style.display = "block"; @@ -567,99 +582,99 @@ displayLocationContent = function() { 6000, 114, 125, 11); break; - case Locations.Sector12BladeIndustries: + case Locations.Sector12BladeIndustries: locationInfo.innerHTML = Companies[loc].info; - + softwareJob.style.display = "block"; itJob.style.display = "block"; securityEngineerJob.style.display = "block"; networkEngineerJob.style.display = "block"; businessJob.style.display = "block"; securityJob.style.display = "block"; - setInfiltrateButton(infiltrate, Locations.Sector12BladeIndustries, + setInfiltrateButton(infiltrate, Locations.Sector12BladeIndustries, 3000, 46, 100, 7.5); break; - case Locations.Sector12FourSigma: + case Locations.Sector12FourSigma: locationInfo.innerHTML = Companies[loc].info; - + softwareJob.style.display = "block"; itJob.style.display = "block"; securityEngineerJob.style.display = "block"; networkEngineerJob.style.display = "block"; businessJob.style.display = "block"; securityJob.style.display = "block"; - setInfiltrateButton(infiltrate, Locations.Sector12FourSigma, + setInfiltrateButton(infiltrate, Locations.Sector12FourSigma, 1500, 58, 100, 11.5); break; - case Locations.Sector12IcarusMicrosystems: + case Locations.Sector12IcarusMicrosystems: 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"; businessJob.style.display = "block"; - setInfiltrateButton(infiltrate, Locations.Sector12IcarusMicrosystems, + setInfiltrateButton(infiltrate, Locations.Sector12IcarusMicrosystems, 900, 32, 70, 8.5); break; case Locations.Sector12UniversalEnergy: 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"; businessJob.style.display = "block"; - setInfiltrateButton(infiltrate, Locations.Sector12UniversalEnergy, + setInfiltrateButton(infiltrate, Locations.Sector12UniversalEnergy, 775, 24, 50, 7); break; - case Locations.Sector12DeltaOne: + case Locations.Sector12DeltaOne: locationInfo.innerHTML = Companies[loc].info; - + softwareJob.style.display = "block"; itJob.style.display = "block"; securityEngineerJob.style.display = "block"; networkEngineerJob.style.display = "block"; securityJob.style.display = "block"; - setInfiltrateButton(infiltrate, Locations.Sector12DeltaOne, + setInfiltrateButton(infiltrate, Locations.Sector12DeltaOne, 1200, 38, 75, 7); break; - case Locations.Sector12CIA: + case Locations.Sector12CIA: locationInfo.innerHTML = Companies[loc].info; - + softwareJob.style.display = "block"; itJob.style.display = "block"; securityEngineerJob.style.display = "block"; networkEngineerJob.style.display = "block"; securityJob.style.display = "block"; agentJob.style.display = "block"; - setInfiltrateButton(infiltrate, Locations.Sector12CIA, + setInfiltrateButton(infiltrate, Locations.Sector12CIA, 1450, 44, 80, 8.5); break; - case Locations.Sector12NSA: + case Locations.Sector12NSA: locationInfo.innerHTML = Companies[loc].info; - + softwareJob.style.display = "block"; itJob.style.display = "block"; securityEngineerJob.style.display = "block"; networkEngineerJob.style.display = "block"; securityJob.style.display = "block"; agentJob.style.display = "block"; - setInfiltrateButton(infiltrate, Locations.Sector12NSA, + setInfiltrateButton(infiltrate, Locations.Sector12NSA, 1400, 40, 80, 8); break; case Locations.Sector12AlphaEnterprises: locationInfo.innerHTML = Companies[loc].info; - + softwareJob.style.display = "block"; softwareConsultantJob.style.display = "block"; businessJob.style.display = "block"; @@ -667,13 +682,13 @@ displayLocationContent = function() { purchase4gb.style.display = "block"; purchaseTor.style.display = "block"; purchaseHomeRam.style.display = "block"; - setInfiltrateButton(infiltrate, Locations.Sector12AlphaEnterprises, + setInfiltrateButton(infiltrate, Locations.Sector12AlphaEnterprises, 250, 14, 40, 3); break; case Locations.Sector12CarmichaelSecurity: locationInfo.innerHTML = Companies[loc].info; - + softwareJob.style.display = "block"; softwareConsultantJob.style.display = "block"; itJob.style.display = "block"; @@ -681,23 +696,23 @@ displayLocationContent = function() { networkEngineerJob.style.display = "block"; securityJob.style.display = "block"; agentJob.style.display = "block"; - setInfiltrateButton(infiltrate, Locations.Sector12CarmichaelSecurity, + setInfiltrateButton(infiltrate, Locations.Sector12CarmichaelSecurity, 500, 18, 60, 3); break; case Locations.Sector12FoodNStuff: 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"; - setInfiltrateButton(infiltrate, Locations.Sector12JoesGuns, + setInfiltrateButton(infiltrate, Locations.Sector12JoesGuns, 120, 8, 20, 2.5); break; @@ -713,7 +728,7 @@ displayLocationContent = function() { setGymLocationButtons(costMult, expMult); break; - case Locations.NewTokyoTravelAgency: + case Locations.NewTokyoTravelAgency: travelAgencyText.style.display = "block"; travelToAevum.style.display = "block"; travelToChongqing.style.display = "block"; @@ -724,32 +739,32 @@ displayLocationContent = function() { case Locations.NewTokyoDefComm: 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"; - setInfiltrateButton(infiltrate, Locations.NewTokyoDefComm, + setInfiltrateButton(infiltrate, Locations.NewTokyoDefComm, 1300, 28, 70, 6); break; case Locations.NewTokyoVitaLife: 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"; businessJob.style.display = "block"; - setInfiltrateButton(infiltrate, Locations.NewTokyoVitaLife, + setInfiltrateButton(infiltrate, Locations.NewTokyoVitaLife, 750, 22, 100, 5.5); break; - case Locations.NewTokyoGlobalPharmaceuticals: + case Locations.NewTokyoGlobalPharmaceuticals: locationInfo.innerHTML = Companies[loc].info; - + softwareJob.style.display = "block"; softwareConsultantJob.style.display = "block"; itJob.style.display = "block"; @@ -757,13 +772,13 @@ displayLocationContent = function() { networkEngineerJob.style.display = "block"; businessJob.style.display = "block"; securityJob.style.display = "block"; - setInfiltrateButton(infiltrate, Locations.NewTokyoGlobalPharmaceuticals, + setInfiltrateButton(infiltrate, Locations.NewTokyoGlobalPharmaceuticals, 900, 24, 80, 6); break; - case Locations.NewTokyoNoodleBar: + case Locations.NewTokyoNoodleBar: locationInfo.innerHTML = Companies[loc].info; - + waiterJob.style.display = "block"; waitPartTimeJob.style.display = "block"; break; @@ -779,7 +794,7 @@ displayLocationContent = function() { case Locations.IshimaStormTechnologies: locationInfo.innerHTML = Companies[loc].info; - + softwareJob.style.display = "block"; softwareConsultantJob.style.display = "block"; itJob.style.display = "block"; @@ -789,45 +804,45 @@ displayLocationContent = function() { securityJob.style.display = "none"; agentJob.style.display = "none"; employeeJob.style.display = "none"; - waiterJob.style.display = "none"; + waiterJob.style.display = "none"; purchase32gb.style.display = "block"; purchase64gb.style.display = "block"; purchase128gb.style.display = "block"; purchase256gb.style.display = "block"; purchaseHomeRam.style.display = "block"; - setInfiltrateButton(infiltrate, Locations.IshimaStormTechnologies, + setInfiltrateButton(infiltrate, Locations.IshimaStormTechnologies, 700, 24, 100, 6.5); break; - case Locations.IshimaNovaMedical: + case Locations.IshimaNovaMedical: 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"; businessJob.style.display = "block"; - setInfiltrateButton(infiltrate, Locations.IshimaNovaMedical, + setInfiltrateButton(infiltrate, Locations.IshimaNovaMedical, 600, 20, 50, 5); break; - case Locations.IshimaOmegaSoftware: + case Locations.IshimaOmegaSoftware: locationInfo.innerHTML = Companies[loc].info; - + softwareJob.style.display = "block"; softwareConsultantJob.style.display = "block"; itJob.style.display = "block"; businessJob.style.display = "block"; - + purchase4gb.style.display = "block"; purchase8gb.style.display = "block"; purchase16gb.style.display = "block"; purchase32gb.style.display = "block"; purchaseTor.style.display = "block"; purchaseHomeRam.style.display = "block"; - setInfiltrateButton(infiltrate, Locations.IshimaOmegaSoftware, + setInfiltrateButton(infiltrate, Locations.IshimaOmegaSoftware, 200, 10, 40, 2.5); break; @@ -839,71 +854,71 @@ displayLocationContent = function() { travelToNewTokyo.style.display = "block"; travelToIshima.style.display = "block"; break; - + case Locations.VolhavenZBInstituteOfTechnology: var costMult = 5, expMult = 4; displayUniversityLocationContent(costMult); setUniversityLocationButtons(costMult, expMult); break; - case Locations.VolhavenOmniTekIncorporated: + case Locations.VolhavenOmniTekIncorporated: locationInfo.innerHTML = Companies[loc].info; - + softwareJob.style.display = "block"; itJob.style.display = "block"; securityEngineerJob.style.display = "block"; networkEngineerJob.style.display = "block"; businessJob.style.display = "block"; securityJob.style.display = "block"; - + purchase128gb.style.display = "block"; purchase256gb.style.display = "block"; purchase512gb.style.display = "block"; purchase1tb.style.display = "block"; - setInfiltrateButton(infiltrate, Locations.VolhavenOmniTekIncorporated, + setInfiltrateButton(infiltrate, Locations.VolhavenOmniTekIncorporated, 1500, 44, 100, 7); break; - case Locations.VolhavenNWO: + case Locations.VolhavenNWO: locationInfo.innerHTML = Companies[loc].info; - + softwareJob.style.display = "block"; itJob.style.display = "block"; securityEngineerJob.style.display = "block"; networkEngineerJob.style.display = "block"; businessJob.style.display = "block"; securityJob.style.display = "block"; - setInfiltrateButton(infiltrate, Locations.VolhavenNWO, + setInfiltrateButton(infiltrate, Locations.VolhavenNWO, 1800, 56, 200, 8); break; - case Locations.VolhavenHeliosLabs: + case Locations.VolhavenHeliosLabs: 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"; - setInfiltrateButton(infiltrate, Locations.VolhavenHeliosLabs, + setInfiltrateButton(infiltrate, Locations.VolhavenHeliosLabs, 1200, 28, 75, 6); break; case Locations.VolhavenOmniaCybersystems: locationInfo.innerHTML = Companies[loc].info; - + softwareJob.style.display = "block"; itJob.style.display = "block"; securityEngineerJob.style.display = "block"; networkEngineerJob.style.display = "block"; securityJob.style.display = "block"; - setInfiltrateButton(infiltrate, Locations.VolhavenOmniaCybersystems, + setInfiltrateButton(infiltrate, Locations.VolhavenOmniaCybersystems, 900, 28, 90, 6.5); break; case Locations.VolhavenLexoCorp: locationInfo.innerHTML = Companies[loc].info; - + softwareJob.style.display = "block"; softwareConsultantJob.style.display = "block"; itJob.style.display = "block"; @@ -911,30 +926,30 @@ displayLocationContent = function() { networkEngineerJob.style.display = "block"; businessJob.style.display = "block"; securityJob.style.display = "block"; - setInfiltrateButton(infiltrate, Locations.VolhavenLexoCorp, + setInfiltrateButton(infiltrate, Locations.VolhavenLexoCorp, 500, 14, 40, 3.5); break; - case Locations.VolhavenSysCoreSecurities: + case Locations.VolhavenSysCoreSecurities: locationInfo.innerHTML = Companies[loc].info; - + softwareJob.style.display = "block"; itJob.style.display = "block"; securityEngineerJob.style.display = "block"; networkEngineerJob.style.display = "block"; - setInfiltrateButton(infiltrate, Locations.VolhavenSysCoreSecurities, + setInfiltrateButton(infiltrate, Locations.VolhavenSysCoreSecurities, 600, 16, 50, 4); break; - case Locations.VolhavenCompuTek: + case Locations.VolhavenCompuTek: 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"; - + purchase8gb.style.display = "block"; purchase16gb.style.display = "block"; purchase32gb.style.display = "block"; @@ -943,16 +958,16 @@ displayLocationContent = function() { purchase256gb.style.display = "block"; purchaseTor.style.display = "block"; purchaseHomeRam.style.display = "block"; - setInfiltrateButton(infiltrate, Locations.VolhavenCompuTek, + setInfiltrateButton(infiltrate, Locations.VolhavenCompuTek, 300, 12, 35, 3.5); break; - case Locations.VolhavenMilleniumFitnessGym: + case Locations.VolhavenMilleniumFitnessGym: var costMult = 3, expMult = 2.5; displayGymLocationContent(costMult); setGymLocationButtons(costMult, expMult); break; - + //All Slums case Locations.AevumSlums: case Locations.ChongqingSlums: @@ -969,7 +984,7 @@ displayLocationContent = function() { var kidnapChance = determineCrimeChanceKidnap(); var assassinateChance = determineCrimeChanceAssassination(); var heistChance = determineCrimeChanceHeist(); - + slumsDescText.style.display = "block"; slumsShoplift.style.display = "block"; slumsShoplift.innerHTML = "Shoplift (" + (shopliftChance*100).toFixed(3) + "% chance of success)"; @@ -999,23 +1014,23 @@ displayLocationContent = function() { slumsHeist.innerHTML = "Heist (" + (heistChance*100).toFixed(3) + "% chance of success)"; slumsHeist.innerHTML += ' Attempt to pull off the ultimate heist '; break; - + //Hospital case Locations.Hospital: hospitalTreatment.innerText = "Get treatment for wounds - $" + formatNumber(hospitalTreatmentCost, 2).toString(); hospitalTreatment.style.display = "block"; break; - + default: console.log("ERROR: INVALID LOCATION"); } - + //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; - + if (currPos.positionName == CompanyPositions.Employee.positionName) { employeeJob.style.display = "none"; } else if (currPos.positionName == CompanyPositions.Waiter.positionName) { @@ -1036,457 +1051,457 @@ initLocationButtons = function() { Engine.loadLocationContent(); return false; }); - + aevumHospital = document.getElementById("aevum-hospital"); aevumHospital.addEventListener("click", function() { Player.location = Locations.Hospital; Engine.loadLocationContent(); return false; }); - + aevumSummitUniversity = document.getElementById("aevum-summituniversity"); aevumSummitUniversity.addEventListener("click", function() { Player.location = Locations.AevumSummitUniversity; Engine.loadLocationContent(); return false; }); - + aevumECorp = document.getElementById("aevum-ecorp"); aevumECorp.addEventListener("click", function() { Player.location = Locations.AevumECorp; Engine.loadLocationContent(); return false; }); - + aevumBachmanAndAssociates = document.getElementById("aevum-bachmanandassociates"); aevumBachmanAndAssociates.addEventListener("click", function() { Player.location = Locations.AevumBachmanAndAssociates; Engine.loadLocationContent(); return false; }); - + aevumClarkeIncorporated = document.getElementById("aevum-clarkeincorporated"); aevumClarkeIncorporated.addEventListener("click", function() { - Player.location = Locations.AevumClarkeIncorporated; + Player.location = Locations.AevumClarkeIncorporated; Engine.loadLocationContent(); return false; }); - + aevumFulcrumTechnologies = document.getElementById("aevum-fulcrumtechnologies"); aevumFulcrumTechnologies.addEventListener("click", function() { Player.location = Locations.AevumFulcrumTechnologies; Engine.loadLocationContent(); return false; }); - + aevumAeroCorp = document.getElementById("aevum-aerocorp"); aevumAeroCorp.addEventListener("click", function() { Player.location = Locations.AevumAeroCorp; Engine.loadLocationContent(); return false; }); - + aevumGalacticCybersystems = document.getElementById("aevum-galacticcybersystems"); aevumGalacticCybersystems.addEventListener("click", function() { Player.location = Locations.AevumGalacticCybersystems; Engine.loadLocationContent(); return false; }); - + aevumWatchdogSecurity = document.getElementById("aevum-watchdogsecurity"); aevumWatchdogSecurity.addEventListener("click", function() { Player.location = Locations.AevumWatchdogSecurity; Engine.loadLocationContent(); return false; }); - + aevumRhoConstruction = document.getElementById("aevum-rhoconstruction"); aevumRhoConstruction.addEventListener("click", function() { Player.location = Locations.AevumRhoConstruction; Engine.loadLocationContent(); return false; }); - + aevumPolice = document.getElementById("aevum-aevumpolice"); aevumPolice.addEventListener("click", function() { Player.location = Locations.AevumPolice; Engine.loadLocationContent(); return false; }); - + aevumNetLinkTechnologies = document.getElementById("aevum-netlinktechnologies"); aevumNetLinkTechnologies.addEventListener("click", function() { Player.location = Locations.AevumNetLinkTechnologies; Engine.loadLocationContent(); return false; }); - + aevumCrushFitnessGym = document.getElementById("aevum-crushfitnessgym"); aevumCrushFitnessGym.addEventListener("click", function() { Player.location = Locations.AevumCrushFitnessGym; Engine.loadLocationContent(); return false; }); - + aevumSnapFitnessGym = document.getElementById("aevum-snapfitnessgym"); aevumSnapFitnessGym.addEventListener("click", function() { Player.location = Locations.AevumSnapFitnessGym; Engine.loadLocationContent(); return false; }); - + aevumSlums = document.getElementById("aevum-slums"); aevumSlums.addEventListener("click", function() { Player.location = Locations.AevumSlums; Engine.loadLocationContent(); return false; }); - + chongqingTravelAgency = document.getElementById("chongqing-travelagency"); chongqingTravelAgency.addEventListener("click", function() { Player.location = Locations.ChongqingTravelAgency; Engine.loadLocationContent(); return false; }); - + chongqingHospital = document.getElementById("chongqing-hospital"); chongqingHospital.addEventListener("click", function() { Player.location = Locations.Hospital; Engine.loadLocationContent(); return false; }); - + chongqingKuaiGongInternational = document.getElementById("chongqing-kuaigonginternational"); chongqingKuaiGongInternational.addEventListener("click", function() { Player.location = Locations.ChongqingKuaiGongInternational; - Engine.loadLocationContent(); + Engine.loadLocationContent(); return false; }); - + chongqingSolarisSpaceSystems = document.getElementById("chongqing-solarisspacesystems"); chongqingSolarisSpaceSystems.addEventListener("click", function() { Player.location = Locations.ChongqingSolarisSpaceSystems; Engine.loadLocationContent(); return false; }); - + chongqingSlums = document.getElementById("chongqing-slums"); chongqingSlums.addEventListener("click", function() { Player.location = Locations.ChongqingSlums; Engine.loadLocationContent(); return false; }); - - + + sector12TravelAgency = document.getElementById("sector12-travelagency"); sector12TravelAgency.addEventListener("click", function() { Player.location = Locations.Sector12TravelAgency; Engine.loadLocationContent(); return false; }); - + sector12Hospital = document.getElementById("sector12-hospital"); sector12Hospital.addEventListener("click", function() { Player.location = Locations.Hospital; Engine.loadLocationContent(); return false; }); - + sector12RothmanUniversity = document.getElementById("sector12-rothmanuniversity"); sector12RothmanUniversity.addEventListener("click", function() { Player.location = Locations.Sector12RothmanUniversity; Engine.loadLocationContent(); return false; }); - + sector12MegaCorp = document.getElementById("sector12-megacorp"); sector12MegaCorp.addEventListener("click", function() { Player.location = Locations.Sector12MegaCorp; Engine.loadLocationContent(); return false; }); - + sector12BladeIndustries = document.getElementById("sector12-bladeindustries"); sector12BladeIndustries.addEventListener("click", function() { Player.location = Locations.Sector12BladeIndustries; Engine.loadLocationContent(); return false; }); - + sector12FourSigma = document.getElementById("sector12-foursigma"); sector12FourSigma.addEventListener("click", function() { Player.location = Locations.Sector12FourSigma; Engine.loadLocationContent(); return false; }); - + sector12IcarusMicrosystems = document.getElementById("sector12-icarusmicrosystems"); sector12IcarusMicrosystems.addEventListener("click", function() { Player.location = Locations.Sector12IcarusMicrosystems; Engine.loadLocationContent(); return false; }); - + sector12UniversalEnergy = document.getElementById("sector12-universalenergy"); sector12UniversalEnergy.addEventListener("click", function() { Player.location = Locations.Sector12UniversalEnergy; Engine.loadLocationContent(); return false; }); - + sector12DeltaOne = document.getElementById("sector12-deltaone"); sector12DeltaOne.addEventListener("click", function() { Player.location = Locations.Sector12DeltaOne; Engine.loadLocationContent(); return false; }); - + sector12CIA = document.getElementById("sector12-cia"); sector12CIA.addEventListener("click", function() { Player.location = Locations.Sector12CIA; Engine.loadLocationContent(); return false; }); - + sector12NSA = document.getElementById("sector12-nsa"); sector12NSA.addEventListener("click", function() { Player.location = Locations.Sector12NSA; Engine.loadLocationContent(); return false; }); - + sector12AlphaEnterprises = document.getElementById("sector12-alphaenterprises"); sector12AlphaEnterprises.addEventListener("click", function() { - Player.location = Locations.Sector12AlphaEnterprises; + Player.location = Locations.Sector12AlphaEnterprises; Engine.loadLocationContent(); return false; }); - + sector12CarmichaelSecurity = document.getElementById("sector12-carmichaelsecurity"); sector12CarmichaelSecurity.addEventListener("click", function() { Player.location = Locations.Sector12CarmichaelSecurity; Engine.loadLocationContent(); return false; }); - + sector12FoodNStuff = document.getElementById("sector12-foodnstuff"); sector12FoodNStuff.addEventListener("click", function() { Player.location = Locations.Sector12FoodNStuff; Engine.loadLocationContent(); return false; }); - + sector12JoesGuns = document.getElementById("sector12-joesguns"); sector12JoesGuns.addEventListener("click", function() { Player.location = Locations.Sector12JoesGuns; Engine.loadLocationContent(); return false; }); - + sector12IronGym = document.getElementById("sector12-irongym"); sector12IronGym.addEventListener("click", function() { Player.location = Locations.Sector12IronGym; Engine.loadLocationContent(); return false; }); - + sector12PowerhouseGym = document.getElementById("sector12-powerhousegym"); sector12PowerhouseGym.addEventListener("click", function() { Player.location = Locations.Sector12PowerhouseGym; Engine.loadLocationContent(); return false; }); - + sector12Slums = document.getElementById("sector12-slums"); sector12Slums.addEventListener("click", function() { Player.location = Locations.Sector12Slums; Engine.loadLocationContent(); return false; }); - + newTokyoTravelAgency = document.getElementById("newtokyo-travelagency"); newTokyoTravelAgency.addEventListener("click", function() { Player.location = Locations.NewTokyoTravelAgency; Engine.loadLocationContent(); return false; }); - + newTokyoHospital = document.getElementById("newtokyo-hospital"); newTokyoHospital.addEventListener("click", function() { Player.location = Locations.Hospital; Engine.loadLocationContent(); return false; }); - + newTokyoDefComm = document.getElementById("newtokyo-defcomm"); newTokyoDefComm.addEventListener("click", function() { Player.location = Locations.NewTokyoDefComm; Engine.loadLocationContent(); return false; }); - + newTokyoVitaLife = document.getElementById("newtokyo-vitalife"); newTokyoVitaLife.addEventListener("click", function() { Player.location = Locations.NewTokyoVitaLife; Engine.loadLocationContent(); return false; }); - + newTokyoGlobalPharmaceuticals = document.getElementById("newtokyo-globalpharmaceuticals"); newTokyoGlobalPharmaceuticals.addEventListener("click", function() { Player.location = Locations.NewTokyoGlobalPharmaceuticals; Engine.loadLocationContent(); return false; }); - + newTokyoNoodleBar = document.getElementById("newtokyo-noodlebar"); newTokyoNoodleBar.addEventListener("click", function() { Player.location = Locations.NewTokyoNoodleBar; Engine.loadLocationContent(); return false; }); - + newTokyoSlums = document.getElementById("newtokyo-slums"); newTokyoSlums.addEventListener("click", function() { Player.location = Locations.NewTokyoSlums; Engine.loadLocationContent(); return false; }); - + ishimaTravelAgency = document.getElementById("ishima-travelagency"); ishimaTravelAgency.addEventListener("click", function() { Player.location = Locations.IshimaTravelAgency; Engine.loadLocationContent(); return false; }); - + ishimaHospital = document.getElementById("ishima-hospital"); ishimaHospital.addEventListener("click", function() { Player.location = Locations.Hospital; Engine.loadLocationContent(); return false; }); - + ishimaStormTechnologies = document.getElementById("ishima-stormtechnologies"); ishimaStormTechnologies.addEventListener("click", function() { Player.location = Locations.IshimaStormTechnologies; Engine.loadLocationContent(); return false; }); - + ishimaNovaMedical = document.getElementById("ishima-novamedical"); ishimaNovaMedical.addEventListener("click", function() { Player.location = Locations.IshimaNovaMedical; Engine.loadLocationContent(); return false; }); - + ishimaOmegaSoftware = document.getElementById("ishima-omegasoftware"); ishimaOmegaSoftware.addEventListener("click", function() { Player.location = Locations.IshimaOmegaSoftware; Engine.loadLocationContent(); return false; }); - + ishimaSlums = document.getElementById("ishima-slums"); ishimaSlums.addEventListener("click", function() { Player.location = Locations.IshimaSlums; Engine.loadLocationContent(); return false; }); - + volhavenTravelAgency = document.getElementById("volhaven-travelagency"); volhavenTravelAgency.addEventListener("click", function() { Player.location = Locations.VolhavenTravelAgency; Engine.loadLocationContent(); return false; }); - + volhavenHospital = document.getElementById("volhaven-hospital"); volhavenHospital.addEventListener("click", function() { Player.location = Locations.Hospital; Engine.loadLocationContent(); return false; }); - + volhavenZBInstituteOfTechnology = document.getElementById("volhaven-zbinstituteoftechnology"); volhavenZBInstituteOfTechnology.addEventListener("click", function() { Player.location = Locations.VolhavenZBInstituteOfTechnology; Engine.loadLocationContent(); return false; }); - + volhavenOmniTekIncorporated = document.getElementById("volhaven-omnitekincorporated"); volhavenOmniTekIncorporated.addEventListener("click", function() { Player.location = Locations.VolhavenOmniTekIncorporated; Engine.loadLocationContent(); return false; }); - + volhavenNWO = document.getElementById("volhaven-nwo"); volhavenNWO.addEventListener("click", function() { Player.location = Locations.VolhavenNWO; Engine.loadLocationContent(); return false; }); - + volhavenHeliosLabs = document.getElementById("volhaven-helioslabs"); volhavenHeliosLabs.addEventListener("click", function() { Player.location = Locations.VolhavenHeliosLabs; Engine.loadLocationContent(); return false; }); - + volhavenOmniaCybersystems = document.getElementById("volhaven-omniacybersystems"); volhavenOmniaCybersystems.addEventListener("click", function() { Player.location = Locations.VolhavenOmniaCybersystems; Engine.loadLocationContent(); return false; }); - + volhavenLexoCorp = document.getElementById("volhaven-lexocorp"); volhavenLexoCorp.addEventListener("click", function() { Player.location = Locations.VolhavenLexoCorp; Engine.loadLocationContent(); return false; }); - + volhavenSysCoreSecurities = document.getElementById("volhaven-syscoresecurities"); volhavenSysCoreSecurities.addEventListener("click", function() { Player.location = Locations.VolhavenSysCoreSecurities; Engine.loadLocationContent(); return false; }); - + volhavenCompuTek = document.getElementById("volhaven-computek"); volhavenCompuTek.addEventListener("click", function() { Player.location = Locations.VolhavenCompuTek; Engine.loadLocationContent(); return false; }); - + volhavenMilleniumFitnessGym = document.getElementById("volhaven-milleniumfitnessgym"); volhavenMilleniumFitnessGym.addEventListener("click", function() { Player.location = Locations.VolhavenMilleniumFitnessGym; Engine.loadLocationContent(); return false; }); - + volhavenSlums = document.getElementById("volhaven-slums"); volhavenSlums.addEventListener("click", function() { Player.location = Locations.VolhavenSlums; Engine.loadLocationContent(); return false; }); - + worldStockExchange = document.getElementById("generic-location-wse"); worldStockExchange.addEventListener("click", function() { Player.location = Locations.WorldStockExchange; Engine.loadStockMarketContent(); return false; }); - - + + //Buttons to interact at a location (apply for job/promotion, train, purchase, etc.) var softwareJob = document.getElementById("location-software-job"); var softwareConsultantJob = document.getElementById("location-software-consultant-job") @@ -1523,7 +1538,7 @@ initLocationButtons = function() { 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 slumsShoplift = document.getElementById("location-slums-shoplift"); var slumsMug = document.getElementById("location-slums-mug"); var slumsDealDrugs = document.getElementById("location-slums-deal-drugs"); @@ -1533,69 +1548,69 @@ initLocationButtons = function() { var slumsKidnap = document.getElementById("location-slums-kidnap"); var slumsAssassinate = document.getElementById("location-slums-assassinate"); var slumsHeist = document.getElementById("location-slums-heist"); - + var hospitalTreatment = document.getElementById("location-hospital-treatment"); - + softwareJob.addEventListener("click", function() { Player.applyForSoftwareJob(); return false; }); - + softwareConsultantJob.addEventListener("click", function() { Player.applyForSoftwareConsultantJob(); return false; }); - + itJob.addEventListener("click", function() { Player.applyForItJob(); - return false; + return false; }); - + securityEngineerJob.addEventListener("click", function() { Player.applyForSecurityEngineerJob(); - return false; + return false; }); - + networkEngineerJob.addEventListener("click", function() { Player.applyForNetworkEngineerJob(); - return false; + return false; }); - + businessJob.addEventListener("click", function() { Player.applyForBusinessJob(); - return false; + return false; }); - + businessConsultantJob.addEventListener("click", function() { Player.applyForBusinessConsultantJob(); return false; }); - + securityJob.addEventListener("click", function() { Player.applyForSecurityJob(); - return false; + return false; }); - + agentJob.addEventListener("click", function() { Player.applyForAgentJob(); - return false; + return false; }); - + employeeJob.addEventListener("click", function() { Player.applyForEmployeeJob(); - return false; + return false; }); - + employeePartTimeJob.addEventListener("click", function() { Player.applyForPartTimeEmployeeJob(); return false; }); - + waiterJob.addEventListener("click", function() { Player.applyForWaiterJob(); - return false; + return false; }); - + waiterPartTimeJob.addEventListener("click", function() { Player.applyForPartTimeWaiterJob(); return false; @@ -1605,156 +1620,156 @@ initLocationButtons = function() { purchaseServerBoxCreate(2, 2 * CONSTANTS.BaseCostFor1GBOfRamServer); return false; }); - + purchase4gb.addEventListener("click", function() { purchaseServerBoxCreate(4, 4 * CONSTANTS.BaseCostFor1GBOfRamServer); return false; }); - + purchase8gb.addEventListener("click", function() { purchaseServerBoxCreate(8, 8 * CONSTANTS.BaseCostFor1GBOfRamServer); return false; }); - + purchase16gb.addEventListener("click", function() { purchaseServerBoxCreate(16, 16 * CONSTANTS.BaseCostFor1GBOfRamServer); return false; }); - + purchase32gb.addEventListener("click", function() { purchaseServerBoxCreate(32, 32 * CONSTANTS.BaseCostFor1GBOfRamServer); return false; }); - + purchase64gb.addEventListener("click", function() { purchaseServerBoxCreate(64, 64 * CONSTANTS.BaseCostFor1GBOfRamServer); return false; }); - + purchase128gb.addEventListener("click", function() { purchaseServerBoxCreate(128, 128 * CONSTANTS.BaseCostFor1GBOfRamServer); return false; }); - + purchase256gb.addEventListener("click", function() { purchaseServerBoxCreate(256, 256 * CONSTANTS.BaseCostFor1GBOfRamServer); return false; }); - + purchase512gb.addEventListener("click", function() { purchaseServerBoxCreate(512, 512 * CONSTANTS.BaseCostFor1GBOfRamServer); return false; }); - + purchase1tb.addEventListener("click", function() { purchaseServerBoxCreate(1024, 1024 * CONSTANTS.BaseCostFor1GBOfRamServer); return false; }); - + purchaseTor.addEventListener("click", function() { purchaseTorRouter(); return false; }); - + purchaseHomeRam.addEventListener("click", function() { purchaseRamForHomeBoxCreate(); return false; }); - + travelToAevum.addEventListener("click", function() { travelBoxCreate(Locations.Aevum, 200000); return false; }); - + travelToChongqing.addEventListener("click", function() { travelBoxCreate(Locations.Chongqing, 200000); return false; }); - + travelToSector12.addEventListener("click", function() { travelBoxCreate(Locations.Sector12, 200000); return false; }); - + travelToNewTokyo.addEventListener("click", function() { travelBoxCreate(Locations.NewTokyo, 200000); return false; }); - + travelToIshima.addEventListener("click", function() { travelBoxCreate(Locations.Ishima, 200000); return false; }); - + travelToVolhaven.addEventListener("click", function() { travelBoxCreate(Locations.Volhaven, 200000); return false; }); - + slumsShoplift.addEventListener("click", function() { commitShopliftCrime(); return false; }); - + slumsMug.addEventListener("click", function() { commitMugCrime(); return false; }); - + slumsDealDrugs.addEventListener("click", function() { commitDealDrugsCrime(); return false; }); - + slumsTrafficArms.addEventListener("click", function() { commitTraffickArmsCrime(); return false; }); - + slumsHomicide.addEventListener("click", function() { commitHomicideCrime(); return false; }); - + slumsGta.addEventListener("click", function() { commitGrandTheftAutoCrime(); return false; }); - + slumsKidnap.addEventListener("click", function() { commitKidnapCrime(); return false; }); - + slumsAssassinate.addEventListener("click", function() { commitAssassinationCrime(); return false; }); - + slumsHeist.addEventListener("click", function() { commitHeistCrime(); return false; }); - + hospitalTreatment.addEventListener("click", function() { if (Player.hp < 0) {Player.hp = 0;} var price = (Player.max_hp - Player.hp) * CONSTANTS.HospitalCostPerHp; Player.loseMoney(price); - dialogBoxCreate("You were healed to full health! The hospital billed " + + dialogBoxCreate("You were healed to full health! The hospital billed " + "you for $" + formatNumber(price, 2).toString()); Player.hp = Player.max_hp; displayLocationContent(); return false; }); -} +} travelToCity = function(destCityName, cost) { if (cost > Player.money) { - dialogBoxCreate("You cannot afford to travel to " + destCityName); + dialogBoxCreate("You cannot afford to travel to " + destCityName); return; } Player.money -= cost; - + Player.city = destCityName; dialogBoxCreate("You are now in " + destCityName + "!"); Engine.loadWorldContent(); @@ -1766,14 +1781,14 @@ purchaseTorRouter = function() { return; } Player.loseMoney(CONSTANTS.TorRouterCost); - + var darkweb = new Server(); darkweb.init(createRandomIp(), "darkweb", "", true, false, false, false, 1); AddToAllServers(darkweb); SpecialServerIps.addIp("Darkweb Server", darkweb.ip); - + document.getElementById("location-purchase-tor").setAttribute("class", "a-link-button-inactive"); - + Player.getHomeComputer().serversOnNetwork.push(darkweb.ip); darkweb.serversOnNetwork.push(Player.getHomeComputer().ip); dialogBoxCreate("You have purchased a Tor router!
You now have access to the dark web from your home computer
Use the scan/netstat commands to search for the dark web connection."); @@ -1792,14 +1807,14 @@ displayUniversityLocationContent = function(costMult) { classAlgorithmsButton.style.display = "block"; classManagementButton.style.display = "block"; classLeadershipButton.style.display = "block"; - - //Costs (per second) + + //Costs (per second) var dataStructuresCost = CONSTANTS.ClassDataStructuresBaseCost * costMult; var networksCost = CONSTANTS.ClassNetworksBaseCost * costMult; var algorithmsCost = CONSTANTS.ClassAlgorithmsBaseCost * costMult; var managementCost = CONSTANTS.ClassManagementBaseCost * costMult; var leadershipCost = CONSTANTS.ClassLeadershipBaseCost * costMult; - + //Update button text to show cost classDataStructuresButton.innerHTML = "Take Data Structures course ($" + dataStructuresCost + " / sec)"; classNetworksButton.innerHTML = "Take Networks course ($" + networksCost + " / sec)"; @@ -1814,31 +1829,31 @@ setUniversityLocationButtons = function(costMult, expMult) { Player.startClass(costMult, expMult, CONSTANTS.ClassStudyComputerScience); return false; }); - + var newClassDataStructures = clearEventListeners("location-data-structures-class"); newClassDataStructures.addEventListener("click", function() { Player.startClass(costMult, expMult, CONSTANTS.ClassDataStructures); return false; }); - + var newClassNetworks = clearEventListeners("location-networks-class"); newClassNetworks.addEventListener("click", function() { Player.startClass(costMult, expMult, CONSTANTS.ClassNetworks); return false; }); - + var newClassAlgorithms = clearEventListeners("location-algorithms-class"); newClassAlgorithms.addEventListener("click", function() { Player.startClass(costMult, expMult, CONSTANTS.ClassAlgorithms); return false; }); - + var newClassManagement = clearEventListeners("location-management-class"); newClassManagement.addEventListener("click", function() { Player.startClass(costMult, expMult, CONSTANTS.ClassManagement); return false; }); - + var newClassLeadership = clearEventListeners("location-leadership-class"); newClassLeadership.addEventListener("click", function() { Player.startClass(costMult, expMult, CONSTANTS.ClassLeadership); @@ -1855,10 +1870,10 @@ displayGymLocationContent = function(costMult) { gymDefButton.style.display = "block"; gymDexButton.style.display = "block"; gymAgiButton.style.display = "block"; - - //Costs (per second) + + //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)"; @@ -1872,19 +1887,19 @@ setGymLocationButtons = function(costMult, expMult) { 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); @@ -1899,4 +1914,15 @@ setInfiltrateButton = function(btn, companyName, startLevel, val, maxClearance, beginInfiltration(companyName, startLevel, val, maxClearance, difficulty) return false; }); -} \ No newline at end of file +} + +//Finds the next target job for the player at the given company (loc) and +//adds the tooltiptext to the Application button, given by 'button' +function setJobRequirementTooltip(loc, entryPosType, btn) { + var company = Companies[loc]; + if (company == null) {return;} + var pos = Player.getNextCompanyPosition(company, entryPosType); + if (pos == null) {return}; + var reqText = getJobRequirementText(company, pos, true); + btn.innerHTML += "" + reqText + ""; +} diff --git a/src/Message.js b/src/Message.js index 3f8eb2c02..14732845d 100644 --- a/src/Message.js +++ b/src/Message.js @@ -20,13 +20,15 @@ Reviver.constructors.Message = Message; function sendMessage(msg) { console.log("sending message: " + msg.filename); msg.recvd = true; - showMessage(msg); + if (!Settings.SuppressMessages) { + showMessage(msg); + } addMessageToServer(msg, "home"); } function showMessage(msg) { - var txt = "Message received from unknown sender:

" + - "" + msg.msg + "

" + + var txt = "Message received from unknown sender:

" + + "" + msg.msg + "

" + "This message was saved as " + msg.filename + " onto your home computer."; dialogBoxCreate(txt); } @@ -53,7 +55,7 @@ function checkForMessagesToSend() { var nitesecTest = Messages[MessageFilenames.NiteSecTest]; var bitrunnersTest = Messages[MessageFilenames.BitRunnersTest]; var redpill = Messages[MessageFilenames.RedPill]; - + if (jumper0 && !jumper0.recvd && Player.hacking_skill >= 25) { sendMessage(jumper0); } else if (jumper1 && !jumper1.recvd && Player.hacking_skill >= 40) { @@ -100,61 +102,61 @@ MessageFilenames = { function initMessages() { //Reset Messages = {}; - + //jump3R Messages AddToAllMessages(new Message(MessageFilenames.Jumper0, - "I know you can sense it. I know you're searching for it. " + - "It's why you spend night after " + - "night at your computer.

It's real, I've seen it. And I can " + + "I know you can sense it. I know you're searching for it. " + + "It's why you spend night after " + + "night at your computer.

It's real, I've seen it. And I can " + "help you find it. But not right now. You're not ready yet.

-jump3R")); AddToAllMessages(new Message(MessageFilenames.Jumper1, "Soon you will be contacted by a hacking group known as CyberSec. " + "They can help you with your search.

" + - "You should join them, garner their favor, and " + - "exploit them for their Augmentations. But do not trust them. " + - "They are not what they seem. No one is.

" + + "You should join them, garner their favor, and " + + "exploit them for their Augmentations. But do not trust them. " + + "They are not what they seem. No one is.

" + "-jump3R")); AddToAllMessages(new Message(MessageFilenames.Jumper2, - "Do not try to save the world. There is no world to save. If " + - "you want to find the truth, worry only about yourself. Ethics and " + - "morals will get you killed.

Watch out for a hacking group known as NiteSec." + + "Do not try to save the world. There is no world to save. If " + + "you want to find the truth, worry only about yourself. Ethics and " + + "morals will get you killed.

Watch out for a hacking group known as NiteSec." + "

-jump3R")); AddToAllMessages(new Message(MessageFilenames.Jumper3, - "You must learn to walk before you can run. And you must " + - "run before you can fly. Look for the black hand.

" + + "You must learn to walk before you can run. And you must " + + "run before you can fly. Look for the black hand.

" + "I.I.I.I

-jump3R")); AddToAllMessages(new Message(MessageFilenames.Jumper4, - "To find what you are searching for, you must understand the bits. " + - "The bits are all around us. The runners will help you.

" + + "To find what you are searching for, you must understand the bits. " + + "The bits are all around us. The runners will help you.

" + "-jump3R")); AddToAllMessages(new Message(MessageFilenames.Jumper5, "Build your wings and fly

-jump3R

" + "The fl1ght.exe program was added to your home computer")); - + //Messages from hacking factions AddToAllMessages(new Message(MessageFilenames.CyberSecTest, "We've been watching you. Your skills are very impressive. But you're wasting " + "your talents. If you join us, you can put your skills to good use and change " + - "the world for the better. If you join us, we can unlock your full potential.

" + - "But first, you must pass our test. Find and hack our server using the Terminal.

" + + "the world for the better. If you join us, we can unlock your full potential.

" + + "But first, you must pass our test. Find and hack our server using the Terminal.

" + "-CyberSec")); AddToAllMessages(new Message(MessageFilenames.NiteSecTest, - "People say that the corrupted governments and corporations rule the world. " + - "Yes, maybe they do. But do you know who everyone really fears? People " + + "People say that the corrupted governments and corporations rule the world. " + + "Yes, maybe they do. But do you know who everyone really fears? People " + "like us. Because they can't hide from us. Because they can't fight shadows " + - "and ideas with bullets.

" + - "Join us, and people will fear you, too.

" + - "Find and hack our hidden server using the Terminal. Then, we will contact you again." + + "and ideas with bullets.

" + + "Join us, and people will fear you, too.

" + + "Find and hack our hidden server using the Terminal. Then, we will contact you again." + "

-NiteSec")); AddToAllMessages(new Message(MessageFilenames.BitRunnersTest, - "We know what you are doing. We know what drives you. We know " + - "what you are looking for.

" + - "We can help you find the answers.

" + + "We know what you are doing. We know what drives you. We know " + + "what you are looking for.

" + + "We can help you find the answers.

" + "run4theh111z")); - + AddToAllMessages(new Message(MessageFilenames.RedPill, - "@)(#V%*N)@(#*)*C)@#%*)*V)@#(*%V@)(#VN%*)@#(*%
" + - ")@B(*#%)@)M#B*%V)____FIND___#$@)#%(B*)@#(*%B)
" + - "@_#(%_@#M(BDSPOMB__THE-CAVE_#)$(*@#$)@#BNBEGB
" + + "@)(#V%*N)@(#*)*C)@#%*)*V)@#(*%V@)(#VN%*)@#(*%
" + + ")@B(*#%)@)M#B*%V)____FIND___#$@)#%(B*)@#(*%B)
" + + "@_#(%_@#M(BDSPOMB__THE-CAVE_#)$(*@#$)@#BNBEGB
" + "DFLSMFVMV)#@($*)@#*$MV)@#(*$V)M#(*$)M@(#*VM$)")); -} \ No newline at end of file +} diff --git a/src/NetscriptEvaluator.js b/src/NetscriptEvaluator.js index f8cc5fba5..3462cafa2 100644 --- a/src/NetscriptEvaluator.js +++ b/src/NetscriptEvaluator.js @@ -131,6 +131,14 @@ function evaluate(exp, workerScript) { reject(e); }); break; + case "UnaryExpression": + var p = evalUnary(exp, workerScript, resolve, reject); + p.then(function(res) { + resolve(res); + }).catch(function(e) { + reject(e); + }); + break; case "AssignmentExpression": var p = evalAssignment(exp, workerScript); p.then(function(res) { @@ -210,58 +218,6 @@ function evaluate(exp, workerScript) { }); // End Promise } -/* -function evalFunction(exp, workerScript){ - return new Promise(function(resolve, reject) { - if (exp.callee.type!="Identifier"){ - reject(makeRuntimeRejectMsg(workerScript, "callee must be an Identifier")); - return; - } - switch(exp.callee.name){ - case "print": - if (exp.arguments.length != 1) { - return reject(makeRuntimeRejectMsg(workerScript, "print() call has incorrect number of arguments. Takes 1 argument")); - } - var evaluatePromise = evaluate(exp.arguments[0], workerScript); - evaluatePromise.then(function(res) { - workerScript.scriptRef.log(res.toString()); - resolve(true); - }).catch(function(e) { - reject(e); - }); - break; - case "scan": - if (exp.arguments.length != 1) { - exp.arguments = [{value:Player.getCurrentServer().hostname,type:"Literal"}]; - } - var ipPromise = evaluate(exp.arguments[0], workerScript); - ipPromise.then(function (ip) { - var server = getServer(ip); - if (server == null) { - workerScript.scriptRef.log('getServerOpenPortsCount() failed. Invalid IP or hostname passed in: ' + ip); - return reject(makeRuntimeRejectMsg(workerScript, 'Invalid IP or hostname passed into getServerOpenPortsCount() command')); - } - var out = []; - for (var i = 0; i < server.serversOnNetwork.length; i++) { - var entry = server.getServerOnNetwork(i).hostname; - if (entry == null) { - continue; - } - out.push(entry); - } - workerScript.scriptRef.log('scan() returned ' + server.serversOnNetwork.length + ' connections for ' + server.hostname); - resolve(out); - }).catch(function(e) { - reject(e); - }); - break; - default: - reject(makeRuntimeRejectMsg(workerScript, "Invalid function: " + exp.callee)); - } - }); -} -*/ - function evalBinary(exp, workerScript){ return new Promise(function(resolve, reject) { var expLeftPromise = evaluate(exp.left, workerScript); @@ -329,17 +285,24 @@ function evalBinary(exp, workerScript){ } function evalUnary(exp, workerScript){ + var env = workerScript.env; return new Promise(function(resolve, reject) { - var expLeftPromise = evaluate(exp.left, workerScript); - expLeftPromise.then(function(expLeft) { - switch(exp.operator){ - case "++": - break - case "--": - break; + if (env.stopFlag) {return reject(workerScript);} + var p = evaluate(exp.argument, workerScript); + p.then(function(res) { + if (exp.operator == "!") { + resolve(!res); + } else if (exp.operator == "-") { + if (isNaN(res)) { + resolve(res); + } else { + resolve(-1 * res); + } + } else { + reject(makeRuntimeRejectMsg(workerScript, "Unimplemented unary operator: " + exp.operator)); } - }, function(e) { - reject(e); + }).catch(function(e) { + reject(e); }); }); } @@ -534,113 +497,6 @@ function evaluateWhile(exp, workerScript) { }); } -/* -function evaluateHacknetNode(exp, workerScript) { - console.log("here"); - var env = workerScript.env; - return new Promise(function(resolve, reject) { - setTimeout(function() { - if (exp.index == null) { - if ((exp.op.type == "call" && exp.op.func.value == "length") || - (exp.op.type == "var" && exp.op.value == "length")) { - resolve(Player.hacknetNodes.length); - workerScript.scriptRef.log("hacknetnodes.length returned " + Player.hacknetNodes.length); - return; - } else { - workerScript.scriptRef.log("Invalid/null index for hacknetnodes"); - reject(makeRuntimeRejectMsg(workerScript, "Invalid/null index. hacknetnodes array must be accessed with an index")); - return; - } - - } - var indexPromise = evaluate(exp.index.value, workerScript); - indexPromise.then(function(index) { - if (isNaN(index) || index >= Player.hacknetNodes.length || index < 0) { - workerScript.scriptRef.log("Invalid index value for hacknetnodes[]"); - reject(makeRuntimeRejectMsg(workerScript, "Invalid index value for hacknetnodes[].")); - return; - } - var nodeObj = Player.hacknetNodes[index]; - if (exp.op == null) { - reject(makeRuntimeRejectMsg(workerScript, "No operator or property called for hacknetnodes. Usage: hacknetnodes[i].property/operator")); - return; - } else if (exp.op.type == "var") { - //Get properties: level, ram, cores - switch(exp.op.value) { - case "level": - resolve(nodeObj.level); - break; - case "ram": - resolve(nodeObj.ram); - break; - case "cores": - resolve(nodeObj.numCores); - break; - default: - reject(makeRuntimeRejectMsg(workerScript, "Unrecognized property for Hacknet Node. Valid properties: ram, cores, level")); - break; - } - - } else if (exp.op.type == "call") { - switch(exp.op.func.value) { - case "upgradeLevel": - if (exp.op.args.length == 1) { - var argPromise = evaluate(exp.op.args[0], workerScript); - argPromise.then(function(arg) { - if (isNaN(arg) || arg < 0) { - reject(makeRuntimeRejectMsg(workerScript, "Invalid argument passed into upgradeLevel()")); - return; - } - arg = Math.round(arg); - var res = nodeObj.purchaseLevelUpgrade(arg); - if (res) { - workerScript.scriptRef.log("Upgraded " + nodeObj.name + " " + arg + " times to level " + nodeObj.level); - } - resolve(res); - }, function(e) { - reject(e); - }); - } else { - var res = nodeObj.purchaseLevelUpgrade(1); - if (res) { - workerScript.scriptRef.log("Upgraded " + nodeObj.name + " once to level " + nodeObj.level); - } - resolve(res); - } - break; - case "upgradeRam": - var res = nodeObj.purchaseRamUpgrade(); - if (res) { - workerScript.scriptRef.log("Upgraded " + nodeObj.name + "'s RAM to " + nodeObj.ram + "GB"); - } - resolve(res); - break; - case "upgradeCore": - var res = nodeObj.purchaseCoreUpgrade(); - if (res) { - workerScript.scriptRef.log("Upgraded " + nodeObj.name + "'s number of cores to " + nodeObj.numCores); - } - resolve(res); - break; - default: - reject(makeRuntimeRejectMsg(workerScript, "Unrecognized function/operator for hacknet node. Valid functions: upgradeLevel(n), upgradeRam(), upgradeCore()")); - break; - } - } else { - reject(makeRuntimeRejectMsg(workerScript, "Unrecognized operation for hacknet node")); - return; - } - }, function(e) { - reject(e); - }); - - }, CONSTANTS.CodeInstructionRunTime); - }, function(e) { - reject(e); - }); -} -*/ - function evaluateProg(exp, workerScript, index) { var env = workerScript.env; @@ -791,7 +647,7 @@ function scriptCalculateExpGain(server) { if (server.baseDifficulty == null) { server.baseDifficulty = server.hackDifficulty; } - return (server.baseDifficulty * Player.hacking_exp_mult * 0.4 + 2); + return (server.baseDifficulty * Player.hacking_exp_mult * 0.3 + 2); } //The same as Player's calculatePercentMoneyHacked() function but takes in the server as an argument diff --git a/src/NetscriptFunctions.js b/src/NetscriptFunctions.js index 4e665bcfd..160694ef4 100644 --- a/src/NetscriptFunctions.js +++ b/src/NetscriptFunctions.js @@ -654,6 +654,12 @@ function NetscriptFunctions(workerScript) { return ""; } + if (Player.purchasedServers.length >= CONSTANTS.PurchasedServerLimit) { + workerScript.scriptRef.log("Error: You have reached the maximum limit of " + CONSTANTS.PurchasedServerLimit + + " servers. You cannot purchase any more."); + return ""; + } + ram = Math.round(ram); if (isNaN(ram) || !powerOfTwo(ram)) { workerScript.scriptRef.log("Error: Invalid ram argument passed to purchaseServer(). Must be numeric and a power of 2"); @@ -677,6 +683,56 @@ function NetscriptFunctions(workerScript) { workerScript.scriptRef.log("Purchased new server with hostname " + newServ.hostname + " for $" + formatNumber(cost, 2)); return newServ.hostname; }, + deleteServer : function(hostname) { + var hostnameStr = String(hostname); + hostnameStr = hostnameStr.replace(/\s\s+/g, ''); + var server = GetServerByHostname(hostnameStr); + if (server == null) { + workerScript.scriptRef.log("Error: Could not find server with hostname " + hostnameStr + ". deleteServer() failed"); + return false; + } + + if (!server.purchasedByPlayer) { + workerScript.scriptRef.log("Error: Server " + server.hostname + " is not a purchased server. " + + "Cannot be deleted. deleteSErver failed"); + return false; + } + var ip = server.ip; + + //Delete from all servers + delete AllServers[ip]; + + //Delete from player's purchasedServers array + var found = false; + for (var i = 0; i < Player.purchasedServers.length; ++i) { + if (ip == Player.purchasedServers[i]) { + found = true; + Player.purchasedServers.splice(i, 1); + break; + } + } + + if (!found) { + workerScript.scriptRef.log("Error: Could not identify server " + server.hostname + + "as a purchased server. This is likely a bug please contact game dev"); + return false; + } + + //Delete from home computer + found = false; + var homeComputer = Player.getHomeComputer(); + for (var i = 0; i < homeComputer.serversOnNetwork.length; ++i) { + if (ip == homeComputer.serversOnNetwork[i]) { + homeComputer.serversOnNetwork.splice(i, 1); + workerScript.scriptRef.log("Deleted server " + hostnameStr); + return true; + } + } + //Wasn't found on home computer + workerScript.scriptRef.log("Error: Could not find server " + server.hostname + + "as a purchased server. This is likely a bug please contact game dev"); + return false; + }, round : function(n) { if (isNaN(n)) {return 0;} return Math.round(n); diff --git a/src/NetscriptWorker.js b/src/NetscriptWorker.js index c3a3684e1..f90703b0d 100644 --- a/src/NetscriptWorker.js +++ b/src/NetscriptWorker.js @@ -1,6 +1,6 @@ -/* Worker code, contains Netscript scripts that are actually running */ - -//TODO Tested For and while and generic call statements. Have not tested if statements +/* Worker code, contains Netscript scripts that are actually running */ + +//TODO Tested For and while and generic call statements. Have not tested if statements /* Actual Worker Code */ function WorkerScript(runningScriptObj) { @@ -53,7 +53,7 @@ function runScriptsLoop() { workerScripts[i].env.stopFlag = true; continue; } - + workerScripts[i].running = true; var p = evaluate(ast, workerScripts[i]); //Once the code finishes (either resolved or rejected, doesnt matter), set its @@ -79,9 +79,9 @@ function runScriptsLoop() { var serverIp = errorTextArray[1]; var scriptName = errorTextArray[2]; var errorMsg = errorTextArray[3]; - - dialogBoxCreate("Script runtime error:
Server Ip: " + serverIp + - "
Script name: " + scriptName + + + dialogBoxCreate("Script runtime error:
Server Ip: " + serverIp + + "
Script name: " + scriptName + "
Args:" + printArray(w.args) + "
" + errorMsg); w.scriptRef.log("Script crashed with runtime error"); } else { @@ -89,7 +89,7 @@ function runScriptsLoop() { } w.running = false; w.env.stopFlag = true; - + } else if (isScriptErrorMessage(w)) { dialogBoxCreate("Script runtime unknown error. This is a bug please contact game developer"); console.log("ERROR: Evaluating workerscript returns only error message rather than WorkerScript object. THIS SHOULDN'T HAPPEN"); @@ -100,13 +100,13 @@ function runScriptsLoop() { }); } } - + //Delete any scripts that finished or have been killed. Loop backwards bc removing //items fucks up the indexing for (var i = workerScripts.length - 1; i >= 0; i--) { if (workerScripts[i].running == false && workerScripts[i].env.stopFlag == true) { console.log("Deleting script: " + workerScripts[i].name); - //Delete script from the runningScripts array on its host serverIp + //Delete script from the runningScripts array on its host serverIp var ip = workerScripts[i].serverIp; var name = workerScripts[i].name; for (var j = 0; j < AllServers[ip].runningScripts.length; j++) { @@ -116,18 +116,18 @@ function runScriptsLoop() { break; } } - + //Free RAM AllServers[ip].ramUsed -= workerScripts[i].ramUsage; - + //Delete script from Active Scripts deleteActiveScriptsItem(workerScripts[i]); - + //Delete script from workerScripts workerScripts.splice(i, 1); } } - + setTimeout(runScriptsLoop, 10000); } @@ -145,10 +145,10 @@ function killWorkerScript(runningScriptObj, serverIp) { return false; } -//Queues a script to be run +//Queues a script to be run function addWorkerScript(runningScriptObj, server) { var filename = runningScriptObj.filename; - + //Update server's ram usage var threads = 1; if (runningScriptObj.threads && !isNaN(runningScriptObj.threads)) { @@ -156,18 +156,18 @@ function addWorkerScript(runningScriptObj, server) { } else { runningScriptObj.threads = 1; } - var ramUsage = runningScriptObj.scriptRef.ramUsage * threads + var ramUsage = runningScriptObj.scriptRef.ramUsage * threads * Math.pow(CONSTANTS.MultithreadingRAMCost, threads-1); server.ramUsed += ramUsage; - + //Create the WorkerScript var s = new WorkerScript(runningScriptObj); s.serverIp = server.ip; s.ramUsage = ramUsage; - + //Add the WorkerScript to the Active Scripts list addActiveScriptsItem(s); - + //Add the WorkerScript workerScripts.push(s); return; @@ -181,4 +181,4 @@ function updateOnlineScriptTimes(numCycles = 1) { } } -runScriptsLoop(); \ No newline at end of file +runScriptsLoop(); diff --git a/src/Player.js b/src/Player.js index 7cecca84b..41e494079 100644 --- a/src/Player.js +++ b/src/Player.js @@ -2,7 +2,7 @@ function PlayerObject() { //Skills and stats this.hacking_skill = 1; - + //Fighting this.hp = 10; this.max_hp = 10; @@ -10,17 +10,17 @@ function PlayerObject() { this.defense = 1; //Damage received this.dexterity = 1; //Accuracy this.agility = 1; //Dodge % - + //Labor stats this.charisma = 1; //Intelligence, perhaps? - + //Hacking multipliers this.hacking_chance_mult = 1; //Increase through ascensions/augmentations this.hacking_speed_mult = 1; //Decrease through ascensions/augmentations this.hacking_money_mult = 1; //Increase through ascensions/augmentations. Can't go above 1 this.hacking_grow_mult = 1; - + //Note: "Lifetime" refers to current ascension, "total" refers to the entire game history //Accumulative stats and skills this.total_hacking = 1; @@ -35,7 +35,7 @@ function PlayerObject() { this.lifetime_dexterity = 1; this.lifetime_agility = 1; this.lifetime_charisma = 1; - + //Experience and multipliers this.hacking_exp = 0; this.strength_exp = 0; @@ -43,14 +43,14 @@ function PlayerObject() { this.dexterity_exp = 0; this.agility_exp = 0; this.charisma_exp = 0; - + this.hacking_mult = 1; this.strength_mult = 1; this.defense_mult = 1; this.dexterity_mult = 1; this.agility_mult = 1; this.charisma_mult = 1; - + this.hacking_exp_mult = 1; this.strength_exp_mult = 1; this.defense_exp_mult = 1; @@ -59,38 +59,39 @@ function PlayerObject() { this.charisma_exp_mult = 1; this.company_rep_mult = 1; - this.faction_rep_mult = 1; - + this.faction_rep_mult = 1; + //Money this.money = 1000; this.total_money = 0; //Total money ever earned in this "simulation" this.lifetime_money = 0; //Total money ever earned - + //IP Address of Starting (home) computer this.homeComputer = ""; - + //Location information this.city = Locations.Sector12; this.location = ""; - + //Company Information this.companyName = ""; //Name of Company, equivalent to an object from Locations 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.totalHacknetNodeProduction = 0; - + this.totalHacknetNodeProduction = 0; + //Factions - this.factions = []; //Names of all factions player has joined - + this.factions = []; //Names of all factions player has joined + this.factionInvitations = []; //Outstanding faction invitations + //Augmentations this.queuedAugmentations = []; //Purchased but not installed, names only this.augmentations = []; //Names of all installed augmentations - + //Crime statistics (Total refers to this 'simulation'. Lifetime is forever) this.karma = 0; this.numTimesShoplifted = 0; @@ -117,22 +118,22 @@ function PlayerObject() { this.numTimesHeist = 0; this.numTimesHeistTotal = 0; this.numTimesHeistLifetime = 0; - + this.crime_money_mult = 1; this.crime_success_mult = 1; - + //Flag to let the engine know the player is starting an action // Current actions: hack, analyze this.startAction = false; this.actionTime = 0; - - //Flags/variables for working (Company, Faction, Creating Program, Taking Class) + + //Flags/variables for working (Company, Faction, Creating Program, Taking Class) this.isWorking = false; this.workType = ""; - + this.currentWorkFactionName = ""; this.currentWorkFactionDescription = ""; - + this.workHackExpGainRate = 0; this.workStrExpGainRate = 0; this.workDefExpGainRate = 0; @@ -142,7 +143,7 @@ function PlayerObject() { this.workRepGainRate = 0; this.workMoneyGainRate = 0; this.workMoneyLossRate = 0; - + this.workHackExpGained = 0; this.workStrExpGained = 0; this.workDefExpGained = 0; @@ -151,30 +152,30 @@ function PlayerObject() { this.workChaExpGained = 0; this.workRepGained = 0; this.workMoneyGained = 0; - + this.createProgramName = ""; - + this.className = ""; - + this.crimeType = ""; - + this.timeWorked = 0; //in ms this.timeNeededToCompleteWork = 0; - + this.work_money_mult = 1; - + //Hacknet Node multipliers this.hacknet_node_money_mult = 1; this.hacknet_node_purchase_cost_mult = 1; this.hacknet_node_ram_cost_mult = 1; this.hacknet_node_core_cost_mult = 1; this.hacknet_node_level_cost_mult = 1; - + //Stock Market this.hasWseAccount = false; this.hasTixApiAccess = false; - - //Used to store the last update time. + + //Used to store the last update time. this.lastUpdate = 0; this.totalPlaytime = 0; this.playtimeSinceLastAug = 0; @@ -187,7 +188,7 @@ PlayerObject.prototype.init = function() { this.homeComputer = t_homeComp.ip; this.currentServer = t_homeComp.ip; AddToAllServers(t_homeComp); - + this.getHomeComputer().programs.push(Programs.NukeProgram); } @@ -213,7 +214,7 @@ PlayerObject.prototype.updateSkillLevels = function() { this.dexterity = Math.floor(this.calculateSkill(this.dexterity_exp) * this.dexterity_mult); this.agility = Math.floor(this.calculateSkill(this.agility_exp) * this.agility_mult); this.charisma = Math.floor(this.calculateSkill(this.charisma_exp) * this.charisma_mult); - + var ratio = this.hp / this.max_hp; this.max_hp = Math.floor(10 + this.defense / 10); Player.hp = Math.round(this.max_hp * ratio); @@ -221,7 +222,7 @@ PlayerObject.prototype.updateSkillLevels = function() { //Calculates the chance of hacking a server //The formula is: -// (2 * hacking_chance_multiplier * hacking_skill - requiredLevel) 100 - difficulty +// (2 * hacking_chance_multiplier * hacking_skill - requiredLevel) 100 - difficulty // ----------------------------------------------------------- * ----------------- // (2 * hacking_chance_multiplier * hacking_skill) 100 PlayerObject.prototype.calculateHackingChance = function() { @@ -230,15 +231,15 @@ PlayerObject.prototype.calculateHackingChance = function() { var skillChance = (skillMult - this.getCurrentServer().requiredHackingSkill) / skillMult; var chance = skillChance * difficultyMult * this.hacking_chance_mult; if (chance > 1) {return 1;} - if (chance < 0) {return 0;} + if (chance < 0) {return 0;} return chance; } //Calculate the time it takes to hack a server in seconds. Returns the time //The formula is: -// (2.5 * requiredLevel * difficulty + 200) +// (2.5 * requiredLevel * difficulty + 200) // ----------------------------------- * hacking_speed_multiplier -// hacking_skill + 100 +// hacking_skill + 100 PlayerObject.prototype.calculateHackingTime = function() { var difficultyMult = this.getCurrentServer().requiredHackingSkill * this.getCurrentServer().hackDifficulty; var skillFactor = (2.5 * difficultyMult + 200) / (this.hacking_skill + 100); @@ -247,7 +248,7 @@ PlayerObject.prototype.calculateHackingTime = function() { //Calculates the PERCENTAGE of a server's money that the player will hack from the server if successful //The formula is: -// (hacking_skill - (requiredLevel-1)) 100 - difficulty +// (hacking_skill - (requiredLevel-1)) 100 - difficulty // --------------------------------------* ----------------------- * hacking_money_multiplier // hacking_skill 100 PlayerObject.prototype.calculatePercentMoneyHacked = function() { @@ -268,7 +269,7 @@ PlayerObject.prototype.calculateExpGain = function() { if (s.baseDifficulty == null) { s.baseDifficulty = s.hackDifficulty; } - return (s.baseDifficulty * this.hacking_exp_mult * 0.4 + 2); + return (s.baseDifficulty * this.hacking_exp_mult * 0.3 + 2); } //Hack/Analyze a server. Return the amount of time the hack will take. This lets the Terminal object know how long to disable itself for @@ -349,7 +350,7 @@ PlayerObject.prototype.gainCharismaExp = function(exp) { console.log("ERR: NaN passed into Player.gainCharismaExp()"); return; } this.charisma_exp += exp; -} +} /******* Working functions *******/ PlayerObject.prototype.resetWorkStatus = function() { @@ -361,7 +362,7 @@ PlayerObject.prototype.resetWorkStatus = function() { this.workChaExpGainRate = 0; this.workRepGainRate = 0; this.workMoneyGainRate = 0; - + this.workHackExpGained = 0; this.workStrExpGained = 0; this.workDefExpGained = 0; @@ -370,14 +371,14 @@ PlayerObject.prototype.resetWorkStatus = function() { this.workChaExpGained = 0; this.workRepGained = 0; this.workMoneyGained = 0; - + this.timeWorked = 0; - + this.currentWorkFactionName = ""; this.currentWorkFactionDescription = ""; this.createProgramName = ""; this.className = ""; - + document.getElementById("work-in-progress-text").innerHTML = ""; } @@ -398,33 +399,33 @@ PlayerObject.prototype.finishWork = function(cancelled) { } this.gainWorkExp(); - + var company = Companies[this.companyName]; company.playerReputation += (this.workRepGained); - + this.gainMoney(this.workMoneyGained); - + this.updateSkillLevels(); - - var txt = "You earned a total of:
" + - "$" + formatNumber(this.workMoneyGained, 2) + "
" + - formatNumber(this.workRepGained, 4) + " reputation for the company
" + - formatNumber(this.workHackExpGained, 4) + " hacking exp
" + - formatNumber(this.workStrExpGained, 4) + " strength exp
" + + + var txt = "You earned a total of:
" + + "$" + formatNumber(this.workMoneyGained, 2) + "
" + + formatNumber(this.workRepGained, 4) + " reputation for the company
" + + formatNumber(this.workHackExpGained, 4) + " hacking exp
" + + formatNumber(this.workStrExpGained, 4) + " strength exp
" + formatNumber(this.workDefExpGained, 4) + " defense exp
" + - formatNumber(this.workDexExpGained, 4) + " dexterity exp
" + - formatNumber(this.workAgiExpGained, 4) + " agility exp
" + + formatNumber(this.workDexExpGained, 4) + " dexterity exp
" + + formatNumber(this.workAgiExpGained, 4) + " agility exp
" + formatNumber(this.workChaExpGained, 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 reputation you earned.

" + txt; + "Since you cancelled your work early, you only gained half of the reputation you earned.

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

" + "You earned a total of:
" + txt; } dialogBoxCreate(txt); - + var mainMenu = document.getElementById("mainmenu-container"); mainMenu.style.visibility = "visible"; this.isWorking = false; @@ -435,7 +436,7 @@ PlayerObject.prototype.startWork = function() { this.resetWorkStatus(); this.isWorking = true; this.workType = CONSTANTS.WorkTypeCompany; - + this.workHackExpGainRate = this.getWorkHackExpGain(); this.workStrExpGainRate = this.getWorkStrExpGain(); this.workDefExpGainRate = this.getWorkDefExpGain(); @@ -444,9 +445,9 @@ PlayerObject.prototype.startWork = function() { this.workChaExpGainRate = this.getWorkChaExpGain(); this.workRepGainRate = this.getWorkRepGain(); this.workMoneyGainRate = this.getWorkMoneyGain(); - + this.timeNeededToCompleteWork = CONSTANTS.MillisecondsPer8Hours; - + //Remove all old event listeners from Cancel button var newCancelButton = clearEventListeners("work-in-progress-cancel-button"); newCancelButton.innerHTML = "Cancel Work"; @@ -454,14 +455,14 @@ PlayerObject.prototype.startWork = function() { Player.finishWork(true); return false; }); - + //Display Work In Progress Screen Engine.loadWorkInProgressContent(); } - + PlayerObject.prototype.work = function(numCycles) { this.workRepGainRate = this.getWorkRepGain(); - + this.workHackExpGained += this.workHackExpGainRate * numCycles; this.workStrExpGained += this.workStrExpGainRate * numCycles; this.workDefExpGained += this.workDefExpGainRate * numCycles; @@ -470,11 +471,11 @@ PlayerObject.prototype.work = function(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; @@ -489,30 +490,30 @@ PlayerObject.prototype.work = function(numCycles) { this.finishWork(false); return; } - + var txt = document.getElementById("work-in-progress-text"); - txt.innerHTML = "You are currently working as a " + this.companyPosition.positionName + - " at " + Player.companyName + "

" + + 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
" + + "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, " + + 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 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(); @@ -521,23 +522,23 @@ PlayerObject.prototype.startWorkPartTime = function() { 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.innerHTML = "Stop Working"; 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; @@ -546,11 +547,11 @@ PlayerObject.prototype.workPartTime = function(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; @@ -565,47 +566,47 @@ PlayerObject.prototype.workPartTime = function(numCycles) { 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 + "

" + + 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
" + + "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,
" + + 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(); - + var company = Companies[this.companyName]; company.playerReputation += (this.workRepGained); - + this.gainMoney(this.workMoneyGained); - + this.updateSkillLevels(); - - var txt = "You earned a total of:
" + - "$" + formatNumber(this.workMoneyGained, 2) + "
" + - formatNumber(this.workRepGained, 4) + " reputation for the company
" + - formatNumber(this.workHackExpGained, 4) + " hacking exp
" + - formatNumber(this.workStrExpGained, 4) + " strength exp
" + + + var txt = "You earned a total of:
" + + "$" + formatNumber(this.workMoneyGained, 2) + "
" + + formatNumber(this.workRepGained, 4) + " reputation for the company
" + + formatNumber(this.workHackExpGained, 4) + " hacking exp
" + + formatNumber(this.workStrExpGained, 4) + " strength exp
" + formatNumber(this.workDefExpGained, 4) + " defense exp
" + - formatNumber(this.workDexExpGained, 4) + " dexterity exp
" + - formatNumber(this.workAgiExpGained, 4) + " agility exp
" + + formatNumber(this.workDexExpGained, 4) + " dexterity exp
" + + formatNumber(this.workAgiExpGained, 4) + " agility exp
" + formatNumber(this.workChaExpGained, 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; @@ -615,31 +616,31 @@ PlayerObject.prototype.finishWorkPartTime = function() { /* Working for Faction */ PlayerObject.prototype.finishFactionWork = function(cancelled, faction) { this.gainWorkExp(); - + var faction = Factions[this.currentWorkFactionName]; faction.playerReputation += (this.workRepGained); - + this.gainMoney(this.workMoneyGained); - + this.updateSkillLevels(); - + var txt = "You worked for your faction " + faction.name + " for a total of " + convertTimeMsToTimeElapsedString(this.timeWorked) + "

" + - "You earned a total of:
" + - "$" + formatNumber(this.workMoneyGained, 2) + "
" + - formatNumber(this.workRepGained, 4) + " reputation for the faction
" + - formatNumber(this.workHackExpGained, 4) + " hacking exp
" + - formatNumber(this.workStrExpGained, 4) + " strength exp
" + + "You earned a total of:
" + + "$" + formatNumber(this.workMoneyGained, 2) + "
" + + formatNumber(this.workRepGained, 4) + " reputation for the faction
" + + formatNumber(this.workHackExpGained, 4) + " hacking exp
" + + formatNumber(this.workStrExpGained, 4) + " strength exp
" + formatNumber(this.workDefExpGained, 4) + " defense exp
" + - formatNumber(this.workDexExpGained, 4) + " dexterity exp
" + - formatNumber(this.workAgiExpGained, 4) + " agility exp
" + + formatNumber(this.workDexExpGained, 4) + " dexterity exp
" + + formatNumber(this.workAgiExpGained, 4) + " agility exp
" + formatNumber(this.workChaExpGained, 4) + " charisma exp
"; dialogBoxCreate(txt); - + var mainMenu = document.getElementById("mainmenu-container"); mainMenu.style.visibility = "visible"; - + this.isWorking = false; - + Engine.loadTerminalContent(); } @@ -648,39 +649,39 @@ PlayerObject.prototype.startFactionWork = function(faction) { var favorMult = 1 + (faction.favor / 100); if (isNaN(favorMult)) {favorMult = 1;} this.workRepGainRate *= favorMult; - + this.isWorking = true; this.workType = CONSTANTS.WorkTypeFaction; this.currentWorkFactionName = faction.name; - + this.timeNeededToCompleteWork = CONSTANTS.MillisecondsPer20Hours; - - var cancelButton = clearEventListeners("work-in-progress-cancel-button"); + + var cancelButton = clearEventListeners("work-in-progress-cancel-button"); cancelButton.innerHTML = "Stop Faction Work"; cancelButton.addEventListener("click", function() { Player.finishFactionWork(true, faction); return false; }); - + //Display Work In Progress Screen Engine.loadWorkInProgressContent(); } PlayerObject.prototype.startFactionHackWork = function(faction) { this.resetWorkStatus(); - + this.workHackExpGainRate = .15 * this.hacking_exp_mult; this.workRepGainRate = 0.9 * this.hacking_skill / CONSTANTS.MaxSkillLevel * this.faction_rep_mult; - + this.factionWorkType = CONSTANTS.FactionWorkHacking; this.currentWorkFactionDescription = "carrying out hacking contracts"; - + this.startFactionWork(faction); } PlayerObject.prototype.startFactionFieldWork = function(faction) { this.resetWorkStatus(); - + this.workHackExpGainRate = .1 * this.hacking_exp_mult; this.workStrExpGainRate = .1 * this.strength_exp_mult; this.workDefExpGainRate = .1 * this.defense_exp_mult; @@ -688,10 +689,10 @@ PlayerObject.prototype.startFactionFieldWork = function(faction) { this.workAgiExpGainRate = .1 * this.agility_exp_mult; this.workChaExpGainRate = .1 * this.charisma_exp_mult; this.workRepGainRate = this.getFactionFieldWorkRepGain(); - + this.factionWorkType = CONSTANTS.FactionWorkField; this.currentWorkFactionDescription = "carrying out field missions" - + this.startFactionWork(faction); } @@ -705,16 +706,16 @@ PlayerObject.prototype.startFactionSecurityWork = function(faction) { this.workAgiExpGainRate = 0.15 * this.agility_exp_mult; this.workChaExpGainRate = 0.00 * this.charisma_exp_mult; this.workRepGainRate = this.getFactionSecurityWorkRepGain(); - + this.factionWorkType = CONSTANTS.FactionWorkSecurity; this.currentWorkFactionDescription = "performing security detail" - + this.startFactionWork(faction); } - + PlayerObject.prototype.workForFaction = function(numCycles) { var faction = Factions[this.currentWorkFactionName]; - + //Constantly update the rep gain rate switch (this.factionWorkType) { case CONSTANTS.FactionWorkHacking: @@ -729,12 +730,12 @@ PlayerObject.prototype.workForFaction = function(numCycles) { default: break; } - + //Update reputation gain rate to account for faction favor var favorMult = 1 + (faction.favor / 100); if (isNaN(favorMult)) {favorMult = 1;} this.workRepGainRate *= favorMult; - + this.workHackExpGained += this.workHackExpGainRate * numCycles; this.workStrExpGained += this.workStrExpGainRate * numCycles; this.workDefExpGained += this.workDefExpGainRate * numCycles; @@ -743,11 +744,11 @@ PlayerObject.prototype.workForFaction = function(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 == 20 hours, then finish. You can only work for the faction for 20 hours if (this.timeWorked >= CONSTANTS.MillisecondsPer20Hours) { var maxCycles = CONSTANTS.GameCyclesPer20Hours; @@ -761,22 +762,22 @@ PlayerObject.prototype.workForFaction = function(numCycles) { this.workMoneyGained = this.workMoneyGainRate * maxCycles; this.finishFactionWork(false, faction); } - + var txt = document.getElementById("work-in-progress-text"); - txt.innerHTML = "You are currently " + this.currentWorkFactionDescription + " for your faction " + faction.name + "." + + txt.innerHTML = "You are currently " + this.currentWorkFactionDescription + " for your faction " + faction.name + "." + " You have been doing this 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 faction

" + - 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
" + + "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 faction

" + + 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 20 hours. You can cancel earlier if you wish.
" + - "There is no penalty for cancelling earlier."; + formatNumber(this.workChaExpGained, 4) + " (" + formatNumber(this.workChaExpGainRate * cyclesPerSec, 4) + " / sec) charisma exp

" + + + "You will automatically finish after working for 20 hours. You can cancel earlier if you wish.
" + + "There is no penalty for cancelling earlier."; } @@ -827,28 +828,28 @@ PlayerObject.prototype.getWorkRepGain = function() { var company = Companies[this.companyName]; var jobPerformance = this.companyPosition.calculateJobPerformance(this.hacking_skill, this.strength, this.defense, this.dexterity, - this.agility, this.charisma); + this.agility, this.charisma); //Update reputation gain rate to account for company favor var favorMult = 1 + (company.favor / 100); if (isNaN(favorMult)) {favorMult = 1;} - return jobPerformance * this.company_rep_mult * favorMult; + return jobPerformance * this.company_rep_mult * favorMult; } PlayerObject.prototype.getFactionSecurityWorkRepGain = function() { - var t = 0.9 * (this.hacking_skill / CONSTANTS.MaxSkillLevel + - this.strength / CONSTANTS.MaxSkillLevel + - this.defense / CONSTANTS.MaxSkillLevel + - this.dexterity / CONSTANTS.MaxSkillLevel + + var t = 0.9 * (this.hacking_skill / CONSTANTS.MaxSkillLevel + + this.strength / CONSTANTS.MaxSkillLevel + + this.defense / CONSTANTS.MaxSkillLevel + + this.dexterity / CONSTANTS.MaxSkillLevel + this.agility / CONSTANTS.MaxSkillLevel) / 5; return t * this.faction_rep_mult; } PlayerObject.prototype.getFactionFieldWorkRepGain = function() { - var t = 0.9 * (this.hacking_skill / CONSTANTS.MaxSkillLevel + - this.strength / CONSTANTS.MaxSkillLevel + - this.defense / CONSTANTS.MaxSkillLevel + - this.dexterity / CONSTANTS.MaxSkillLevel + - this.agility / CONSTANTS.MaxSkillLevel + + var t = 0.9 * (this.hacking_skill / CONSTANTS.MaxSkillLevel + + this.strength / CONSTANTS.MaxSkillLevel + + this.defense / CONSTANTS.MaxSkillLevel + + this.dexterity / CONSTANTS.MaxSkillLevel + + this.agility / CONSTANTS.MaxSkillLevel + this.charisma / CONSTANTS.MaxSkillLevel) / 6; return t * this.faction_rep_mult; } @@ -858,13 +859,13 @@ PlayerObject.prototype.startCreateProgramWork = function(programName, time, reqL this.resetWorkStatus(); this.isWorking = true; this.workType = CONSTANTS.WorkTypeCreateProgram; - + //Time needed to complete work affected by hacking skill (linearly based on //ratio of (your skill - required level) to MAX skill) var timeMultiplier = (CONSTANTS.MaxSkillLevel - (this.hacking_skill - reqLevel)) / CONSTANTS.MaxSkillLevel; if (timeMultiplier > 1) {timeMultiplier = 1;} if (timeMultiplier < 0.01) {timeMultiplier = 0.01;} - + this.timeNeededToCompleteWork = timeMultiplier * time; //Check for incomplete program for (var i = 0; i < Player.getHomeComputer().programs.length; ++i) { @@ -878,16 +879,16 @@ PlayerObject.prototype.startCreateProgramWork = function(programName, time, reqL Player.getHomeComputer().programs.splice(i, 1); } } - + this.createProgramName = programName; - + var cancelButton = clearEventListeners("work-in-progress-cancel-button"); cancelButton.innerHTML = "Cancel work on creating program"; cancelButton.addEventListener("click", function() { Player.finishCreateProgramWork(true, programName); return false; }); - + //Display Work In Progress Screen Engine.loadWorkInProgressContent(); } @@ -895,35 +896,35 @@ PlayerObject.prototype.startCreateProgramWork = function(programName, time, reqL PlayerObject.prototype.createProgramWork = function(numCycles) { this.timeWorked += Engine._idleSpeed * numCycles; var programName = this.createProgramName; - + if (this.timeWorked >= this.timeNeededToCompleteWork) { this.finishCreateProgramWork(false, programName); } - + var txt = document.getElementById("work-in-progress-text"); - txt.innerHTML = "You are currently working on coding " + programName + ".

" + + txt.innerHTML = "You are currently working on coding " + programName + ".

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

" + - "The program is " + (this.timeWorked / this.timeNeededToCompleteWork * 100).toFixed(2) + "% complete.
" + - "If you cancel, your work will be saved and you can come back to complete the program later."; + "The program is " + (this.timeWorked / this.timeNeededToCompleteWork * 100).toFixed(2) + "% complete.
" + + "If you cancel, your work will be saved and you can come back to complete the program later."; } PlayerObject.prototype.finishCreateProgramWork = function(cancelled, programName) { if (cancelled == false) { - dialogBoxCreate("You've finished creating " + programName + "!
" + + dialogBoxCreate("You've finished creating " + programName + "!
" + "The new program can be found on your home computer."); - + Player.getHomeComputer().programs.push(programName); } else { var perc = Math.floor(this.timeWorked / this.timeNeededToCompleteWork * 100).toString(); var incompleteName = programName + "-" + perc + "%-INC"; Player.getHomeComputer().programs.push(incompleteName); } - + var mainMenu = document.getElementById("mainmenu-container"); mainMenu.style.visibility = "visible"; - + Player.isWorking = false; - + Engine.loadTerminalContent(); } @@ -932,11 +933,11 @@ PlayerObject.prototype.startClass = function(costMult, expMult, className) { this.resetWorkStatus(); this.isWorking = true; this.workType = CONSTANTS.WorkTypeStudyClass; - + this.className = className; - + var gameCPS = 1000 / Engine._idleSpeed; - + //Base exp gains per second var baseStudyComputerScienceExp = 0.25; var baseDataStructuresExp = 0.5; @@ -945,7 +946,7 @@ PlayerObject.prototype.startClass = function(costMult, expMult, className) { var baseManagementExp = 1; var baseLeadershipExp = 2; var baseGymExp = 1; - + //Find cost and exp gain per game cycle var cost = 0; var hackExp = 0, strExp = 0, defExp = 0, dexExp = 0, agiExp = 0, chaExp = 0; @@ -958,7 +959,7 @@ PlayerObject.prototype.startClass = function(costMult, expMult, className) { hackExp = baseDataStructuresExp * expMult / gameCPS; break; case CONSTANTS.ClassNetworks: - cost = CONSTANTS.ClassNetworksBaseCost * costMult / gameCPS; + cost = CONSTANTS.ClassNetworksBaseCost * costMult / gameCPS; hackExp = baseNetworksExp * expMult / gameCPS; break; case CONSTANTS.ClassAlgorithms: @@ -993,7 +994,7 @@ PlayerObject.prototype.startClass = function(costMult, expMult, className) { throw new Error("ERR: Invalid/unregocnized class name"); return; } - + this.workMoneyLossRate = cost; this.workHackExpGainRate = hackExp * this.hacking_exp_mult; this.workStrExpGainRate = strExp * this.strength_exp_mult; @@ -1001,11 +1002,11 @@ PlayerObject.prototype.startClass = function(costMult, expMult, className) { this.workDexExpGainRate = dexExp * this.dexterity_exp_mult; this.workAgiExpGainRate = agiExp * this.agility_exp_mult; this.workChaExpGainRate = chaExp * this.charisma_exp_mult; - + var cancelButton = clearEventListeners("work-in-progress-cancel-button"); - if (className == CONSTANTS.ClassGymStrength || - className == CONSTANTS.ClassGymDefense || - className == CONSTANTS.ClassGymDexterity || + if (className == CONSTANTS.ClassGymStrength || + className == CONSTANTS.ClassGymDefense || + className == CONSTANTS.ClassGymDexterity || className == CONSTANTS.ClassGymAgility) { cancelButton.innerHTML = "Stop training at gym"; } else { @@ -1015,7 +1016,7 @@ PlayerObject.prototype.startClass = function(costMult, expMult, className) { Player.finishClass(); return false; }); - + //Display Work In Progress Screen Engine.loadWorkInProgressContent(); } @@ -1023,7 +1024,7 @@ PlayerObject.prototype.startClass = function(costMult, expMult, className) { PlayerObject.prototype.takeClass = function(numCycles) { this.timeWorked += Engine._idleSpeed * numCycles; var className = this.className; - + this.workHackExpGained += this.workHackExpGainRate * numCycles; this.workStrExpGained += this.workStrExpGainRate * numCycles; this.workDefExpGained += this.workDefExpGainRate * numCycles; @@ -1033,49 +1034,49 @@ PlayerObject.prototype.takeClass = function(numCycles) { this.workRepGained += this.workRepGainRate * numCycles; this.workMoneyGained += this.workMoneyGainRate * numCycles; this.workMoneyGained -= this.workMoneyLossRate * numCycles; - + var cyclesPerSec = 1000 / Engine._idleSpeed; - + var txt = document.getElementById("work-in-progress-text"); txt.innerHTML = "You have been " + className + " for " + convertTimeMsToTimeElapsedString(this.timeWorked) + "

" + - "This has cost you:
" + - "$" + formatNumber(this.workMoneyGained, 2) + " ($" + formatNumber(this.workMoneyLossRate * cyclesPerSec, 2) + " / sec)

" + - "You have gained:
" + - formatNumber(this.workHackExpGained, 4) + " (" + formatNumber(this.workHackExpGainRate * cyclesPerSec, 4) + " / sec) hacking exp
" + - formatNumber(this.workDefExpGained, 4) + " (" + formatNumber(this.workDefExpGainRate * cyclesPerSec, 4) + " / sec) defense exp
" + - formatNumber(this.workStrExpGained, 4) + " (" + formatNumber(this.workStrExpGainRate * cyclesPerSec, 4) + " / sec) strength exp
" + - formatNumber(this.workDexExpGained, 4) + " (" + formatNumber(this.workDexExpGainRate * cyclesPerSec, 4) + " / sec) dexterity exp
" + + "This has cost you:
" + + "$" + formatNumber(this.workMoneyGained, 2) + " ($" + formatNumber(this.workMoneyLossRate * cyclesPerSec, 2) + " / sec)

" + + "You have gained:
" + + formatNumber(this.workHackExpGained, 4) + " (" + formatNumber(this.workHackExpGainRate * cyclesPerSec, 4) + " / sec) hacking exp
" + + formatNumber(this.workDefExpGained, 4) + " (" + formatNumber(this.workDefExpGainRate * cyclesPerSec, 4) + " / sec) defense exp
" + + formatNumber(this.workStrExpGained, 4) + " (" + formatNumber(this.workStrExpGainRate * cyclesPerSec, 4) + " / sec) strength 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 may cancel at any time"; + formatNumber(this.workChaExpGained, 4) + " (" + formatNumber(this.workChaExpGainRate * cyclesPerSec, 4) + " / sec) charisma exp
" + + "You may cancel at any time"; } PlayerObject.prototype.finishClass = function() { this.gainWorkExp(); - + if (this.workMoneyGained > 0) { throw new Error("ERR: Somehow gained money while taking class"); } this.loseMoney(this.workMoneyGained * -1); - + this.updateSkillLevels(); var txt = "After " + this.className + " for " + convertTimeMsToTimeElapsedString(this.timeWorked) + ",
" + - "you spent a total of $" + formatNumber(this.workMoneyGained * -1, 2) + ".

" + - "You earned a total of:
" + - formatNumber(this.workHackExpGained, 4) + " hacking exp
" + - formatNumber(this.workStrExpGained, 4) + " strength exp
" + + "you spent a total of $" + formatNumber(this.workMoneyGained * -1, 2) + ".

" + + "You earned a total of:
" + + formatNumber(this.workHackExpGained, 4) + " hacking exp
" + + formatNumber(this.workStrExpGained, 4) + " strength exp
" + formatNumber(this.workDefExpGained, 4) + " defense exp
" + - formatNumber(this.workDexExpGained, 4) + " dexterity exp
" + - formatNumber(this.workAgiExpGained, 4) + " agility exp
" + + formatNumber(this.workDexExpGained, 4) + " dexterity exp
" + + formatNumber(this.workAgiExpGained, 4) + " agility exp
" + formatNumber(this.workChaExpGained, 4) + " charisma exp
"; dialogBoxCreate(txt); - + var mainMenu = document.getElementById("mainmenu-container"); mainMenu.style.visibility = "visible"; - + this.isWorking = false; - + Engine.loadLocationContent(); } @@ -1084,7 +1085,7 @@ PlayerObject.prototype.startCrime = function(hackExp, strExp, defExp, dexExp, ag this.resetWorkStatus(); this.isWorking = true; this.workType = CONSTANTS.WorkTypeCrime; - + this.workHackExpGained = hackExp * this.hacking_exp_mult; this.workStrExpGained = strExp * this.strength_exp_mult; this.workDefExpGained = defExp * this.defense_exp_mult; @@ -1092,9 +1093,9 @@ PlayerObject.prototype.startCrime = function(hackExp, strExp, defExp, dexExp, ag this.workAgiExpGained = agiExp * this.agility_exp_mult; this.workChaExpGained = chaExp * this.charisma_exp_mult; this.workMoneyGained = money * this.crime_money_mult; - + this.timeNeededToCompleteWork = time; - + //Remove all old event listeners from Cancel button var newCancelButton = clearEventListeners("work-in-progress-cancel-button") newCancelButton.innerHTML = "Cancel crime" @@ -1102,25 +1103,25 @@ PlayerObject.prototype.startCrime = function(hackExp, strExp, defExp, dexExp, ag Player.finishCrime(true); return false; }); - + //Display Work In Progress Screen Engine.loadWorkInProgressContent(); } PlayerObject.prototype.commitCrime = function (numCycles) { this.timeWorked += Engine._idleSpeed * numCycles; - + if (this.timeWorked >= this.timeNeededToCompleteWork) {Player.finishCrime(false); return;} - + 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"); - txt.innerHTML = "You are attempting to " + Player.crimeType + ".
" + - "Time remaining: " + convertTimeMsToTimeElapsedString(this.timeNeededToCompleteWork - this.timeWorked) + "
" + + txt.innerHTML = "You are attempting to " + Player.crimeType + ".
" + + "Time remaining: " + convertTimeMsToTimeElapsedString(this.timeNeededToCompleteWork - this.timeWorked) + "
" + progressBar.replace( / /g, " " ); } @@ -1141,7 +1142,7 @@ PlayerObject.prototype.finishCrime = function(cancelled) { break; case CONSTANTS.CrimeDrugs: ++this.numTimesDealtDrugs; - this.karma -= 0.5; + this.karma -= 0.5; break; case CONSTANTS.CrimeTraffickArms: ++this.numTimesTraffickArms; @@ -1171,7 +1172,7 @@ PlayerObject.prototype.finishCrime = function(cancelled) { dialogBoxCreate("ERR: Unrecognized crime type. This is probably a bug please contact the developer"); return; } - + //On a crime success, gain 2x exp this.workHackExpGained *= 2; this.workStrExpGained *= 2; @@ -1179,32 +1180,32 @@ PlayerObject.prototype.finishCrime = function(cancelled) { this.workDexExpGained *= 2; this.workAgiExpGained *= 2; this.workChaExpGained *= 2; - - dialogBoxCreate("Crime successful!

" + - "You gained:
"+ - "$" + formatNumber(this.workMoneyGained, 2) + "
" + - formatNumber(this.workHackExpGained, 4) + " hacking experience
" + - formatNumber(this.workStrExpGained, 4) + " strength experience
" + - formatNumber(this.workDefExpGained, 4) + " defense experience
" + - formatNumber(this.workDexExpGained, 4) + " dexterity experience
" + - formatNumber(this.workAgiExpGained, 4) + " agility experience
" + + + dialogBoxCreate("Crime successful!

" + + "You gained:
"+ + "$" + formatNumber(this.workMoneyGained, 2) + "
" + + formatNumber(this.workHackExpGained, 4) + " hacking experience
" + + formatNumber(this.workStrExpGained, 4) + " strength experience
" + + formatNumber(this.workDefExpGained, 4) + " defense experience
" + + formatNumber(this.workDexExpGained, 4) + " dexterity experience
" + + formatNumber(this.workAgiExpGained, 4) + " agility experience
" + formatNumber(this.workChaExpGained, 4) + " charisma experience"); } else { - dialogBoxCreate("Crime failed!

" + - "You gained:
"+ - formatNumber(this.workHackExpGained, 4) + " hacking experience
" + - formatNumber(this.workStrExpGained, 4) + " strength experience
" + - formatNumber(this.workDefExpGained, 4) + " defense experience
" + - formatNumber(this.workDexExpGained, 4) + " dexterity experience
" + - formatNumber(this.workAgiExpGained, 4) + " agility experience
" + + dialogBoxCreate("Crime failed!

" + + "You gained:
"+ + formatNumber(this.workHackExpGained, 4) + " hacking experience
" + + formatNumber(this.workStrExpGained, 4) + " strength experience
" + + formatNumber(this.workDefExpGained, 4) + " defense experience
" + + formatNumber(this.workDexExpGained, 4) + " dexterity experience
" + + formatNumber(this.workAgiExpGained, 4) + " agility experience
" + formatNumber(this.workChaExpGained, 4) + " charisma experience"); } - + this.gainWorkExp(); } - - - + + + var mainMenu = document.getElementById("mainmenu-container"); mainMenu.style.visibility = "visible"; this.isWorking = false; @@ -1224,8 +1225,8 @@ PlayerObject.prototype.takeDamage = function(amt) { } PlayerObject.prototype.hospitalize = function() { - dialogBoxCreate("You were in critical condition! You were taken to the hospital where " + - "luckily they were able to save your life. You were charged $" + + dialogBoxCreate("You were in critical condition! You were taken to the hospital where " + + "luckily they were able to save your life. You were charged $" + formatNumber(this.max_hp * CONSTANTS.HospitalCostPerHp, 2)); Player.loseMoney(this.max_hp * CONSTANTS.HospitalCostPerHp); this.hp = this.max_hp; @@ -1238,11 +1239,8 @@ PlayerObject.prototype.toJSON = function() { PlayerObject.fromJSON = function(value) { return Generic_fromJSON(PlayerObject, value.data); -} +} Reviver.constructors.PlayerObject = PlayerObject; Player = new PlayerObject(); - - - diff --git a/src/Prestige.js b/src/Prestige.js index 890b92ae7..26a4eb8d5 100644 --- a/src/Prestige.js +++ b/src/Prestige.js @@ -15,7 +15,7 @@ function prestigeAugmentation() { Player.lifetime_agility += Player.agility; Player.total_charisma += Player.charisma; Player.lifetime_charisma += Player.charisma; - + //Crime statistics Player.numTimesShopliftedTotal += Player.numTimesShoplifted; Player.numTimesShopliftedLifetime += Player.numTimesShoplifted; @@ -41,52 +41,53 @@ function prestigeAugmentation() { Player.numTimesHeistTotal += Player.numTimesHeist; Player.numTimesHeistLifetime += Player.numTimesHeist; Player.numTimesHeist = 0; - + Player.karma = 0; - + //Reset stats Player.hacking_skill = 1; - + Player.strength = 1; Player.defense = 1; Player.dexterity = 1; Player.agility = 1; - + Player.charisma = 1; - + Player.hacking_exp = 0; Player.strength_exp = 0; Player.defense_exp = 0; Player.dexterity_exp = 0; Player.agility_exp = 0; Player.charisma_exp = 0; - + Player.money = 1000; - + Player.city = Locations.Sector12; Player.location = ""; - + Player.companyName = ""; Player.companyPosition = ""; - + Player.currentServer = ""; Player.discoveredServers = []; Player.purchasedServers = []; - + Player.factions = []; - + Player.factionInvitations = []; + Player.queuedAugmentations = []; - + Player.startAction = false; Player.actionTime = 0; - + Player.isWorking = false; Player.currentWorkFactionName = ""; Player.currentWorkFactionDescription = ""; this.createProgramName = ""; this.className = ""; this.crimeType = ""; - + Player.workHackExpGainRate = 0; Player.workStrExpGainRate = 0; Player.workDefExpGainRate = 0; @@ -95,7 +96,7 @@ function prestigeAugmentation() { Player.workChaExpGainRate = 0; Player.workRepGainRate = 0; Player.workMoneyGainRate = 0; - + Player.workHackExpGained = 0; Player.workStrExpGained = 0; Player.workDefExpGained = 0; @@ -104,18 +105,18 @@ function prestigeAugmentation() { Player.workChaExpGained = 0; Player.workRepGained = 0; Player.workMoneyGained = 0; - + Player.timeWorked = 0; - + Player.lastUpdate = new Date().getTime(); - + //Delete all Worker Scripts objects for (var i = 0; i < workerScripts.length; ++i) { deleteActiveScriptsItem(workerScripts[i]); workerScripts[i].env.stopFlag = true; } workerScripts.length = 0; - + var homeComp = Player.getHomeComputer(); //Delete all servers except home computer for (var member in AllServers) { @@ -127,7 +128,7 @@ function prestigeAugmentation() { delete SpecialServerIps[member]; } SpecialServersIps = null; - + //Reset home computer (only the programs) and add to AllServers homeComp.programs.length = 0; homeComp.runningScripts = []; @@ -136,12 +137,12 @@ function prestigeAugmentation() { homeComp.isOnline = true; homeComp.ramUsed = 0; homeComp.programs.push(Programs.NukeProgram); - if (augmentationExists(AugmentationNames.Neurolink) && + if (augmentationExists(AugmentationNames.Neurolink) && Augmentations[AugmentationNames.Neurolink].owned) { homeComp.programs.push(Programs.FTPCrackProgram); homeComp.programs.push(Programs.RelaySMTPProgram); - } - if (augmentationExists(AugmentationNames.CashRoot) && + } + if (augmentationExists(AugmentationNames.CashRoot) && Augmentations[AugmentationNames.CashRoot].owned) { Player.money = 1000000; homeComp.programs.push(Programs.BruteSSHProgram); @@ -149,57 +150,57 @@ function prestigeAugmentation() { Player.currentServer = homeComp.ip; Player.homeComputer = homeComp.ip; AddToAllServers(homeComp); - + //Re-create foreign servers SpecialServerIps = new SpecialServerIpsMap(); //Must be done before initForeignServers() initForeignServers(); - + //Darkweb is purchase-able document.getElementById("location-purchase-tor").setAttribute("class", "a-link-button"); - + //Reset statistics of all scripts on home computer for (var i = 0; i < homeComp.scripts.length; ++i) { var s = homeComp.scripts[i]; } //Delete messages on home computer homeComp.messages.length = 0; - + //Delete Hacknet Nodes Player.hacknetNodes.length = 0; Player.totalHacknetNodeProduction = 0; - + //Gain favor for Companies for (var member in Companies) { if (Companies.hasOwnProperty(member)) { Companies[member].gainFavor(); } } - + //Gain favor for factions for (var member in Factions) { if (Factions.hasOwnProperty(member)) { Factions[member].gainFavor(); } } - + //Stop a Terminal action if there is onerror if (Engine._actionInProgress) { Engine._actionInProgress = false; Terminal.finishAction(true); } - - //Re-initialize things - This will update any changes + + //Re-initialize things - This will update any changes initFactions(); //Factions must be initialized before augmentations initAugmentations(); initCompanies(); - + //Clear terminal $("#terminal tr:not(:last)").remove(); postNetburnerText(); - + //Messages initMessages(); - + //Reset Stock market if (Player.hasWseAccount) { initStockMarket(); @@ -210,13 +211,13 @@ function prestigeAugmentation() { stockMarketList.removeChild(stockMarketList.firstChild); } } - + Player.playtimeSinceLastAug = 0; - + var mainMenu = document.getElementById("mainmenu-container"); mainMenu.style.visibility = "visible"; Engine.loadTerminalContent(); - + //Red Pill if (augmentationExists(AugmentationNames.TheRedPill) && Augmentations[AugmentationNames.TheRedPill].owned) { @@ -227,4 +228,4 @@ function prestigeAugmentation() { DaedalusServer.serversOnNetwork.push(WorldDaemon.ip); } } -} \ No newline at end of file +} diff --git a/src/Script.js b/src/Script.js index eff6916bb..7a8fcacbc 100644 --- a/src/Script.js +++ b/src/Script.js @@ -173,6 +173,8 @@ function calculateRamUsage(codeCopy) { var getServerSecurityCount = numOccurrences(codeCopy, "getServerSecurityLevel("); var getServerBaseSecurityCount = numOccurrences(codeCopy, "getServerBaseSecurityLevel("); var getServerReqdHackingCount = numOccurrences(codeCopy, "getServerRequiredHackingLevel("); + var getServerNumPortsReqdCount = numOccurrences(codeCopy, "getServerNumPortsRequired("); + var getServerRamCount = numOccurrences(codeCopy, "getServerRam("); var fileExistsCount = numOccurrences(codeCopy, "fileExists("); var isRunningCount = numOccurrences(codeCopy, "isRunning("); var numOperators = numNetscriptOperators(codeCopy); @@ -185,7 +187,8 @@ function calculateRamUsage(codeCopy) { numOccurrences(codeCopy, "getStockPosition("); var scriptBuySellStockCount = numOccurrences(codeCopy, "buyStock(") + numOccurrences(codeCopy, "sellStock("); - var scriptPurchaseServerCount = numOccurrences(codeCopy, "purchaseServer("); + var scriptPurchaseServerCount = numOccurrences(codeCopy, "purchaseServer(") + + numOccurrences(codeCopy, "deleteServer("); var scriptRoundCount = numOccurrences(codeCopy, "round("); var scriptWriteCount = numOccurrences(codeCopy, "write("); var scriptReadCount = numOccurrences(codeCopy, "read("); @@ -210,11 +213,13 @@ function calculateRamUsage(codeCopy) { (hasRootAccessCount * CONSTANTS.ScriptHasRootAccessRamCost) + (getHostnameCount * CONSTANTS.ScriptGetHostnameRamCost) + (getHackingLevelCount * CONSTANTS.ScriptGetHackingLevelRamCost) + - (getServerMoneyAvailableCount * CONSTANTS.ScriptGetServerMoneyRamCost) + - (getServerMaxMoneyCount * CONSTANTS.ScriptGetServerMoneyRamCost) + - (getServerSecurityCount * CONSTANTS.ScriptGetServerSecurityRamCost) + - (getServerBaseSecurityCount * CONSTANTS.ScriptGetServerSecurityRamCost) + - (getServerReqdHackingCount * CONSTANTS.ScriptGetServerReqdHackRamCost) + + (getServerMoneyAvailableCount * CONSTANTS.ScriptGetServerCost) + + (getServerMaxMoneyCount * CONSTANTS.ScriptGetServerCost) + + (getServerSecurityCount * CONSTANTS.ScriptGetServerCost) + + (getServerBaseSecurityCount * CONSTANTS.ScriptGetServerCost) + + (getServerReqdHackingCount * CONSTANTS.ScriptGetServerCost) + + (getServerNumPortsReqdCount * CONSTANTS.ScriptGetServerCost) + + (getServerRamCount * CONSTANTS.ScriptGetServerCost) + (fileExistsCount * CONSTANTS.ScriptFileExistsRamCost) + (isRunningCount * CONSTANTS.ScriptIsRunningRamCost) + (numOperators * CONSTANTS.ScriptOperatorRamCost) + diff --git a/src/Server.js b/src/Server.js index bca3f76ad..79e77f0d4 100644 --- a/src/Server.js +++ b/src/Server.js @@ -7,45 +7,45 @@ function Server() { this.ip = "0.0.0.0"; this.hostname = ""; this.organizationName = ""; - this.isOnline = true; + this.isOnline = true; this.isConnectedTo = false; //Whether the player is connected to this server - + //Access information this.hasAdminRights = false; //Whether player has admin rights this.purchasedByPlayer = false; this.manuallyHacked = false; //Flag that tracks whether or not the server has been hacked at least once - + //RAM, CPU speed and Scripts - this.maxRam = 1; //GB + this.maxRam = 1; //GB this.ramUsed = 0; this.cpuSpeed = 1; //MHz - + this.scripts = []; this.runningScripts = []; //Stores RunningScript objects this.programs = []; this.messages = []; - + /* Hacking information (only valid for "foreign" aka non-purchased servers) */ - + //Skill required to attempt a hack. Whether a hack is successful will be determined - //by a separate formula - this.requiredHackingSkill = 1; - + //by a separate formula + this.requiredHackingSkill = 1; + //Total money available on this server this.moneyAvailable = 0; this.moneyMax = 0; - - //Parameters used in formulas that dictate how moneyAvailable and requiredHackingSkill change. + + //Parameters used in formulas that dictate how moneyAvailable and requiredHackingSkill change. this.hackDifficulty = 1; //Affects hack success rate and how the requiredHackingSkill increases over time (1-100) this.baseDifficulty = 1; //Starting difficulty this.minDifficulty = 1; this.serverGrowth = 0; //Affects how the moneyAvailable increases (0-100) this.timesHacked = 0; - + //The IP's of all servers reachable from this one (what shows up if you run scan/netstat) // NOTE: Only contains IP and not the Server objects themselves this.serversOnNetwork = []; - + //Port information, required for porthacking servers to get admin rights this.numOpenPortsRequired = 5; this.sshPortOpen = false; //Port 22 @@ -59,7 +59,7 @@ function Server() { //Initialize the properties of a server Server.prototype.init = function(ip, hostname, organizationName, onlineStatus, isConnectedTo, adminRights, purchasedByPlayer, maxRam) { this.ip = ip; - + //Check if hostname is unique var i = 0; while (GetServerByHostname(hostname) != null) { @@ -79,7 +79,11 @@ Server.prototype.init = function(ip, hostname, organizationName, onlineStatus, i //Set the hacking properties of a server Server.prototype.setHackingParameters = function(requiredHackingSkill, moneyAvailable, hackDifficulty, serverGrowth) { this.requiredHackingSkill = requiredHackingSkill; - this.moneyAvailable = moneyAvailable; + if (isNaN(moneyAvailable)) { + this.moneyAvailable = 1000000; + } else { + this.moneyAvailable = moneyAvailable; + } this.moneyMax = 50 * moneyAvailable; this.hackDifficulty = hackDifficulty; this.baseDifficulty = hackDifficulty; @@ -88,7 +92,7 @@ Server.prototype.setHackingParameters = function(requiredHackingSkill, moneyAvai } //Set the port properties of a server -//Right now its only the number of open ports needed to PortHack the server. +//Right now its only the number of open ports needed to PortHack the server. Server.prototype.setPortProperties = function(numOpenPortsReq) { this.numOpenPortsRequired = numOpenPortsReq; } @@ -111,17 +115,17 @@ Server.prototype.getScript = function(scriptName) { return this.scripts[i]; } } - return null; + return null; } //Strengthens a server's security level (difficulty) by the specified amount Server.prototype.fortify = function(amt) { - this.hackDifficulty += amt; + this.hackDifficulty += amt; if (this.hackDifficulty > 99) {this.hackDifficulty = 99;} } Server.prototype.weaken = function(amt) { - this.hackDifficulty -= amt; + this.hackDifficulty -= amt; if (this.hackDifficulty < this.minDifficulty) {this.hackDifficulty = this.minDifficulty;} if (this.hackDifficulty < 1) {this.hackDifficulty = 1;} } @@ -141,384 +145,384 @@ initForeignServers = function() { //MegaCorporations var ECorpServer = new Server(); ECorpServer.init(createRandomIp(), "ecorp", "ECorp", true, false, false, false, 0); - ECorpServer.setHackingParameters(getRandomInt(1150, 1300), 90000000000, 99, 99); + ECorpServer.setHackingParameters(getRandomInt(1150, 1300), getRandomInt(30000000000, 70000000000), 99, 99); ECorpServer.setPortProperties(5); AddToAllServers(ECorpServer); - + var MegaCorpServer = new Server(); MegaCorpServer.init(createRandomIp(), "megacorp", "MegaCorp", true, false, false, false, 0); - MegaCorpServer.setHackingParameters(getRandomInt(1150, 1300), 75000000000, 99, 99); + MegaCorpServer.setHackingParameters(getRandomInt(1150, 1300), getRandomInt(40000000000, 60000000000), 99, 99); MegaCorpServer.setPortProperties(5); AddToAllServers(MegaCorpServer); - + var BachmanAndAssociatesServer = new Server(); BachmanAndAssociatesServer.init(createRandomIp(), "b-and-a", "Bachman & Associates", true, false, false, false, 0); - BachmanAndAssociatesServer.setHackingParameters(getRandomInt(1000, 1050), 30000000000, getRandomInt(75, 85), getRandomInt(65, 75)); + BachmanAndAssociatesServer.setHackingParameters(getRandomInt(1000, 1050), getRandomInt(20000000000, 25000000000), getRandomInt(75, 85), getRandomInt(65, 75)); BachmanAndAssociatesServer.setPortProperties(5); AddToAllServers(BachmanAndAssociatesServer); - + var BladeIndustriesServer = new Server(); BladeIndustriesServer.init(createRandomIp(), "blade", "Blade Industries", true, false, false, false, 0); - BladeIndustriesServer.setHackingParameters(getRandomInt(1000, 1100), 18000000000, getRandomInt(90, 95), getRandomInt(60, 75)); + BladeIndustriesServer.setHackingParameters(getRandomInt(1000, 1100), getRandomInt(12000000000, 20000000000), getRandomInt(90, 95), getRandomInt(60, 75)); BladeIndustriesServer.setPortProperties(5); AddToAllServers(BladeIndustriesServer); - + var NWOServer = new Server(); NWOServer.init(createRandomIp(), "nwo", "New World Order", true, false, false, false, 0); - NWOServer.setHackingParameters(getRandomInt(1000, 1200), 36000000000, 99, getRandomInt(75, 85)); + NWOServer.setHackingParameters(getRandomInt(1000, 1200), getRandomInt(25000000000, 35000000000), 99, getRandomInt(75, 85)); NWOServer.setPortProperties(5); AddToAllServers(NWOServer); - + var ClarkeIncorporatedServer = new Server(); ClarkeIncorporatedServer.init(createRandomIp(), "clarkeinc", "Clarke Incorporated", true, false, false, false, 0); - ClarkeIncorporatedServer.setHackingParameters(getRandomInt(1000, 1200), 13000000000, getRandomInt(50, 60), getRandomInt(50, 70)); + ClarkeIncorporatedServer.setHackingParameters(getRandomInt(1000, 1200), getRandomInt(15000000000, 25000000000), getRandomInt(50, 60), getRandomInt(50, 70)); ClarkeIncorporatedServer.setPortProperties(5); AddToAllServers(ClarkeIncorporatedServer); - + var OmniTekIncorporatedServer = new Server(); OmniTekIncorporatedServer.init(createRandomIp(), "omnitek", "OmniTek Incorporated", true, false, false, false, 0); - OmniTekIncorporatedServer.setHackingParameters(getRandomInt(900, 1100), 45000000000, getRandomInt(90, 99), getRandomInt(95, 99)); + OmniTekIncorporatedServer.setHackingParameters(getRandomInt(900, 1100), getRandomInt(15000000000, 20000000000), getRandomInt(90, 99), getRandomInt(95, 99)); OmniTekIncorporatedServer.setPortProperties(5); AddToAllServers(OmniTekIncorporatedServer); - + var FourSigmaServer = new Server(); FourSigmaServer.init(createRandomIp(), "4sigma", "FourSigma", true, false, false, false, 0); - FourSigmaServer.setHackingParameters(getRandomInt(950, 1200), 24000000000, getRandomInt(60, 70), getRandomInt(75, 99)); + FourSigmaServer.setHackingParameters(getRandomInt(950, 1200), getRandomInt(15000000000, 25000000000), getRandomInt(60, 70), getRandomInt(75, 99)); FourSigmaServer.setPortProperties(5); AddToAllServers(FourSigmaServer); - + var KuaiGongInternationalServer = new Server(); KuaiGongInternationalServer.init(createRandomIp(), "kuai-gong", "KuaiGong International", true, false, false, false, 0); - KuaiGongInternationalServer.setHackingParameters(getRandomInt(1000, 1250), 70000000000, getRandomInt(95, 99), getRandomInt(90, 99)); + KuaiGongInternationalServer.setHackingParameters(getRandomInt(1000, 1250), getRandomInt(20000000000, 30000000000), getRandomInt(95, 99), getRandomInt(90, 99)); KuaiGongInternationalServer.setPortProperties(5); AddToAllServers(KuaiGongInternationalServer); - + //Technology and communications companies (large targets) var FulcrumTechnologiesServer = new Server(); FulcrumTechnologiesServer.init(createRandomIp(), "fulcrumtech", "Fulcrum Technologies", true, false, false, false, 64); - FulcrumTechnologiesServer.setHackingParameters(getRandomInt(1000, 1200), 1500000000, getRandomInt(85, 95), getRandomInt(80, 99)); + FulcrumTechnologiesServer.setHackingParameters(getRandomInt(1000, 1200), getRandomInt(1400000000, 1800000000), getRandomInt(85, 95), getRandomInt(80, 99)); FulcrumTechnologiesServer.setPortProperties(5); AddToAllServers(FulcrumTechnologiesServer); - + var FulcrumSecretTechnologiesServer = new Server(); FulcrumSecretTechnologiesServer.init(createRandomIp(), "fulcrumassets", "Fulcrum Technologies Assets", true, false, false, false, 0); FulcrumSecretTechnologiesServer.setHackingParameters(getRandomInt(1200, 1500), 1000000, 99, 1); FulcrumSecretTechnologiesServer.setPortProperties(5); AddToAllServers(FulcrumSecretTechnologiesServer); SpecialServerIps.addIp(SpecialServerNames.FulcrumSecretTechnologies, FulcrumSecretTechnologiesServer.ip); - + var StormTechnologiesServer = new Server(); StormTechnologiesServer.init(createRandomIp(), "stormtech", "Storm Technologies", true, false, false, false, 0); - StormTechnologiesServer.setHackingParameters(getRandomInt(900, 1050), 1300000000, getRandomInt(80, 90), getRandomInt(70, 90)); + StormTechnologiesServer.setHackingParameters(getRandomInt(900, 1050), getRandomInt(1000000000, 1200000000), getRandomInt(80, 90), getRandomInt(70, 90)); StormTechnologiesServer.setPortProperties(5); AddToAllServers(StormTechnologiesServer); - + var DefCommServer = new Server(); DefCommServer.init(createRandomIp(), "defcomm", "DefComm", true, false, false, false, 0); - DefCommServer.setHackingParameters(getRandomInt(900, 1000), 850000000, getRandomInt(85, 95), getRandomInt(50, 70)); + DefCommServer.setHackingParameters(getRandomInt(900, 1000), getRandomInt(800000000, 950000000), getRandomInt(85, 95), getRandomInt(50, 70)); DefCommServer.setPortProperties(5); AddToAllServers(DefCommServer); - + var InfoCommServer = new Server(); InfoCommServer.init(createRandomIp(), "infocomm", "InfoComm", true, false, false, false, 0); - InfoCommServer.setHackingParameters(getRandomInt(875, 950), 700000000, getRandomInt(70, 90), getRandomInt(35, 75)); + InfoCommServer.setHackingParameters(getRandomInt(875, 950), getRandomInt(600000000, 900000000), getRandomInt(70, 90), getRandomInt(35, 75)); InfoCommServer.setPortProperties(5); AddToAllServers(InfoCommServer); - + var HeliosLabsServer = new Server(); HeliosLabsServer.init(createRandomIp(), "helios", "Helios Labs", true, false, false, false, 0); - HeliosLabsServer.setHackingParameters(getRandomInt(800, 900), 450000000, getRandomInt(85, 95), getRandomInt(70, 80)); + HeliosLabsServer.setHackingParameters(getRandomInt(800, 900), getRandomInt(550000000, 750000000), getRandomInt(85, 95), getRandomInt(70, 80)); HeliosLabsServer.setPortProperties(5); AddToAllServers(HeliosLabsServer); - + var VitaLifeServer = new Server(); VitaLifeServer.init(createRandomIp(), "vitalife", "VitaLife", true, false, false, false, 32); - VitaLifeServer.setHackingParameters(getRandomInt(775, 900), 720000000, getRandomInt(80, 90), getRandomInt(60, 80)); + VitaLifeServer.setHackingParameters(getRandomInt(775, 900), getRandomInt(700000000, 800000000), getRandomInt(80, 90), getRandomInt(60, 80)); VitaLifeServer.setPortProperties(5); AddToAllServers(VitaLifeServer); - + var IcarusMicrosystemsServer = new Server(); IcarusMicrosystemsServer.init(createRandomIp(), "icarus", "Icarus Microsystems", true, false, false, false, 0); - IcarusMicrosystemsServer.setHackingParameters(getRandomInt(850, 925), 1000000000, getRandomInt(85, 95), getRandomInt(85, 95)); + IcarusMicrosystemsServer.setHackingParameters(getRandomInt(850, 925), getRandomInt(900000000, 1000000000), getRandomInt(85, 95), getRandomInt(85, 95)); IcarusMicrosystemsServer.setPortProperties(5); AddToAllServers(IcarusMicrosystemsServer); - + var UniversalEnergyServer = new Server(); UniversalEnergyServer.init(createRandomIp(), "univ-energy", "Universal Energy", true, false, false, false, 32); - UniversalEnergyServer.setHackingParameters(getRandomInt(800, 900), 1300000000, getRandomInt(80, 90), getRandomInt(80, 90)); + UniversalEnergyServer.setHackingParameters(getRandomInt(800, 900), getRandomInt(1100000000, 1200000000), getRandomInt(80, 90), getRandomInt(80, 90)); UniversalEnergyServer.setPortProperties(4); AddToAllServers(UniversalEnergyServer); - + var TitanLabsServer = new Server(); TitanLabsServer.init(createRandomIp(), "titan-labs", "Titan Laboratories", true, false, false, false, 32); - TitanLabsServer.setHackingParameters(getRandomInt(800, 875), 900000000, getRandomInt(70, 80), getRandomInt(60, 80)); + TitanLabsServer.setHackingParameters(getRandomInt(800, 875), getRandomInt(750000000, 900000000), getRandomInt(70, 80), getRandomInt(60, 80)); TitanLabsServer.setPortProperties(5); AddToAllServers(TitanLabsServer); - + var MicrodyneTechnologiesServer = new Server(); MicrodyneTechnologiesServer.init(createRandomIp(), "microdyne", "Microdyne Technologies", true, false, false, false, 16); - MicrodyneTechnologiesServer.setHackingParameters(getRandomInt(800, 875), 750000000, getRandomInt(65, 75), getRandomInt(70, 90)); + MicrodyneTechnologiesServer.setHackingParameters(getRandomInt(800, 875), getRandomInt(500000000, 700000000), getRandomInt(65, 75), getRandomInt(70, 90)); MicrodyneTechnologiesServer.setPortProperties(5); AddToAllServers(MicrodyneTechnologiesServer); - + var TaiYangDigitalServer = new Server(); TaiYangDigitalServer.init(createRandomIp(), "taiyang-digital", "Taiyang Digital", true, false, false, false, 0); - TaiYangDigitalServer.setHackingParameters(getRandomInt(850, 950), 1000000000, getRandomInt(70, 80), getRandomInt(70, 80)); + TaiYangDigitalServer.setHackingParameters(getRandomInt(850, 950), getRandomInt(800000000, 900000000), getRandomInt(70, 80), getRandomInt(70, 80)); TaiYangDigitalServer.setPortProperties(5); AddToAllServers(TaiYangDigitalServer); - + var GalacticCyberSystemsServer = new Server(); GalacticCyberSystemsServer.init(createRandomIp(), "galactic-cyber", "Galactic Cybersystems", true, false, false, false, 0); - GalacticCyberSystemsServer.setHackingParameters(getRandomInt(825, 875), 450000000, getRandomInt(55, 65), getRandomInt(70, 90)); + GalacticCyberSystemsServer.setHackingParameters(getRandomInt(825, 875), getRandomInt(750000000, 850000000), getRandomInt(55, 65), getRandomInt(70, 90)); GalacticCyberSystemsServer.setPortProperties(5); AddToAllServers(GalacticCyberSystemsServer); - + //Defense Companies ("Large" Companies) var AeroCorpServer = new Server(); AeroCorpServer.init(createRandomIp(), "aerocorp", "AeroCorp", true, false, false, false, 0); - AeroCorpServer.setHackingParameters(getRandomInt(850, 925), 1300000000, getRandomInt(80, 90), getRandomInt(55, 65)); + AeroCorpServer.setHackingParameters(getRandomInt(850, 925), getRandomInt(1000000000, 1200000000), getRandomInt(80, 90), getRandomInt(55, 65)); AeroCorpServer.setPortProperties(5); AddToAllServers(AeroCorpServer); - + var OmniaCybersystemsServer = new Server(); OmniaCybersystemsServer.init(createRandomIp(), "omnia", "Omnia Cybersystems", true, false, false, false, 0); - OmniaCybersystemsServer.setHackingParameters(getRandomInt(850, 950), 1100000000, getRandomInt(85, 95), getRandomInt(60, 70)); + OmniaCybersystemsServer.setHackingParameters(getRandomInt(850, 950), getRandomInt(900000000, 1000000000), getRandomInt(85, 95), getRandomInt(60, 70)); OmniaCybersystemsServer.setPortProperties(5); AddToAllServers(OmniaCybersystemsServer); - + var ZBDefenseServer = new Server(); ZBDefenseServer.init(createRandomIp(), "zb-def", "ZB Defense Industries", true, false, false, false, 0); - ZBDefenseServer.setHackingParameters(getRandomInt(775, 825), 900000000, getRandomInt(55, 65), getRandomInt(65, 75)); + ZBDefenseServer.setHackingParameters(getRandomInt(775, 825), getRandomInt(900000000, 1100000000), getRandomInt(55, 65), getRandomInt(65, 75)); ZBDefenseServer.setPortProperties(4); AddToAllServers(ZBDefenseServer); - + var AppliedEnergeticsServer = new Server(); AppliedEnergeticsServer.init(createRandomIp(), "applied-energetics", "Applied Energetics", true, false, false, false, 0); - AppliedEnergeticsServer.setHackingParameters(getRandomInt(775, 850), 1100000000, getRandomInt(60, 80), getRandomInt(70, 75)); + AppliedEnergeticsServer.setHackingParameters(getRandomInt(775, 850), getRandomInt(700000000, 1000000000), getRandomInt(60, 80), getRandomInt(70, 75)); AppliedEnergeticsServer.setPortProperties(4); AddToAllServers(AppliedEnergeticsServer); - + var SolarisSpaceSystemsServer = new Server(); SolarisSpaceSystemsServer.init(createRandomIp(), "solaris", "Solaris Space Systems", true, false, false, false, 0); - SolarisSpaceSystemsServer.setHackingParameters(getRandomInt(750, 850), 800000000, getRandomInt(70, 80), getRandomInt(70, 80)); + SolarisSpaceSystemsServer.setHackingParameters(getRandomInt(750, 850), getRandomInt(700000000, 900000000), getRandomInt(70, 80), getRandomInt(70, 80)); SolarisSpaceSystemsServer.setPortProperties(5); AddToAllServers(SolarisSpaceSystemsServer); - + var DeltaOneServer = new Server(); DeltaOneServer.init(createRandomIp(), "deltaone", "Delta One", true, false, false, false, 0); - DeltaOneServer.setHackingParameters(getRandomInt(800, 900), 1400000000, getRandomInt(75, 85), getRandomInt(50, 70)); + DeltaOneServer.setHackingParameters(getRandomInt(800, 900), getRandomInt(1300000000, 1700000000), getRandomInt(75, 85), getRandomInt(50, 70)); DeltaOneServer.setPortProperties(5); AddToAllServers(DeltaOneServer); - + //Health, medicine, pharmaceutical companies ("Large" targets) var GlobalPharmaceuticalsServer = new Server(); GlobalPharmaceuticalsServer.init(createRandomIp(), "global-pharm", "Global Pharmaceuticals", true, false, false, false, 16); - GlobalPharmaceuticalsServer.setHackingParameters(getRandomInt(750, 850), 1800000000, getRandomInt(75, 85), getRandomInt(80, 90)); + GlobalPharmaceuticalsServer.setHackingParameters(getRandomInt(750, 850), getRandomInt(1500000000, 1750000000), getRandomInt(75, 85), getRandomInt(80, 90)); GlobalPharmaceuticalsServer.setPortProperties(4); AddToAllServers(GlobalPharmaceuticalsServer); - + var NovaMedicalServer = new Server(); NovaMedicalServer.init(createRandomIp(), "nova-med", "Nova Medical", true, false, false, false, 0); - NovaMedicalServer.setHackingParameters(getRandomInt(775, 850), 1350000000, getRandomInt(60, 80), getRandomInt(65, 85)); + NovaMedicalServer.setHackingParameters(getRandomInt(775, 850), getRandomInt(1100000000, 1250000000), getRandomInt(60, 80), getRandomInt(65, 85)); NovaMedicalServer.setPortProperties(4); AddToAllServers(NovaMedicalServer); - + var ZeusMedicalServer = new Server(); ZeusMedicalServer.init(createRandomIp(), "zeus-med", "Zeus Medical", true, false, false, false, 0); - ZeusMedicalServer.setHackingParameters(getRandomInt(800, 850), 1600000000, getRandomInt(70, 90), getRandomInt(70, 80)); + ZeusMedicalServer.setHackingParameters(getRandomInt(800, 850), getRandomInt(1300000000, 1500000000), getRandomInt(70, 90), getRandomInt(70, 80)); ZeusMedicalServer.setPortProperties(5); AddToAllServers(ZeusMedicalServer); - + var UnitaLifeGroupServer = new Server(); UnitaLifeGroupServer.init(createRandomIp(), "unitalife", "UnitaLife Group", true, false, false, false, 32); - UnitaLifeGroupServer.setHackingParameters(getRandomInt(775, 825), 1200000000, getRandomInt(70, 80), getRandomInt(70, 80)); + UnitaLifeGroupServer.setHackingParameters(getRandomInt(775, 825), getRandomInt(1000000000, 1100000000), getRandomInt(70, 80), getRandomInt(70, 80)); UnitaLifeGroupServer.setPortProperties(4); AddToAllServers(UnitaLifeGroupServer); - + //"Medium level" targets var LexoCorpServer = new Server(); LexoCorpServer.init(createRandomIp(), "lexo-corp", "Lexo Corporation", true, false, false, false, 16); - LexoCorpServer.setHackingParameters(getRandomInt(650, 750), 800000000, getRandomInt(60, 80), getRandomInt(55, 65)); + LexoCorpServer.setHackingParameters(getRandomInt(650, 750), getRandomInt(700000000, 800000000), getRandomInt(60, 80), getRandomInt(55, 65)); LexoCorpServer.setPortProperties(4); AddToAllServers(LexoCorpServer); - + var RhoConstructionServer = new Server(); RhoConstructionServer.init(createRandomIp(), "rho-construction", "Rho Construction", true, false, false, false, 0); - RhoConstructionServer.setHackingParameters(getRandomInt(475, 525), 700000000, getRandomInt(40, 60), getRandomInt(40, 60)); + RhoConstructionServer.setHackingParameters(getRandomInt(475, 525), getRandomInt(500000000, 700000000), getRandomInt(40, 60), getRandomInt(40, 60)); RhoConstructionServer.setPortProperties(3); AddToAllServers(RhoConstructionServer); - + var AlphaEnterprisesServer = new Server(); AlphaEnterprisesServer.init(createRandomIp(), "alpha-ent", "Alpha Enterprises", true, false, false, false, 0); - AlphaEnterprisesServer.setHackingParameters(getRandomInt(500, 600), 750000000, getRandomInt(50, 70), getRandomInt(50, 60)); + AlphaEnterprisesServer.setHackingParameters(getRandomInt(500, 600), getRandomInt(600000000, 750000000), getRandomInt(50, 70), getRandomInt(50, 60)); AlphaEnterprisesServer.setPortProperties(4); AddToAllServers(AlphaEnterprisesServer); - - + + var AevumPoliceServer = new Server(); AevumPoliceServer.init(createRandomIp(), "aevum-police", "Aevum Police Network", true, false, false, false, 0); - AevumPoliceServer.setHackingParameters(getRandomInt(400, 450), 100000000, getRandomInt(70, 80), getRandomInt(30, 50)); + AevumPoliceServer.setHackingParameters(getRandomInt(400, 450), getRandomInt(200000000, 400000000), getRandomInt(70, 80), getRandomInt(30, 50)); AevumPoliceServer.setPortProperties(4); AddToAllServers(AevumPoliceServer); - + var RothmanUniversityServer = new Server(); RothmanUniversityServer.init(createRandomIp(), "rothman-uni", "Rothman University Network", true, false, false, false, 4); - RothmanUniversityServer.setHackingParameters(getRandomInt(370, 430), 200000000, getRandomInt(45, 55), getRandomInt(35, 45)); + RothmanUniversityServer.setHackingParameters(getRandomInt(370, 430), getRandomInt(175000000, 250000000), getRandomInt(45, 55), getRandomInt(35, 45)); RothmanUniversityServer.setPortProperties(3); AddToAllServers(RothmanUniversityServer); - + var ZBInstituteOfTechnologyServer = new Server(); ZBInstituteOfTechnologyServer.init(createRandomIp(), "zb-institute", "ZB Institute of Technology Network", true, false, false, false, 4); - ZBInstituteOfTechnologyServer.setHackingParameters(getRandomInt(725, 775), 1000000000, getRandomInt(65, 85), getRandomInt(75, 85)); + ZBInstituteOfTechnologyServer.setHackingParameters(getRandomInt(725, 775), getRandomInt(800000000, 1100000000), getRandomInt(65, 85), getRandomInt(75, 85)); ZBInstituteOfTechnologyServer.setPortProperties(5); AddToAllServers(ZBInstituteOfTechnologyServer); - + var SummitUniversityServer = new Server(); SummitUniversityServer.init(createRandomIp(), "summit-uni", "Summit University Network", true, false, false, false, 4); - SummitUniversityServer.setHackingParameters(getRandomInt(425, 475), 160000000, getRandomInt(45, 65), getRandomInt(40, 60)); + SummitUniversityServer.setHackingParameters(getRandomInt(425, 475), getRandomInt(200000000, 350000000), getRandomInt(45, 65), getRandomInt(40, 60)); SummitUniversityServer.setPortProperties(3); AddToAllServers(SummitUniversityServer); - + var SysCoreSecuritiesServer = new Server(); SysCoreSecuritiesServer.init(createRandomIp(), "syscore", "SysCore Securities", true, false, false, false, 0); - SysCoreSecuritiesServer.setHackingParameters(getRandomInt(550, 650), 500000000, getRandomInt(60, 80), getRandomInt(60, 70)); + SysCoreSecuritiesServer.setHackingParameters(getRandomInt(550, 650), getRandomInt(400000000, 600000000), getRandomInt(60, 80), getRandomInt(60, 70)); SysCoreSecuritiesServer.setPortProperties(4); AddToAllServers(SysCoreSecuritiesServer); - + var CatalystVenturesServer = new Server(); CatalystVenturesServer.init(createRandomIp(), "catalyst", "Catalyst Ventures", true, false, false, false, 0); - CatalystVenturesServer.setHackingParameters(getRandomInt(400, 450), 750000000, getRandomInt(60, 70), getRandomInt(25, 55)); + CatalystVenturesServer.setHackingParameters(getRandomInt(400, 450), getRandomInt(300000000, 550000000), getRandomInt(60, 70), getRandomInt(25, 55)); CatalystVenturesServer.setPortProperties(3); AddToAllServers(CatalystVenturesServer); - + var TheHubServer = new Server(); TheHubServer.init(createRandomIp(), "the-hub", "The Hub", true, false, false, false, 0); - TheHubServer.setHackingParameters(getRandomInt(275, 325), 225000000, getRandomInt(35, 45), getRandomInt(45, 55)); + TheHubServer.setHackingParameters(getRandomInt(275, 325), getRandomInt(150000000, 200000000), getRandomInt(35, 45), getRandomInt(45, 55)); TheHubServer.setPortProperties(2); AddToAllServers(TheHubServer); - + var CompuTekServer = new Server(); CompuTekServer.init(createRandomIp(), "comptek", "CompuTek", true, false, false, false, 8); - CompuTekServer.setHackingParameters(getRandomInt(300, 400), 275000000, getRandomInt(55, 65), getRandomInt(45, 65)); + CompuTekServer.setHackingParameters(getRandomInt(300, 400), getRandomInt(220000000, 250000000), getRandomInt(55, 65), getRandomInt(45, 65)); CompuTekServer.setPortProperties(3); AddToAllServers(CompuTekServer); var NetLinkTechnologiesServer = new Server(); NetLinkTechnologiesServer.init(createRandomIp(), "netlink", "NetLink Technologies", true, false, false, false, 0); - NetLinkTechnologiesServer.setHackingParameters(getRandomInt(375, 425), 320000000, getRandomInt(60, 80), getRandomInt(45, 75)); + NetLinkTechnologiesServer.setHackingParameters(getRandomInt(375, 425), 275000000, getRandomInt(60, 80), getRandomInt(45, 75)); NetLinkTechnologiesServer.setPortProperties(3); AddToAllServers(NetLinkTechnologiesServer); - + var JohnsonOrthopedicsServer = new Server(); JohnsonOrthopedicsServer.init(createRandomIp(), "johnson-ortho", "Johnson Orthopedics", true, false, false, false, 4); - JohnsonOrthopedicsServer.setHackingParameters(getRandomInt(250, 300), 80000000, getRandomInt(35, 65), getRandomInt(35, 65)); + JohnsonOrthopedicsServer.setHackingParameters(getRandomInt(250, 300), getRandomInt(70000000, 85000000), getRandomInt(35, 65), getRandomInt(35, 65)); JohnsonOrthopedicsServer.setPortProperties(2); AddToAllServers(JohnsonOrthopedicsServer); - + //"Low level" targets var FoodNStuffServer = new Server(); FoodNStuffServer.init(createRandomIp(), "foodnstuff", "Food N Stuff Supermarket", true, false, false, false, 4); FoodNStuffServer.setHackingParameters(1, 1000000, 10, 5); FoodNStuffServer.setPortProperties(0); AddToAllServers(FoodNStuffServer); - + var SigmaCosmeticsServer = new Server(); SigmaCosmeticsServer.init(createRandomIp(), "sigma-cosmetics", "Sigma Cosmetics", true, false, false, false, 4); SigmaCosmeticsServer.setHackingParameters(5, 1300000, 10, 10); SigmaCosmeticsServer.setPortProperties(0); AddToAllServers(SigmaCosmeticsServer); - + var JoesGunsServer = new Server(); JoesGunsServer.init(createRandomIp(), "joesguns", "Joe's Guns", true, false, false, false, 4); JoesGunsServer.setHackingParameters(10, 1750000, 20, 20); JoesGunsServer.setPortProperties(0); AddToAllServers(JoesGunsServer); - + var Zer0NightclubServer = new Server(); Zer0NightclubServer.init(createRandomIp(), "zer0", "ZER0 Nightclub", true, false, false, false, 4); Zer0NightclubServer.setHackingParameters(75, 7500000, 25, 40); Zer0NightclubServer.setPortProperties(1); AddToAllServers(Zer0NightclubServer); - + var NectarNightclubServer = new Server(); NectarNightclubServer.init(createRandomIp(), "nectar-net", "Nectar Nightclub Network", true, false, false, false, 4); NectarNightclubServer.setHackingParameters(20, 2000000, 20, 25); NectarNightclubServer.setPortProperties(0); AddToAllServers(NectarNightclubServer); - + var NeoNightclubServer = new Server(); NeoNightclubServer.init(createRandomIp(), "neo-net", "Neo Nightclub Network", true, false, false, false, 4); NeoNightclubServer.setHackingParameters(50, 4500000, 25, 25); NeoNightclubServer.setPortProperties(1); AddToAllServers(NeoNightclubServer); - + var SilverHelixServer = new Server(); SilverHelixServer.init(createRandomIp(), "silver-helix", "Silver Helix", true, false, false, false, 2); - SilverHelixServer.setHackingParameters(150, 50000000, 30, 30); + SilverHelixServer.setHackingParameters(150, 45000000, 30, 30); SilverHelixServer.setPortProperties(2); AddToAllServers(SilverHelixServer); - + var HongFangTeaHouseServer = new Server(); HongFangTeaHouseServer.init(createRandomIp(), "hong-fang-tea", "HongFang Teahouse", true, false, false, false, 4); HongFangTeaHouseServer.setHackingParameters(30, 2500000, 15, 15); HongFangTeaHouseServer.setPortProperties(0); AddToAllServers(HongFangTeaHouseServer); - + var HaraKiriSushiBarServer = new Server(); HaraKiriSushiBarServer.init(createRandomIp(), "harakiri-sushi", "HaraKiri Sushi Bar Network", true, false, false, false, 4); HaraKiriSushiBarServer.setHackingParameters(40, 3500000, 15, 40); HaraKiriSushiBarServer.setPortProperties(0); AddToAllServers(HaraKiriSushiBarServer); - + var PhantasyServer = new Server(); PhantasyServer.init(createRandomIp(), "phantasy", "Phantasy Club", true, false, false, false, 0); - PhantasyServer.setHackingParameters(100, 27500000, 20, 35); + PhantasyServer.setHackingParameters(100, 24000000, 20, 35); PhantasyServer.setPortProperties(2); AddToAllServers(PhantasyServer); - + var MaxHardwareServer = new Server(); MaxHardwareServer.init(createRandomIp(), "max-hardware", "Max Hardware Store", true, false, false, false, 4); - MaxHardwareServer.setHackingParameters(80, 11000000, 15, 25); + MaxHardwareServer.setHackingParameters(80, 10000000, 15, 25); MaxHardwareServer.setPortProperties(1); AddToAllServers(MaxHardwareServer); - + var OmegaSoftwareServer = new Server(); OmegaSoftwareServer.init(createRandomIp(), "omega-net", "Omega Software", true, false, false, false, 8); - OmegaSoftwareServer.setHackingParameters(getRandomInt(180, 220), 75000000, getRandomInt(25, 35), getRandomInt(30, 40)); + OmegaSoftwareServer.setHackingParameters(getRandomInt(180, 220), getRandomInt(60000000, 70000000), getRandomInt(25, 35), getRandomInt(30, 40)); OmegaSoftwareServer.setPortProperties(2); AddToAllServers(OmegaSoftwareServer); //Gyms var CrushFitnessGymServer = new Server(); CrushFitnessGymServer.init(createRandomIp(), "crush-fitness", "Crush Fitness", true, false, false, false, 0); - CrushFitnessGymServer.setHackingParameters(getRandomInt(225, 275), 40000000, getRandomInt(35, 45), getRandomInt(27, 33)); + CrushFitnessGymServer.setHackingParameters(getRandomInt(225, 275), getRandomInt(40000000, 60000000), getRandomInt(35, 45), getRandomInt(27, 33)); CrushFitnessGymServer.setPortProperties(2); AddToAllServers(CrushFitnessGymServer); - + var IronGymServer = new Server(); IronGymServer.init(createRandomIp(), "iron-gym", "Iron Gym Network", true, false, false, false, 4); IronGymServer.setHackingParameters(100, 20000000, 30, 20); IronGymServer.setPortProperties(1); AddToAllServers(IronGymServer); - + var MilleniumFitnessGymServer = new Server(); MilleniumFitnessGymServer.init(createRandomIp(), "millenium-fitness", "Millenium Fitness Network", true, false, false, false, 0); - MilleniumFitnessGymServer.setHackingParameters(getRandomInt(475, 525), 100000000, getRandomInt(45, 55), getRandomInt(25, 45)); + MilleniumFitnessGymServer.setHackingParameters(getRandomInt(475, 525), 250000000, getRandomInt(45, 55), getRandomInt(25, 45)); MilleniumFitnessGymServer.setPortProperties(3); AddToAllServers(MilleniumFitnessGymServer); - + var PowerhouseGymServer = new Server(); PowerhouseGymServer.init(createRandomIp(), "powerhouse-fitness", "Powerhouse Fitness", true, false, false, false, 0); - PowerhouseGymServer.setHackingParameters(getRandomInt(950, 1100), 300000000, getRandomInt(55, 65), getRandomInt(50, 60)); + PowerhouseGymServer.setHackingParameters(getRandomInt(950, 1100), 900000000, getRandomInt(55, 65), getRandomInt(50, 60)); PowerhouseGymServer.setPortProperties(5); AddToAllServers(PowerhouseGymServer); var SnapFitnessGymServer = new Server(); SnapFitnessGymServer.init(createRandomIp(), "snap-fitness", "Snap Fitness", true, false, false, false, 0); - SnapFitnessGymServer.setHackingParameters(getRandomInt(675, 800), 150000000, getRandomInt(40, 60), getRandomInt(40, 60)); + SnapFitnessGymServer.setHackingParameters(getRandomInt(675, 800), 450000000, getRandomInt(40, 60), getRandomInt(40, 60)); SnapFitnessGymServer.setPortProperties(4); AddToAllServers(SnapFitnessGymServer); - + //Faction servers, cannot hack money from these var BitRunnersServer = new Server(); BitRunnersServer.init(createRandomIp(), "run4theh111z", "The Runners", true, false, false, false, 0); @@ -526,42 +530,42 @@ initForeignServers = function() { BitRunnersServer.setPortProperties(4); AddToAllServers(BitRunnersServer); SpecialServerIps.addIp(SpecialServerNames.BitRunnersServer, BitRunnersServer.ip); - + var TheBlackHandServer = new Server(); TheBlackHandServer.init(createRandomIp(), "I.I.I.I", "I.I.I.I", true, false, false, false, 0); TheBlackHandServer.setHackingParameters(getRandomInt(340, 365), 0, 0, 0); TheBlackHandServer.setPortProperties(3); AddToAllServers(TheBlackHandServer); SpecialServerIps.addIp(SpecialServerNames.TheBlackHandServer, TheBlackHandServer.ip); - + var NiteSecServer = new Server(); NiteSecServer.init(createRandomIp(), "avmnite-02h", "NiteSec", true, false, false, false, 0); NiteSecServer.setHackingParameters(getRandomInt(202, 220), 0, 0, 0); NiteSecServer.setPortProperties(2); AddToAllServers(NiteSecServer); SpecialServerIps.addIp(SpecialServerNames.NiteSecServer, NiteSecServer.ip); - + var DarkArmyServer = new Server(); DarkArmyServer.init(createRandomIp(), ".", ".", true, false, false, false, 0); DarkArmyServer.setHackingParameters(getRandomInt(505, 550), 0, 0, 0); DarkArmyServer.setPortProperties(4); AddToAllServers(DarkArmyServer); SpecialServerIps.addIp(SpecialServerNames.TheDarkArmyServer, DarkArmyServer.ip); - + var CyberSecServer = new Server(); CyberSecServer.init(createRandomIp(), "CSEC", "CyberSec", true, false, false, false, 0); CyberSecServer.setHackingParameters(getRandomInt(51, 60), 0, 0, 0); CyberSecServer.setPortProperties(1); AddToAllServers(CyberSecServer); SpecialServerIps.addIp(SpecialServerNames.CyberSecServer, CyberSecServer.ip); - + var DaedalusServer = new Server(); DaedalusServer.init(createRandomIp(), "The-Cave", "Helios", true, false, false, false, 0); DaedalusServer.setHackingParameters(925, 0, 0, 0); DaedalusServer.setPortProperties(5); AddToAllServers(DaedalusServer); SpecialServerIps.addIp(SpecialServerNames.DaedalusServer, DaedalusServer.ip); - + //Super special Servers var WorldDaemon = new Server(); WorldDaemon.init(createRandomIp(), SpecialServerNames.WorldDaemon, SpecialServerNames.WorldDaemon, true, false, false, false, 0); @@ -569,7 +573,7 @@ initForeignServers = function() { WorldDaemon.setPortProperties(5); AddToAllServers(WorldDaemon); SpecialServerIps.addIp(SpecialServerNames.WorldDaemon, WorldDaemon.ip); - + /* Create a randomized network for all the foreign servers */ //Groupings for creating a randomized network var NetworkGroup1 = [IronGymServer, FoodNStuffServer, SigmaCosmeticsServer, JoesGunsServer, HongFangTeaHouseServer, HaraKiriSushiBarServer]; @@ -587,91 +591,91 @@ initForeignServers = function() { var NetworkGroup13 = [KuaiGongInternationalServer, FourSigmaServer, OmniTekIncorporatedServer, DarkArmyServer]; var NetworkGroup14 = [PowerhouseGymServer, ClarkeIncorporatedServer, NWOServer, BladeIndustriesServer, BachmanAndAssociatesServer]; var NetworkGroup15 = [FulcrumSecretTechnologiesServer, MegaCorpServer, ECorpServer, DaedalusServer]; - + for (var i = 0; i < NetworkGroup2.length; i++) { var randomServerFromPrevGroup = NetworkGroup1[Math.floor(Math.random() * NetworkGroup1.length)]; NetworkGroup2[i].serversOnNetwork.push(randomServerFromPrevGroup.ip); randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup2[i].ip); } - + for (var i = 0; i < NetworkGroup3.length; i++) { var randomServerFromPrevGroup = NetworkGroup2[Math.floor(Math.random() * NetworkGroup2.length)]; NetworkGroup3[i].serversOnNetwork.push(randomServerFromPrevGroup.ip); randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup3[i].ip); } - + for (var i = 0; i < NetworkGroup4.length; i++) { var randomServerFromPrevGroup = NetworkGroup3[Math.floor(Math.random() * NetworkGroup3.length)]; NetworkGroup4[i].serversOnNetwork.push(randomServerFromPrevGroup.ip); randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup4[i].ip); } - + for (var i = 0; i < NetworkGroup5.length; i++) { var randomServerFromPrevGroup = NetworkGroup4[Math.floor(Math.random() * NetworkGroup4.length)]; NetworkGroup5[i].serversOnNetwork.push(randomServerFromPrevGroup.ip); randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup5[i].ip); } - + for (var i = 0; i < NetworkGroup6.length; i++) { var randomServerFromPrevGroup = NetworkGroup5[Math.floor(Math.random() * NetworkGroup5.length)]; NetworkGroup6[i].serversOnNetwork.push(randomServerFromPrevGroup.ip); randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup6[i].ip); } - + for (var i = 0; i < NetworkGroup7.length; i++) { var randomServerFromPrevGroup = NetworkGroup6[Math.floor(Math.random() * NetworkGroup6.length)]; NetworkGroup7[i].serversOnNetwork.push(randomServerFromPrevGroup.ip); randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup7[i].ip); } - + for (var i = 0; i < NetworkGroup8.length; i++) { var randomServerFromPrevGroup = NetworkGroup7[Math.floor(Math.random() * NetworkGroup7.length)]; NetworkGroup8[i].serversOnNetwork.push(randomServerFromPrevGroup.ip); randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup8[i].ip); } - + for (var i = 0; i < NetworkGroup9.length; i++) { var randomServerFromPrevGroup = NetworkGroup8[Math.floor(Math.random() * NetworkGroup8.length)]; NetworkGroup9[i].serversOnNetwork.push(randomServerFromPrevGroup.ip); randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup9[i].ip); } - + for (var i = 0; i < NetworkGroup10.length; i++) { var randomServerFromPrevGroup = NetworkGroup9[Math.floor(Math.random() * NetworkGroup9.length)]; NetworkGroup10[i].serversOnNetwork.push(randomServerFromPrevGroup.ip); randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup10[i].ip); } - + for (var i = 0; i < NetworkGroup11.length; i++) { var randomServerFromPrevGroup = NetworkGroup10[Math.floor(Math.random() * NetworkGroup10.length)]; NetworkGroup11[i].serversOnNetwork.push(randomServerFromPrevGroup.ip); randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup11[i].ip); } - + for (var i = 0; i < NetworkGroup12.length; i++) { var randomServerFromPrevGroup = NetworkGroup11[Math.floor(Math.random() * NetworkGroup11.length)]; NetworkGroup12[i].serversOnNetwork.push(randomServerFromPrevGroup.ip); randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup12[i].ip); } - + for (var i = 0; i < NetworkGroup13.length; i++) { var randomServerFromPrevGroup = NetworkGroup12[Math.floor(Math.random() * NetworkGroup12.length)]; NetworkGroup13[i].serversOnNetwork.push(randomServerFromPrevGroup.ip); randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup13[i].ip); } - + for (var i = 0; i < NetworkGroup14.length; i++) { var randomServerFromPrevGroup = NetworkGroup13[Math.floor(Math.random() * NetworkGroup13.length)]; NetworkGroup14[i].serversOnNetwork.push(randomServerFromPrevGroup.ip); randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup14[i].ip); } - + for (var i = 0; i < NetworkGroup15.length; i++) { var randomServerFromPrevGroup = NetworkGroup14[Math.floor(Math.random() * NetworkGroup14.length)]; NetworkGroup15[i].serversOnNetwork.push(randomServerFromPrevGroup.ip); randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup15[i].ip); } - + //Connect the first tier of servers to the player's home computer for (var i = 0; i < NetworkGroup1.length; i++) { Player.getHomeComputer().serversOnNetwork.push(NetworkGroup1[i].ip); @@ -683,24 +687,24 @@ initForeignServers = function() { processSingleServerGrowth = function(server, numCycles) { //Server growth processed once every 450 game cycles var numServerGrowthCycles = Math.max(Math.floor(numCycles / 450), 0); - + //Get adjusted growth rate, which accounts for server security - var growthRate = CONSTANTS.ServerBaseGrowthRate; - var adjGrowthRate = 1 + (growthRate - 1) / server.hackDifficulty; + var growthRate = CONSTANTS.ServerBaseGrowthRate; + var adjGrowthRate = 1 + (growthRate - 1) / server.hackDifficulty; if (adjGrowthRate > CONSTANTS.ServerMaxGrowthRate) {adjGrowthRate = CONSTANTS.ServerMaxGrowthRate;} //console.log("Adjusted growth rate: " + adjGrowthRate); - + //Calculate adjusted server growth rate based on parameters var serverGrowthPercentage = server.serverGrowth / 100; var numServerGrowthCyclesAdjusted = numServerGrowthCycles * serverGrowthPercentage; - + //Apply serverGrowth for the calculated number of growth cycles var serverGrowth = Math.pow(adjGrowthRate, numServerGrowthCyclesAdjusted * Player.hacking_grow_mult); if (serverGrowth < 1) { console.log("WARN: serverGrowth calculated to be less than 1"); serverGrowth = 1; } - + server.moneyAvailable *= serverGrowth; if (server.moneyMax && isNaN(server.moneyAvailable)) { server.moneyAvailable = server.moneyMax; @@ -766,4 +770,4 @@ PrintAllServers = function() { console.log("Ip: " + ip + ", hostname: " + AllServers[ip].hostname); } } -} \ No newline at end of file +} diff --git a/src/ServerPurchases.js b/src/ServerPurchases.js index a04785585..e3a1e0d9d 100644 --- a/src/ServerPurchases.js +++ b/src/ServerPurchases.js @@ -8,7 +8,15 @@ purchaseServer = function(ram, cost) { dialogBoxCreate("You don't have enough money to purchase this server!"); return; } - + + //Maximum of 30 servers + if (Player.purchasedServers.length >= CONSTANTS.PurchasedServerLimit) { + dialogBoxCreate("You have reached the maximum limit of " + CONSTANTS.PurchasedServerLimit + " servers. " + + "You cannot purchase any more. You can " + + "delete some of your purchased servers using the deleteServer() Netscript function in a script"); + return; + } + var newServ = new Server(); var hostname = document.getElementById("purchase-server-box-input").value; hostname = hostname.replace(/\s\s+/g, ''); @@ -16,21 +24,21 @@ purchaseServer = function(ram, cost) { dialogBoxCreate("You must enter a hostname for your new server!"); return; } - + //Create server newServ.init(createRandomIp(), hostname, "", true, false, true, true, ram); AddToAllServers(newServ); - + //Add to Player's purchasedServers array Player.purchasedServers.push(newServ.ip); - + //Connect new server to home computer var homeComputer = Player.getHomeComputer(); homeComputer.serversOnNetwork.push(newServ.ip); newServ.serversOnNetwork.push(homeComputer.ip); - - Player.loseMoney(cost); - + + Player.loseMoney(cost); + dialogBoxCreate("Server successfully purchased with hostname " + hostname); } @@ -40,11 +48,11 @@ purchaseRamForHomeComputer = function(cost) { dialogBoxCreate("You do not have enough money to purchase additional RAM for your home computer"); return; } - + var homeComputer = Player.getHomeComputer(); homeComputer.maxRam *= 2; - - Player.loseMoney(cost); - + + Player.loseMoney(cost); + dialogBoxCreate("Purchased additional RAM for home computer! It now has " + homeComputer.maxRam + "GB of RAM."); -} \ No newline at end of file +} diff --git a/src/Settings.js b/src/Settings.js index 13e4119e3..f9aa4a127 100644 --- a/src/Settings.js +++ b/src/Settings.js @@ -1,16 +1,18 @@ /* Settings.js */ Settings = { CodeInstructionRunTime: 100, - suppressMessages: false, MaxLogCapacity: 50, MaxPortCapacity: 50, + SuppressMessages: false, + SuppressFactionInvites: false, } function initSettings() { Settings.CodeInstructionRunTime = 100; - Settings.suppressMessages = false; Settings.MaxLogCapacity = 50; Settings.MaxPortCapacity = 50; + Settings.SuppressMessages = false; + Settings.SuppressFactionInvites = false; } function setSettingsLabels() { @@ -20,4 +22,8 @@ function setSettingsLabels() { = Settings.MaxLogCapacity; document.getElementById("settingsNSPortRangeValLabel").innerHTML = Settings.MaxPortCapacity; + document.getElementById("settingsSuppressMessages").checked + = Settings.SuppressMessages; + document.getElementById("settingsSuppressFactionInvites").checked + = Settings.SuppressFactionInvites; } diff --git a/src/Terminal.js b/src/Terminal.js index 95c6acfef..0e10e0737 100644 --- a/src/Terminal.js +++ b/src/Terminal.js @@ -175,7 +175,9 @@ function tabCompletion(command, arg, allPossibilities, index=0) { if (!(allPossibilities.constructor === Array)) {return;} if (!containsAllStrings(allPossibilities)) {return;} - command = command.toLowerCase(); + if (!command.startsWith("./")) { + command = command.toLowerCase(); + } //Remove all options in allPossibilities that do not match the current string //that we are attempting to autocomplete @@ -243,6 +245,23 @@ function determineAllPossibilitiesForTabCompletion(input, index=0) { var currServ = Player.getCurrentServer(); input = input.toLowerCase(); + //If the command starts with './' and the index == -1, then the user + //has input ./partialexecutablename so autocomplete the script or program + //Put './' in front of each script/executable + if (input.startsWith("./") && index == -1) { + //All programs and scripts + for (var i = 0; i < currServ.scripts.length; ++i) { + allPos.push("./" + currServ.scripts[i].filename); + } + + //Programs are on home computer + var homeComputer = Player.getHomeComputer(); + for(var i = 0; i < homeComputer.programs.length; ++i) { + allPos.push("./" + homeComputer.programs[i]); + } + return allPos; + } + //Autocomplete the command if (index == -1) { return ["alias", "analyze", "cat", "check", "clear", "cls", "connect", "free", @@ -447,7 +466,7 @@ var Terminal = { //Allow usage of ./ if (command.startsWith("./")) { - command = command.slice(0, 2) + " " + command.slice(2); + command = "run " + command.slice(2); } //Only split the first space @@ -895,7 +914,6 @@ var Terminal = { post("No such file exists"); break; case "run": - case "./": //Run a program or a script if (commandArray.length != 2) { post("Incorrect number of arguments. Usage: run [program/script] [-t] [num threads] [arg1] [arg2]..."); diff --git a/src/engine.js b/src/engine.js index 1d2ce0d4b..385d841c0 100644 --- a/src/engine.js +++ b/src/engine.js @@ -485,9 +485,8 @@ var Engine = { }, displayFactionsInfo: function() { + //Clear the list of joined factions var factionsList = document.getElementById("factions-list"); - - //Clear the list while (factionsList.firstChild) { factionsList.removeChild(factionsList.firstChild); } @@ -500,7 +499,6 @@ var Engine = { //Add the faction to the Factions page content var item = document.createElement("li"); var aElem = document.createElement("a"); - aElem.setAttribute("href", "#"); aElem.setAttribute("class", "a-link-button"); aElem.innerHTML = factionName; aElem.addEventListener("click", function() { @@ -509,10 +507,54 @@ var Engine = { return false; }); item.appendChild(aElem); - factionsList.appendChild(item); }()); //Immediate invocation } + + //Clear the list of invitations + var invitationsList = document.getElementById("outstanding-faction-invitations-list"); + while (invitationsList.firstChild) { + invitationsList.removeChild(invitationsList.firstChild); + } + + //Add a link to accept for each faction you have invitiations for + for (var i = 0; i < Player.factionInvitations.length; ++i) { + (function () { + var factionName = Player.factionInvitations[i]; + + var item = document.createElement("li"); + + var pElem = document.createElement("p"); + pElem.innerText = factionName; + pElem.style.display = "inline"; + pElem.style.margin = "4px"; + pElem.style.padding = "4px"; + + var aElem = document.createElement("a"); + aElem.innerText = "Accept Faction Invitation"; + aElem.setAttribute("class", "a-link-button"); + aElem.style.display = "inline"; + aElem.style.margin = "4px"; + aElem.style.padding = "4px"; + aElem.addEventListener("click", function() { + joinFaction(Factions[factionName]); + for (var i = 0; i < Player.factionInvitations.length; ++i) { + if (Player.factionInvitations[i] == factionName) { + Player.factionInvitations.splice(i, 1); + break; + } + } + Engine.displayFactionsInfo(); + return false; + }); + + item.appendChild(pElem); + item.appendChild(aElem); + item.style.margin = "6px"; + item.style.padding = "6px"; + invitationsList.appendChild(item); + }()); + } }, displayAugmentationsContent: function() { @@ -693,7 +735,7 @@ var Engine = { updateSkillLevelsCounter: 10, //Only update skill levels every 2 seconds. Might improve performance updateDisplays: 3, //Update displays such as Active Scripts display and character display createProgramNotifications: 10, //Checks whether any programs can be created and notifies - checkFactionInvitations: 100, //Check whether you qualify for any faction invitations every 5 minutes + checkFactionInvitations: 100, //Check whether you qualify for any faction invitations passiveFactionGrowth: 600, messages: 150, stockTick: 30, //Update stock prices diff --git a/utils/FactionInvitationBox.js b/utils/FactionInvitationBox.js index 2c7912969..65832f01e 100644 --- a/utils/FactionInvitationBox.js +++ b/utils/FactionInvitationBox.js @@ -23,20 +23,21 @@ factionInvitationSetMessage = function(msg) { factionInvitationBoxCreate = function(faction) { factionInvitationSetText("You have received a faction invitation from " + faction.name); //TODO Faction invitation message - + var newYesButton = clearEventListeners("faction-invitation-box-yes"); newYesButton.addEventListener("click", function() { joinFaction(faction); factionInvitationBoxClose(); return false; }); - + var noButton = clearEventListeners("faction-invitation-box-no"); noButton.addEventListener("click", function() { factionInvitationBoxClose(); faction.alreadyInvited = true; + Player.factionInvitations.push(faction.name); return false; }); - + factionInvitationBoxOpen(); -} \ No newline at end of file +}