From 4a60874a3a5bdb51c1997b4ab7b4b8cb0482e8ca Mon Sep 17 00:00:00 2001 From: Daniel Xie Date: Fri, 17 Feb 2017 16:19:25 -0600 Subject: [PATCH] Display Faction content, including Augmentations. Added requirements for Augmentations. Created PurchaseAugmentationBox.js. Next step is to create the reset function needed for prestiging --- css/popupboxes.css | 50 +++ css/styles.css | 14 + index.html | 56 ++- src/Augmentations.js | 600 +++++++++++++++++-------------- src/Company.js | 4 +- src/Faction.js | 96 ++++- src/Player.js | 161 +++++---- utils/PurchaseAugmentationBox.js | 60 ++++ utils/PurchaseServerBox.js | 7 +- 9 files changed, 703 insertions(+), 345 deletions(-) create mode 100644 utils/PurchaseAugmentationBox.js diff --git a/css/popupboxes.css b/css/popupboxes.css index 6e8763761..ee22c4079 100644 --- a/css/popupboxes.css +++ b/css/popupboxes.css @@ -100,6 +100,56 @@ 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-container { display: none; /* Hidden by default */ diff --git a/css/styles.css b/css/styles.css index edd795f67..8a4d784eb 100644 --- a/css/styles.css +++ b/css/styles.css @@ -68,3 +68,17 @@ h1 { 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; +} + diff --git a/index.html b/index.html index fba58654a..277efa08f 100644 --- a/index.html +++ b/index.html @@ -21,6 +21,7 @@ + @@ -325,26 +326,51 @@

-
-

Complete hacking contracts for your faction! Speed and effectiveness determined by hacking skill. Gain hacking exp.

+ Hacking Contracts +

+ Complete hacking contracts for your faction!
+ Your effectiveness, which determines how much reputation you gain for this faction, is based on your hacking skill.
+ Gain hacking exp. +

-
+ Field Work
-

Carry out field missions for your faction. Speed and effectiveness determined by all stats. Gains exp for all stats.

+

+ Carry out field missions for your faction.
+ Your effectiveness, which determines how much reputation you gain for this faction, is based on all of your stats.
+ Gains exp for all stats. +

-
+ Security Work
-

Serve in a security detail for your faction. Speed and effectiveness determined by combat stats. Gains exp for all combat stats.

+

+ Serve in a security detail for your faction.
+ Your effectiveness, which determines how much reputation you gain for this faction, is based on your combat stats.
+ Gains exp for all combat stats. +

+ +

+ As your reputation with this faction rises, you will unlock Augmentations, which you + can purchase to enhance your abilities. +

+ Purchase Augmentations + +
+

Faction Augmentations

+

Lists all augmentations that are available from

+ +
@@ -425,6 +451,24 @@ Cancel
+ + +
+
+

+

WARNING: Purchasing an Augmentation resets most of your progress, including:
+ Stats/Skill levels and Experience
+ Money
+ Scripts
+ Faction/Company reputation

+ 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). +

+ Purchase + Cancel +

