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,25 +326,50 @@
</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 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> </div>
<!-- Installed augmentations --> <!-- Installed augmentations -->
@ -426,6 +452,24 @@
</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">
<div id="faction-invitation-box-content"> <div id="faction-invitation-box-content">

@ -3,12 +3,22 @@ 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) {
@ -45,149 +55,180 @@ AddToAugmentations = function(aug) {
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.setRequirements(36000, 10000000);
Targeting1.addToFactions("The Dark Army", "The Syndicate", "Sector-12", "Volhaven", "Ishima", Targeting1.addToFactions("The Dark Army", "The Syndicate", "Sector-12", "Volhaven", "Ishima",
"OmniTek Incorporated", "KuaiGong International", "Blade Industries"); "OmniTek Incorporated", "KuaiGong International", "Blade Industries");
AddToAugmentations(Targeting1); AddToAugmentations(Targeting1);
var Targeting2 = new Augmentation("Augmented Targeting II"); var Targeting2 = new Augmentation("Augmented Targeting II");
Targeting2.setRequirements(72000, 20000000);
Targeting2.addToFactions("The Dark Army", "The Syndicate", "Sector-12", "Volhaven", "Ishima", Targeting2.addToFactions("The Dark Army", "The Syndicate", "Sector-12", "Volhaven", "Ishima",
"OmniTek Incorporated", "KuaiGong International", "Blade Industries"); "OmniTek Incorporated", "KuaiGong International", "Blade Industries");
AddToAugmentations(Targeting2); AddToAugmentations(Targeting2);
var Targeting3 = new Augmentation("Augmented Targeting III"); var Targeting3 = new Augmentation("Augmented Targeting III");
Targeting3.setRequirements(144000, 50000000);
Targeting3.addToFactions("The Dark Army", "The Syndicate", "OmniTek Incorporated", Targeting3.addToFactions("The Dark Army", "The Syndicate", "OmniTek Incorporated",
"KuaiGong International", "Blade Industries", "The Covenant"); "KuaiGong International", "Blade Industries", "The Covenant");
AddToAugmentations(Targeting3); AddToAugmentations(Targeting3);
var SyntheticHeart = new Augmentation("Synthetic Heart"); var SyntheticHeart = new Augmentation("Synthetic Heart");
SyntheticHeart.setRequirements(1000000, 500000000);
SyntheticHeart.addToFactions("KuaiGong International", "Fulcrum Secret Technologies", "Speakers for the Dead", SyntheticHeart.addToFactions("KuaiGong International", "Fulcrum Secret Technologies", "Speakers for the Dead",
"NWO", "The Covenant", "Daedalus", "Illuminati"); "NWO", "The Covenant", "Daedalus", "Illuminati");
AddToAugmentations(SyntheticHeart); AddToAugmentations(SyntheticHeart);
var SynfibrilMuscle = new Augmentation("Synfibril Muscle"); var SynfibrilMuscle = new Augmentation("Synfibril Muscle");
SynfibrilMuscle.setRequirements(900000, 400000000);
SynfibrilMuscle.addToFactions("KuaiGong International", "Fulcrum Secret Technologies", "Speakers for the Dead", SynfibrilMuscle.addToFactions("KuaiGong International", "Fulcrum Secret Technologies", "Speakers for the Dead",
"NWO", "The Covenant", "Daedalus", "Illuminati", "Blade Industries"); "NWO", "The Covenant", "Daedalus", "Illuminati", "Blade Industries");
AddToAugmentations(SynfibrilMuscle) AddToAugmentations(SynfibrilMuscle)
var CombatRib1 = new Augmentation("Combat Rib I"); var CombatRib1 = new Augmentation("Combat Rib I");
CombatRib1.setRequirements(50000, 15000000);
CombatRib1.addToFactions("The Dark Army", "The Syndicate", "Sector-12", "Volhaven", "Ishima", CombatRib1.addToFactions("The Dark Army", "The Syndicate", "Sector-12", "Volhaven", "Ishima",
"OmniTek Incorporated", "KuaiGong International", "Blade Industries"); "OmniTek Incorporated", "KuaiGong International", "Blade Industries");
AddToAugmentations(CombatRib1); AddToAugmentations(CombatRib1);
var CombatRib2 = new Augmentation("Combat Rib II"); var CombatRib2 = new Augmentation("Combat Rib II");
CombatRib2.setRequirements.setRequirements(100000, 40000000);
CombatRib2.addToFactions("The Dark Army", "The Syndicate", "Sector-12", "Volhaven", "Ishima", CombatRib2.addToFactions("The Dark Army", "The Syndicate", "Sector-12", "Volhaven", "Ishima",
"OmniTek Incorporated", "KuaiGong International", "Blade Industries"); "OmniTek Incorporated", "KuaiGong International", "Blade Industries");
AddToAugmentations(CombatRib2); AddToAugmentations(CombatRib2);
var CombatRib3 = new Augmentation("Combat Rib III"); var CombatRib3 = new Augmentation("Combat Rib III");
CombatRib3.setRequirements(200000, 100000000);
CombatRib3.addToFactions("The Dark Army", "The Syndicate", "OmniTek Incorporated", CombatRib3.addToFactions("The Dark Army", "The Syndicate", "OmniTek Incorporated",
"KuaiGong International", "Blade Industries", "The Covenant"); "KuaiGong International", "Blade Industries", "The Covenant");
AddToAugmentations(CombatRib3); AddToAugmentations(CombatRib3);
var NanofiberWeave = new Augmentation("Nanofiber Weave"); var NanofiberWeave = new Augmentation("Nanofiber Weave");
NanofiberWeave.setRequirements(400000, 250000000);
NanofiberWeave.addToFactions("Tian Di Hui", "The Syndicate", "The Dark Army", "Speakers for the Dead", NanofiberWeave.addToFactions("Tian Di Hui", "The Syndicate", "The Dark Army", "Speakers for the Dead",
"Blade Industries", "Fulcrum Secret Technologies", "OmniTek Incorporated"); "Blade Industries", "Fulcrum Secret Technologies", "OmniTek Incorporated");
AddToAugmentations(NanofiberWeave); AddToAugmentations(NanofiberWeave);
var SubdermalArmor = new Augmentation("NEMEAN Subdermal Weave"); var SubdermalArmor = new Augmentation("NEMEAN Subdermal Weave");
SubdermalArmor.setRequirements(1000000, 750000000);
SubdermalArmor.addToFactions("The Syndicate", "Fulcrum Secret Technologies", "Illuminati", "Daedalus", SubdermalArmor.addToFactions("The Syndicate", "Fulcrum Secret Technologies", "Illuminati", "Daedalus",
"The Covenant"); "The Covenant");
AddToAugmentations(SubdermalArmor); AddToAugmentations(SubdermalArmor);
var WiredReflexes = new Augmentation("Wired Reflexes"); var WiredReflexes = new Augmentation("Wired Reflexes");
WiredReflexes.setRequirements(36000, 10000000);
WiredReflexes.addToFactions("Tian Di Hui", "Sector-12", "Volhaven", "Aevum", "Ishima", WiredReflexes.addToFactions("Tian Di Hui", "Sector-12", "Volhaven", "Aevum", "Ishima",
"The Syndicate", "The Dark Army", "Speakers for the Dead"); "The Syndicate", "The Dark Army", "Speakers for the Dead");
AddToAugmentations(WiredReflexes); AddToAugmentations(WiredReflexes);
var GrapheneBoneLacings = new Augmentation("Graphene Bone Lacings"); var GrapheneBoneLacings = new Augmentation("Graphene Bone Lacings");
GrapheneBoneLacings.setRequirements(1500000, 1000000000);
GrapheneBoneLacings.addToFactions("Fulcrum Secret Technologies", "The Covenant"); GrapheneBoneLacings.addToFactions("Fulcrum Secret Technologies", "The Covenant");
AddToAugmentations(GrapheneBoneLacings); AddToAugmentations(GrapheneBoneLacings);
var BionicSpine = new Augmentation("Bionic Spine"); var BionicSpine = new Augmentation("Bionic Spine");
BionicSpine.setRequirements(250000, 75000000);
BionicSpine.addToFactions("Speakers for the Dead", "The Syndicate", "KuaiGong International", BionicSpine.addToFactions("Speakers for the Dead", "The Syndicate", "KuaiGong International",
"OmniTek Incorporated", "Blade Industries"); "OmniTek Incorporated", "Blade Industries");
AddToAugmentations(BionicSpine); AddToAugmentations(BionicSpine);
var GrapheneBionicSpine = new Augmentation("Graphene Bionic Spine Upgrade"); var GrapheneBionicSpine = new Augmentation("Graphene Bionic Spine Upgrade");
GrapheneBionicSpine.setRequirements(1200000, 1000000000);
GrapheneBionicSpine.addToFactions("Fulcrum Secret Technologies", "ECorp"); GrapheneBionicSpine.addToFactions("Fulcrum Secret Technologies", "ECorp");
AddToAugmentations(GrapheneBionicSpine); AddToAugmentations(GrapheneBionicSpine);
var BionicLegs = new Augmentation("Bionic Legs"); var BionicLegs = new Augmentation("Bionic Legs");
BionicLegs.setRequirements(200000, 60000000);
BionicLegs.addToFactions("Speakers for the Dead", "The Syndicate", "KuaiGong International", BionicLegs.addToFactions("Speakers for the Dead", "The Syndicate", "KuaiGong International",
"OmniTek Incorporated", "Blade Industries"); "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.setRequirements(1000000, 900000000);
GrapheneBionicLegs.addToFactions("MegaCorp", "ECorp", "Fulcrum Secret Technologies"); 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.setRequirements(50000, 15000000);
SpeechProcessor.addToFactions("Tian Di Hui", "Chongqing", "Sector-12", "New Tokyo", "Aevum", SpeechProcessor.addToFactions("Tian Di Hui", "Chongqing", "Sector-12", "New Tokyo", "Aevum",
"Ishima", "Volhaven"); "Ishima", "Volhaven");
AddToAugmentations(SpeechProcessor); AddToAugmentations(SpeechProcessor);
var EnhancedSocialInteractionImplant = new Augmentation("Enhanced Social Interaction Implant"); var EnhancedSocialInteractionImplant = new Augmentation("Enhanced Social Interaction Implant");
EnhancedSocialInteractionImplant.setRequirements(750000, 500000000);
EnhancedSocialInteractionImplant.addToFactions("Bachman & Associates", "NWO", "Clarke Incorporated", EnhancedSocialInteractionImplant.addToFactions("Bachman & Associates", "NWO", "Clarke Incorporated",
"OmniTek Incorporated", "Four Sigma"); "OmniTek Incorporated", "Four Sigma");
AddToAugmentations(EnhancedSocialInteractionImplant); AddToAugmentations(EnhancedSocialInteractionImplant);
//Hacking augmentations //Hacking augmentations
var ArtificialBioNeuralNetwork = new Augmentation("Artificial Bio-neural Network Implant"); var ArtificialBioNeuralNetwork = new Augmentation("Artificial Bio-neural Network Implant");
ArtificialBioNeuralNetwork.setRequirements(750000, 600000000);
ArtificialBioNeuralNetwork.addToFactions("BitRunners", "Fulcrum Secret Technologies"); ArtificialBioNeuralNetwork.addToFactions("BitRunners", "Fulcrum Secret Technologies");
AddToAugmentations(ArtificialBioNeuralNetwork); AddToAugmentations(ArtificialBioNeuralNetwork);
var ArtificialSynapticPotentiation = new Augmentation("Artificial Synaptic Potentiation"); var ArtificialSynapticPotentiation = new Augmentation("Artificial Synaptic Potentiation");
ArtificialSynapticPotentiation.setRequirements(600000, 400000000);
ArtificialSynapticPotentiation.addToFactions("The Black Hand", "NiteSec"); ArtificialSynapticPotentiation.addToFactions("The Black Hand", "NiteSec");
AddToAugmentations(ArtificialSynapticPotentiation); AddToAugmentations(ArtificialSynapticPotentiation);
var EnhancedMyelinSheathing = new Augmentation("Enhanced Myelin Sheating"); var EnhancedMyelinSheathing = new Augmentation("Enhanced Myelin Sheating");
EnhancedMyelinSheathing.setRequirements(900000, 850000000);)
EnhancedMyelinSheating.addToFactions("Fulcrum Secret Technologies", "BitRunners", "The Black Hand"); EnhancedMyelinSheating.addToFactions("Fulcrum Secret Technologies", "BitRunners", "The Black Hand");
AddToAugmentations(EnhancedMyelinSheathing); AddToAugmentations(EnhancedMyelinSheathing);
var SynapticEnhancement = new Augmentation("Synaptic Enhancement Implant"); var SynapticEnhancement = new Augmentation("Synaptic Enhancement Implant");
SynapticEnhancement.setRequirements(50000, 35000000);
SynapticEnhancement.addToFactions("CyberSec"); SynapticEnhancement.addToFactions("CyberSec");
AddToAugmentations(SynapticEnhancement); AddToAugmentations(SynapticEnhancement);
var NeuralRetentionEnhancement = new Augmentation("Neural-Retention Enhancement"); var NeuralRetentionEnhancement = new Augmentation("Neural-Retention Enhancement");
NeuralRetentionEnhancement.setRequirements(200000, 250000000);
NeuralRetentionEnhancement.addToFactions("CyberSec", "NiteSec"); NeuralRetentionEnhancement.addToFactions("CyberSec", "NiteSec");
AddToAugmentations(NeuralRetentionEnhancement); AddToAugmentations(NeuralRetentionEnhancement);
var DataJack = new Augmentation("DataJack"); var DataJack = new Augmentation("DataJack");
DataJack.setRequirements(750000, 750000000);
DataJack.addToFactions("BitRunners", "The Black Hand", "NiteSec", "Chongqing", "New Tokyo"); DataJack.addToFactions("BitRunners", "The Black Hand", "NiteSec", "Chongqing", "New Tokyo");
AddToAugmentations(DataJack); AddToAugmentations(DataJack);
var ENM = new Augmentation("Embedded Netburner Module"); var ENM = new Augmentation("Embedded Netburner Module");
ENM.setRequirements(500000, 300000000);
ENM.addToFactions("BitRunners", "The Black Hand", "NiteSec", "ECorp", "MegaCorp", ENM.addToFactions("BitRunners", "The Black Hand", "NiteSec", "ECorp", "MegaCorp",
"Fulcrum Secret Technologies", "NWO", "Blade Industries"); "Fulcrum Secret Technologies", "NWO", "Blade Industries");
AddToAugmentations(ENM); AddToAugmentations(ENM);
var ENMCore = new Augmentation("Embedded Netburner Module Core Implant"); var ENMCore = new Augmentation("Embedded Netburner Module Core Implant");
ENMCore.setRequirements(750000, 500000000);
ENMCore.addToFactions("BitRunners", "The Black Hand", "NiteSec", "ECorp", "MegaCorp", ENMCore.addToFactions("BitRunners", "The Black Hand", "NiteSec", "ECorp", "MegaCorp",
"Fulcrum Secret Technologies", "NWO", "Blade Industries"); "Fulcrum Secret Technologies", "NWO", "Blade Industries");
AddToAugmentations(ENMCore); AddToAugmentations(ENMCore);
var ENMCoreV2 = new Augmentation("Embedded Netburner Module Core V2 Upgrade"); var ENMCoreV2 = new Augmentation("Embedded Netburner Module Core V2 Upgrade");
ENMCoreV2.setRequirements(1000000, 1000000000);
ENMCoreV2.addToFactions("ECorp", "MegaCorp", "Fulcrum Secret Technologies", "NWO", ENMCoreV2.addToFactions("ECorp", "MegaCorp", "Fulcrum Secret Technologies", "NWO",
"Blade Industries", "OmniTek Incorporated", "KuaiGong International"); "Blade Industries", "OmniTek Incorporated", "KuaiGong International");
AddToAugmentations(ENMCoreV2); AddToAugmentations(ENMCoreV2);
var ENMCoreV3 = new Augmentation("Embedded Netburner Module Core V3 Upgrade"); var ENMCoreV3 = new Augmentation("Embedded Netburner Module Core V3 Upgrade");
ENMCOREV3.setRequirements(1500000, 1250000000);
ENMCoreV3.addToFactions("ECorp", "MegaCorp", "Fulcrum Secret Technologies", "NWO", ENMCoreV3.addToFactions("ECorp", "MegaCorp", "Fulcrum Secret Technologies", "NWO",
"Daedalus", "The Covenant", "Illuminati"); "Daedalus", "The Covenant", "Illuminati");
AddToAugmentations(ENMCoreV3); AddToAugmentations(ENMCoreV3);
var ENMAnalyzeEngine = new Augmentation("Embedded Netburner Module Analyze Engine"); var ENMAnalyzeEngine = new Augmentation("Embedded Netburner Module Analyze Engine");
ENMCoreV3.addToFactions("ECorp", "MegaCorp", "Fulcrum Secret Technologies", "NWO", ENMAnalyzeEngine.setReqpRequirement(1250000, 1000000000);
ENMAnalyzeEngine.addToFactions("ECorp", "MegaCorp", "Fulcrum Secret Technologies", "NWO",
"Daedalus", "The Covenant", "Illuminati"); "Daedalus", "The Covenant", "Illuminati");
AddToAugmentations(ENMAnalyzeEngine); AddToAugmentations(ENMAnalyzeEngine);
var ENMDMA = new Augmentation("Embedded Netburner Module Direct Memory Access Upgrade"); var ENMDMA = new Augmentation("Embedded Netburner Module Direct Memory Access Upgrade");
ENMCoreV3.addToFactions("ECorp", "MegaCorp", "Fulcrum Secret Technologies", "NWO", ENMDMA.setReqpRequirement(1350000, 1100000000);
ENMDMA.addToFactions("ECorp", "MegaCorp", "Fulcrum Secret Technologies", "NWO",
"Daedalus", "The Covenant", "Illuminati"); "Daedalus", "The Covenant", "Illuminati");
AddToAugmentations(ENMDMA); AddToAugmentations(ENMDMA);
var Neuralstimulator = new Augmentation("Neuralstimulator"); var Neuralstimulator = new Augmentation("Neuralstimulator");
Neuralstimulator.setReqpRequirement(500000, 600000000);
Neuralstimulator.addToFactions("The Black Hand", "Chongqing", "Sector-12", "New Tokyo", "Aevum", Neuralstimulator.addToFactions("The Black Hand", "Chongqing", "Sector-12", "New Tokyo", "Aevum",
"Ishima", "Volhaven", "Bachman & Associates", "Clarke Incorporated", "Ishima", "Volhaven", "Bachman & Associates", "Clarke Incorporated",
"Four Sigma"); "Four Sigma");
@ -196,50 +237,60 @@ initAugmentations = function() {
//Work Augmentations //Work Augmentations
var NuoptimalInjectorImplant = new Augmentation("Nuoptimal Nootropic Injector Implant"); var NuoptimalInjectorImplant = new Augmentation("Nuoptimal Nootropic Injector Implant");
NuoptimalInjectorImplant.setReqpRequirement(100000, 90000000);
NuoptimalInjectorImplant.addToFactions("Tian Di Hui", "Volhaven", "New Tokyo", "Chongqing", "Ishima", NuoptimalInjectorImplant.addToFactions("Tian Di Hui", "Volhaven", "New Tokyo", "Chongqing", "Ishima",
"Clarke Incorporated", "Four Sigma", "Bachman & Associates"); "Clarke Incorporated", "Four Sigma", "Bachman & Associates");
AddToAugmentations(NuoptimalInjectorImplant); AddToAugmentations(NuoptimalInjectorImplant);
var SpeechEnhancement = new Augmentation("Speech Enhancement"); var SpeechEnhancement = new Augmentation("Speech Enhancement");
SpeechEnhancement.setReqpRequirement(50000, 45000000);
SpeechEnhancement.addToFactions("Tian Di Hui", "Speakers for the Dead", "Four Sigma", "KuaiGong International", SpeechEnhancement.addToFactions("Tian Di Hui", "Speakers for the Dead", "Four Sigma", "KuaiGong International",
"Clarke Incorporated", "Four Sigma", "Bachman & Associates"); "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.setReqpRequirement(400000, 350000000);
FocusWire.addToFactions("Bachman & Associates", "Clarke Incorporated", "Four Sigma", "KuaiGong International"); 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.setReqpRequirement(750000, 650000000);
PCDNI.addToFactions("Four Sigma", "OmniTek Incorporated", "ECorp", "Blade Industries"); 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.setRequirements(50000, 35000000);
Neurotrainer1.addToFactions("CyberSec"); Neurotrainer1.addToFactions("CyberSec");
AddToAugmentations(Neurotrainer1); AddToAugmentations(Neurotrainer1);
var Neurotrainer2 = new Augmentation("Neurotrainer II"); var Neurotrainer2 = new Augmentation("Neurotrainer II");
Neurotrainer2.setRequirements(300000, 150000000);
Neurotrainer2.addToFactions("BitRunners", "NiteSec"); Neurotrainer2.addToFactions("BitRunners", "NiteSec");
AddToAugmentations(Neurotrainer2); AddToAugmentations(Neurotrainer2);
var Neurotrainer3 = new Augmentation("Neurotrainer III"); var Neurotrainer3 = new Augmentation("Neurotrainer III");
Neurotrainer3.setRequirements(900000, 725000000);
Neurotrainer3.addToFactions("NWO", "Four Sigma"); Neurotrainer3.addToFactions("NWO", "Four Sigma");
AddToAugmentations(Neurotrainer3); AddToAugmentations(Neurotrainer3);
var Hypersight = new Augmentation("HyperSight Corneal Implant"); var Hypersight = new Augmentation("HyperSight Corneal Implant");
Hypersight.setRequirements(800000, 650000000);
Hypersight.addToFactions("Blade Industries", "KuaiGong International"); 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":
@ -381,7 +432,10 @@ applyAugmentation = function(aug) {
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) {
@ -566,3 +613,50 @@ displayFactionContent = function(factionName) {
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,7 +430,7 @@ 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;
}); });
@ -464,7 +438,54 @@ PlayerObject.prototype.startFactionHackWork = function() {
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,
var jobPerformance = this.companyPosition.calculateJobPerformance(this.hacking_skill, this.strength,
this.defense, this.dexterity, this.defense, this.dexterity,
this.agility, this.charisma); 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;