diff --git a/index.html b/index.html
index cfef7f465..bb0c59e07 100644
--- a/index.html
+++ b/index.html
@@ -142,6 +142,9 @@
-
Travel Agency
+
+ -
+ Summit University
-
ECorp
@@ -184,124 +187,130 @@
@@ -457,6 +466,12 @@
Train Dexterity
Train Agility
+
+ Study Computer Science (free)
+ Take Data Structures Class
+ Take Networks Class
+ Take Algorithms Class
+
Purchase 1GB Server - $50,000
Purchase 2GB Server - $100,000
@@ -488,8 +503,11 @@
diff --git a/src/Company.js b/src/Company.js
index 268f9af2c..31b866d01 100644
--- a/src/Company.js
+++ b/src/Company.js
@@ -206,43 +206,43 @@ CompanyPositions = {
SoftwareIntern: new CompanyPosition("Software Engineering Intern", 1, 0, 0, 0, 0, 0, 0, 1),
JuniorDev: new CompanyPosition("Junior Software Engineer", 50, 0, 0, 0, 0, 25, 9000, 5),
SeniorDev: new CompanyPosition("Senior Software Engineer", 250, 0, 0, 0, 0, 75, 36000, 12),
- LeadDev: new CompanyPosition("Lead Software Developer", 400, 0, 0, 0, 0, 150, 72000, 15),
+ LeadDev: new CompanyPosition("Lead Software Developer", 400, 0, 0, 0, 0, 150, 144000, 15),
//IT
ITIntern: new CompanyPosition("IT Intern", 1, 0, 0, 0, 0, 1, 0, .8),
ITAnalyst: new CompanyPosition("IT Analyst", 25, 0, 0, 0, 0, 1, 9000, 2),
ITManager: new CompanyPosition("IT Manager", 150, 0, 0, 0, 0, 50, 36000, 8),
- SysAdmin: new CompanyPosition("Systems Administrator", 250, 0, 0, 0, 0, 75, 72000, 13),
+ SysAdmin: new CompanyPosition("Systems Administrator", 250, 0, 0, 0, 0, 75, 144000, 13),
SecurityEngineer: new CompanyPosition("Security Engineer", 150, 0, 0, 0, 0, 25, 36000, 10),
NetworkEngineer: new CompanyPosition("Network Engineer", 150, 0, 0, 0, 0, 25, 36000, 10),
- NetworkAdministrator: new CompanyPosition("Network Administrator", 250, 0, 0, 0, 0, 75, 72000, 12),
+ NetworkAdministrator: new CompanyPosition("Network Administrator", 250, 0, 0, 0, 0, 75, 144000, 12),
//Technology management
- HeadOfSoftware: new CompanyPosition("Head of Software", 500, 0, 0, 0, 0, 250, 108000, 30),
- HeadOfEngineering: new CompanyPosition("Head of Engineering", 500, 0, 0, 0, 0, 250, 10800, 30),
- VicePresident: new CompanyPosition("Vice President of Technology", 600, 0, 0, 0, 0, 400, 144000, 40),
- CTO: new CompanyPosition("Chief Technology Officer", 750, 0, 0, 0, 0, 500, 216000, 50),
+ HeadOfSoftware: new CompanyPosition("Head of Software", 500, 0, 0, 0, 0, 250, 288000, 30),
+ HeadOfEngineering: new CompanyPosition("Head of Engineering", 500, 0, 0, 0, 0, 250, 576000, 35),
+ VicePresident: new CompanyPosition("Vice President of Technology", 600, 0, 0, 0, 0, 400, 1152000, 40),
+ CTO: new CompanyPosition("Chief Technology Officer", 750, 0, 0, 0, 0, 500, 4608000, 50),
//Business
BusinessIntern: new CompanyPosition("Business Intern", 1, 0, 0, 0, 0, 1, 0, 1),
BusinessAnalyst: new CompanyPosition("Business Analyst", 5, 0, 0, 0, 0, 50, 9000, 8),
BusinessManager: new CompanyPosition("Business Manager", 50, 0, 0, 0, 0, 100, 36000, 15),
- OperationsManager: new CompanyPosition("Operations Manager", 50, 0, 0, 0, 0, 200, 72000, 20),
- CFO: new CompanyPosition("Chief Financial Officer", 75, 0, 0, 0, 0, 500, 108000, 50),
- CEO: new CompanyPosition("Chief Executive Officer", 100, 0, 0, 0, 0, 750, 216000, 100),
+ OperationsManager: new CompanyPosition("Operations Manager", 50, 0, 0, 0, 0, 200, 144000, 20),
+ CFO: new CompanyPosition("Chief Financial Officer", 75, 0, 0, 0, 0, 500, 576000, 50),
+ CEO: new CompanyPosition("Chief Executive Officer", 100, 0, 0, 0, 0, 750, 4608000, 100),
//Non-tech/management jobs
Waiter: new CompanyPosition("Waiter", 0, 0, 0, 0, 0, 0, 0, .5),
Employee: new CompanyPosition("Employee", 0, 0, 0, 0, 0, 0, 0, .5),
PoliceOfficer: new CompanyPosition("Police Officer", 10, 100, 100, 100, 100, 9000, 4),
- PoliceChief: new CompanyPosition("Police Chief", 100, 300, 300, 300, 300, 18000, 10),
+ PoliceChief: new CompanyPosition("Police Chief", 100, 300, 300, 300, 300, 36000, 10),
SecurityGuard: new CompanyPosition("Security Guard", 0, 50, 50, 50, 50, 0, 3),
SecurityOfficer: new CompanyPosition("Security Officer", 25, 150, 150, 150, 150, 9000, 6),
SecuritySupervisor: new CompanyPosition("Security Supervisor", 25, 250, 250, 250, 250, 36000, 12),
- HeadOfSecurity: new CompanyPosition("Head of Security", 50, 500, 500, 500, 500, 72000, 20),
+ HeadOfSecurity: new CompanyPosition("Head of Security", 50, 500, 500, 500, 500, 144000, 20),
FieldAgent: new CompanyPosition("Field Agent", 100, 100, 100, 100, 100, 9000, 4),
SecretAgent: new CompanyPosition("Secret Agent", 200, 250, 250, 250, 250, 36000, 10),
- SpecialOperative: new CompanyPosition("Special Operative", 250, 500, 500, 500, 500, 108000, 20),
+ SpecialOperative: new CompanyPosition("Special Operative", 250, 500, 500, 500, 500, 144000, 20),
init: function() {
//Argument order: hack, str, def, dex, agi, cha
diff --git a/src/CompanyJobApplication.js b/src/CompanyJobApplication.js
index 437a39f99..300f8146a 100644
--- a/src/CompanyJobApplication.js
+++ b/src/CompanyJobApplication.js
@@ -78,10 +78,10 @@ PlayerObject.prototype.applyForJob = function(entryPosType) {
this.companyPosition = pos;
if (leaveCompany) {
- dialogBoxCreate("Congratulations! You were offered a new job at ", this.companyName, " as a " + pos.positionName + "!",
+ dialogBoxCreate("Congratulations! You were offered a new job at " + this.companyName + " as a " + pos.positionName + "!",
"You lost 1000 reputatation at your old company " + oldCompanyName + " because you left.");
} else {
- dialogBoxCreate("Congratulations! You were offered a new job at ", this.companyName, " as a " + pos.positionName + "!");
+ dialogBoxCreate("Congratulations! You were offered a new job at " + this.companyName + " as a " + pos.positionName + "!");
}
Engine.loadLocationContent();
diff --git a/src/Constants.js b/src/Constants.js
index 1190e5744..231b4adb6 100644
--- a/src/Constants.js
+++ b/src/Constants.js
@@ -1,4 +1,6 @@
CONSTANTS = {
+ Version: "0.1",
+
//Max level for any skill. Determined by max numerical value in javascript and the skill level
//formula in Player.js
MaxSkillLevel: 975,
@@ -41,6 +43,16 @@ CONSTANTS = {
FactionWorkField: "Faction Field Work",
FactionWorkSecurity: "Faction Security Work",
+ WorkTypeCompany: "Working for Company",
+ WorkTypeFaction: "Working for Faction",
+ WorkTypeCreateProgram: "Working on Create a Program",
+ WorkTypeStudyClass: "Studying or Taking a class at university",
+
+ ClassStudyComputerScience: "studying Computer Science",
+ ClassDataStructures: "taking a Data Structures course",
+ ClassNetworks: "taking a Networks course",
+ ClassAlgorithms: "taking an Algorithms course",
+
//Text that is displayed when the 'help' command is ran in Terminal
HelpText: "analyze Get statistics and information about current machine
" +
"clear Clear all text on the terminal
" +
diff --git a/src/Location.js b/src/Location.js
index df57941e6..0dcd2dc47 100644
--- a/src/Location.js
+++ b/src/Location.js
@@ -13,6 +13,7 @@ Locations = {
//Aevum Locations
AevumTravelAgency: "Aevum Travel Agency",
+ AevumSummitUniversity: "Summit University",
AevumECorp: "ECorp",
AevumBachmanAndAssociates: "Bachman & Associates",
AevumClarkeIncorporated: "Clarke Incorporated",
@@ -33,6 +34,7 @@ Locations = {
//Sector 12
Sector12TravelAgency: "Sector-12 Travel Agency",
+ Sector12RothmanUniversity: "Rothman University",
Sector12MegaCorp: "MegaCorp",
Sector12BladeIndustries: "Blade Industries",
Sector12FourSigma: "Four Sigma",
@@ -62,15 +64,16 @@ Locations = {
IshimaOmegaSoftware: "Omega Software",
//Volhaven
- VolhavenTravelAgency: "Volhaven Travel Agency",
- VolhavenOmniTekIncorporated: "OmniTek Incorporated",
- VolhavenNWO: "NWO",
- VolhavenHeliosLabs: "Helios Labs",
- VolhavenOmniaCybersystems: "Omnia Cybersystems",
- VolhavenLexoCorp: "LexoCorp",
- VolhavenSysCoreSecurities: "SysCore Securities",
- VolhavenCompuTek: "CompuTek",
- VolhavenMilleniumFitnessGym: "Millenium Fitness Gym",
+ VolhavenTravelAgency: "Volhaven Travel Agency",
+ VolhavenZBInstituteOfTechnology: "ZB Institute of Technology",
+ VolhavenOmniTekIncorporated: "OmniTek Incorporated",
+ VolhavenNWO: "NWO",
+ VolhavenHeliosLabs: "Helios Labs",
+ VolhavenOmniaCybersystems: "Omnia Cybersystems",
+ VolhavenLexoCorp: "LexoCorp",
+ VolhavenSysCoreSecurities: "SysCore Securities",
+ VolhavenCompuTek: "CompuTek",
+ VolhavenMilleniumFitnessGym: "Millenium Fitness Gym",
}
displayLocationContent = function() {
@@ -103,6 +106,11 @@ displayLocationContent = function() {
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 purchase1gb = document.getElementById("location-purchase-1gb");
var purchase2gb = document.getElementById("location-purchase-2gb");
@@ -163,6 +171,11 @@ displayLocationContent = function() {
gymTrainDex.style.display = "none";
gymTrainAgi.style.display = "none";
+ studyComputerScience.style.display = "none";
+ classDataStructures.style.display = "none";
+ classNetworks.style.display = "none";
+ classAlgorithms.style.display = "none";
+
purchase1gb.style.display = "none";
purchase2gb.style.display = "none";
purchase4gb.style.display = "none";
@@ -233,6 +246,41 @@ displayLocationContent = function() {
travelToVolhaven.style.display = "block";
break;
+ case Locations.AevumSummitUniveristy:
+ var costMult = 2;
+ var expMult = 1;
+ displayUniversityLocationContent(costMult);
+
+ var newStudyCS = studyComputerScience.cloneNode(true);
+ studyComputerScience.parentNode.replaceChild(newStudyCS, studyComputerScience)
+ newStudyCS.addEventListener("click", function() {
+ Player.startClass(costMult, expMult, CONSTANTS.ClassStudyComputerScience);
+ return false;
+ });
+
+ var newClassDataStructures = classDataStructures.cloneNode(true);
+ classDataStructures.parentNode.replaceChild(newClassDataStructures, classDataStructures);
+ newClassDataStructures.addEventListener("click", function() {
+ Player.startClass(costMult, expMult, CONSTANTS.ClassDataStructures);
+ return false;
+ });
+
+ var newClassNetworks = classNetworks.cloneNode(true);
+ classNetworks.parentNode.replaceChild(newClassNetworks, classNetworks);
+ newClassNetworks.addEventListener("click", function() {
+ Player.startClass(costMult, expMult, CONSTANTS.ClassNetworks);
+ return false;
+ });
+
+ var newClassAlgorithms = classAlgorithms.cloneNode(true);
+ classAlgorithms.parentNode.replaceChild(newClassAlgorithms, classAlgorithms);
+ newClassAlgorithms.addEventListener("click", function() {
+ Player.startClass(costMult, expMult, CONSTANTS.ClassAlgorithms);
+ return false;
+ });
+
+ break;
+
case Locations.AevumECorp:
locationInfo.innerHTML = Companies[loc].info;
@@ -403,6 +451,40 @@ displayLocationContent = function() {
travelToIshima.style.display = "block";
travelToVolhaven.style.display = "block";
break;
+
+ case Locations.Sector12RothmanUniversity:
+ var costMult = 1;
+ var expMult = 0.5;
+ displayUniversityLocationContent(costMult);
+
+ var newStudyCS = studyComputerScience.cloneNode(true);
+ studyComputerScience.parentNode.replaceChild(newStudyCS, studyComputerScience)
+ newStudyCS.addEventListener("click", function() {
+ Player.startClass(costMult, expMult, CONSTANTS.ClassStudyComputerScience);
+ return false;
+ });
+
+ var newClassDataStructures = classDataStructures.cloneNode(true);
+ classDataStructures.parentNode.replaceChild(newClassDataStructures, classDataStructures);
+ newClassDataStructures.addEventListener("click", function() {
+ Player.startClass(costMult, expMult, CONSTANTS.ClassDataStructures);
+ return false;
+ });
+
+ var newClassNetworks = classNetworks.cloneNode(true);
+ classNetworks.parentNode.replaceChild(newClassNetworks, classNetworks);
+ newClassNetworks.addEventListener("click", function() {
+ Player.startClass(costMult, expMult, CONSTANTS.ClassNetworks);
+ return false;
+ });
+
+ var newClassAlgorithms = classAlgorithms.cloneNode(true);
+ classAlgorithms.parentNode.replaceChild(newClassAlgorithms, classAlgorithms);
+ newClassAlgorithms.addEventListener("click", function() {
+ Player.startClass(costMult, expMult, CONSTANTS.ClassAlgorithms);
+ return false;
+ });
+ break;
case Locations.Sector12MegaCorp:
locationInfo.innerHTML = Companies[loc].info;
@@ -637,7 +719,7 @@ displayLocationContent = function() {
purchaseTor.style.display = "block";
break;
- case Locations.VolhavenTravelAgency:
+ case Locations.VolhavenTravelAgency:
travelAgencyText.style.display = "block";
travelToAevum.style.display = "block";
travelToChongqing.style.display = "block";
@@ -645,6 +727,40 @@ displayLocationContent = function() {
travelToNewTokyo.style.display = "block";
travelToIshima.style.display = "block";
break;
+
+ case Locations.VolhavenZBInstituteOfTechnology:
+ var costMult = 3;
+ var expMult = 2;
+ displayUniversityLocationContent(costMult);
+
+ var newStudyCS = studyComputerScience.cloneNode(true);
+ studyComputerScience.parentNode.replaceChild(newStudyCS, studyComputerScience)
+ newStudyCS.addEventListener("click", function() {
+ Player.startClass(costMult, expMult, CONSTANTS.ClassStudyComputerScience);
+ return false;
+ });
+
+ var newClassDataStructures = classDataStructures.cloneNode(true);
+ classDataStructures.parentNode.replaceChild(newClassDataStructures, classDataStructures);
+ newClassDataStructures.addEventListener("click", function() {
+ Player.startClass(costMult, expMult, CONSTANTS.ClassDataStructures);
+ return false;
+ });
+
+ var newClassNetworks = classNetworks.cloneNode(true);
+ classNetworks.parentNode.replaceChild(newClassNetworks, classNetworks);
+ newClassNetworks.addEventListener("click", function() {
+ Player.startClass(costMult, expMult, CONSTANTS.ClassNetworks);
+ return false;
+ });
+
+ var newClassAlgorithms = classAlgorithms.cloneNode(true);
+ classAlgorithms.parentNode.replaceChild(newClassAlgorithms, classAlgorithms);
+ newClassAlgorithms.addEventListener("click", function() {
+ Player.startClass(costMult, expMult, CONSTANTS.ClassAlgorithms);
+ return false;
+ });
+ break;
case Locations.VolhavenOmniTekIncorporated:
locationInfo.innerHTML = Companies[loc].info;
@@ -765,6 +881,13 @@ initLocationButtons = function() {
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;
@@ -877,6 +1000,13 @@ initLocationButtons = function() {
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;
@@ -1044,6 +1174,13 @@ initLocationButtons = function() {
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() {
@@ -1302,4 +1439,31 @@ purchaseTorRouter = function() {
Player.getHomeComputer().serversOnNetwork.push(darkweb.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 connect.", "");
+}
+
+displayUniversityLocationContent = function(costMult) {
+ var studyComputerScienceButton = document.getElementById("location-study-computer-science");
+ var classDataStructuresButton = document.getElementById("location-data-structures-class");
+ var classNetworksButton = document.getElementById("location-networks-class");
+ var classAlgorithmsButton = document.getElementById("location-algorithms-class");
+ studyComputerScienceButton.style.display = "block";
+ classDataStructuresButton.style.display = "block";
+ classNetworksButton.style.display = "block";
+ classAlgorithmsButton.style.display = "block";
+
+ var gameCPS = 1 / Engine._idleSpeed;
+
+ //Costs (per second)
+ var baseDataStructuresCost = 1;
+ var baseNetworksCost = 5;
+ var baseAlgorithmsCost = 20;
+
+ var dataStructuresCost = baseDataStructuresCost * costMult;
+ var networksCost = baseNetworksCost * costMult;
+ var algorithmsCost = baseAlgorithmsCost * costMult;
+
+ //Update button text to show cost
+ classDataStructuresButton.innerHTML = "Take Data Structures Class ($" + dataStructuresCost + " / sec)";
+ classNetworksButton.innerHTML = "Take Networks Class ($" + networksCost + " / second)";
+ classAlgorithmsButton.innerHTML = "Take Algorithms Class ($" + algorithmsCost + " / second)";
}
\ No newline at end of file
diff --git a/src/Player.js b/src/Player.js
index 090fe1b2f..0caeeec5c 100644
--- a/src/Player.js
+++ b/src/Player.js
@@ -99,8 +99,10 @@ function PlayerObject() {
this.startAction = false;
this.actionTime = 0;
- //Flags/variables for working (Company, Faction, and Creating Programin)
+ //Flags/variables for working (Company, Faction, Creating Program, Taking Class)
this.isWorking = false;
+ this.workType = "";
+
this.currentWorkFactionName = "";
this.currentWorkFactionDescription = "";
@@ -112,6 +114,7 @@ function PlayerObject() {
this.workChaExpGainRate = 0;
this.workRepGainRate = 0;
this.workMoneyGainRate = 0;
+ this.workMoneyLossRate = 0;
this.workHackExpGained = 0;
this.workStrExpGained = 0;
@@ -124,6 +127,8 @@ function PlayerObject() {
this.createProgramName = "";
+ this.className = "";
+
this.timeWorked = 0; //in ms
this.timeNeededToCompleteWork = 0;
@@ -243,6 +248,13 @@ PlayerObject.prototype.gainMoney = function(money) {
this.lifetime_money += money;
}
+PlayerObject.prototype.loseMoney = function(money) {
+ if (isNaN(money)) {
+ console.log("ERR: NaN passed into Player.loseMoney()"); return;
+ }
+ this.money -= money;
+}
+
PlayerObject.prototype.gainHackingExp = function(exp) {
if (isNaN(exp)) {
console.log("ERR: NaN passed into Player.gainHackingExp()"); return;
@@ -346,6 +358,7 @@ PlayerObject.prototype.finishWork = function(cancelled) {
PlayerObject.prototype.startWork = function() {
this.isWorking = true;
+ this.workType = CONSTANTS.WorkTypeCompany;
this.currentWorkFactionName = "";
this.currentWorkFactionDescription = "";
this.createProgramName = "";
@@ -474,6 +487,7 @@ PlayerObject.prototype.finishFactionWork = function(cancelled, faction) {
PlayerObject.prototype.startFactionWork = function(faction) {
this.isWorking = true;
+ this.workType = CONSTANTS.WorkTypeFaction;
this.currentWorkFactionName = faction.name;
this.createProgramName = "";
@@ -688,6 +702,7 @@ PlayerObject.prototype.getFactionFieldWorkRepGain = function() {
/* Creating a Program */
PlayerObject.prototype.startCreateProgramWork = function(programName, time) {
this.isWorking = true;
+ this.workType = CONSTANTS.WorkTypeCreateProgram;
this.timeWorked = 0;
this.timeNeededToCompleteWork = time;
@@ -742,7 +757,152 @@ PlayerObject.prototype.finishCreateProgramWork = function(cancelled, programName
Engine.loadTerminalContent();
}
-//Functions for saving and loading the Player data
+/* Studying/Taking Classes */
+PlayerObject.prototype.startClass = function(costMult, expMult, className) {
+ this.isWorking = true;
+ this.workType = CONSTANTS.WorkTypeStudyClass;
+ this.timeWorked = 0;
+
+ this.className = className;
+
+ this.workStrExpGainRate = 0;
+ this.workDefExpGainRate = 0;
+ this.workDexExpGainRate = 0;
+ this.workAgiExpGainRate = 0;
+ this.workChaExpGainRate = 0;
+ this.workRepGainRate = 0;
+ this.workMoneyGainRate = 0;
+
+ this.workHackExpGained = 0;
+ this.workStrExpGained = 0;
+ this.workDefExpGained = 0;
+ this.workDexExpGained = 0;
+ this.workAgiExpGained = 0;
+ this.workChaExpGained = 0;
+ this.workRepGained = 0;
+ this.workMoneyGained = 0;
+
+ var gameCPS = 1000 / Engine._idleSpeed;
+ //Base costs/exp (per second)
+ var baseDataStructuresCost = 1;
+ var baseNetworksCost = 5;
+ var baseAlgorithmsCost = 20;
+
+ var baseStudyComputerScienceExp = 0.02;
+ var baseDataStructuresExp = 0.1;
+ var baseNetworksExp = 0.5;
+ var baseAlgorithmsExp = 2.0;
+
+ //Find cost and exp gain per game cycle
+ var cost = 0;
+ var hackExp = 0;
+ switch (className) {
+ case CONSTANTS.ClassStudyComputerScience:
+ hackExp = baseStudyComputerScienceExp * expMult / gameCPS;
+ break;
+ case CONSTANTS.ClassDataStructures:
+ cost = baseDataStructuresCost * costMult / gameCPS;
+ hackExp = baseDataStructuresExp * expMult / gameCPS;
+ break;
+ case CONSTANTS.ClassNetworks:
+ cost = baseNetworksCost * costMult / gameCPS;
+ hackExp = baseNetworksExp * expMult / gameCPS;
+ break;
+ case CONSTANTS.ClassAlgorithms:
+ cost = baseAlgorithmsCost * costMult / gameCPS;
+ hackExp = baseAlgorithmsExp * expMult / gameCPS;
+ break;
+ default:
+ throw new Error("ERR: Invalid/unregocnized class name");
+ return;
+ }
+
+ this.workMoneyLossRate = cost;
+ this.workHackExpGainRate = hackExp;
+
+ var cancelButton = document.getElementById("work-in-progress-cancel-button");
+
+ //Remove all old event listeners from Cancel button
+ var newCancelButton = cancelButton.cloneNode(true);
+ cancelButton.parentNode.replaceChild(newCancelButton, cancelButton);
+
+ newCancelButton.addEventListener("click", function() {
+ Player.finishClass();
+ return false;
+ });
+
+ //Display Work In Progress Screen
+ Engine.loadWorkInProgressContent();
+}
+
+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;
+ this.workDexExpGained += this.workDexExpGainRate * numCycles;
+ this.workAgiExpGained += this.workAgiExpGainRate * numCycles;
+ this.workChaExpGained += this.workChaExpGainRate * numCycles;
+ this.workRepGained += this.workRepGainRate * numCycles;
+ this.workMoneyGained += this.workMoneyGainRate * numCycles;
+ this.workMoneyGained -= this.workMoneyLossRate * numCycles;
+
+ var cyclesPerSec = 1000 / Engine._idleSpeed;
+
+ //TODO Account for running out of money when numCycles is very big
+
+ var txt = document.getElementById("work-in-progress-text");
+ txt.innerHTML = "You have been " + className + " for " + convertTimeMsToTimeElapsedString(this.timeWorked) + ".
" +
+ "This has cost you:
" +
+ "$" + this.workMoneyGained.toFixed(2) + " ($" + (this.workMoneyLossRate * cyclesPerSec).toFixed(2) + " / sec)
" +
+ "You have gained:
" +
+ this.workHackExpGained.toFixed(3) + " (" + (this.workHackExpGainRate * cyclesPerSec).toFixed(3) + " / sec) hacking exp
" +
+ this.workStrExpGained.toFixed(3) + " (" + (this.workStrExpGainRate * cyclesPerSec).toFixed(3) + " / sec) strength exp
" +
+ this.workDefExpGained.toFixed(3) + " (" + (this.workDefExpGainRate * cyclesPerSec).toFixed(3) + " / sec) defense exp
" +
+ this.workDexExpGained.toFixed(3) + " (" + (this.workDexExpGainRate * cyclesPerSec).toFixed(3) + " / sec) dexterity exp
" +
+ this.workAgiExpGained.toFixed(3) + " (" + (this.workAgiExpGainRate * cyclesPerSec).toFixed(3) + " / sec) agility exp
" +
+ this.workChaExpGained.toFixed(3) + " (" + (this.workChaExpGainRate * cyclesPerSec).toFixed(3) + " / sec) charisma exp
" +
+ "You may cancel at any time";
+
+}
+
+PlayerObject.prototype.finishClass = function() {
+ this.gainHackingExp(this.workHackExpGained);
+ this.gainStrengthExp(this.workStrExpGained);
+ this.gainDefenseExp(this.workDefExpGained);
+ this.gainDexterityExp(this.workDexExpGained);
+ this.gainAgilityExp(this.workAgiExpGained);
+ this.gainCharismaExp(this.workChaExpGained);
+
+ 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 " + this.workMoneyGained * -1 + ".
" +
+ "You earned a total of:
" +
+ (this.workHackExpGained).toFixed(3) + " hacking exp
" +
+ (this.workStrExpGained).toFixed(3) + " strength exp
" +
+ (this.workDefExpGained).toFixed(3) + " defense exp
" +
+ (this.workDexExpGained).toFixed(3) + " dexterity exp
" +
+ (this.workAgiExpGained).toFixed(3) + " agility exp
" +
+ (this.workChaExpGained).toFixed(3) + " charisma exp
";
+
+ dialogBoxCreate(txt);
+
+ var mainMenu = document.getElementById("mainmenu-container");
+ mainMenu.style.visibility = "visible";
+
+ this.isWorking = false;
+
+ Engine.loadTerminalContent();
+}
+
+/* Functions for saving and loading the Player data */
PlayerObject.prototype.toJSON = function() {
return Generic_toJSON("PlayerObject", this);
}
diff --git a/src/Terminal.js b/src/Terminal.js
index 6130cff64..37934bd54 100644
--- a/src/Terminal.js
+++ b/src/Terminal.js
@@ -23,7 +23,7 @@ function updateTerminalScroll() {
}
var postNetburnerText = function() {
- post("Netburner v0.1");
+ post("Bitburner v" + CONSTANTS.Version);
}
//Defines key commands in terminal
diff --git a/src/engine.js b/src/engine.js
index bdf64c200..129592bcb 100644
--- a/src/engine.js
+++ b/src/engine.js
@@ -561,11 +561,14 @@ var Engine = {
Player.startAction = false;
}
+ //Working
if (Player.isWorking) {
- if (Player.currentWorkFactionName != "") {
+ if (Player.workType == CONSTANTS.WorkTypeFaction) {
Player.workForFaction(numCycles);
- } else if (Player.createProgramName != "") {
+ } else if (Player.workType == CONSTANTS.WorkTypeCreateProgram) {
Player.createProgramWork(numCycles);
+ } else if (Player.workType == CONSTANTS.WorkTypeStudyClass) {
+ Player.takeClass(numCycles);
} else {
Player.work(numCycles);
}
@@ -868,10 +871,12 @@ var Engine = {
processServerGrowth(numCyclesOffline); //Should be done before offline production for scripts
loadAllRunningScripts(); //This also takes care of offline production for those scripts
if (Player.isWorking) {
- if (Player.currentWorkFactionName != "") {
+ if (Player.workType == CONSTANTS.WorkTypeFaction) {
Player.workForFaction(numCyclesOffline);
- } else if (Player.createProgramName != "") {
+ } else if (Player.workType == CONSTANTS.WorkTypeCreateProgram) {
Player.createProgramWork(numCyclesOffline);
+ } else if (Player.workType == CONSTANTS.WorkTypeStudyClass) {
+ Player.takeClass(numCyclesOffline);
} else {
Player.work(numCyclesOffline);
}
@@ -895,11 +900,13 @@ var Engine = {
if (Player.isWorking) {
var cancelButton = document.getElementById("work-in-progress-cancel-button");
cancelButton.addEventListener("click", function() {
- if (Player.currentWorkFactionName != "") {
+ if (Player.workType == CONSTANTS.WorkTypeFaction) {
var fac = Factions[Player.currentWorkFactionName];
Player.finishFactionWork(true, fac);
- } else if (Player.createProgramName != "") {
+ } else if (Player.WorkType == CONSTANTS.WorkTypeCreateProgram) {
Player.finishCreateProgramWork(true, Player.createProgramName);
+ } else if (Player.workType == CONSTANTS.WorkTypeStudyClass) {
+ Player.finishClass();
} else {
Player.finishWork(true);
}