+
diff --git a/src/Augmentations.js b/src/Augmentations.js index b0f0cbbf1..f15c457ec 100644 --- a/src/Augmentations.js +++ b/src/Augmentations.js @@ -1,31 +1,41 @@ //Augmentations function Augmentation(name) { - this.name = name; + this.name = name; 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) { - 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 Augmentation.prototype.addToFactions(factionList) { - for (var i = 0; i < factionList.length; ++i) { - var faction = Factions[factionList[i]]; - if (faction = null) { - console.log("Error: Could not find faction with this name"); - } - faction.augmentations.push(this.name); - } + for (var i = 0; i < factionList.length; ++i) { + var faction = Factions[factionList[i]]; + if (faction = null) { + console.log("Error: Could not find faction with this name"); + } + faction.augmentations.push(this.name); + } } Augmentation.prototype.toJSON = function() { - return Generic_toJSON("Augmentation", this); + return Generic_toJSON("Augmentation", this); } Augmentation.fromJSON = function(value) { - return Generic_fromJSON(Augmentation, value.data); + return Generic_fromJSON(Augmentation, value.data); } Reviver.constructors.Augmentation = Augmentation; @@ -33,312 +43,353 @@ Reviver.constructors.Augmentation = Augmentation; Augmentations = {} AddToAugmentations = function(aug) { - var name = aug.name; - Augmentations[name] = aug; + var name = aug.name; + Augmentations[name] = aug; } //TODO Set descriptions for all //TODO Something that decreases RAM usage of scripts //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() { - //Combat stat augmentations - var Targeting1 = new Augmentation("Augmented Targeting I"); - Targeting1.addToFactions("The Dark Army", "The Syndicate", "Sector-12", "Volhaven", "Ishima", - "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); + //Combat stat augmentations + var Targeting1 = new Augmentation("Augmented Targeting I"); + Targeting1.setRequirements(36000, 10000000); + Targeting1.addToFactions("The Dark Army", "The Syndicate", "Sector-12", "Volhaven", "Ishima", + "OmniTek Incorporated", "KuaiGong International", "Blade Industries"); + AddToAugmentations(Targeting1); - var SynfibrilMuscle = new Augmentation("Synfibril Muscle"); - SynfibrilMuscle.addToFactions("KuaiGong International", "Fulcrum Secret Technologies", "Speakers for the Dead", - "NWO", "The Covenant", "Daedalus", "Illuminati", "Blade Industries"); - AddToAugmentations(SynfibrilMuscle) - - var CombatRib1 = new Augmentation("Combat Rib I"); - CombatRib1.addToFactions("The Dark Army", "The Syndicate", "Sector-12", "Volhaven", "Ishima", - "OmniTek Incorporated", "KuaiGong International", "Blade Industries"); - AddToAugmentations(CombatRib1); - - var CombatRib2 = new Augmentation("Combat Rib II"); - CombatRib2.addToFactions("The Dark Army", "The Syndicate", "Sector-12", "Volhaven", "Ishima", - "OmniTek Incorporated", "KuaiGong International", "Blade Industries"); - AddToAugmentations(CombatRib2); - - var CombatRib3 = new Augmentation("Combat Rib III"); - CombatRib3.addToFactions("The Dark Army", "The Syndicate", "OmniTek Incorporated", - "KuaiGong International", "Blade Industries", "The Covenant"); - AddToAugmentations(CombatRib3); - - var NanofiberWeave = new Augmentation("Nanofiber Weave"); - NanofiberWeave.addToFactions("Tian Di Hui", "The Syndicate", "The Dark Army", "Speakers for the Dead", - "Blade Industries", "Fulcrum Secret Technologies", "OmniTek Incorporated"); - AddToAugmentations(NanofiberWeave); - - var SubdermalArmor = new Augmentation("NEMEAN Subdermal Weave"); - SubdermalArmor.addToFactions("The Syndicate", "Fulcrum Secret Technologies", "Illuminati", "Daedalus", - "The Covenant"); - AddToAugmentations(SubdermalArmor); - - var WiredReflexes = new Augmentation("Wired Reflexes"); - 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.addToFactions("Fulcrum Secret Technologies", "The Covenant"); - AddToAugmentations(GrapheneBoneLacings); - - var BionicSpine = new Augmentation("Bionic Spine"); - 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.addToFactions("Fulcrum Secret Technologies", "ECorp"); - AddToAugmentations(GrapheneBionicSpine); + var Targeting2 = new Augmentation("Augmented Targeting II"); + Targeting2.setRequirements(72000, 20000000); + 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.setRequirements(144000, 50000000); + Targeting3.addToFactions("The Dark Army", "The Syndicate", "OmniTek Incorporated", + "KuaiGong International", "Blade Industries", "The Covenant"); + AddToAugmentations(Targeting3); + + var SyntheticHeart = new Augmentation("Synthetic Heart"); + SyntheticHeart.setRequirements(1000000, 500000000); + SyntheticHeart.addToFactions("KuaiGong International", "Fulcrum Secret Technologies", "Speakers for the Dead", + "NWO", "The Covenant", "Daedalus", "Illuminati"); + AddToAugmentations(SyntheticHeart); + + var SynfibrilMuscle = new Augmentation("Synfibril Muscle"); + SynfibrilMuscle.setRequirements(900000, 400000000); + SynfibrilMuscle.addToFactions("KuaiGong International", "Fulcrum Secret Technologies", "Speakers for the Dead", + "NWO", "The Covenant", "Daedalus", "Illuminati", "Blade Industries"); + AddToAugmentations(SynfibrilMuscle) + + var CombatRib1 = new Augmentation("Combat Rib I"); + CombatRib1.setRequirements(50000, 15000000); + CombatRib1.addToFactions("The Dark Army", "The Syndicate", "Sector-12", "Volhaven", "Ishima", + "OmniTek Incorporated", "KuaiGong International", "Blade Industries"); + AddToAugmentations(CombatRib1); + + var CombatRib2 = new Augmentation("Combat Rib II"); + CombatRib2.setRequirements.setRequirements(100000, 40000000); + CombatRib2.addToFactions("The Dark Army", "The Syndicate", "Sector-12", "Volhaven", "Ishima", + "OmniTek Incorporated", "KuaiGong International", "Blade Industries"); + AddToAugmentations(CombatRib2); + + var CombatRib3 = new Augmentation("Combat Rib III"); + CombatRib3.setRequirements(200000, 100000000); + CombatRib3.addToFactions("The Dark Army", "The Syndicate", "OmniTek Incorporated", + "KuaiGong International", "Blade Industries", "The Covenant"); + AddToAugmentations(CombatRib3); + + var NanofiberWeave = new Augmentation("Nanofiber Weave"); + NanofiberWeave.setRequirements(400000, 250000000); + NanofiberWeave.addToFactions("Tian Di Hui", "The Syndicate", "The Dark Army", "Speakers for the Dead", + "Blade Industries", "Fulcrum Secret Technologies", "OmniTek Incorporated"); + 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"); - BionicLegs.addToFactions("Speakers for the Dead", "The Syndicate", "KuaiGong International", - "OmniTek Incorporated", "Blade Industries"); + BionicLegs.setRequirements(200000, 60000000); + BionicLegs.addToFactions("Speakers for the Dead", "The Syndicate", "KuaiGong International", + "OmniTek Incorporated", "Blade Industries"); AddToAugmentations(BionicLegs); 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); - - //Labor stat augmentations - var SpeechProcessor = new Augmentation("Speech Processor Implant"); //Cochlear imlant? - SpeechProcessor.addToFactions("Tian Di Hui", "Chongqing", "Sector-12", "New Tokyo", "Aevum", - "Ishima", "Volhaven"); - AddToAugmentations(SpeechProcessor); - - var EnhancedSocialInteractionImplant = new Augmentation("Enhanced Social Interaction Implant"); - EnhancedSocialInteractionImplant.addToFactions("Bachman & Associates", "NWO", "Clarke Incorporated", - "OmniTek Incorporated", "Four Sigma"); - AddToAugmentations(EnhancedSocialInteractionImplant); - - //Hacking augmentations - var ArtificialBioNeuralNetwork = new Augmentation("Artificial Bio-neural Network Implant"); - ArtificialBioNeuralNetwork.addToFactions("BitRunners", "Fulcrum Secret Technologies"); - AddToAugmentations(ArtificialBioNeuralNetwork); - - var ArtificialSynapticPotentiation = new Augmentation("Artificial Synaptic Potentiation"); - ArtificialSynapticPotentiation.addToFactions("The Black Hand", "NiteSec"); - AddToAugmentations(ArtificialSynapticPotentiation); + + //Labor stat augmentations + var SpeechProcessor = new Augmentation("Speech Processor Implant"); //Cochlear imlant? + SpeechProcessor.setRequirements(50000, 15000000); + SpeechProcessor.addToFactions("Tian Di Hui", "Chongqing", "Sector-12", "New Tokyo", "Aevum", + "Ishima", "Volhaven"); + AddToAugmentations(SpeechProcessor); + + var EnhancedSocialInteractionImplant = new Augmentation("Enhanced Social Interaction Implant"); + EnhancedSocialInteractionImplant.setRequirements(750000, 500000000); + EnhancedSocialInteractionImplant.addToFactions("Bachman & Associates", "NWO", "Clarke Incorporated", + "OmniTek Incorporated", "Four Sigma"); + AddToAugmentations(EnhancedSocialInteractionImplant); + + //Hacking augmentations + var ArtificialBioNeuralNetwork = new Augmentation("Artificial Bio-neural Network Implant"); + ArtificialBioNeuralNetwork.setRequirements(750000, 600000000); + ArtificialBioNeuralNetwork.addToFactions("BitRunners", "Fulcrum Secret Technologies"); + AddToAugmentations(ArtificialBioNeuralNetwork); + + 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"); - EnhancedMyelinSheating.addToFactions("Fulcrum Secret Technologies", "BitRunners", "The Black Hand"); + EnhancedMyelinSheathing.setRequirements(900000, 850000000);) + EnhancedMyelinSheating.addToFactions("Fulcrum Secret Technologies", "BitRunners", "The Black Hand"); 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 var NuoptimalInjectorImplant = new Augmentation("Nuoptimal Nootropic Injector Implant"); - NuoptimalInjectorImplant.addToFactions("Tian Di Hui", "Volhaven", "New Tokyo", "Chongqing", "Ishima", - "Clarke Incorporated", "Four Sigma", "Bachman & Associates"); + NuoptimalInjectorImplant.setReqpRequirement(100000, 90000000); + NuoptimalInjectorImplant.addToFactions("Tian Di Hui", "Volhaven", "New Tokyo", "Chongqing", "Ishima", + "Clarke Incorporated", "Four Sigma", "Bachman & Associates"); AddToAugmentations(NuoptimalInjectorImplant); var SpeechEnhancement = new Augmentation("Speech Enhancement"); - SpeechEnhancement.addToFactions("Tian Di Hui", "Speakers for the Dead", "Four Sigma", "KuaiGong International", - "Clarke Incorporated", "Four Sigma", "Bachman & Associates"); + SpeechEnhancement.setReqpRequirement(50000, 45000000); + SpeechEnhancement.addToFactions("Tian Di Hui", "Speakers for the Dead", "Four Sigma", "KuaiGong International", + "Clarke Incorporated", "Four Sigma", "Bachman & Associates"); AddToAugmentations(SpeechEnhancement); 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) 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); 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); - - var PCDNINeuralNetwork = new Augmentation("PC Direct-Neural Interface NeuroNet Injector"); - PCDNI.addToFactions("Fulcrum Secret Technologies"); + + var PCDNINeuralNetwork = new Augmentation("PC Direct-Neural Interface NeuroNet Injector"); + PCDNINeuralNetwork.setRequirements(1200000, 1100000000); + PCDNINeuralNetwork.addToFactions("Fulcrum Secret Technologies"); AddToAugmentations(PCDNINeuralNetwork); - //Misc augmentations + //Misc augmentations var Neurotrainer1 = new Augmentation("Neurotrainer I"); - Neurotrainer1.addToFactions("CyberSec"); + Neurotrainer1.setRequirements(50000, 35000000); + Neurotrainer1.addToFactions("CyberSec"); AddToAugmentations(Neurotrainer1); var Neurotrainer2 = new Augmentation("Neurotrainer II"); - Neurotrainer2.addToFactions("BitRunners", "NiteSec"); + Neurotrainer2.setRequirements(300000, 150000000); + Neurotrainer2.addToFactions("BitRunners", "NiteSec"); AddToAugmentations(Neurotrainer2); var Neurotrainer3 = new Augmentation("Neurotrainer III"); - Neurotrainer3.addToFactions("NWO", "Four Sigma"); + Neurotrainer3.setRequirements(900000, 725000000); + Neurotrainer3.addToFactions("NWO", "Four Sigma"); AddToAugmentations(Neurotrainer3); 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); } -applyAugmentation = function(aug) { - switch(aug.name) { - //Combat stat augmentations - case "Augmented Targeting I": - //Dex 5% - break; - case "Augmented Targeting II": - //Dex 5% - break; - case "Augmented Targeting III": - //Dex 5% - break; - case "Synthetic Heart": - //Agi and Str - HIGH LEVEL - break; - case "Synfibril Muscle": - //Strength and Defense - MED HIGH LEVEL - break; - case "Combat Rib I": - //Str and Defense 5% - break; - case "Combat Rib II": - break; - case "Combat Rib III": - break; - case "Nanofiber Weave": - //str + Defense - MED LEVEL - break; - case "NEMEAN Subdermal Weave": - //Defense - HIGH LEVEL - break; - case "Wired Reflexes": - //Agility - Low level - break; - case "Graphene Bone Lacings": - //Strength defense - HIGH level - break; - case "Bionic Spine": - //Everything - Medium level - break; - case "Graphene Bionic Spine Upgrade": - //Everything - high level - break; +applyAugmentation = function(aug, faction) { + switch(aug.name) { + //Combat stat augmentations + case "Augmented Targeting I": + //Dex 5% + break; + case "Augmented Targeting II": + //Dex 5% + break; + case "Augmented Targeting III": + //Dex 5% + break; + case "Synthetic Heart": + //Agi and Str - HIGH LEVEL + break; + case "Synfibril Muscle": + //Strength and Defense - MED HIGH LEVEL + break; + case "Combat Rib I": + //Str and Defense 5% + break; + case "Combat Rib II": + break; + case "Combat Rib III": + break; + case "Nanofiber Weave": + //str + Defense - MED LEVEL + break; + case "NEMEAN Subdermal Weave": + //Defense - HIGH LEVEL + break; + case "Wired Reflexes": + //Agility - Low level + break; + case "Graphene Bone Lacings": + //Strength defense - HIGH level + break; + case "Bionic Spine": + //Everything - Medium level + break; + case "Graphene Bionic Spine Upgrade": + //Everything - high level + break; case "Bionic Legs": //Agi - Med level break; - case "Graphene Bionic Legs Upgrade": - //Agi - HIGH level - break; - - //Labor stats augmentations - case "Enhanced Social Interaction Implant": - //Charisma 10% - Med high level - break; - case "Speech Processor Implant": - //Charisma 5% - Med level - break; + case "Graphene Bionic Legs Upgrade": + //Agi - HIGH level + break; + + //Labor stats augmentations + case "Enhanced Social Interaction Implant": + //Charisma 10% - Med high level + break; + case "Speech Processor Implant": + //Charisma 5% - Med level + break; - //Hacking augmentations - case "Artificial Bio-neural Network Implant": - //Hacking speed and money gained - MED Level - break; - case "Artificial Synaptic Potentiation": - //Hacking speed - MED Level - break; + //Hacking augmentations + case "Artificial Bio-neural Network Implant": + //Hacking speed and money gained - MED Level + break; + case "Artificial Synaptic Potentiation": + //Hacking speed - MED Level + break; case "Enhanced Myelin Sheating": //Hacking speed and exp gain - MED Level break; - case "Synaptic Enhancement Implant": - //Hacking speed - LOw level - break; - case "Neural-Retention Enhancement": - //Gain 10% more hacking exp - med level - break; - case "DataJack": - //5% more money from hacking - med low level - break; - case "Embedded Netburner Module": - //Doesn't give anyhting itself but allows user to install - //ENM upgrades in the future, which are very powerful - //Med level - break; - case "Embedded Netburner Module Core Implant": - //Hacking speed, money gained, and exp gained - Med level - break; - case "Embedded Netburner Module Core V2 Upgrade": - //Hacking speed, money gained, and exp gained - Med High Level - break; - case "Embedded Netburner Module Core V3 Upgrade": - //Hacking speed, money gained, and exp gained - High level - break; - case "Embedded Netburner Module Analyze Engine": - //Hacking speed 20% - High level - break; - case "Embedded Netburner Module Direct Memory Access Upgrade": - //Money hacked 20% - High level - break; - case "Neuralstimulator": - //Hacking speed, money gained, and exp gained - Med level - break; + case "Synaptic Enhancement Implant": + //Hacking speed - LOw level + break; + case "Neural-Retention Enhancement": + //Gain 10% more hacking exp - med level + break; + case "DataJack": + //5% more money from hacking - med low level + break; + case "Embedded Netburner Module": + //Doesn't give anyhting itself but allows user to install + //ENM upgrades in the future, which are very powerful + //Med level + break; + case "Embedded Netburner Module Core Implant": + //Hacking speed, money gained, and exp gained - Med level + break; + case "Embedded Netburner Module Core V2 Upgrade": + //Hacking speed, money gained, and exp gained - Med High Level + break; + case "Embedded Netburner Module Core V3 Upgrade": + //Hacking speed, money gained, and exp gained - High level + break; + case "Embedded Netburner Module Analyze Engine": + //Hacking speed 20% - High level + break; + case "Embedded Netburner Module Direct Memory Access Upgrade": + //Money hacked 20% - High level + break; + case "Neuralstimulator": + //Hacking speed, money gained, and exp gained - Med level + break; case "PC Direct-Neural Interface NeuroNet Injector": //Hacking speed increases break; @@ -355,15 +406,15 @@ applyAugmentation = function(aug) { break; case "PC Direct-Neural Interface": //Allows people to directly communicate interface with PCs..which helps with Software and IT jobs - //Med level + //Med level break; case "PC Direct-Neural Interface Optimization Submodule": //Allows u to better optimize code/pc when connecting with PC DNI..helps with software/IT jobs - //High level - break; - case "PC Direct-Neural Interface NeuroNet Injector": + //High level + break; + case "PC Direct-Neural Interface NeuroNet Injector": //Allow you to use ur brain as aneural net on a computer lol...increases everything - //High Level + //High Level break; //Misc augmentations @@ -379,9 +430,12 @@ applyAugmentation = function(aug) { case "HyperSight Corneal Implant": //Increases sight..which increases dex..hacking speed + money? - Med high level break; - - default: - console.log("No such augmentation!"); - break; - } + + default: + console.log("ERROR: No such augmentation!"); + return; + } + + aug.owned = true; + aug.factionInstalledBy = faction.name; } \ No newline at end of file diff --git a/src/Company.js b/src/Company.js index 5b5c3c347..d9df7caf7 100644 --- a/src/Company.js +++ b/src/Company.js @@ -225,8 +225,8 @@ CompanyPositions = { //Business 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), - BusinessManager: new CompanyPosition("Business Manager", 50, 1, 1, 1, 1, 100, 36000, 12), + 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, 15), 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), CEO: new CompanyPosition("Chief Executive Officer", 100, 1, 1, 1, 1, 750, 216000, 100), diff --git a/src/Faction.js b/src/Faction.js index fb3bf3640..9649a37fa 100644 --- a/src/Faction.js +++ b/src/Faction.js @@ -8,8 +8,17 @@ function Faction(name) { this.isMember = false; //Whether player is member this.isBanned = false; //Whether or not player is banned from joining this 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) { this.information = info; } @@ -33,6 +42,8 @@ AddToFactions = function(faction) { } //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() { //Endgame var Illuminati = new Faction("Illuminati"); @@ -353,6 +364,7 @@ inviteToFaction = function(faction) { joinFaction = function(faction) { faction.isMember = true; + Player.factions.push(faction.name); //Add the faction to the Factions page content var item = document.createElement("li"); @@ -424,7 +436,42 @@ displayFactionContent = function(factionName) { var fieldWorkButton = document.getElementById("faction-fieldwork-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) { switch(faction.name) { @@ -565,4 +612,51 @@ displayFactionContent = function(factionName) { } else { 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); + } } \ No newline at end of file diff --git a/src/Player.js b/src/Player.js index 6d3119403..37ed1b535 100644 --- a/src/Player.js +++ b/src/Player.js @@ -49,7 +49,8 @@ function PlayerObject() { this.agility_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 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.purchasedServers = []; + //Factions + this.factions = []; //Names of all factions player has joined + //Augmentations + this.augmentations = []; //Names of all installed augmentations this.numAugmentations = 0; //Misc statistics @@ -89,7 +94,8 @@ function PlayerObject() { //Flags/variables for working (both Company and faction) this.isWorking = false; - this.isWorkingForFaction = false; + this.currentWorkFactionName = ""; + this.currentWorkFactionDescription = ""; this.workHackExpGainRate = 0; this.workStrExpGainRate = 0; @@ -367,33 +373,22 @@ PlayerObject.prototype.work = function(numCycles) { } /* Working for Faction */ -PlayerObject.prototype.finishFactionWork = function(cancelled) { - //Since the work was cancelled early, player only gains half of what they've earned so far - var cancMult = 1; - if (cancelled) { - cancMult = 2; - } - if (Engine.Debug) { - console.log("Player finishWork() called with " + this.workMoneyGained / cancMult + " $ gained"); - } - this.hacking_exp += (this.workHackExpGained / cancMult); - this.strength_exp += (this.workStrExpGained / cancMult); - this.defense_exp += (this.workDefExpGained / cancMult); - this.dexterity_exp += (this.workDexExpGained / cancMult); - this.agility_exp += (this.workAgiExpGained / cancMult); - this.charisma_exp += (this.workChaExpGained / cancMult); +PlayerObject.prototype.finishFactionWork = function(cancelled, faction) { + this.hacking_exp += (this.workHackExpGained); + this.strength_exp += (this.workStrExpGained); + this.defense_exp += (this.workDefExpGained); + this.dexterity_exp += (this.workDexExpGained); + this.agility_exp += (this.workAgiExpGained); + this.charisma_exp += (this.workChaExpGained); - var company = Companies[this.companyName]; - company.playerReputation += (this.workRepGained / cancMult); + var faction = Factions[this.currentWorkFactionName]; + faction.playerReputation += (this.workRepGained); this.gainMoney(this.workMoneyGained / cancMult); this.updateSkillLevels(); - var txt = ""; - if (cancelled) { - txt = "You worked a short shift of " + convertTimeMsToTimeElapsedString(this.timeWorked) + "

