Display Faction content, including Augmentations. Added requirements for Augmentations. Created PurchaseAugmentationBox.js. Next step is to create the reset function needed for prestiging

This commit is contained in:
Daniel Xie 2017-02-17 16:19:25 -06:00
parent 0ed3d65ae5
commit 4a60874a3a
9 changed files with 703 additions and 345 deletions

@ -100,6 +100,56 @@
cursor: pointer; cursor: pointer;
} }
/* Purchase Invitation Box */
#purchase-augmentation-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-augmentation-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-augmentation-box-confirm,
#purchase-augmentation-box-cancel {
color: #aaa;
float: right;
font-size: 16px;
font-weight: bold;
padding: 2px;
border: 1px solid white;
}
#purchase-augmentation-box-confirm:hover,
#purchase-augmentation-box-confirm:focus {
color: #66ff33;
text-decoration: none;
cursor: pointer;
}
#purchase-augmentation-box-cancel:hover,
#purchase-augmentation-box-cancel:focus {
color: #66ff33;
text-decoration: none;
cursor: pointer;
}
/* Faction invitation box */ /* Faction invitation box */
#faction-invitation-box-container { #faction-invitation-box-container {
display: none; /* Hidden by default */ display: none; /* Hidden by default */

@ -68,3 +68,17 @@ h1 {
border-left: 1px solid #333333; border-left: 1px solid #333333;
} }
/* Make anchor tags ("a" elements) inactive (not clickable) */
.a-link-button-inactive {
text-decoration: none;
background-color: #555;
color: #FFFFFF;
padding: 4px 4px 4px 4px;
border-top: 1px solid #333333;
border-right: 1px solid #333333;
border-bottom: 1px solid #333333;
border-left: 1px solid #333333;
pointer-events: none;
cursor: default;
}

@ -21,6 +21,7 @@
<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> <script src="utils/FactionInvitationBox.js"></script>
<script src="utils/PurchaseAugmentationBox.js"></script>
<!-- Netscript --> <!-- Netscript -->
<script src="src/netscript/NetScriptWorker.js"></script> <script src="src/netscript/NetScriptWorker.js"></script>
@ -325,26 +326,51 @@
</p> </p>
<div id="faction-hack-div"> <div id="faction-hack-div">
<div id="faction-hack-button-div"><button id="faction-hack-button"> Hacking Contracts </button></div> <a href="#" id="faction-hack-button" class="a-link-button">Hacking Contracts</a>
<p id="faction-hack-text">Complete hacking contracts for your faction! Speed and effectiveness determined by hacking skill. Gain hacking exp.</p> <p id="faction-hack-text">
Complete hacking contracts for your faction! <br>
Your effectiveness, which determines how much reputation you gain for this faction, is based on your hacking skill. <br>
Gain hacking exp.
</p>
<div id="faction-hack-text-div"> <div id="faction-hack-text-div">
</div> </div>
</div> </div>
<div id="faction-fieldwork-div"> <div id="faction-fieldwork-div">
<div id="faction-fieldwork-button-div"><button id="faction-fieldwork-button"> Field Work </button></div> <a href="#" id="faction-fieldwork-button" class="a-link-button">Field Work</a>
<div id="faction-fieldwork-text-div"> <div id="faction-fieldwork-text-div">
<p id="faction-fieldwork-text">Carry out field missions for your faction. Speed and effectiveness determined by all stats. Gains exp for all stats.</p> <p id="faction-fieldwork-text">
Carry out field missions for your faction. <br>
Your effectiveness, which determines how much reputation you gain for this faction, is based on all of your stats. <br>
Gains exp for all stats.
</p>
</div> </div>
</div> </div>
<div id="faction-securitywork-div"> <div id="faction-securitywork-div">
<div id="faction-securitywork-button-div"><button id="faction-securitywork-button"> Security Work </button></div> <a href="#" id="faction-securitywork-button" class="a-link-button">Security Work</a>
<div id="faction-securitywork-text-div"> <div id="faction-securitywork-text-div">
<p id="faction-securitywork-text">Serve in a security detail for your faction. Speed and effectiveness determined by combat stats. Gains exp for all combat stats.</p> <p id="faction-securitywork-text">
Serve in a security detail for your faction. <br>
Your effectiveness, which determines how much reputation you gain for this faction, is based on your combat stats. <br>
Gains exp for all combat stats.
</p>
</div> </div>
</div> </div>
<p>
As your reputation with this faction rises, you will unlock Augmentations, which you
can purchase to enhance your abilities.
</p>
<a href="#" id="faction-purchase-augmentations" class="a-link-button">Purchase Augmentations</a>
</div> </div>
<div id="faction-augmentations-container">
<h1 id> Faction Augmentations </h1>
<p id="faction-augmentations-page-desc"> Lists all augmentations that are available from </p>
<ul class="factions-augmentations-list" id="factions-augmentations-list">
</ul>
</div>
<!-- Installed augmentations --> <!-- Installed augmentations -->
<div id="augmentations-container"> <div id="augmentations-container">
@ -425,6 +451,24 @@
<span id="purchase-server-box-cancel"> Cancel </span> <span id="purchase-server-box-cancel"> Cancel </span>
</div> </div>
</div> </div>
<!-- Purchase Augmentation Pop-up Box -->
<div id="purchase-augmentation-box-container">
<div id="purchase-augmentation-box-content">
<p id="purchase-augmentation-box-text"> </p>
<p> WARNING: Purchasing an Augmentation resets most of your progress, including: <br>
Stats/Skill levels and Experience <br>
Money <br>
Scripts <br>
Faction/Company reputation <br><br>
Purchasing an Augmentation lets you start over with the perks and benefits granted by all
of the Augmentations you have ever purchased (purchasing an Augmentation does not reset the benefits
of Augmentations you have previously purchased).
<p>
<span id="purchase-augmentation-box-confirm"> Purchase </span>
<span id="purchase-augmentation-box-cancel"> Cancel </span>
</div>
</div>
<!-- Faction Invitation Pop-up Box --> <!-- Faction Invitation Pop-up Box -->
<div id="faction-invitation-box-container"> <div id="faction-invitation-box-container">

