Added a bunch of small fixes and features, don't remember exactly what lol

This commit is contained in:
Daniel Xie 2017-02-16 12:52:11 -06:00
parent 1c26d2953b
commit 0ed3d65ae5
18 changed files with 736 additions and 215 deletions

@ -48,6 +48,8 @@ TESTING TODO:
Companies Companies
Add possible CompanyPositions for every Company Add possible CompanyPositions for every Company
Applying/working for companies Applying/working for companies
Factions
Tasks TODO: Tasks TODO:
Script logging functionality? Logs to internal "log file" (property of script itself) Script logging functionality? Logs to internal "log file" (property of script itself)
@ -56,7 +58,10 @@ Tasks TODO:
Hack time formula needs rebalancing I think Hack time formula needs rebalancing I think
Factions Create new menu page for purchased servers
Change Company pages to display "apply for promotion" and other stuff when you are already employed there
Augmentations Augmentations
Update CONSTANTS.HelpText Update CONSTANTS.HelpText
Account for Max possible int when gaining exp Account for Max possible int when gaining exp

151
css/popupboxes.css Normal file

@ -0,0 +1,151 @@
/* Pop-up boxes */
/* Pop-up Dialog Box */
#dialog-box-container {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: black; /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}
#dialog-box-content {
background-color: black;
margin: 20% auto; /* 15% from the top and centered */
padding: 10px;
border: 5px solid #FFFFFF;
width: 40%; /* Could be more or less, depending on screen size */
}
.dialog-box-text {
color: #66ff33;
}
#dialog-box-close-button {
color: #aaa;
float: right;
font-size: 20px;
font-weight: bold;
-webkit-border-radius: 12px;
-moz-border-radius: 12px;
border-radius: 12px;
-moz-box-shadow: 1px 1px 3px #000;
-webkit-box-shadow: 1px 1px 3px #000;
box-shadow: 1px 1px 3px #000;
}
#dialog-box-close-button:hover,
#dialog-box-close-button:focus {
color: white;
text-decoration: none;
cursor: pointer;
}
/* Purchase server box */
#purchase-server-box-container {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
left: 0;
right: 0;
bottom: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: black; /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
transition: opacity 400ms ease-in;
}
#purchase-server-box-content {
background-color: black;
margin: 15% auto; /* 15% from the top and centered */
padding: 1px;
border: 5px solid #FFFFFF;
width: 80%; /* Could be more or less, depending on screen size */
color: #66ff33;
}
#purchase-server-box-input {
color: white;
}
#purchase-server-box-confirm,
#purchase-server-box-cancel {
color: #aaa;
float: right;
font-size: 16px;
font-weight: bold;
padding: 2px;
border: 1px solid white;
}
#purchase-server-box-confirm:hover,
#purchase-server-box-confirm:focus {
color: #66ff33;
text-decoration: none;
cursor: pointer;
}
#purchase-server-box-cancel:hover,
#purchase-server-box-cancel:focus {
color: #66ff33;
text-decoration: none;
cursor: pointer;
}
/* Faction invitation box */
#faction-invitation-box-container {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
left: 0;
right: 0;
bottom: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: black; /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
transition: opacity 400ms ease-in;
}
#faction-invitation-box-content {
background-color: black;
margin: 15% auto; /* 15% from the top and centered */
padding: 10px;
border: 5px solid #FFFFFF;
width: 80%; /* Could be more or less, depending on screen size */
color: #66ff33;
}
#faction-invitation-box-yes,
#faction-invitation-box-no {
color: #aaa;
font-size: 20px;
font-weight: bold;
padding: 1px;
margin: 3px;
border: 1px solid white;
}
#faction-invitation-box-yes:hover,
#faction-invitation-box-yes:focus {
color: white;
text-decoration: none;
cursor: pointer;
}
#faction-invitation-box-no:hover,
#faction-invitation-box-no:focus {
color: white;
text-decoration: none;
cursor: pointer;
}

@ -68,102 +68,3 @@ h1 {
border-left: 1px solid #333333; border-left: 1px solid #333333;
} }
/* Pop-up Dialog Box */
#dialog-box-container {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: black; /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}
#dialog-box-content {
background-color: black;
margin: 20% auto; /* 15% from the top and centered */
padding: 10px;
border: 5px solid #FFFFFF;
width: 40%; /* Could be more or less, depending on screen size */
}
.dialog-box-text {
color: #66ff33;
}
#dialog-box-close-button {
color: #aaa;
float: right;
font-size: 20px;
font-weight: bold;
-webkit-border-radius: 12px;
-moz-border-radius: 12px;
border-radius: 12px;
-moz-box-shadow: 1px 1px 3px #000;
-webkit-box-shadow: 1px 1px 3px #000;
box-shadow: 1px 1px 3px #000;
}
#dialog-box-close-button:hover,
#dialog-box-close-button:focus {
color: white;
text-decoration: none;
cursor: pointer;
}
/* Pop-up Yes/no box */
#purchase-server-box-container {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
left: 0;
right: 0;
bottom: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: black; /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
transition: opacity 400ms ease-in;
}
#purchase-server-box-content {
background-color: black;
margin: 15% auto; /* 15% from the top and centered */
padding: 1px;
border: 5px solid #FFFFFF;
width: 80%; /* Could be more or less, depending on screen size */
color: #66ff33;
}
#purchase-server-box-input {
color: white;
}
#purchase-server-box-confirm,
#purchase-server-box-cancel {
color: #aaa;
float: right;
font-size: 14px;
font-weight: bold;
padding: 2px;
border: 1px solid white
}
#purchase-server-box-confirm:hover,
#purchase-server-box-confirm:focus {
color: #66ff33;
text-decoration: none;
cursor: pointer;
}
#purchase-server-box-cancel:hover,
#purchase-server-box-cancel:focus {
color: #66ff33;
text-decoration: none;
cursor: pointer;
}

@ -17,7 +17,10 @@
font-weight: bold; font-weight: bold;
-webkit-border-radius: 12px; -webkit-border-radius: 12px;
-moz-border-radius: 12px; -moz-border-radius: 12px;
margin: 10px;
padding: 5px;
border-radius: 12px; border-radius: 12px;
border: 3px solid white;
-moz-box-shadow: 1px 1px 3px #000; -moz-box-shadow: 1px 1px 3px #000;
-webkit-box-shadow: 1px 1px 3px #000; -webkit-box-shadow: 1px 1px 3px #000;
box-shadow: 1px 1px 3px #000; box-shadow: 1px 1px 3px #000;

@ -7,6 +7,7 @@
<link rel="stylesheet" type="text/css" href="css/terminal.css" /> <link rel="stylesheet" type="text/css" href="css/terminal.css" />
<link rel="stylesheet" type="text/css" href="css/menupages.css" /> <link rel="stylesheet" type="text/css" href="css/menupages.css" />
<link rel="stylesheet" type="text/css" href="css/workinprogress.css" /> <link rel="stylesheet" type="text/css" href="css/workinprogress.css" />
<link rel="stylesheet" type="text/css" href="css/popupboxes.css" />
<!-- We'll add in the jQuery library here - direct from <!-- We'll add in the jQuery library here - direct from
the Google CDN (Content Delivery Network). --> the Google CDN (Content Delivery Network). -->
@ -19,6 +20,7 @@
<script src="utils/ObjectHelperFunctions.js"></script> <script src="utils/ObjectHelperFunctions.js"></script>
<script src="utils/DialogBox.js"></script> <script src="utils/DialogBox.js"></script>
<script src="utils/PurchaseServerBox.js"></script> <script src="utils/PurchaseServerBox.js"></script>
<script src="utils/FactionInvitationBox.js"></script>
<!-- Netscript --> <!-- Netscript -->
<script src="src/netscript/NetScriptWorker.js"></script> <script src="src/netscript/NetScriptWorker.js"></script>
@ -30,6 +32,7 @@
<!-- Main game files --> <!-- Main game files -->
<script src="src/Constants.js"></script> <script src="src/Constants.js"></script>
<script src="src/SpecialServerIps.js"></script>
<script src="src/Location.js"></script> <script src="src/Location.js"></script>
<script src="src/Script.js"></script> <script src="src/Script.js"></script>
<script src="src/Server.js"></script> <script src="src/Server.js"></script>
@ -412,7 +415,7 @@
</div> </div>
</div> </div>
<!-- Purchase Server Box --> <!-- Purchase Server Pop-up Box -->
<div id="purchase-server-box-container"> <div id="purchase-server-box-container">
<div id="purchase-server-box-content"> <div id="purchase-server-box-content">
<p id="purchase-server-box-text"> </p> <p id="purchase-server-box-text"> </p>
@ -423,6 +426,20 @@
</div> </div>
</div> </div>
<!-- Faction Invitation Pop-up Box -->
<div id="faction-invitation-box-container">
<div id="faction-invitation-box-content">
<p id="faction-invitation-box-text"> </p>
<p id="faction-invitation-box-message"> </p>
<p id="faction-invitation-box-warning">
Would you like to join? <br> <br>
Warning: Joining this faction may prevent you from joining other factions during this run!
</p>
<span id="faction-invitation-box-yes"> Yes </span>
<span id="faction-invitation-box-no"> No </span>
</div>
</div>
<!-- Work in progress screen --> <!-- Work in progress screen -->
<div id="work-in-progress-container"> <div id="work-in-progress-container">
<p id="work-in-progress-text"> </p> <p id="work-in-progress-text"> </p>