" + - "Since you cancelled your work early, you only gained half of the experience, money, and reputation you earned.

" + + var txt = "You worked for your faction " + faction.name + " for a total of " + convertTimeMsToTimeElapsedString(this.timeWorked) + "

" + "You earned a total of:
" + "$" + (this.workMoneyGained / cancMult).toFixed(2) + "
" + (this.workRepGained / cancMult).toFixed(3) + " reputation for the company
" + @@ -403,19 +398,6 @@ PlayerObject.prototype.finishFactionWork = function(cancelled) { (this.workDexExpGained / cancMult).toFixed(3) + " dexterity exp
" + (this.workAgiExpGained / cancMult).toFixed(3) + " agility exp
" + (this.workChaExpGained / cancMult).toFixed(3) + " charisma exp
"; - - } else { - txt = "You worked a full shift of 8 hours!

" + - "You earned a total of:
" + - "$" + (this.workMoneyGained / cancMult) + "
" + - (this.workRepGained / cancMult) + " reputation for the company
" + - (this.workHackExpGained / cancMult) + " hacking exp
" + - (this.workStrExpGained / cancMult) + " strength exp
" + - (this.workDefExpGained / cancMult) + " defense exp
" + - (this.workDexExpGained / cancMult) + " dexterity exp
" + - (this.workAgiExpGained / cancMult) + " agility exp
" + - (this.workChaExpGained / cancMult) + " charisma exp
"; - } dialogBoxCreate(txt); var mainMenu = document.getElementById("mainmenu-container"); @@ -426,17 +408,9 @@ PlayerObject.prototype.finishFactionWork = function(cancelled) { Engine.loadTerminalContent(); } -PlayerObject.prototype.startFactionHackWork = function() { +PlayerObject.prototype.startFactionWork(faction) { this.isWorking = true; - - this.workHackExpGainRate = this.getWorkHackExpGain(); - this.workStrExpGainRate = this.getWorkStrExpGain(); - this.workDefExpGainRate = this.getWorkDefExpGain(); - this.workDexExpGainRate = this.getWorkDexExpGain(); - this.workAgiExpGainRate = this.getWorkAgiExpGain(); - this.workChaExpGainRate = this.getWorkChaExpGain(); - this.workRepGainRate = this.getWorkRepGain(); - this.workMoneyGainRate = this.getWorkMoneyGain(); + this.currentWorkFactionName = faction.name; this.workHackExpGained = 0; this.workStrExpGained = 0; @@ -456,15 +430,62 @@ PlayerObject.prototype.startFactionHackWork = function() { cancelButton.parentNode.replaceChild(newCancelButton, cancelButton); newCancelButton.addEventListener("click", function() { - Player.finishWork(true); + Player.finishFactionWork(true, faction); return false; }); //Display Work In Progress Screen 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) { + var faction = Factions[this.currentWorkFactionName]; + this.workHackExpGained += this.workHackExpGainRate * numCycles; this.workStrExpGained += this.workStrExpGainRate * numCycles; this.workDefExpGained += this.workDefExpGainRate * numCycles; @@ -478,9 +499,9 @@ PlayerObject.prototype.workForFaction = function(numCycles) { this.timeWorked += Engine._idleSpeed * numCycles; - //If timeWorked == 8 hours, then finish. You can only gain 8 hours worth of exp and money - if (this.timeWorked >= 28800000) { - var maxCycles = 144000; //Number of cycles in 8 hours + //If timeWorked == 20 hours, then finish. You can only work for the faction for 20 hours + if (this.timeWorked >= 72000000) { + var maxCycles = 360000; //Number of cycles in 20 hours this.workHackExpGained = this.workhackExpGainRate * maxCycles; this.workStrExpGained = this.workStrExpGainRate * maxCycles; this.workDefExpGained = this.workDefExpGainRate * maxCycles; @@ -489,13 +510,12 @@ PlayerObject.prototype.workForFaction = function(numCycles) { this.workChaExpGained = this.workChaExpGainRate * maxCycles; this.workRepGained = this.workRepGainRate * maxCycles; this.workMoneyGained = this.workMoneyGainRate * maxCycles; - this.finishWork(false); + this.finishFactionWork(false, faction); } var txt = document.getElementById("work-in-progress-text"); - txt.innerHTML = "You are currently working as a " + this.companyPosition.positionName + - " at " + Player.companyName + "

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