@ -1,31 +1,41 @@
//Augmentations //Augmentations
function Augmentation(name) { function Augmentation(name) {
this.name = name; this.name = name;
this.info = ""; this.info = "";
this.owned = false; //Whether the player has it (you can only have each augmentation once) this.owned = false; //Whether the player has it (you can only have each augmentation once)
this.factionInstalledBy = ""; //Which faction the Player got this from
//Price and reputation base requirements (can change based on faction multipliers)
this.baseRepRequirement = 0;
this.baseCost = 0;
} }
Augmentation.prototype.setInfo(inf) { Augmentation.prototype.setInfo(inf) {
this.info = inf; this.info = inf;
}
Augmentation.prototype.setRequirements(rep, cost) {
this.baseRepRequirement = rep;
this.baseCost = cost;
} }
//Takes in an array of faction names and adds this augmentation to all of those factions //Takes in an array of faction names and adds this augmentation to all of those factions
Augmentation.prototype.addToFactions(factionList) { Augmentation.prototype.addToFactions(factionList) {
for (var i = 0; i < factionList.length; ++i) { for (var i = 0; i < factionList.length; ++i) {
var faction = Factions[factionList[i]]; var faction = Factions[factionList[i]];
if (faction = null) { if (faction = null) {
console.log("Error: Could not find faction with this name"); console.log("Error: Could not find faction with this name");
} }
faction.augmentations.push(this.name); faction.augmentations.push(this.name);
} }
} }
Augmentation.prototype.toJSON = function() { Augmentation.prototype.toJSON = function() {
return Generic_toJSON("Augmentation", this); return Generic_toJSON("Augmentation", this);
} }
Augmentation.fromJSON = function(value) { Augmentation.fromJSON = function(value) {
return Generic_fromJSON(Augmentation, value.data); return Generic_fromJSON(Augmentation, value.data);
} }
Reviver.constructors.Augmentation = Augmentation; Reviver.constructors.Augmentation = Augmentation;
@ -33,312 +43,353 @@ Reviver.constructors.Augmentation = Augmentation;
Augmentations = {} Augmentations = {}
AddToAugmentations = function(aug) { AddToAugmentations = function(aug) {
var name = aug.name; var name = aug.name;
Augmentations[name] = aug; Augmentations[name] = aug;
} }
//TODO Set descriptions for all //TODO Set descriptions for all
//TODO Something that decreases RAM usage of scripts //TODO Something that decreases RAM usage of scripts
//TODO SOmething that increases rate at which you gain faction respect //TODO SOmething that increases rate at which you gain faction respect
// Similarly. something that helps you gain company reputation // Similarly. something that helps you gain company reputation
initAugmentations = function() { initAugmentations = function() {
//Combat stat augmentations //Combat stat augmentations
var Targeting1 = new Augmentation("Augmented Targeting I"); var Targeting1 = new Augmentation("Augmented Targeting I");
Targeting1.addToFactions("The Dark Army", "The Syndicate", "Sector-12", "Volhaven", "Ishima", Targeting1.setRequirements(36000, 10000000);
"OmniTek Incorporated", "KuaiGong International", "Blade Industries"); Targeting1.addToFactions("The Dark Army", "The Syndicate", "Sector-12", "Volhaven", "Ishima",
AddToAugmentations(Targeting1); "OmniTek Incorporated", "KuaiGong International", "Blade Industries");
AddToAugmentations(Targeting1);
var Targeting2 = new Augmentation("Augmented Targeting II");
Targeting2.addToFactions("The Dark Army", "The Syndicate", "Sector-12", "Volhaven", "Ishima",
"OmniTek Incorporated", "KuaiGong International", "Blade Industries");
AddToAugmentations(Targeting2);
var Targeting3 = new Augmentation("Augmented Targeting III");
Targeting3.addToFactions("The Dark Army", "The Syndicate", "OmniTek Incorporated",
"KuaiGong International", "Blade Industries", "The Covenant");
AddToAugmentations(Targeting3);
var SyntheticHeart = new Augmentation("Synthetic Heart");
SyntheticHeart.addToFactions("KuaiGong International", "Fulcrum Secret Technologies", "Speakers for the Dead",
"NWO", "The Covenant", "Daedalus", "Illuminati");
AddToAugmentations(SyntheticHeart);
var SynfibrilMuscle = new Augmentation("Synfibril Muscle"); var Targeting2 = new Augmentation("Augmented Targeting II");
SynfibrilMuscle.addToFactions("KuaiGong International", "Fulcrum Secret Technologies", "Speakers for the Dead", Targeting2.setRequirements(72000, 20000000);
"NWO", "The Covenant", "Daedalus", "Illuminati", "Blade Industries"); Targeting2.addToFactions("The Dark Army", "The Syndicate", "Sector-12", "Volhaven", "Ishima",
AddToAugmentations(SynfibrilMuscle) "OmniTek Incorporated", "KuaiGong International", "Blade Industries");
AddToAugmentations(Targeting2);
var CombatRib1 = new Augmentation("Combat Rib I");
CombatRib1.addToFactions("The Dark Army", "The Syndicate", "Sector-12", "Volhaven", "Ishima", var Targeting3 = new Augmentation("Augmented Targeting III");
"OmniTek Incorporated", "KuaiGong International", "Blade Industries"); Targeting3.setRequirements(144000, 50000000);
AddToAugmentations(CombatRib1); Targeting3.addToFactions("The Dark Army", "The Syndicate", "OmniTek Incorporated",
"KuaiGong International", "Blade Industries", "The Covenant");
var CombatRib2 = new Augmentation("Combat Rib II"); AddToAugmentations(Targeting3);
CombatRib2.addToFactions("The Dark Army", "The Syndicate", "Sector-12", "Volhaven", "Ishima",
"OmniTek Incorporated", "KuaiGong International", "Blade Industries"); var SyntheticHeart = new Augmentation("Synthetic Heart");
AddToAugmentations(CombatRib2); SyntheticHeart.setRequirements(1000000, 500000000);
SyntheticHeart.addToFactions("KuaiGong International", "Fulcrum Secret Technologies", "Speakers for the Dead",
var CombatRib3 = new Augmentation("Combat Rib III"); "NWO", "The Covenant", "Daedalus", "Illuminati");
CombatRib3.addToFactions("The Dark Army", "The Syndicate", "OmniTek Incorporated", AddToAugmentations(SyntheticHeart);
"KuaiGong International", "Blade Industries", "The Covenant");
AddToAugmentations(CombatRib3); var SynfibrilMuscle = new Augmentation("Synfibril Muscle");
SynfibrilMuscle.setRequirements(900000, 400000000);
var NanofiberWeave = new Augmentation("Nanofiber Weave"); SynfibrilMuscle.addToFactions("KuaiGong International", "Fulcrum Secret Technologies", "Speakers for the Dead",
NanofiberWeave.addToFactions("Tian Di Hui", "The Syndicate", "The Dark Army", "Speakers for the Dead", "NWO", "The Covenant", "Daedalus", "Illuminati", "Blade Industries");
"Blade Industries", "Fulcrum Secret Technologies", "OmniTek Incorporated"); AddToAugmentations(SynfibrilMuscle)
AddToAugmentations(NanofiberWeave);
var CombatRib1 = new Augmentation("Combat Rib I");
var SubdermalArmor = new Augmentation("NEMEAN Subdermal Weave"); CombatRib1.setRequirements(50000, 15000000);
SubdermalArmor.addToFactions("The Syndicate", "Fulcrum Secret Technologies", "Illuminati", "Daedalus", CombatRib1.addToFactions("The Dark Army", "The Syndicate", "Sector-12", "Volhaven", "Ishima",
"The Covenant"); "OmniTek Incorporated", "KuaiGong International", "Blade Industries");
AddToAugmentations(SubdermalArmor); AddToAugmentations(CombatRib1);
var WiredReflexes = new Augmentation("Wired Reflexes"); var CombatRib2 = new Augmentation("Combat Rib II");
WiredReflexes.addToFactions("Tian Di Hui", "Sector-12", "Volhaven", "Aevum", "Ishima", CombatRib2.setRequirements.setRequirements(100000, 40000000);
"The Syndicate", "The Dark Army", "Speakers for the Dead"); CombatRib2.addToFactions("The Dark Army", "The Syndicate", "Sector-12", "Volhaven", "Ishima",
AddToAugmentations(WiredReflexes); "OmniTek Incorporated", "KuaiGong International", "Blade Industries");
AddToAugmentations(CombatRib2);
var GrapheneBoneLacings = new Augmentation("Graphene Bone Lacings");
GrapheneBoneLacings.addToFactions("Fulcrum Secret Technologies", "The Covenant"); var CombatRib3 = new Augmentation("Combat Rib III");
AddToAugmentations(GrapheneBoneLacings); CombatRib3.setRequirements(200000, 100000000);
CombatRib3.addToFactions("The Dark Army", "The Syndicate", "OmniTek Incorporated",
var BionicSpine = new Augmentation("Bionic Spine"); "KuaiGong International", "Blade Industries", "The Covenant");
BionicSpine.addToFactions("Speakers for the Dead", "The Syndicate", "KuaiGong International", AddToAugmentations(CombatRib3);
"OmniTek Incorporated", "Blade Industries");
AddToAugmentations(BionicSpine); var NanofiberWeave = new Augmentation("Nanofiber Weave");
NanofiberWeave.setRequirements(400000, 250000000);
var GrapheneBionicSpine = new Augmentation("Graphene Bionic Spine Upgrade"); NanofiberWeave.addToFactions("Tian Di Hui", "The Syndicate", "The Dark Army", "Speakers for the Dead",
GrapheneBionicSpine.addToFactions("Fulcrum Secret Technologies", "ECorp"); "Blade Industries", "Fulcrum Secret Technologies", "OmniTek Incorporated");
AddToAugmentations(GrapheneBionicSpine); AddToAugmentations(NanofiberWeave);
var SubdermalArmor = new Augmentation("NEMEAN Subdermal Weave");
SubdermalArmor.setRequirements(1000000, 750000000);
SubdermalArmor.addToFactions("The Syndicate", "Fulcrum Secret Technologies", "Illuminati", "Daedalus",
"The Covenant");
AddToAugmentations(SubdermalArmor);
var WiredReflexes = new Augmentation("Wired Reflexes");
WiredReflexes.setRequirements(36000, 10000000);
WiredReflexes.addToFactions("Tian Di Hui", "Sector-12", "Volhaven", "Aevum", "Ishima",
"The Syndicate", "The Dark Army", "Speakers for the Dead");
AddToAugmentations(WiredReflexes);
var GrapheneBoneLacings = new Augmentation("Graphene Bone Lacings");
GrapheneBoneLacings.setRequirements(1500000, 1000000000);
GrapheneBoneLacings.addToFactions("Fulcrum Secret Technologies", "The Covenant");
AddToAugmentations(GrapheneBoneLacings);
var BionicSpine = new Augmentation("Bionic Spine");
BionicSpine.setRequirements(250000, 75000000);
BionicSpine.addToFactions("Speakers for the Dead", "The Syndicate", "KuaiGong International",
"OmniTek Incorporated", "Blade Industries");
AddToAugmentations(BionicSpine);
var GrapheneBionicSpine = new Augmentation("Graphene Bionic Spine Upgrade");
GrapheneBionicSpine.setRequirements(1200000, 1000000000);
GrapheneBionicSpine.addToFactions("Fulcrum Secret Technologies", "ECorp");
AddToAugmentations(GrapheneBionicSpine);
var BionicLegs = new Augmentation("Bionic Legs"); var BionicLegs = new Augmentation("Bionic Legs");
BionicLegs.addToFactions("Speakers for the Dead", "The Syndicate", "KuaiGong International", BionicLegs.setRequirements(200000, 60000000);
"OmniTek Incorporated", "Blade Industries"); BionicLegs.addToFactions("Speakers for the Dead", "The Syndicate", "KuaiGong International",
"OmniTek Incorporated", "Blade Industries");
AddToAugmentations(BionicLegs); AddToAugmentations(BionicLegs);
var GrapheneBionicLegs = new Augmentation("Graphene Bionic Legs Upgrade"); var GrapheneBionicLegs = new Augmentation("Graphene Bionic Legs Upgrade");
GrapheneBionicLegs.addToFactions("MegaCorp", "ECorp", "Fulcrum Secret Technologies"); GrapheneBionicLegs.setRequirements(1000000, 900000000);
GrapheneBionicLegs.addToFactions("MegaCorp", "ECorp", "Fulcrum Secret Technologies");
AddToAugmentations(GrapheneBionicLegs); AddToAugmentations(GrapheneBionicLegs);
//Labor stat augmentations //Labor stat augmentations
var SpeechProcessor = new Augmentation("Speech Processor Implant"); //Cochlear imlant? var SpeechProcessor = new Augmentation("Speech Processor Implant"); //Cochlear imlant?
SpeechProcessor.addToFactions("Tian Di Hui", "Chongqing", "Sector-12", "New Tokyo", "Aevum", SpeechProcessor.setRequirements(50000, 15000000);
"Ishima", "Volhaven"); SpeechProcessor.addToFactions("Tian Di Hui", "Chongqing", "Sector-12", "New Tokyo", "Aevum",
AddToAugmentations(SpeechProcessor); "Ishima", "Volhaven");
AddToAugmentations(SpeechProcessor);
var EnhancedSocialInteractionImplant = new Augmentation("Enhanced Social Interaction Implant");
EnhancedSocialInteractionImplant.addToFactions("Bachman & Associates", "NWO", "Clarke Incorporated", var EnhancedSocialInteractionImplant = new Augmentation("Enhanced Social Interaction Implant");
"OmniTek Incorporated", "Four Sigma"); EnhancedSocialInteractionImplant.setRequirements(750000, 500000000);
AddToAugmentations(EnhancedSocialInteractionImplant); EnhancedSocialInteractionImplant.addToFactions("Bachman & Associates", "NWO", "Clarke Incorporated",
"OmniTek Incorporated", "Four Sigma");
//Hacking augmentations AddToAugmentations(EnhancedSocialInteractionImplant);
var ArtificialBioNeuralNetwork = new Augmentation("Artificial Bio-neural Network Implant");
ArtificialBioNeuralNetwork.addToFactions("BitRunners", "Fulcrum Secret Technologies"); //Hacking augmentations
AddToAugmentations(ArtificialBioNeuralNetwork); var ArtificialBioNeuralNetwork = new Augmentation("Artificial Bio-neural Network Implant");
ArtificialBioNeuralNetwork.setRequirements(750000, 600000000);
var ArtificialSynapticPotentiation = new Augmentation("Artificial Synaptic Potentiation"); ArtificialBioNeuralNetwork.addToFactions("BitRunners", "Fulcrum Secret Technologies");
ArtificialSynapticPotentiation.addToFactions("The Black Hand", "NiteSec"); AddToAugmentations(ArtificialBioNeuralNetwork);
AddToAugmentations(ArtificialSynapticPotentiation);
var ArtificialSynapticPotentiation = new Augmentation("Artificial Synaptic Potentiation");
ArtificialSynapticPotentiation.setRequirements(600000, 400000000);
ArtificialSynapticPotentiation.addToFactions("The Black Hand", "NiteSec");
AddToAugmentations(ArtificialSynapticPotentiation);
var EnhancedMyelinSheathing = new Augmentation("Enhanced Myelin Sheating"); var EnhancedMyelinSheathing = new Augmentation("Enhanced Myelin Sheating");
EnhancedMyelinSheating.addToFactions("Fulcrum Secret Technologies", "BitRunners", "The Black Hand"); EnhancedMyelinSheathing.setRequirements(900000, 850000000);)
EnhancedMyelinSheating.addToFactions("Fulcrum Secret Technologies", "BitRunners", "The Black Hand");
AddToAugmentations(EnhancedMyelinSheathing); AddToAugmentations(EnhancedMyelinSheathing);
var SynapticEnhancement = new Augmentation("Synaptic Enhancement Implant");
SynapticEnhancement.addToFactions("CyberSec");
AddToAugmentations(SynapticEnhancement);
var NeuralRetentionEnhancement = new Augmentation("Neural-Retention Enhancement");
NeuralRetentionEnhancement.addToFactions("CyberSec", "NiteSec");
AddToAugmentations(NeuralRetentionEnhancement);
var DataJack = new Augmentation("DataJack");
DataJack.addToFactions("BitRunners", "The Black Hand", "NiteSec", "Chongqing", "New Tokyo");
AddToAugmentations(DataJack);
var ENM = new Augmentation("Embedded Netburner Module");
ENM.addToFactions("BitRunners", "The Black Hand", "NiteSec", "ECorp", "MegaCorp",
"Fulcrum Secret Technologies", "NWO", "Blade Industries");
AddToAugmentations(ENM);
var ENMCore = new Augmentation("Embedded Netburner Module Core Implant");
ENMCore.addToFactions("BitRunners", "The Black Hand", "NiteSec", "ECorp", "MegaCorp",
"Fulcrum Secret Technologies", "NWO", "Blade Industries");
AddToAugmentations(ENMCore);
var ENMCoreV2 = new Augmentation("Embedded Netburner Module Core V2 Upgrade");
ENMCoreV2.addToFactions("ECorp", "MegaCorp", "Fulcrum Secret Technologies", "NWO",
"Blade Industries", "OmniTek Incorporated", "KuaiGong International");
AddToAugmentations(ENMCoreV2);
var ENMCoreV3 = new Augmentation("Embedded Netburner Module Core V3 Upgrade");
ENMCoreV3.addToFactions("ECorp", "MegaCorp", "Fulcrum Secret Technologies", "NWO",
"Daedalus", "The Covenant", "Illuminati");
AddToAugmentations(ENMCoreV3);
var ENMAnalyzeEngine = new Augmentation("Embedded Netburner Module Analyze Engine");
ENMCoreV3.addToFactions("ECorp", "MegaCorp", "Fulcrum Secret Technologies", "NWO",
"Daedalus", "The Covenant", "Illuminati");
AddToAugmentations(ENMAnalyzeEngine);
var ENMDMA = new Augmentation("Embedded Netburner Module Direct Memory Access Upgrade");
ENMCoreV3.addToFactions("ECorp", "MegaCorp", "Fulcrum Secret Technologies", "NWO",
"Daedalus", "The Covenant", "Illuminati");
AddToAugmentations(ENMDMA);
var Neuralstimulator = new Augmentation("Neuralstimulator");
Neuralstimulator.addToFactions("The Black Hand", "Chongqing", "Sector-12", "New Tokyo", "Aevum",
"Ishima", "Volhaven", "Bachman & Associates", "Clarke Incorporated",
"Four Sigma");
AddToAugmentations(Neuralstimulator);
var SynapticEnhancement = new Augmentation("Synaptic Enhancement Implant");
SynapticEnhancement.setRequirements(50000, 35000000);
SynapticEnhancement.addToFactions("CyberSec");
AddToAugmentations(SynapticEnhancement);
var NeuralRetentionEnhancement = new Augmentation("Neural-Retention Enhancement");
NeuralRetentionEnhancement.setRequirements(200000, 250000000);
NeuralRetentionEnhancement.addToFactions("CyberSec", "NiteSec");
AddToAugmentations(NeuralRetentionEnhancement);
var DataJack = new Augmentation("DataJack");
DataJack.setRequirements(750000, 750000000);
DataJack.addToFactions("BitRunners", "The Black Hand", "NiteSec", "Chongqing", "New Tokyo");
AddToAugmentations(DataJack);
var ENM = new Augmentation("Embedded Netburner Module");
ENM.setRequirements(500000, 300000000);
ENM.addToFactions("BitRunners", "The Black Hand", "NiteSec", "ECorp", "MegaCorp",
"Fulcrum Secret Technologies", "NWO", "Blade Industries");
AddToAugmentations(ENM);
var ENMCore = new Augmentation("Embedded Netburner Module Core Implant");
ENMCore.setRequirements(750000, 500000000);
ENMCore.addToFactions("BitRunners", "The Black Hand", "NiteSec", "ECorp", "MegaCorp",
"Fulcrum Secret Technologies", "NWO", "Blade Industries");
AddToAugmentations(ENMCore);
var ENMCoreV2 = new Augmentation("Embedded Netburner Module Core V2 Upgrade");
ENMCoreV2.setRequirements(1000000, 1000000000);
ENMCoreV2.addToFactions("ECorp", "MegaCorp", "Fulcrum Secret Technologies", "NWO",
"Blade Industries", "OmniTek Incorporated", "KuaiGong International");
AddToAugmentations(ENMCoreV2);
var ENMCoreV3 = new Augmentation("Embedded Netburner Module Core V3 Upgrade");
ENMCOREV3.setRequirements(1500000, 1250000000);
ENMCoreV3.addToFactions("ECorp", "MegaCorp", "Fulcrum Secret Technologies", "NWO",
"Daedalus", "The Covenant", "Illuminati");
AddToAugmentations(ENMCoreV3);
var ENMAnalyzeEngine = new Augmentation("Embedded Netburner Module Analyze Engine");
ENMAnalyzeEngine.setReqpRequirement(1250000, 1000000000);
ENMAnalyzeEngine.addToFactions("ECorp", "MegaCorp", "Fulcrum Secret Technologies", "NWO",
"Daedalus", "The Covenant", "Illuminati");
AddToAugmentations(ENMAnalyzeEngine);
var ENMDMA = new Augmentation("Embedded Netburner Module Direct Memory Access Upgrade");
ENMDMA.setReqpRequirement(1350000, 1100000000);
ENMDMA.addToFactions("ECorp", "MegaCorp", "Fulcrum Secret Technologies", "NWO",
"Daedalus", "The Covenant", "Illuminati");
AddToAugmentations(ENMDMA);
var Neuralstimulator = new Augmentation("Neuralstimulator");
Neuralstimulator.setReqpRequirement(500000, 600000000);
Neuralstimulator.addToFactions("The Black Hand", "Chongqing", "Sector-12", "New Tokyo", "Aevum",
"Ishima", "Volhaven", "Bachman & Associates", "Clarke Incorporated",
"Four Sigma");
AddToAugmentations(Neuralstimulator);
//Work Augmentations //Work Augmentations
var NuoptimalInjectorImplant = new Augmentation("Nuoptimal Nootropic Injector Implant"); var NuoptimalInjectorImplant = new Augmentation("Nuoptimal Nootropic Injector Implant");
NuoptimalInjectorImplant.addToFactions("Tian Di Hui", "Volhaven", "New Tokyo", "Chongqing", "Ishima", NuoptimalInjectorImplant.setReqpRequirement(100000, 90000000);
"Clarke Incorporated", "Four Sigma", "Bachman & Associates"); NuoptimalInjectorImplant.addToFactions("Tian Di Hui", "Volhaven", "New Tokyo", "Chongqing", "Ishima",
"Clarke Incorporated", "Four Sigma", "Bachman & Associates");
AddToAugmentations(NuoptimalInjectorImplant); AddToAugmentations(NuoptimalInjectorImplant);
var SpeechEnhancement = new Augmentation("Speech Enhancement"); var SpeechEnhancement = new Augmentation("Speech Enhancement");
SpeechEnhancement.addToFactions("Tian Di Hui", "Speakers for the Dead", "Four Sigma", "KuaiGong International", SpeechEnhancement.setReqpRequirement(50000, 45000000);
"Clarke Incorporated", "Four Sigma", "Bachman & Associates"); SpeechEnhancement.addToFactions("Tian Di Hui", "Speakers for the Dead", "Four Sigma", "KuaiGong International",
"Clarke Incorporated", "Four Sigma", "Bachman & Associates");
AddToAugmentations(SpeechEnhancement); AddToAugmentations(SpeechEnhancement);
var FocusWire = new Augmentation("FocusWire"); //Stops procrastination var FocusWire = new Augmentation("FocusWire"); //Stops procrastination
FocusWire.addToFactions("Bachman & Associates", "Clarke Incorporated", "Four Sigma", "KuaiGong International"); FocusWire.setReqpRequirement(400000, 350000000);
FocusWire.addToFactions("Bachman & Associates", "Clarke Incorporated", "Four Sigma", "KuaiGong International");
AddToAugmentations(FocusWire) AddToAugmentations(FocusWire)
var PCDNI = new Augmentation("PC Direct-Neural Interface"); var PCDNI = new Augmentation("PC Direct-Neural Interface");
PCDNI.addToFactions("Four Sigma", "OmniTek Incorporated", "ECorp", "Blade Industries"); PCDNI.setReqpRequirement(750000, 650000000);
PCDNI.addToFactions("Four Sigma", "OmniTek Incorporated", "ECorp", "Blade Industries");
AddToAugmentations(PCDNI); AddToAugmentations(PCDNI);
var PCDNIOptimizer = new Augmentation("PC Direct-Neural Interface Optimization Submodule"); var PCDNIOptimizer = new Augmentation("PC Direct-Neural Interface Optimization Submodule");
PCDNI.addToFactions("Fulcrum Secret Technologies", "ECorp", "Blade Industries"); PCDNIOptimizer.setReqpRequirement(1000000, 875000000);
PCDNIOptimizer.addToFactions("Fulcrum Secret Technologies", "ECorp", "Blade Industries");
AddToAugmentations(PCDNIOptimizer); AddToAugmentations(PCDNIOptimizer);
var PCDNINeuralNetwork = new Augmentation("PC Direct-Neural Interface NeuroNet Injector"); var PCDNINeuralNetwork = new Augmentation("PC Direct-Neural Interface NeuroNet Injector");
PCDNI.addToFactions("Fulcrum Secret Technologies"); PCDNINeuralNetwork.setRequirements(1200000, 1100000000);
PCDNINeuralNetwork.addToFactions("Fulcrum Secret Technologies");
AddToAugmentations(PCDNINeuralNetwork); AddToAugmentations(PCDNINeuralNetwork);
//Misc augmentations //Misc augmentations
var Neurotrainer1 = new Augmentation("Neurotrainer I"); var Neurotrainer1 = new Augmentation("Neurotrainer I");
Neurotrainer1.addToFactions("CyberSec"); Neurotrainer1.setRequirements(50000, 35000000);
Neurotrainer1.addToFactions("CyberSec");
AddToAugmentations(Neurotrainer1); AddToAugmentations(Neurotrainer1);
var Neurotrainer2 = new Augmentation("Neurotrainer II"); var Neurotrainer2 = new Augmentation("Neurotrainer II");
Neurotrainer2.addToFactions("BitRunners", "NiteSec"); Neurotrainer2.setRequirements(300000, 150000000);
Neurotrainer2.addToFactions("BitRunners", "NiteSec");
AddToAugmentations(Neurotrainer2); AddToAugmentations(Neurotrainer2);
var Neurotrainer3 = new Augmentation("Neurotrainer III"); var Neurotrainer3 = new Augmentation("Neurotrainer III");
Neurotrainer3.addToFactions("NWO", "Four Sigma"); Neurotrainer3.setRequirements(900000, 725000000);
Neurotrainer3.addToFactions("NWO", "Four Sigma");
AddToAugmentations(Neurotrainer3); AddToAugmentations(Neurotrainer3);
var Hypersight = new Augmentation("HyperSight Corneal Implant"); var Hypersight = new Augmentation("HyperSight Corneal Implant");
Hypersight.addToFactions("Blade Industries", "KuaiGong International"); Hypersight.setRequirements(800000, 650000000);
Hypersight.addToFactions("Blade Industries", "KuaiGong International");
AddToAugmentations(Hypersight); AddToAugmentations(Hypersight);
} }
applyAugmentation = function(aug) { applyAugmentation = function(aug, faction) {
switch(aug.name) { switch(aug.name) {
//Combat stat augmentations //Combat stat augmentations
case "Augmented Targeting I": case "Augmented Targeting I":
//Dex 5% //Dex 5%
break; break;
case "Augmented Targeting II": case "Augmented Targeting II":
//Dex 5% //Dex 5%
break; break;
case "Augmented Targeting III": case "Augmented Targeting III":
//Dex 5% //Dex 5%
break; break;
case "Synthetic Heart": case "Synthetic Heart":
//Agi and Str - HIGH LEVEL //Agi and Str - HIGH LEVEL
break; break;
case "Synfibril Muscle": case "Synfibril Muscle":
//Strength and Defense - MED HIGH LEVEL //Strength and Defense - MED HIGH LEVEL
break; break;
case "Combat Rib I": case "Combat Rib I":
//Str and Defense 5% //Str and Defense 5%
break; break;
case "Combat Rib II": case "Combat Rib II":
break; break;
case "Combat Rib III": case "Combat Rib III":
break; break;
case "Nanofiber Weave": case "Nanofiber Weave":
//str + Defense - MED LEVEL //str + Defense - MED LEVEL
break; break;
case "NEMEAN Subdermal Weave": case "NEMEAN Subdermal Weave":
//Defense - HIGH LEVEL //Defense - HIGH LEVEL
break; break;
case "Wired Reflexes": case "Wired Reflexes":
//Agility - Low level //Agility - Low level
break; break;
case "Graphene Bone Lacings": case "Graphene Bone Lacings":
//Strength defense - HIGH level //Strength defense - HIGH level
break; break;
case "Bionic Spine": case "Bionic Spine":
//Everything - Medium level //Everything - Medium level
break; break;
case "Graphene Bionic Spine Upgrade": case "Graphene Bionic Spine Upgrade":
//Everything - high level //Everything - high level
break; break;
case "Bionic Legs": case "Bionic Legs":
//Agi - Med level //Agi - Med level
break; break;
case "Graphene Bionic Legs Upgrade": case "Graphene Bionic Legs Upgrade":
//Agi - HIGH level //Agi - HIGH level
break; break;
//Labor stats augmentations //Labor stats augmentations
case "Enhanced Social Interaction Implant": case "Enhanced Social Interaction Implant":
//Charisma 10% - Med high level //Charisma 10% - Med high level
break; break;
case "Speech Processor Implant": case "Speech Processor Implant":
//Charisma 5% - Med level //Charisma 5% - Med level
break; break;
//Hacking augmentations //Hacking augmentations
case "Artificial Bio-neural Network Implant": case "Artificial Bio-neural Network Implant":
//Hacking speed and money gained - MED Level //Hacking speed and money gained - MED Level
break; break;
case "Artificial Synaptic Potentiation": case "Artificial Synaptic Potentiation":
//Hacking speed - MED Level //Hacking speed - MED Level
break; break;
case "Enhanced Myelin Sheating": case "Enhanced Myelin Sheating":
//Hacking speed and exp gain - MED Level //Hacking speed and exp gain - MED Level
break; break;
case "Synaptic Enhancement Implant": case "Synaptic Enhancement Implant":
//Hacking speed - LOw level //Hacking speed - LOw level
break; break;
case "Neural-Retention Enhancement": case "Neural-Retention Enhancement":
//Gain 10% more hacking exp - med level //Gain 10% more hacking exp - med level
break; break;
case "DataJack": case "DataJack":
//5% more money from hacking - med low level //5% more money from hacking - med low level
break; break;
case "Embedded Netburner Module": case "Embedded Netburner Module":
//Doesn't give anyhting itself but allows user to install //Doesn't give anyhting itself but allows user to install
//ENM upgrades in the future, which are very powerful //ENM upgrades in the future, which are very powerful
//Med level //Med level
break; break;
case "Embedded Netburner Module Core Implant": case "Embedded Netburner Module Core Implant":
//Hacking speed, money gained, and exp gained - Med level //Hacking speed, money gained, and exp gained - Med level
break; break;
case "Embedded Netburner Module Core V2 Upgrade": case "Embedded Netburner Module Core V2 Upgrade":
//Hacking speed, money gained, and exp gained - Med High Level //Hacking speed, money gained, and exp gained - Med High Level
break; break;
case "Embedded Netburner Module Core V3 Upgrade": case "Embedded Netburner Module Core V3 Upgrade":
//Hacking speed, money gained, and exp gained - High level //Hacking speed, money gained, and exp gained - High level
break; break;
case "Embedded Netburner Module Analyze Engine": case "Embedded Netburner Module Analyze Engine":
//Hacking speed 20% - High level //Hacking speed 20% - High level
break; break;
case "Embedded Netburner Module Direct Memory Access Upgrade": case "Embedded Netburner Module Direct Memory Access Upgrade":
//Money hacked 20% - High level //Money hacked 20% - High level
break; break;
case "Neuralstimulator": case "Neuralstimulator":
//Hacking speed, money gained, and exp gained - Med level //Hacking speed, money gained, and exp gained - Med level
break; break;
case "PC Direct-Neural Interface NeuroNet Injector": case "PC Direct-Neural Interface NeuroNet Injector":
//Hacking speed increases //Hacking speed increases
break; break;
@ -355,15 +406,15 @@ applyAugmentation = function(aug) {
break; break;
case "PC Direct-Neural Interface": case "PC Direct-Neural Interface":
//Allows people to directly communicate interface with PCs..which helps with Software and IT jobs //Allows people to directly communicate interface with PCs..which helps with Software and IT jobs
//Med level //Med level
break; break;
case "PC Direct-Neural Interface Optimization Submodule": case "PC Direct-Neural Interface Optimization Submodule":
//Allows u to better optimize code/pc when connecting with PC DNI..helps with software/IT jobs //Allows u to better optimize code/pc when connecting with PC DNI..helps with software/IT jobs
//High level //High level
break; break;
case "PC Direct-Neural Interface NeuroNet Injector": case "PC Direct-Neural Interface NeuroNet Injector":
//Allow you to use ur brain as aneural net on a computer lol...increases everything //Allow you to use ur brain as aneural net on a computer lol...increases everything
//High Level //High Level
break; break;
//Misc augmentations //Misc augmentations
@ -379,9 +430,12 @@ applyAugmentation = function(aug) {
case "HyperSight Corneal Implant": case "HyperSight Corneal Implant":
//Increases sight..which increases dex..hacking speed + money? - Med high level //Increases sight..which increases dex..hacking speed + money? - Med high level
break; break;
default: default:
console.log("No such augmentation!"); console.log("ERROR: No such augmentation!");
break; return;
} }
aug.owned = true;
aug.factionInstalledBy = faction.name;
} }

@ -225,8 +225,8 @@ CompanyPositions = {
//Business //Business
BusinessIntern: new CompanyPosition("Business Intern", 1, 1, 1, 1, 1, 1, 0, 1), BusinessIntern: new CompanyPosition("Business Intern", 1, 1, 1, 1, 1, 1, 0, 1),
BusinessAnalyst: new CompanyPosition("Business Analyst", 5, 1, 1, 1, 1, 50, 9000, 5), BusinessAnalyst: new CompanyPosition("Business Analyst", 5, 1, 1, 1, 1, 50, 9000, 8),
BusinessManager: new CompanyPosition("Business Manager", 50, 1, 1, 1, 1, 100, 36000, 12), BusinessManager: new CompanyPosition("Business Manager", 50, 1, 1, 1, 1, 100, 36000, 15),
OperationsManager: new CompanyPosition("Operations Manager", 50, 1, 1, 1, 1, 200, 72000, 20), OperationsManager: new CompanyPosition("Operations Manager", 50, 1, 1, 1, 1, 200, 72000, 20),
CFO: new CompanyPosition("Chief Financial Officer", 75, 1, 1, 1, 1, 500, 108000, 50), CFO: new CompanyPosition("Chief Financial Officer", 75, 1, 1, 1, 1, 500, 108000, 50),
CEO: new CompanyPosition("Chief Executive Officer", 100, 1, 1, 1, 1, 750, 216000, 100), CEO: new CompanyPosition("Chief Executive Officer", 100, 1, 1, 1, 1, 750, 216000, 100),

@ -8,8 +8,17 @@ function Faction(name) {
this.isMember = false; //Whether player is member this.isMember = false; //Whether player is member
this.isBanned = false; //Whether or not player is banned from joining this faction this.isBanned = false; //Whether or not player is banned from joining this faction
this.playerReputation = 0; //"Reputation" within faction this.playerReputation = 0; //"Reputation" within faction
//Multipliers for unlocking and purchasing augmentations
this.augmentationPriceMult = 1;
this.augmentationRepRequirementMult = 1;
}; };
Faction.prototype.setAugmentationMultipliers = function(price, rep) {
this.augmentationPriceMult = price;
this.augmentationRepRequirementMult = rep;
}
Faction.prototype.setInformation = function(info) { Faction.prototype.setInformation = function(info) {
this.information = info; this.information = info;
} }
@ -33,6 +42,8 @@ AddToFactions = function(faction) {
} }
//TODO Add faction information //TODO Add faction information
//TODO Augmentation price and rep requirement mult are 1 for everything right now,
// This might change in the future for balance
initFactions = function() { initFactions = function() {
//Endgame //Endgame
var Illuminati = new Faction("Illuminati"); var Illuminati = new Faction("Illuminati");
@ -353,6 +364,7 @@ inviteToFaction = function(faction) {
joinFaction = function(faction) { joinFaction = function(faction) {
faction.isMember = true; faction.isMember = true;
Player.factions.push(faction.name);
//Add the faction to the Factions page content //Add the faction to the Factions page content
var item = document.createElement("li"); var item = document.createElement("li");
@ -424,7 +436,42 @@ displayFactionContent = function(factionName) {
var fieldWorkButton = document.getElementById("faction-fieldwork-button"); var fieldWorkButton = document.getElementById("faction-fieldwork-button");
var securityWorkButton = document.getElementById("faction-securitywork-button"); var securityWorkButton = document.getElementById("faction-securitywork-button");
//TODO Add event listeners for the buttons //Set new event listener for all of the work buttons
//The old buttons need to be replaced to clear the old event listeners
var newHackButton = hackButton.cloneNode(true);
var newFieldWorkButton = fieldWorkButton.cloneNode(true);
var newSecurityWorkButton = securityWorkbutton.cloneNode(true);
hackButton.parentNode.replaceChild(newHackButton, hackButton);
fieldWorkButton.parentNode.replaceChild(newFieldWorkButton, fieldWorkButton);
securityWorkButton.parentNode.replaceChild(newSecurityWorkButton, securityWorkButton);
newHackButton.addEventListener("click", function() {
Player.startFactionHackWork(faction);
return false;
});
newFieldWorkButton.addEventListener("click", function() {
Player.startFactionFieldWork(faction);
return false;
});
newSecurityWorkButton("click", function() {
Player.startFactionSecurityWork(faction);
return false;
});
//Set new event listener for the purchase augmentation buttons
//The old button needs to be replaced to clear the old event listeners
var purchaseAugmentations = document.getElementById("faction-purchase-augmentations");
var newPurchaseAugmentationsButton = purchaseAugmentations.cloneNode(true);
purchaseAugmentations.parentNode.replaceChild(newPurchaseAugmentationsButton, purchaseAugmentations);
newPurchaseAugmentationsButton.addEventListener("click", function() {
displayFactionAugmentations(factionName);
return false;
});
if (faction.isMember) { if (faction.isMember) {
switch(faction.name) { switch(faction.name) {
@ -565,4 +612,51 @@ displayFactionContent = function(factionName) {
} else { } else {
console.log("Not a member of this faction, cannot display faction information"); console.log("Not a member of this faction, cannot display faction information");
} }
}
displayFactionAugmentations = function(factionName) {
//E.g:
//Add the faction to the Factions page content
var item = document.createElement("li");
var aElem = document.createElement("a");
aElem.setAttribute("href", "#");
aElem.setAttribute("class", "a-link-button");
aElem.innerHTML = faction.name;
aElem.addEventListener("click", function() {
displayFactionContent(faction.name);
return false;
});
item.appendChild(aElem);
var factionsList = document.getElementById("factions-list");
factionsList.appendChild(item);
///
var faction = Factions[factionName];
var augmentationsList = document.getElementById("faction-augmentations-list");
for (var i = 0; i < Player.augmentations.length; ++i) {
var aug = Augmentations[Player.augmentations[i]];
var span = document.createElement("span");
var aElem = document.createElement("a");
var pElem = document.createElement("p");
aElem.setAttribute("href", "#");
if (faction.playerReputation >= (aug.baseRepRequirement * faction.augmentationRepRequirementMult)) {
aElem.setAttribute("class", "a-link-button");
pElem.innerHTML = "UNLOCKED"
pElem.style.color = #66ff33;
//TODO Event listener for button to purchase augmentation
} else {
aElem.setAttribute("class", "a-link-button-inactive");
pElem.innerHTML = "LOCKED";
pElem.style.color = red;
}
aElem.innerHTML = aug.name;
span.appendChild(aElem);
span.appendChild(pElem);
augmentationsList.appendChild(span);
}
} }

@ -49,7 +49,8 @@ function PlayerObject() {
this.agility_exp_mult = 1; this.agility_exp_mult = 1;
this.charisma_exp_mult = 1; this.charisma_exp_mult = 1;
this.company_rep_mult = 1; //Multiplier for how fast the player gains reputation at a company this.company_rep_mult = 1;
this.faction_rep_mult = 1;
//Money //Money
this.money = 0; this.money = 0;
@ -72,7 +73,11 @@ function PlayerObject() {
this.discoveredServers = []; //IP addresses of secret servers not in the network that you have discovered this.discoveredServers = []; //IP addresses of secret servers not in the network that you have discovered
this.purchasedServers = []; this.purchasedServers = [];
//Factions
this.factions = []; //Names of all factions player has joined
//Augmentations //Augmentations
this.augmentations = []; //Names of all installed augmentations
this.numAugmentations = 0; this.numAugmentations = 0;
//Misc statistics //Misc statistics
@ -89,7 +94,8 @@ function PlayerObject() {
//Flags/variables for working (both Company and faction) //Flags/variables for working (both Company and faction)
this.isWorking = false; this.isWorking = false;
this.isWorkingForFaction = false; this.currentWorkFactionName = "";
this.currentWorkFactionDescription = "";
this.workHackExpGainRate = 0; this.workHackExpGainRate = 0;
this.workStrExpGainRate = 0; this.workStrExpGainRate = 0;
@ -367,33 +373,22 @@ PlayerObject.prototype.work = function(numCycles) {
} }
/* Working for Faction */ /* Working for Faction */
PlayerObject.prototype.finishFactionWork = function(cancelled) { PlayerObject.prototype.finishFactionWork = function(cancelled, faction) {
//Since the work was cancelled early, player only gains half of what they've earned so far this.hacking_exp += (this.workHackExpGained);
var cancMult = 1; this.strength_exp += (this.workStrExpGained);
if (cancelled) { this.defense_exp += (this.workDefExpGained);
cancMult = 2; this.dexterity_exp += (this.workDexExpGained);
} this.agility_exp += (this.workAgiExpGained);
if (Engine.Debug) { this.charisma_exp += (this.workChaExpGained);
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]; var faction = Factions[this.currentWorkFactionName];
company.playerReputation += (this.workRepGained / cancMult); faction.playerReputation += (this.workRepGained);
this.gainMoney(this.workMoneyGained / cancMult); this.gainMoney(this.workMoneyGained / cancMult);
this.updateSkillLevels(); this.updateSkillLevels();
var txt = ""; var txt = "You worked for your faction " + faction.name + " for a total of " + convertTimeMsToTimeElapsedString(this.timeWorked) + " <br><br> " +
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>" + "You earned a total of: <br>" +
"$" + (this.workMoneyGained / cancMult).toFixed(2) + "<br>" + "$" + (this.workMoneyGained / cancMult).toFixed(2) + "<br>" +
(this.workRepGained / cancMult).toFixed(3) + " reputation for the company <br>" + (this.workRepGained / cancMult).toFixed(3) + " reputation for the company <br>" +
@ -403,19 +398,6 @@ PlayerObject.prototype.finishFactionWork = function(cancelled) {
(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>"; (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); dialogBoxCreate(txt);
var mainMenu = document.getElementById("mainmenu-container"); var mainMenu = document.getElementById("mainmenu-container");
@ -426,17 +408,9 @@ PlayerObject.prototype.finishFactionWork = function(cancelled) {
Engine.loadTerminalContent(); Engine.loadTerminalContent();
} }
PlayerObject.prototype.startFactionHackWork = function() { PlayerObject.prototype.startFactionWork(faction) {
this.isWorking = true; this.isWorking = true;
this.currentWorkFactionName = faction.name;
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.workHackExpGained = 0;
this.workStrExpGained = 0; this.workStrExpGained = 0;
@ -456,15 +430,62 @@ PlayerObject.prototype.startFactionHackWork = function() {
cancelButton.parentNode.replaceChild(newCancelButton, cancelButton); cancelButton.parentNode.replaceChild(newCancelButton, cancelButton);
newCancelButton.addEventListener("click", function() { newCancelButton.addEventListener("click", function() {
Player.finishWork(true); Player.finishFactionWork(true, faction);
return false; return false;
}); });
//Display Work In Progress Screen //Display Work In Progress Screen
Engine.loadWorkInProgressContent(); Engine.loadWorkInProgressContent();
} }
PlayerObject.prototype.startFactionHackWork = function(faction) {
this.workHackExpGainRate = .1 * this.hacking_exp_mult;
this.workStrExpGainRate = 0;
this.workDefExpGainRate = 0;
this.workDexExpGainRate = 0;
this.workAgiExpGainRate = 0;
this.workChaExpGainRate = 0;
this.workRepGainRate = this.hacking_skill / CONSTANTS.MaxSkillLevel * this.faction_rep_mult;
this.workMoneyGainRate = 0;
this.currentWorkFactionDescription = "carrying out hacking contracts";
this.startFactionWork(faction);
}
PlayerObject.prototype.startFactionFieldWork = function(faction) {
this.workHackExpGainRate = .05 * this.hacking_exp_mult;
this.workStrExpGainRate = .05 * this.strength_exp_mult;
this.workDefExpGainRate = .05 * this.defense_exp_mult;
this.workDexExpGainRate = .05 * this.dexterity_exp_mult;
this.workAgiExpGainRate = .05 * this.agility_exp_mult;
this.workChaExpGainRate = .05 * this.charisma_exp_mult;
this.workRepGainRate = this.getFactionFieldWorkRepGain();
this.workMoneyGainRate = 0;
this.currentWorkFactionDescription = "carrying out field missions"
this.startFactionWork(faction);
}
PlayerObject.prototype.startFactionSecurityWork = faction(faction) {
this.workHackExpGainRate = .1 * this.hacking_exp_mult;
this.workStrExpGainRate = 0;
this.workDefExpGainRate = 0;
this.workDexExpGainRate = 0;
this.workAgiExpGainRate = 0;
this.workChaExpGainRate = 0;
this.workRepGainRate = this.getFactionFieldWorkRepGain();
this.workMoneyGainRate = 0;
this.currentWorkFactionDescription = "performing security detail"
this.startFactionWork(faction);
}
PlayerObject.prototype.workForFaction = function(numCycles) { PlayerObject.prototype.workForFaction = function(numCycles) {
var faction = Factions[this.currentWorkFactionName];
this.workHackExpGained += this.workHackExpGainRate * numCycles; this.workHackExpGained += this.workHackExpGainRate * numCycles;
this.workStrExpGained += this.workStrExpGainRate * numCycles; this.workStrExpGained += this.workStrExpGainRate * numCycles;
this.workDefExpGained += this.workDefExpGainRate * numCycles; this.workDefExpGained += this.workDefExpGainRate * numCycles;
@ -478,9 +499,9 @@ PlayerObject.prototype.workForFaction = function(numCycles) {
this.timeWorked += Engine._idleSpeed * numCycles; this.timeWorked += Engine._idleSpeed * numCycles;
//If timeWorked == 8 hours, then finish. You can only gain 8 hours worth of exp and money //If timeWorked == 20 hours, then finish. You can only work for the faction for 20 hours
if (this.timeWorked >= 28800000) { if (this.timeWorked >= 72000000) {
var maxCycles = 144000; //Number of cycles in 8 hours var maxCycles = 360000; //Number of cycles in 20 hours
this.workHackExpGained = this.workhackExpGainRate * maxCycles; this.workHackExpGained = this.workhackExpGainRate * maxCycles;
this.workStrExpGained = this.workStrExpGainRate * maxCycles; this.workStrExpGained = this.workStrExpGainRate * maxCycles;
this.workDefExpGained = this.workDefExpGainRate * maxCycles; this.workDefExpGained = this.workDefExpGainRate * maxCycles;
@ -489,13 +510,12 @@ PlayerObject.prototype.workForFaction = function(numCycles) {
this.workChaExpGained = this.workChaExpGainRate * maxCycles; this.workChaExpGained = this.workChaExpGainRate * maxCycles;
this.workRepGained = this.workRepGainRate * maxCycles; this.workRepGained = this.workRepGainRate * maxCycles;
this.workMoneyGained = this.workMoneyGainRate * maxCycles; this.workMoneyGained = this.workMoneyGainRate * maxCycles;
this.finishWork(false); this.finishFactionWork(false, faction);
} }
var txt = document.getElementById("work-in-progress-text"); var txt = document.getElementById("work-in-progress-text");
txt.innerHTML = "You are currently working as a " + this.companyPosition.positionName + txt.innerHTML = "You are currently " + this.currentWorkFactionDescription + " for your faction " + faction.name + "." +
" at " + Player.companyName + "<br><br>" + "You have been doing this 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><br>" + this.workRepGained.toFixed(3) + " (" + (this.workRepGainRate * cyclesPerSec).toFixed(3) + " / sec) reputation for this company <br><br>" +
@ -506,10 +526,8 @@ PlayerObject.prototype.workForFaction = function(numCycles) {
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>" + 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>" + "There is no penalty for cancelling earlier";
"but you will only gain half of the experience, money, and reputation you've earned so far."
} }
@ -557,9 +575,30 @@ PlayerObject.prototype.getWorkChaExpGain = function() {
//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,
this.defense, this.dexterity, var jobPerformance = this.companyPosition.calculateJobPerformance(this.hacking_skill, this.strength,
this.agility, this.charisma); this.defense, this.dexterity,
this.agility, this.charisma);
return jobPerformance * this.company_rep_mult;
}
PlayerObject.prototype.getFactionSecurityWorkRepGain = function() {
var t = (this.hacking_skill / CONSTANTS.MaxSkillLevel +
this.strength / CONSTANTS.MaxSkillLevel +
this.defense / CONSTANTS.MaxSkillLevel +
this.dexterity / CONSTANTS.MaxSkillLevel +
this.agility / CONSTANTS.MaxSkillLevel) / 5;
return t * this.faction_rep_mult;
}
PlayerObject.prototype.getFactionFieldWorkRepGain = function() {
var t = (this.hacking_skill / CONSTANTS.MaxSkillLevel +
this.strength / CONSTANTS.MaxSkillLevel +
this.defense / CONSTANTS.MaxSkillLevel +
this.dexterity / CONSTANTS.MaxSkillLevel +
this.agility / CONSTANTS.MaxSkillLevel +
this.charisma / CONSTANTS.MaxSkillLevel) / 6;
return t * this.faction_rep_mult;
} }
//Functions for saving and loading the Player data //Functions for saving and loading the Player data

@ -0,0 +1,60 @@
/* Pop up Purchase Augmentation Box */
function purchaseAugmentationBoxInit() {
if (Engine.Debug) {
console.log("Purchase Augmentation Box Initialized");
}
var cancelButton = document.getElementById("purchase-augmentation-box-cancel");
//Close Dialog box
cancelButton.addEventListener("click", function() {
purchaseAugmentationBoxClose();
return false;
});
};
document.addEventListener("DOMContentLoaded", purchaseAugmentationBoxInit, false);
purchaseAugmentationBoxClose = function() {
var purchaseAugmentationBox = document.getElementById("purchase-augmentation-box-container");
purchaseAugmentationBox.style.display = "none";
}
purchaseAugmentationBoxOpen = function() {
var purchaseAugmentationBox = document.getElementById("purchase-augmentation-box-container");
purchaseAugmentationBox.style.display = "block";
}
purchaseAugmentationBoxSetText = function(txt) {
var purchaseAugmentationBox = document.getElementById("purchase-augmentation-box-text");
purchaseAugmentationBox.innerHTML = txt;
}
//ram argument is in GB
purchaseAugmentationBoxCreate = function(aug, fac) {
purchaseAugmentationBoxSetText("Would you like to purchase the " + aug.name + " Augmentation for $" +
(aug.baseCost * fac.augmentationPriceMult) + "?");
//Clear old event listeners from Confirm button
var confirmButton = document.getElementById("purchase-augmentation-box-confirm");
var newConfirmButton = confirmButton.cloneNode(true);
confirmButton.parentNode.replaceChild(newConfirmButton, confirmButton);
newConfirmButton.addEventListener("click", function() {
if (Player.money >= (aug.baseCost * fac.augmentationPriceMult)) {
applyAugmentation(aug, fac);
//TODO Make this text better
dialogBoxCreate("You slowly drift to sleep as " + fac.name + "'s scientists put you under <br>" +
" in order to install the " + aug.name + " Augmentation. <br>br>" +
"You wake up in your home...you feel different...");
//TODO RESSETTTT FOR PRESTIGE
} else {
dialogBoxCreate("You don't have enough money to purchase this Augmentation!");
}
purchaseAugmentationBoxClose();
return false;
});
purchaseAugmentationBoxOpen();
}

@ -1,4 +1,4 @@
/* Pop up Yes/No Box */ /* Pop up Purchase Server Box */
function purchaseServerBoxInit() { function purchaseServerBoxInit() {
if (Engine.Debug) { if (Engine.Debug) {
console.log("Purchase Server box Initialized"); console.log("Purchase Server box Initialized");
@ -33,8 +33,11 @@ purchaseServerBoxSetText = function(txt) {
purchaseServerBoxCreate = function(ram, cost) { purchaseServerBoxCreate = function(ram, cost) {
purchaseServerBoxSetText("Would you like to purchase a new server with " + ram + "GB of RAM for $" + cost + "?" ); purchaseServerBoxSetText("Would you like to purchase a new server with " + ram + "GB of RAM for $" + cost + "?" );
//Clear old event listeners from Confirm button
var confirmButton = document.getElementById("purchase-server-box-confirm"); var confirmButton = document.getElementById("purchase-server-box-confirm");
confirmButton.addEventListener("click", function() { var newConfirmButton = confirmButton.cloneNode(true);
confirmButton.parentNode.replaceChild(newConfirmButton, confirmButton);
newConfirmButton.addEventListener("click", function() {
purchaseServerBoxClose(); purchaseServerBoxClose();
purchaseServer(ram, cost); purchaseServer(ram, cost);
return false; return false;