@ -301,7 +301,7 @@ CompanyPositions = {
CompanyPositions.Waiter.setPerformanceParameters(0, 10, 0, 10, 10, 70); CompanyPositions.Waiter.setPerformanceParameters(0, 10, 0, 10, 10, 70);
CompanyPositions.Waiter.setExperienceGains(0, .01, .01, .01, .01, .05); CompanyPositions.Waiter.setExperienceGains(0, .01, .01, .01, .01, .05);
CompanyPositions.Employee.setPerformanceParameters(0, 10, 0, 10, 10, 70); CompanyPositions.Employee.setPerformanceParameters(0, 10, 0, 10, 10, 70);
CompanyPositions.Employee.setExperienceGains(0, .01, .01, .01, .01, .05); CompanyPositions.Employee.setExperienceGains(0, .01, .01, .01, .01, .015);
CompanyPositions.SecurityGuard.setPerformanceParameters(5, 20, 20, 20, 20, 15); CompanyPositions.SecurityGuard.setPerformanceParameters(5, 20, 20, 20, 20, 15);
CompanyPositions.SecurityGuard.setExperienceGains(.01, .02, .02, .02, .02, .01); CompanyPositions.SecurityGuard.setExperienceGains(.01, .02, .02, .02, .02, .01);
CompanyPositions.PoliceOfficer.setPerformanceParameters(5, 20, 20, 20, 20, 15); CompanyPositions.PoliceOfficer.setPerformanceParameters(5, 20, 20, 20, 20, 15);

@ -13,25 +13,25 @@ CONSTANTS = {
CodeOfflineExecutionTime: 10, CodeOfflineExecutionTime: 10,
//Text that is displayed when the 'help' command is ran in Terminal //Text that is displayed when the 'help' command is ran in Terminal
HelpText: "analyze Get statistics and information about current machine\n" + HelpText: "analyze Get statistics and information about current machine <br>" +
"clear Clear all text on the terminal\n" + "clear Clear all text on the terminal <br>" +
"cls See 'clear' command\n" + "cls See 'clear' command <br>" +
"connect [ip/hostname] Connects to the machine given by its IP or hostname\n" + "connect [ip/hostname] Connects to the machine given by its IP or hostname <br>" +
"free Check the machine's memory usage\n" + "free Check the machine's memory usage<br>" +
"hack Hack the current machine\n" + "hack Hack the current machine<br>" +
"help Display this list\n" + "help Display this list<br>" +
"hostname Displays the hostname of the machine\n" + "hostname Displays the hostname of the machine<br>" +
"ifconfig Displays the IP address of the machine\n" + "ifconfig Displays the IP address of the machine<br>" +
"kill [script name] Stops a script that is running\n" + "kill [script name] Stops a script that is running<br>" +
"ls Displays all programs and scripts on the machine\n" + "ls Displays all programs and scripts on the machine<br>" +
"nano [script name] Text editor - Open up and edit a script\n" + "nano [script name] Text editor - Open up and edit a script<br>" +
"netstat Displays all available network connections\n" + "netstat Displays all available network connections<br>" +
"ps Display all scripts that are currently running\n" + "ps Display all scripts that are currently running<br>" +
"rm Delete a script/program from the machine. (WARNING: Permanent)\n" + "rm Delete a script/program from the machine. (WARNING: Permanent)<br>" +
"run [script/program] Execute a program or a script\n" + "run [script/program] Execute a program or a script<br>" +
"scan See 'netstat' command\n" + "scan See 'netstat' command<br>" +
"telnet [ip/hostname] See 'connect' command\n" + "telnet [ip/hostname] See 'connect' command<br>" +
"top Display all running scripts and their RAM usage\n", "top Display all running scripts and their RAM usage<br>",
//TutorialGettingStartedText: //TutorialGettingStartedText:

@ -107,8 +107,11 @@ initFactions = function() {
//This function sets the requirements to join a Faction. It checks whether the Player meets //This function sets the requirements to join a Faction. It checks whether the Player meets
//those requirements and will return an array of all factions that the Player should //those requirements and will return an array of all factions that the Player should
//receive an invitation to //receive an invitation to
PlayerObject.prototype.checkForFactionInvitations() { PlayerObject.prototype.checkForFactionInvitations = function() {
invitedFactions = []; //Array which will hold NAMES of all Factions player should be invited to if (Engine.Debug) {
console.log("checkForFactionInvitations() called");
}
invitedFactions = []; //Array which will hold all Factions th eplayer should be invited to
var companyRep = Companies[this.companyName].playerReputation; var companyRep = Companies[this.companyName].playerReputation;
@ -122,7 +125,7 @@ PlayerObject.prototype.checkForFactionInvitations() {
this.defense >= 900 && this.total_defense >= 10000 && this.defense >= 900 && this.total_defense >= 10000 &&
this.dexterity >= 900 && this.total_dexterity >= 10000 && this.dexterity >= 900 && this.total_dexterity >= 10000 &&
this.agility >= 900 && this.total_agility >= 10000) { this.agility >= 900 && this.total_agility >= 10000) {
invitedFactions.push("Illuminati"); invitedFactions.push(illuminatiFac);
} }
//Daedalus //Daedalus
@ -135,7 +138,7 @@ PlayerObject.prototype.checkForFactionInvitations() {
this.defense >= 500 && this.total_defense >= 8000 && this.defense >= 500 && this.total_defense >= 8000 &&
this.dexterity >= 500 && this.total_dexterity >= 8000 && this.dexterity >= 500 && this.total_dexterity >= 8000 &&
this.agility >= 500 && this.total_agility >= 8000) { this.agility >= 500 && this.total_agility >= 8000) {
invitedFactions.push("Daedalus"); invitedFactions.push(daedalusFac);
} }
//The Covenant //The Covenant
@ -148,91 +151,90 @@ PlayerObject.prototype.checkForFactionInvitations() {
this.defense >= 850 && this.total_defense >= 5000 && this.defense >= 850 && this.total_defense >= 5000 &&
this.dexterity >= 850 && this.total_dexterity >= 5000 && this.dexterity >= 850 && this.total_dexterity >= 5000 &&
this.agility >= 850 && this.total_agility >= 5000) { this.agility >= 850 && this.total_agility >= 5000) {
invitedFactions.push("The Covenant"); invitedFactions.push(covenantFac);
} }
//ECorp //ECorp
var ecorpFac = Factions["ECorp"]; var ecorpFac = Factions["ECorp"];
if (ecorpFac.isBanned == false && ecorpFac.isMember == false && if (ecorpFac.isBanned == false && ecorpFac.isMember == false &&
this.companyName == Locations.AevumECorp && companyRep >= CONSTANTS.CorpFactionRepRequirement) { this.companyName == Locations.AevumECorp && companyRep >= CONSTANTS.CorpFactionRepRequirement) {
invitedFactions.push("ECorp"); invitedFactions.push(ecorpFac);
} }
//MegaCorp //MegaCorp
var megacorpFac = Factions["MegaCorp"]; var megacorpFac = Factions["MegaCorp"];
if (megacorpFac.isBanned == false && megacorpFac.isMember == false && if (megacorpFac.isBanned == false && megacorpFac.isMember == false &&
this.companyName == Locations.Sector12MegaCorp && companyRep >= CONSTANTS.CorpFactionRepRequirement) { this.companyName == Locations.Sector12MegaCorp && companyRep >= CONSTANTS.CorpFactionRepRequirement) {
invitedFactions.push("MegaCorp"); invitedFactions.push(megacorpFac);
} }
//Bachman & Associates //Bachman & Associates
var bachmanandassociatesFac = Factions["Bachman & Associates"]; var bachmanandassociatesFac = Factions["Bachman & Associates"];
if (bachmanandassociatesFac.isBanned == false && bachmanandassociatesFac.isMember == false && if (bachmanandassociatesFac.isBanned == false && bachmanandassociatesFac.isMember == false &&
this.companyName == Locations.AevumBachmanAndAssociates && companyRep >= CONSTANTS.CorpFactionRepRequirement) { this.companyName == Locations.AevumBachmanAndAssociates && companyRep >= CONSTANTS.CorpFactionRepRequirement) {
invitedFactions.push("Bachman & Associates"); invitedFactions.push(bachmanandassociatesFac);
} }
//Blade Industries //Blade Industries
var bladeindustriesFac = Factions["Blade Industries"]; var bladeindustriesFac = Factions["Blade Industries"];
if (bladeindustriesFac.isBanned == false && bladeindustriesFac.isMember == false && if (bladeindustriesFac.isBanned == false && bladeindustriesFac.isMember == false &&
this.companyName == Locations.Sector12BladeIndustries && companyRep >= CONSTANTS.CorpFactionRepRequirement) { this.companyName == Locations.Sector12BladeIndustries && companyRep >= CONSTANTS.CorpFactionRepRequirement) {
invitedFactions.push("Blade Industries"); invitedFactions.push(bladeindustriesFac);
} }
//NWO //NWO
var nwoFac = Factions["NWO"]; var nwoFac = Factions["NWO"];
if (nwoFac.isBanned == false && nwoFac.isMember == false && if (nwoFac.isBanned == false && nwoFac.isMember == false &&
this.companyName == Locations.VolhavenNWO && companyRep >= CONSTANTS.CorpFactionRepRequirement) { this.companyName == Locations.VolhavenNWO && companyRep >= CONSTANTS.CorpFactionRepRequirement) {
invitedFactions.push("NWO"); invitedFactions.push(nwoFac);
} }
//Clarke Incorporated //Clarke Incorporated
var clarkeincorporatedFac = Factions["Clarke Incorporated"]; var clarkeincorporatedFac = Factions["Clarke Incorporated"];
if (clarkeincorporatedFac.isBanned == false && clarkeincorporatedFac.isMember == false && if (clarkeincorporatedFac.isBanned == false && clarkeincorporatedFac.isMember == false &&
this.companyName == Locations.AevumClarkeIncorporated && companyRep >= CONSTANTS.CorpFactionRepRequirement) { this.companyName == Locations.AevumClarkeIncorporated && companyRep >= CONSTANTS.CorpFactionRepRequirement) {
invitedFactions.push("Clarke Incorporated"); invitedFactions.push(clarkeincorporatedFac);
} }
//OmniTek Incorporated //OmniTek Incorporated
var omnitekincorporatedFac = Factions["OmniTek Incorporated"]; var omnitekincorporatedFac = Factions["OmniTek Incorporated"];
if (omnitekincorporatedFac.isBanned == false && omnitekincorporatedFac.isMember == false && if (omnitekincorporatedFac.isBanned == false && omnitekincorporatedFac.isMember == false &&
this.companyName == Locations.VolhavenOmniTekIncorporated && companyRep >= CONSTANTS.CorpFactionRepRequirement) { this.companyName == Locations.VolhavenOmniTekIncorporated && companyRep >= CONSTANTS.CorpFactionRepRequirement) {
invitedFactions.push("OmniTek Incorporated"); invitedFactions.push(omnitekincorporatedFac);
} }
//Four Sigma //Four Sigma
var foursigmaFac = Factions["Four Sigma"]; var foursigmaFac = Factions["Four Sigma"];
if (foursigmaFac.isBanned == false && foursigmaFac.isMember == false && if (foursigmaFac.isBanned == false && foursigmaFac.isMember == false &&
this.companyName == Locations.Sector12FourSigma && companyRep >= CONSTANTS.CorpFactionRepRequirement) { this.companyName == Locations.Sector12FourSigma && companyRep >= CONSTANTS.CorpFactionRepRequirement) {
invitedFactions.push("Four Sigma"); invitedFactions.push(foursigmaFac);
} }
//KuaiGong International //KuaiGong International
var kuaigonginternationalFac = Factions["KuaiGong International"]; var kuaigonginternationalFac = Factions["KuaiGong International"];
if (kuaigonginternationalFac.isBanned == false && kuaigonginternationalFac.isMember == false && if (kuaigonginternationalFac.isBanned == false && kuaigonginternationalFac.isMember == false &&
this.companyName == Locations.ChongqingKuaiGongInternational && companyRep >= CONSTANTS.CorpFactionRepRequirement) { this.companyName == Locations.ChongqingKuaiGongInternational && companyRep >= CONSTANTS.CorpFactionRepRequirement) {
invitedFactions.push("KuaiGong International"); invitedFactions.push(kuaigonginternationalFac);
} }
//Fulcrum Secret Technologies - If u've unlocked fulcrum secret technolgoies server and have a high rep with the company //Fulcrum Secret Technologies - If u've unlocked fulcrum secret technolgoies server and have a high rep with the company
var fulcrumsecrettechonologiesFac = Factions["Fulcrum Secret Technologies"]; var fulcrumsecrettechonologiesFac = Factions["Fulcrum Secret Technologies"];
var fulcrumSecretServer = AllServers[SpecialServerIps.fulcrumSecretServer]; var fulcrumSecretServer = AllServers[SpecialServerIps["Fulcrum Secret Technologies Server"]];
if (fulcrumSecretServer == null) { if (fulcrumSecretServer == null) {
console.log("Error: Could not find Fulcrum Secret Technologies Server"); console.log("Error: Could not find Fulcrum Secret Technologies Server");
} }
if (fulcrumsecrettechonologiesFac.isBanned == false && fulcrumsecrettechonologiesFac.isMember == false && if (fulcrumsecrettechonologiesFac.isBanned == false && fulcrumsecrettechonologiesFac.isMember == false &&
fulcrumSecretServer.hasAdminRights && fulcrumSecretServer.hasAdminRights &&
this.companyName == Locations.AevumFulcrumTechnologies && companyRep >= 250000) { this.companyName == Locations.AevumFulcrumTechnologies && companyRep >= 250000) {
invitedFactions.push("Fulcrum Secret Technologies"); invitedFactions.push(fulcrumsecrettechonologiesFac);
} }
//BitRunners //BitRunners
var bitrunnersFac = Factions["BitRunners"]; var bitrunnersFac = Factions["BitRunners"];
var homeComp = AllServers[this.homeComputer]; var homeComp = Player.getHomeComputer();
if (bitrunnersFac.isBanned == false && bitrunnersFac.isMember == false && if (bitrunnersFac.isBanned == false && bitrunnersFac.isMember == false &&
this.hacking_skill >= 600 && homeComp.maxRam >= 32) { this.hacking_skill >= 600 && homeComp.maxRam >= 32) {
invitedFactions.push("BitRunners"); invitedFactions.push(bitrunnersFac);
} }
//The Black Hand //The Black Hand
@ -240,27 +242,113 @@ PlayerObject.prototype.checkForFactionInvitations() {
if (theblackhandFac.isBanned == false && theblackhandFac.isMember == false && if (theblackhandFac.isBanned == false && theblackhandFac.isMember == false &&
this.hacking_skill >= 400 && this.strength >= 300 && this.defense >= 300 && this.hacking_skill >= 400 && this.strength >= 300 && this.defense >= 300 &&
this.agility >= 300 && this.dexterity >= 300 && homeComp.maxRam >= 16) { this.agility >= 300 && this.dexterity >= 300 && homeComp.maxRam >= 16) {
invitedFactions.push("The Black Hand"); invitedFactions.push(theblackhandFac);
} }
//NiteSec //NiteSec
var nitesecFac = Factions["NiteSec"]; var nitesecFac = Factions["NiteSec"];
if (nitesecFac.isBanned == false && nitesecFac.isMember == false && if (nitesecFac.isBanned == false && nitesecFac.isMember == false &&
this.hacking_skill >= 500 && homeComp.maxRam >= 32) { this.hacking_skill >= 500 && homeComp.maxRam >= 32) {
invitedFactions.push("NiteSec"); invitedFactions.push(nitesecFac);
} }
//Chongqing //Chongqing
var chongqingFac = Factions["Chongqing"];
if (chongqingFac.isBanned == false && chongqingFac.isMember == false &&
this.money >= 20000000 && this.location == Locations.Chongqing) {
invitedFactions.push(chongqingFac);
}
//Sector-12 //Sector-12
var sector12Fac = Factions["Sector-12"];
if (sector12Fac.isBanned == false && sector12Fac.isMember == false &&
this.money >= 50000000 && this.location == Locations.Sector12) {
invitedFactions.push(sector12Fac);
}
//New Tokyo //New Tokyo
var newtokyoFac = Factions["New Tokyo"];
if (newtokyoFac.isBanned == false && newtokyoFac.isMember == false &&
this.money >= 20000000 && this.location == Locations.NewTokyo) {
invitedFactions.push(newtokyoFac);
}
//Aevum //Aevum
var aevumFac = Factions["Aevum"];
if (aevumFac.isBanned == false && aevumFac.isMember == false &&
this.money >= 40000000 && this.location == Locations.Aevum) {
invitedFactions.push(aevumFac);
}
//Ishima //Ishima
var ishimaFac = Factions["Ishima"];
if (ishimaFac.isBanned == false && ishimaFac.isMember == false &&
this.money >= 30000000 && this.location == Locations.Ishima) {
invitedFactions.push(ishimaFac);
}
//Volhaven //Volhaven
var volhavenFac = Factions["Volhaven"];
if (volhavenFac.isBanned == false && volhavenFac.isMember == false &&
this.money >= 50000000 && this.location == Locations.Volhaven) {
invitedFactions.push(volhavenFac);
}
//Speakers for the Dead //Speakers for the Dead
var speakersforthedeadFac = Factions["Speakers for the Dead"];
if (speakersforthedeadFac.isBanned == false && speakersforthedeadFac.isMember == false &&
this.hacking_skill >= 100 && this.strength >= 300 && this.defense >= 300 &&
this.dexterity >= 300 && this.agility >= 300 && this.numPeopleKilled >= 10 &&
this.numPeopleKilledTotal >= 100 && this.companyName != Locations.Sector12CIA &&
this.companyName != Locations.Sector12NSA) {
invitedFactions.push(speakersforthedeadFac);
}
//The Dark Army //The Dark Army
var thedarkarmyFac = Factions["The Dark Army"];
if (thedarkarmyFac.isBanned == false && thedarkarmyFac.isMember == false &&
this.hacking_skill >= 300 && this.strength >= 300 && this.defense >= 300 &&
this.dexterity >= 300 && this.agility >= 300 && this.location == Locations.Chongqing &&
this.numPeopleKilled >= 5 && this.companyName != Locations.Sector12CIA &&
this.companyName != Locations.Sector12NSA) {
invitedFactions.push(thedarkarmyFac);
}
//The Syndicate //The Syndicate
var thesyndicateFac = Factions["The Syndicate"];
if (thesyndicateFac.isBanned == false && thesyndicateFac.isMember == false &&
this.hacking_skill >= 200 && this.strength >= 200 && this.defense >= 200 &&
this.dexterity >= 200 && this.agility >= 200 &&
(this.location == Locations.Aevum || this.location == Locations.Sector12) &&
this.money >= 10000000 && this.companyName != Locations.Sector12CIA &&
this.companyName != Locations.Sector12NSA) {
invitedFactions.push(thesyndicateFac);
}
//Tian Di Hui //Tian Di Hui
var tiandihuiFac = Factions["Tian Di Hui"];
if (tiandihuiFac.isBanned == false && tiandihuiFac.isMember == false &&
this.money >= 1000000 && this.hacking_skill >= 50 &&
(this.location == Locations.Chongqing || this.location == Locations.NewTokyo ||
this.location == Locations.Ishima)) {
invitedFactions.push(tiandihuiFac);
}
//CyberSec //CyberSec
var cybersecFac = Factions["CyberSec"];
if (cybersecFac.isBanned == false && cybersecFac.isMember == false &&
this.hacking_skill >= 50) {
invitedFactions.push(cybersecFac);
}
return invitedFactions;
}
inviteToFaction = function(faction) {
if (Engine.Debug) {
console.log("inviteToFaction() called with faction: " + faction.name);
}
factionInvitationBoxCreate(faction);
} }
joinFaction = function(faction) { joinFaction = function(faction) {
@ -270,6 +358,7 @@ joinFaction = function(faction) {
var item = document.createElement("li"); var item = document.createElement("li");
var aElem = document.createElement("a"); var aElem = document.createElement("a");
aElem.setAttribute("href", "#"); aElem.setAttribute("href", "#");
aElem.setAttribute("class", "a-link-button");
aElem.innerHTML = faction.name; aElem.innerHTML = faction.name;
aElem.addEventListener("click", function() { aElem.addEventListener("click", function() {
displayFactionContent(faction.name); displayFactionContent(faction.name);
@ -279,8 +368,50 @@ joinFaction = function(faction) {
var factionsList = document.getElementById("factions-list"); var factionsList = document.getElementById("factions-list");
factionsList.appendChild(item); factionsList.appendChild(item);
//Determine what factions you are banned from now that you have joined this faction
if (faction.name == "BitRunners") {
Factions["The Black Hand"].isBanned = true;
Factions["NiteSec"].isBanned = true;
} else if (faction.name == "The Black Hand") {
Factions["BitRunners"].isBanned = true;
Factions["NiteSec"].isBanned = true;
} else if (faction.name == "NiteSec") {
Factions["BitRunners"].isBanned = true;
Factions["The Black Hand"].isBanned = true;
} else if (faction.name == "Chongqing") {
Factions["Sector-12"].isBanned = true;
Factions["Aevum"].isBanned = true;
Factions["Volhaven"].isBanned = true;
} else if (faction.name == "Sector-12") {
Factions["Chongqing"].isBanned = true;
Factions["New Tokyo"].isBanned = true;
Factions["Ishima"].isBanned = true;
Factions["Volhaven"].isBanned = true;
} else if (faction.name == "New Tokyo") {
Factions["Sector-12"].isBanned = true;
Factions["Aevum"].isBanned = true;
Factions["Volhaven"].isBanned = true;
} else if (faction.name == "Aevum") {
Factions["Chongqing"].isBanned = true;
Factions["New Tokyo"].isBanned = true;
Factions["Ishima"].isBanned = true;
Factions["Volhaven"].isBanned = true;
} else if (faction.name == "Ishima") {
Factions["Sector-12"].isBanned = true;
Factions["Aevum"].isBanned = true;
Factions["Volhaven"].isBanned = true;
} else if (faction.name == "Volhaven") {
Factions["Chongqing"].isBanned = true;
Factions["Sector-12"].isBanned = true;
Factions["New Tokyo"].isBanned = true;
Factions["Aevum"].isBanned = true;
Factions["Ishima"].isBanned = true;
}
} }
//TODO Leave faction
//Displays the HTML content for this faction //Displays the HTML content for this faction
displayFactionContent = function(factionName) { displayFactionContent = function(factionName) {
var faction = Factions[factionName]; var faction = Factions[factionName];

@ -175,7 +175,8 @@ displayLocationContent = function() {
if (loc == Player.companyName) { if (loc == Player.companyName) {
var company = Companies[loc]; var company = Companies[loc];
jobTitle.style.display = "block";
jobReputation.style.display = "block";
jobTitle.innerHTML = "Job Title: " + Player.companyPosition.positionName; jobTitle.innerHTML = "Job Title: " + Player.companyPosition.positionName;
jobReputation.innerHTML = "Company reputation: " + company.playerReputation; jobReputation.innerHTML = "Company reputation: " + company.playerReputation;
work.style.display = "block"; work.style.display = "block";

@ -200,8 +200,21 @@ function evaluate(exp, workerScript) {
var ipPromise = evaluate(exp.args[0], workerScript); var ipPromise = evaluate(exp.args[0], workerScript);
ipPromise.then(function(ip) { ipPromise.then(function(ip) {
//Check if its a valid IP address. If it's not, assume its a hostname and
//try to get the server. If its not a server, there is an error
var server = null;
if (!isValidIPAddress(ip)) {
//It's not an IP address, so see if its a hostanme
server = GetServerByHostname(ip);
} else {
server = AllServers[ip];
}
if (server == null) {
resolve("Invalid IP or server hostname passed in");
//TODO LOg...or throw error or something
}
//Calculate the hacking time //Calculate the hacking time
var server = AllServers[ip];
var hackingTime = scriptCalculateHackingTime(server); //This is in seconds var hackingTime = scriptCalculateHackingTime(server); //This is in seconds
if (server.hasAdminRights == false) { if (server.hasAdminRights == false) {
@ -517,7 +530,7 @@ function scriptCalculateHackingChance(server) {
//The same as Player's calculateHackingTime() function but takes in the server as an argument //The same as Player's calculateHackingTime() function but takes in the server as an argument
function scriptCalculateHackingTime(server) { function scriptCalculateHackingTime(server) {
var difficultyMult = server.requiredHackingSkill * server.hackDifficulty; var difficultyMult = server.requiredHackingSkill * server.hackDifficulty;
var skillFactor = difficultyMult / Player.hacking_skill; var skillFactor = (difficultyMult + 500) / (Player.hacking_skill + 50);
var hackingTime = skillFactor * Player.hacking_speed_multiplier; //This is in seconds var hackingTime = skillFactor * Player.hacking_speed_multiplier; //This is in seconds
return hackingTime; return hackingTime;
} }

@ -54,6 +54,9 @@ function runScriptsLoop() {
if (w instanceof Error) { if (w instanceof Error) {
//Error text format: |serverip|scriptname|error message //Error text format: |serverip|scriptname|error message
var errorText = w.toString(); var errorText = w.toString();
if (Engine.Debug) {
console.log("Error in script: " + errorText);
}
var errorTextArray = errorText.split("|"); var errorTextArray = errorText.split("|");
if (errorTextArray.length != 4) { if (errorTextArray.length != 4) {
console.log("ERROR: Something wrong with Error text in evaluator..."); console.log("ERROR: Something wrong with Error text in evaluator...");

@ -75,6 +75,11 @@ function PlayerObject() {
//Augmentations //Augmentations
this.numAugmentations = 0; this.numAugmentations = 0;
//Misc statistics
this.numPeopleKilled = 0;
this.numPeopleKilledTotal = 0;
this.numPeopleKilledLifetime = 0;
//Achievements and achievement progress //Achievements and achievement progress
//Flag to let the engine know the player is starting an action //Flag to let the engine know the player is starting an action
@ -82,14 +87,16 @@ function PlayerObject() {
this.startAction = false; this.startAction = false;
this.actionTime = 0; this.actionTime = 0;
//Flags/variables for working //Flags/variables for working (both Company and faction)
this.isWorking = false; this.isWorking = false;
this.isWorkingForFaction = false;
this.workHackExpGainRate = 0; this.workHackExpGainRate = 0;
this.workStrExpGainRate = 0; this.workStrExpGainRate = 0;
this.workDefExpGainRate = 0; this.workDefExpGainRate = 0;
this.workDexExpGainRate = 0; this.workDexExpGainRate = 0;
this.workAgiExpGainRate = 0; this.workAgiExpGainRate = 0;
this.workChaExpGainRate = 0;
this.workRepGainRate = 0; this.workRepGainRate = 0;
this.workMoneyGainRate = 0; this.workMoneyGainRate = 0;
@ -98,6 +105,7 @@ function PlayerObject() {
this.workDefExpGained = 0; this.workDefExpGained = 0;
this.workDexExpGained = 0; this.workDexExpGained = 0;
this.workAgiExpGained = 0; this.workAgiExpGained = 0;
this.workChaExpGained = 0;
this.workRepGained = 0; this.workRepGained = 0;
this.workMoneyGained = 0; this.workMoneyGained = 0;
@ -132,7 +140,7 @@ PlayerObject.prototype.getHomeComputer = function() {
// At the maximum possible exp (MAX_INT = 9007199254740991), the hacking skill will be 1796 TODO REcalculate this // At the maximum possible exp (MAX_INT = 9007199254740991), the hacking skill will be 1796 TODO REcalculate this
// Gets to level 1000 hacking skill at (TODO Determine this) // Gets to level 1000 hacking skill at (TODO Determine this)
PlayerObject.prototype.calculateSkill = function(exp) { PlayerObject.prototype.calculateSkill = function(exp) {
return Math.max(Math.floor(32 * Math.log(exp + 112) - 150), 1); return Math.max(Math.floor(32 * Math.log(exp + 534.5) - 200), 1);
} }
PlayerObject.prototype.updateSkillLevels = function() { PlayerObject.prototype.updateSkillLevels = function() {
@ -164,7 +172,7 @@ PlayerObject.prototype.calculateHackingChance = function() {
// hacking_skill // hacking_skill
PlayerObject.prototype.calculateHackingTime = function() { PlayerObject.prototype.calculateHackingTime = function() {
var difficultyMult = this.getCurrentServer().requiredHackingSkill * this.getCurrentServer().hackDifficulty; var difficultyMult = this.getCurrentServer().requiredHackingSkill * this.getCurrentServer().hackDifficulty;
var skillFactor = difficultyMult / this.hacking_skill; var skillFactor = (difficultyMult + 500) / (this.hacking_skill + 100);
return skillFactor * this.hacking_speed_multiplier; return skillFactor * this.hacking_speed_multiplier;
} }
@ -212,18 +220,22 @@ PlayerObject.prototype.gainMoney = function(money) {
this.lifetime_money += money; this.lifetime_money += money;
} }
/* Working */ /* Working for Company */
PlayerObject.prototype.finishWork = function(cancelled) { PlayerObject.prototype.finishWork = function(cancelled) {
//Since the work was cancelled early, player only gains half of what they've earned so far //Since the work was cancelled early, player only gains half of what they've earned so far
var cancMult = 1; var cancMult = 1;
if (cancelled) { if (cancelled) {
cancMult = 2; cancMult = 2;
} }
this.hacking_exp += Math.round(this.workHackExpGained / cancMult); if (Engine.Debug) {
this.strength_exp += Math.round(this.workStrExpGained / cancMult); console.log("Player finishWork() called with " + this.workMoneyGained / cancMult + " $ gained");
this.defense_exp += Math.round(this.workDefExpGained / cancMult); }
this.dexterity_exp += Math.round(this.workDexExpGained / cancMult); this.hacking_exp += (this.workHackExpGained / cancMult);
this.agility_exp += Math.round(this.workAgiExpGained / cancMult); this.strength_exp += (this.workStrExpGained / cancMult);
this.defense_exp += (this.workDefExpGained / cancMult);
this.dexterity_exp += (this.workDexExpGained / cancMult);
this.agility_exp += (this.workAgiExpGained / cancMult);
this.charisma_exp += (this.workChaExpGained / cancMult);
var company = Companies[this.companyName]; var company = Companies[this.companyName];
company.playerReputation += (this.workRepGained / cancMult); company.playerReputation += (this.workRepGained / cancMult);
@ -243,10 +255,11 @@ PlayerObject.prototype.finishWork = function(cancelled) {
(this.workStrExpGained / cancMult).toFixed(3) + " strength exp <br>" + (this.workStrExpGained / cancMult).toFixed(3) + " strength exp <br>" +
(this.workDefExpGained / cancMult).toFixed(3) + " defense exp <br>" + (this.workDefExpGained / cancMult).toFixed(3) + " defense exp <br>" +
(this.workDexExpGained / cancMult).toFixed(3) + " dexterity exp <br>" + (this.workDexExpGained / cancMult).toFixed(3) + " dexterity exp <br>" +
(this.workAgiExpGained / cancMult).toFixed(3) + " agility exp <br>"; (this.workAgiExpGained / cancMult).toFixed(3) + " agility exp <br>" +
(this.workChaExpGained / cancMult).toFixed(3) + " charisma exp<br>";
} else { } else {
txt = "You worked a full shirt of 8 hours! <br><br> " + txt = "You worked a full shift of 8 hours! <br><br> " +
"You earned a total of: <br>" + "You earned a total of: <br>" +
"$" + (this.workMoneyGained / cancMult) + "<br>" + "$" + (this.workMoneyGained / cancMult) + "<br>" +
(this.workRepGained / cancMult) + " reputation for the company <br>" + (this.workRepGained / cancMult) + " reputation for the company <br>" +
@ -254,13 +267,16 @@ PlayerObject.prototype.finishWork = function(cancelled) {
(this.workStrExpGained / cancMult) + " strength exp <br>" + (this.workStrExpGained / cancMult) + " strength exp <br>" +
(this.workDefExpGained / cancMult) + " defense exp <br>" + (this.workDefExpGained / cancMult) + " defense exp <br>" +
(this.workDexExpGained / cancMult) + " dexterity exp <br>" + (this.workDexExpGained / cancMult) + " dexterity exp <br>" +
(this.workAgiExpGained / cancMult) + " agility exp <br>"; (this.workAgiExpGained / cancMult) + " agility exp <br>" +
(this.workChaExpGained / cancMult) + " charisma exp <br>";
} }
dialogBoxCreate(txt); dialogBoxCreate(txt);
var mainMenu = document.getElementById("mainmenu-container"); var mainMenu = document.getElementById("mainmenu-container");
mainMenu.style.visibility = "visible"; mainMenu.style.visibility = "visible";
Player.isWorking = false;
Engine.loadTerminalContent(); Engine.loadTerminalContent();
} }
@ -272,6 +288,7 @@ PlayerObject.prototype.startWork = function() {
this.workDefExpGainRate = this.getWorkDefExpGain(); this.workDefExpGainRate = this.getWorkDefExpGain();
this.workDexExpGainRate = this.getWorkDexExpGain(); this.workDexExpGainRate = this.getWorkDexExpGain();
this.workAgiExpGainRate = this.getWorkAgiExpGain(); this.workAgiExpGainRate = this.getWorkAgiExpGain();
this.workChaExpGainRate = this.getWorkChaExpGain();
this.workRepGainRate = this.getWorkRepGain(); this.workRepGainRate = this.getWorkRepGain();
this.workMoneyGainRate = this.getWorkMoneyGain(); this.workMoneyGainRate = this.getWorkMoneyGain();
@ -280,14 +297,21 @@ PlayerObject.prototype.startWork = function() {
this.workDefExpGained = 0; this.workDefExpGained = 0;
this.workDexExpGained = 0; this.workDexExpGained = 0;
this.workAgiExpGained = 0; this.workAgiExpGained = 0;
this.workChaExpGained = 0;
this.workRepGained = 0; this.workRepGained = 0;
this.workMoneyGained = 0; this.workMoneyGained = 0;
this.timeWorked = 0; this.timeWorked = 0;
var cancelButton = document.getElementById("work-in-progress-cancel-button"); var cancelButton = document.getElementById("work-in-progress-cancel-button");
cancelButton.addEventListener("click", function() {
//Remove all old event listeners from Cancel button
var newCancelButton = cancelButton.cloneNode(true);
cancelButton.parentNode.replaceChild(newCancelButton, cancelButton);
newCancelButton.addEventListener("click", function() {
Player.finishWork(true); Player.finishWork(true);
return false;
}); });
//Display Work In Progress Screen //Display Work In Progress Screen
@ -300,6 +324,7 @@ PlayerObject.prototype.work = function(numCycles) {
this.workDefExpGained += this.workDefExpGainRate * numCycles; this.workDefExpGained += this.workDefExpGainRate * numCycles;
this.workDexExpGained += this.workDexExpGainRate * numCycles; this.workDexExpGained += this.workDexExpGainRate * numCycles;
this.workAgiExpGained += this.workAgiExpGainRate * numCycles; this.workAgiExpGained += this.workAgiExpGainRate * numCycles;
this.workChaExpGained += this.workChaExpGainRate * numCycles;
this.workRepGained += this.workRepGainRate * numCycles; this.workRepGained += this.workRepGainRate * numCycles;
this.workMoneyGained += this.workMoneyGainRate * numCycles; this.workMoneyGained += this.workMoneyGainRate * numCycles;
@ -307,8 +332,17 @@ PlayerObject.prototype.work = function(numCycles) {
this.timeWorked += Engine._idleSpeed * numCycles; this.timeWorked += Engine._idleSpeed * numCycles;
//TODO If timeWorked == 8 hours, then finish //If timeWorked == 8 hours, then finish. You can only gain 8 hours worth of exp and money
if (this.timeWorked >= 28800000) { if (this.timeWorked >= 28800000) {
var maxCycles = 144000; //Number of cycles in 8 hours
this.workHackExpGained = this.workhackExpGainRate * maxCycles;
this.workStrExpGained = this.workStrExpGainRate * maxCycles;
this.workDefExpGained = this.workDefExpGainRate * maxCycles;
this.workDexExpGained = this.workDexExpGainRate * maxCycles;
this.workAgiExpGained = this.workAgiExpGainRate * maxCycles;
this.workChaExpGained = this.workChaExpGainRate * maxCycles;
this.workRepGained = this.workRepGainRate * maxCycles;
this.workMoneyGained = this.workMoneyGainRate * maxCycles;
this.finishWork(false); this.finishWork(false);
} }
@ -318,18 +352,167 @@ PlayerObject.prototype.work = function(numCycles) {
"You have been working for " + convertTimeMsToTimeElapsedString(this.timeWorked) + "<br><br>" + "You have been working for " + convertTimeMsToTimeElapsedString(this.timeWorked) + "<br><br>" +
"You have earned: <br><br>" + "You have earned: <br><br>" +
"$" + this.workMoneyGained + " (" + (this.workMoneyGainRate * cyclesPerSec).toFixed(2) + " / sec) <br><br>" + "$" + this.workMoneyGained + " (" + (this.workMoneyGainRate * cyclesPerSec).toFixed(2) + " / sec) <br><br>" +
this.workRepGained.toFixed(3) + " (" + (this.workRepGainRate * cyclesPerSec).toFixed(3) + " / sec) reputation for this company <br>" + this.workRepGained.toFixed(3) + " (" + (this.workRepGainRate * cyclesPerSec).toFixed(3) + " / sec) reputation for this company <br><br>" +
this.workHackExpGained.toFixed(3) + " (" + (this.workHackExpGainRate * cyclesPerSec).toFixed(3) + " / sec) hacking exp <br>" + this.workHackExpGained.toFixed(3) + " (" + (this.workHackExpGainRate * cyclesPerSec).toFixed(3) + " / sec) hacking exp <br><br>" +
this.workStrExpGained.toFixed(3) + " (" + (this.workStrExpGainRate * cyclesPerSec).toFixed(3) + " / sec) strength exp <br>" + this.workStrExpGained.toFixed(3) + " (" + (this.workStrExpGainRate * cyclesPerSec).toFixed(3) + " / sec) strength exp <br>" +
this.workDefExpGained.toFixed(3) + " (" + (this.workDefExpGainRate * cyclesPerSec).toFixed(3) + " / sec) defense exp <br>" + this.workDefExpGained.toFixed(3) + " (" + (this.workDefExpGainRate * cyclesPerSec).toFixed(3) + " / sec) defense exp <br>" +
this.workDexExpGained.toFixed(3) + " (" + (this.workDexExpGainRate * cyclesPerSec).toFixed(3) + " / sec) dexterity exp <br>" + this.workDexExpGained.toFixed(3) + " (" + (this.workDexExpGainRate * cyclesPerSec).toFixed(3) + " / sec) dexterity exp <br>" +
this.workAgiExpGained.toFixed(3) + " (" + (this.workAgiExpGainRate * cyclesPerSec).toFixed(3) + " / sec) agility exp <br><br> " + this.workAgiExpGained.toFixed(3) + " (" + (this.workAgiExpGainRate * cyclesPerSec).toFixed(3) + " / sec) agility exp <br><br> " +
this.workChaExpGained.toFixed(3) + " (" + (this.workChaExpGainRate * cyclesPerSec).toFixed(3) + " / sec) charisma exp <br><br>" +
"You will automatically finish after working for 8 hours. You can cancel earlier if you wish, <br>" + "You will automatically finish after working for 8 hours. You can cancel earlier if you wish, <br>" +
"but you will only gain half of the experience, money, and reputation you've earned so far." "but you will only gain half of the experience, money, and reputation you've earned so far."
} }
/* Working for Faction */
PlayerObject.prototype.finishFactionWork = function(cancelled) {
//Since the work was cancelled early, player only gains half of what they've earned so far
var cancMult = 1;
if (cancelled) {
cancMult = 2;
}
if (Engine.Debug) {
console.log("Player finishWork() called with " + this.workMoneyGained / cancMult + " $ gained");
}
this.hacking_exp += (this.workHackExpGained / cancMult);
this.strength_exp += (this.workStrExpGained / cancMult);
this.defense_exp += (this.workDefExpGained / cancMult);
this.dexterity_exp += (this.workDexExpGained / cancMult);
this.agility_exp += (this.workAgiExpGained / cancMult);
this.charisma_exp += (this.workChaExpGained / cancMult);
var company = Companies[this.companyName];
company.playerReputation += (this.workRepGained / cancMult);
this.gainMoney(this.workMoneyGained / cancMult);
this.updateSkillLevels();
var txt = "";
if (cancelled) {
txt = "You worked a short shift of " + convertTimeMsToTimeElapsedString(this.timeWorked) + " <br><br> " +
"Since you cancelled your work early, you only gained half of the experience, money, and reputation you earned. <br><br>" +
"You earned a total of: <br>" +
"$" + (this.workMoneyGained / cancMult).toFixed(2) + "<br>" +
(this.workRepGained / cancMult).toFixed(3) + " reputation for the company <br>" +
(this.workHackExpGained / cancMult).toFixed(3) + " hacking exp <br>" +
(this.workStrExpGained / cancMult).toFixed(3) + " strength exp <br>" +
(this.workDefExpGained / cancMult).toFixed(3) + " defense exp <br>" +
(this.workDexExpGained / cancMult).toFixed(3) + " dexterity exp <br>" +
(this.workAgiExpGained / cancMult).toFixed(3) + " agility exp <br>" +
(this.workChaExpGained / cancMult).toFixed(3) + " charisma exp<br>";
} else {
txt = "You worked a full shift of 8 hours! <br><br> " +
"You earned a total of: <br>" +
"$" + (this.workMoneyGained / cancMult) + "<br>" +
(this.workRepGained / cancMult) + " reputation for the company <br>" +
(this.workHackExpGained / cancMult) + " hacking exp <br>" +
(this.workStrExpGained / cancMult) + " strength exp <br>" +
(this.workDefExpGained / cancMult) + " defense exp <br>" +
(this.workDexExpGained / cancMult) + " dexterity exp <br>" +
(this.workAgiExpGained / cancMult) + " agility exp <br>" +
(this.workChaExpGained / cancMult) + " charisma exp <br>";
}
dialogBoxCreate(txt);
var mainMenu = document.getElementById("mainmenu-container");
mainMenu.style.visibility = "visible";
Player.isWorking = false;
Engine.loadTerminalContent();
}
PlayerObject.prototype.startFactionHackWork = function() {
this.isWorking = true;
this.workHackExpGainRate = this.getWorkHackExpGain();
this.workStrExpGainRate = this.getWorkStrExpGain();
this.workDefExpGainRate = this.getWorkDefExpGain();
this.workDexExpGainRate = this.getWorkDexExpGain();
this.workAgiExpGainRate = this.getWorkAgiExpGain();
this.workChaExpGainRate = this.getWorkChaExpGain();
this.workRepGainRate = this.getWorkRepGain();
this.workMoneyGainRate = this.getWorkMoneyGain();
this.workHackExpGained = 0;
this.workStrExpGained = 0;
this.workDefExpGained = 0;
this.workDexExpGained = 0;
this.workAgiExpGained = 0;
this.workChaExpGained = 0;
this.workRepGained = 0;
this.workMoneyGained = 0;
this.timeWorked = 0;
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.finishWork(true);
return false;
});
//Display Work In Progress Screen
Engine.loadWorkInProgressContent();
}
PlayerObject.prototype.workForFaction = function(numCycles) {
this.workHackExpGained += this.workHackExpGainRate * numCycles;
this.workStrExpGained += this.workStrExpGainRate * numCycles;
this.workDefExpGained += this.workDefExpGainRate * numCycles;
this.workDexExpGained += this.workDexExpGainRate * numCycles;
this.workAgiExpGained += this.workAgiExpGainRate * numCycles;
this.workChaExpGained += this.workChaExpGainRate * numCycles;
this.workRepGained += this.workRepGainRate * numCycles;
this.workMoneyGained += this.workMoneyGainRate * numCycles;
var cyclesPerSec = 1000 / Engine._idleSpeed;
this.timeWorked += Engine._idleSpeed * numCycles;
//If timeWorked == 8 hours, then finish. You can only gain 8 hours worth of exp and money
if (this.timeWorked >= 28800000) {
var maxCycles = 144000; //Number of cycles in 8 hours
this.workHackExpGained = this.workhackExpGainRate * maxCycles;
this.workStrExpGained = this.workStrExpGainRate * maxCycles;
this.workDefExpGained = this.workDefExpGainRate * maxCycles;
this.workDexExpGained = this.workDexExpGainRate * maxCycles;
this.workAgiExpGained = this.workAgiExpGainRate * maxCycles;
this.workChaExpGained = this.workChaExpGainRate * maxCycles;
this.workRepGained = this.workRepGainRate * maxCycles;
this.workMoneyGained = this.workMoneyGainRate * maxCycles;
this.finishWork(false);
}
var txt = document.getElementById("work-in-progress-text");
txt.innerHTML = "You are currently working as a " + this.companyPosition.positionName +
" at " + Player.companyName + "<br><br>" +
"You have been working for " + convertTimeMsToTimeElapsedString(this.timeWorked) + "<br><br>" +
"You have earned: <br><br>" +
"$" + this.workMoneyGained + " (" + (this.workMoneyGainRate * cyclesPerSec).toFixed(2) + " / sec) <br><br>" +
this.workRepGained.toFixed(3) + " (" + (this.workRepGainRate * cyclesPerSec).toFixed(3) + " / sec) reputation for this company <br><br>" +
this.workHackExpGained.toFixed(3) + " (" + (this.workHackExpGainRate * cyclesPerSec).toFixed(3) + " / sec) hacking exp <br><br>" +
this.workStrExpGained.toFixed(3) + " (" + (this.workStrExpGainRate * cyclesPerSec).toFixed(3) + " / sec) strength exp <br>" +
this.workDefExpGained.toFixed(3) + " (" + (this.workDefExpGainRate * cyclesPerSec).toFixed(3) + " / sec) defense exp <br>" +
this.workDexExpGained.toFixed(3) + " (" + (this.workDexExpGainRate * cyclesPerSec).toFixed(3) + " / sec) dexterity exp <br>" +
this.workAgiExpGained.toFixed(3) + " (" + (this.workAgiExpGainRate * cyclesPerSec).toFixed(3) + " / sec) agility exp <br><br> " +
this.workChaExpGained.toFixed(3) + " (" + (this.workChaExpGainRate * cyclesPerSec).toFixed(3) + " / sec) charisma exp <br><br>" +
"You will automatically finish after working for 8 hours. You can cancel earlier if you wish, <br>" +
"but you will only gain half of the experience, money, and reputation you've earned so far."
}
//Money gained per game cycle //Money gained per game cycle
PlayerObject.prototype.getWorkMoneyGain = function() { PlayerObject.prototype.getWorkMoneyGain = function() {
var company = Companies[this.companyName]; var company = Companies[this.companyName];
@ -339,9 +522,6 @@ PlayerObject.prototype.getWorkMoneyGain = function() {
//Hack exp gained per game cycle //Hack exp gained per game cycle
PlayerObject.prototype.getWorkHackExpGain = function() { PlayerObject.prototype.getWorkHackExpGain = function() {
var company = Companies[this.companyName]; var company = Companies[this.companyName];
if (Engine.Debug) {
console.log(company.companyName);
}
return this.companyPosition.hackingExpGain * company.expMultiplier * this.hacking_exp_mult; return this.companyPosition.hackingExpGain * company.expMultiplier * this.hacking_exp_mult;
} }
@ -369,6 +549,12 @@ PlayerObject.prototype.getWorkAgiExpGain = function() {
return this.companyPosition.agilityExpGain * company.expMultiplier * this.agility_exp_mult; return this.companyPosition.agilityExpGain * company.expMultiplier * this.agility_exp_mult;
} }
//Charisma exp gained per game cycle
PlayerObject.prototype.getWorkChaExpGain = function() {
var company = Companies[this.companyName];
return this.companyPosition.charismaExpGain * company.expMultiplier * this.charisma_exp_mult;
}
//Reputation gained per game cycle //Reputation gained per game cycle
PlayerObject.prototype.getWorkRepGain = function() { PlayerObject.prototype.getWorkRepGain = function() {
return this.companyPosition.calculateJobPerformance(this.hacking_skill, this.strength, return this.companyPosition.calculateJobPerformance(this.hacking_skill, this.strength,

@ -14,11 +14,18 @@ purchaseServer = function(ram, cost) {
return; return;
} }
newServ.init(createRandomIp(), hostname, "", true, false, true, true, ram);
//Create server
newServ.init(createRandomIp(), hostname, "", true, false, true, true, ram);
AddToAllServers(newServ); AddToAllServers(newServ);
//Add to Player's purchasedServers array
Player.purchasedServers.push(newServ); Player.purchasedServers.push(newServ);
//Connect new server to home computer
var homeComputer = Player.getHomeComputer();
homeComputer.serversOnNetwork.push(newServ);
Player.money -= cost; Player.money -= cost;
dialogBoxCreate("Server successfully purchased with hostname " + hostname); dialogBoxCreate("Server successfully purchased with hostname " + hostname);

@ -183,7 +183,7 @@ initForeignServers = function() {
FulcrumSecretTechnologiesServer.setPortProperties(5); FulcrumSecretTechnologiesServer.setPortProperties(5);
AddToAllServers(FulcrumSecretTechnologiesServer); AddToAllServers(FulcrumSecretTechnologiesServer);
SpecialServerIps.fulcrumSecretServer = FulcrumSecretTechnologiesServer.ip; SpecialServerIps.addIp("Fulcrum Secret Technologies Server", FulcrumSecretTechnologiesServer.ip);
var StormTechnologiesServer = new Server(); var StormTechnologiesServer = new Server();
StormTechnologiesServer.init(createRandomIp(), "stormtech", "Storm Technologies", true, false, false, false, 256); StormTechnologiesServer.init(createRandomIp(), "stormtech", "Storm Technologies", true, false, false, false, 256);

@ -1,5 +1,19 @@
/* Holds IP of Special Servers */ /* Holds IP of Special Servers */
SpecialServerIps = { function SpecialServerIpsMap() {
fulcrumSecretServer: "", }
}; SpecialServerIpsMap.prototype.addIp = function(name, ip) {
this[name] = ip;
}
SpecialServerIpsMap.prototype.toJSON = function() {
return Generic_toJSON("SpecialServerIpsMap", this);
}
SpecialServerIpsMap.fromJSON = function(value) {
return Generic_fromJSON(SpecialServerIpsMap, value.data);
}
Reviver.constructors.SpecialServerIpsMap = SpecialServerIpsMap();
SpecialServerIps = null;

@ -340,7 +340,7 @@ var Terminal = {
//Can only edit script files //Can only edit script files
if (filename.endsWith(".script") == false) { if (filename.endsWith(".script") == false) {
post("Error: Only .script files are editable with nano (filename must end with .scrip)"); return; post("Error: Only .script files are editable with nano (filename must end with .script)"); return;
} }
//Script name is the filename without the .script at the end //Script name is the filename without the .script at the end
@ -448,7 +448,7 @@ var Terminal = {
return; return;
} }
} }
post("ERROR: No such executable on home computer (Programs can only be run from home computer)"); post("ERROR: No such executable on home computer (Only programs that exist on your home computer can be run)");
}, },
//Contains the implementations of all possible programs //Contains the implementations of all possible programs

@ -61,6 +61,7 @@ var Engine = {
Augmentations: "Augmentations", Augmentations: "Augmentations",
Tutorial: "Tutorial", Tutorial: "Tutorial",
Location: "Location", Location: "Location",
workInProgress: "WorkInProgress",
}, },
currentPage: null, currentPage: null,
@ -75,12 +76,14 @@ var Engine = {
var AllServersSave = JSON.stringify(AllServers); var AllServersSave = JSON.stringify(AllServers);
var CompaniesSave = JSON.stringify(Companies); var CompaniesSave = JSON.stringify(Companies);
var FactionsSave = JSON.stringify(Factions); var FactionsSave = JSON.stringify(Factions);
//TODO Add factions + companies here when they're done var SpecialServerIpsSave = JSON.stringify(SpecialServerIps);
window.localStorage.setItem("netburnerPlayerSave", PlayerSave); window.localStorage.setItem("netburnerPlayerSave", PlayerSave);
window.localStorage.setItem("netburnerAllServersSave", AllServersSave); window.localStorage.setItem("netburnerAllServersSave", AllServersSave);
window.localStorage.setItem("netburnerCompaniesSave", CompaniesSave); window.localStorage.setItem("netburnerCompaniesSave", CompaniesSave);
window.localStorage.setItem("netburnerFactionsSave", FactionsSave); window.localStorage.setItem("netburnerFactionsSave", FactionsSave);
window.localStorage.setItem("netburnerSpecialServerIpsSave", SpecialServerIpsSave);
console.log("Game saved to local storage"); console.log("Game saved to local storage");
}, },
@ -99,15 +102,21 @@ var Engine = {
} else if (!window.localStorage.getItem("netburnerFactionsSave")) { } else if (!window.localStorage.getItem("netburnerFactionsSave")) {
console.log("No Factions save to load"); console.log("No Factions save to load");
return false; return false;
} else if (!window.localStorage.getItem("netburnerSpecialServerIpsSave")) {
console.log("No Special Server Ips save to load");
return false;
} else { } else {
var PlayerSave = window.localStorage.getItem("netburnerPlayerSave"); var PlayerSave = window.localStorage.getItem("netburnerPlayerSave");
var AllServersSave = window.localStorage.getItem("netburnerAllServersSave"); var AllServersSave = window.localStorage.getItem("netburnerAllServersSave");
var CompaniesSave = window.localStorage.getItem("netburnerCompaniesSave"); var CompaniesSave = window.localStorage.getItem("netburnerCompaniesSave");
var FactionsSave = window.localStorage.getItem("netburnerFactionsSave"); var FactionsSave = window.localStorage.getItem("netburnerFactionsSave");
var SpecialServerIpsSave = window.localStorage.getItem("netburnerSpecialServerIpsSave");
Player = JSON.parse(PlayerSave, Reviver); Player = JSON.parse(PlayerSave, Reviver);
AllServers = JSON.parse(AllServersSave, Reviver); AllServers = JSON.parse(AllServersSave, Reviver);
Companies = JSON.parse(CompaniesSave, Reviver); Companies = JSON.parse(CompaniesSave, Reviver);
Factions = JSON.parse(FactionsSave, Reviver); Factions = JSON.parse(FactionsSave, Reviver);
SpecialServerIps = JSON.parse(SpecialServerIpsSave, Reviver);
return true; return true;
} }
}, },
@ -116,25 +125,24 @@ var Engine = {
deleteSave: function() { deleteSave: function() {
//TODO if a save doesn't exist..maybe I shouldn't return? I just keep going //TODO if a save doesn't exist..maybe I shouldn't return? I just keep going
//or else nothing gets deleted. TODO Fix this //or else nothing gets deleted. TODO Fix this
if (!window.localStorage.getItem("netburnerPlayerSave")) { if (window.localStorage.getItem("netburnerPlayerSave")) {
console.log("No Player Save to delete"); window.localStorage.removeItem("netburnerPlayerSave");
return false; }
} else if (!window.localStorage.getItem("netburnerAllServersSave")) {
console.log("No AllServers Save to delete"); if (window.localStorage.getItem("netburnerAllServersSave")) {
return false;
} else if (!window.localStorage.getItem("netburnerCompaniesSave")) {
console.log("No Companies Save to delete");
return false;
} else if (!window.localStorage.getItem("netburnerFactionsSave")) {
console.log("No Factions Save to delete");
return false;
} else {
window.localStorage.removeItem("netburnerPlayerSave");
window.localStorage.removeItem("netburnerAllServersSave"); window.localStorage.removeItem("netburnerAllServersSave");
}
if (window.localStorage.getItem("netburnerCompaniesSave")) {
window.localStorage.removeItem("netburnerCompaniesSave"); window.localStorage.removeItem("netburnerCompaniesSave");
}
if (window.localStorage.getItem("netburnerFactionsSave")) {
window.localStorage.removeItem("netburnerFactionsSave"); window.localStorage.removeItem("netburnerFactionsSave");
console.log("Deleted saves") }
return true;
if (window.localStorage.getItem("netburnerSpecialServerIpsSave")) {
window.localStorage.removeItem("netburnerSpecialServerIpsSave");
} }
}, },
@ -230,6 +238,7 @@ var Engine = {
Engine.Display.workInProgressContent.style.visibility = "visible"; Engine.Display.workInProgressContent.style.visibility = "visible";
Engine.currentPage = Engine.Page.WorkInProgress;
}, },
//Helper function that hides all content //Helper function that hides all content
@ -273,7 +282,12 @@ var Engine = {
'Agility: ' + Player.agility + '<br><br>' + 'Agility: ' + Player.agility + '<br><br>' +
'Charisma: ' + Player.charisma + '<br><br>' + 'Charisma: ' + Player.charisma + '<br><br>' +
'Servers owned: ' + Player.purchasedServers.length + '<br><br>' + 'Servers owned: ' + Player.purchasedServers.length + '<br><br>' +
'Hacking Experience: ' + Player.hacking_exp.toFixed(4) + '<br><br>'; 'Hacking experience: ' + Player.hacking_exp.toFixed(4) + '<br><br>' +
'Strength experience: ' + Player.strength_exp.toFixed(4) + '<br><br>' +
'Defense experience: ' + Player.defense_exp.toFixed(4) + '<br><br>' +
'Dexterity experience: ' + Player.dexterity_exp.toFixed(4) + '<br><br>' +
'Agility experience: ' + Player.agility_exp.toFixed(4) + '<br><br>' +
'Charisma experience: ' + Player.charisma_exp.toFixed(4) + '<br><br>';
}, },
/* Display locations in the world*/ /* Display locations in the world*/
@ -457,9 +471,11 @@ var Engine = {
//for something to happen. //for something to happen.
Counters: { Counters: {
autoSaveCounter: 300, //Autosave every minute autoSaveCounter: 300, //Autosave every minute
updateSkillLevelsCounter: 10, //Only update skill levels every 2 seconds. Might improve performance updateSkillLevelsCounter: 10, //Only update skill levels every 2 seconds. Might improve performance
updateDisplays: 10, //Update displays such as Active Scripts display and character display updateDisplays: 10, //Update displays such as Active Scripts display and character display
serverGrowth: 450, //Process server growth every minute and a half serverGrowth: 450, //Process server growth every minute and a half
//checkFactionInvitations: 1500, //Check whether you qualify for any faction invitations every 5 minutes
checkFactionInvitations: 30,
}, },
decrementAllCounters: function(numCycles = 1) { decrementAllCounters: function(numCycles = 1) {
@ -498,6 +514,15 @@ var Engine = {
processServerGrowth(numCycles); processServerGrowth(numCycles);
Engine.Counters.serverGrowth = 450; Engine.Counters.serverGrowth = 450;
} }
if (Engine.Counters.checkFactionInvitations <= 0) {
var invitedFactions = Player.checkForFactionInvitations();
if (invitedFactions.length > 0) {
var randFaction = invitedFactions[Math.floor(Math.random() * invitedFactions.length)];
inviteToFaction(randFaction);
}
Engine.Counters.checkFactionInvitations = 1500;
}
}, },
/* Calculates the hack progress for a manual (non-scripted) hack and updates the progress bar/time accordingly */ /* Calculates the hack progress for a manual (non-scripted) hack and updates the progress bar/time accordingly */
@ -536,28 +561,6 @@ var Engine = {
/* Initialization */ /* Initialization */
init: function() { init: function() {
//Initialization functions
if (Engine.loadSave()) {
console.log("Loaded game from save");
CompanyPositions.init();
//Calculate the number of cycles have elapsed while offline
var thisUpdate = new Date().getTime();
var lastUpdate = Player.lastUpdate;
var numCyclesOffline = Math.floor((thisUpdate - lastUpdate) / Engine._idleSpeed);
processServerGrowth(numCyclesOffline); //Should be done before offline production for scripts
loadAllRunningScripts(); //This also takes care of offline production for those scripts
} else {
//No save found, start new game
console.log("Initializing new game");
Player.init();
initForeignServers();
initCompanies();
initFactions();
CompanyPositions.init();
}
//Main menu buttons and content //Main menu buttons and content
Engine.Clickables.terminalMainMenuButton = document.getElementById("terminal-menu-link"); Engine.Clickables.terminalMainMenuButton = document.getElementById("terminal-menu-link");
Engine.Clickables.terminalMainMenuButton.addEventListener("click", function() { Engine.Clickables.terminalMainMenuButton.addEventListener("click", function() {
@ -684,12 +687,48 @@ var Engine = {
//Script editor //Script editor
Engine.Display.scriptEditorText = document.getElementById("script-editor-text"); Engine.Display.scriptEditorText = document.getElementById("script-editor-text");
//Load game from save or create new game
if (Engine.loadSave()) {
console.log("Loaded game from save");
CompanyPositions.init();
//Calculate the number of cycles have elapsed while offline
var thisUpdate = new Date().getTime();
var lastUpdate = Player.lastUpdate;
var numCyclesOffline = Math.floor((thisUpdate - lastUpdate) / Engine._idleSpeed);
processServerGrowth(numCyclesOffline); //Should be done before offline production for scripts
loadAllRunningScripts(); //This also takes care of offline production for those scripts
Player.work(numCyclesOffline);
} else {
//No save found, start new game
console.log("Initializing new game");
SpecialServerIps = new SpecialServerIpsMap();
Player.init();
initForeignServers();
initCompanies();
initFactions();
CompanyPositions.init();
}
//Message at the top of terminal //Message at the top of terminal
postNetburnerText(); postNetburnerText();
//Player was working
if (Player.isWorking) {
var cancelButton = document.getElementById("work-in-progress-cancel-button");
cancelButton.addEventListener("click", function() {
Player.finishWork(true);
});
Engine.loadWorkInProgressContent();
}
//Run main loop //Run main loop
Engine.idleTimer(); Engine.idleTimer();
//Scripts
runScriptsLoop(); runScriptsLoop();
} }
}; };

@ -0,0 +1,50 @@
/* Faction Invitation Pop-up box */
function factionInvitationBoxInit() {
if (Engine.Debug) {
console.log("Faction Invitation Box Initialized");
}
var cancelButton = document.getElementById("faction-invitation-box-no");
//Close Dialog box
cancelButton.addEventListener("click", function() {
factionInvitationBoxClose();
return false;
});
};
document.addEventListener("DOMContentLoaded", factionInvitationBoxInit, false);
factionInvitationBoxClose = function() {
var factionInvitationBox = document.getElementById("faction-invitation-box-container");
factionInvitationBox.style.display = "none";
}
factionInvitationBoxOpen = function() {
var factionInvitationBox = document.getElementById("faction-invitation-box-container");
factionInvitationBox.style.display = "block";
}
factionInvitationSetText = function(txt) {
var textBox = document.getElementById("faction-invitation-box-text");
textBox.innerHTML = txt;
}
factionInvitationSetMessage = function(msg) {
var msgBox = document.getElementById("faction-invitation-box-message");
msgBox.innerHTML = msg;
}
//ram argument is in GB
factionInvitationBoxCreate = function(faction) {
factionInvitationSetText("You have received a faction invitation from " + faction.name);
//TODO Faction invitation message
var yesButton = document.getElementById("faction-invitation-box-yes");
yesButton.addEventListener("click", function() {
joinFaction(faction);
factionInvitationBoxClose();
return false;
});
factionInvitationBoxOpen();
}