" + + txt.innerHTML = "You are currently " + this.currentWorkFactionDescription + " for your faction " + faction.name + "." + + "You have been doing this for " + convertTimeMsToTimeElapsedString(this.timeWorked) + "

" + "You have earned:

" + "$" + this.workMoneyGained + " (" + (this.workMoneyGainRate * cyclesPerSec).toFixed(2) + " / sec)

" + this.workRepGained.toFixed(3) + " (" + (this.workRepGainRate * cyclesPerSec).toFixed(3) + " / sec) reputation for this company

" + @@ -506,10 +526,8 @@ PlayerObject.prototype.workForFaction = function(numCycles) { this.workAgiExpGained.toFixed(3) + " (" + (this.workAgiExpGainRate * cyclesPerSec).toFixed(3) + " / sec) agility exp

" + this.workChaExpGained.toFixed(3) + " (" + (this.workChaExpGainRate * cyclesPerSec).toFixed(3) + " / sec) charisma exp

" + - - "You will automatically finish after working for 8 hours. You can cancel earlier if you wish,
" + - "but you will only gain half of the experience, money, and reputation you've earned so far." - + "You will automatically finish after working for 8 hours. You can cancel earlier if you wish.
" + + "There is no penalty for cancelling earlier"; } @@ -557,9 +575,30 @@ PlayerObject.prototype.getWorkChaExpGain = function() { //Reputation gained per game cycle PlayerObject.prototype.getWorkRepGain = function() { - return this.companyPosition.calculateJobPerformance(this.hacking_skill, this.strength, - this.defense, this.dexterity, - this.agility, this.charisma); + + var jobPerformance = this.companyPosition.calculateJobPerformance(this.hacking_skill, this.strength, + 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 diff --git a/utils/PurchaseAugmentationBox.js b/utils/PurchaseAugmentationBox.js new file mode 100644 index 000000000..e09659182 --- /dev/null +++ b/utils/PurchaseAugmentationBox.js @@ -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
" + + " in order to install the " + aug.name + " Augmentation.
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(); +} \ No newline at end of file diff --git a/utils/PurchaseServerBox.js b/utils/PurchaseServerBox.js index b8527e527..40e52c5d9 100644 --- a/utils/PurchaseServerBox.js +++ b/utils/PurchaseServerBox.js @@ -1,4 +1,4 @@ -/* Pop up Yes/No Box */ +/* Pop up Purchase Server Box */ function purchaseServerBoxInit() { if (Engine.Debug) { console.log("Purchase Server box Initialized"); @@ -33,8 +33,11 @@ purchaseServerBoxSetText = function(txt) { purchaseServerBoxCreate = function(ram, 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"); - confirmButton.addEventListener("click", function() { + var newConfirmButton = confirmButton.cloneNode(true); + confirmButton.parentNode.replaceChild(newConfirmButton, confirmButton); + newConfirmButton.addEventListener("click", function() { purchaseServerBoxClose(); purchaseServer(ram, cost); return false;