From a65c82ff22ed186de6fc8e769afcc7ef931b8c62 Mon Sep 17 00:00:00 2001 From: phyzical Date: Thu, 24 Mar 2022 22:33:38 +0800 Subject: [PATCH 01/12] slice out refactor of augmenation realted stuff from new faction pr * moved some of augmentation helper stuff to new file augmentation creator * simplified init augmenations * converted augmentation names to enum --- src/Augmentation/AugmentationCreator.tsx | 1939 +++++++++++++++++++ src/Augmentation/AugmentationHelpers.tsx | 2037 +------------------- src/Augmentation/data/AugmentationNames.ts | 341 ++-- src/Faction/ui/AugmentationsPage.tsx | 11 +- src/PersonObjects/Resleeving/Resleeving.ts | 2 +- 5 files changed, 2123 insertions(+), 2207 deletions(-) create mode 100644 src/Augmentation/AugmentationCreator.tsx diff --git a/src/Augmentation/AugmentationCreator.tsx b/src/Augmentation/AugmentationCreator.tsx new file mode 100644 index 000000000..1c2162255 --- /dev/null +++ b/src/Augmentation/AugmentationCreator.tsx @@ -0,0 +1,1939 @@ +import { Augmentation, IConstructorParams } from "./Augmentation"; +import { AugmentationNames } from "./data/AugmentationNames"; +import { Player } from "../Player"; +import { Programs } from "../Programs/Programs"; +import { WHRNG } from "../Casino/RNG"; +import React from "react"; +import { FactionNames } from "../Faction/data/FactionNames"; + +function getRandomBonus(): any { + const bonuses = [ + { + bonuses: { + hacking_chance_mult: 1.25, + hacking_speed_mult: 1.1, + hacking_money_mult: 1.25, + hacking_grow_mult: 1.1, + }, + description: + "Increases the player's hacking chance by 25%.
" + + "Increases the player's hacking speed by 10%.
" + + "Increases the amount of money the player's gains from hacking by 25%.
" + + "Improves grow() by 10%.", + }, + { + bonuses: { + hacking_mult: 1.15, + hacking_exp_mult: 2, + }, + description: + "Increases the player's hacking skill by 15%.
" + + "Increases the player's hacking experience gain rate by 100%.", + }, + { + bonuses: { + strength_mult: 1.25, + strength_exp_mult: 2, + defense_mult: 1.25, + defense_exp_mult: 2, + dexterity_mult: 1.25, + dexterity_exp_mult: 2, + agility_mult: 1.25, + agility_exp_mult: 2, + }, + description: + "Increases all of the player's combat stats by 25%.
" + + "Increases all of the player's combat stat experience gain rate by 100%.", + }, + { + bonuses: { + charisma_mult: 1.5, + charisma_exp_mult: 2, + }, + description: + "This augmentation increases the player's charisma by 50%.
" + + "Increases the player's charisma experience gain rate by 100%.", + }, + { + bonuses: { + hacknet_node_money_mult: 1.2, + hacknet_node_purchase_cost_mult: 0.85, + hacknet_node_ram_cost_mult: 0.85, + hacknet_node_core_cost_mult: 0.85, + hacknet_node_level_cost_mult: 0.85, + }, + description: + "Increases the amount of money produced by Hacknet Nodes by 20%.
" + + "Decreases all costs related to Hacknet Node by 15%.", + }, + { + bonuses: { + company_rep_mult: 1.25, + faction_rep_mult: 1.15, + work_money_mult: 1.7, + }, + description: + "Increases the amount of money the player gains from working by 70%.
" + + "Increases the amount of reputation the player gains when working for a company by 25%.
" + + "Increases the amount of reputation the player gains for a faction by 15%.", + }, + { + bonuses: { + crime_success_mult: 2, + crime_money_mult: 2, + }, + description: + "Increases the player's crime success rate by 100%.
" + + "Increases the amount of money the player gains from crimes by 100%.", + }, + ]; + + const randomNumber = new WHRNG(Math.floor(Player.lastUpdate / 3600000)); + for (let i = 0; i < 5; i++) randomNumber.step(); + + return bonuses[Math.floor(bonuses.length * randomNumber.random())]; +} + +export const generalAugmentations = [ + new Augmentation({ + name: AugmentationNames.HemoRecirculator, + moneyCost: 4.5e7, + repCost: 1e4, + info: "A heart implant that greatly increases the body's ability to effectively use and pump blood.", + strength_mult: 1.08, + defense_mult: 1.08, + agility_mult: 1.08, + dexterity_mult: 1.08, + factions: [FactionNames.Tetrads, FactionNames.TheDarkArmy, FactionNames.TheSyndicate], + }), + new Augmentation({ + name: AugmentationNames.Targeting1, + moneyCost: 1.5e7, + repCost: 5e3, + info: + "A cranial implant that is embedded within the inner ear structures and optic nerves. It regulates " + + "and enhances balance and hand-eye coordination.", + dexterity_mult: 1.1, + factions: [ + FactionNames.SlumSnakes, + FactionNames.TheDarkArmy, + FactionNames.TheSyndicate, + FactionNames.Sector12, + FactionNames.Ishima, + FactionNames.OmniTekIncorporated, + FactionNames.KuaiGongInternational, + FactionNames.BladeIndustries, + ], + }), + new Augmentation({ + name: AugmentationNames.Targeting2, + moneyCost: 4.25e7, + repCost: 8.75e3, + info: + "This upgraded version of the 'Augmented Targeting' implant is capable of augmenting " + + "reality by digitally displaying weaknesses and vital signs of threats.", + prereqs: [AugmentationNames.Targeting1], + dexterity_mult: 1.2, + factions: [ + FactionNames.TheDarkArmy, + FactionNames.TheSyndicate, + FactionNames.Sector12, + FactionNames.OmniTekIncorporated, + FactionNames.KuaiGongInternational, + FactionNames.BladeIndustries, + ], + }), + new Augmentation({ + name: AugmentationNames.Targeting3, + moneyCost: 1.15e8, + repCost: 2.75e4, + info: "The latest version of the 'Augmented Targeting' implant adds the ability to lock-on and track threats.", + prereqs: [AugmentationNames.Targeting2], + dexterity_mult: 1.3, + factions: [ + FactionNames.TheDarkArmy, + FactionNames.TheSyndicate, + FactionNames.OmniTekIncorporated, + FactionNames.KuaiGongInternational, + FactionNames.BladeIndustries, + FactionNames.TheCovenant, + ], + }), + new Augmentation({ + name: AugmentationNames.SyntheticHeart, + moneyCost: 2.875e9, + repCost: 7.5e5, + info: + "This advanced artificial heart, created from plasteel and graphene, is capable of pumping blood " + + "more efficiently than an organic heart.", + agility_mult: 1.5, + strength_mult: 1.5, + factions: [ + FactionNames.KuaiGongInternational, + FactionNames.FulcrumSecretTechnologies, + FactionNames.SpeakersForTheDead, + FactionNames.NWO, + FactionNames.TheCovenant, + FactionNames.Daedalus, + FactionNames.Illuminati, + ], + }), + new Augmentation({ + name: AugmentationNames.SynfibrilMuscle, + repCost: 4.375e5, + moneyCost: 1.125e9, + info: + "The myofibrils in human muscles are injected with special chemicals that react with the proteins inside " + + "the myofibrils, altering their underlying structure. The end result is muscles that are stronger and more elastic. " + + "Scientists have named these artificially enhanced units 'synfibrils'.", + strength_mult: 1.3, + defense_mult: 1.3, + factions: [ + FactionNames.KuaiGongInternational, + FactionNames.FulcrumSecretTechnologies, + FactionNames.SpeakersForTheDead, + FactionNames.NWO, + FactionNames.TheCovenant, + FactionNames.Daedalus, + FactionNames.Illuminati, + FactionNames.BladeIndustries, + ], + }), + new Augmentation({ + name: AugmentationNames.CombatRib1, + repCost: 7.5e3, + moneyCost: 2.375e7, + info: + "The rib cage is augmented to continuously release boosters into the bloodstream " + + "which increase the oxygen-carrying capacity of blood.", + strength_mult: 1.1, + defense_mult: 1.1, + factions: [ + FactionNames.SlumSnakes, + FactionNames.TheDarkArmy, + FactionNames.TheSyndicate, + FactionNames.Volhaven, + FactionNames.Ishima, + FactionNames.OmniTekIncorporated, + FactionNames.KuaiGongInternational, + FactionNames.BladeIndustries, + ], + }), + new Augmentation({ + name: AugmentationNames.CombatRib2, + repCost: 1.875e4, + moneyCost: 6.5e7, + info: + "An upgraded version of the 'Combat Rib' augmentation that adds potent stimulants which " + + "improve focus and endurance while decreasing reaction time and fatigue.", + prereqs: [AugmentationNames.CombatRib1], + strength_mult: 1.14, + defense_mult: 1.14, + factions: [ + FactionNames.TheDarkArmy, + FactionNames.TheSyndicate, + FactionNames.Volhaven, + FactionNames.OmniTekIncorporated, + FactionNames.KuaiGongInternational, + FactionNames.BladeIndustries, + ], + }), + new Augmentation({ + name: AugmentationNames.CombatRib3, + repCost: 3.5e4, + moneyCost: 1.2e8, + info: + "The latest version of the 'Combat Rib' augmentation releases advanced anabolic steroids that " + + "improve muscle mass and physical performance while being safe and free of side effects.", + prereqs: [AugmentationNames.CombatRib2], + strength_mult: 1.18, + defense_mult: 1.18, + factions: [ + FactionNames.TheDarkArmy, + FactionNames.TheSyndicate, + FactionNames.OmniTekIncorporated, + FactionNames.KuaiGongInternational, + FactionNames.BladeIndustries, + FactionNames.TheCovenant, + ], + }), + new Augmentation({ + name: AugmentationNames.NanofiberWeave, + repCost: 3.75e4, + moneyCost: 1.25e8, + info: + "Synthetic nanofibers are woven into the skin's extracellular matrix using electrospinning, " + + "which improves its regenerative and extracellular homeostasis abilities.", + strength_mult: 1.2, + defense_mult: 1.2, + factions: [ + FactionNames.TheDarkArmy, + FactionNames.TheSyndicate, + FactionNames.OmniTekIncorporated, + FactionNames.BladeIndustries, + FactionNames.TianDiHui, + FactionNames.SpeakersForTheDead, + FactionNames.FulcrumSecretTechnologies, + ], + }), + new Augmentation({ + name: AugmentationNames.SubdermalArmor, + repCost: 8.75e5, + moneyCost: 3.25e9, + info: + "The NEMEAN Subdermal Weave is a thin, light-weight, graphene plating that houses a dilatant fluid. " + + "The material is implanted underneath the skin, and is the most advanced form of defensive enhancement " + + "that has ever been created. The dilatant fluid, despite being thin and light, is extremely effective " + + "at stopping piercing blows and reducing blunt trauma. The properties of graphene allow the plating to " + + "mitigate damage from any fire or electrical traumas.", + defense_mult: 2.2, + factions: [ + FactionNames.TheSyndicate, + FactionNames.FulcrumSecretTechnologies, + FactionNames.Illuminati, + FactionNames.Daedalus, + FactionNames.TheCovenant, + ], + }), + new Augmentation({ + name: AugmentationNames.WiredReflexes, + repCost: 1.25e3, + moneyCost: 2.5e6, + info: + "Synthetic nerve-enhancements are injected into all major parts of the somatic nervous system, " + + "supercharging the spread of neural signals and increasing reflex speed.", + agility_mult: 1.05, + dexterity_mult: 1.05, + factions: [ + FactionNames.TianDiHui, + FactionNames.SlumSnakes, + FactionNames.Sector12, + FactionNames.Volhaven, + FactionNames.Aevum, + FactionNames.Ishima, + FactionNames.TheSyndicate, + FactionNames.TheDarkArmy, + FactionNames.SpeakersForTheDead, + ], + }), + new Augmentation({ + name: AugmentationNames.GrapheneBoneLacings, + repCost: 1.125e6, + moneyCost: 4.25e9, + info: "Graphene is grafted and fused into the skeletal structure, enhancing bone density and tensile strength.", + strength_mult: 1.7, + defense_mult: 1.7, + factions: [FactionNames.FulcrumSecretTechnologies, FactionNames.TheCovenant], + }), + new Augmentation({ + name: AugmentationNames.BionicSpine, + repCost: 4.5e4, + moneyCost: 1.25e8, + info: + "The spine is reconstructed using plasteel and carbon fibers. " + + "It is now capable of stimulating and regulating neural signals " + + "passing through the spinal cord, improving senses and reaction speed. " + + "The 'Bionic Spine' also interfaces with all other 'Bionic' implants.", + strength_mult: 1.15, + defense_mult: 1.15, + agility_mult: 1.15, + dexterity_mult: 1.15, + factions: [ + FactionNames.SpeakersForTheDead, + FactionNames.TheSyndicate, + FactionNames.KuaiGongInternational, + FactionNames.OmniTekIncorporated, + FactionNames.BladeIndustries, + ], + }), + new Augmentation({ + name: AugmentationNames.GrapheneBionicSpine, + repCost: 1.625e6, + moneyCost: 6e9, + info: + "An upgrade to the 'Bionic Spine' augmentation. The spine is fused with graphene " + + "which enhances durability and supercharges all body functions.", + prereqs: [AugmentationNames.BionicSpine], + strength_mult: 1.6, + defense_mult: 1.6, + agility_mult: 1.6, + dexterity_mult: 1.6, + factions: [FactionNames.FulcrumSecretTechnologies, FactionNames.ECorp], + }), + new Augmentation({ + name: AugmentationNames.BionicLegs, + repCost: 1.5e5, + moneyCost: 3.75e8, + info: "Cybernetic legs, created from plasteel and carbon fibers, enhance running speed.", + agility_mult: 1.6, + factions: [ + FactionNames.SpeakersForTheDead, + FactionNames.TheSyndicate, + FactionNames.KuaiGongInternational, + FactionNames.OmniTekIncorporated, + FactionNames.BladeIndustries, + ], + }), + new Augmentation({ + name: AugmentationNames.GrapheneBionicLegs, + repCost: 7.5e5, + moneyCost: 4.5e9, + info: + "An upgrade to the 'Bionic Legs' augmentation. The legs are fused " + + "with graphene, greatly enhancing jumping ability.", + prereqs: [AugmentationNames.BionicLegs], + agility_mult: 2.5, + factions: [FactionNames.MegaCorp, FactionNames.ECorp, FactionNames.FulcrumSecretTechnologies], + }), + new Augmentation({ + name: AugmentationNames.SpeechProcessor, + repCost: 7.5e3, + moneyCost: 5e7, + info: + "A cochlear implant with an embedded computer that analyzes incoming speech. " + + "The embedded computer processes characteristics of incoming speech, such as tone " + + "and inflection, to pick up on subtle cues and aid in social interactions.", + charisma_mult: 1.2, + factions: [ + FactionNames.TianDiHui, + FactionNames.Chongqing, + FactionNames.Sector12, + FactionNames.NewTokyo, + FactionNames.Aevum, + FactionNames.Ishima, + FactionNames.Volhaven, + FactionNames.Silhouette, + ], + }), + new Augmentation({ + name: AugmentationNames.TITN41Injection, + repCost: 2.5e4, + moneyCost: 1.9e8, + info: + "TITN is a series of viruses that targets and alters the sequences of human DNA in genes that " + + "control personality. The TITN-41 strain alters these genes so that the subject becomes more " + + "outgoing and socialable.", + charisma_mult: 1.15, + charisma_exp_mult: 1.15, + factions: [FactionNames.Silhouette], + }), + new Augmentation({ + name: AugmentationNames.EnhancedSocialInteractionImplant, + repCost: 3.75e5, + moneyCost: 1.375e9, + info: + "A cranial implant that greatly assists in the user's ability to analyze social situations " + + "and interactions. The system uses a wide variety of factors such as facial expressions, body " + + "language, and the voice tone, and inflection to determine the best course of action during social" + + "situations. The implant also uses deep learning software to continuously learn new behavior" + + "patterns and how to best respond.", + charisma_mult: 1.6, + charisma_exp_mult: 1.6, + factions: [ + FactionNames.BachmanAssociates, + FactionNames.NWO, + FactionNames.ClarkeIncorporated, + FactionNames.OmniTekIncorporated, + FactionNames.FourSigma, + ], + }), + new Augmentation({ + name: AugmentationNames.BitWire, + repCost: 3.75e3, + moneyCost: 1e7, + info: + "A small brain implant embedded in the cerebrum. This regulates and improves the brain's computing " + + "capabilities.", + hacking_mult: 1.05, + factions: [FactionNames.CyberSec, FactionNames.NiteSec], + }), + new Augmentation({ + name: AugmentationNames.ArtificialBioNeuralNetwork, + repCost: 2.75e5, + moneyCost: 3e9, + info: + "A network consisting of millions of nanoprocessors is embedded into the brain. " + + "The network is meant to mimic the way a biological brain solves a problem, with each " + + "nanoprocessor acting similar to the way a neuron would in a neural network. However, these " + + "nanoprocessors are programmed to perform computations much faster than organic neurons, " + + "allowing the user to solve much more complex problems at a much faster rate.", + hacking_speed_mult: 1.03, + hacking_money_mult: 1.15, + hacking_mult: 1.12, + factions: [FactionNames.BitRunners, FactionNames.FulcrumSecretTechnologies], + }), + new Augmentation({ + name: AugmentationNames.ArtificialSynapticPotentiation, + repCost: 6.25e3, + moneyCost: 8e7, + info: + "The body is injected with a chemical that artificially induces synaptic potentiation, " + + "otherwise known as the strengthening of synapses. This results in enhanced cognitive abilities.", + hacking_speed_mult: 1.02, + hacking_chance_mult: 1.05, + hacking_exp_mult: 1.05, + factions: [FactionNames.TheBlackHand, FactionNames.NiteSec], + }), + new Augmentation({ + name: AugmentationNames.EnhancedMyelinSheathing, + repCost: 1e5, + moneyCost: 1.375e9, + info: + "Electrical signals are used to induce a new, artificial form of myelinogenesis in the human body. " + + "This process results in the proliferation of new, synthetic myelin sheaths in the nervous " + + "system. These myelin sheaths can propogate neuro-signals much faster than their organic " + + "counterparts, leading to greater processing speeds and better brain function.", + hacking_speed_mult: 1.03, + hacking_exp_mult: 1.1, + hacking_mult: 1.08, + factions: [FactionNames.FulcrumSecretTechnologies, FactionNames.BitRunners, FactionNames.TheBlackHand], + }), + new Augmentation({ + name: AugmentationNames.SynapticEnhancement, + repCost: 2e3, + moneyCost: 7.5e6, + info: + "A small cranial implant that continuously uses weak electrical signals to stimulate the brain and " + + "induce stronger synaptic activity. This improves the user's cognitive abilities.", + hacking_speed_mult: 1.03, + factions: [FactionNames.CyberSec, FactionNames.Aevum], + }), + new Augmentation({ + name: AugmentationNames.NeuralRetentionEnhancement, + repCost: 2e4, + moneyCost: 2.5e8, + info: + "Chemical injections are used to permanently alter and strengthen the brain's neuronal " + + "circuits, strengthening the ability to retain information.", + hacking_exp_mult: 1.25, + factions: [FactionNames.NiteSec], + }), + new Augmentation({ + name: AugmentationNames.DataJack, + repCost: 1.125e5, + moneyCost: 4.5e8, + info: + "A brain implant that provides an interface for direct, wireless communication between a computer's main " + + "memory and the mind. This implant allows the user to not only access a computer's memory, but also alter " + + "and delete it.", + hacking_money_mult: 1.25, + factions: [ + FactionNames.BitRunners, + FactionNames.TheBlackHand, + FactionNames.NiteSec, + FactionNames.Chongqing, + FactionNames.NewTokyo, + ], + }), + new Augmentation({ + name: AugmentationNames.ENM, + repCost: 1.5e4, + moneyCost: 2.5e8, + info: + "A thin device embedded inside the arm containing a wireless module capable of connecting " + + "to nearby networks. Once connected, the Netburner Module is capable of capturing and " + + "processing all of the traffic on that network. By itself, the Embedded Netburner Module does " + + "not do much, but a variety of very powerful upgrades can be installed that allow you to fully " + + "control the traffic on a network.", + hacking_mult: 1.08, + factions: [ + FactionNames.BitRunners, + FactionNames.TheBlackHand, + FactionNames.NiteSec, + FactionNames.ECorp, + FactionNames.MegaCorp, + FactionNames.FulcrumSecretTechnologies, + FactionNames.NWO, + FactionNames.BladeIndustries, + ], + }), + new Augmentation({ + name: AugmentationNames.ENMCore, + repCost: 175e3, + moneyCost: 2.5e9, + info: + "The Core library is an implant that upgrades the firmware of the Embedded Netburner Module. " + + "This upgrade allows the Embedded Netburner Module to generate its own data on a network.", + prereqs: [AugmentationNames.ENM], + hacking_speed_mult: 1.03, + hacking_money_mult: 1.1, + hacking_chance_mult: 1.03, + hacking_exp_mult: 1.07, + hacking_mult: 1.07, + factions: [ + FactionNames.BitRunners, + FactionNames.TheBlackHand, + FactionNames.ECorp, + FactionNames.MegaCorp, + FactionNames.FulcrumSecretTechnologies, + FactionNames.NWO, + FactionNames.BladeIndustries, + ], + }), + new Augmentation({ + name: AugmentationNames.ENMCoreV2, + repCost: 1e6, + moneyCost: 4.5e9, + info: + "The Core V2 library is an implant that upgrades the firmware of the Embedded Netburner Module. " + + "This upgraded firmware allows the Embedded Netburner Module to control information on " + + "a network by re-routing traffic, spoofing IP addresses, and altering the data inside network " + + "packets.", + prereqs: [AugmentationNames.ENMCore], + hacking_speed_mult: 1.05, + hacking_money_mult: 1.3, + hacking_chance_mult: 1.05, + hacking_exp_mult: 1.15, + hacking_mult: 1.08, + factions: [ + FactionNames.BitRunners, + FactionNames.ECorp, + FactionNames.MegaCorp, + FactionNames.FulcrumSecretTechnologies, + FactionNames.NWO, + FactionNames.BladeIndustries, + FactionNames.OmniTekIncorporated, + FactionNames.KuaiGongInternational, + ], + }), + new Augmentation({ + name: AugmentationNames.ENMCoreV3, + repCost: 1.75e6, + moneyCost: 7.5e9, + info: + "The Core V3 library is an implant that upgrades the firmware of the Embedded Netburner Module. " + + "This upgraded firmware allows the Embedded Netburner Module to seamlessly inject code into " + + "any device on a network.", + prereqs: [AugmentationNames.ENMCoreV2], + hacking_speed_mult: 1.05, + hacking_money_mult: 1.4, + hacking_chance_mult: 1.1, + hacking_exp_mult: 1.25, + hacking_mult: 1.1, + factions: [ + FactionNames.ECorp, + FactionNames.MegaCorp, + FactionNames.FulcrumSecretTechnologies, + FactionNames.NWO, + FactionNames.Daedalus, + FactionNames.TheCovenant, + FactionNames.Illuminati, + ], + }), + new Augmentation({ + name: AugmentationNames.ENMAnalyzeEngine, + repCost: 6.25e5, + moneyCost: 6e9, + info: + "Installs the Analyze Engine for the Embedded Netburner Module, which is a CPU cluster " + + "that vastly outperforms the Netburner Module's native single-core processor.", + prereqs: [AugmentationNames.ENM], + hacking_speed_mult: 1.1, + factions: [ + FactionNames.ECorp, + FactionNames.MegaCorp, + FactionNames.FulcrumSecretTechnologies, + FactionNames.NWO, + FactionNames.Daedalus, + FactionNames.TheCovenant, + FactionNames.Illuminati, + ], + }), + new Augmentation({ + name: AugmentationNames.ENMDMA, + repCost: 1e6, + moneyCost: 7e9, + info: + "This implant installs a Direct Memory Access (DMA) controller into the " + + "Embedded Netburner Module. This allows the Module to send and receive data " + + "directly to and from the main memory of devices on a network.", + prereqs: [AugmentationNames.ENM], + hacking_money_mult: 1.4, + hacking_chance_mult: 1.2, + factions: [ + FactionNames.ECorp, + FactionNames.MegaCorp, + FactionNames.FulcrumSecretTechnologies, + FactionNames.NWO, + FactionNames.Daedalus, + FactionNames.TheCovenant, + FactionNames.Illuminati, + ], + }), + new Augmentation({ + name: AugmentationNames.Neuralstimulator, + repCost: 5e4, + moneyCost: 3e9, + info: + "A cranial implant that intelligently stimulates certain areas of the brain " + + "in order to improve cognitive functions.", + hacking_speed_mult: 1.02, + hacking_chance_mult: 1.1, + hacking_exp_mult: 1.12, + factions: [ + FactionNames.TheBlackHand, + FactionNames.Chongqing, + FactionNames.Sector12, + FactionNames.NewTokyo, + FactionNames.Aevum, + FactionNames.Ishima, + FactionNames.Volhaven, + FactionNames.BachmanAssociates, + FactionNames.ClarkeIncorporated, + FactionNames.FourSigma, + ], + }), + new Augmentation({ + name: AugmentationNames.NeuralAccelerator, + repCost: 2e5, + moneyCost: 1.75e9, + info: + "A microprocessor that accelerates the processing " + + "speed of biological neural networks. This is a cranial implant that is embedded inside the brain.", + hacking_mult: 1.1, + hacking_exp_mult: 1.15, + hacking_money_mult: 1.2, + factions: [FactionNames.BitRunners], + }), + new Augmentation({ + name: AugmentationNames.CranialSignalProcessorsG1, + repCost: 1e4, + moneyCost: 7e7, + info: + "The first generation of Cranial Signal Processors. Cranial Signal Processors " + + "are a set of specialized microprocessors that are attached to " + + "neurons in the brain. These chips process neural signals to quickly and automatically perform specific computations " + + "so that the brain doesn't have to.", + hacking_speed_mult: 1.01, + hacking_mult: 1.05, + factions: [FactionNames.CyberSec], + }), + new Augmentation({ + name: AugmentationNames.CranialSignalProcessorsG2, + repCost: 1.875e4, + moneyCost: 1.25e8, + info: + "The second generation of Cranial Signal Processors. Cranial Signal Processors " + + "are a set of specialized microprocessors that are attached to " + + "neurons in the brain. These chips process neural signals to quickly and automatically perform specific computations " + + "so that the brain doesn't have to.", + prereqs: [AugmentationNames.CranialSignalProcessorsG1], + hacking_speed_mult: 1.02, + hacking_chance_mult: 1.05, + hacking_mult: 1.07, + factions: [FactionNames.CyberSec, FactionNames.NiteSec], + }), + new Augmentation({ + name: AugmentationNames.CranialSignalProcessorsG3, + repCost: 5e4, + moneyCost: 5.5e8, + info: + "The third generation of Cranial Signal Processors. Cranial Signal Processors " + + "are a set of specialized microprocessors that are attached to " + + "neurons in the brain. These chips process neural signals to quickly and automatically perform specific computations " + + "so that the brain doesn't have to.", + prereqs: [AugmentationNames.CranialSignalProcessorsG2], + hacking_speed_mult: 1.02, + hacking_money_mult: 1.15, + hacking_mult: 1.09, + factions: [FactionNames.NiteSec, FactionNames.TheBlackHand, FactionNames.BitRunners], + }), + new Augmentation({ + name: AugmentationNames.CranialSignalProcessorsG4, + repCost: 1.25e5, + moneyCost: 1.1e9, + info: + "The fourth generation of Cranial Signal Processors. Cranial Signal Processors " + + "are a set of specialized microprocessors that are attached to " + + "neurons in the brain. These chips process neural signals to quickly and automatically perform specific computations " + + "so that the brain doesn't have to.", + prereqs: [AugmentationNames.CranialSignalProcessorsG3], + hacking_speed_mult: 1.02, + hacking_money_mult: 1.2, + hacking_grow_mult: 1.25, + factions: [FactionNames.TheBlackHand, FactionNames.BitRunners], + }), + new Augmentation({ + name: AugmentationNames.CranialSignalProcessorsG5, + repCost: 2.5e5, + moneyCost: 2.25e9, + info: + "The fifth generation of Cranial Signal Processors. Cranial Signal Processors " + + "are a set of specialized microprocessors that are attached to " + + "neurons in the brain. These chips process neural signals to quickly and automatically perform specific computations " + + "so that the brain doesn't have to.", + prereqs: [AugmentationNames.CranialSignalProcessorsG4], + hacking_mult: 1.3, + hacking_money_mult: 1.25, + hacking_grow_mult: 1.75, + factions: [FactionNames.BitRunners], + }), + new Augmentation({ + name: AugmentationNames.NeuronalDensification, + repCost: 1.875e5, + moneyCost: 1.375e9, + info: + "The brain is surgically re-engineered to have increased neuronal density " + + "by decreasing the neuron gap junction. Then, the body is genetically modified " + + "to enhance the production and capabilities of its neural stem cells.", + hacking_mult: 1.15, + hacking_exp_mult: 1.1, + hacking_speed_mult: 1.03, + factions: [FactionNames.ClarkeIncorporated], + }), + new Augmentation({ + name: AugmentationNames.NuoptimalInjectorImplant, + repCost: 5e3, + moneyCost: 2e7, + info: + "This torso implant automatically injects nootropic supplements into " + + "the bloodstream to improve memory, increase focus, and provide other " + + "cognitive enhancements.", + company_rep_mult: 1.2, + factions: [ + FactionNames.TianDiHui, + FactionNames.Volhaven, + FactionNames.NewTokyo, + FactionNames.Chongqing, + FactionNames.ClarkeIncorporated, + FactionNames.FourSigma, + FactionNames.BachmanAssociates, + ], + }), + new Augmentation({ + name: AugmentationNames.SpeechEnhancement, + repCost: 2.5e3, + moneyCost: 1.25e7, + info: + "An advanced neural implant that improves your speaking abilities, making " + + "you more convincing and likable in conversations and overall improving your " + + "social interactions.", + company_rep_mult: 1.1, + charisma_mult: 1.1, + factions: [ + FactionNames.TianDiHui, + FactionNames.SpeakersForTheDead, + FactionNames.FourSigma, + FactionNames.KuaiGongInternational, + FactionNames.ClarkeIncorporated, + FactionNames.BachmanAssociates, + ], + }), + new Augmentation({ + name: AugmentationNames.FocusWire, + repCost: 7.5e4, + moneyCost: 9e8, + info: "A cranial implant that stops procrastination by blocking specific neural pathways in the brain.", + hacking_exp_mult: 1.05, + strength_exp_mult: 1.05, + defense_exp_mult: 1.05, + dexterity_exp_mult: 1.05, + agility_exp_mult: 1.05, + charisma_exp_mult: 1.05, + company_rep_mult: 1.1, + work_money_mult: 1.2, + factions: [ + FactionNames.BachmanAssociates, + FactionNames.ClarkeIncorporated, + FactionNames.FourSigma, + FactionNames.KuaiGongInternational, + ], + }), + new Augmentation({ + name: AugmentationNames.PCDNI, + repCost: 3.75e5, + moneyCost: 3.75e9, + info: + "Installs a Direct-Neural Interface jack into your arm that is compatible with most " + + "computers. Connecting to a computer through this jack allows you to interface with " + + "it using the brain's electrochemical signals.", + company_rep_mult: 1.3, + hacking_mult: 1.08, + factions: [ + FactionNames.FourSigma, + FactionNames.OmniTekIncorporated, + FactionNames.ECorp, + FactionNames.BladeIndustries, + ], + }), + new Augmentation({ + name: AugmentationNames.PCDNIOptimizer, + repCost: 5e5, + moneyCost: 4.5e9, + info: + "This is a submodule upgrade to the PC Direct-Neural Interface augmentation. It " + + "improves the performance of the interface and gives the user more control options " + + "to a connected computer.", + prereqs: [AugmentationNames.PCDNI], + company_rep_mult: 1.75, + hacking_mult: 1.1, + factions: [FactionNames.FulcrumSecretTechnologies, FactionNames.ECorp, FactionNames.BladeIndustries], + }), + new Augmentation({ + name: AugmentationNames.PCDNINeuralNetwork, + repCost: 1.5e6, + moneyCost: 7.5e9, + info: + "This is an additional installation that upgrades the functionality of the " + + "PC Direct-Neural Interface augmentation. When connected to a computer, " + + "The Neural Network upgrade allows the user to use their own brain's " + + "processing power to aid the computer in computational tasks.", + prereqs: [AugmentationNames.PCDNI], + company_rep_mult: 2, + hacking_mult: 1.1, + hacking_speed_mult: 1.05, + factions: [FactionNames.FulcrumSecretTechnologies], + }), + new Augmentation({ + name: AugmentationNames.ADRPheromone1, + repCost: 3.75e3, + moneyCost: 1.75e7, + info: + "The body is genetically re-engineered so that it produces the ADR-V1 pheromone, " + + "an artificial pheromone discovered by scientists. The ADR-V1 pheromone, when excreted, " + + "triggers feelings of admiration and approval in other people.", + company_rep_mult: 1.1, + faction_rep_mult: 1.1, + factions: [ + FactionNames.TianDiHui, + FactionNames.TheSyndicate, + FactionNames.NWO, + FactionNames.MegaCorp, + FactionNames.FourSigma, + ], + }), + new Augmentation({ + name: AugmentationNames.ADRPheromone2, + repCost: 6.25e4, + moneyCost: 5.5e8, + info: + "The body is genetically re-engineered so that it produces the ADR-V2 pheromone, " + + "which is similar to but more potent than ADR-V1. This pheromone, when excreted, " + + "triggers feelings of admiration, approval, and respect in others.", + company_rep_mult: 1.2, + faction_rep_mult: 1.2, + factions: [ + FactionNames.Silhouette, + FactionNames.FourSigma, + FactionNames.BachmanAssociates, + FactionNames.ClarkeIncorporated, + ], + }), + new Augmentation({ + name: AugmentationNames.ShadowsSimulacrum, + repCost: 3.75e4, + moneyCost: 4e8, + info: + "A crude but functional matter phase-shifter module that is embedded " + + "in the brainstem and cerebellum. This augmentation was developed by " + + "criminal organizations and allows the user to project and control holographic " + + "simulacrums within a large radius. These simulacrums are commonly used for " + + "espionage and surveillance work.", + company_rep_mult: 1.15, + faction_rep_mult: 1.15, + factions: [FactionNames.TheSyndicate, FactionNames.TheDarkArmy, FactionNames.SpeakersForTheDead], + }), + new Augmentation({ + name: AugmentationNames.HacknetNodeCPUUpload, + repCost: 3.75e3, + moneyCost: 1.1e7, + info: + "Uploads the architecture and design details of a Hacknet Node's CPU into " + + "the brain. This allows the user to engineer custom hardware and software " + + "for the Hacknet Node that provides better performance.", + hacknet_node_money_mult: 1.15, + hacknet_node_purchase_cost_mult: 0.85, + factions: [FactionNames.Netburners], + }), + new Augmentation({ + name: AugmentationNames.HacknetNodeCacheUpload, + repCost: 2.5e3, + moneyCost: 5.5e6, + info: + "Uploads the architecture and design details of a Hacknet Node's main-memory cache " + + "into the brain. This allows the user to engineer custom cache hardware for the " + + "Hacknet Node that offers better performance.", + hacknet_node_money_mult: 1.1, + hacknet_node_level_cost_mult: 0.85, + factions: [FactionNames.Netburners], + }), + new Augmentation({ + name: AugmentationNames.HacknetNodeNICUpload, + repCost: 1.875e3, + moneyCost: 4.5e6, + info: + "Uploads the architecture and design details of a Hacknet Node's Network Interface Card (NIC) " + + "into the brain. This allows the user to engineer a custom NIC for the Hacknet Node that " + + "offers better performance.", + hacknet_node_money_mult: 1.1, + hacknet_node_purchase_cost_mult: 0.9, + factions: [FactionNames.Netburners], + }), + new Augmentation({ + name: AugmentationNames.HacknetNodeKernelDNI, + repCost: 7.5e3, + moneyCost: 4e7, + info: + "Installs a Direct-Neural Interface jack into the arm that is capable of connecting to a " + + "Hacknet Node. This lets the user access and manipulate the Node's kernel using " + + "electrochemical signals.", + hacknet_node_money_mult: 1.25, + factions: [FactionNames.Netburners], + }), + new Augmentation({ + name: AugmentationNames.HacknetNodeCoreDNI, + repCost: 1.25e4, + moneyCost: 6e7, + info: + "Installs a Direct-Neural Interface jack into the arm that is capable of connecting " + + "to a Hacknet Node. This lets the user access and manipulate the Node's processing logic using " + + "electrochemical signals.", + hacknet_node_money_mult: 1.45, + factions: [FactionNames.Netburners], + }), + new Augmentation({ + name: AugmentationNames.Neurotrainer1, + repCost: 1e3, + moneyCost: 4e6, + info: + "A decentralized cranial implant that improves the brain's ability to learn. It is " + + "installed by releasing millions of nanobots into the human brain, each of which " + + "attaches to a different neural pathway to enhance the brain's ability to retain " + + "and retrieve information.", + hacking_exp_mult: 1.1, + strength_exp_mult: 1.1, + defense_exp_mult: 1.1, + dexterity_exp_mult: 1.1, + agility_exp_mult: 1.1, + charisma_exp_mult: 1.1, + factions: [FactionNames.CyberSec, FactionNames.Aevum], + }), + new Augmentation({ + name: AugmentationNames.Neurotrainer2, + repCost: 1e4, + moneyCost: 4.5e7, + info: + "A decentralized cranial implant that improves the brain's ability to learn. This " + + "is a more powerful version of the Neurotrainer I augmentation, but it does not " + + "require Neurotrainer I to be installed as a prerequisite.", + hacking_exp_mult: 1.15, + strength_exp_mult: 1.15, + defense_exp_mult: 1.15, + dexterity_exp_mult: 1.15, + agility_exp_mult: 1.15, + charisma_exp_mult: 1.15, + factions: [FactionNames.BitRunners, FactionNames.NiteSec], + }), + new Augmentation({ + name: AugmentationNames.Neurotrainer3, + repCost: 2.5e4, + moneyCost: 1.3e8, + info: + "A decentralized cranial implant that improves the brain's ability to learn. This " + + "is a more powerful version of the Neurotrainer I and Neurotrainer II augmentation, " + + "but it does not require either of them to be installed as a prerequisite.", + hacking_exp_mult: 1.2, + strength_exp_mult: 1.2, + defense_exp_mult: 1.2, + dexterity_exp_mult: 1.2, + agility_exp_mult: 1.2, + charisma_exp_mult: 1.2, + factions: [FactionNames.NWO, FactionNames.FourSigma], + }), + new Augmentation({ + name: AugmentationNames.Hypersight, + repCost: 1.5e5, + moneyCost: 2.75e9, + info: + "A bionic eye implant that grants sight capabilities far beyond those of a natural human. " + + "Embedded circuitry within the implant provides the ability to detect heat and movement " + + "through solid objects such as walls, thus providing 'x-ray vision'-like capabilities.", + dexterity_mult: 1.4, + hacking_speed_mult: 1.03, + hacking_money_mult: 1.1, + factions: [FactionNames.BladeIndustries, FactionNames.KuaiGongInternational], + }), + new Augmentation({ + name: AugmentationNames.LuminCloaking1, + repCost: 1.5e3, + moneyCost: 5e6, + info: + "A skin implant that reinforces the skin with highly-advanced synthetic cells. These " + + "cells, when powered, have a negative refractive index. As a result, they bend light " + + "around the skin, making the user much harder to see to the naked eye.", + agility_mult: 1.05, + crime_money_mult: 1.1, + factions: [FactionNames.SlumSnakes, FactionNames.Tetrads], + }), + new Augmentation({ + name: AugmentationNames.LuminCloaking2, + repCost: 5e3, + moneyCost: 3e7, + info: + "This is a more advanced version of the LuminCloaking-V1 augmentation. This skin implant " + + "reinforces the skin with highly-advanced synthetic cells. These " + + "cells, when powered, are capable of not only bending light but also of bending heat, " + + "making the user more resilient as well as stealthy.", + prereqs: [AugmentationNames.LuminCloaking1], + agility_mult: 1.1, + defense_mult: 1.1, + crime_money_mult: 1.25, + factions: [FactionNames.SlumSnakes, FactionNames.Tetrads], + }), + new Augmentation({ + name: AugmentationNames.SmartSonar, + repCost: 2.25e4, + moneyCost: 7.5e7, + info: "A cochlear implant that helps the player detect and locate enemies using sound propagation.", + dexterity_mult: 1.1, + dexterity_exp_mult: 1.15, + crime_money_mult: 1.25, + factions: [FactionNames.SlumSnakes], + }), + new Augmentation({ + name: AugmentationNames.PowerRecirculator, + repCost: 2.5e4, + moneyCost: 1.8e8, + info: + "The body's nerves are attached with polypyrrole nanocircuits that " + + "are capable of capturing wasted energy, in the form of heat, " + + "and converting it back into usable power.", + hacking_mult: 1.05, + strength_mult: 1.05, + defense_mult: 1.05, + dexterity_mult: 1.05, + agility_mult: 1.05, + charisma_mult: 1.05, + hacking_exp_mult: 1.1, + strength_exp_mult: 1.1, + defense_exp_mult: 1.1, + dexterity_exp_mult: 1.1, + agility_exp_mult: 1.1, + charisma_exp_mult: 1.1, + factions: [FactionNames.Tetrads, FactionNames.TheDarkArmy, FactionNames.TheSyndicate, FactionNames.NWO], + }), + new Augmentation({ + name: AugmentationNames.QLink, + repCost: 1.875e6, + moneyCost: 2.5e13, + info: + `A brain implant that wirelessly connects you to the ${FactionNames.Illuminati}'s ` + + "quantum supercomputer, allowing you to access and use its incredible " + + "computing power.", + hacking_mult: 1.75, + hacking_speed_mult: 2, + hacking_chance_mult: 2.5, + hacking_money_mult: 4, + factions: [FactionNames.Illuminati], + }), + new Augmentation({ + name: AugmentationNames.SPTN97, + repCost: 1.25e6, + moneyCost: 4.875e9, + info: + "The SPTN-97 gene is injected into the genome. The SPTN-97 gene is an " + + "artificially-synthesized gene that was developed by DARPA to create " + + "super-soldiers through genetic modification. The gene was outlawed in " + + "2056.", + strength_mult: 1.75, + defense_mult: 1.75, + dexterity_mult: 1.75, + agility_mult: 1.75, + hacking_mult: 1.15, + factions: [FactionNames.TheCovenant], + }), + new Augmentation({ + name: AugmentationNames.HiveMind, + repCost: 1.5e6, + moneyCost: 5.5e9, + info: + `A brain implant developed by ${FactionNames.ECorp}. They do not reveal what ` + + "exactly the implant does, but they promise that it will greatly " + + "enhance your abilities.", + hacking_grow_mult: 3, + stats: null, + factions: [FactionNames.ECorp], + }), + new Augmentation({ + name: AugmentationNames.TheRedPill, + repCost: 2.5e6, + moneyCost: 0, + info: "It's time to leave the cave.", + stats: null, + factions: [FactionNames.Daedalus], + }), + new Augmentation({ + name: AugmentationNames.CordiARCReactor, + repCost: 1.125e6, + moneyCost: 5e9, + info: + "The thoracic cavity is equipped with a small chamber designed " + + "to hold and sustain hydrogen plasma. The plasma is used to generate " + + "fusion power through nuclear fusion, providing limitless amounts of clean " + + "energy for the body.", + strength_mult: 1.35, + defense_mult: 1.35, + dexterity_mult: 1.35, + agility_mult: 1.35, + strength_exp_mult: 1.35, + defense_exp_mult: 1.35, + dexterity_exp_mult: 1.35, + agility_exp_mult: 1.35, + factions: [FactionNames.MegaCorp], + }), + new Augmentation({ + name: AugmentationNames.SmartJaw, + repCost: 3.75e5, + moneyCost: 2.75e9, + info: + "A bionic jaw that contains advanced hardware and software " + + "capable of psychoanalyzing and profiling the personality of " + + "others using optical imaging software.", + charisma_mult: 1.5, + charisma_exp_mult: 1.5, + company_rep_mult: 1.25, + faction_rep_mult: 1.25, + factions: [FactionNames.BachmanAssociates], + }), + new Augmentation({ + name: AugmentationNames.Neotra, + repCost: 5.625e5, + moneyCost: 2.875e9, + info: + "A highly-advanced techno-organic drug that is injected into the skeletal " + + "and integumentary system. The drug permanently modifies the DNA of the " + + "body's skin and bone cells, granting them the ability to repair " + + "and restructure themselves.", + strength_mult: 1.55, + defense_mult: 1.55, + factions: [FactionNames.BladeIndustries], + }), + new Augmentation({ + name: AugmentationNames.Xanipher, + repCost: 8.75e5, + moneyCost: 4.25e9, + info: + "A concoction of advanced nanobots that is orally ingested into the " + + "body. These nanobots induce physiological changes and significantly " + + "improve the body's functioning in all aspects.", + hacking_mult: 1.2, + strength_mult: 1.2, + defense_mult: 1.2, + dexterity_mult: 1.2, + agility_mult: 1.2, + charisma_mult: 1.2, + hacking_exp_mult: 1.15, + strength_exp_mult: 1.15, + defense_exp_mult: 1.15, + dexterity_exp_mult: 1.15, + agility_exp_mult: 1.15, + charisma_exp_mult: 1.15, + factions: [FactionNames.NWO], + }), + new Augmentation({ + name: AugmentationNames.HydroflameLeftArm, + repCost: 1.25e6, + moneyCost: 2.5e12, + info: + "The left arm of a legendary BitRunner who ascended beyond this world. " + + "It projects a light blue energy shield that protects the exposed inner parts. " + + "Even though it contains no weapons, the advanced tungsten titanium " + + "alloy increases the user's strength to unbelievable levels. The augmentation " + + "gets more powerful over time for seemingly no reason.", + strength_mult: 2.7, + factions: [FactionNames.NWO], + }), + new Augmentation({ + name: AugmentationNames.nextSENS, + repCost: 4.375e5, + moneyCost: 1.925e9, + info: + "The body is genetically re-engineered to maintain a state " + + "of negligible senescence, preventing the body from " + + "deteriorating with age.", + hacking_mult: 1.2, + strength_mult: 1.2, + defense_mult: 1.2, + dexterity_mult: 1.2, + agility_mult: 1.2, + charisma_mult: 1.2, + factions: [FactionNames.ClarkeIncorporated], + }), + new Augmentation({ + name: AugmentationNames.OmniTekInfoLoad, + repCost: 6.25e5, + moneyCost: 2.875e9, + info: + "OmniTek's data and information repository is uploaded " + + "into your brain, enhancing your programming and " + + "hacking abilities.", + hacking_mult: 1.2, + hacking_exp_mult: 1.25, + factions: [FactionNames.OmniTekIncorporated], + }), + new Augmentation({ + name: AugmentationNames.PhotosyntheticCells, + repCost: 5.625e5, + moneyCost: 2.75e9, + info: + "Chloroplasts are added to epidermal stem cells and are applied " + + "to the body using a skin graft. The result is photosynthetic " + + "skin cells, allowing users to generate their own energy " + + "and nutrition using solar power.", + strength_mult: 1.4, + defense_mult: 1.4, + agility_mult: 1.4, + factions: [FactionNames.KuaiGongInternational], + }), + new Augmentation({ + name: AugmentationNames.Neurolink, + repCost: 8.75e5, + moneyCost: 4.375e9, + info: + "A brain implant that provides a high-bandwidth, direct neural link between your " + + `mind and the ${FactionNames.BitRunners}' data servers, which reportedly contain ` + + "the largest database of hacking tools and information in the world.", + hacking_mult: 1.15, + hacking_exp_mult: 1.2, + hacking_chance_mult: 1.1, + hacking_speed_mult: 1.05, + programs: [Programs.FTPCrackProgram.name, Programs.RelaySMTPProgram.name], + factions: [FactionNames.BitRunners], + }), + new Augmentation({ + name: AugmentationNames.TheBlackHand, + repCost: 1e5, + moneyCost: 5.5e8, + info: + "A highly advanced bionic hand. This prosthetic not only " + + "enhances strength and dexterity but it is also embedded " + + "with hardware and firmware that lets the user connect to, access, and hack " + + "devices and machines by just touching them.", + strength_mult: 1.15, + dexterity_mult: 1.15, + hacking_mult: 1.1, + hacking_speed_mult: 1.02, + hacking_money_mult: 1.1, + factions: [FactionNames.TheBlackHand], + }), + new Augmentation({ + name: AugmentationNames.CRTX42AA, + repCost: 4.5e4, + moneyCost: 2.25e8, + info: + "The CRTX42-AA gene is injected into the genome. " + + "The CRTX42-AA is an artificially-synthesized gene that targets the visual and prefrontal " + + "cortex and improves cognitive abilities.", + hacking_mult: 1.08, + hacking_exp_mult: 1.15, + factions: [FactionNames.NiteSec], + }), + new Augmentation({ + name: AugmentationNames.Neuregen, + repCost: 3.75e4, + moneyCost: 3.75e8, + info: + "A drug that genetically modifies the neurons in the brain " + + "resulting in neurons that never die, continuously " + + "regenerate, and strengthen themselves.", + hacking_exp_mult: 1.4, + factions: [FactionNames.Chongqing], + }), + new Augmentation({ + name: AugmentationNames.CashRoot, + repCost: 1.25e4, + moneyCost: 1.25e8, + info: ( + <> + A collection of digital assets saved on a small chip. The chip is implanted into your wrist. A small jack in the + chip allows you to connect it to a computer and upload the assets. + + ), + startingMoney: 1e6, + programs: [Programs.BruteSSHProgram.name], + factions: [FactionNames.Sector12], + }), + new Augmentation({ + name: AugmentationNames.NutriGen, + repCost: 6.25e3, + moneyCost: 2.5e6, + info: + "A thermo-powered artificial nutrition generator. Endogenously " + + "synthesizes glucose, amino acids, and vitamins and redistributes them " + + "across the body. The device is powered by the body's naturally wasted " + + "energy in the form of heat.", + strength_exp_mult: 1.2, + defense_exp_mult: 1.2, + dexterity_exp_mult: 1.2, + agility_exp_mult: 1.2, + factions: [FactionNames.NewTokyo], + }), + new Augmentation({ + name: AugmentationNames.PCMatrix, + repCost: 100e3, + moneyCost: 2e9, + info: + "A 'Probability Computation Matrix' is installed in the frontal cortex. This implant " + + "uses advanced mathematical algorithims to rapidly identify and compute statistical " + + "outcomes of nearly every situation.", + charisma_mult: 1.0777, + charisma_exp_mult: 1.0777, + work_money_mult: 1.777, + faction_rep_mult: 1.0777, + company_rep_mult: 1.0777, + crime_success_mult: 1.0777, + crime_money_mult: 1.0777, + programs: [Programs.DeepscanV1.name, Programs.AutoLink.name], + factions: [FactionNames.Aevum], + }), + new Augmentation({ + name: AugmentationNames.INFRARet, + repCost: 7.5e3, + moneyCost: 3e7, + info: "A tiny chip that sits behind the retinae. This implant lets the user visually detect infrared radiation.", + crime_success_mult: 1.25, + crime_money_mult: 1.1, + dexterity_mult: 1.1, + factions: [FactionNames.Ishima], + }), + new Augmentation({ + name: AugmentationNames.DermaForce, + repCost: 1.5e4, + moneyCost: 5e7, + info: + "Synthetic skin that is grafted onto the body. This skin consists of " + + "millions of nanobots capable of projecting high-density muon beams, " + + "creating an energy barrier around the user.", + defense_mult: 1.4, + factions: [FactionNames.Volhaven], + }), + new Augmentation({ + name: AugmentationNames.GrapheneBrachiBlades, + repCost: 2.25e5, + moneyCost: 2.5e9, + info: + "An upgrade to the BrachiBlades augmentation. It infuses " + + "the retractable blades with an advanced graphene material " + + "making them stronger and lighter.", + prereqs: [AugmentationNames.BrachiBlades], + strength_mult: 1.4, + defense_mult: 1.4, + crime_success_mult: 1.1, + crime_money_mult: 1.3, + factions: [FactionNames.SpeakersForTheDead], + }), + new Augmentation({ + name: AugmentationNames.GrapheneBionicArms, + repCost: 5e5, + moneyCost: 3.75e9, + info: + "An upgrade to the Bionic Arms augmentation. It infuses the " + + "prosthetic arms with an advanced graphene material " + + "to make them stronger and lighter.", + prereqs: [AugmentationNames.BionicArms], + strength_mult: 1.85, + dexterity_mult: 1.85, + factions: [FactionNames.TheDarkArmy], + }), + new Augmentation({ + name: AugmentationNames.BrachiBlades, + repCost: 1.25e4, + moneyCost: 9e7, + info: "A set of retractable plasteel blades that are implanted in the arm, underneath the skin.", + strength_mult: 1.15, + defense_mult: 1.15, + crime_success_mult: 1.1, + crime_money_mult: 1.15, + factions: [FactionNames.TheSyndicate], + }), + new Augmentation({ + name: AugmentationNames.BionicArms, + repCost: 6.25e4, + moneyCost: 2.75e8, + info: "Cybernetic arms created from plasteel and carbon fibers that completely replace the user's organic arms.", + strength_mult: 1.3, + dexterity_mult: 1.3, + factions: [FactionNames.Tetrads], + }), + new Augmentation({ + name: AugmentationNames.SNA, + repCost: 6.25e3, + moneyCost: 3e7, + info: + "A cranial implant that affects the user's personality, making them better " + + "at negotiation in social situations.", + work_money_mult: 1.1, + company_rep_mult: 1.15, + faction_rep_mult: 1.15, + factions: [FactionNames.TianDiHui], + }), + new Augmentation({ + name: AugmentationNames.NeuroreceptorManager, + repCost: 0.75e5, + moneyCost: 5.5e8, + info: + "A brain implant carefully assembled around the synapses, which " + + "micromanages the activity and levels of various neuroreceptor " + + "chemicals and modulates electrical activity to optimize concentration, " + + "allowing the user to multitask much more effectively.", + stats: ( + <> + This augmentation removes the penalty for not focusing on actions such as working in a job or working for a + faction. + + ), + factions: [FactionNames.TianDiHui], + }), +]; + +export const bladeburnerAugmentations = [ + new Augmentation({ + name: AugmentationNames.EsperEyewear, + repCost: 1.25e3, + moneyCost: 1.65e8, + info: + "Ballistic-grade protective and retractable eyewear that was designed specifically " + + "for Bladeburner units. This " + + "is implanted by installing a mechanical frame in the skull's orbit. " + + "This frame interfaces with the brain and allows the user to " + + "automatically extrude and extract the eyewear. The eyewear protects " + + "against debris, shrapnel, lasers, blinding flashes, and gas. It is also " + + "embedded with a data processing chip that can be programmed to display an " + + "AR HUD to assist the user in field missions.", + bladeburner_success_chance_mult: 1.03, + dexterity_mult: 1.05, + isSpecial: true, + factions: [FactionNames.Bladeburners], + }), + new Augmentation({ + name: AugmentationNames.EMS4Recombination, + repCost: 2.5e3, + moneyCost: 2.75e8, + info: + "A DNA recombination of the EMS-4 Gene. This genetic engineering " + + "technique was originally used on Bladeburners during the Synthoid uprising " + + "to induce wakefulness and concentration, suppress fear, reduce empathy, " + + "improve reflexes, and improve memory among other things.", + bladeburner_success_chance_mult: 1.03, + bladeburner_analysis_mult: 1.05, + bladeburner_stamina_gain_mult: 1.02, + isSpecial: true, + factions: [FactionNames.Bladeburners], + }), + new Augmentation({ + name: AugmentationNames.OrionShoulder, + repCost: 6.25e3, + moneyCost: 5.5e8, + info: + "A bionic shoulder augmentation for the right shoulder. Using cybernetics, " + + "the ORION-MKIV shoulder enhances the strength and dexterity " + + "of the user's right arm. It also provides protection due to its " + + "crystallized graphene plating.", + defense_mult: 1.05, + strength_mult: 1.05, + dexterity_mult: 1.05, + bladeburner_success_chance_mult: 1.04, + isSpecial: true, + factions: [FactionNames.Bladeburners], + }), + new Augmentation({ + name: AugmentationNames.HyperionV1, + repCost: 1.25e4, + moneyCost: 2.75e9, + info: + "A pair of mini plasma cannons embedded into the hands. The Hyperion is capable " + + "of rapidly firing bolts of high-density plasma. The weapon is meant to " + + "be used against augmented enemies as the ionized " + + "nature of the plasma disrupts the electrical systems of Augmentations. However, " + + "it can also be effective against non-augmented enemies due to its high temperature " + + "and concussive force.", + bladeburner_success_chance_mult: 1.06, + isSpecial: true, + factions: [FactionNames.Bladeburners], + }), + new Augmentation({ + name: AugmentationNames.HyperionV2, + repCost: 2.5e4, + moneyCost: 5.5e9, + info: + "A pair of mini plasma cannons embedded into the hands. This augmentation " + + "is more advanced and powerful than the original V1 model. This V2 model is " + + "more power-efficient, more accurate, and can fire plasma bolts at a much " + + "higher velocity than the V1 model.", + prereqs: [AugmentationNames.HyperionV1], + bladeburner_success_chance_mult: 1.08, + isSpecial: true, + factions: [FactionNames.Bladeburners], + }), + new Augmentation({ + name: AugmentationNames.GolemSerum, + repCost: 3.125e4, + moneyCost: 1.1e10, + info: + "A serum that permanently enhances many aspects of human capabilities, " + + "including strength, speed, immune system enhancements, and mitochondrial efficiency. The " + + "serum was originally developed by the Chinese military in an attempt to " + + "create super soldiers.", + strength_mult: 1.07, + defense_mult: 1.07, + dexterity_mult: 1.07, + agility_mult: 1.07, + bladeburner_stamina_gain_mult: 1.05, + isSpecial: true, + factions: [FactionNames.Bladeburners], + }), + new Augmentation({ + name: AugmentationNames.VangelisVirus, + repCost: 1.875e4, + moneyCost: 2.75e9, + info: + "A synthetic symbiotic virus that is injected into human brain tissue. The Vangelis virus " + + "heightens the senses and focus of its host, and also enhances its intuition.", + dexterity_exp_mult: 1.1, + bladeburner_analysis_mult: 1.1, + bladeburner_success_chance_mult: 1.04, + isSpecial: true, + factions: [FactionNames.Bladeburners], + }), + new Augmentation({ + name: AugmentationNames.VangelisVirus3, + repCost: 3.75e4, + moneyCost: 1.1e10, + info: + "An improved version of Vangelis, a synthetic symbiotic virus that is " + + "injected into human brain tissue. On top of the benefits of the original " + + "virus, this also grants an accelerated healing factor and enhanced " + + "reflexes.", + prereqs: [AugmentationNames.VangelisVirus], + defense_exp_mult: 1.1, + dexterity_exp_mult: 1.1, + bladeburner_analysis_mult: 1.15, + bladeburner_success_chance_mult: 1.05, + isSpecial: true, + factions: [FactionNames.Bladeburners], + }), + new Augmentation({ + name: AugmentationNames.INTERLINKED, + repCost: 2.5e4, + moneyCost: 5.5e9, + info: + "The DNA is genetically modified to enhance the human's body " + + "extracellular matrix (ECM). This improves the ECM's ability to " + + "structurally support the body and grants heightened strength and " + + "durability.", + strength_exp_mult: 1.05, + defense_exp_mult: 1.05, + dexterity_exp_mult: 1.05, + agility_exp_mult: 1.05, + bladeburner_max_stamina_mult: 1.1, + isSpecial: true, + factions: [FactionNames.Bladeburners], + }), + new Augmentation({ + name: AugmentationNames.BladeRunner, + repCost: 2e4, + moneyCost: 8.25e9, + info: + `A cybernetic foot augmentation that was specifically created for ${FactionNames.Bladeburners} ` + + "during the Synthoid Uprising. The organic musculature of the human foot " + + "is enhanced with flexible carbon nanotube matrices that are controlled by " + + "intelligent servo-motors.", + agility_mult: 1.05, + bladeburner_max_stamina_mult: 1.05, + bladeburner_stamina_gain_mult: 1.05, + isSpecial: true, + factions: [FactionNames.Bladeburners], + }), + new Augmentation({ + name: AugmentationNames.BladeArmor, + repCost: 1.25e4, + moneyCost: 1.375e9, + info: + `A powered exoskeleton suit designed as armor for ${FactionNames.Bladeburners} units. This ` + + "exoskeleton is incredibly adaptable and can protect the wearer from blunt, piercing, " + + "concussive, thermal, chemical, and electric trauma. It also enhances the user's " + + "physical abilities.", + strength_mult: 1.04, + defense_mult: 1.04, + dexterity_mult: 1.04, + agility_mult: 1.04, + bladeburner_stamina_gain_mult: 1.02, + bladeburner_success_chance_mult: 1.03, + isSpecial: true, + factions: [FactionNames.Bladeburners], + }), + new Augmentation({ + name: AugmentationNames.BladeArmorPowerCells, + repCost: 1.875e4, + moneyCost: 2.75e9, + info: + "Upgrades the BLADE-51b Tesla Armor with Ion Power Cells, which are capable of " + + "more efficiently storing and using power.", + prereqs: [AugmentationNames.BladeArmor], + bladeburner_success_chance_mult: 1.05, + bladeburner_stamina_gain_mult: 1.02, + bladeburner_max_stamina_mult: 1.05, + isSpecial: true, + factions: [FactionNames.Bladeburners], + }), + new Augmentation({ + name: AugmentationNames.BladeArmorEnergyShielding, + repCost: 2.125e4, + moneyCost: 5.5e9, + info: + "Upgrades the BLADE-51b Tesla Armor with a plasma energy propulsion system " + + "that is capable of projecting an energy shielding force field.", + prereqs: [AugmentationNames.BladeArmor], + defense_mult: 1.05, + bladeburner_success_chance_mult: 1.06, + isSpecial: true, + factions: [FactionNames.Bladeburners], + }), + new Augmentation({ + name: AugmentationNames.BladeArmorUnibeam, + repCost: 3.125e4, + moneyCost: 1.65e10, + info: + "Upgrades the BLADE-51b Tesla Armor with a concentrated deuterium-fluoride laser " + + "weapon. It's precision and accuracy makes it useful for quickly neutralizing " + + "threats while keeping casualties to a minimum.", + prereqs: [AugmentationNames.BladeArmor], + bladeburner_success_chance_mult: 1.08, + isSpecial: true, + factions: [FactionNames.Bladeburners], + }), + new Augmentation({ + name: AugmentationNames.BladeArmorOmnibeam, + repCost: 6.25e4, + moneyCost: 2.75e10, + info: + "Upgrades the BLADE-51b Tesla Armor Unibeam augmentation to use a " + + "multiple-fiber system. This upgraded weapon uses multiple fiber laser " + + "modules that combine together to form a single, more powerful beam of up to " + + "2000MW.", + prereqs: [AugmentationNames.BladeArmorUnibeam], + bladeburner_success_chance_mult: 1.1, + isSpecial: true, + factions: [FactionNames.Bladeburners], + }), + new Augmentation({ + name: AugmentationNames.BladeArmorIPU, + repCost: 1.5e4, + moneyCost: 1.1e9, + info: + "Upgrades the BLADE-51b Tesla Armor with an AI Information Processing " + + "Unit that was specially designed to analyze Synthoid related data and " + + "information.", + prereqs: [AugmentationNames.BladeArmor], + bladeburner_analysis_mult: 1.15, + bladeburner_success_chance_mult: 1.02, + isSpecial: true, + factions: [FactionNames.Bladeburners], + }), + new Augmentation({ + name: AugmentationNames.BladesSimulacrum, + repCost: 1.25e3, + moneyCost: 1.5e11, + info: + "A highly-advanced matter phase-shifter module that is embedded " + + "in the brainstem and cerebellum. This augmentation allows " + + "the user to project and control a holographic simulacrum within an " + + "extremely large radius. These specially-modified holograms were specifically " + + "weaponized by Bladeburner units to be used against Synthoids.", + stats: ( + <> + This augmentation allows you to perform Bladeburner actions and other actions (such as working, commiting + crimes, etc.) at the same time. + + ), + isSpecial: true, + factions: [FactionNames.Bladeburners], + }), +]; + +export const churchOfTheMachineGodAugmentations = [ + new Augmentation({ + name: AugmentationNames.StaneksGift1, + repCost: 0, + moneyCost: 0, + info: + 'Allison "Mother" Stanek imparts you with her gift. An ' + + "experimental Augmentation implanted at the base of the neck. " + + "It allows you to overclock your entire system by carefully " + + "changing the configuration.", + isSpecial: true, + hacking_chance_mult: 0.9, + hacking_speed_mult: 0.9, + hacking_money_mult: 0.9, + hacking_grow_mult: 0.9, + hacking_mult: 0.9, + strength_mult: 0.9, + defense_mult: 0.9, + dexterity_mult: 0.9, + agility_mult: 0.9, + charisma_mult: 0.9, + hacking_exp_mult: 0.9, + strength_exp_mult: 0.9, + defense_exp_mult: 0.9, + dexterity_exp_mult: 0.9, + agility_exp_mult: 0.9, + charisma_exp_mult: 0.9, + company_rep_mult: 0.9, + faction_rep_mult: 0.9, + crime_money_mult: 0.9, + crime_success_mult: 0.9, + hacknet_node_money_mult: 0.9, + hacknet_node_purchase_cost_mult: 1.1, + hacknet_node_ram_cost_mult: 1.1, + hacknet_node_core_cost_mult: 1.1, + hacknet_node_level_cost_mult: 1.1, + work_money_mult: 0.9, + stats: <>Its unstable nature decreases all your stats by 10%, + factions: [FactionNames.ChurchOfTheMachineGod], + }), + new Augmentation({ + name: AugmentationNames.StaneksGift2, + repCost: 1e6, + moneyCost: 0, + info: + "The next evolution is near, a coming together of man and machine. A synthesis greater than the birth of the human " + + "organism. Time spent with the gift has allowed for acclimatization of the invasive augment and the toll it takes upon " + + "your frame granting lesser penalty of 5% to all stats.", + prereqs: [AugmentationNames.StaneksGift1], + isSpecial: true, + hacking_chance_mult: 0.95 / 0.9, + hacking_speed_mult: 0.95 / 0.9, + hacking_money_mult: 0.95 / 0.9, + hacking_grow_mult: 0.95 / 0.9, + hacking_mult: 0.95 / 0.9, + strength_mult: 0.95 / 0.9, + defense_mult: 0.95 / 0.9, + dexterity_mult: 0.95 / 0.9, + agility_mult: 0.95 / 0.9, + charisma_mult: 0.95 / 0.9, + hacking_exp_mult: 0.95 / 0.9, + strength_exp_mult: 0.95 / 0.9, + defense_exp_mult: 0.95 / 0.9, + dexterity_exp_mult: 0.95 / 0.9, + agility_exp_mult: 0.95 / 0.9, + charisma_exp_mult: 0.95 / 0.9, + company_rep_mult: 0.95 / 0.9, + faction_rep_mult: 0.95 / 0.9, + crime_money_mult: 0.95 / 0.9, + crime_success_mult: 0.95 / 0.9, + hacknet_node_money_mult: 0.95 / 0.9, + hacknet_node_purchase_cost_mult: 1.05 / 1.1, + hacknet_node_ram_cost_mult: 1.05 / 1.1, + hacknet_node_core_cost_mult: 1.05 / 1.1, + hacknet_node_level_cost_mult: 1.05 / 1.1, + work_money_mult: 0.95 / 0.9, + stats: <>The penalty for the gift is reduced to 5%, + factions: [FactionNames.ChurchOfTheMachineGod], + }), + new Augmentation({ + name: AugmentationNames.StaneksGift3, + repCost: 1e8, + moneyCost: 0, + info: + "The synthesis of human and machine is nothing to fear. It is our destiny. " + + "You will become greater than the sum of our parts. As One. Embrace your gift " + + "fully and wholly free of it's accursed toll. Serenity brings tranquility the form " + + "of no longer suffering a stat penalty. ", + prereqs: [AugmentationNames.StaneksGift2], + isSpecial: true, + hacking_chance_mult: 1 / 0.95, + hacking_speed_mult: 1 / 0.95, + hacking_money_mult: 1 / 0.95, + hacking_grow_mult: 1 / 0.95, + hacking_mult: 1 / 0.95, + strength_mult: 1 / 0.95, + defense_mult: 1 / 0.95, + dexterity_mult: 1 / 0.95, + agility_mult: 1 / 0.95, + charisma_mult: 1 / 0.95, + hacking_exp_mult: 1 / 0.95, + strength_exp_mult: 1 / 0.95, + defense_exp_mult: 1 / 0.95, + dexterity_exp_mult: 1 / 0.95, + agility_exp_mult: 1 / 0.95, + charisma_exp_mult: 1 / 0.95, + company_rep_mult: 1 / 0.95, + faction_rep_mult: 1 / 0.95, + crime_money_mult: 1 / 0.95, + crime_success_mult: 1 / 0.95, + hacknet_node_money_mult: 1 / 0.95, + hacknet_node_purchase_cost_mult: 1 / 1.05, + hacknet_node_ram_cost_mult: 1 / 1.05, + hacknet_node_core_cost_mult: 1 / 1.05, + hacknet_node_level_cost_mult: 1 / 1.05, + work_money_mult: 1 / 0.95, + stats: <>Staneks Gift has no penalty., + factions: [FactionNames.ChurchOfTheMachineGod], + }), +]; + +export function initNeuroFluxGovernor(): Augmentation { + return new Augmentation({ + name: AugmentationNames.NeuroFluxGovernor, + repCost: 500, + moneyCost: 750e3, + info: + "A device that is embedded in the back of the neck. The NeuroFlux Governor " + + "monitors and regulates nervous impulses coming to and from the spinal column, " + + "essentially 'governing' the body. By doing so, it improves the functionality of the " + + "body's nervous system.", + stats: ( + <> + This special augmentation can be leveled up infinitely. Each level of this augmentation increases MOST + multipliers by 1%, stacking multiplicatively. + + ), + hacking_chance_mult: 1.01, + hacking_speed_mult: 1.01, + hacking_money_mult: 1.01, + hacking_grow_mult: 1.01, + hacking_mult: 1.01, + strength_mult: 1.01, + defense_mult: 1.01, + dexterity_mult: 1.01, + agility_mult: 1.01, + charisma_mult: 1.01, + hacking_exp_mult: 1.01, + strength_exp_mult: 1.01, + defense_exp_mult: 1.01, + dexterity_exp_mult: 1.01, + agility_exp_mult: 1.01, + charisma_exp_mult: 1.01, + company_rep_mult: 1.01, + faction_rep_mult: 1.01, + crime_money_mult: 1.01, + crime_success_mult: 1.01, + hacknet_node_money_mult: 1.01, + hacknet_node_purchase_cost_mult: 0.99, + hacknet_node_ram_cost_mult: 0.99, + hacknet_node_core_cost_mult: 0.99, + hacknet_node_level_cost_mult: 0.99, + work_money_mult: 1.01, + factions: Object.values(FactionNames), + }); +} + +export function initUnstableCircadianModulator(): Augmentation { + //Time-Based Augment Test + const randomBonuses = getRandomBonus(); + + const UnstableCircadianModulatorParams: IConstructorParams = { + name: AugmentationNames.UnstableCircadianModulator, + moneyCost: 5e9, + repCost: 3.625e5, + info: + "An experimental nanobot injection. Its unstable nature leads to " + + "unpredictable results based on your circadian rhythm.", + factions: [FactionNames.SpeakersForTheDead], + }; + Object.keys(randomBonuses.bonuses).forEach( + (key) => ((UnstableCircadianModulatorParams as any)[key] = randomBonuses.bonuses[key]), + ); + + return new Augmentation(UnstableCircadianModulatorParams); +} diff --git a/src/Augmentation/AugmentationHelpers.tsx b/src/Augmentation/AugmentationHelpers.tsx index b284e61e1..f8b4a79cd 100644 --- a/src/Augmentation/AugmentationHelpers.tsx +++ b/src/Augmentation/AugmentationHelpers.tsx @@ -1,4 +1,4 @@ -import { Augmentation, IConstructorParams } from "./Augmentation"; +import { Augmentation } from "./Augmentation"; import { Augmentations } from "./Augmentations"; import { PlayerOwnedAugmentation, IPlayerOwnedAugmentation } from "./PlayerOwnedAugmentation"; import { AugmentationNames } from "./data/AugmentationNames"; @@ -8,2008 +8,99 @@ import { CONSTANTS } from "../Constants"; import { Factions, factionExists } from "../Faction/Factions"; import { Player } from "../Player"; import { prestigeAugmentation } from "../Prestige"; -import { Programs } from "../Programs/Programs"; import { SourceFileFlags } from "../SourceFile/SourceFileFlags"; import { dialogBoxCreate } from "../ui/React/DialogBox"; import { clearObject } from "../utils/helpers/clearObject"; -import { WHRNG } from "../Casino/RNG"; - -import React from "react"; import { FactionNames } from "../Faction/data/FactionNames"; +import { + bladeburnerAugmentations, + churchOfTheMachineGodAugmentations, + generalAugmentations, + initNeuroFluxGovernor, + initUnstableCircadianModulator, +} from "./AugmentationCreator"; -function AddToAugmentations(aug: Augmentation): void { +export function AddToAugmentations(aug: Augmentation): void { const name = aug.name; Augmentations[name] = aug; } -function getRandomBonus(): any { - const bonuses = [ - { - bonuses: { - hacking_chance_mult: 1.25, - hacking_speed_mult: 1.1, - hacking_money_mult: 1.25, - hacking_grow_mult: 1.1, - }, - description: - "Increases the player's hacking chance by 25%.
" + - "Increases the player's hacking speed by 10%.
" + - "Increases the amount of money the player's gains from hacking by 25%.
" + - "Improves grow() by 10%.", - }, - { - bonuses: { - hacking_mult: 1.15, - hacking_exp_mult: 2, - }, - description: - "Increases the player's hacking skill by 15%.
" + - "Increases the player's hacking experience gain rate by 100%.", - }, - { - bonuses: { - strength_mult: 1.25, - strength_exp_mult: 2, - defense_mult: 1.25, - defense_exp_mult: 2, - dexterity_mult: 1.25, - dexterity_exp_mult: 2, - agility_mult: 1.25, - agility_exp_mult: 2, - }, - description: - "Increases all of the player's combat stats by 25%.
" + - "Increases all of the player's combat stat experience gain rate by 100%.", - }, - { - bonuses: { - charisma_mult: 1.5, - charisma_exp_mult: 2, - }, - description: - "This augmentation increases the player's charisma by 50%.
" + - "Increases the player's charisma experience gain rate by 100%.", - }, - { - bonuses: { - hacknet_node_money_mult: 1.2, - hacknet_node_purchase_cost_mult: 0.85, - hacknet_node_ram_cost_mult: 0.85, - hacknet_node_core_cost_mult: 0.85, - hacknet_node_level_cost_mult: 0.85, - }, - description: - "Increases the amount of money produced by Hacknet Nodes by 20%.
" + - "Decreases all costs related to Hacknet Node by 15%.", - }, - { - bonuses: { - company_rep_mult: 1.25, - faction_rep_mult: 1.15, - work_money_mult: 1.7, - }, - description: - "Increases the amount of money the player gains from working by 70%.
" + - "Increases the amount of reputation the player gains when working for a company by 25%.
" + - "Increases the amount of reputation the player gains for a faction by 15%.", - }, - { - bonuses: { - crime_success_mult: 2, - crime_money_mult: 2, - }, - description: - "Increases the player's crime success rate by 100%.
" + - "Increases the amount of money the player gains from crimes by 100%.", - }, - ]; - - const randomNumber = new WHRNG(Math.floor(Player.lastUpdate / 3600000)); - for (let i = 0; i < 5; i++) randomNumber.step(); - - return bonuses[Math.floor(bonuses.length * randomNumber.random())]; -} - -function initAugmentations(): void { - for (const name of Object.keys(Factions)) { - if (Factions.hasOwnProperty(name)) { - Factions[name].augmentations = []; - } - } - - //Reset Augmentations - clearObject(Augmentations); - - //Time-Based Augment Test - const randomBonuses = getRandomBonus(); - - const UnstableCircadianModulatorParams: IConstructorParams = { - name: AugmentationNames.UnstableCircadianModulator, - moneyCost: 5e9, - repCost: 3.625e5, - info: - "An experimental nanobot injection. Its unstable nature leads to " + - "unpredictable results based on your circadian rhythm.", - factions: [FactionNames.SpeakersForTheDead], - }; - Object.keys(randomBonuses.bonuses).forEach( - (key) => ((UnstableCircadianModulatorParams as any)[key] = randomBonuses.bonuses[key]), - ); - - //Misc/Hybrid augmentations - const NeuroFluxGovernor = new Augmentation({ - name: AugmentationNames.NeuroFluxGovernor, - repCost: 1.25e3, - moneyCost: 3.75e6, - info: - "A device that is embedded in the back of the neck. The NeuroFlux Governor " + - "monitors and regulates nervous impulses coming to and from the spinal column, " + - "essentially 'governing' the body. By doing so, it improves the functionality of the " + - "body's nervous system.", - stats: ( - <> - This special augmentation can be leveled up infinitely. Each level of this augmentation increases MOST - multipliers by 1%, stacking multiplicatively. - - ), - hacking_chance_mult: 1.01, - hacking_speed_mult: 1.01, - hacking_money_mult: 1.01, - hacking_grow_mult: 1.01, - hacking_mult: 1.01, - strength_mult: 1.01, - defense_mult: 1.01, - dexterity_mult: 1.01, - agility_mult: 1.01, - charisma_mult: 1.01, - hacking_exp_mult: 1.01, - strength_exp_mult: 1.01, - defense_exp_mult: 1.01, - dexterity_exp_mult: 1.01, - agility_exp_mult: 1.01, - charisma_exp_mult: 1.01, - company_rep_mult: 1.01, - faction_rep_mult: 1.01, - crime_money_mult: 1.01, - crime_success_mult: 1.01, - hacknet_node_money_mult: 1.01, - hacknet_node_purchase_cost_mult: 0.99, - hacknet_node_ram_cost_mult: 0.99, - hacknet_node_core_cost_mult: 0.99, - hacknet_node_level_cost_mult: 0.99, - work_money_mult: 1.01, - factions: [], - }); - - // Set the Augmentation's level to the currently-installed level +export function getNextNeuroFluxLevel(): number { + // Get current Neuroflux level based on Player's augmentations let currLevel = 0; for (let i = 0; i < Player.augmentations.length; ++i) { if (Player.augmentations[i].name === AugmentationNames.NeuroFluxGovernor) { currLevel = Player.augmentations[i].level; } } - NeuroFluxGovernor.level = currLevel; - // To set the price/rep req of the NeuroFlux, we have to take into account NeuroFlux - // levels that are purchased but not yet installed - let nextLevel = currLevel; + // Account for purchased but uninstalled Augmentations for (let i = 0; i < Player.queuedAugmentations.length; ++i) { - if (Player.queuedAugmentations[i].name === AugmentationNames.NeuroFluxGovernor) { - ++nextLevel; + if (Player.queuedAugmentations[i].name == AugmentationNames.NeuroFluxGovernor) { + ++currLevel; } } - let mult = Math.pow(CONSTANTS.NeuroFluxGovernorLevelMult, nextLevel); - NeuroFluxGovernor.baseRepRequirement = 500 * mult * BitNodeMultipliers.AugmentationRepCost; - NeuroFluxGovernor.baseCost = 750e3 * mult * BitNodeMultipliers.AugmentationMoneyCost; - if (augmentationExists(AugmentationNames.NeuroFluxGovernor)) { - delete Augmentations[AugmentationNames.NeuroFluxGovernor]; + return currLevel + 1; +} + +function createAugmentations(): void { + [ + initNeuroFluxGovernor(), + initUnstableCircadianModulator(), + ...generalAugmentations, + ...(factionExists(FactionNames.Bladeburners) ? bladeburnerAugmentations : []), + ...(factionExists(FactionNames.ChurchOfTheMachineGod) ? churchOfTheMachineGodAugmentations : []), + ].map(resetAugmentation); +} + +function resetFactionAugmentations(): void { + for (const name of Object.keys(Factions)) { + if (Factions.hasOwnProperty(name)) { + Factions[name].augmentations = []; + } } - NeuroFluxGovernor.addToAllFactions(); - AddToAugmentations(NeuroFluxGovernor); +} - const augmentations = [ - new Augmentation(UnstableCircadianModulatorParams), - new Augmentation({ - name: AugmentationNames.HemoRecirculator, - moneyCost: 4.5e7, - repCost: 1e4, - info: "A heart implant that greatly increases the body's ability to effectively use and pump blood.", - strength_mult: 1.08, - defense_mult: 1.08, - agility_mult: 1.08, - dexterity_mult: 1.08, - factions: [FactionNames.Tetrads, FactionNames.TheDarkArmy, FactionNames.TheSyndicate], - }), - new Augmentation({ - name: AugmentationNames.Targeting1, - moneyCost: 1.5e7, - repCost: 5e3, - info: - "A cranial implant that is embedded within the inner ear structures and optic nerves. It regulates " + - "and enhances balance and hand-eye coordination.", - dexterity_mult: 1.1, - factions: [ - FactionNames.SlumSnakes, - FactionNames.TheDarkArmy, - FactionNames.TheSyndicate, - FactionNames.Sector12, - FactionNames.Ishima, - FactionNames.OmniTekIncorporated, - FactionNames.KuaiGongInternational, - FactionNames.BladeIndustries, - ], - }), - new Augmentation({ - name: AugmentationNames.Targeting2, - moneyCost: 4.25e7, - repCost: 8.75e3, - info: - "This upgraded version of the 'Augmented Targeting' implant is capable of augmenting " + - "reality by digitally displaying weaknesses and vital signs of threats.", - prereqs: [AugmentationNames.Targeting1], - dexterity_mult: 1.2, - factions: [ - FactionNames.TheDarkArmy, - FactionNames.TheSyndicate, - FactionNames.Sector12, - FactionNames.OmniTekIncorporated, - FactionNames.KuaiGongInternational, - FactionNames.BladeIndustries, - ], - }), - new Augmentation({ - name: AugmentationNames.Targeting3, - moneyCost: 1.15e8, - repCost: 2.75e4, - info: "The latest version of the 'Augmented Targeting' implant adds the ability to lock-on and track threats.", - prereqs: [AugmentationNames.Targeting2], - dexterity_mult: 1.3, - factions: [ - FactionNames.TheDarkArmy, - FactionNames.TheSyndicate, - FactionNames.OmniTekIncorporated, - FactionNames.KuaiGongInternational, - FactionNames.BladeIndustries, - FactionNames.TheCovenant, - ], - }), - new Augmentation({ - name: AugmentationNames.SyntheticHeart, - moneyCost: 2.875e9, - repCost: 7.5e5, - info: - "This advanced artificial heart, created from plasteel and graphene, is capable of pumping blood " + - "more efficiently than an organic heart.", - agility_mult: 1.5, - strength_mult: 1.5, - factions: [ - FactionNames.KuaiGongInternational, - FactionNames.FulcrumSecretTechnologies, - FactionNames.SpeakersForTheDead, - FactionNames.NWO, - FactionNames.TheCovenant, - FactionNames.Daedalus, - FactionNames.Illuminati, - ], - }), - new Augmentation({ - name: AugmentationNames.SynfibrilMuscle, - repCost: 4.375e5, - moneyCost: 1.125e9, - info: - "The myofibrils in human muscles are injected with special chemicals that react with the proteins inside " + - "the myofibrils, altering their underlying structure. The end result is muscles that are stronger and more elastic. " + - "Scientists have named these artificially enhanced units 'synfibrils'.", - strength_mult: 1.3, - defense_mult: 1.3, - factions: [ - FactionNames.KuaiGongInternational, - FactionNames.FulcrumSecretTechnologies, - FactionNames.SpeakersForTheDead, - FactionNames.NWO, - FactionNames.TheCovenant, - FactionNames.Daedalus, - FactionNames.Illuminati, - FactionNames.BladeIndustries, - ], - }), - new Augmentation({ - name: AugmentationNames.CombatRib1, - repCost: 7.5e3, - moneyCost: 2.375e7, - info: - "The rib cage is augmented to continuously release boosters into the bloodstream " + - "which increase the oxygen-carrying capacity of blood.", - strength_mult: 1.1, - defense_mult: 1.1, - factions: [ - FactionNames.SlumSnakes, - FactionNames.TheDarkArmy, - FactionNames.TheSyndicate, - FactionNames.Volhaven, - FactionNames.Ishima, - FactionNames.OmniTekIncorporated, - FactionNames.KuaiGongInternational, - FactionNames.BladeIndustries, - ], - }), - new Augmentation({ - name: AugmentationNames.CombatRib2, - repCost: 1.875e4, - moneyCost: 6.5e7, - info: - "An upgraded version of the 'Combat Rib' augmentation that adds potent stimulants which " + - "improve focus and endurance while decreasing reaction time and fatigue.", - prereqs: [AugmentationNames.CombatRib1], - strength_mult: 1.14, - defense_mult: 1.14, - factions: [ - FactionNames.TheDarkArmy, - FactionNames.TheSyndicate, - FactionNames.Volhaven, - FactionNames.OmniTekIncorporated, - FactionNames.KuaiGongInternational, - FactionNames.BladeIndustries, - ], - }), - new Augmentation({ - name: AugmentationNames.CombatRib3, - repCost: 3.5e4, - moneyCost: 1.2e8, - info: - "The latest version of the 'Combat Rib' augmentation releases advanced anabolic steroids that " + - "improve muscle mass and physical performance while being safe and free of side effects.", - prereqs: [AugmentationNames.CombatRib2], - strength_mult: 1.18, - defense_mult: 1.18, - factions: [ - FactionNames.TheDarkArmy, - FactionNames.TheSyndicate, - FactionNames.OmniTekIncorporated, - FactionNames.KuaiGongInternational, - FactionNames.BladeIndustries, - FactionNames.TheCovenant, - ], - }), - new Augmentation({ - name: AugmentationNames.NanofiberWeave, - repCost: 3.75e4, - moneyCost: 1.25e8, - info: - "Synthetic nanofibers are woven into the skin's extracellular matrix using electrospinning, " + - "which improves its regenerative and extracellular homeostasis abilities.", - strength_mult: 1.2, - defense_mult: 1.2, - factions: [ - FactionNames.TheDarkArmy, - FactionNames.TheSyndicate, - FactionNames.OmniTekIncorporated, - FactionNames.BladeIndustries, - FactionNames.TianDiHui, - FactionNames.SpeakersForTheDead, - FactionNames.FulcrumSecretTechnologies, - ], - }), - new Augmentation({ - name: AugmentationNames.SubdermalArmor, - repCost: 8.75e5, - moneyCost: 3.25e9, - info: - "The NEMEAN Subdermal Weave is a thin, light-weight, graphene plating that houses a dilatant fluid. " + - "The material is implanted underneath the skin, and is the most advanced form of defensive enhancement " + - "that has ever been created. The dilatant fluid, despite being thin and light, is extremely effective " + - "at stopping piercing blows and reducing blunt trauma. The properties of graphene allow the plating to " + - "mitigate damage from any fire or electrical traumas.", - defense_mult: 2.2, - factions: [ - FactionNames.TheSyndicate, - FactionNames.FulcrumSecretTechnologies, - FactionNames.Illuminati, - FactionNames.Daedalus, - FactionNames.TheCovenant, - ], - }), - new Augmentation({ - name: AugmentationNames.WiredReflexes, - repCost: 1.25e3, - moneyCost: 2.5e6, - info: - "Synthetic nerve-enhancements are injected into all major parts of the somatic nervous system, " + - "supercharging the spread of neural signals and increasing reflex speed.", - agility_mult: 1.05, - dexterity_mult: 1.05, - factions: [ - FactionNames.TianDiHui, - FactionNames.SlumSnakes, - FactionNames.Sector12, - FactionNames.Volhaven, - FactionNames.Aevum, - FactionNames.Ishima, - FactionNames.TheSyndicate, - FactionNames.TheDarkArmy, - FactionNames.SpeakersForTheDead, - ], - }), - new Augmentation({ - name: AugmentationNames.GrapheneBoneLacings, - repCost: 1.125e6, - moneyCost: 4.25e9, - info: "Graphene is grafted and fused into the skeletal structure, enhancing bone density and tensile strength.", - strength_mult: 1.7, - defense_mult: 1.7, - factions: [FactionNames.FulcrumSecretTechnologies, FactionNames.TheCovenant], - }), - new Augmentation({ - name: AugmentationNames.BionicSpine, - repCost: 4.5e4, - moneyCost: 1.25e8, - info: - "The spine is reconstructed using plasteel and carbon fibers. " + - "It is now capable of stimulating and regulating neural signals " + - "passing through the spinal cord, improving senses and reaction speed. " + - "The 'Bionic Spine' also interfaces with all other 'Bionic' implants.", - strength_mult: 1.15, - defense_mult: 1.15, - agility_mult: 1.15, - dexterity_mult: 1.15, - factions: [ - FactionNames.SpeakersForTheDead, - FactionNames.TheSyndicate, - FactionNames.KuaiGongInternational, - FactionNames.OmniTekIncorporated, - FactionNames.BladeIndustries, - ], - }), - new Augmentation({ - name: AugmentationNames.GrapheneBionicSpine, - repCost: 1.625e6, - moneyCost: 6e9, - info: - "An upgrade to the 'Bionic Spine' augmentation. The spine is fused with graphene " + - "which enhances durability and supercharges all body functions.", - prereqs: [AugmentationNames.BionicSpine], - strength_mult: 1.6, - defense_mult: 1.6, - agility_mult: 1.6, - dexterity_mult: 1.6, - factions: [FactionNames.FulcrumSecretTechnologies, FactionNames.ECorp], - }), - new Augmentation({ - name: AugmentationNames.BionicLegs, - repCost: 1.5e5, - moneyCost: 3.75e8, - info: "Cybernetic legs, created from plasteel and carbon fibers, enhance running speed.", - agility_mult: 1.6, - factions: [ - FactionNames.SpeakersForTheDead, - FactionNames.TheSyndicate, - FactionNames.KuaiGongInternational, - FactionNames.OmniTekIncorporated, - FactionNames.BladeIndustries, - ], - }), - new Augmentation({ - name: AugmentationNames.GrapheneBionicLegs, - repCost: 7.5e5, - moneyCost: 4.5e9, - info: - "An upgrade to the 'Bionic Legs' augmentation. The legs are fused " + - "with graphene, greatly enhancing jumping ability.", - prereqs: [AugmentationNames.BionicLegs], - agility_mult: 2.5, - factions: [FactionNames.MegaCorp, FactionNames.ECorp, FactionNames.FulcrumSecretTechnologies], - }), - new Augmentation({ - name: AugmentationNames.SpeechProcessor, - repCost: 7.5e3, - moneyCost: 5e7, - info: - "A cochlear implant with an embedded computer that analyzes incoming speech. " + - "The embedded computer processes characteristics of incoming speech, such as tone " + - "and inflection, to pick up on subtle cues and aid in social interactions.", - charisma_mult: 1.2, - factions: [ - FactionNames.TianDiHui, - FactionNames.Chongqing, - FactionNames.Sector12, - FactionNames.NewTokyo, - FactionNames.Aevum, - FactionNames.Ishima, - FactionNames.Volhaven, - FactionNames.Silhouette, - ], - }), - new Augmentation({ - name: AugmentationNames.TITN41Injection, - repCost: 2.5e4, - moneyCost: 1.9e8, - info: - "TITN is a series of viruses that targets and alters the sequences of human DNA in genes that " + - "control personality. The TITN-41 strain alters these genes so that the subject becomes more " + - "outgoing and socialable.", - charisma_mult: 1.15, - charisma_exp_mult: 1.15, - factions: [FactionNames.Silhouette], - }), - new Augmentation({ - name: AugmentationNames.EnhancedSocialInteractionImplant, - repCost: 3.75e5, - moneyCost: 1.375e9, - info: - "A cranial implant that greatly assists in the user's ability to analyze social situations " + - "and interactions. The system uses a wide variety of factors such as facial expressions, body " + - "language, and the voice tone, and inflection to determine the best course of action during social" + - "situations. The implant also uses deep learning software to continuously learn new behavior" + - "patterns and how to best respond.", - charisma_mult: 1.6, - charisma_exp_mult: 1.6, - factions: [ - FactionNames.BachmanAssociates, - FactionNames.NWO, - FactionNames.ClarkeIncorporated, - FactionNames.OmniTekIncorporated, - FactionNames.FourSigma, - ], - }), - new Augmentation({ - name: AugmentationNames.BitWire, - repCost: 3.75e3, - moneyCost: 1e7, - info: - "A small brain implant embedded in the cerebrum. This regulates and improves the brain's computing " + - "capabilities.", - hacking_mult: 1.05, - factions: [FactionNames.CyberSec, FactionNames.NiteSec], - }), - new Augmentation({ - name: AugmentationNames.ArtificialBioNeuralNetwork, - repCost: 2.75e5, - moneyCost: 3e9, - info: - "A network consisting of millions of nanoprocessors is embedded into the brain. " + - "The network is meant to mimic the way a biological brain solves a problem, with each " + - "nanoprocessor acting similar to the way a neuron would in a neural network. However, these " + - "nanoprocessors are programmed to perform computations much faster than organic neurons, " + - "allowing the user to solve much more complex problems at a much faster rate.", - hacking_speed_mult: 1.03, - hacking_money_mult: 1.15, - hacking_mult: 1.12, - factions: [FactionNames.BitRunners, FactionNames.FulcrumSecretTechnologies], - }), - new Augmentation({ - name: AugmentationNames.ArtificialSynapticPotentiation, - repCost: 6.25e3, - moneyCost: 8e7, - info: - "The body is injected with a chemical that artificially induces synaptic potentiation, " + - "otherwise known as the strengthening of synapses. This results in enhanced cognitive abilities.", - hacking_speed_mult: 1.02, - hacking_chance_mult: 1.05, - hacking_exp_mult: 1.05, - factions: [FactionNames.TheBlackHand, FactionNames.NiteSec], - }), - new Augmentation({ - name: AugmentationNames.EnhancedMyelinSheathing, - repCost: 1e5, - moneyCost: 1.375e9, - info: - "Electrical signals are used to induce a new, artificial form of myelinogenesis in the human body. " + - "This process results in the proliferation of new, synthetic myelin sheaths in the nervous " + - "system. These myelin sheaths can propogate neuro-signals much faster than their organic " + - "counterparts, leading to greater processing speeds and better brain function.", - hacking_speed_mult: 1.03, - hacking_exp_mult: 1.1, - hacking_mult: 1.08, - factions: [FactionNames.FulcrumSecretTechnologies, FactionNames.BitRunners, FactionNames.TheBlackHand], - }), - new Augmentation({ - name: AugmentationNames.SynapticEnhancement, - repCost: 2e3, - moneyCost: 7.5e6, - info: - "A small cranial implant that continuously uses weak electrical signals to stimulate the brain and " + - "induce stronger synaptic activity. This improves the user's cognitive abilities.", - hacking_speed_mult: 1.03, - factions: [FactionNames.CyberSec, FactionNames.Aevum], - }), - new Augmentation({ - name: AugmentationNames.NeuralRetentionEnhancement, - repCost: 2e4, - moneyCost: 2.5e8, - info: - "Chemical injections are used to permanently alter and strengthen the brain's neuronal " + - "circuits, strengthening the ability to retain information.", - hacking_exp_mult: 1.25, - factions: [FactionNames.NiteSec], - }), - new Augmentation({ - name: AugmentationNames.DataJack, - repCost: 1.125e5, - moneyCost: 4.5e8, - info: - "A brain implant that provides an interface for direct, wireless communication between a computer's main " + - "memory and the mind. This implant allows the user to not only access a computer's memory, but also alter " + - "and delete it.", - hacking_money_mult: 1.25, - factions: [ - FactionNames.BitRunners, - FactionNames.TheBlackHand, - FactionNames.NiteSec, - FactionNames.Chongqing, - FactionNames.NewTokyo, - ], - }), - new Augmentation({ - name: AugmentationNames.ENM, - repCost: 1.5e4, - moneyCost: 2.5e8, - info: - "A thin device embedded inside the arm containing a wireless module capable of connecting " + - "to nearby networks. Once connected, the Netburner Module is capable of capturing and " + - "processing all of the traffic on that network. By itself, the Embedded Netburner Module does " + - "not do much, but a variety of very powerful upgrades can be installed that allow you to fully " + - "control the traffic on a network.", - hacking_mult: 1.08, - factions: [ - FactionNames.BitRunners, - FactionNames.TheBlackHand, - FactionNames.NiteSec, - FactionNames.ECorp, - FactionNames.MegaCorp, - FactionNames.FulcrumSecretTechnologies, - FactionNames.NWO, - FactionNames.BladeIndustries, - ], - }), - new Augmentation({ - name: AugmentationNames.ENMCore, - repCost: 175e3, - moneyCost: 2.5e9, - info: - "The Core library is an implant that upgrades the firmware of the Embedded Netburner Module. " + - "This upgrade allows the Embedded Netburner Module to generate its own data on a network.", - prereqs: [AugmentationNames.ENM], - hacking_speed_mult: 1.03, - hacking_money_mult: 1.1, - hacking_chance_mult: 1.03, - hacking_exp_mult: 1.07, - hacking_mult: 1.07, - factions: [ - FactionNames.BitRunners, - FactionNames.TheBlackHand, - FactionNames.ECorp, - FactionNames.MegaCorp, - FactionNames.FulcrumSecretTechnologies, - FactionNames.NWO, - FactionNames.BladeIndustries, - ], - }), - new Augmentation({ - name: AugmentationNames.ENMCoreV2, - repCost: 1e6, - moneyCost: 4.5e9, - info: - "The Core V2 library is an implant that upgrades the firmware of the Embedded Netburner Module. " + - "This upgraded firmware allows the Embedded Netburner Module to control information on " + - "a network by re-routing traffic, spoofing IP addresses, and altering the data inside network " + - "packets.", - prereqs: [AugmentationNames.ENMCore], - hacking_speed_mult: 1.05, - hacking_money_mult: 1.3, - hacking_chance_mult: 1.05, - hacking_exp_mult: 1.15, - hacking_mult: 1.08, - factions: [ - FactionNames.BitRunners, - FactionNames.ECorp, - FactionNames.MegaCorp, - FactionNames.FulcrumSecretTechnologies, - FactionNames.NWO, - FactionNames.BladeIndustries, - FactionNames.OmniTekIncorporated, - FactionNames.KuaiGongInternational, - ], - }), - new Augmentation({ - name: AugmentationNames.ENMCoreV3, - repCost: 1.75e6, - moneyCost: 7.5e9, - info: - "The Core V3 library is an implant that upgrades the firmware of the Embedded Netburner Module. " + - "This upgraded firmware allows the Embedded Netburner Module to seamlessly inject code into " + - "any device on a network.", - prereqs: [AugmentationNames.ENMCoreV2], - hacking_speed_mult: 1.05, - hacking_money_mult: 1.4, - hacking_chance_mult: 1.1, - hacking_exp_mult: 1.25, - hacking_mult: 1.1, - factions: [ - FactionNames.ECorp, - FactionNames.MegaCorp, - FactionNames.FulcrumSecretTechnologies, - FactionNames.NWO, - FactionNames.Daedalus, - FactionNames.TheCovenant, - FactionNames.Illuminati, - ], - }), - new Augmentation({ - name: AugmentationNames.ENMAnalyzeEngine, - repCost: 6.25e5, - moneyCost: 6e9, - info: - "Installs the Analyze Engine for the Embedded Netburner Module, which is a CPU cluster " + - "that vastly outperforms the Netburner Module's native single-core processor.", - prereqs: [AugmentationNames.ENM], - hacking_speed_mult: 1.1, - factions: [ - FactionNames.ECorp, - FactionNames.MegaCorp, - FactionNames.FulcrumSecretTechnologies, - FactionNames.NWO, - FactionNames.Daedalus, - FactionNames.TheCovenant, - FactionNames.Illuminati, - ], - }), - new Augmentation({ - name: AugmentationNames.ENMDMA, - repCost: 1e6, - moneyCost: 7e9, - info: - "This implant installs a Direct Memory Access (DMA) controller into the " + - "Embedded Netburner Module. This allows the Module to send and receive data " + - "directly to and from the main memory of devices on a network.", - prereqs: [AugmentationNames.ENM], - hacking_money_mult: 1.4, - hacking_chance_mult: 1.2, - factions: [ - FactionNames.ECorp, - FactionNames.MegaCorp, - FactionNames.FulcrumSecretTechnologies, - FactionNames.NWO, - FactionNames.Daedalus, - FactionNames.TheCovenant, - FactionNames.Illuminati, - ], - }), - new Augmentation({ - name: AugmentationNames.Neuralstimulator, - repCost: 5e4, - moneyCost: 3e9, - info: - "A cranial implant that intelligently stimulates certain areas of the brain " + - "in order to improve cognitive functions.", - hacking_speed_mult: 1.02, - hacking_chance_mult: 1.1, - hacking_exp_mult: 1.12, - factions: [ - FactionNames.TheBlackHand, - FactionNames.Chongqing, - FactionNames.Sector12, - FactionNames.NewTokyo, - FactionNames.Aevum, - FactionNames.Ishima, - FactionNames.Volhaven, - FactionNames.BachmanAssociates, - FactionNames.ClarkeIncorporated, - FactionNames.FourSigma, - ], - }), - new Augmentation({ - name: AugmentationNames.NeuralAccelerator, - repCost: 2e5, - moneyCost: 1.75e9, - info: - "A microprocessor that accelerates the processing " + - "speed of biological neural networks. This is a cranial implant that is embedded inside the brain.", - hacking_mult: 1.1, - hacking_exp_mult: 1.15, - hacking_money_mult: 1.2, - factions: [FactionNames.BitRunners], - }), - new Augmentation({ - name: AugmentationNames.CranialSignalProcessorsG1, - repCost: 1e4, - moneyCost: 7e7, - info: - "The first generation of Cranial Signal Processors. Cranial Signal Processors " + - "are a set of specialized microprocessors that are attached to " + - "neurons in the brain. These chips process neural signals to quickly and automatically perform specific computations " + - "so that the brain doesn't have to.", - hacking_speed_mult: 1.01, - hacking_mult: 1.05, - factions: [FactionNames.CyberSec], - }), - new Augmentation({ - name: AugmentationNames.CranialSignalProcessorsG2, - repCost: 1.875e4, - moneyCost: 1.25e8, - info: - "The second generation of Cranial Signal Processors. Cranial Signal Processors " + - "are a set of specialized microprocessors that are attached to " + - "neurons in the brain. These chips process neural signals to quickly and automatically perform specific computations " + - "so that the brain doesn't have to.", - prereqs: [AugmentationNames.CranialSignalProcessorsG1], - hacking_speed_mult: 1.02, - hacking_chance_mult: 1.05, - hacking_mult: 1.07, - factions: [FactionNames.CyberSec, FactionNames.NiteSec], - }), - new Augmentation({ - name: AugmentationNames.CranialSignalProcessorsG3, - repCost: 5e4, - moneyCost: 5.5e8, - info: - "The third generation of Cranial Signal Processors. Cranial Signal Processors " + - "are a set of specialized microprocessors that are attached to " + - "neurons in the brain. These chips process neural signals to quickly and automatically perform specific computations " + - "so that the brain doesn't have to.", - prereqs: [AugmentationNames.CranialSignalProcessorsG2], - hacking_speed_mult: 1.02, - hacking_money_mult: 1.15, - hacking_mult: 1.09, - factions: [FactionNames.NiteSec, FactionNames.TheBlackHand, FactionNames.BitRunners], - }), - new Augmentation({ - name: AugmentationNames.CranialSignalProcessorsG4, - repCost: 1.25e5, - moneyCost: 1.1e9, - info: - "The fourth generation of Cranial Signal Processors. Cranial Signal Processors " + - "are a set of specialized microprocessors that are attached to " + - "neurons in the brain. These chips process neural signals to quickly and automatically perform specific computations " + - "so that the brain doesn't have to.", - prereqs: [AugmentationNames.CranialSignalProcessorsG3], - hacking_speed_mult: 1.02, - hacking_money_mult: 1.2, - hacking_grow_mult: 1.25, - factions: [FactionNames.TheBlackHand, FactionNames.BitRunners], - }), - new Augmentation({ - name: AugmentationNames.CranialSignalProcessorsG5, - repCost: 2.5e5, - moneyCost: 2.25e9, - info: - "The fifth generation of Cranial Signal Processors. Cranial Signal Processors " + - "are a set of specialized microprocessors that are attached to " + - "neurons in the brain. These chips process neural signals to quickly and automatically perform specific computations " + - "so that the brain doesn't have to.", - prereqs: [AugmentationNames.CranialSignalProcessorsG4], - hacking_mult: 1.3, - hacking_money_mult: 1.25, - hacking_grow_mult: 1.75, - factions: [FactionNames.BitRunners], - }), - new Augmentation({ - name: AugmentationNames.NeuronalDensification, - repCost: 1.875e5, - moneyCost: 1.375e9, - info: - "The brain is surgically re-engineered to have increased neuronal density " + - "by decreasing the neuron gap junction. Then, the body is genetically modified " + - "to enhance the production and capabilities of its neural stem cells.", - hacking_mult: 1.15, - hacking_exp_mult: 1.1, - hacking_speed_mult: 1.03, - factions: [FactionNames.ClarkeIncorporated], - }), - new Augmentation({ - name: AugmentationNames.NuoptimalInjectorImplant, - repCost: 5e3, - moneyCost: 2e7, - info: - "This torso implant automatically injects nootropic supplements into " + - "the bloodstream to improve memory, increase focus, and provide other " + - "cognitive enhancements.", - company_rep_mult: 1.2, - factions: [ - FactionNames.TianDiHui, - FactionNames.Volhaven, - FactionNames.NewTokyo, - FactionNames.Chongqing, - FactionNames.ClarkeIncorporated, - FactionNames.FourSigma, - FactionNames.BachmanAssociates, - ], - }), - new Augmentation({ - name: AugmentationNames.SpeechEnhancement, - repCost: 2.5e3, - moneyCost: 1.25e7, - info: - "An advanced neural implant that improves your speaking abilities, making " + - "you more convincing and likable in conversations and overall improving your " + - "social interactions.", - company_rep_mult: 1.1, - charisma_mult: 1.1, - factions: [ - FactionNames.TianDiHui, - FactionNames.SpeakersForTheDead, - FactionNames.FourSigma, - FactionNames.KuaiGongInternational, - FactionNames.ClarkeIncorporated, - FactionNames.BachmanAssociates, - ], - }), - new Augmentation({ - name: AugmentationNames.FocusWire, - repCost: 7.5e4, - moneyCost: 9e8, - info: "A cranial implant that stops procrastination by blocking specific neural pathways in the brain.", - hacking_exp_mult: 1.05, - strength_exp_mult: 1.05, - defense_exp_mult: 1.05, - dexterity_exp_mult: 1.05, - agility_exp_mult: 1.05, - charisma_exp_mult: 1.05, - company_rep_mult: 1.1, - work_money_mult: 1.2, - factions: [ - FactionNames.BachmanAssociates, - FactionNames.ClarkeIncorporated, - FactionNames.FourSigma, - FactionNames.KuaiGongInternational, - ], - }), - new Augmentation({ - name: AugmentationNames.PCDNI, - repCost: 3.75e5, - moneyCost: 3.75e9, - info: - "Installs a Direct-Neural Interface jack into your arm that is compatible with most " + - "computers. Connecting to a computer through this jack allows you to interface with " + - "it using the brain's electrochemical signals.", - company_rep_mult: 1.3, - hacking_mult: 1.08, - factions: [ - FactionNames.FourSigma, - FactionNames.OmniTekIncorporated, - FactionNames.ECorp, - FactionNames.BladeIndustries, - ], - }), - new Augmentation({ - name: AugmentationNames.PCDNIOptimizer, - repCost: 5e5, - moneyCost: 4.5e9, - info: - "This is a submodule upgrade to the PC Direct-Neural Interface augmentation. It " + - "improves the performance of the interface and gives the user more control options " + - "to a connected computer.", - prereqs: [AugmentationNames.PCDNI], - company_rep_mult: 1.75, - hacking_mult: 1.1, - factions: [FactionNames.FulcrumSecretTechnologies, FactionNames.ECorp, FactionNames.BladeIndustries], - }), - new Augmentation({ - name: AugmentationNames.PCDNINeuralNetwork, - repCost: 1.5e6, - moneyCost: 7.5e9, - info: - "This is an additional installation that upgrades the functionality of the " + - "PC Direct-Neural Interface augmentation. When connected to a computer, " + - "The Neural Network upgrade allows the user to use their own brain's " + - "processing power to aid the computer in computational tasks.", - prereqs: [AugmentationNames.PCDNI], - company_rep_mult: 2, - hacking_mult: 1.1, - hacking_speed_mult: 1.05, - factions: [FactionNames.FulcrumSecretTechnologies], - }), - new Augmentation({ - name: AugmentationNames.ADRPheromone1, - repCost: 3.75e3, - moneyCost: 1.75e7, - info: - "The body is genetically re-engineered so that it produces the ADR-V1 pheromone, " + - "an artificial pheromone discovered by scientists. The ADR-V1 pheromone, when excreted, " + - "triggers feelings of admiration and approval in other people.", - company_rep_mult: 1.1, - faction_rep_mult: 1.1, - factions: [ - FactionNames.TianDiHui, - FactionNames.TheSyndicate, - FactionNames.NWO, - FactionNames.MegaCorp, - FactionNames.FourSigma, - ], - }), - new Augmentation({ - name: AugmentationNames.ADRPheromone2, - repCost: 6.25e4, - moneyCost: 5.5e8, - info: - "The body is genetically re-engineered so that it produces the ADR-V2 pheromone, " + - "which is similar to but more potent than ADR-V1. This pheromone, when excreted, " + - "triggers feelings of admiration, approval, and respect in others.", - company_rep_mult: 1.2, - faction_rep_mult: 1.2, - factions: [ - FactionNames.Silhouette, - FactionNames.FourSigma, - FactionNames.BachmanAssociates, - FactionNames.ClarkeIncorporated, - ], - }), - new Augmentation({ - name: AugmentationNames.ShadowsSimulacrum, - repCost: 3.75e4, - moneyCost: 4e8, - info: - "A crude but functional matter phase-shifter module that is embedded " + - "in the brainstem and cerebellum. This augmentation was developed by " + - "criminal organizations and allows the user to project and control holographic " + - "simulacrums within a large radius. These simulacrums are commonly used for " + - "espionage and surveillance work.", - company_rep_mult: 1.15, - faction_rep_mult: 1.15, - factions: [FactionNames.TheSyndicate, FactionNames.TheDarkArmy, FactionNames.SpeakersForTheDead], - }), - new Augmentation({ - name: AugmentationNames.HacknetNodeCPUUpload, - repCost: 3.75e3, - moneyCost: 1.1e7, - info: - "Uploads the architecture and design details of a Hacknet Node's CPU into " + - "the brain. This allows the user to engineer custom hardware and software " + - "for the Hacknet Node that provides better performance.", - hacknet_node_money_mult: 1.15, - hacknet_node_purchase_cost_mult: 0.85, - factions: [FactionNames.Netburners], - }), - new Augmentation({ - name: AugmentationNames.HacknetNodeCacheUpload, - repCost: 2.5e3, - moneyCost: 5.5e6, - info: - "Uploads the architecture and design details of a Hacknet Node's main-memory cache " + - "into the brain. This allows the user to engineer custom cache hardware for the " + - "Hacknet Node that offers better performance.", - hacknet_node_money_mult: 1.1, - hacknet_node_level_cost_mult: 0.85, - factions: [FactionNames.Netburners], - }), - new Augmentation({ - name: AugmentationNames.HacknetNodeNICUpload, - repCost: 1.875e3, - moneyCost: 4.5e6, - info: - "Uploads the architecture and design details of a Hacknet Node's Network Interface Card (NIC) " + - "into the brain. This allows the user to engineer a custom NIC for the Hacknet Node that " + - "offers better performance.", - hacknet_node_money_mult: 1.1, - hacknet_node_purchase_cost_mult: 0.9, - factions: [FactionNames.Netburners], - }), - new Augmentation({ - name: AugmentationNames.HacknetNodeKernelDNI, - repCost: 7.5e3, - moneyCost: 4e7, - info: - "Installs a Direct-Neural Interface jack into the arm that is capable of connecting to a " + - "Hacknet Node. This lets the user access and manipulate the Node's kernel using " + - "electrochemical signals.", - hacknet_node_money_mult: 1.25, - factions: [FactionNames.Netburners], - }), - new Augmentation({ - name: AugmentationNames.HacknetNodeCoreDNI, - repCost: 1.25e4, - moneyCost: 6e7, - info: - "Installs a Direct-Neural Interface jack into the arm that is capable of connecting " + - "to a Hacknet Node. This lets the user access and manipulate the Node's processing logic using " + - "electrochemical signals.", - hacknet_node_money_mult: 1.45, - factions: [FactionNames.Netburners], - }), - new Augmentation({ - name: AugmentationNames.Neurotrainer1, - repCost: 1e3, - moneyCost: 4e6, - info: - "A decentralized cranial implant that improves the brain's ability to learn. It is " + - "installed by releasing millions of nanobots into the human brain, each of which " + - "attaches to a different neural pathway to enhance the brain's ability to retain " + - "and retrieve information.", - hacking_exp_mult: 1.1, - strength_exp_mult: 1.1, - defense_exp_mult: 1.1, - dexterity_exp_mult: 1.1, - agility_exp_mult: 1.1, - charisma_exp_mult: 1.1, - factions: [FactionNames.CyberSec, FactionNames.Aevum], - }), - new Augmentation({ - name: AugmentationNames.Neurotrainer2, - repCost: 1e4, - moneyCost: 4.5e7, - info: - "A decentralized cranial implant that improves the brain's ability to learn. This " + - "is a more powerful version of the Neurotrainer I augmentation, but it does not " + - "require Neurotrainer I to be installed as a prerequisite.", - hacking_exp_mult: 1.15, - strength_exp_mult: 1.15, - defense_exp_mult: 1.15, - dexterity_exp_mult: 1.15, - agility_exp_mult: 1.15, - charisma_exp_mult: 1.15, - factions: [FactionNames.BitRunners, FactionNames.NiteSec], - }), - new Augmentation({ - name: AugmentationNames.Neurotrainer3, - repCost: 2.5e4, - moneyCost: 1.3e8, - info: - "A decentralized cranial implant that improves the brain's ability to learn. This " + - "is a more powerful version of the Neurotrainer I and Neurotrainer II augmentation, " + - "but it does not require either of them to be installed as a prerequisite.", - hacking_exp_mult: 1.2, - strength_exp_mult: 1.2, - defense_exp_mult: 1.2, - dexterity_exp_mult: 1.2, - agility_exp_mult: 1.2, - charisma_exp_mult: 1.2, - factions: [FactionNames.NWO, FactionNames.FourSigma], - }), - new Augmentation({ - name: AugmentationNames.Hypersight, - repCost: 1.5e5, - moneyCost: 2.75e9, - info: - "A bionic eye implant that grants sight capabilities far beyond those of a natural human. " + - "Embedded circuitry within the implant provides the ability to detect heat and movement " + - "through solid objects such as walls, thus providing 'x-ray vision'-like capabilities.", - dexterity_mult: 1.4, - hacking_speed_mult: 1.03, - hacking_money_mult: 1.1, - factions: [FactionNames.BladeIndustries, FactionNames.KuaiGongInternational], - }), - new Augmentation({ - name: AugmentationNames.LuminCloaking1, - repCost: 1.5e3, - moneyCost: 5e6, - info: - "A skin implant that reinforces the skin with highly-advanced synthetic cells. These " + - "cells, when powered, have a negative refractive index. As a result, they bend light " + - "around the skin, making the user much harder to see to the naked eye.", - agility_mult: 1.05, - crime_money_mult: 1.1, - factions: [FactionNames.SlumSnakes, FactionNames.Tetrads], - }), - new Augmentation({ - name: AugmentationNames.LuminCloaking2, - repCost: 5e3, - moneyCost: 3e7, - info: - "This is a more advanced version of the LuminCloaking-V1 augmentation. This skin implant " + - "reinforces the skin with highly-advanced synthetic cells. These " + - "cells, when powered, are capable of not only bending light but also of bending heat, " + - "making the user more resilient as well as stealthy.", - prereqs: [AugmentationNames.LuminCloaking1], - agility_mult: 1.1, - defense_mult: 1.1, - crime_money_mult: 1.25, - factions: [FactionNames.SlumSnakes, FactionNames.Tetrads], - }), - new Augmentation({ - name: AugmentationNames.SmartSonar, - repCost: 2.25e4, - moneyCost: 7.5e7, - info: "A cochlear implant that helps the player detect and locate enemies using sound propagation.", - dexterity_mult: 1.1, - dexterity_exp_mult: 1.15, - crime_money_mult: 1.25, - factions: [FactionNames.SlumSnakes], - }), - new Augmentation({ - name: AugmentationNames.PowerRecirculator, - repCost: 2.5e4, - moneyCost: 1.8e8, - info: - "The body's nerves are attached with polypyrrole nanocircuits that " + - "are capable of capturing wasted energy, in the form of heat, " + - "and converting it back into usable power.", - hacking_mult: 1.05, - strength_mult: 1.05, - defense_mult: 1.05, - dexterity_mult: 1.05, - agility_mult: 1.05, - charisma_mult: 1.05, - hacking_exp_mult: 1.1, - strength_exp_mult: 1.1, - defense_exp_mult: 1.1, - dexterity_exp_mult: 1.1, - agility_exp_mult: 1.1, - charisma_exp_mult: 1.1, - factions: [FactionNames.Tetrads, FactionNames.TheDarkArmy, FactionNames.TheSyndicate, FactionNames.NWO], - }), - new Augmentation({ - name: AugmentationNames.QLink, - repCost: 1.875e6, - moneyCost: 2.5e13, - info: - `A brain implant that wirelessly connects you to the ${FactionNames.Illuminati}'s ` + - "quantum supercomputer, allowing you to access and use its incredible " + - "computing power.", - hacking_mult: 1.75, - hacking_speed_mult: 2, - hacking_chance_mult: 2.5, - hacking_money_mult: 4, - factions: [FactionNames.Illuminati], - }), - new Augmentation({ - name: AugmentationNames.SPTN97, - repCost: 1.25e6, - moneyCost: 4.875e9, - info: - "The SPTN-97 gene is injected into the genome. The SPTN-97 gene is an " + - "artificially-synthesized gene that was developed by DARPA to create " + - "super-soldiers through genetic modification. The gene was outlawed in " + - "2056.", - strength_mult: 1.75, - defense_mult: 1.75, - dexterity_mult: 1.75, - agility_mult: 1.75, - hacking_mult: 1.15, - factions: [FactionNames.TheCovenant], - }), - new Augmentation({ - name: AugmentationNames.HiveMind, - repCost: 1.5e6, - moneyCost: 5.5e9, - info: - `A brain implant developed by ${FactionNames.ECorp}. They do not reveal what ` + - "exactly the implant does, but they promise that it will greatly " + - "enhance your abilities.", - hacking_grow_mult: 3, - stats: null, - factions: [FactionNames.ECorp], - }), - new Augmentation({ - name: AugmentationNames.TheRedPill, - repCost: 2.5e6, - moneyCost: 0, - info: "It's time to leave the cave.", - stats: null, - factions: [FactionNames.Daedalus], - }), - new Augmentation({ - name: AugmentationNames.CordiARCReactor, - repCost: 1.125e6, - moneyCost: 5e9, - info: - "The thoracic cavity is equipped with a small chamber designed " + - "to hold and sustain hydrogen plasma. The plasma is used to generate " + - "fusion power through nuclear fusion, providing limitless amounts of clean " + - "energy for the body.", - strength_mult: 1.35, - defense_mult: 1.35, - dexterity_mult: 1.35, - agility_mult: 1.35, - strength_exp_mult: 1.35, - defense_exp_mult: 1.35, - dexterity_exp_mult: 1.35, - agility_exp_mult: 1.35, - factions: [FactionNames.MegaCorp], - }), - new Augmentation({ - name: AugmentationNames.SmartJaw, - repCost: 3.75e5, - moneyCost: 2.75e9, - info: - "A bionic jaw that contains advanced hardware and software " + - "capable of psychoanalyzing and profiling the personality of " + - "others using optical imaging software.", - charisma_mult: 1.5, - charisma_exp_mult: 1.5, - company_rep_mult: 1.25, - faction_rep_mult: 1.25, - factions: [FactionNames.BachmanAssociates], - }), - new Augmentation({ - name: AugmentationNames.Neotra, - repCost: 5.625e5, - moneyCost: 2.875e9, - info: - "A highly-advanced techno-organic drug that is injected into the skeletal " + - "and integumentary system. The drug permanently modifies the DNA of the " + - "body's skin and bone cells, granting them the ability to repair " + - "and restructure themselves.", - strength_mult: 1.55, - defense_mult: 1.55, - factions: [FactionNames.BladeIndustries], - }), - new Augmentation({ - name: AugmentationNames.Xanipher, - repCost: 8.75e5, - moneyCost: 4.25e9, - info: - "A concoction of advanced nanobots that is orally ingested into the " + - "body. These nanobots induce physiological changes and significantly " + - "improve the body's functioning in all aspects.", - hacking_mult: 1.2, - strength_mult: 1.2, - defense_mult: 1.2, - dexterity_mult: 1.2, - agility_mult: 1.2, - charisma_mult: 1.2, - hacking_exp_mult: 1.15, - strength_exp_mult: 1.15, - defense_exp_mult: 1.15, - dexterity_exp_mult: 1.15, - agility_exp_mult: 1.15, - charisma_exp_mult: 1.15, - factions: [FactionNames.NWO], - }), - new Augmentation({ - name: AugmentationNames.HydroflameLeftArm, - repCost: 1.25e6, - moneyCost: 2.5e12, - info: - "The left arm of a legendary BitRunner who ascended beyond this world. " + - "It projects a light blue energy shield that protects the exposed inner parts. " + - "Even though it contains no weapons, the advanced tungsten titanium " + - "alloy increases the user's strength to unbelievable levels. The augmentation " + - "gets more powerful over time for seemingly no reason.", - strength_mult: 2.7, - factions: [FactionNames.NWO], - }), - new Augmentation({ - name: AugmentationNames.nextSENS, - repCost: 4.375e5, - moneyCost: 1.925e9, - info: - "The body is genetically re-engineered to maintain a state " + - "of negligible senescence, preventing the body from " + - "deteriorating with age.", - hacking_mult: 1.2, - strength_mult: 1.2, - defense_mult: 1.2, - dexterity_mult: 1.2, - agility_mult: 1.2, - charisma_mult: 1.2, - factions: [FactionNames.ClarkeIncorporated], - }), - new Augmentation({ - name: AugmentationNames.OmniTekInfoLoad, - repCost: 6.25e5, - moneyCost: 2.875e9, - info: - "OmniTek's data and information repository is uploaded " + - "into your brain, enhancing your programming and " + - "hacking abilities.", - hacking_mult: 1.2, - hacking_exp_mult: 1.25, - factions: [FactionNames.OmniTekIncorporated], - }), - new Augmentation({ - name: AugmentationNames.PhotosyntheticCells, - repCost: 5.625e5, - moneyCost: 2.75e9, - info: - "Chloroplasts are added to epidermal stem cells and are applied " + - "to the body using a skin graft. The result is photosynthetic " + - "skin cells, allowing users to generate their own energy " + - "and nutrition using solar power.", - strength_mult: 1.4, - defense_mult: 1.4, - agility_mult: 1.4, - factions: [FactionNames.KuaiGongInternational], - }), - new Augmentation({ - name: AugmentationNames.Neurolink, - repCost: 8.75e5, - moneyCost: 4.375e9, - info: - "A brain implant that provides a high-bandwidth, direct neural link between your " + - `mind and the ${FactionNames.BitRunners}' data servers, which reportedly contain ` + - "the largest database of hacking tools and information in the world.", - hacking_mult: 1.15, - hacking_exp_mult: 1.2, - hacking_chance_mult: 1.1, - hacking_speed_mult: 1.05, - programs: [Programs.FTPCrackProgram.name, Programs.RelaySMTPProgram.name], - factions: [FactionNames.BitRunners], - }), - new Augmentation({ - name: AugmentationNames.TheBlackHand, - repCost: 1e5, - moneyCost: 5.5e8, - info: - "A highly advanced bionic hand. This prosthetic not only " + - "enhances strength and dexterity but it is also embedded " + - "with hardware and firmware that lets the user connect to, access, and hack " + - "devices and machines by just touching them.", - strength_mult: 1.15, - dexterity_mult: 1.15, - hacking_mult: 1.1, - hacking_speed_mult: 1.02, - hacking_money_mult: 1.1, - factions: [FactionNames.TheBlackHand], - }), - new Augmentation({ - name: AugmentationNames.CRTX42AA, - repCost: 4.5e4, - moneyCost: 2.25e8, - info: - "The CRTX42-AA gene is injected into the genome. " + - "The CRTX42-AA is an artificially-synthesized gene that targets the visual and prefrontal " + - "cortex and improves cognitive abilities.", - hacking_mult: 1.08, - hacking_exp_mult: 1.15, - factions: [FactionNames.NiteSec], - }), - new Augmentation({ - name: AugmentationNames.Neuregen, - repCost: 3.75e4, - moneyCost: 3.75e8, - info: - "A drug that genetically modifies the neurons in the brain " + - "resulting in neurons that never die, continuously " + - "regenerate, and strengthen themselves.", - hacking_exp_mult: 1.4, - factions: [FactionNames.Chongqing], - }), - new Augmentation({ - name: AugmentationNames.CashRoot, - repCost: 1.25e4, - moneyCost: 1.25e8, - info: ( - <> - A collection of digital assets saved on a small chip. The chip is implanted into your wrist. A small jack in - the chip allows you to connect it to a computer and upload the assets. - - ), - startingMoney: 1e6, - programs: [Programs.BruteSSHProgram.name], - factions: [FactionNames.Sector12], - }), - new Augmentation({ - name: AugmentationNames.NutriGen, - repCost: 6.25e3, - moneyCost: 2.5e6, - info: - "A thermo-powered artificial nutrition generator. Endogenously " + - "synthesizes glucose, amino acids, and vitamins and redistributes them " + - "across the body. The device is powered by the body's naturally wasted " + - "energy in the form of heat.", - strength_exp_mult: 1.2, - defense_exp_mult: 1.2, - dexterity_exp_mult: 1.2, - agility_exp_mult: 1.2, - factions: [FactionNames.NewTokyo], - }), - new Augmentation({ - name: AugmentationNames.PCMatrix, - repCost: 100e3, - moneyCost: 2e9, - info: - "A 'Probability Computation Matrix' is installed in the frontal cortex. This implant " + - "uses advanced mathematical algorithims to rapidly identify and compute statistical " + - "outcomes of nearly every situation.", - charisma_mult: 1.0777, - charisma_exp_mult: 1.0777, - work_money_mult: 1.777, - faction_rep_mult: 1.0777, - company_rep_mult: 1.0777, - crime_success_mult: 1.0777, - crime_money_mult: 1.0777, - programs: [Programs.DeepscanV1.name, Programs.AutoLink.name], - factions: [FactionNames.Aevum], - }), - new Augmentation({ - name: AugmentationNames.INFRARet, - repCost: 7.5e3, - moneyCost: 3e7, - info: "A tiny chip that sits behind the retinae. This implant lets the user visually detect infrared radiation.", - crime_success_mult: 1.25, - crime_money_mult: 1.1, - dexterity_mult: 1.1, - factions: [FactionNames.Ishima], - }), - new Augmentation({ - name: AugmentationNames.DermaForce, - repCost: 1.5e4, - moneyCost: 5e7, - info: - "Synthetic skin that is grafted onto the body. This skin consists of " + - "millions of nanobots capable of projecting high-density muon beams, " + - "creating an energy barrier around the user.", - defense_mult: 1.4, - factions: [FactionNames.Volhaven], - }), - new Augmentation({ - name: AugmentationNames.GrapheneBrachiBlades, - repCost: 2.25e5, - moneyCost: 2.5e9, - info: - "An upgrade to the BrachiBlades augmentation. It infuses " + - "the retractable blades with an advanced graphene material " + - "making them stronger and lighter.", - prereqs: [AugmentationNames.BrachiBlades], - strength_mult: 1.4, - defense_mult: 1.4, - crime_success_mult: 1.1, - crime_money_mult: 1.3, - factions: [FactionNames.SpeakersForTheDead], - }), - new Augmentation({ - name: AugmentationNames.GrapheneBionicArms, - repCost: 5e5, - moneyCost: 3.75e9, - info: - "An upgrade to the Bionic Arms augmentation. It infuses the " + - "prosthetic arms with an advanced graphene material " + - "to make them stronger and lighter.", - prereqs: [AugmentationNames.BionicArms], - strength_mult: 1.85, - dexterity_mult: 1.85, - factions: [FactionNames.TheDarkArmy], - }), - new Augmentation({ - name: AugmentationNames.BrachiBlades, - repCost: 1.25e4, - moneyCost: 9e7, - info: "A set of retractable plasteel blades that are implanted in the arm, underneath the skin.", - strength_mult: 1.15, - defense_mult: 1.15, - crime_success_mult: 1.1, - crime_money_mult: 1.15, - factions: [FactionNames.TheSyndicate], - }), - new Augmentation({ - name: AugmentationNames.BionicArms, - repCost: 6.25e4, - moneyCost: 2.75e8, - info: "Cybernetic arms created from plasteel and carbon fibers that completely replace the user's organic arms.", - strength_mult: 1.3, - dexterity_mult: 1.3, - factions: [FactionNames.Tetrads], - }), - new Augmentation({ - name: AugmentationNames.SNA, - repCost: 6.25e3, - moneyCost: 3e7, - info: - "A cranial implant that affects the user's personality, making them better " + - "at negotiation in social situations.", - work_money_mult: 1.1, - company_rep_mult: 1.15, - faction_rep_mult: 1.15, - factions: [FactionNames.TianDiHui], - }), - new Augmentation({ - name: AugmentationNames.NeuroreceptorManager, - repCost: 0.75e5, - moneyCost: 5.5e8, - info: - "A brain implant carefully assembled around the synapses, which " + - "micromanages the activity and levels of various neuroreceptor " + - "chemicals and modulates electrical activity to optimize concentration, " + - "allowing the user to multitask much more effectively.", - stats: ( - <> - This augmentation removes the penalty for not focusing on actions such as working in a job or working for a - faction. - - ), - factions: [FactionNames.TianDiHui], - }), - ]; +function initAugmentations(): void { + resetFactionAugmentations(); + clearObject(Augmentations); + createAugmentations(); + updateAugmentationCosts(); + Player.reapplyAllAugmentations(); +} - // Special Bladeburner Augmentations - const BladeburnersFactionName = FactionNames.Bladeburners; - if (factionExists(BladeburnersFactionName)) { - augmentations.push( - new Augmentation({ - name: AugmentationNames.EsperEyewear, - repCost: 1.25e3, - moneyCost: 1.65e8, - info: - "Ballistic-grade protective and retractable eyewear that was designed specifically " + - "for Bladeburner units. This " + - "is implanted by installing a mechanical frame in the skull's orbit. " + - "This frame interfaces with the brain and allows the user to " + - "automatically extrude and extract the eyewear. The eyewear protects " + - "against debris, shrapnel, lasers, blinding flashes, and gas. It is also " + - "embedded with a data processing chip that can be programmed to display an " + - "AR HUD to assist the user in field missions.", - bladeburner_success_chance_mult: 1.03, - dexterity_mult: 1.05, - isSpecial: true, - factions: [BladeburnersFactionName], - }), - new Augmentation({ - name: AugmentationNames.EMS4Recombination, - repCost: 2.5e3, - moneyCost: 2.75e8, - info: - "A DNA recombination of the EMS-4 Gene. This genetic engineering " + - "technique was originally used on Bladeburners during the Synthoid uprising " + - "to induce wakefulness and concentration, suppress fear, reduce empathy, " + - "improve reflexes, and improve memory among other things.", - bladeburner_success_chance_mult: 1.03, - bladeburner_analysis_mult: 1.05, - bladeburner_stamina_gain_mult: 1.02, - isSpecial: true, - factions: [BladeburnersFactionName], - }), - new Augmentation({ - name: AugmentationNames.OrionShoulder, - repCost: 6.25e3, - moneyCost: 5.5e8, - info: - "A bionic shoulder augmentation for the right shoulder. Using cybernetics, " + - "the ORION-MKIV shoulder enhances the strength and dexterity " + - "of the user's right arm. It also provides protection due to its " + - "crystallized graphene plating.", - defense_mult: 1.05, - strength_mult: 1.05, - dexterity_mult: 1.05, - bladeburner_success_chance_mult: 1.04, - isSpecial: true, - factions: [BladeburnersFactionName], - }), - new Augmentation({ - name: AugmentationNames.HyperionV1, - repCost: 1.25e4, - moneyCost: 2.75e9, - info: - "A pair of mini plasma cannons embedded into the hands. The Hyperion is capable " + - "of rapidly firing bolts of high-density plasma. The weapon is meant to " + - "be used against augmented enemies as the ionized " + - "nature of the plasma disrupts the electrical systems of Augmentations. However, " + - "it can also be effective against non-augmented enemies due to its high temperature " + - "and concussive force.", - bladeburner_success_chance_mult: 1.06, - isSpecial: true, - factions: [BladeburnersFactionName], - }), - new Augmentation({ - name: AugmentationNames.HyperionV2, - repCost: 2.5e4, - moneyCost: 5.5e9, - info: - "A pair of mini plasma cannons embedded into the hands. This augmentation " + - "is more advanced and powerful than the original V1 model. This V2 model is " + - "more power-efficient, more accurate, and can fire plasma bolts at a much " + - "higher velocity than the V1 model.", - prereqs: [AugmentationNames.HyperionV1], - bladeburner_success_chance_mult: 1.08, - isSpecial: true, - factions: [BladeburnersFactionName], - }), - new Augmentation({ - name: AugmentationNames.GolemSerum, - repCost: 3.125e4, - moneyCost: 1.1e10, - info: - "A serum that permanently enhances many aspects of human capabilities, " + - "including strength, speed, immune system enhancements, and mitochondrial efficiency. The " + - "serum was originally developed by the Chinese military in an attempt to " + - "create super soldiers.", - strength_mult: 1.07, - defense_mult: 1.07, - dexterity_mult: 1.07, - agility_mult: 1.07, - bladeburner_stamina_gain_mult: 1.05, - isSpecial: true, - factions: [BladeburnersFactionName], - }), - new Augmentation({ - name: AugmentationNames.VangelisVirus, - repCost: 1.875e4, - moneyCost: 2.75e9, - info: - "A synthetic symbiotic virus that is injected into human brain tissue. The Vangelis virus " + - "heightens the senses and focus of its host, and also enhances its intuition.", - dexterity_exp_mult: 1.1, - bladeburner_analysis_mult: 1.1, - bladeburner_success_chance_mult: 1.04, - isSpecial: true, - factions: [BladeburnersFactionName], - }), - new Augmentation({ - name: AugmentationNames.VangelisVirus3, - repCost: 3.75e4, - moneyCost: 1.1e10, - info: - "An improved version of Vangelis, a synthetic symbiotic virus that is " + - "injected into human brain tissue. On top of the benefits of the original " + - "virus, this also grants an accelerated healing factor and enhanced " + - "reflexes.", - prereqs: [AugmentationNames.VangelisVirus], - defense_exp_mult: 1.1, - dexterity_exp_mult: 1.1, - bladeburner_analysis_mult: 1.15, - bladeburner_success_chance_mult: 1.05, - isSpecial: true, - factions: [BladeburnersFactionName], - }), - new Augmentation({ - name: AugmentationNames.INTERLINKED, - repCost: 2.5e4, - moneyCost: 5.5e9, - info: - "The DNA is genetically modified to enhance the human's body " + - "extracellular matrix (ECM). This improves the ECM's ability to " + - "structurally support the body and grants heightened strength and " + - "durability.", - strength_exp_mult: 1.05, - defense_exp_mult: 1.05, - dexterity_exp_mult: 1.05, - agility_exp_mult: 1.05, - bladeburner_max_stamina_mult: 1.1, - isSpecial: true, - factions: [BladeburnersFactionName], - }), - new Augmentation({ - name: AugmentationNames.BladeRunner, - repCost: 2e4, - moneyCost: 8.25e9, - info: - `A cybernetic foot augmentation that was specifically created for ${BladeburnersFactionName} ` + - "during the Synthoid Uprising. The organic musculature of the human foot " + - "is enhanced with flexible carbon nanotube matrices that are controlled by " + - "intelligent servo-motors.", - agility_mult: 1.05, - bladeburner_max_stamina_mult: 1.05, - bladeburner_stamina_gain_mult: 1.05, - isSpecial: true, - factions: [BladeburnersFactionName], - }), - new Augmentation({ - name: AugmentationNames.BladeArmor, - repCost: 1.25e4, - moneyCost: 1.375e9, - info: - `A powered exoskeleton suit designed as armor for ${BladeburnersFactionName} units. This ` + - "exoskeleton is incredibly adaptable and can protect the wearer from blunt, piercing, " + - "concussive, thermal, chemical, and electric trauma. It also enhances the user's " + - "physical abilities.", - strength_mult: 1.04, - defense_mult: 1.04, - dexterity_mult: 1.04, - agility_mult: 1.04, - bladeburner_stamina_gain_mult: 1.02, - bladeburner_success_chance_mult: 1.03, - isSpecial: true, - factions: [BladeburnersFactionName], - }), - new Augmentation({ - name: AugmentationNames.BladeArmorPowerCells, - repCost: 1.875e4, - moneyCost: 2.75e9, - info: - "Upgrades the BLADE-51b Tesla Armor with Ion Power Cells, which are capable of " + - "more efficiently storing and using power.", - prereqs: [AugmentationNames.BladeArmor], - bladeburner_success_chance_mult: 1.05, - bladeburner_stamina_gain_mult: 1.02, - bladeburner_max_stamina_mult: 1.05, - isSpecial: true, - factions: [BladeburnersFactionName], - }), - new Augmentation({ - name: AugmentationNames.BladeArmorEnergyShielding, - repCost: 2.125e4, - moneyCost: 5.5e9, - info: - "Upgrades the BLADE-51b Tesla Armor with a plasma energy propulsion system " + - "that is capable of projecting an energy shielding force field.", - prereqs: [AugmentationNames.BladeArmor], - defense_mult: 1.05, - bladeburner_success_chance_mult: 1.06, - isSpecial: true, - factions: [BladeburnersFactionName], - }), - new Augmentation({ - name: AugmentationNames.BladeArmorUnibeam, - repCost: 3.125e4, - moneyCost: 1.65e10, - info: - "Upgrades the BLADE-51b Tesla Armor with a concentrated deuterium-fluoride laser " + - "weapon. It's precision and accuracy makes it useful for quickly neutralizing " + - "threats while keeping casualties to a minimum.", - prereqs: [AugmentationNames.BladeArmor], - bladeburner_success_chance_mult: 1.08, - isSpecial: true, - factions: [BladeburnersFactionName], - }), - new Augmentation({ - name: AugmentationNames.BladeArmorOmnibeam, - repCost: 6.25e4, - moneyCost: 2.75e10, - info: - "Upgrades the BLADE-51b Tesla Armor Unibeam augmentation to use a " + - "multiple-fiber system. This upgraded weapon uses multiple fiber laser " + - "modules that combine together to form a single, more powerful beam of up to " + - "2000MW.", - prereqs: [AugmentationNames.BladeArmorUnibeam], - bladeburner_success_chance_mult: 1.1, - isSpecial: true, - factions: [BladeburnersFactionName], - }), - new Augmentation({ - name: AugmentationNames.BladeArmorIPU, - repCost: 1.5e4, - moneyCost: 1.1e9, - info: - "Upgrades the BLADE-51b Tesla Armor with an AI Information Processing " + - "Unit that was specially designed to analyze Synthoid related data and " + - "information.", - prereqs: [AugmentationNames.BladeArmor], - bladeburner_analysis_mult: 1.15, - bladeburner_success_chance_mult: 1.02, - isSpecial: true, - factions: [BladeburnersFactionName], - }), - new Augmentation({ - name: AugmentationNames.BladesSimulacrum, - repCost: 1.25e3, - moneyCost: 1.5e11, - info: - "A highly-advanced matter phase-shifter module that is embedded " + - "in the brainstem and cerebellum. This augmentation allows " + - "the user to project and control a holographic simulacrum within an " + - "extremely large radius. These specially-modified holograms were specifically " + - "weaponized by Bladeburner units to be used against Synthoids.", - stats: ( - <> - This augmentation allows you to perform Bladeburner actions and other actions (such as working, commiting - crimes, etc.) at the same time. - - ), - isSpecial: true, - factions: [BladeburnersFactionName], - }), - ); +function getBaseAugmentationPriceMultiplier(): number { + return CONSTANTS.MultipleAugMultiplier * [1, 0.96, 0.94, 0.93][SourceFileFlags[11]]; +} +export function getGenericAugmentationPriceMultiplier(): number { + return Math.pow(getBaseAugmentationPriceMultiplier(), Player.queuedAugmentations.length); +} + +function updateNeuroFluxGovernorCosts(neuroFluxGovernorAugmentation: Augmentation): void { + let nextLevel = getNextNeuroFluxLevel(); + --nextLevel; + const multiplier = Math.pow(CONSTANTS.NeuroFluxGovernorLevelMult, nextLevel); + neuroFluxGovernorAugmentation.baseRepRequirement *= multiplier * BitNodeMultipliers.AugmentationRepCost; + neuroFluxGovernorAugmentation.baseCost *= multiplier * BitNodeMultipliers.AugmentationMoneyCost; + + for (let i = 0; i < Player.queuedAugmentations.length - 1; ++i) { + neuroFluxGovernorAugmentation.baseCost *= getBaseAugmentationPriceMultiplier(); } +} - // Special CotMG Augmentations - const ChurchOfTheMachineGodFactionName = FactionNames.ChurchOfTheMachineGod; - if (factionExists(ChurchOfTheMachineGodFactionName)) { - augmentations.push( - new Augmentation({ - name: AugmentationNames.StaneksGift1, - repCost: 0, - moneyCost: 0, - info: - 'Allison "Mother" Stanek imparts you with her gift. An ' + - "experimental Augmentation implanted at the base of the neck. " + - "It allows you to overclock your entire system by carefully " + - "changing the configuration.", - isSpecial: true, - hacking_chance_mult: 0.9, - hacking_speed_mult: 0.9, - hacking_money_mult: 0.9, - hacking_grow_mult: 0.9, - hacking_mult: 0.9, - strength_mult: 0.9, - defense_mult: 0.9, - dexterity_mult: 0.9, - agility_mult: 0.9, - charisma_mult: 0.9, - hacking_exp_mult: 0.9, - strength_exp_mult: 0.9, - defense_exp_mult: 0.9, - dexterity_exp_mult: 0.9, - agility_exp_mult: 0.9, - charisma_exp_mult: 0.9, - company_rep_mult: 0.9, - faction_rep_mult: 0.9, - crime_money_mult: 0.9, - crime_success_mult: 0.9, - hacknet_node_money_mult: 0.9, - hacknet_node_purchase_cost_mult: 1.1, - hacknet_node_ram_cost_mult: 1.1, - hacknet_node_core_cost_mult: 1.1, - hacknet_node_level_cost_mult: 1.1, - work_money_mult: 0.9, - stats: <>Its unstable nature decreases all your stats by 10%, - factions: [ChurchOfTheMachineGodFactionName], - }), - new Augmentation({ - name: AugmentationNames.StaneksGift2, - repCost: 1e6, - moneyCost: 0, - info: - "The next evolution is near, a coming together of man and machine. A synthesis greater than the birth of the human " + - "organism. Time spent with the gift has allowed for acclimatization of the invasive augment and the toll it takes upon " + - "your frame granting lesser penalty of 5% to all stats.", - prereqs: [AugmentationNames.StaneksGift1], - isSpecial: true, - hacking_chance_mult: 0.95 / 0.9, - hacking_speed_mult: 0.95 / 0.9, - hacking_money_mult: 0.95 / 0.9, - hacking_grow_mult: 0.95 / 0.9, - hacking_mult: 0.95 / 0.9, - strength_mult: 0.95 / 0.9, - defense_mult: 0.95 / 0.9, - dexterity_mult: 0.95 / 0.9, - agility_mult: 0.95 / 0.9, - charisma_mult: 0.95 / 0.9, - hacking_exp_mult: 0.95 / 0.9, - strength_exp_mult: 0.95 / 0.9, - defense_exp_mult: 0.95 / 0.9, - dexterity_exp_mult: 0.95 / 0.9, - agility_exp_mult: 0.95 / 0.9, - charisma_exp_mult: 0.95 / 0.9, - company_rep_mult: 0.95 / 0.9, - faction_rep_mult: 0.95 / 0.9, - crime_money_mult: 0.95 / 0.9, - crime_success_mult: 0.95 / 0.9, - hacknet_node_money_mult: 0.95 / 0.9, - hacknet_node_purchase_cost_mult: 1.05 / 1.1, - hacknet_node_ram_cost_mult: 1.05 / 1.1, - hacknet_node_core_cost_mult: 1.05 / 1.1, - hacknet_node_level_cost_mult: 1.05 / 1.1, - work_money_mult: 0.95 / 0.9, - stats: <>The penalty for the gift is reduced to 5%, - factions: [ChurchOfTheMachineGodFactionName], - }), - new Augmentation({ - name: AugmentationNames.StaneksGift3, - repCost: 1e8, - moneyCost: 0, - info: - "The synthesis of human and machine is nothing to fear. It is our destiny. " + - "You will become greater than the sum of our parts. As One. Embrace your gift " + - "fully and wholly free of it's accursed toll. Serenity brings tranquility the form " + - "of no longer suffering a stat penalty. ", - prereqs: [AugmentationNames.StaneksGift2], - isSpecial: true, - hacking_chance_mult: 1 / 0.95, - hacking_speed_mult: 1 / 0.95, - hacking_money_mult: 1 / 0.95, - hacking_grow_mult: 1 / 0.95, - hacking_mult: 1 / 0.95, - strength_mult: 1 / 0.95, - defense_mult: 1 / 0.95, - dexterity_mult: 1 / 0.95, - agility_mult: 1 / 0.95, - charisma_mult: 1 / 0.95, - hacking_exp_mult: 1 / 0.95, - strength_exp_mult: 1 / 0.95, - defense_exp_mult: 1 / 0.95, - dexterity_exp_mult: 1 / 0.95, - agility_exp_mult: 1 / 0.95, - charisma_exp_mult: 1 / 0.95, - company_rep_mult: 1 / 0.95, - faction_rep_mult: 1 / 0.95, - crime_money_mult: 1 / 0.95, - crime_success_mult: 1 / 0.95, - hacknet_node_money_mult: 1 / 0.95, - hacknet_node_purchase_cost_mult: 1 / 1.05, - hacknet_node_ram_cost_mult: 1 / 1.05, - hacknet_node_core_cost_mult: 1 / 1.05, - hacknet_node_level_cost_mult: 1 / 1.05, - work_money_mult: 1 / 0.95, - stats: <>Staneks Gift has no penalty., - factions: [ChurchOfTheMachineGodFactionName], - }), - ); - } - - augmentations.map(resetAugmentation); - - // Update costs based on how many have been purchased - mult = Math.pow( - CONSTANTS.MultipleAugMultiplier * [1, 0.96, 0.94, 0.93][SourceFileFlags[11]], - Player.queuedAugmentations.length, - ); +export function updateAugmentationCosts(): void { for (const name of Object.keys(Augmentations)) { if (Augmentations.hasOwnProperty(name)) { - Augmentations[name].baseCost *= mult; + const augmentationToUpdate = Augmentations[name]; + if (augmentationToUpdate.name === AugmentationNames.NeuroFluxGovernor) { + updateNeuroFluxGovernorCosts(augmentationToUpdate); + } else { + augmentationToUpdate.baseCost *= getGenericAugmentationPriceMultiplier(); + } } } - - Player.reapplyAllAugmentations(); } //Resets an Augmentation during (re-initizliation) diff --git a/src/Augmentation/data/AugmentationNames.ts b/src/Augmentation/data/AugmentationNames.ts index 470615aa6..f0fe6a46f 100644 --- a/src/Augmentation/data/AugmentationNames.ts +++ b/src/Augmentation/data/AugmentationNames.ts @@ -1,234 +1,121 @@ -export const AugmentationNames: { - Targeting1: string; - Targeting2: string; - Targeting3: string; - SyntheticHeart: string; - SynfibrilMuscle: string; - CombatRib1: string; - CombatRib2: string; - CombatRib3: string; - NanofiberWeave: string; - SubdermalArmor: string; - WiredReflexes: string; - GrapheneBoneLacings: string; - BionicSpine: string; - GrapheneBionicSpine: string; - BionicLegs: string; - GrapheneBionicLegs: string; - SpeechProcessor: string; - TITN41Injection: string; - EnhancedSocialInteractionImplant: string; - BitWire: string; - ArtificialBioNeuralNetwork: string; - ArtificialSynapticPotentiation: string; - EnhancedMyelinSheathing: string; - SynapticEnhancement: string; - NeuralRetentionEnhancement: string; - DataJack: string; - ENM: string; - ENMCore: string; - ENMCoreV2: string; - ENMCoreV3: string; - ENMAnalyzeEngine: string; - ENMDMA: string; - Neuralstimulator: string; - NeuralAccelerator: string; - CranialSignalProcessorsG1: string; - CranialSignalProcessorsG2: string; - CranialSignalProcessorsG3: string; - CranialSignalProcessorsG4: string; - CranialSignalProcessorsG5: string; - NeuronalDensification: string; - NeuroreceptorManager: string; - NuoptimalInjectorImplant: string; - SpeechEnhancement: string; - FocusWire: string; - PCDNI: string; - PCDNIOptimizer: string; - PCDNINeuralNetwork: string; - PCMatrix: string; - ADRPheromone1: string; - ADRPheromone2: string; - ShadowsSimulacrum: string; - HacknetNodeCPUUpload: string; - HacknetNodeCacheUpload: string; - HacknetNodeNICUpload: string; - HacknetNodeKernelDNI: string; - HacknetNodeCoreDNI: string; - NeuroFluxGovernor: string; - Neurotrainer1: string; - Neurotrainer2: string; - Neurotrainer3: string; - Hypersight: string; - LuminCloaking1: string; - LuminCloaking2: string; - HemoRecirculator: string; - SmartSonar: string; - PowerRecirculator: string; - QLink: string; - TheRedPill: string; - SPTN97: string; - HiveMind: string; - CordiARCReactor: string; - SmartJaw: string; - Neotra: string; - Xanipher: string; - nextSENS: string; - OmniTekInfoLoad: string; - PhotosyntheticCells: string; - Neurolink: string; - TheBlackHand: string; - UnstableCircadianModulator: string; - CRTX42AA: string; - Neuregen: string; - CashRoot: string; - NutriGen: string; - INFRARet: string; - DermaForce: string; - GrapheneBrachiBlades: string; - GrapheneBionicArms: string; - BrachiBlades: string; - BionicArms: string; - SNA: string; - HydroflameLeftArm: string; - EsperEyewear: string; - EMS4Recombination: string; - OrionShoulder: string; - HyperionV1: string; - HyperionV2: string; - GolemSerum: string; - VangelisVirus: string; - VangelisVirus3: string; - INTERLINKED: string; - BladeRunner: string; - BladeArmor: string; - BladeArmorPowerCells: string; - BladeArmorEnergyShielding: string; - BladeArmorUnibeam: string; - BladeArmorOmnibeam: string; - BladeArmorIPU: string; - BladesSimulacrum: string; - StaneksGift1: string; - StaneksGift2: string; - StaneksGift3: string; -} = { - Targeting1: "Augmented Targeting I", - Targeting2: "Augmented Targeting II", - Targeting3: "Augmented Targeting III", - SyntheticHeart: "Synthetic Heart", - SynfibrilMuscle: "Synfibril Muscle", - CombatRib1: "Combat Rib I", - CombatRib2: "Combat Rib II", - CombatRib3: "Combat Rib III", - NanofiberWeave: "Nanofiber Weave", - SubdermalArmor: "NEMEAN Subdermal Weave", - WiredReflexes: "Wired Reflexes", - GrapheneBoneLacings: "Graphene Bone Lacings", - BionicSpine: "Bionic Spine", - GrapheneBionicSpine: "Graphene Bionic Spine Upgrade", - BionicLegs: "Bionic Legs", - GrapheneBionicLegs: "Graphene Bionic Legs Upgrade", - SpeechProcessor: "Speech Processor Implant", - TITN41Injection: "TITN-41 Gene-Modification Injection", - EnhancedSocialInteractionImplant: "Enhanced Social Interaction Implant", - BitWire: "BitWire", - ArtificialBioNeuralNetwork: "Artificial Bio-neural Network Implant", - ArtificialSynapticPotentiation: "Artificial Synaptic Potentiation", - EnhancedMyelinSheathing: "Enhanced Myelin Sheathing", - SynapticEnhancement: "Synaptic Enhancement Implant", - NeuralRetentionEnhancement: "Neural-Retention Enhancement", - DataJack: "DataJack", - ENM: "Embedded Netburner Module", - ENMCore: "Embedded Netburner Module Core Implant", - ENMCoreV2: "Embedded Netburner Module Core V2 Upgrade", - ENMCoreV3: "Embedded Netburner Module Core V3 Upgrade", - ENMAnalyzeEngine: "Embedded Netburner Module Analyze Engine", - ENMDMA: "Embedded Netburner Module Direct Memory Access Upgrade", - Neuralstimulator: "Neuralstimulator", - NeuralAccelerator: "Neural Accelerator", - CranialSignalProcessorsG1: "Cranial Signal Processors - Gen I", - CranialSignalProcessorsG2: "Cranial Signal Processors - Gen II", - CranialSignalProcessorsG3: "Cranial Signal Processors - Gen III", - CranialSignalProcessorsG4: "Cranial Signal Processors - Gen IV", - CranialSignalProcessorsG5: "Cranial Signal Processors - Gen V", - NeuronalDensification: "Neuronal Densification", - NeuroreceptorManager: "Neuroreceptor Management Implant", - NuoptimalInjectorImplant: "Nuoptimal Nootropic Injector Implant", - SpeechEnhancement: "Speech Enhancement", - FocusWire: "FocusWire", - PCDNI: "PC Direct-Neural Interface", - PCDNIOptimizer: "PC Direct-Neural Interface Optimization Submodule", - PCDNINeuralNetwork: "PC Direct-Neural Interface NeuroNet Injector", - PCMatrix: "PCMatrix", - ADRPheromone1: "ADR-V1 Pheromone Gene", - ADRPheromone2: "ADR-V2 Pheromone Gene", - ShadowsSimulacrum: "The Shadow's Simulacrum", - HacknetNodeCPUUpload: "Hacknet Node CPU Architecture Neural-Upload", - HacknetNodeCacheUpload: "Hacknet Node Cache Architecture Neural-Upload", - HacknetNodeNICUpload: "Hacknet Node NIC Architecture Neural-Upload", - HacknetNodeKernelDNI: "Hacknet Node Kernel Direct-Neural Interface", - HacknetNodeCoreDNI: "Hacknet Node Core Direct-Neural Interface", - NeuroFluxGovernor: "NeuroFlux Governor", - Neurotrainer1: "Neurotrainer I", - Neurotrainer2: "Neurotrainer II", - Neurotrainer3: "Neurotrainer III", - Hypersight: "HyperSight Corneal Implant", - LuminCloaking1: "LuminCloaking-V1 Skin Implant", - LuminCloaking2: "LuminCloaking-V2 Skin Implant", - HemoRecirculator: "HemoRecirculator", - SmartSonar: "SmartSonar Implant", - PowerRecirculator: "Power Recirculation Core", - QLink: "QLink", - TheRedPill: "The Red Pill", - SPTN97: "SPTN-97 Gene Modification", - HiveMind: "ECorp HVMind Implant", - CordiARCReactor: "CordiARC Fusion Reactor", - SmartJaw: "SmartJaw", - Neotra: "Neotra", - Xanipher: "Xanipher", - nextSENS: "nextSENS Gene Modification", - OmniTekInfoLoad: "OmniTek InfoLoad", - PhotosyntheticCells: "Photosynthetic Cells", - Neurolink: "BitRunners Neurolink", - TheBlackHand: "The Black Hand", - UnstableCircadianModulator: "Unstable Circadian Modulator", - CRTX42AA: "CRTX42-AA Gene Modification", - Neuregen: "Neuregen Gene Modification", - CashRoot: "CashRoot Starter Kit", - NutriGen: "NutriGen Implant", - INFRARet: "INFRARET Enhancement", - DermaForce: "DermaForce Particle Barrier", - GrapheneBrachiBlades: "Graphene BrachiBlades Upgrade", - GrapheneBionicArms: "Graphene Bionic Arms Upgrade", - BrachiBlades: "BrachiBlades", - BionicArms: "Bionic Arms", - SNA: "Social Negotiation Assistant (S.N.A)", - HydroflameLeftArm: "Hydroflame Left Arm", - EsperEyewear: "EsperTech Bladeburner Eyewear", - EMS4Recombination: "EMS-4 Recombination", - OrionShoulder: "ORION-MKIV Shoulder", - HyperionV1: "Hyperion Plasma Cannon V1", - HyperionV2: "Hyperion Plasma Cannon V2", - GolemSerum: "GOLEM Serum", - VangelisVirus: "Vangelis Virus", - VangelisVirus3: "Vangelis Virus 3.0", - INTERLINKED: "I.N.T.E.R.L.I.N.K.E.D", - BladeRunner: "Blade's Runners", - BladeArmor: "BLADE-51b Tesla Armor", - BladeArmorPowerCells: "BLADE-51b Tesla Armor: Power Cells Upgrade", - BladeArmorEnergyShielding: "BLADE-51b Tesla Armor: Energy Shielding Upgrade", - BladeArmorUnibeam: "BLADE-51b Tesla Armor: Unibeam Upgrade", - BladeArmorOmnibeam: "BLADE-51b Tesla Armor: Omnibeam Upgrade", - BladeArmorIPU: "BLADE-51b Tesla Armor: IPU Upgrade", - BladesSimulacrum: "The Blade's Simulacrum", +export enum AugmentationNames { + Targeting1 = "Augmented Targeting I", + Targeting2 = "Augmented Targeting II", + Targeting3 = "Augmented Targeting III", + SyntheticHeart = "Synthetic Heart", + SynfibrilMuscle = "Synfibril Muscle", + CombatRib1 = "Combat Rib I", + CombatRib2 = "Combat Rib II", + CombatRib3 = "Combat Rib III", + NanofiberWeave = "Nanofiber Weave", + SubdermalArmor = "NEMEAN Subdermal Weave", + WiredReflexes = "Wired Reflexes", + GrapheneBoneLacings = "Graphene Bone Lacings", + BionicSpine = "Bionic Spine", + GrapheneBionicSpine = "Graphene Bionic Spine Upgrade", + BionicLegs = "Bionic Legs", + GrapheneBionicLegs = "Graphene Bionic Legs Upgrade", + SpeechProcessor = "Speech Processor Implant", + TITN41Injection = "TITN-41 Gene-Modification Injection", + EnhancedSocialInteractionImplant = "Enhanced Social Interaction Implant", + BitWire = "BitWire", + ArtificialBioNeuralNetwork = "Artificial Bio-neural Network Implant", + ArtificialSynapticPotentiation = "Artificial Synaptic Potentiation", + EnhancedMyelinSheathing = "Enhanced Myelin Sheathing", + SynapticEnhancement = "Synaptic Enhancement Implant", + NeuralRetentionEnhancement = "Neural-Retention Enhancement", + DataJack = "DataJack", + ENM = "Embedded Netburner Module", + ENMCore = "Embedded Netburner Module Core Implant", + ENMCoreV2 = "Embedded Netburner Module Core V2 Upgrade", + ENMCoreV3 = "Embedded Netburner Module Core V3 Upgrade", + ENMAnalyzeEngine = "Embedded Netburner Module Analyze Engine", + ENMDMA = "Embedded Netburner Module Direct Memory Access Upgrade", + Neuralstimulator = "Neuralstimulator", + NeuralAccelerator = "Neural Accelerator", + CranialSignalProcessorsG1 = "Cranial Signal Processors - Gen I", + CranialSignalProcessorsG2 = "Cranial Signal Processors - Gen II", + CranialSignalProcessorsG3 = "Cranial Signal Processors - Gen III", + CranialSignalProcessorsG4 = "Cranial Signal Processors - Gen IV", + CranialSignalProcessorsG5 = "Cranial Signal Processors - Gen V", + NeuronalDensification = "Neuronal Densification", + NeuroreceptorManager = "Neuroreceptor Management Implant", + NuoptimalInjectorImplant = "Nuoptimal Nootropic Injector Implant", + SpeechEnhancement = "Speech Enhancement", + FocusWire = "FocusWire", + PCDNI = "PC Direct-Neural Interface", + PCDNIOptimizer = "PC Direct-Neural Interface Optimization Submodule", + PCDNINeuralNetwork = "PC Direct-Neural Interface NeuroNet Injector", + PCMatrix = "PCMatrix", + ADRPheromone1 = "ADR-V1 Pheromone Gene", + ADRPheromone2 = "ADR-V2 Pheromone Gene", + ShadowsSimulacrum = "The Shadow's Simulacrum", + HacknetNodeCPUUpload = "Hacknet Node CPU Architecture Neural-Upload", + HacknetNodeCacheUpload = "Hacknet Node Cache Architecture Neural-Upload", + HacknetNodeNICUpload = "Hacknet Node NIC Architecture Neural-Upload", + HacknetNodeKernelDNI = "Hacknet Node Kernel Direct-Neural Interface", + HacknetNodeCoreDNI = "Hacknet Node Core Direct-Neural Interface", + NeuroFluxGovernor = "NeuroFlux Governor", + Neurotrainer1 = "Neurotrainer I", + Neurotrainer2 = "Neurotrainer II", + Neurotrainer3 = "Neurotrainer III", + Hypersight = "HyperSight Corneal Implant", + LuminCloaking1 = "LuminCloaking-V1 Skin Implant", + LuminCloaking2 = "LuminCloaking-V2 Skin Implant", + HemoRecirculator = "HemoRecirculator", + SmartSonar = "SmartSonar Implant", + PowerRecirculator = "Power Recirculation Core", + QLink = "QLink", + TheRedPill = "The Red Pill", + SPTN97 = "SPTN-97 Gene Modification", + HiveMind = "ECorp HVMind Implant", + CordiARCReactor = "CordiARC Fusion Reactor", + SmartJaw = "SmartJaw", + Neotra = "Neotra", + Xanipher = "Xanipher", + nextSENS = "nextSENS Gene Modification", + OmniTekInfoLoad = "OmniTek InfoLoad", + PhotosyntheticCells = "Photosynthetic Cells", + Neurolink = "BitRunners Neurolink", + TheBlackHand = "The Black Hand", + UnstableCircadianModulator = "Unstable Circadian Modulator", + CRTX42AA = "CRTX42-AA Gene Modification", + Neuregen = "Neuregen Gene Modification", + CashRoot = "CashRoot Starter Kit", + NutriGen = "NutriGen Implant", + INFRARet = "INFRARET Enhancement", + DermaForce = "DermaForce Particle Barrier", + GrapheneBrachiBlades = "Graphene BrachiBlades Upgrade", + GrapheneBionicArms = "Graphene Bionic Arms Upgrade", + BrachiBlades = "BrachiBlades", + BionicArms = "Bionic Arms", + SNA = "Social Negotiation Assistant (S.N.A)", + HydroflameLeftArm = "Hydroflame Left Arm", + EsperEyewear = "EsperTech Bladeburner Eyewear", + EMS4Recombination = "EMS-4 Recombination", + OrionShoulder = "ORION-MKIV Shoulder", + HyperionV1 = "Hyperion Plasma Cannon V1", + HyperionV2 = "Hyperion Plasma Cannon V2", + GolemSerum = "GOLEM Serum", + VangelisVirus = "Vangelis Virus", + VangelisVirus3 = "Vangelis Virus 3.0", + INTERLINKED = "I.N.T.E.R.L.I.N.K.E.D", + BladeRunner = "Blade's Runners", + BladeArmor = "BLADE-51b Tesla Armor", + BladeArmorPowerCells = "BLADE-51b Tesla Armor: Power Cells Upgrade", + BladeArmorEnergyShielding = "BLADE-51b Tesla Armor: Energy Shielding Upgrade", + BladeArmorUnibeam = "BLADE-51b Tesla Armor: Unibeam Upgrade", + BladeArmorOmnibeam = "BLADE-51b Tesla Armor: Omnibeam Upgrade", + BladeArmorIPU = "BLADE-51b Tesla Armor: IPU Upgrade", + BladesSimulacrum = "The Blade's Simulacrum", - StaneksGift1: "Stanek's Gift - Genesis", - StaneksGift2: "Stanek's Gift - Awakening", - StaneksGift3: "Stanek's Gift - Serenity", + StaneksGift1 = "Stanek's Gift - Genesis", + StaneksGift2 = "Stanek's Gift - Awakening", + StaneksGift3 = "Stanek's Gift - Serenity", //Wasteland Augs //PepBoy: "P.E.P-Boy", Plasma Energy Projection System //PepBoyForceField Generates plasma force fields //PepBoyBlasts Generate high density plasma concussive blasts //PepBoyDataStorage STore more data on pep boy, -}; +} diff --git a/src/Faction/ui/AugmentationsPage.tsx b/src/Faction/ui/AugmentationsPage.tsx index 1d519b124..c0cf4c310 100644 --- a/src/Faction/ui/AugmentationsPage.tsx +++ b/src/Faction/ui/AugmentationsPage.tsx @@ -23,7 +23,7 @@ import Typography from "@mui/material/Typography"; import Tooltip from "@mui/material/Tooltip"; import TableBody from "@mui/material/TableBody"; import Table from "@mui/material/Table"; -import { CONSTANTS } from "../../Constants"; +import { getGenericAugmentationPriceMultiplier } from "../../Augmentation/AugmentationHelpers"; type IProps = { faction: Faction; @@ -180,10 +180,7 @@ export function AugmentationsPage(props: IProps): React.ReactElement { ); } - const mult = Math.pow( - CONSTANTS.MultipleAugMultiplier * [1, 0.96, 0.94, 0.93][player.sourceFileLvl(11)], - player.queuedAugmentations.length, - ); + return ( <> @@ -204,7 +201,9 @@ export function AugmentationsPage(props: IProps): React.ReactElement { } > - Price multiplier: x {numeralWrapper.formatMultiplier(mult)} + + Price multiplier: x {numeralWrapper.formatMultiplier(getGenericAugmentationPriceMultiplier())} + diff --git a/src/PersonObjects/Resleeving/Resleeving.ts b/src/PersonObjects/Resleeving/Resleeving.ts index 2d3f2daa6..cc17c56c2 100644 --- a/src/PersonObjects/Resleeving/Resleeving.ts +++ b/src/PersonObjects/Resleeving/Resleeving.ts @@ -111,7 +111,7 @@ export function generateResleeves(): Resleeve[] { AugmentationNames.StaneksGift1, AugmentationNames.StaneksGift2, AugmentationNames.StaneksGift3, - ]; + ].map((augmentation) => augmentation as string); if (forbidden.includes(randKey)) { continue; } From c681828ec1497dad3d10da70ccc3701a70130485 Mon Sep 17 00:00:00 2001 From: phyzical Date: Thu, 24 Mar 2022 23:09:24 +0800 Subject: [PATCH 02/12] few more event key. constant refactors --- src/Bladeburner/Bladeburner.tsx | 7 ++-- src/Bladeburner/ui/Console.tsx | 26 ++++++------ src/Infiltration/ui/BackwardGame.tsx | 3 +- src/Infiltration/ui/BracketGame.tsx | 20 ++++----- src/Infiltration/ui/BribeGame.tsx | 12 +++--- src/Infiltration/ui/CheatCodeGame.tsx | 4 +- src/Infiltration/ui/Cyberpunk2077Game.tsx | 13 +++--- src/Infiltration/ui/MinesweeperGame.tsx | 13 +++--- src/Infiltration/ui/SlashGame.tsx | 3 +- src/Infiltration/ui/WireCuttingGame.tsx | 9 ++++- src/Infiltration/utils.ts | 49 +++++++++++++++++------ src/Sidebar/ui/SidebarRoot.tsx | 10 +++-- src/Terminal/Parser.ts | 35 ++++++++-------- src/Terminal/ui/TerminalInput.tsx | 12 +++--- src/utils/helpers/keyCodes.ts | 27 +++++++++++-- 15 files changed, 153 insertions(+), 90 deletions(-) diff --git a/src/Bladeburner/Bladeburner.tsx b/src/Bladeburner/Bladeburner.tsx index e94934d1f..cd1d832de 100644 --- a/src/Bladeburner/Bladeburner.tsx +++ b/src/Bladeburner/Bladeburner.tsx @@ -35,6 +35,7 @@ import { joinFaction } from "../Faction/FactionHelpers"; import { WorkerScript } from "../Netscript/WorkerScript"; import { FactionNames } from "../Faction/data/FactionNames"; import { BlackOperationNames } from "./data/BlackOperationNames"; +import { KEY } from "../utils/helpers/keyCodes"; interface BlackOpsAttempt { error?: string; @@ -793,7 +794,7 @@ export class Bladeburner implements IBladeburner { if (c === '"') { // Double quotes const endQuote = command.indexOf('"', i + 1); - if (endQuote !== -1 && (endQuote === command.length - 1 || command.charAt(endQuote + 1) === " ")) { + if (endQuote !== -1 && (endQuote === command.length - 1 || command.charAt(endQuote + 1) === KEY.SPACE)) { args.push(command.substr(i + 1, endQuote - i - 1)); if (endQuote === command.length - 1) { start = i = endQuote + 1; @@ -805,7 +806,7 @@ export class Bladeburner implements IBladeburner { } else if (c === "'") { // Single quotes, same thing as above const endQuote = command.indexOf("'", i + 1); - if (endQuote !== -1 && (endQuote === command.length - 1 || command.charAt(endQuote + 1) === " ")) { + if (endQuote !== -1 && (endQuote === command.length - 1 || command.charAt(endQuote + 1) === KEY.SPACE)) { args.push(command.substr(i + 1, endQuote - i - 1)); if (endQuote === command.length - 1) { start = i = endQuote + 1; @@ -814,7 +815,7 @@ export class Bladeburner implements IBladeburner { } continue; } - } else if (c === " ") { + } else if (c === KEY.SPACE) { args.push(command.substr(start, i - start)); start = i + 1; } diff --git a/src/Bladeburner/ui/Console.tsx b/src/Bladeburner/ui/Console.tsx index 1a839a15e..c0600a4e3 100644 --- a/src/Bladeburner/ui/Console.tsx +++ b/src/Bladeburner/ui/Console.tsx @@ -89,7 +89,7 @@ export function Console(props: IProps): React.ReactElement { const consoleHistory = props.bladeburner.consoleHistory; - if (event.key === KEY.UPARROW) { + if (event.key === KEY.UP_ARROW) { // up let i = consoleHistoryIndex; const len = consoleHistory.length; @@ -109,7 +109,7 @@ export function Console(props: IProps): React.ReactElement { setCommand(prevCommand); } - if (event.key === KEY.DOWNARROW) { + if (event.key === KEY.DOWN_ARROW) { const i = consoleHistoryIndex; const len = consoleHistory.length; @@ -140,14 +140,16 @@ export function Console(props: IProps): React.ReactElement { return ( - + @@ -195,9 +197,7 @@ function Logs({ entries }: ILogProps): React.ReactElement { return ( - {entries && entries.map((log: any, i: number) => ( - - ))} + {entries && entries.map((log: any, i: number) => )} ); } diff --git a/src/Infiltration/ui/BackwardGame.tsx b/src/Infiltration/ui/BackwardGame.tsx index 6202aefcb..7cd7ed724 100644 --- a/src/Infiltration/ui/BackwardGame.tsx +++ b/src/Infiltration/ui/BackwardGame.tsx @@ -7,6 +7,7 @@ import { random } from "../utils"; import { interpolate } from "./Difficulty"; import { BlinkingCursor } from "./BlinkingCursor"; import Typography from "@mui/material/Typography"; +import { KEY } from "../../utils/helpers/keyCodes"; interface Difficulty { [key: string]: number; @@ -36,7 +37,7 @@ export function BackwardGame(props: IMinigameProps): React.ReactElement { function press(this: Document, event: KeyboardEvent): void { event.preventDefault(); - if (event.key === "Backspace") return; + if (event.key === KEY.BACKSPACE) return; const nextGuess = guess + event.key.toUpperCase(); if (!answer.startsWith(nextGuess)) props.onFailure(); else if (answer === nextGuess) props.onSuccess(); diff --git a/src/Infiltration/ui/BracketGame.tsx b/src/Infiltration/ui/BracketGame.tsx index 9bad60379..6c1aee432 100644 --- a/src/Infiltration/ui/BracketGame.tsx +++ b/src/Infiltration/ui/BracketGame.tsx @@ -7,6 +7,7 @@ import { random } from "../utils"; import { interpolate } from "./Difficulty"; import { BlinkingCursor } from "./BlinkingCursor"; import Typography from "@mui/material/Typography"; +import { KEY } from "../../utils/helpers/keyCodes"; interface Difficulty { [key: string]: number; @@ -29,28 +30,29 @@ const difficulties: { function generateLeftSide(difficulty: Difficulty): string { let str = ""; + const options = [KEY.OPEN_BRACKET, KEY.LESS_THAN, KEY.OPEN_PARENTHESIS, KEY.OPEN_BRACE]; const length = random(difficulty.min, difficulty.max); for (let i = 0; i < length; i++) { - str += ["[", "<", "(", "{"][Math.floor(Math.random() * 4)]; + str += options[Math.floor(Math.random() * 4)]; } return str; } function getChar(event: KeyboardEvent): string { - if (event.key === ")") return ")"; - if (event.key === "]") return "]"; - if (event.key === "}") return "}"; - if (event.key === ">") return ">"; + if (event.key === KEY.CLOSE_PARENTHESIS) return KEY.CLOSE_PARENTHESIS; + if (event.key === KEY.CLOSE_BRACKET) return KEY.CLOSE_BRACKET; + if (event.key === KEY.CLOSE_BRACE) return KEY.CLOSE_BRACE; + if (event.key === KEY.GREATER_THAN) return KEY.GREATER_THAN; return ""; } function match(left: string, right: string): boolean { return ( - (left === "[" && right === "]") || - (left === "<" && right === ">") || - (left === "(" && right === ")") || - (left === "{" && right === "}") + (left === KEY.OPEN_BRACKET && right === KEY.CLOSE_BRACKET) || + (left === KEY.LESS_THAN && right === KEY.GREATER_THAN) || + (left === KEY.OPEN_PARENTHESIS && right === KEY.CLOSE_PARENTHESIS) || + (left === KEY.OPEN_BRACE && right === KEY.CLOSE_BRACE) ); } diff --git a/src/Infiltration/ui/BribeGame.tsx b/src/Infiltration/ui/BribeGame.tsx index e5fa424df..f7ff526a8 100644 --- a/src/Infiltration/ui/BribeGame.tsx +++ b/src/Infiltration/ui/BribeGame.tsx @@ -5,6 +5,8 @@ import { KeyHandler } from "./KeyHandler"; import { GameTimer } from "./GameTimer"; import { interpolate } from "./Difficulty"; import Typography from "@mui/material/Typography"; +import { KEY } from "../../utils/helpers/keyCodes"; +import { downArrowSymbol, upArrowSymbol } from "../utils"; interface Difficulty { [key: string]: number; @@ -34,15 +36,15 @@ export function BribeGame(props: IMinigameProps): React.ReactElement { function press(this: Document, event: KeyboardEvent): void { event.preventDefault(); const k = event.key; - if (k === " ") { + if (k === KEY.SPACE) { if (positive.includes(choices[index])) props.onSuccess(); else props.onFailure(); return; } let newIndex = index; - if (["ArrowUp", "w", "ArrowRight", "d"].includes(k)) newIndex++; - if (["ArrowDown", "s", "ArrowLeft", "a"].includes(k)) newIndex--; + if ([KEY.UP_ARROW, KEY.W, KEY.RIGHT_ARROW, KEY.D].map((key) => key as string).includes(k)) newIndex++; + if ([KEY.DOWN_ARROW, KEY.S, KEY.LEFT_ARROW, KEY.A].map((key) => key as string).includes(k)) newIndex--; while (newIndex < 0) newIndex += choices.length; while (newIndex > choices.length - 1) newIndex -= choices.length; setIndex(newIndex); @@ -57,13 +59,13 @@ export function BribeGame(props: IMinigameProps): React.ReactElement { - ↑ + {upArrowSymbol} {choices[index]} - ↓ + {downArrowSymbol} diff --git a/src/Infiltration/ui/CheatCodeGame.tsx b/src/Infiltration/ui/CheatCodeGame.tsx index 68fd61329..38cb80e6a 100644 --- a/src/Infiltration/ui/CheatCodeGame.tsx +++ b/src/Infiltration/ui/CheatCodeGame.tsx @@ -3,7 +3,7 @@ import Grid from "@mui/material/Grid"; import { IMinigameProps } from "./IMinigameProps"; import { KeyHandler } from "./KeyHandler"; import { GameTimer } from "./GameTimer"; -import { random, getArrow } from "../utils"; +import { random, getArrow, rightArrowSymbol, leftArrowSymbol, upArrowSymbol, downArrowSymbol } from "../utils"; import { interpolate } from "./Difficulty"; import Typography from "@mui/material/Typography"; @@ -56,7 +56,7 @@ export function CheatCodeGame(props: IMinigameProps): React.ReactElement { } function generateCode(difficulty: Difficulty): string { - const arrows = ["←", "→", "↑", "↓"]; + const arrows = [leftArrowSymbol, rightArrowSymbol, upArrowSymbol, downArrowSymbol]; let code = ""; for (let i = 0; i < random(difficulty.min, difficulty.max); i++) { let arrow = arrows[Math.floor(4 * Math.random())]; diff --git a/src/Infiltration/ui/Cyberpunk2077Game.tsx b/src/Infiltration/ui/Cyberpunk2077Game.tsx index d0c8736b6..ab63eccac 100644 --- a/src/Infiltration/ui/Cyberpunk2077Game.tsx +++ b/src/Infiltration/ui/Cyberpunk2077Game.tsx @@ -4,8 +4,9 @@ import { IMinigameProps } from "./IMinigameProps"; import { KeyHandler } from "./KeyHandler"; import { GameTimer } from "./GameTimer"; import { interpolate } from "./Difficulty"; -import { getArrow } from "../utils"; +import { downArrowSymbol, getArrow, leftArrowSymbol, rightArrowSymbol, upArrowSymbol } from "../utils"; import Typography from "@mui/material/Typography"; +import { KEY } from "../../utils/helpers/keyCodes"; interface Difficulty { [key: string]: number; @@ -41,16 +42,16 @@ export function Cyberpunk2077Game(props: IMinigameProps): React.ReactElement { const move = [0, 0]; const arrow = getArrow(event); switch (arrow) { - case "↑": + case upArrowSymbol: move[1]--; break; - case "←": + case leftArrowSymbol: move[0]--; break; - case "↓": + case downArrowSymbol: move[1]++; break; - case "→": + case rightArrowSymbol: move[0]++; break; } @@ -59,7 +60,7 @@ export function Cyberpunk2077Game(props: IMinigameProps): React.ReactElement { next[1] = (next[1] + grid.length) % grid.length; setPos(next); - if (event.key === " ") { + if (event.key === KEY.SPACE) { const selected = grid[pos[1]][pos[0]]; const expected = answer[index]; if (selected !== expected) { diff --git a/src/Infiltration/ui/MinesweeperGame.tsx b/src/Infiltration/ui/MinesweeperGame.tsx index 532c654ee..fd6c78f9e 100644 --- a/src/Infiltration/ui/MinesweeperGame.tsx +++ b/src/Infiltration/ui/MinesweeperGame.tsx @@ -4,8 +4,9 @@ import { IMinigameProps } from "./IMinigameProps"; import { KeyHandler } from "./KeyHandler"; import { GameTimer } from "./GameTimer"; import { interpolate } from "./Difficulty"; -import { getArrow } from "../utils"; +import { downArrowSymbol, getArrow, leftArrowSymbol, rightArrowSymbol, upArrowSymbol } from "../utils"; import Typography from "@mui/material/Typography"; +import { KEY } from "../../utils/helpers/keyCodes"; interface Difficulty { [key: string]: number; @@ -42,16 +43,16 @@ export function MinesweeperGame(props: IMinigameProps): React.ReactElement { const move = [0, 0]; const arrow = getArrow(event); switch (arrow) { - case "↑": + case upArrowSymbol: move[1]--; break; - case "←": + case leftArrowSymbol: move[0]--; break; - case "↓": + case downArrowSymbol: move[1]++; break; - case "→": + case rightArrowSymbol: move[0]++; break; } @@ -60,7 +61,7 @@ export function MinesweeperGame(props: IMinigameProps): React.ReactElement { next[1] = (next[1] + minefield.length) % minefield.length; setPos(next); - if (event.key == " ") { + if (event.key == KEY.SPACE) { if (!minefield[pos[1]][pos[0]]) { props.onFailure(); return; diff --git a/src/Infiltration/ui/SlashGame.tsx b/src/Infiltration/ui/SlashGame.tsx index 5aa633f78..2926052ef 100644 --- a/src/Infiltration/ui/SlashGame.tsx +++ b/src/Infiltration/ui/SlashGame.tsx @@ -5,6 +5,7 @@ import { KeyHandler } from "./KeyHandler"; import { GameTimer } from "./GameTimer"; import { interpolate } from "./Difficulty"; import Typography from "@mui/material/Typography"; +import { KEY } from "../../utils/helpers/keyCodes"; interface Difficulty { [key: string]: number; @@ -30,7 +31,7 @@ export function SlashGame(props: IMinigameProps): React.ReactElement { function press(this: Document, event: KeyboardEvent): void { event.preventDefault(); - if (event.key !== " ") return; + if (event.key !== KEY.SPACE) return; if (phase !== 2) { props.onFailure(); } else { diff --git a/src/Infiltration/ui/WireCuttingGame.tsx b/src/Infiltration/ui/WireCuttingGame.tsx index 875f42641..efd1c2eb8 100644 --- a/src/Infiltration/ui/WireCuttingGame.tsx +++ b/src/Infiltration/ui/WireCuttingGame.tsx @@ -6,6 +6,7 @@ import { KeyHandler } from "./KeyHandler"; import { GameTimer } from "./GameTimer"; import { random } from "../utils"; import { interpolate } from "./Difficulty"; +import { KEY } from "../../utils/helpers/keyCodes"; interface Difficulty { [key: string]: number; @@ -27,7 +28,7 @@ const difficulties: { Impossible: { timer: 4000, wiresmin: 9, wiresmax: 9, rules: 4 }, }; -const types = ["|", ".", "/", "-", "█", "#"]; +const types = [KEY.PIPE, KEY.DOT, KEY.FORWARD_SLASH, KEY.HYPHEN, "█", KEY.HASH]; const colors = ["red", "#FFC107", "blue", "white"]; @@ -61,6 +62,10 @@ export function WireCuttingGame(props: IMinigameProps): React.ReactElement { const [cutWires, setCutWires] = useState(new Array(wires.length).fill(false)); const [questions] = useState(generateQuestion(wires, difficulty)); + function checkWire(wireNum: number): boolean { + return questions.some((q) => q.shouldCut(wires[wireNum - 1], wireNum - 1)); + } + function press(this: Document, event: KeyboardEvent): void { event.preventDefault(); const wireNum = parseInt(event.key); @@ -69,7 +74,7 @@ export function WireCuttingGame(props: IMinigameProps): React.ReactElement { setCutWires((old) => { const next = [...old]; next[wireNum - 1] = true; - if (!questions.some((q) => q.shouldCut(wires[wireNum - 1], wireNum - 1))) { + if (checkWire(wireNum)) { props.onFailure(); } diff --git a/src/Infiltration/utils.ts b/src/Infiltration/utils.ts index cdbce68d9..d338423d5 100644 --- a/src/Infiltration/utils.ts +++ b/src/Infiltration/utils.ts @@ -1,21 +1,46 @@ +import { KEY } from "../utils/helpers/keyCodes"; + export function random(min: number, max: number): number { return Math.random() * (max - min) + min; } +export const upArrowSymbol = "↑"; +export const downArrowSymbol = "↑"; +export const leftArrowSymbol = "↑"; +export const rightArrowSymbol = "↑"; + export function getArrow(event: KeyboardEvent): string { switch (event.key) { - case "ArrowUp": - case "w": - return "↑"; - case "ArrowLeft": - case "a": - return "←"; - case "ArrowDown": - case "s": - return "↓"; - case "ArrowRight": - case "d": - return "→"; + case KEY.UP_ARROW: + case KEY.W: + return upArrowSymbol; + case KEY.LEFT_ARROW: + case KEY.A: + return leftArrowSymbol; + case KEY.DOWN_ARROW: + case KEY.S: + return downArrowSymbol; + case KEY.RIGHT_ARROW: + case KEY.D: + return rightArrowSymbol; + } + return ""; +} + +export function getInverseArrow(event: KeyboardEvent): string { + switch (event.key) { + case KEY.DOWN_ARROW: + case KEY.S: + return upArrowSymbol; + case KEY.RIGHT_ARROW: + case KEY.D: + return leftArrowSymbol; + case KEY.UP_ARROW: + case KEY.W: + return downArrowSymbol; + case KEY.LEFT_ARROW: + case KEY.A: + return rightArrowSymbol; } return ""; } diff --git a/src/Sidebar/ui/SidebarRoot.tsx b/src/Sidebar/ui/SidebarRoot.tsx index 81f724304..c13b7e81e 100644 --- a/src/Sidebar/ui/SidebarRoot.tsx +++ b/src/Sidebar/ui/SidebarRoot.tsx @@ -276,7 +276,7 @@ export function SidebarRoot(props: IProps): React.ReactElement { function handleShortcuts(this: Document, event: KeyboardEvent): any { if (Settings.DisableHotkeys) return; if ((props.player.isWorking && props.player.focus) || redPillFlag) return; - if (event.key === "t" && event.altKey) { + if (event.key === KEY.T && event.altKey) { event.preventDefault(); clickTerminal(); } else if (event.key === KEY.C && event.altKey) { @@ -522,7 +522,9 @@ export function SidebarRoot(props: IProps): React.ReactElement { - + @@ -570,7 +572,9 @@ export function SidebarRoot(props: IProps): React.ReactElement { > - + diff --git a/src/Terminal/Parser.ts b/src/Terminal/Parser.ts index 80c3654b4..fc38c1ba3 100644 --- a/src/Terminal/Parser.ts +++ b/src/Terminal/Parser.ts @@ -1,3 +1,4 @@ +import { KEY } from "../utils/helpers/keyCodes"; import { substituteAliases } from "../Alias"; // Helper function that checks if an argument (which is a string) is a valid number function isNumber(str: string): boolean { @@ -55,11 +56,11 @@ export function ParseCommand(command: string): (string | number | boolean)[] { } const c = command.charAt(i); - if (c === '"') { + if (c === KEY.DOUBLE_QUOTE) { // Double quotes - if (!escaped && prevChar === " ") { - const endQuote = command.indexOf('"', i + 1); - if (endQuote !== -1 && (endQuote === command.length - 1 || command.charAt(endQuote + 1) === " ")) { + if (!escaped && prevChar === KEY.SPACE) { + const endQuote = command.indexOf(KEY.DOUBLE_QUOTE, i + 1); + if (endQuote !== -1 && (endQuote === command.length - 1 || command.charAt(endQuote + 1) === KEY.SPACE)) { args.push(command.substr(i + 1, endQuote - i - 1)); if (endQuote === command.length - 1) { start = i = endQuote + 1; @@ -69,15 +70,15 @@ export function ParseCommand(command: string): (string | number | boolean)[] { continue; } } else if (inQuote === ``) { - inQuote = `"`; - } else if (inQuote === `"`) { - inQuote = ``; - } - } else if (c === "'") { + inQuote = KEY.DOUBLE_QUOTE; + } else if (inQuote === KEY.DOUBLE_QUOTE) { + inQuote = ``; + } + } else if (c === KEY.QUOTE) { // Single quotes, same thing as above - if (!escaped && prevChar === " ") { - const endQuote = command.indexOf("'", i + 1); - if (endQuote !== -1 && (endQuote === command.length - 1 || command.charAt(endQuote + 1) === " ")) { + if (!escaped && prevChar === KEY.SPACE) { + const endQuote = command.indexOf(KEY.QUOTE, i + 1); + if (endQuote !== -1 && (endQuote === command.length - 1 || command.charAt(endQuote + 1) === KEY.SPACE)) { args.push(command.substr(i + 1, endQuote - i - 1)); if (endQuote === command.length - 1) { start = i = endQuote + 1; @@ -87,11 +88,11 @@ export function ParseCommand(command: string): (string | number | boolean)[] { continue; } } else if (inQuote === ``) { - inQuote = `'`; - } else if (inQuote === `'`) { - inQuote = ``; - } - } else if (c === " " && inQuote === ``) { + inQuote = KEY.QUOTE; + } else if (inQuote === KEY.QUOTE) { + inQuote = ``; + } + } else if (c === KEY.SPACE && inQuote === ``) { const arg = command.substr(start, i - start); // If this is a number, convert it from a string to number diff --git a/src/Terminal/ui/TerminalInput.tsx b/src/Terminal/ui/TerminalInput.tsx index f84623535..afaf7604b 100644 --- a/src/Terminal/ui/TerminalInput.tsx +++ b/src/Terminal/ui/TerminalInput.tsx @@ -97,7 +97,7 @@ export function TerminalInput({ terminal, router, player }: IProps): React.React break; case "deletewordbefore": // Delete rest of word before the cursor for (let delStart = start - 1; delStart > -2; --delStart) { - if ((inputText.charAt(delStart) === " " || delStart === -1) && delStart !== start - 1) { + if ((inputText.charAt(delStart) === KEY.SPACE || delStart === -1) && delStart !== start - 1) { saveValue(inputText.substr(0, delStart + 1) + inputText.substr(start), () => { // Move cursor to correct location // foo bar |baz bum --> foo |baz bum @@ -110,7 +110,7 @@ export function TerminalInput({ terminal, router, player }: IProps): React.React break; case "deletewordafter": // Delete rest of word after the cursor, including trailing space for (let delStart = start + 1; delStart <= value.length + 1; ++delStart) { - if (inputText.charAt(delStart) === " " || delStart === value.length + 1) { + if (inputText.charAt(delStart) === KEY.SPACE || delStart === value.length + 1) { saveValue(inputText.substr(0, start) + inputText.substr(delStart + 1), () => { // Move cursor to correct location // foo bar |baz bum --> foo bar |bum @@ -151,7 +151,7 @@ export function TerminalInput({ terminal, router, player }: IProps): React.React break; case "prevword": for (let i = start - 2; i >= 0; --i) { - if (ref.value.charAt(i) === " ") { + if (ref.value.charAt(i) === KEY.SPACE) { ref.setSelectionRange(i + 1, i + 1); return; } @@ -163,7 +163,7 @@ export function TerminalInput({ terminal, router, player }: IProps): React.React break; case "nextword": for (let i = start + 1; i <= inputLength; ++i) { - if (ref.value.charAt(i) === " ") { + if (ref.value.charAt(i) === KEY.SPACE) { ref.setSelectionRange(i, i); return; } @@ -262,7 +262,7 @@ export function TerminalInput({ terminal, router, player }: IProps): React.React } // Select previous command. - if (event.key === KEY.UPARROW || (Settings.EnableBashHotkeys && event.key === "p" && event.ctrlKey)) { + if (event.key === KEY.UP_ARROW || (Settings.EnableBashHotkeys && event.key === KEY.P && event.ctrlKey)) { if (Settings.EnableBashHotkeys) { event.preventDefault(); } @@ -290,7 +290,7 @@ export function TerminalInput({ terminal, router, player }: IProps): React.React } // Select next command - if (event.key === KEY.DOWNARROW || (Settings.EnableBashHotkeys && event.key === "m" && event.ctrlKey)) { + if (event.key === KEY.DOWN_ARROW || (Settings.EnableBashHotkeys && event.key === KEY.M && event.ctrlKey)) { if (Settings.EnableBashHotkeys) { event.preventDefault(); } diff --git a/src/utils/helpers/keyCodes.ts b/src/utils/helpers/keyCodes.ts index a03290a26..29231dfec 100644 --- a/src/utils/helpers/keyCodes.ts +++ b/src/utils/helpers/keyCodes.ts @@ -8,10 +8,29 @@ export enum KEY { ENTER = "Enter", ESC = "Escape", TAB = "Tab", - UPARROW = "ArrowUp", - DOWNARROW = "ArrowDown", - LEFTARROW = "ArrowLeft", - RIGHTARROW = "ArrowRight", + SPACE = " ", + BACKSPACE = "Backspace", + UP_ARROW = "ArrowUp", + DOWN_ARROW = "ArrowDown", + LEFT_ARROW = "ArrowLeft", + RIGHT_ARROW = "ArrowRight", + + QUOTE = "'", + DOUBLE_QUOTE = '"', + OPEN_BRACKET = "[", + CLOSE_BRACKET = "]", + LESS_THAN = "<", + GREATER_THAN = ">", + OPEN_PARENTHESIS = "(", + CLOSE_PARENTHESIS = ")", + OPEN_BRACE = "{", + CLOSE_BRACE = "}", + + PIPE = "|", + DOT = ".", + FORWARD_SLASH = "/", + HYPHEN = "-", + HASH = "#", k0 = "0", k1 = "1", From 57b59de9be7576918ea29e32dfbd8e41e1eae0d6 Mon Sep 17 00:00:00 2001 From: Jack Date: Fri, 25 Mar 2022 20:10:20 +0800 Subject: [PATCH 03/12] fix arrows --- src/Infiltration/utils.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Infiltration/utils.ts b/src/Infiltration/utils.ts index d338423d5..ed8f6fedc 100644 --- a/src/Infiltration/utils.ts +++ b/src/Infiltration/utils.ts @@ -5,9 +5,9 @@ export function random(min: number, max: number): number { } export const upArrowSymbol = "↑"; -export const downArrowSymbol = "↑"; -export const leftArrowSymbol = "↑"; -export const rightArrowSymbol = "↑"; +export const downArrowSymbol = "↓"; +export const leftArrowSymbol = "←"; +export const rightArrowSymbol = "→"; export function getArrow(event: KeyboardEvent): string { switch (event.key) { From 6c530202b2ed282864a0f9d5f288aa0e7795a15c Mon Sep 17 00:00:00 2001 From: phyzical Date: Wed, 30 Mar 2022 08:19:25 +0800 Subject: [PATCH 04/12] missed one file removal --- src/PersonObjects/Resleeving/Resleeving.ts | 133 --------------------- 1 file changed, 133 deletions(-) delete mode 100644 src/PersonObjects/Resleeving/Resleeving.ts diff --git a/src/PersonObjects/Resleeving/Resleeving.ts b/src/PersonObjects/Resleeving/Resleeving.ts deleted file mode 100644 index cc17c56c2..000000000 --- a/src/PersonObjects/Resleeving/Resleeving.ts +++ /dev/null @@ -1,133 +0,0 @@ -/** - * Implements the Re-sleeving mechanic for BitNode-10. - * This allows the player to purchase and "use" new sleeves at VitaLife. - * These new sleeves come with different starting experience and Augmentations - * The cost of these new sleeves scales based on the exp and Augs. - * - * Note that this is different from the "Sleeve mechanic". The "Sleeve" mechanic - * provides new sleeves, essentially clones. This Re-sleeving mechanic lets - * the player purchase a new body with pre-existing Augmentations and experience - * - * As of right now, this feature is only available in BitNode 10 - */ -import { Resleeve } from "./Resleeve"; -import { IPlayer } from "../IPlayer"; - -import { Augmentation } from "../../Augmentation/Augmentation"; -import { Augmentations } from "../../Augmentation/Augmentations"; -import { IPlayerOwnedAugmentation, PlayerOwnedAugmentation } from "../../Augmentation/PlayerOwnedAugmentation"; -import { AugmentationNames } from "../../Augmentation/data/AugmentationNames"; - -import { getRandomInt } from "../../utils/helpers/getRandomInt"; - -// Executes the actual re-sleeve when one is purchased -export function purchaseResleeve(r: Resleeve, p: IPlayer): boolean { - const cost: number = r.getCost(); - if (!p.canAfford(cost)) { - return false; - } - p.loseMoney(cost, "other"); - - // Set the player's exp - p.hacking_exp = r.hacking_exp; - p.strength_exp = r.strength_exp; - p.defense_exp = r.defense_exp; - p.dexterity_exp = r.dexterity_exp; - p.agility_exp = r.agility_exp; - p.charisma_exp = r.charisma_exp; - - // Reset Augmentation "owned" data - for (const augKey of Object.keys(Augmentations)) { - Augmentations[augKey].owned = false; - } - - // Clear all of the player's augmentations, except the NeuroFlux Governor - // which is kept - for (let i = p.augmentations.length - 1; i >= 0; --i) { - if (p.augmentations[i].name !== AugmentationNames.NeuroFluxGovernor) { - p.augmentations.splice(i, 1); - } else { - // NeuroFlux Governor - Augmentations[AugmentationNames.NeuroFluxGovernor].owned = true; - } - } - - for (let i = 0; i < r.augmentations.length; ++i) { - p.augmentations.push(new PlayerOwnedAugmentation(r.augmentations[i].name)); - Augmentations[r.augmentations[i].name].owned = true; - } - - // The player's purchased Augmentations should remain the same, but any purchased - // Augmentations that are given by the resleeve should be removed so there are no duplicates - for (let i = p.queuedAugmentations.length - 1; i >= 0; --i) { - const name: string = p.queuedAugmentations[i].name; - - if ( - p.augmentations.filter((e: IPlayerOwnedAugmentation) => { - return e.name !== AugmentationNames.NeuroFluxGovernor && e.name === name; - }).length >= 1 - ) { - p.queuedAugmentations.splice(i, 1); - } - } - - p.reapplyAllAugmentations(true); - p.reapplyAllSourceFiles(); //Multipliers get reset, so have to re-process source files too - return true; -} - -// Creates all of the Re-sleeves that will be available for purchase at VitaLife -export function generateResleeves(): Resleeve[] { - const NumResleeves = 40; // Total number of Resleeves to generate - - const ret: Resleeve[] = []; - for (let i = 0; i < NumResleeves; ++i) { - // i will be a number indicating how "powerful" the Re-sleeve should be - const r: Resleeve = new Resleeve(); - - // Generate experience - const expMult: number = 5 * i + 1; - r.hacking_exp = expMult * getRandomInt(1000, 5000); - r.strength_exp = expMult * getRandomInt(1000, 5000); - r.defense_exp = expMult * getRandomInt(1000, 5000); - r.dexterity_exp = expMult * getRandomInt(1000, 5000); - r.agility_exp = expMult * getRandomInt(1000, 5000); - r.charisma_exp = expMult * getRandomInt(1000, 5000); - - // Generate Augs - // Augmentation prequisites will be ignored for this - const baseNumAugs: number = Math.max(2, Math.ceil((i + 3) / 2)); - const numAugs: number = getRandomInt(baseNumAugs, baseNumAugs + 2); - const augKeys: string[] = Object.keys(Augmentations); - for (let a = 0; a < numAugs; ++a) { - // Get a random aug - const randIndex: number = getRandomInt(0, augKeys.length - 1); - const randKey: string = augKeys[randIndex]; - - // Forbidden augmentations - const forbidden = [ - AugmentationNames.TheRedPill, - AugmentationNames.NeuroFluxGovernor, - AugmentationNames.StaneksGift1, - AugmentationNames.StaneksGift2, - AugmentationNames.StaneksGift3, - ].map((augmentation) => augmentation as string); - if (forbidden.includes(randKey)) { - continue; - } - - const randAug: Augmentation | null = Augmentations[randKey]; - if (randAug === null) throw new Error(`null augmentation: ${randKey}`); - r.augmentations.push({ name: randAug.name, level: 1 }); - r.applyAugmentation(Augmentations[randKey]); - r.updateStatLevels(); - - // Remove Augmentation so that there are no duplicates - augKeys.splice(randIndex, 1); - } - - ret.push(r); - } - - return ret; -} From 6c9a3a336eed3ae68316ddc5d95cdad560c758e1 Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Tue, 29 Mar 2022 20:24:04 -0400 Subject: [PATCH 05/12] unknown-ify corp API. --- src/NetscriptFunctions/Corporation.ts | 522 +++++++++++++++----------- 1 file changed, 295 insertions(+), 227 deletions(-) diff --git a/src/NetscriptFunctions/Corporation.ts b/src/NetscriptFunctions/Corporation.ts index b9ae2f0b5..8adaaf11f 100644 --- a/src/NetscriptFunctions/Corporation.ts +++ b/src/NetscriptFunctions/Corporation.ts @@ -21,7 +21,7 @@ import { Division as NSDivision, WarehouseAPI, OfficeAPI, - InvestmentOffer + InvestmentOffer, } from "../ScriptEditor/NetscriptDefinitions"; import { @@ -100,8 +100,8 @@ export function NetscriptCorporation( return upgrade[1]; } - function getUpgradeLevel(aupgradeName: string): number { - const upgradeName = helper.string("levelUpgrade", "upgradeName", aupgradeName); + function getUpgradeLevel(_upgradeName: string): number { + const upgradeName = helper.string("levelUpgrade", "upgradeName", _upgradeName); const corporation = getCorporation(); const upgrade = Object.values(CorporationUpgrades).find((upgrade) => upgrade[4] === upgradeName); if (upgrade === undefined) throw new Error(`No upgrade named '${upgradeName}'`); @@ -109,8 +109,8 @@ export function NetscriptCorporation( return corporation.upgrades[upgN]; } - function getUpgradeLevelCost(aupgradeName: string): number { - const upgradeName = helper.string("levelUpgrade", "upgradeName", aupgradeName); + function getUpgradeLevelCost(_upgradeName: string): number { + const upgradeName = helper.string("levelUpgrade", "upgradeName", _upgradeName); const corporation = getCorporation(); const upgrade = Object.values(CorporationUpgrades).find((upgrade) => upgrade[4] === upgradeName); if (upgrade === undefined) throw new Error(`No upgrade named '${upgradeName}'`); @@ -135,11 +135,15 @@ export function NetscriptCorporation( function getInvestmentOffer(): InvestmentOffer { const corporation = getCorporation(); - if (corporation.fundingRound >= CorporationConstants.FundingRoundShares.length || corporation.fundingRound >= CorporationConstants.FundingRoundMultiplier.length || corporation.public) + if ( + corporation.fundingRound >= CorporationConstants.FundingRoundShares.length || + corporation.fundingRound >= CorporationConstants.FundingRoundMultiplier.length || + corporation.public + ) return { funds: 0, shares: 0, - round: corporation.fundingRound + 1 // Make more readable + round: corporation.fundingRound + 1, // Make more readable }; // Don't throw an error here, no reason to have a second function to check if you can get investment. const val = corporation.determineValuation(); const percShares = CorporationConstants.FundingRoundShares[corporation.fundingRound]; @@ -149,13 +153,18 @@ export function NetscriptCorporation( return { funds: funding, shares: investShares, - round: corporation.fundingRound + 1 // Make more readable + round: corporation.fundingRound + 1, // Make more readable }; } function acceptInvestmentOffer(): boolean { const corporation = getCorporation(); - if (corporation.fundingRound >= CorporationConstants.FundingRoundShares.length || corporation.fundingRound >= CorporationConstants.FundingRoundMultiplier.length || corporation.public) return false; + if ( + corporation.fundingRound >= CorporationConstants.FundingRoundShares.length || + corporation.fundingRound >= CorporationConstants.FundingRoundMultiplier.length || + corporation.public + ) + return false; const val = corporation.determineValuation(); const percShares = CorporationConstants.FundingRoundShares[corporation.fundingRound]; const roundMultiplier = CorporationConstants.FundingRoundMultiplier[corporation.fundingRound]; @@ -181,7 +190,6 @@ export function NetscriptCorporation( return true; } - function getResearchCost(division: IIndustry, researchName: string): number { const researchTree = IndustryResearchTrees[division.type]; if (researchTree === undefined) throw new Error(`No research tree for industry '${division.type}'`); @@ -192,17 +200,18 @@ export function NetscriptCorporation( } function hasResearched(division: IIndustry, researchName: string): boolean { - return division.researched[researchName] === undefined ? false : division.researched[researchName] as boolean; + return division.researched[researchName] === undefined ? false : (division.researched[researchName] as boolean); } function bribe(factionName: string, amountCash: number, amountShares: number): boolean { if (!player.factions.includes(factionName)) throw new Error("Invalid faction name"); - if (isNaN(amountCash) || amountCash < 0 || isNaN(amountShares) || amountShares < 0) throw new Error("Invalid value for amount field! Must be numeric, grater than 0."); + if (isNaN(amountCash) || amountCash < 0 || isNaN(amountShares) || amountShares < 0) + throw new Error("Invalid value for amount field! Must be numeric, grater than 0."); const corporation = getCorporation(); if (corporation.funds < amountCash) return false; if (corporation.numShares < amountShares) return false; - const faction = Factions[factionName] + const faction = Factions[factionName]; const info = faction.getInfo(); if (!info.offersWork()) return false; if (player.hasGangWith(factionName)) return false; @@ -302,40 +311,40 @@ export function NetscriptCorporation( checkAccess("getPurchaseWarehouseCost", 7); return CorporationConstants.WarehouseInitialCost; }, - getUpgradeWarehouseCost: function (adivisionName: any, acityName: any): number { + getUpgradeWarehouseCost: function (_divisionName: unknown, _cityName: unknown): number { checkAccess("upgradeWarehouse", 7); - const divisionName = helper.string("getUpgradeWarehouseCost", "divisionName", adivisionName); - const cityName = helper.string("getUpgradeWarehouseCost", "cityName", acityName); + const divisionName = helper.string("getUpgradeWarehouseCost", "divisionName", _divisionName); + const cityName = helper.string("getUpgradeWarehouseCost", "cityName", _cityName); const warehouse = getWarehouse(divisionName, cityName); return CorporationConstants.WarehouseUpgradeBaseCost * Math.pow(1.07, warehouse.level + 1); }, - hasWarehouse: function (adivisionName: any, acityName: any): boolean { + hasWarehouse: function (_divisionName: unknown, _cityName: unknown): boolean { checkAccess("hasWarehouse", 7); - const divisionName = helper.string("getWarehouse", "divisionName", adivisionName); - const cityName = helper.string("getWarehouse", "cityName", acityName); + const divisionName = helper.string("getWarehouse", "divisionName", _divisionName); + const cityName = helper.string("getWarehouse", "cityName", _cityName); const division = getDivision(divisionName); if (!(cityName in division.warehouses)) throw new Error(`Invalid city name '${cityName}'`); const warehouse = division.warehouses[cityName]; return warehouse !== 0; }, - getWarehouse: function (adivisionName: any, acityName: any): NSWarehouse { + getWarehouse: function (_divisionName: unknown, _cityName: unknown): NSWarehouse { checkAccess("getWarehouse", 7); - const divisionName = helper.string("getWarehouse", "divisionName", adivisionName); - const cityName = helper.string("getWarehouse", "cityName", acityName); + const divisionName = helper.string("getWarehouse", "divisionName", _divisionName); + const cityName = helper.string("getWarehouse", "cityName", _cityName); const warehouse = getWarehouse(divisionName, cityName); return { level: warehouse.level, loc: warehouse.loc, size: warehouse.size, sizeUsed: warehouse.sizeUsed, - smartSupplyEnabled: warehouse.smartSupplyEnabled + smartSupplyEnabled: warehouse.smartSupplyEnabled, }; }, - getMaterial: function (adivisionName: any, acityName: any, amaterialName: any): NSMaterial { + getMaterial: function (_divisionName: unknown, _cityName: unknown, _materialName: unknown): NSMaterial { checkAccess("getMaterial", 7); - const divisionName = helper.string("getMaterial", "divisionName", adivisionName); - const cityName = helper.string("getMaterial", "cityName", acityName); - const materialName = helper.string("getMaterial", "materialName", amaterialName); + const divisionName = helper.string("getMaterial", "divisionName", _divisionName); + const cityName = helper.string("getMaterial", "cityName", _cityName); + const materialName = helper.string("getMaterial", "materialName", _materialName); const material = getMaterial(divisionName, cityName, materialName); return { name: material.name, @@ -345,10 +354,10 @@ export function NetscriptCorporation( sell: material.sll, }; }, - getProduct: function (adivisionName: any, aproductName: any): NSProduct { + getProduct: function (_divisionName: unknown, _productName: unknown): NSProduct { checkAccess("getProduct", 7); - const divisionName = helper.string("getProduct", "divisionName", adivisionName); - const productName = helper.string("getProduct", "productName", aproductName); + const divisionName = helper.string("getProduct", "divisionName", _divisionName); + const productName = helper.string("getProduct", "productName", _productName); const product = getProduct(divisionName, productName); return { name: product.name, @@ -360,220 +369,271 @@ export function NetscriptCorporation( developmentProgress: product.prog, }; }, - purchaseWarehouse: function (adivisionName: any, acityName: any): void { + purchaseWarehouse: function (_divisionName: unknown, _cityName: unknown): void { checkAccess("purchaseWarehouse", 7); - const divisionName = helper.string("purchaseWarehouse", "divisionName", adivisionName); - const cityName = helper.string("purchaseWarehouse", "cityName", acityName); + const divisionName = helper.string("purchaseWarehouse", "divisionName", _divisionName); + const cityName = helper.string("purchaseWarehouse", "cityName", _cityName); const corporation = getCorporation(); PurchaseWarehouse(corporation, getDivision(divisionName), cityName); }, - upgradeWarehouse: function (adivisionName: any, acityName: any): void { + upgradeWarehouse: function (_divisionName: unknown, _cityName: unknown): void { checkAccess("upgradeWarehouse", 7); - const divisionName = helper.string("upgradeWarehouse", "divisionName", adivisionName); - const cityName = helper.string("upgradeWarehouse", "cityName", acityName); + const divisionName = helper.string("upgradeWarehouse", "divisionName", _divisionName); + const cityName = helper.string("upgradeWarehouse", "cityName", _cityName); const corporation = getCorporation(); UpgradeWarehouse(corporation, getDivision(divisionName), getWarehouse(divisionName, cityName)); }, - sellMaterial: function (adivisionName: any, acityName: any, amaterialName: any, aamt: any, aprice: any): void { + sellMaterial: function ( + _divisionName: unknown, + _cityName: unknown, + _materialName: unknown, + _amt: unknown, + _price: unknown, + ): void { checkAccess("sellMaterial", 7); - const divisionName = helper.string("sellMaterial", "divisionName", adivisionName); - const cityName = helper.string("sellMaterial", "cityName", acityName); - const materialName = helper.string("sellMaterial", "materialName", amaterialName); - const amt = helper.string("sellMaterial", "amt", aamt); - const price = helper.string("sellMaterial", "price", aprice); + const divisionName = helper.string("sellMaterial", "divisionName", _divisionName); + const cityName = helper.string("sellMaterial", "cityName", _cityName); + const materialName = helper.string("sellMaterial", "materialName", _materialName); + const amt = helper.string("sellMaterial", "amt", _amt); + const price = helper.string("sellMaterial", "price", _price); const material = getMaterial(divisionName, cityName, materialName); SellMaterial(material, amt, price); }, sellProduct: function ( - adivisionName: any, - acityName: any, - aproductName: any, - aamt: any, - aprice: any, - aall: any, + _divisionName: unknown, + _cityName: unknown, + _productName: unknown, + _amt: unknown, + _price: unknown, + _all: unknown, ): void { checkAccess("sellProduct", 7); - const divisionName = helper.string("sellProduct", "divisionName", adivisionName); - const cityName = helper.string("sellProduct", "cityName", acityName); - const productName = helper.string("sellProduct", "productName", aproductName); - const amt = helper.string("sellProduct", "amt", aamt); - const price = helper.string("sellProduct", "price", aprice); - const all = helper.boolean(aall); + const divisionName = helper.string("sellProduct", "divisionName", _divisionName); + const cityName = helper.string("sellProduct", "cityName", _cityName); + const productName = helper.string("sellProduct", "productName", _productName); + const amt = helper.string("sellProduct", "amt", _amt); + const price = helper.string("sellProduct", "price", _price); + const all = helper.boolean(_all); const product = getProduct(divisionName, productName); SellProduct(product, cityName, amt, price, all); }, - discontinueProduct: function (adivisionName: any, aproductName: any): void { + discontinueProduct: function (_divisionName: unknown, _productName: unknown): void { checkAccess("discontinueProduct", 7); - const divisionName = helper.string("discontinueProduct", "divisionName", adivisionName); - const productName = helper.string("discontinueProduct", "productName", aproductName); + const divisionName = helper.string("discontinueProduct", "divisionName", _divisionName); + const productName = helper.string("discontinueProduct", "productName", _productName); getDivision(divisionName).discontinueProduct(getProduct(divisionName, productName)); }, - setSmartSupply: function (adivisionName: any, acityName: any, aenabled: any): void { + setSmartSupply: function (_divisionName: unknown, _cityName: unknown, _enabled: unknown): void { checkAccess("setSmartSupply", 7); - const divisionName = helper.string("setSmartSupply", "divisionName", adivisionName); - const cityName = helper.string("sellProduct", "cityName", acityName); - const enabled = helper.boolean(aenabled); + const divisionName = helper.string("setSmartSupply", "divisionName", _divisionName); + const cityName = helper.string("sellProduct", "cityName", _cityName); + const enabled = helper.boolean(_enabled); const warehouse = getWarehouse(divisionName, cityName); if (!hasUnlockUpgrade("Smart Supply")) - throw helper.makeRuntimeErrorMsg(`corporation.setSmartSupply`, `You have not purchased the Smart Supply upgrade!`); + throw helper.makeRuntimeErrorMsg( + `corporation.setSmartSupply`, + `You have not purchased the Smart Supply upgrade!`, + ); SetSmartSupply(warehouse, enabled); }, - setSmartSupplyUseLeftovers: function (adivisionName: any, acityName: any, amaterialName: any, aenabled: any): void { + setSmartSupplyUseLeftovers: function ( + _divisionName: unknown, + _cityName: unknown, + _materialName: unknown, + _enabled: unknown, + ): void { checkAccess("setSmartSupplyUseLeftovers", 7); - const divisionName = helper.string("setSmartSupply", "divisionName", adivisionName); - const cityName = helper.string("sellProduct", "cityName", acityName); - const materialName = helper.string("sellProduct", "materialName", amaterialName); - const enabled = helper.boolean(aenabled); + const divisionName = helper.string("setSmartSupply", "divisionName", _divisionName); + const cityName = helper.string("sellProduct", "cityName", _cityName); + const materialName = helper.string("sellProduct", "materialName", _materialName); + const enabled = helper.boolean(_enabled); const warehouse = getWarehouse(divisionName, cityName); const material = getMaterial(divisionName, cityName, materialName); if (!hasUnlockUpgrade("Smart Supply")) - throw helper.makeRuntimeErrorMsg(`corporation.setSmartSupply`, `You have not purchased the Smart Supply upgrade!`); + throw helper.makeRuntimeErrorMsg( + `corporation.setSmartSupply`, + `You have not purchased the Smart Supply upgrade!`, + ); SetSmartSupplyUseLeftovers(warehouse, material, enabled); }, - buyMaterial: function (adivisionName: any, acityName: any, amaterialName: any, aamt: any): void { + buyMaterial: function (_divisionName: unknown, _cityName: unknown, _materialName: unknown, _amt: unknown): void { checkAccess("buyMaterial", 7); - const divisionName = helper.string("buyMaterial", "divisionName", adivisionName); - const cityName = helper.string("buyMaterial", "cityName", acityName); - const materialName = helper.string("buyMaterial", "materialName", amaterialName); - const amt = helper.number("buyMaterial", "amt", aamt); + const divisionName = helper.string("buyMaterial", "divisionName", _divisionName); + const cityName = helper.string("buyMaterial", "cityName", _cityName); + const materialName = helper.string("buyMaterial", "materialName", _materialName); + const amt = helper.number("buyMaterial", "amt", _amt); if (amt < 0) throw new Error("Invalid value for amount field! Must be numeric and greater than 0"); const material = getMaterial(divisionName, cityName, materialName); BuyMaterial(material, amt); }, - bulkPurchase: function (adivisionName: any, acityName: any, amaterialName: any, aamt: any): void { + bulkPurchase: function (_divisionName: unknown, _cityName: unknown, _materialName: unknown, _amt: unknown): void { checkAccess("bulkPurchase", 7); - const divisionName = helper.string("bulkPurchase", "divisionName", adivisionName); - if (!hasResearched(getDivision(adivisionName), "Bulk Purchasing")) throw new Error(`You have not researched Bulk Purchasing in ${divisionName}`) + const divisionName = helper.string("bulkPurchase", "divisionName", _divisionName); + if (!hasResearched(getDivision(_divisionName), "Bulk Purchasing")) + throw new Error(`You have not researched Bulk Purchasing in ${divisionName}`); const corporation = getCorporation(); - const cityName = helper.string("bulkPurchase", "cityName", acityName); - const materialName = helper.string("bulkPurchase", "materialName", amaterialName); - const amt = helper.number("bulkPurchase", "amt", aamt); - const warehouse = getWarehouse(divisionName, cityName) + const cityName = helper.string("bulkPurchase", "cityName", _cityName); + const materialName = helper.string("bulkPurchase", "materialName", _materialName); + const amt = helper.number("bulkPurchase", "amt", _amt); + const warehouse = getWarehouse(divisionName, cityName); const material = getMaterial(divisionName, cityName, materialName); BulkPurchase(corporation, warehouse, material, amt); }, makeProduct: function ( - adivisionName: any, - acityName: any, - aproductName: any, - adesignInvest: any, - amarketingInvest: any, + _divisionName: unknown, + _cityName: unknown, + _productName: unknown, + _designInvest: unknown, + _marketingInvest: unknown, ): void { checkAccess("makeProduct", 7); - const divisionName = helper.string("makeProduct", "divisionName", adivisionName); - const cityName = helper.string("makeProduct", "cityName", acityName); - const productName = helper.string("makeProduct", "productName", aproductName); - const designInvest = helper.number("makeProduct", "designInvest", adesignInvest); - const marketingInvest = helper.number("makeProduct", "marketingInvest", amarketingInvest); + const divisionName = helper.string("makeProduct", "divisionName", _divisionName); + const cityName = helper.string("makeProduct", "cityName", _cityName); + const productName = helper.string("makeProduct", "productName", _productName); + const designInvest = helper.number("makeProduct", "designInvest", _designInvest); + const marketingInvest = helper.number("makeProduct", "marketingInvest", _marketingInvest); const corporation = getCorporation(); MakeProduct(corporation, getDivision(divisionName), cityName, productName, designInvest, marketingInvest); }, exportMaterial: function ( - asourceDivision: any, - asourceCity: any, - atargetDivision: any, - atargetCity: any, - amaterialName: any, - aamt: any, + _sourceDivision: unknown, + _sourceCity: unknown, + _targetDivision: unknown, + _targetCity: unknown, + _materialName: unknown, + _amt: unknown, ): void { checkAccess("exportMaterial", 7); - const sourceDivision = helper.string("exportMaterial", "sourceDivision", asourceDivision); - const sourceCity = helper.string("exportMaterial", "sourceCity", asourceCity); - const targetDivision = helper.string("exportMaterial", "targetDivision", atargetDivision); - const targetCity = helper.string("exportMaterial", "targetCity", atargetCity); - const materialName = helper.string("exportMaterial", "materialName", amaterialName); - const amt = helper.string("exportMaterial", "amt", aamt); - ExportMaterial(targetDivision, targetCity, getMaterial(sourceDivision, sourceCity, materialName), amt + "", getDivision(targetDivision)); + const sourceDivision = helper.string("exportMaterial", "sourceDivision", _sourceDivision); + const sourceCity = helper.string("exportMaterial", "sourceCity", _sourceCity); + const targetDivision = helper.string("exportMaterial", "targetDivision", _targetDivision); + const targetCity = helper.string("exportMaterial", "targetCity", _targetCity); + const materialName = helper.string("exportMaterial", "materialName", _materialName); + const amt = helper.string("exportMaterial", "amt", _amt); + ExportMaterial( + targetDivision, + targetCity, + getMaterial(sourceDivision, sourceCity, materialName), + amt + "", + getDivision(targetDivision), + ); }, cancelExportMaterial: function ( - asourceDivision: any, - asourceCity: any, - atargetDivision: any, - atargetCity: any, - amaterialName: any, - aamt: any, + _sourceDivision: unknown, + _sourceCity: unknown, + _targetDivision: unknown, + _targetCity: unknown, + _materialName: unknown, + _amt: unknown, ): void { checkAccess("cancelExportMaterial", 7); - const sourceDivision = helper.string("cancelExportMaterial", "sourceDivision", asourceDivision); - const sourceCity = helper.string("cancelExportMaterial", "sourceCity", asourceCity); - const targetDivision = helper.string("cancelExportMaterial", "targetDivision", atargetDivision); - const targetCity = helper.string("cancelExportMaterial", "targetCity", atargetCity); - const materialName = helper.string("cancelExportMaterial", "materialName", amaterialName); - const amt = helper.string("cancelExportMaterial", "amt", aamt); + const sourceDivision = helper.string("cancelExportMaterial", "sourceDivision", _sourceDivision); + const sourceCity = helper.string("cancelExportMaterial", "sourceCity", _sourceCity); + const targetDivision = helper.string("cancelExportMaterial", "targetDivision", _targetDivision); + const targetCity = helper.string("cancelExportMaterial", "targetCity", _targetCity); + const materialName = helper.string("cancelExportMaterial", "materialName", _materialName); + const amt = helper.string("cancelExportMaterial", "amt", _amt); CancelExportMaterial(targetDivision, targetCity, getMaterial(sourceDivision, sourceCity, materialName), amt + ""); }, - setMaterialMarketTA1: function (adivisionName: any, acityName: any, amaterialName: any, aon: any): void { + setMaterialMarketTA1: function ( + _divisionName: unknown, + _cityName: unknown, + _materialName: unknown, + _on: unknown, + ): void { checkAccess("setMaterialMarketTA1", 7); - const divisionName = helper.string("setMaterialMarketTA1", "divisionName", adivisionName); - const cityName = helper.string("setMaterialMarketTA1", "cityName", acityName); - const materialName = helper.string("setMaterialMarketTA1", "materialName", amaterialName); - const on = helper.boolean(aon); + const divisionName = helper.string("setMaterialMarketTA1", "divisionName", _divisionName); + const cityName = helper.string("setMaterialMarketTA1", "cityName", _cityName); + const materialName = helper.string("setMaterialMarketTA1", "materialName", _materialName); + const on = helper.boolean(_on); if (!getDivision(divisionName).hasResearch("Market-TA.I")) - throw helper.makeRuntimeErrorMsg(`corporation.setMaterialMarketTA1`, `You have not researched MarketTA.I for division: ${divisionName}`); + throw helper.makeRuntimeErrorMsg( + `corporation.setMaterialMarketTA1`, + `You have not researched MarketTA.I for division: ${divisionName}`, + ); SetMaterialMarketTA1(getMaterial(divisionName, cityName, materialName), on); }, - setMaterialMarketTA2: function (adivisionName: any, acityName: any, amaterialName: any, aon: any): void { + setMaterialMarketTA2: function ( + _divisionName: unknown, + _cityName: unknown, + _materialName: unknown, + _on: unknown, + ): void { checkAccess("setMaterialMarketTA2", 7); - const divisionName = helper.string("setMaterialMarketTA2", "divisionName", adivisionName); - const cityName = helper.string("setMaterialMarketTA2", "cityName", acityName); - const materialName = helper.string("setMaterialMarketTA2", "materialName", amaterialName); - const on = helper.boolean(aon); + const divisionName = helper.string("setMaterialMarketTA2", "divisionName", _divisionName); + const cityName = helper.string("setMaterialMarketTA2", "cityName", _cityName); + const materialName = helper.string("setMaterialMarketTA2", "materialName", _materialName); + const on = helper.boolean(_on); if (!getDivision(divisionName).hasResearch("Market-TA.II")) - throw helper.makeRuntimeErrorMsg(`corporation.setMaterialMarketTA2`, `You have not researched MarketTA.II for division: ${divisionName}`); + throw helper.makeRuntimeErrorMsg( + `corporation.setMaterialMarketTA2`, + `You have not researched MarketTA.II for division: ${divisionName}`, + ); SetMaterialMarketTA2(getMaterial(divisionName, cityName, materialName), on); }, - setProductMarketTA1: function (adivisionName: any, aproductName: any, aon: any): void { + setProductMarketTA1: function (_divisionName: unknown, _productName: unknown, _on: unknown): void { checkAccess("setProductMarketTA1", 7); - const divisionName = helper.string("setProductMarketTA1", "divisionName", adivisionName); - const productName = helper.string("setProductMarketTA1", "productName", aproductName); - const on = helper.boolean(aon); + const divisionName = helper.string("setProductMarketTA1", "divisionName", _divisionName); + const productName = helper.string("setProductMarketTA1", "productName", _productName); + const on = helper.boolean(_on); if (!getDivision(divisionName).hasResearch("Market-TA.I")) - throw helper.makeRuntimeErrorMsg(`corporation.setProductMarketTA1`, `You have not researched MarketTA.I for division: ${divisionName}`); + throw helper.makeRuntimeErrorMsg( + `corporation.setProductMarketTA1`, + `You have not researched MarketTA.I for division: ${divisionName}`, + ); SetProductMarketTA1(getProduct(divisionName, productName), on); }, - setProductMarketTA2: function (adivisionName: any, aproductName: any, aon: any): void { + setProductMarketTA2: function (_divisionName: unknown, _productName: unknown, _on: unknown): void { checkAccess("setProductMarketTA2", 7); - const divisionName = helper.string("setProductMarketTA2", "divisionName", adivisionName); - const productName = helper.string("setProductMarketTA2", "productName", aproductName); - const on = helper.boolean(aon); + const divisionName = helper.string("setProductMarketTA2", "divisionName", _divisionName); + const productName = helper.string("setProductMarketTA2", "productName", _productName); + const on = helper.boolean(_on); if (!getDivision(divisionName).hasResearch("Market-TA.II")) - throw helper.makeRuntimeErrorMsg(`corporation.setProductMarketTA2`, `You have not researched MarketTA.II for division: ${divisionName}`); + throw helper.makeRuntimeErrorMsg( + `corporation.setProductMarketTA2`, + `You have not researched MarketTA.II for division: ${divisionName}`, + ); SetProductMarketTA2(getProduct(divisionName, productName), on); }, }; const officeAPI: OfficeAPI = { - getHireAdVertCost: function (adivisionName: any): number { + getHireAdVertCost: function (_divisionName: unknown): number { checkAccess("getHireAdVertCost", 8); - const divisionName = helper.string("getHireAdVertCost", "divisionName", adivisionName); + const divisionName = helper.string("getHireAdVertCost", "divisionName", _divisionName); const division = getDivision(divisionName); const upgrade = IndustryUpgrades[1]; return upgrade[1] * Math.pow(upgrade[2], division.upgrades[1]); }, - getHireAdVertCount: function (adivisionName: any): number { + getHireAdVertCount: function (_divisionName: unknown): number { checkAccess("getHireAdVertCount", 8); - const divisionName = helper.string("getHireAdVertCount", "divisionName", adivisionName); + const divisionName = helper.string("getHireAdVertCount", "divisionName", _divisionName); const division = getDivision(divisionName); - return division.upgrades[1] + return division.upgrades[1]; }, - getResearchCost: function (adivisionName: any, aresearchName: any): number { + getResearchCost: function (_divisionName: unknown, _researchName: unknown): number { checkAccess("getResearchCost", 8); - const divisionName = helper.string("getResearchCost", "divisionName", adivisionName); - const researchName = helper.string("getResearchCost", "researchName", aresearchName); + const divisionName = helper.string("getResearchCost", "divisionName", _divisionName); + const researchName = helper.string("getResearchCost", "researchName", _researchName); return getResearchCost(getDivision(divisionName), researchName); }, - hasResearched: function (adivisionName: any, aresearchName: any): boolean { + hasResearched: function (_divisionName: unknown, _researchName: unknown): boolean { checkAccess("hasResearched", 8); - const divisionName = helper.string("hasResearched", "divisionName", adivisionName); - const researchName = helper.string("hasResearched", "researchName", aresearchName); + const divisionName = helper.string("hasResearched", "divisionName", _divisionName); + const researchName = helper.string("hasResearched", "researchName", _researchName); return hasResearched(getDivision(divisionName), researchName); }, - setAutoJobAssignment: function (adivisionName: any, acityName: any, ajob: any, aamount: any): Promise { + setAutoJobAssignment: function ( + _divisionName: unknown, + _cityName: unknown, + _job: unknown, + _amount: unknown, + ): Promise { checkAccess("setAutoJobAssignment", 8); - const divisionName = helper.string("setAutoJobAssignment", "divisionName", adivisionName); - const cityName = helper.string("setAutoJobAssignment", "cityName", acityName); - const amount = helper.number("setAutoJobAssignment", "amount", aamount); - const job = helper.string("setAutoJobAssignment", "job", ajob); + const divisionName = helper.string("setAutoJobAssignment", "divisionName", _divisionName); + const cityName = helper.string("setAutoJobAssignment", "cityName", _cityName); + const amount = helper.number("setAutoJobAssignment", "amount", _amount); + const job = helper.string("setAutoJobAssignment", "job", _job); const office = getOffice(divisionName, cityName); if (!Object.values(EmployeePositions).includes(job)) throw new Error(`'${job}' is not a valid job.`); return netscriptDelay(1000, workerScript).then(function () { @@ -583,11 +643,11 @@ export function NetscriptCorporation( return Promise.resolve(office.setEmployeeToJob(job, amount)); }); }, - getOfficeSizeUpgradeCost: function (adivisionName: any, acityName: any, asize: any): number { + getOfficeSizeUpgradeCost: function (_divisionName: unknown, _cityName: unknown, _size: unknown): number { checkAccess("getOfficeSizeUpgradeCost", 8); - const divisionName = helper.string("getOfficeSizeUpgradeCost", "divisionName", adivisionName); - const cityName = helper.string("getOfficeSizeUpgradeCost", "cityName", acityName); - const size = helper.number("getOfficeSizeUpgradeCost", "size", asize); + const divisionName = helper.string("getOfficeSizeUpgradeCost", "divisionName", _divisionName); + const cityName = helper.string("getOfficeSizeUpgradeCost", "cityName", _cityName); + const size = helper.number("getOfficeSizeUpgradeCost", "size", _size); if (size < 0) throw new Error("Invalid value for size field! Must be numeric and greater than 0"); const office = getOffice(divisionName, cityName); const initialPriceMult = Math.round(office.size / CorporationConstants.OfficeInitialSize); @@ -598,40 +658,46 @@ export function NetscriptCorporation( } return CorporationConstants.OfficeInitialCost * mult; }, - assignJob: function (adivisionName: any, acityName: any, aemployeeName: any, ajob: any): Promise { + assignJob: function ( + _divisionName: unknown, + _cityName: unknown, + _employeeName: unknown, + _job: unknown, + ): Promise { checkAccess("assignJob", 8); - const divisionName = helper.string("assignJob", "divisionName", adivisionName); - const cityName = helper.string("assignJob", "cityName", acityName); - const employeeName = helper.string("assignJob", "employeeName", aemployeeName); - const job = helper.string("assignJob", "job", ajob); + const divisionName = helper.string("assignJob", "divisionName", _divisionName); + const cityName = helper.string("assignJob", "cityName", _cityName); + const employeeName = helper.string("assignJob", "employeeName", _employeeName); + const job = helper.string("assignJob", "job", _job); const employee = getEmployee(divisionName, cityName, employeeName); return netscriptDelay(1000, workerScript).then(function () { return Promise.resolve(AssignJob(employee, job)); }); }, - hireEmployee: function (adivisionName: any, acityName: any): any { + hireEmployee: function (_divisionName: unknown, _cityName: unknown): any { checkAccess("hireEmployee", 8); - const divisionName = helper.string("hireEmployee", "divisionName", adivisionName); - const cityName = helper.string("hireEmployee", "cityName", acityName); + const divisionName = helper.string("hireEmployee", "divisionName", _divisionName); + const cityName = helper.string("hireEmployee", "cityName", _cityName); const office = getOffice(divisionName, cityName); return office.hireRandomEmployee(); }, - upgradeOfficeSize: function (adivisionName: any, acityName: any, asize: any): void { + upgradeOfficeSize: function (_divisionName: unknown, _cityName: unknown, _size: unknown): void { checkAccess("upgradeOfficeSize", 8); - const divisionName = helper.string("upgradeOfficeSize", "divisionName", adivisionName); - const cityName = helper.string("upgradeOfficeSize", "cityName", acityName); - const size = helper.number("upgradeOfficeSize", "size", asize); + const divisionName = helper.string("upgradeOfficeSize", "divisionName", _divisionName); + const cityName = helper.string("upgradeOfficeSize", "cityName", _cityName); + const size = helper.number("upgradeOfficeSize", "size", _size); if (size < 0) throw new Error("Invalid value for size field! Must be numeric and greater than 0"); const office = getOffice(divisionName, cityName); const corporation = getCorporation(); UpgradeOfficeSize(corporation, office, size); }, - throwParty: function (adivisionName: any, acityName: any, acostPerEmployee: any): Promise { + throwParty: function (_divisionName: unknown, _cityName: unknown, _costPerEmployee: unknown): Promise { checkAccess("throwParty", 8); - const divisionName = helper.string("throwParty", "divisionName", adivisionName); - const cityName = helper.string("throwParty", "cityName", acityName); - const costPerEmployee = helper.number("throwParty", "costPerEmployee", acostPerEmployee); - if (costPerEmployee < 0) throw new Error("Invalid value for Cost Per Employee field! Must be numeric and greater than 0"); + const divisionName = helper.string("throwParty", "divisionName", _divisionName); + const cityName = helper.string("throwParty", "cityName", _cityName); + const costPerEmployee = helper.number("throwParty", "costPerEmployee", _costPerEmployee); + if (costPerEmployee < 0) + throw new Error("Invalid value for Cost Per Employee field! Must be numeric and greater than 0"); const office = getOffice(divisionName, cityName); const corporation = getCorporation(); return netscriptDelay( @@ -641,10 +707,10 @@ export function NetscriptCorporation( return Promise.resolve(ThrowParty(corporation, office, costPerEmployee)); }); }, - buyCoffee: function (adivisionName: any, acityName: any): Promise { + buyCoffee: function (_divisionName: unknown, _cityName: unknown): Promise { checkAccess("buyCoffee", 8); - const divisionName = helper.string("buyCoffee", "divisionName", adivisionName); - const cityName = helper.string("buyCoffee", "cityName", acityName); + const divisionName = helper.string("buyCoffee", "divisionName", _divisionName); + const cityName = helper.string("buyCoffee", "cityName", _cityName); const corporation = getCorporation(); return netscriptDelay( (60 * 1000) / (player.hacking_speed_mult * calculateIntelligenceBonus(player.intelligence, 1)), @@ -653,22 +719,22 @@ export function NetscriptCorporation( return Promise.resolve(BuyCoffee(corporation, getDivision(divisionName), getOffice(divisionName, cityName))); }); }, - hireAdVert: function (adivisionName: any): void { + hireAdVert: function (_divisionName: unknown): void { checkAccess("hireAdVert", 8); - const divisionName = helper.string("hireAdVert", "divisionName", adivisionName); + const divisionName = helper.string("hireAdVert", "divisionName", _divisionName); const corporation = getCorporation(); HireAdVert(corporation, getDivision(divisionName), getOffice(divisionName, "Sector-12")); }, - research: function (adivisionName: any, aresearchName: any): void { + research: function (_divisionName: unknown, _researchName: unknown): void { checkAccess("research", 8); - const divisionName = helper.string("research", "divisionName", adivisionName); - const researchName = helper.string("research", "researchName", aresearchName); + const divisionName = helper.string("research", "divisionName", _divisionName); + const researchName = helper.string("research", "researchName", _researchName); Research(getDivision(divisionName), researchName); }, - getOffice: function (adivisionName: any, acityName: any): any { + getOffice: function (_divisionName: unknown, _cityName: unknown): any { checkAccess("getOffice", 8); - const divisionName = helper.string("getOffice", "divisionName", adivisionName); - const cityName = helper.string("getOffice", "cityName", acityName); + const divisionName = helper.string("getOffice", "divisionName", _divisionName); + const cityName = helper.string("getOffice", "cityName", _cityName); const office = getOffice(divisionName, cityName); return { loc: office.loc, @@ -689,11 +755,11 @@ export function NetscriptCorporation( }, }; }, - getEmployee: function (adivisionName: any, acityName: any, aemployeeName: any): NSEmployee { + getEmployee: function (_divisionName: unknown, _cityName: unknown, _employeeName: unknown): NSEmployee { checkAccess("getEmployee", 8); - const divisionName = helper.string("getEmployee", "divisionName", adivisionName); - const cityName = helper.string("getEmployee", "cityName", acityName); - const employeeName = helper.string("getEmployee", "employeeName", aemployeeName); + const divisionName = helper.string("getEmployee", "divisionName", _divisionName); + const cityName = helper.string("getEmployee", "cityName", _cityName); + const employeeName = helper.string("getEmployee", "employeeName", _employeeName); const employee = getEmployee(divisionName, cityName, employeeName); return { name: employee.name, @@ -715,42 +781,43 @@ export function NetscriptCorporation( return { ...warehouseAPI, ...officeAPI, - expandIndustry: function (aindustryName: any, adivisionName: any): void { + expandIndustry: function (_industryName: unknown, _divisionName: unknown): void { checkAccess("expandIndustry"); - const industryName = helper.string("expandIndustry", "industryName", aindustryName); - const divisionName = helper.string("expandIndustry", "divisionName", adivisionName); + const industryName = helper.string("expandIndustry", "industryName", _industryName); + const divisionName = helper.string("expandIndustry", "divisionName", _divisionName); const corporation = getCorporation(); NewIndustry(corporation, industryName, divisionName); }, - expandCity: function (adivisionName: any, acityName: any): void { + expandCity: function (_divisionName: unknown, _cityName: unknown): void { checkAccess("expandCity"); - const divisionName = helper.string("expandCity", "divisionName", adivisionName); - const cityName = helper.string("expandCity", "cityName", acityName); + const divisionName = helper.string("expandCity", "divisionName", _divisionName); + const cityName = helper.string("expandCity", "cityName", _cityName); if (!CorporationConstants.Cities.includes(cityName)) throw new Error("Invalid city name"); const corporation = getCorporation(); const division = getDivision(divisionName); NewCity(corporation, division, cityName); }, - unlockUpgrade: function (aupgradeName: any): void { + unlockUpgrade: function (_upgradeName: unknown): void { checkAccess("unlockUpgrade"); - const upgradeName = helper.string("unlockUpgrade", "upgradeName", aupgradeName); + const upgradeName = helper.string("unlockUpgrade", "upgradeName", _upgradeName); const corporation = getCorporation(); const upgrade = Object.values(CorporationUnlockUpgrades).find((upgrade) => upgrade[2] === upgradeName); if (upgrade === undefined) throw new Error(`No upgrade named '${upgradeName}'`); UnlockUpgrade(corporation, upgrade); }, - levelUpgrade: function (aupgradeName: any): void { + levelUpgrade: function (_upgradeName: unknown): void { checkAccess("levelUpgrade"); - const upgradeName = helper.string("levelUpgrade", "upgradeName", aupgradeName); + const upgradeName = helper.string("levelUpgrade", "upgradeName", _upgradeName); const corporation = getCorporation(); const upgrade = Object.values(CorporationUpgrades).find((upgrade) => upgrade[4] === upgradeName); if (upgrade === undefined) throw new Error(`No upgrade named '${upgradeName}'`); LevelUpgrade(corporation, upgrade); }, - issueDividends: function (apercent: any): void { + issueDividends: function (_percent: unknown): void { checkAccess("issueDividends"); - const percent = helper.number("issueDividends", "percent", apercent); - if (percent < 0 || percent > 100) throw new Error("Invalid value for percent field! Must be numeric, greater than 0, and less than 100"); + const percent = helper.number("issueDividends", "percent", _percent); + if (percent < 0 || percent > 100) + throw new Error("Invalid value for percent field! Must be numeric, greater than 0, and less than 100"); const corporation = getCorporation(); if (!corporation.public) throw helper.makeRuntimeErrorMsg(`corporation.issueDividends`, `Your company has not gone public!`); @@ -759,9 +826,9 @@ export function NetscriptCorporation( // If you modify these objects you will affect them for real, it's not // copies. - getDivision: function (adivisionName: any): NSDivision { + getDivision: function (_divisionName: unknown): NSDivision { checkAccess("getDivision"); - const divisionName = helper.string("getDivision", "divisionName", adivisionName); + const divisionName = helper.string("getDivision", "divisionName", _divisionName); const division = getDivision(divisionName); return getSafeDivision(division); }, @@ -783,33 +850,34 @@ export function NetscriptCorporation( divisions: corporation.divisions.map((division): NSDivision => getSafeDivision(division)), }; }, - createCorporation: function (acorporationName: string, selfFund = true): boolean { - const corporationName = helper.string("createCorporation", "corporationName", acorporationName); + createCorporation: function (_corporationName: unknown, _selfFund: unknown = true): boolean { + const corporationName = helper.string("createCorporation", "corporationName", _corporationName); + const selfFund = helper.boolean(_selfFund); return createCorporation(corporationName, selfFund); }, - hasUnlockUpgrade: function (aupgradeName: any): boolean { + hasUnlockUpgrade: function (_upgradeName: unknown): boolean { checkAccess("hasUnlockUpgrade"); - const upgradeName = helper.string("hasUnlockUpgrade", "upgradeName", aupgradeName); + const upgradeName = helper.string("hasUnlockUpgrade", "upgradeName", _upgradeName); return hasUnlockUpgrade(upgradeName); }, - getUnlockUpgradeCost: function (aupgradeName: any): number { + getUnlockUpgradeCost: function (_upgradeName: unknown): number { checkAccess("getUnlockUpgradeCost"); - const upgradeName = helper.string("getUnlockUpgradeCost", "upgradeName", aupgradeName); + const upgradeName = helper.string("getUnlockUpgradeCost", "upgradeName", _upgradeName); return getUnlockUpgradeCost(upgradeName); }, - getUpgradeLevel: function (aupgradeName: any): number { + getUpgradeLevel: function (_upgradeName: unknown): number { checkAccess("hasUnlockUpgrade"); - const upgradeName = helper.string("getUpgradeLevel", "upgradeName", aupgradeName); + const upgradeName = helper.string("getUpgradeLevel", "upgradeName", _upgradeName); return getUpgradeLevel(upgradeName); }, - getUpgradeLevelCost: function (aupgradeName: any): number { + getUpgradeLevelCost: function (_upgradeName: unknown): number { checkAccess("getUpgradeLevelCost"); - const upgradeName = helper.string("getUpgradeLevelCost", "upgradeName", aupgradeName); + const upgradeName = helper.string("getUpgradeLevelCost", "upgradeName", _upgradeName); return getUpgradeLevelCost(upgradeName); }, - getExpandIndustryCost: function (aindustryName: any): number { + getExpandIndustryCost: function (_industryName: unknown): number { checkAccess("getExpandIndustryCost"); - const industryName = helper.string("getExpandIndustryCost", "industryName", aindustryName); + const industryName = helper.string("getExpandIndustryCost", "industryName", _industryName); return getExpandIndustryCost(industryName); }, getExpandCityCost: function (): number { @@ -824,31 +892,31 @@ export function NetscriptCorporation( checkAccess("acceptInvestmentOffer"); return acceptInvestmentOffer(); }, - goPublic: function (anumShares: any): boolean { + goPublic: function (_numShares: unknown): boolean { checkAccess("acceptInvestmentOffer"); - const numShares = helper.number("goPublic", "numShares", anumShares); + const numShares = helper.number("goPublic", "numShares", _numShares); return goPublic(numShares); }, - sellShares: function (anumShares: any): number { + sellShares: function (_numShares: unknown): number { checkAccess("acceptInvestmentOffer"); - const numShares = helper.number("sellStock", "numShares", anumShares); + const numShares = helper.number("sellStock", "numShares", _numShares); return SellShares(getCorporation(), player, numShares); }, - buyBackShares: function (anumShares: any): boolean { + buyBackShares: function (_numShares: unknown): boolean { checkAccess("acceptInvestmentOffer"); - const numShares = helper.number("buyStock", "numShares", anumShares); + const numShares = helper.number("buyStock", "numShares", _numShares); return BuyBackShares(getCorporation(), player, numShares); }, - bribe: function (afactionName: string, aamountCash: any, aamountShares: any): boolean { + bribe: function (_factionName: unknown, _amountCash: unknown, _amountShares: unknown): boolean { checkAccess("bribe"); - const factionName = helper.string("bribe", "factionName", afactionName); - const amountCash = helper.number("bribe", "amountCash", aamountCash); - const amountShares = helper.number("bribe", "amountShares", aamountShares); + const factionName = helper.string("bribe", "factionName", _factionName); + const amountCash = helper.number("bribe", "amountCash", _amountCash); + const amountShares = helper.number("bribe", "amountShares", _amountShares); return bribe(factionName, amountCash, amountShares); }, getBonusTime: function (): number { checkAccess("getBonusTime"); return Math.round(getCorporation().storedCycles / 5) * 1000; - } + }, }; } From 4d9a8e7bba675dc8dd4ab2d9057018ca3ed435fe Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Tue, 29 Mar 2022 20:29:05 -0400 Subject: [PATCH 06/12] unknown-ify coding contract API. --- src/NetscriptFunctions/CodingContract.ts | 36 ++++++++++++++++-------- src/Server/BaseServer.ts | 2 +- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/src/NetscriptFunctions/CodingContract.ts b/src/NetscriptFunctions/CodingContract.ts index 11dff9eed..ef908e83a 100644 --- a/src/NetscriptFunctions/CodingContract.ts +++ b/src/NetscriptFunctions/CodingContract.ts @@ -4,14 +4,14 @@ import { IPlayer } from "../PersonObjects/IPlayer"; import { getRamCost } from "../Netscript/RamCostGenerator"; import { is2DArray } from "../utils/helpers/is2DArray"; import { CodingContract } from "../CodingContracts"; -import { CodingContract as ICodingContract } from "../ScriptEditor/NetscriptDefinitions"; +import { CodingAttemptOptions, CodingContract as ICodingContract } from "../ScriptEditor/NetscriptDefinitions"; export function NetscriptCodingContract( player: IPlayer, workerScript: WorkerScript, helper: INetscriptHelper, ): ICodingContract { - const getCodingContract = function (func: any, hostname: any, filename: any): CodingContract { + const getCodingContract = function (func: string, hostname: string, filename: string): CodingContract { const server = helper.getServer(hostname, func); const contract = server.getContract(filename); if (contract == null) { @@ -27,10 +27,12 @@ export function NetscriptCodingContract( return { attempt: function ( answer: any, - filename: any, - hostname: any = workerScript.hostname, - { returnReward }: any = {}, + _filename: unknown, + _hostname: unknown = workerScript.hostname, + { returnReward }: CodingAttemptOptions = { returnReward: false }, ): boolean | string { + const filename = helper.string("attempt", "filename", _filename); + const hostname = helper.string("attempt", "hostname", _hostname); helper.updateDynamicRam("attempt", getRamCost(player, "codingcontract", "attempt")); const contract = getCodingContract("attempt", hostname, filename); @@ -53,7 +55,10 @@ export function NetscriptCodingContract( const serv = helper.getServer(hostname, "codingcontract.attempt"); if (contract.isSolution(answer)) { const reward = player.gainCodingContractReward(creward, contract.getDifficulty()); - workerScript.log("codingcontract.attempt", () => `Successfully completed Coding Contract '${filename}'. Reward: ${reward}`); + workerScript.log( + "codingcontract.attempt", + () => `Successfully completed Coding Contract '${filename}'. Reward: ${reward}`, + ); serv.removeContract(filename); return returnReward ? reward : true; } else { @@ -68,7 +73,8 @@ export function NetscriptCodingContract( workerScript.log( "codingcontract.attempt", () => - `Coding Contract attempt '${filename}' failed. ${contract.getMaxNumTries() - contract.tries + `Coding Contract attempt '${filename}' failed. ${ + contract.getMaxNumTries() - contract.tries } attempts remaining.`, ); } @@ -76,12 +82,16 @@ export function NetscriptCodingContract( return returnReward ? "" : false; } }, - getContractType: function (filename: any, hostname: any = workerScript.hostname): string { + getContractType: function (_filename: unknown, _hostname: unknown = workerScript.hostname): string { + const filename = helper.string("getContractType", "filename", _filename); + const hostname = helper.string("getContractType", "hostname", _hostname); helper.updateDynamicRam("getContractType", getRamCost(player, "codingcontract", "getContractType")); const contract = getCodingContract("getContractType", hostname, filename); return contract.getType(); }, - getData: function (filename: any, hostname: any = workerScript.hostname): any { + getData: function (_filename: unknown, _hostname: unknown = workerScript.hostname): any { + const filename = helper.string("getContractType", "filename", _filename); + const hostname = helper.string("getContractType", "hostname", _hostname); helper.updateDynamicRam("getData", getRamCost(player, "codingcontract", "getData")); const contract = getCodingContract("getData", hostname, filename); const data = contract.getData(); @@ -101,12 +111,16 @@ export function NetscriptCodingContract( return data; } }, - getDescription: function (filename: any, hostname: any = workerScript.hostname): string { + getDescription: function (_filename: unknown, _hostname: unknown = workerScript.hostname): string { + const filename = helper.string("getDescription", "filename", _filename); + const hostname = helper.string("getDescription", "hostname", _hostname); helper.updateDynamicRam("getDescription", getRamCost(player, "codingcontract", "getDescription")); const contract = getCodingContract("getDescription", hostname, filename); return contract.getDescription(); }, - getNumTriesRemaining: function (filename: any, hostname: any = workerScript.hostname): number { + getNumTriesRemaining: function (_filename: unknown, _hostname: unknown = workerScript.hostname): number { + const filename = helper.string("getNumTriesRemaining", "filename", _filename); + const hostname = helper.string("getNumTriesRemaining", "hostname", _hostname); helper.updateDynamicRam("getNumTriesRemaining", getRamCost(player, "codingcontract", "getNumTriesRemaining")); const contract = getCodingContract("getNumTriesRemaining", hostname, filename); return contract.getMaxNumTries() - contract.tries; diff --git a/src/Server/BaseServer.ts b/src/Server/BaseServer.ts index af7a80628..faa0d3c35 100644 --- a/src/Server/BaseServer.ts +++ b/src/Server/BaseServer.ts @@ -163,7 +163,7 @@ export class BaseServer { return false; } - removeContract(contract: CodingContract): void { + removeContract(contract: CodingContract | string): void { if (contract instanceof CodingContract) { this.contracts = this.contracts.filter((c) => { return c.fn !== contract.fn; From b3a52c6224ba11f9666fb7087d352c28008d9432 Mon Sep 17 00:00:00 2001 From: phyzical Date: Wed, 30 Mar 2022 08:36:27 +0800 Subject: [PATCH 07/12] one minor compile issue --- src/Faction/ui/AugmentationsPage.tsx | 5 ++++- src/NetscriptFunctions/Singularity.ts | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Faction/ui/AugmentationsPage.tsx b/src/Faction/ui/AugmentationsPage.tsx index af1b73b85..89eb9f7f0 100644 --- a/src/Faction/ui/AugmentationsPage.tsx +++ b/src/Faction/ui/AugmentationsPage.tsx @@ -43,6 +43,7 @@ export function AugmentationsPage(props: IProps): React.ReactElement { function getAugs(): string[] { if (isPlayersGang) { + // TODO: this code is duplicated in getAugmentationsFromFaction DRY let augs = Object.values(Augmentations); // Remove special augs. @@ -53,7 +54,9 @@ export function AugmentationsPage(props: IProps): React.ReactElement { augs = augs.filter((a) => a.factions.length > 1 || props.faction.augmentations.includes(a.name)); // Remove blacklisted augs. - const blacklist = [AugmentationNames.NeuroFluxGovernor, AugmentationNames.TheRedPill]; + const blacklist = [AugmentationNames.NeuroFluxGovernor, AugmentationNames.TheRedPill].map( + (augmentation) => augmentation as string, + ); augs = augs.filter((a) => !blacklist.includes(a.name)); } diff --git a/src/NetscriptFunctions/Singularity.ts b/src/NetscriptFunctions/Singularity.ts index 354e94b84..73581c89e 100644 --- a/src/NetscriptFunctions/Singularity.ts +++ b/src/NetscriptFunctions/Singularity.ts @@ -130,7 +130,9 @@ export function NetscriptSingularity( augs = augs.filter((a) => a.factions.length > 1 || Factions[facName].augmentations.includes(a.name)); // Remove blacklisted augs. - const blacklist = [AugmentationNames.NeuroFluxGovernor, AugmentationNames.TheRedPill]; + const blacklist = [AugmentationNames.NeuroFluxGovernor, AugmentationNames.TheRedPill].map( + (augmentation) => augmentation as string, + ); augs = augs.filter((a) => !blacklist.includes(a.name)); } From cd1f01846f35c8038ec23e0d563920b3ac1cd68c Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Tue, 29 Mar 2022 20:44:27 -0400 Subject: [PATCH 08/12] unknown-ify bladeburner API. --- src/NetscriptFunctions/Bladeburner.ts | 89 +++++++++++++++++++-------- 1 file changed, 63 insertions(+), 26 deletions(-) diff --git a/src/NetscriptFunctions/Bladeburner.ts b/src/NetscriptFunctions/Bladeburner.ts index c04e6ccfb..f6e669665 100644 --- a/src/NetscriptFunctions/Bladeburner.ts +++ b/src/NetscriptFunctions/Bladeburner.ts @@ -5,13 +5,14 @@ import { Bladeburner } from "../Bladeburner/Bladeburner"; import { getRamCost } from "../Netscript/RamCostGenerator"; import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers"; import { Bladeburner as INetscriptBladeburner, BladeburnerCurAction } from "../ScriptEditor/NetscriptDefinitions"; +import { IAction } from "src/Bladeburner/IAction"; export function NetscriptBladeburner( player: IPlayer, workerScript: WorkerScript, helper: INetscriptHelper, ): INetscriptBladeburner { - const checkBladeburnerAccess = function (func: any, skipjoined: any = false): void { + const checkBladeburnerAccess = function (func: string, skipjoined = false): void { const bladeburner = player.bladeburner; if (bladeburner === null) throw new Error("Must have joined bladeburner"); const apiAccess = @@ -32,7 +33,7 @@ export function NetscriptBladeburner( } }; - const checkBladeburnerCity = function (func: any, city: any): void { + const checkBladeburnerCity = function (func: string, city: string): void { const bladeburner = player.bladeburner; if (bladeburner === null) throw new Error("Must have joined bladeburner"); if (!bladeburner.cities.hasOwnProperty(city)) { @@ -40,7 +41,7 @@ export function NetscriptBladeburner( } }; - const getBladeburnerActionObject = function (func: any, type: any, name: any): any { + const getBladeburnerActionObject = function (func: string, type: string, name: string): IAction { const bladeburner = player.bladeburner; if (bladeburner === null) throw new Error("Must have joined bladeburner"); const actionId = bladeburner.getActionIdFromTypeAndName(type, name); @@ -77,10 +78,11 @@ export function NetscriptBladeburner( if (bladeburner === null) throw new Error("Should not be called without Bladeburner"); return bladeburner.getBlackOpNamesNetscriptFn(); }, - getBlackOpRank: function (name: any = ""): number { + getBlackOpRank: function (_blackOpName: unknown): number { + const blackOpName = helper.string("getBlackOpRank", "blackOpName", _blackOpName); helper.updateDynamicRam("getBlackOpRank", getRamCost(player, "bladeburner", "getBlackOpRank")); checkBladeburnerAccess("getBlackOpRank"); - const action: any = getBladeburnerActionObject("getBlackOpRank", "blackops", name); + const action: any = getBladeburnerActionObject("getBlackOpRank", "blackops", blackOpName); return action.reqdRank; }, getGeneralActionNames: function (): string[] { @@ -97,7 +99,9 @@ export function NetscriptBladeburner( if (bladeburner === null) throw new Error("Should not be called without Bladeburner"); return bladeburner.getSkillNamesNetscriptFn(); }, - startAction: function (type: any = "", name: any = ""): boolean { + startAction: function (_type: unknown, _name: unknown): boolean { + const type = helper.string("startAction", "type", _type); + const name = helper.string("startAction", "name", _name); helper.updateDynamicRam("startAction", getRamCost(player, "bladeburner", "startAction")); checkBladeburnerAccess("startAction"); const bladeburner = player.bladeburner; @@ -122,7 +126,9 @@ export function NetscriptBladeburner( if (bladeburner === null) throw new Error("Should not be called without Bladeburner"); return bladeburner.getTypeAndNameFromActionId(bladeburner.action); }, - getActionTime: function (type: any = "", name: any = ""): number { + getActionTime: function (_type: unknown, _name: unknown): number { + const type = helper.string("getActionTime", "type", _type); + const name = helper.string("getActionTime", "name", _name); helper.updateDynamicRam("getActionTime", getRamCost(player, "bladeburner", "getActionTime")); checkBladeburnerAccess("getActionTime"); const bladeburner = player.bladeburner; @@ -133,7 +139,9 @@ export function NetscriptBladeburner( throw helper.makeRuntimeErrorMsg("bladeburner.getActionTime", e); } }, - getActionEstimatedSuccessChance: function (type: any = "", name: any = ""): [number, number] { + getActionEstimatedSuccessChance: function (_type: unknown, _name: unknown): [number, number] { + const type = helper.string("getActionEstimatedSuccessChance", "type", _type); + const name = helper.string("getActionEstimatedSuccessChance", "name", _name); helper.updateDynamicRam( "getActionEstimatedSuccessChance", getRamCost(player, "bladeburner", "getActionEstimatedSuccessChance"), @@ -147,7 +155,10 @@ export function NetscriptBladeburner( throw helper.makeRuntimeErrorMsg("bladeburner.getActionEstimatedSuccessChance", e); } }, - getActionRepGain: function (type: any = "", name: any = "", level: any): number { + getActionRepGain: function (_type: unknown, _name: unknown, _level: unknown): number { + const type = helper.string("getActionRepGain", "type", _type); + const name = helper.string("getActionRepGain", "name", _name); + const level = helper.number("getActionRepGain", "level", _level); helper.updateDynamicRam("getActionRepGain", getRamCost(player, "bladeburner", "getActionRepGain")); checkBladeburnerAccess("getActionRepGain"); const action = getBladeburnerActionObject("getActionRepGain", type, name); @@ -160,7 +171,9 @@ export function NetscriptBladeburner( return action.rankGain * rewardMultiplier * BitNodeMultipliers.BladeburnerRank; }, - getActionCountRemaining: function (type: any = "", name: any = ""): number { + getActionCountRemaining: function (_type: unknown, _name: unknown): number { + const type = helper.string("getActionCountRemaining", "type", _type); + const name = helper.string("getActionCountRemaining", "name", _name); helper.updateDynamicRam("getActionCountRemaining", getRamCost(player, "bladeburner", "getActionCountRemaining")); checkBladeburnerAccess("getActionCountRemaining"); const bladeburner = player.bladeburner; @@ -171,31 +184,43 @@ export function NetscriptBladeburner( throw helper.makeRuntimeErrorMsg("bladeburner.getActionCountRemaining", e); } }, - getActionMaxLevel: function (type: any = "", name: any = ""): number { + getActionMaxLevel: function (_type: unknown, _name: unknown): number { + const type = helper.string("getActionMaxLevel", "type", _type); + const name = helper.string("getActionMaxLevel", "name", _name); helper.updateDynamicRam("getActionMaxLevel", getRamCost(player, "bladeburner", "getActionMaxLevel")); checkBladeburnerAccess("getActionMaxLevel"); const action = getBladeburnerActionObject("getActionMaxLevel", type, name); return action.maxLevel; }, - getActionCurrentLevel: function (type: any = "", name: any = ""): number { + getActionCurrentLevel: function (_type: unknown, _name: unknown): number { + const type = helper.string("getActionCurrentLevel", "type", _type); + const name = helper.string("getActionCurrentLevel", "name", _name); helper.updateDynamicRam("getActionCurrentLevel", getRamCost(player, "bladeburner", "getActionCurrentLevel")); checkBladeburnerAccess("getActionCurrentLevel"); const action = getBladeburnerActionObject("getActionCurrentLevel", type, name); return action.level; }, - getActionAutolevel: function (type: any = "", name: any = ""): boolean { + getActionAutolevel: function (_type: unknown, _name: unknown): boolean { + const type = helper.string("getActionAutolevel", "type", _type); + const name = helper.string("getActionAutolevel", "name", _name); helper.updateDynamicRam("getActionAutolevel", getRamCost(player, "bladeburner", "getActionAutolevel")); checkBladeburnerAccess("getActionAutolevel"); const action = getBladeburnerActionObject("getActionCurrentLevel", type, name); return action.autoLevel; }, - setActionAutolevel: function (type: any = "", name: any = "", autoLevel: any = true): void { + setActionAutolevel: function (_type: unknown, _name: unknown, _autoLevel: unknown = true): void { + const type = helper.string("setActionAutolevel", "type", _type); + const name = helper.string("setActionAutolevel", "name", _name); + const autoLevel = helper.boolean(_autoLevel); helper.updateDynamicRam("setActionAutolevel", getRamCost(player, "bladeburner", "setActionAutolevel")); checkBladeburnerAccess("setActionAutolevel"); const action = getBladeburnerActionObject("setActionAutolevel", type, name); action.autoLevel = autoLevel; }, - setActionLevel: function (type: any = "", name: any = "", level: any = 1): void { + setActionLevel: function (_type: unknown, _name: unknown, _level: unknown = 1): void { + const type = helper.string("setActionLevel", "type", _type); + const name = helper.string("setActionLevel", "name", _name); + const level = helper.number("setActionLevel", "level", _level); helper.updateDynamicRam("setActionLevel", getRamCost(player, "bladeburner", "setActionLevel")); checkBladeburnerAccess("setActionLevel"); const action = getBladeburnerActionObject("setActionLevel", type, name); @@ -221,7 +246,8 @@ export function NetscriptBladeburner( if (bladeburner === null) throw new Error("Should not be called without Bladeburner"); return bladeburner.skillPoints; }, - getSkillLevel: function (skillName: any = ""): number { + getSkillLevel: function (_skillName: unknown): number { + const skillName = helper.string("getSkillLevel", "skillName", _skillName); helper.updateDynamicRam("getSkillLevel", getRamCost(player, "bladeburner", "getSkillLevel")); checkBladeburnerAccess("getSkillLevel"); const bladeburner = player.bladeburner; @@ -232,7 +258,8 @@ export function NetscriptBladeburner( throw helper.makeRuntimeErrorMsg("bladeburner.getSkillLevel", e); } }, - getSkillUpgradeCost: function (skillName: any = ""): number { + getSkillUpgradeCost: function (_skillName: unknown): number { + const skillName = helper.string("getSkillUpgradeCost", "skillName", _skillName); helper.updateDynamicRam("getSkillUpgradeCost", getRamCost(player, "bladeburner", "getSkillUpgradeCost")); checkBladeburnerAccess("getSkillUpgradeCost"); const bladeburner = player.bladeburner; @@ -243,7 +270,8 @@ export function NetscriptBladeburner( throw helper.makeRuntimeErrorMsg("bladeburner.getSkillUpgradeCost", e); } }, - upgradeSkill: function (skillName: any): boolean { + upgradeSkill: function (_skillName: unknown): boolean { + const skillName = helper.string("upgradeSkill", "skillName", _skillName); helper.updateDynamicRam("upgradeSkill", getRamCost(player, "bladeburner", "upgradeSkill")); checkBladeburnerAccess("upgradeSkill"); const bladeburner = player.bladeburner; @@ -254,7 +282,9 @@ export function NetscriptBladeburner( throw helper.makeRuntimeErrorMsg("bladeburner.upgradeSkill", e); } }, - getTeamSize: function (type: any = "", name: any = ""): number { + getTeamSize: function (_type: unknown, _name: unknown): number { + const type = helper.string("getTeamSize", "type", _type); + const name = helper.string("getTeamSize", "name", _name); helper.updateDynamicRam("getTeamSize", getRamCost(player, "bladeburner", "getTeamSize")); checkBladeburnerAccess("getTeamSize"); const bladeburner = player.bladeburner; @@ -265,7 +295,10 @@ export function NetscriptBladeburner( throw helper.makeRuntimeErrorMsg("bladeburner.getTeamSize", e); } }, - setTeamSize: function (type: any = "", name: any = "", size: any): number { + setTeamSize: function (_type: unknown, _name: unknown, _size: unknown): number { + const type = helper.string("setTeamSize", "type", _type); + const name = helper.string("setTeamSize", "name", _name); + const size = helper.number("setTeamSize", "size", _size); helper.updateDynamicRam("setTeamSize", getRamCost(player, "bladeburner", "setTeamSize")); checkBladeburnerAccess("setTeamSize"); const bladeburner = player.bladeburner; @@ -276,7 +309,8 @@ export function NetscriptBladeburner( throw helper.makeRuntimeErrorMsg("bladeburner.setTeamSize", e); } }, - getCityEstimatedPopulation: function (cityName: any): number { + getCityEstimatedPopulation: function (_cityName: unknown): number { + const cityName = helper.string("getCityEstimatedPopulation", "cityName", _cityName); helper.updateDynamicRam( "getCityEstimatedPopulation", getRamCost(player, "bladeburner", "getCityEstimatedPopulation"), @@ -287,7 +321,8 @@ export function NetscriptBladeburner( if (bladeburner === null) throw new Error("Should not be called without Bladeburner"); return bladeburner.cities[cityName].popEst; }, - getCityCommunities: function (cityName: any): number { + getCityCommunities: function (_cityName: unknown): number { + const cityName = helper.string("getCityCommunities", "cityName", _cityName); helper.updateDynamicRam("getCityCommunities", getRamCost(player, "bladeburner", "getCityCommunities")); checkBladeburnerAccess("getCityCommunities"); checkBladeburnerCity("getCityCommunities", cityName); @@ -295,7 +330,8 @@ export function NetscriptBladeburner( if (bladeburner === null) throw new Error("Should not be called without Bladeburner"); return bladeburner.cities[cityName].comms; }, - getCityChaos: function (cityName: any): number { + getCityChaos: function (_cityName: unknown): number { + const cityName = helper.string("getCityChaos", "cityName", _cityName); helper.updateDynamicRam("getCityChaos", getRamCost(player, "bladeburner", "getCityChaos")); checkBladeburnerAccess("getCityChaos"); checkBladeburnerCity("getCityChaos", cityName); @@ -310,13 +346,14 @@ export function NetscriptBladeburner( if (bladeburner === null) throw new Error("Should not be called without Bladeburner"); return bladeburner.city; }, - switchCity: function (cityName: any): boolean { + switchCity: function (_cityName: unknown): boolean { + const cityName = helper.string("switchCity", "cityName", _cityName); helper.updateDynamicRam("switchCity", getRamCost(player, "bladeburner", "switchCity")); checkBladeburnerAccess("switchCity"); checkBladeburnerCity("switchCity", cityName); const bladeburner = player.bladeburner; if (bladeburner === null) throw new Error("Should not be called without Bladeburner"); - return (bladeburner.city = cityName); + return bladeburner.city === cityName; }, getStamina: function (): [number, number] { helper.updateDynamicRam("getStamina", getRamCost(player, "bladeburner", "getStamina")); @@ -365,7 +402,7 @@ export function NetscriptBladeburner( checkBladeburnerAccess("getBonusTime"); const bladeburner = player.bladeburner; if (bladeburner === null) throw new Error("Should not be called without Bladeburner"); - return (Math.round(bladeburner.storedCycles / 5))*1000; + return Math.round(bladeburner.storedCycles / 5) * 1000; }, }; } From aa0425a23d3da3f4b0f19442e9994bef21647a56 Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Tue, 29 Mar 2022 21:42:27 -0400 Subject: [PATCH 09/12] unknown-ify half the basic API. --- src/BitNode/BitNodeMultipliers.ts | 5 + src/NetscriptFunctions.ts | 257 ++++++++++++++------- src/ScriptEditor/NetscriptDefinitions.d.ts | 2 +- 3 files changed, 178 insertions(+), 86 deletions(-) diff --git a/src/BitNode/BitNodeMultipliers.ts b/src/BitNode/BitNodeMultipliers.ts index cbcdf2042..ac78815b8 100644 --- a/src/BitNode/BitNodeMultipliers.ts +++ b/src/BitNode/BitNodeMultipliers.ts @@ -232,6 +232,11 @@ interface IBitNodeMultipliers { */ WorldDaemonDifficulty: number; + /** + * Influences corporation dividends. + */ + CorporationSoftCap: number; + // Index signature [key: string]: number; } diff --git a/src/NetscriptFunctions.ts b/src/NetscriptFunctions.ts index 1bd16ab67..e95042c24 100644 --- a/src/NetscriptFunctions.ts +++ b/src/NetscriptFunctions.ts @@ -80,6 +80,12 @@ import { Bladeburner as IBladeburner, Stanek as IStanek, SourceFileLvl, + BasicHGWOptions, + ProcessInfo, + HackingMultipliers, + HacknetMultipliers, + BitNodeMultipliers as IBNMults, + Server as IServerDef, } from "./ScriptEditor/NetscriptDefinitions"; import { NetscriptSingularity } from "./NetscriptFunctions/Singularity"; @@ -162,9 +168,9 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { * is not specified. */ const getRunningScript = function ( - fn: any, - hostname: any, - callingFnName: any, + fn: string, + hostname: string, + callingFnName: string, scriptArgs: any, ): RunningScript | null { if (typeof callingFnName !== "string" || callingFnName === "") { @@ -193,7 +199,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { return workerScript.scriptRef; }; - const getRunningScriptByPid = function (pid: any, callingFnName: any): RunningScript | null { + const getRunningScriptByPid = function (pid: number, callingFnName: string): RunningScript | null { if (typeof callingFnName !== "string" || callingFnName === "") { callingFnName = "getRunningScriptgetRunningScriptByPid"; } @@ -213,7 +219,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { * @param {any[]} scriptArgs - Running script's arguments * @returns {string} Error message to print to logs */ - const getCannotFindRunningScriptErrorMessage = function (fn: any, hostname: any, scriptArgs: any): string { + const getCannotFindRunningScriptErrorMessage = function (fn: string, hostname: string, scriptArgs: any): string { if (!Array.isArray(scriptArgs)) { scriptArgs = []; } @@ -228,7 +234,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { * @param {string} callingFn - Name of calling function. For logging purposes * @returns {boolean} True if the server is a Hacknet Server, false otherwise */ - const failOnHacknetServer = function (server: any, callingFn: any = ""): boolean { + const failOnHacknetServer = function (server: BaseServer, callingFn = ""): boolean { if (server instanceof HacknetServer) { workerScript.log(callingFn, () => `Does not work on Hacknet Servers`); return true; @@ -316,7 +322,11 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { } }; - const hack = function (hostname: any, manual: any, { threads: requestedThreads, stock }: any = {}): Promise { + const hack = function ( + hostname: string, + manual: boolean, + { threads: requestedThreads, stock }: any = {}, + ): Promise { if (hostname === undefined) { throw makeRuntimeErrorMsg("hack", "Takes 1 argument."); } @@ -447,7 +457,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { getServer: safeGetServer, checkSingularityAccess: checkSingularityAccess, hack: hack, - getValidPort: (funcName: string, port: any): IPort => { + getValidPort: (funcName: string, port: number): IPort => { if (isNaN(port)) { throw makeRuntimeErrorMsg( funcName, @@ -501,7 +511,8 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { hacknet: hacknet, sprintf: sprintf, vsprintf: vsprintf, - scan: function (hostname: any = workerScript.hostname): any { + scan: function (_hostname: unknown = workerScript.hostname): string[] { + const hostname = helper.string("scan", "hostname", _hostname); updateDynamicRam("scan", getRamCost(Player, "scan")); const server = safeGetServer(hostname, "scan"); const out = []; @@ -515,11 +526,14 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { workerScript.log("scan", () => `returned ${server.serversOnNetwork.length} connections for ${server.hostname}`); return out; }, - hack: function (hostname: any, { threads: requestedThreads, stock }: any = {}): any { + hack: function (_hostname: unknown, { threads: requestedThreads, stock }: BasicHGWOptions = {}): Promise { + const hostname = helper.string("hack", "hostname", _hostname); updateDynamicRam("hack", getRamCost(Player, "hack")); return hack(hostname, false, { threads: requestedThreads, stock: stock }); }, - hackAnalyzeThreads: function (hostname: any, hackAmount: any): any { + hackAnalyzeThreads: function (_hostname: unknown, _hackAmount: unknown): number { + const hostname = helper.string("hackAnalyzeThreads", "hostname", _hostname); + const hackAmount = helper.number("hackAnalyzeThreads", "hackAmount", _hackAmount); updateDynamicRam("hackAnalyzeThreads", getRamCost(Player, "hackAnalyzeThreads")); // Check argument validity @@ -549,43 +563,48 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { return hackAmount / Math.floor(server.moneyAvailable * percentHacked); }, - hackAnalyze: function (hostname: any): any { + hackAnalyze: function (_hostname: unknown): number { + const hostname = helper.string("hackAnalyze", "hostname", _hostname); updateDynamicRam("hackAnalyze", getRamCost(Player, "hackAnalyze")); const server = safeGetServer(hostname, "hackAnalyze"); if (!(server instanceof Server)) { workerScript.log("hackAnalyze", () => "Cannot be executed on this server."); - return false; + return 0; } return calculatePercentMoneyHacked(server, Player); }, - hackAnalyzeSecurity: function (threads: any): number { + hackAnalyzeSecurity: function (_threads: unknown): number { + const threads = helper.number("hackAnalyzeSecurity", "threads", _threads); updateDynamicRam("hackAnalyzeSecurity", getRamCost(Player, "hackAnalyzeSecurity")); return CONSTANTS.ServerFortifyAmount * threads; }, - hackAnalyzeChance: function (hostname: any): any { + hackAnalyzeChance: function (_hostname: unknown): number { + const hostname = helper.string("hackAnalyzeChance", "hostname", _hostname); updateDynamicRam("hackAnalyzeChance", getRamCost(Player, "hackAnalyzeChance")); const server = safeGetServer(hostname, "hackAnalyzeChance"); if (!(server instanceof Server)) { workerScript.log("hackAnalyzeChance", () => "Cannot be executed on this server."); - return false; + return 0; } return calculateHackingChance(server, Player); }, - sleep: function (time: any): any { + sleep: async function (_time: unknown = 0): Promise { + const time = helper.number("sleep", "time", _time); updateDynamicRam("sleep", getRamCost(Player, "sleep")); if (time === undefined) { throw makeRuntimeErrorMsg("sleep", "Takes 1 argument."); } workerScript.log("sleep", () => `Sleeping for ${time} milliseconds`); return netscriptDelay(time, workerScript).then(function () { - return Promise.resolve(true); + return Promise.resolve(); }); }, - asleep: function (time: any): any { + asleep: function (_time: unknown = 0): Promise { + const time = helper.number("asleep", "time", _time); updateDynamicRam("asleep", getRamCost(Player, "asleep")); if (time === undefined) { throw makeRuntimeErrorMsg("asleep", "Takes 1 argument."); @@ -593,16 +612,24 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { workerScript.log("asleep", () => `Sleeping for ${time} milliseconds`); return new Promise((resolve) => setTimeout(resolve, time)); }, - grow: function (hostname: any, { threads: requestedThreads, stock }: any = {}): any { + grow: async function ( + _hostname: unknown, + { threads: requestedThreads, stock }: BasicHGWOptions = {}, + ): Promise { + const hostname = helper.string("grow", "hostname", _hostname); updateDynamicRam("grow", getRamCost(Player, "grow")); - const threads = resolveNetscriptRequestedThreads(workerScript, "grow", requestedThreads); + const threads = resolveNetscriptRequestedThreads( + workerScript, + "grow", + requestedThreads ?? workerScript.scriptRef.threads, + ); if (hostname === undefined) { throw makeRuntimeErrorMsg("grow", "Takes 1 argument."); } const server = safeGetServer(hostname, "grow"); if (!(server instanceof Server)) { workerScript.log("grow", () => "Cannot be executed on this server."); - return false; + return Promise.resolve(0); } const host = GetServer(workerScript.hostname); @@ -648,14 +675,17 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { return Promise.resolve(moneyAfter / moneyBefore); }); }, - growthAnalyze: function (hostname: any, growth: any, cores: any = 1): any { + growthAnalyze: function (_hostname: unknown, _growth: unknown, _cores: unknown = 1): number { + const hostname = helper.string("growthAnalyze", "hostname", _hostname); + const growth = helper.number("growthAnalyze", "growth", _growth); + const cores = helper.number("growthAnalyze", "cores", _cores); updateDynamicRam("growthAnalyze", getRamCost(Player, "growthAnalyze")); // Check argument validity const server = safeGetServer(hostname, "growthAnalyze"); if (!(server instanceof Server)) { workerScript.log("growthAnalyze", () => "Cannot be executed on this server."); - return false; + return 0; } if (typeof growth !== "number" || isNaN(growth) || growth < 1 || !isFinite(growth)) { throw makeRuntimeErrorMsg("growthAnalyze", `Invalid argument: growth must be numeric and >= 1, is ${growth}.`); @@ -663,20 +693,26 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { return numCycleForGrowth(server, Number(growth), Player, cores); }, - growthAnalyzeSecurity: function (threads: any): number { + growthAnalyzeSecurity: function (_threads: unknown): number { + const threads = helper.number("growthAnalyzeSecurity", "threads", _threads); updateDynamicRam("growthAnalyzeSecurity", getRamCost(Player, "growthAnalyzeSecurity")); return 2 * CONSTANTS.ServerFortifyAmount * threads; }, - weaken: function (hostname: any, { threads: requestedThreads }: any = {}): any { + weaken: async function (_hostname: unknown, { threads: requestedThreads }: BasicHGWOptions = {}): Promise { + const hostname = helper.string("weaken", "hostname", _hostname); updateDynamicRam("weaken", getRamCost(Player, "weaken")); - const threads = resolveNetscriptRequestedThreads(workerScript, "weaken", requestedThreads); + const threads = resolveNetscriptRequestedThreads( + workerScript, + "weaken", + requestedThreads ?? workerScript.scriptRef.threads, + ); if (hostname === undefined) { throw makeRuntimeErrorMsg("weaken", "Takes 1 argument."); } const server = safeGetServer(hostname, "weaken"); if (!(server instanceof Server)) { workerScript.log("weaken", () => "Cannot be executed on this server."); - return false; + return Promise.resolve(0); } // No root access or skill level too low @@ -716,12 +752,14 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { return Promise.resolve(CONSTANTS.ServerWeakenAmount * threads * coreBonus); }); }, - weakenAnalyze: function (threads: any, cores: any = 1): number { + weakenAnalyze: function (_threads: unknown, _cores: unknown = 1): number { + const threads = helper.number("weakenAnalyze", "threads", _threads); + const cores = helper.number("weakenAnalyze", "cores", _cores); updateDynamicRam("weakenAnalyze", getRamCost(Player, "weakenAnalyze")); const coreBonus = 1 + (cores - 1) / 16; return CONSTANTS.ServerWeakenAmount * threads * coreBonus * BitNodeMultipliers.ServerWeakenRate; }, - share: function (): Promise { + share: async function (): Promise { updateDynamicRam("share", getRamCost(Player, "share")); workerScript.log("share", () => "Sharing this computer."); const end = StartSharing(workerScript.scriptRef.threads * calculateIntelligenceBonus(Player.intelligence, 2)); @@ -741,7 +779,8 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { } workerScript.print(argsToString(args)); }, - printf: function (format: string, ...args: any[]): void { + printf: function (_format: unknown, ...args: any[]): void { + const format = helper.string("printf", "format", _format); updateDynamicRam("printf", getRamCost(Player, "printf")); if (typeof format !== "string") { throw makeRuntimeErrorMsg("printf", "First argument must be string for the format."); @@ -772,7 +811,8 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { } Terminal.print(`${workerScript.scriptRef.filename}: ${str}`); }, - tprintf: function (format: any, ...args: any): any { + tprintf: function (_format: unknown, ...args: any[]): void { + const format = helper.string("printf", "format", _format); updateDynamicRam("tprintf", getRamCost(Player, "tprintf")); if (typeof format !== "string") { throw makeRuntimeErrorMsg("tprintf", "First argument must be string for the format."); @@ -797,14 +837,15 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { } Terminal.print(`${str}`); }, - clearLog: function (): any { + clearLog: function (): void { updateDynamicRam("clearLog", getRamCost(Player, "clearLog")); workerScript.scriptRef.clearLog(); }, - disableLog: function (fn: any): any { + disableLog: function (_fn: unknown): void { + const fn = helper.string("disableLog", "fn", _fn); updateDynamicRam("disableLog", getRamCost(Player, "disableLog")); if (fn === "ALL") { - for (fn of Object.keys(possibleLogs)) { + for (const fn of Object.keys(possibleLogs)) { workerScript.disableLogs[fn] = true; } workerScript.log("disableLog", () => `Disabled logging for all functions`); @@ -815,10 +856,11 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { workerScript.log("disableLog", () => `Disabled logging for ${fn}`); } }, - enableLog: function (fn: any): any { + enableLog: function (_fn: unknown): void { + const fn = helper.string("enableLog", "fn", _fn); updateDynamicRam("enableLog", getRamCost(Player, "enableLog")); if (fn === "ALL") { - for (fn of Object.keys(possibleLogs)) { + for (const fn of Object.keys(possibleLogs)) { delete workerScript.disableLogs[fn]; } workerScript.log("enableLog", () => `Enabled logging for all functions`); @@ -828,24 +870,29 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { delete workerScript.disableLogs[fn]; workerScript.log("enableLog", () => `Enabled logging for ${fn}`); }, - isLogEnabled: function (fn: any): any { + isLogEnabled: function (_fn: unknown): boolean { + const fn = helper.string("isLogEnabled", "fn", _fn); updateDynamicRam("isLogEnabled", getRamCost(Player, "isLogEnabled")); if (possibleLogs[fn] === undefined) { throw makeRuntimeErrorMsg("isLogEnabled", `Invalid argument: ${fn}.`); } return !workerScript.disableLogs[fn]; }, - getScriptLogs: function (fn: any, hostname: any, ...scriptArgs: any): any { + getScriptLogs: function (_fn: unknown, _hostname: unknown, ...scriptArgs: any[]): string[] { + const fn = helper.string("getScriptLogs", "fn", _fn); + const hostname = helper.string("getScriptLogs", "hostname", _hostname); updateDynamicRam("getScriptLogs", getRamCost(Player, "getScriptLogs")); const runningScriptObj = getRunningScript(fn, hostname, "getScriptLogs", scriptArgs); if (runningScriptObj == null) { workerScript.log("getScriptLogs", () => getCannotFindRunningScriptErrorMessage(fn, hostname, scriptArgs)); - return ""; + return []; } return runningScriptObj.logs.slice(); }, - tail: function (fn: any, hostname: any = workerScript.hostname, ...scriptArgs: any): any { + tail: function (_fn: unknown, _hostname: unknown = workerScript.hostname, ...scriptArgs: any[]): void { + const fn = helper.string("tail", "fn", _fn); + const hostname = helper.string("tail", "hostname", _hostname); updateDynamicRam("tail", getRamCost(Player, "tail")); let runningScriptObj; if (arguments.length === 0) { @@ -862,7 +909,8 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { LogBoxEvents.emit(runningScriptObj); }, - nuke: function (hostname: any): boolean { + nuke: function (_hostname: unknown): boolean { + const hostname = helper.string("tail", "hostname", _hostname); updateDynamicRam("nuke", getRamCost(Player, "nuke")); if (hostname === undefined) { throw makeRuntimeErrorMsg("nuke", "Takes 1 argument."); @@ -886,7 +934,8 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { workerScript.log("nuke", () => `Executed NUKE.exe virus on '${server.hostname}' to gain root access.`); return true; }, - brutessh: function (hostname: any): boolean { + brutessh: function (_hostname: unknown): boolean { + const hostname = helper.string("brutessh", "hostname", _hostname); updateDynamicRam("brutessh", getRamCost(Player, "brutessh")); if (hostname === undefined) { throw makeRuntimeErrorMsg("brutessh", "Takes 1 argument."); @@ -908,7 +957,8 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { } return true; }, - ftpcrack: function (hostname: any): boolean { + ftpcrack: function (_hostname: unknown): boolean { + const hostname = helper.string("ftpcrack", "hostname", _hostname); updateDynamicRam("ftpcrack", getRamCost(Player, "ftpcrack")); if (hostname === undefined) { throw makeRuntimeErrorMsg("ftpcrack", "Takes 1 argument."); @@ -930,7 +980,8 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { } return true; }, - relaysmtp: function (hostname: any): boolean { + relaysmtp: function (_hostname: unknown): boolean { + const hostname = helper.string("relaysmtp", "hostname", _hostname); updateDynamicRam("relaysmtp", getRamCost(Player, "relaysmtp")); if (hostname === undefined) { throw makeRuntimeErrorMsg("relaysmtp", "Takes 1 argument."); @@ -952,7 +1003,8 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { } return true; }, - httpworm: function (hostname: any): boolean { + httpworm: function (_hostname: unknown): boolean { + const hostname = helper.string("httpworm", "hostname", _hostname); updateDynamicRam("httpworm", getRamCost(Player, "httpworm")); if (hostname === undefined) { throw makeRuntimeErrorMsg("httpworm", "Takes 1 argument"); @@ -974,7 +1026,8 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { } return true; }, - sqlinject: function (hostname: any): boolean { + sqlinject: function (_hostname: unknown): boolean { + const hostname = helper.string("sqlinject", "hostname", _hostname); updateDynamicRam("sqlinject", getRamCost(Player, "sqlinject")); if (hostname === undefined) { throw makeRuntimeErrorMsg("sqlinject", "Takes 1 argument."); @@ -996,7 +1049,9 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { } return true; }, - run: function (scriptname: any, threads: any = 1, ...args: any[]): any { + run: function (_scriptname: unknown, _threads: unknown = 1, ...args: any[]): number { + const scriptname = helper.string("run", "scriptname", _scriptname); + const threads = helper.number("run", "threads", _threads); updateDynamicRam("run", getRamCost(Player, "run")); if (scriptname === undefined) { throw makeRuntimeErrorMsg("run", "Usage: run(scriptname, [numThreads], [arg1], [arg2]...)"); @@ -1011,7 +1066,10 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { return runScriptFromScript(Player, "run", scriptServer, scriptname, args, workerScript, threads); }, - exec: function (scriptname: any, hostname: any, threads: any = 1, ...args: any[]): any { + exec: function (_scriptname: unknown, _hostname: unknown, _threads: unknown = 1, ...args: any[]): number { + const scriptname = helper.string("exec", "scriptname", _scriptname); + const hostname = helper.string("exec", "hostname", _hostname); + const threads = helper.number("exec", "threads", _threads); updateDynamicRam("exec", getRamCost(Player, "exec")); if (scriptname === undefined || hostname === undefined) { throw makeRuntimeErrorMsg("exec", "Usage: exec(scriptname, server, [numThreads], [arg1], [arg2]...)"); @@ -1022,7 +1080,9 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { const server = safeGetServer(hostname, "exec"); return runScriptFromScript(Player, "exec", server, scriptname, args, workerScript, threads); }, - spawn: function (scriptname: any, threads: any = 1, ...args: any[]): any { + spawn: function (_scriptname: unknown, _threads: unknown = 1, ...args: any[]): void { + const scriptname = helper.string("spawn", "scriptname", _scriptname); + const threads = helper.number("spawn", "threads", _threads); updateDynamicRam("spawn", getRamCost(Player, "spawn")); if (!scriptname || !threads) { throw makeRuntimeErrorMsg("spawn", "Usage: spawn(scriptname, threads)"); @@ -1048,7 +1108,9 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { workerScript.log("spawn", () => "Exiting..."); } }, - kill: function (filename: any, hostname?: any, ...scriptArgs: any): any { + kill: function (_filename: unknown, _hostname?: unknown, ...scriptArgs: any[]): boolean { + const filename = helper.string("kill", "filename", _filename); + const hostname = helper.string("kill", "hostname", _hostname); updateDynamicRam("kill", getRamCost(Player, "kill")); let res; @@ -1094,7 +1156,8 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { return false; } }, - killall: function (hostname: any = workerScript.hostname): any { + killall: function (_hostname: unknown = workerScript.hostname): boolean { + const hostname = helper.string("killall", "hostname", _hostname); updateDynamicRam("killall", getRamCost(Player, "killall")); if (hostname === undefined) { throw makeRuntimeErrorMsg("killall", "Takes 1 argument"); @@ -1112,7 +1175,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { return scriptsRunning; }, - exit: function (): any { + exit: function (): void { updateDynamicRam("exit", getRamCost(Player, "exit")); workerScript.running = false; // Prevent workerScript from "finishing execution naturally" if (killWorkerScript(workerScript)) { @@ -1121,7 +1184,8 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { workerScript.log("exit", () => "Failed. This is a bug. Report to dev."); } }, - scp: async function (scriptname: any, hostname1: any, hostname2?: any): Promise { + scp: async function (scriptname: any, _hostname1: unknown, hostname2?: any): Promise { + const hostname1 = helper.string("scp", "hostname1", _hostname1); updateDynamicRam("scp", getRamCost(Player, "scp")); if (arguments.length !== 2 && arguments.length !== 3) { throw makeRuntimeErrorMsg("scp", "Takes 2 or 3 arguments"); @@ -1278,7 +1342,9 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { newScript.updateRamUsage(Player, destServer.scripts).then(() => resolve(true)); }); }, - ls: function (hostname: any, grep: any): any { + ls: function (_hostname: unknown, _grep: unknown = ""): string[] { + const hostname = helper.string("ls", "hostname", _hostname); + const grep = helper.string("ls", "grep", _grep); updateDynamicRam("ls", getRamCost(Player, "ls")); if (hostname === undefined) { throw makeRuntimeErrorMsg("ls", "Usage: ls(hostname/ip, [grep filter])"); @@ -1345,7 +1411,8 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { allFiles.sort(); return allFiles; }, - ps: function (hostname: any = workerScript.hostname): any { + ps: function (_hostname: unknown = workerScript.hostname): ProcessInfo[] { + const hostname = helper.string("ps", "hostname", _hostname); updateDynamicRam("ps", getRamCost(Player, "ps")); const server = safeGetServer(hostname, "ps"); const processes = []; @@ -1359,7 +1426,8 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { } return processes; }, - hasRootAccess: function (hostname: any): any { + hasRootAccess: function (_hostname: unknown): boolean { + const hostname = helper.string("hasRootAccess", "hostname", _hostname); updateDynamicRam("hasRootAccess", getRamCost(Player, "hasRootAccess")); if (hostname === undefined) { throw makeRuntimeErrorMsg("hasRootAccess", "Takes 1 argument"); @@ -1367,7 +1435,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { const server = safeGetServer(hostname, "hasRootAccess"); return server.hasAdminRights; }, - getHostname: function (): any { + getHostname: function (): string { updateDynamicRam("getHostname", getRamCost(Player, "getHostname")); const scriptServer = GetServer(workerScript.hostname); if (scriptServer == null) { @@ -1375,13 +1443,13 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { } return scriptServer.hostname; }, - getHackingLevel: function (): any { + getHackingLevel: function (): number { updateDynamicRam("getHackingLevel", getRamCost(Player, "getHackingLevel")); Player.updateSkillLevels(); workerScript.log("getHackingLevel", () => `returned ${Player.hacking}`); return Player.hacking; }, - getHackingMultipliers: function (): any { + getHackingMultipliers: function (): HackingMultipliers { updateDynamicRam("getHackingMultipliers", getRamCost(Player, "getHackingMultipliers")); return { chance: Player.hacking_chance_mult, @@ -1390,7 +1458,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { growth: Player.hacking_grow_mult, }; }, - getHacknetMultipliers: function (): any { + getHacknetMultipliers: function (): HacknetMultipliers { updateDynamicRam("getHacknetMultipliers", getRamCost(Player, "getHacknetMultipliers")); return { production: Player.hacknet_node_money_mult, @@ -1400,7 +1468,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { levelCost: Player.hacknet_node_level_cost_mult, }; }, - getBitNodeMultipliers: function (): any { + getBitNodeMultipliers: function (): IBNMults { updateDynamicRam("getBitNodeMultipliers", getRamCost(Player, "getBitNodeMultipliers")); if (SourceFileFlags[5] <= 0 && Player.bitNodeN !== 5) { throw makeRuntimeErrorMsg("getBitNodeMultipliers", "Requires Source-File 5 to run."); @@ -1408,7 +1476,8 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { const copy = Object.assign({}, BitNodeMultipliers); return copy; }, - getServer: function (hostname: any = workerScript.hostname): any { + getServer: function (_hostname: unknown = workerScript.hostname): IServerDef { + const hostname = helper.string("getServer", "hostname", _hostname); updateDynamicRam("getServer", getRamCost(Player, "getServer")); const server = safeGetServer(hostname, "getServer"); const copy = Object.assign({}, server) as any; @@ -1431,7 +1500,8 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { if (!copy.serverGrowth) copy.serverGrowth = 0; return copy; }, - getServerMoneyAvailable: function (hostname: any): any { + getServerMoneyAvailable: function (_hostname: unknown): number { + const hostname = helper.string("getServerMoneyAvailable", "hostname", _hostname); updateDynamicRam("getServerMoneyAvailable", getRamCost(Player, "getServerMoneyAvailable")); const server = safeGetServer(hostname, "getServerMoneyAvailable"); if (!(server instanceof Server)) { @@ -1455,7 +1525,8 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { ); return server.moneyAvailable; }, - getServerSecurityLevel: function (hostname: any): any { + getServerSecurityLevel: function (_hostname: unknown): number { + const hostname = helper.string("getServerSecurityLevel", "hostname", _hostname); updateDynamicRam("getServerSecurityLevel", getRamCost(Player, "getServerSecurityLevel")); const server = safeGetServer(hostname, "getServerSecurityLevel"); if (!(server instanceof Server)) { @@ -1471,7 +1542,8 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { ); return server.hackDifficulty; }, - getServerBaseSecurityLevel: function (hostname: any): any { + getServerBaseSecurityLevel: function (_hostname: unknown): number { + const hostname = helper.string("getServerBaseSecurityLevel", "hostname", _hostname); updateDynamicRam("getServerBaseSecurityLevel", getRamCost(Player, "getServerBaseSecurityLevel")); workerScript.log( "getServerBaseSecurityLevel", @@ -1491,7 +1563,8 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { ); return server.baseDifficulty; }, - getServerMinSecurityLevel: function (hostname: any): any { + getServerMinSecurityLevel: function (_hostname: unknown): number { + const hostname = helper.string("getServerMinSecurityLevel", "hostname", _hostname); updateDynamicRam("getServerMinSecurityLevel", getRamCost(Player, "getServerMinSecurityLevel")); const server = safeGetServer(hostname, "getServerMinSecurityLevel"); if (!(server instanceof Server)) { @@ -1507,7 +1580,8 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { ); return server.minDifficulty; }, - getServerRequiredHackingLevel: function (hostname: any): any { + getServerRequiredHackingLevel: function (_hostname: unknown): number { + const hostname = helper.string("getServerRequiredHackingLevel", "hostname", _hostname); updateDynamicRam("getServerRequiredHackingLevel", getRamCost(Player, "getServerRequiredHackingLevel")); const server = safeGetServer(hostname, "getServerRequiredHackingLevel"); if (!(server instanceof Server)) { @@ -1523,7 +1597,8 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { ); return server.requiredHackingSkill; }, - getServerMaxMoney: function (hostname: any): any { + getServerMaxMoney: function (_hostname: unknown): number { + const hostname = helper.string("getServerMaxMoney", "hostname", _hostname); updateDynamicRam("getServerMaxMoney", getRamCost(Player, "getServerMaxMoney")); const server = safeGetServer(hostname, "getServerMaxMoney"); if (!(server instanceof Server)) { @@ -1539,7 +1614,8 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { ); return server.moneyMax; }, - getServerGrowth: function (hostname: any): any { + getServerGrowth: function (_hostname: unknown): number { + const hostname = helper.string("getServerGrowth", "hostname", _hostname); updateDynamicRam("getServerGrowth", getRamCost(Player, "getServerGrowth")); const server = safeGetServer(hostname, "getServerGrowth"); if (!(server instanceof Server)) { @@ -1552,7 +1628,8 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { workerScript.log("getServerGrowth", () => `returned ${server.serverGrowth} for '${server.hostname}'`); return server.serverGrowth; }, - getServerNumPortsRequired: function (hostname: any): any { + getServerNumPortsRequired: function (_hostname: unknown): number { + const hostname = helper.string("getServerNumPortsRequired", "hostname", _hostname); updateDynamicRam("getServerNumPortsRequired", getRamCost(Player, "getServerNumPortsRequired")); const server = safeGetServer(hostname, "getServerNumPortsRequired"); if (!(server instanceof Server)) { @@ -1568,7 +1645,8 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { ); return server.numOpenPortsRequired; }, - getServerRam: function (hostname: any): any { + getServerRam: function (_hostname: unknown): [number, number] { + const hostname = helper.string("getServerRam", "hostname", _hostname); updateDynamicRam("getServerRam", getRamCost(Player, "getServerRam")); workerScript.log( "getServerRam", @@ -1581,23 +1659,28 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { ); return [server.maxRam, server.ramUsed]; }, - getServerMaxRam: function (hostname: any): any { + getServerMaxRam: function (_hostname: unknown): number { + const hostname = helper.string("getServerMaxRam", "hostname", _hostname); updateDynamicRam("getServerMaxRam", getRamCost(Player, "getServerMaxRam")); const server = safeGetServer(hostname, "getServerMaxRam"); workerScript.log("getServerMaxRam", () => `returned ${numeralWrapper.formatRAM(server.maxRam)}`); return server.maxRam; }, - getServerUsedRam: function (hostname: any): any { + getServerUsedRam: function (_hostname: unknown): number { + const hostname = helper.string("getServerUsedRam", "hostname", _hostname); updateDynamicRam("getServerUsedRam", getRamCost(Player, "getServerUsedRam")); const server = safeGetServer(hostname, "getServerUsedRam"); workerScript.log("getServerUsedRam", () => `returned ${numeralWrapper.formatRAM(server.ramUsed)}`); return server.ramUsed; }, - serverExists: function (hostname: any): any { + serverExists: function (_hostname: unknown): boolean { + const hostname = helper.string("serverExists", "hostname", _hostname); updateDynamicRam("serverExists", getRamCost(Player, "serverExists")); return GetServer(hostname) !== null; }, - fileExists: function (filename: any, hostname: any = workerScript.hostname): any { + fileExists: function (_filename: unknown, _hostname: unknown = workerScript.hostname): boolean { + const filename = helper.string("fileExists", "filename", _filename); + const hostname = helper.string("fileExists", "hostname", _hostname); updateDynamicRam("fileExists", getRamCost(Player, "fileExists")); if (filename === undefined) { throw makeRuntimeErrorMsg("fileExists", "Usage: fileExists(scriptname, [server])"); @@ -1621,7 +1704,9 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { const txtFile = getTextFile(filename, server); return txtFile != null; }, - isRunning: function (fn: any, hostname: any = workerScript.hostname, ...scriptArgs: any): any { + isRunning: function (_fn: unknown, _hostname: unknown = workerScript.hostname, ...scriptArgs: any[]): boolean { + const fn = helper.string("isRunning", "fn", _fn); + const hostname = helper.string("isRunning", "hostname", _hostname); updateDynamicRam("isRunning", getRamCost(Player, "isRunning")); if (fn === undefined || hostname === undefined) { throw makeRuntimeErrorMsg("isRunning", "Usage: isRunning(scriptname, server, [arg1], [arg2]...)"); @@ -1632,17 +1717,18 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { return getRunningScript(fn, hostname, "isRunning", scriptArgs) != null; } }, - getPurchasedServerLimit: function (): any { + getPurchasedServerLimit: function (): number { updateDynamicRam("getPurchasedServerLimit", getRamCost(Player, "getPurchasedServerLimit")); return getPurchaseServerLimit(); }, - getPurchasedServerMaxRam: function (): any { + getPurchasedServerMaxRam: function (): number { updateDynamicRam("getPurchasedServerMaxRam", getRamCost(Player, "getPurchasedServerMaxRam")); return getPurchaseServerMaxRam(); }, - getPurchasedServerCost: function (ram: any): any { + getPurchasedServerCost: function (_ram: unknown): number { + const ram = helper.number("getPurchasedServerCost", "ram", _ram); updateDynamicRam("getPurchasedServerCost", getRamCost(Player, "getPurchasedServerCost")); const cost = getPurchaseServerCost(ram); @@ -1653,10 +1739,10 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { return cost; }, - purchaseServer: function (aname: any, aram: any): any { + purchaseServer: function (_name: unknown, _ram: unknown): string { + const name = helper.string("purchaseServer", "name", _name); + const ram = helper.number("purchaseServer", "ram", _ram); if (arguments.length !== 2) throw makeRuntimeErrorMsg("purchaseServer", "Takes 2 arguments"); - const name = helper.string("purchaseServer", "name", aname); - const ram = helper.number("purchaseServer", "ram", aram); updateDynamicRam("purchaseServer", getRamCost(Player, "purchaseServer")); let hostnameStr = String(name); hostnameStr = hostnameStr.replace(/\s+/g, ""); @@ -1717,7 +1803,8 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { ); return newServ.hostname; }, - deleteServer: function (name: any): any { + deleteServer: function (_name: unknown): boolean { + const name = helper.string("purchaseServer", "name", _name); updateDynamicRam("deleteServer", getRamCost(Player, "deleteServer")); let hostnameStr = String(name); hostnameStr = hostnameStr.replace(/\s\s+/g, ""); @@ -1793,7 +1880,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { ); return false; }, - getPurchasedServers: function (): any { + getPurchasedServers: function (): string[] { updateDynamicRam("getPurchasedServers", getRamCost(Player, "getPurchasedServers")); const res: string[] = []; Player.purchasedServers.forEach(function (hostname) { diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index 7c00a7a6a..d7b3669ca 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -584,7 +584,7 @@ export interface BitNodeMultipliers { /** Influences the maximum allowed RAM for a purchased server */ PurchasedServerMaxRam: number; /** Influences cost of any purchased server at or above 128GB */ - PurchasedServerSoftCap: number; + PurchasedServerSoftcap: number; /** Influences the minimum favor the player must have with a faction before they can donate to gain rep. */ RepToDonateToFaction: number; /** Influences how much the money on a server can be reduced when a script performs a hack against it. */ From 12d5f55aecd823ef02fe9be1b9ea9d8834d362f8 Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Tue, 29 Mar 2022 22:14:56 -0400 Subject: [PATCH 10/12] unknown-ify the rest of the basic API. --- src/NetscriptFunctions.ts | 116 +++++++++++++-------- src/ScriptEditor/NetscriptDefinitions.d.ts | 2 +- 2 files changed, 76 insertions(+), 42 deletions(-) diff --git a/src/NetscriptFunctions.ts b/src/NetscriptFunctions.ts index e95042c24..255a3b306 100644 --- a/src/NetscriptFunctions.ts +++ b/src/NetscriptFunctions.ts @@ -86,6 +86,7 @@ import { HacknetMultipliers, BitNodeMultipliers as IBNMults, Server as IServerDef, + RunningScript as IRunningScriptDef, } from "./ScriptEditor/NetscriptDefinitions"; import { NetscriptSingularity } from "./NetscriptFunctions/Singularity"; @@ -1888,7 +1889,8 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { }); return res; }, - writePort: function (port: any, data: any = ""): any { + writePort: function (_port: unknown, data: any = ""): Promise { + const port = helper.number("writePort", "port", _port); updateDynamicRam("writePort", getRamCost(Player, "writePort")); if (typeof data !== "string" && typeof data !== "number") { throw makeRuntimeErrorMsg( @@ -1899,7 +1901,9 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { const iport = helper.getValidPort("writePort", port); return Promise.resolve(iport.write(data)); }, - write: function (port: any, data: any = "", mode: any = "a"): any { + write: function (_port: unknown, data: any = "", _mode: unknown = "a"): Promise { + const port = helper.string("write", "port", _port); + const mode = helper.string("write", "mode", _mode); updateDynamicRam("write", getRamCost(Player, "write")); if (isString(port)) { // Write to script or text file @@ -1952,7 +1956,8 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { throw makeRuntimeErrorMsg("write", `Invalid argument: ${port}`); } }, - tryWritePort: function (port: any, data: any = ""): any { + tryWritePort: function (_port: unknown, data: any = ""): Promise { + let port = helper.number("tryWritePort", "port", _port); updateDynamicRam("tryWritePort", getRamCost(Player, "tryWritePort")); if (typeof data !== "string" && typeof data !== "number") { throw makeRuntimeErrorMsg( @@ -1977,14 +1982,16 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { throw makeRuntimeErrorMsg("tryWritePort", `Invalid argument: ${port}`); } }, - readPort: function (port: any): any { + readPort: function (_port: unknown): any { + const port = helper.number("readPort", "port", _port); updateDynamicRam("readPort", getRamCost(Player, "readPort")); // Read from port const iport = helper.getValidPort("readPort", port); const x = iport.read(); return x; }, - read: function (port: any): any { + read: function (_port: unknown): string { + const port = helper.string("read", "port", _port); updateDynamicRam("read", getRamCost(Player, "read")); if (isString(port)) { // Read from script or text file @@ -2013,13 +2020,15 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { throw makeRuntimeErrorMsg("read", `Invalid argument: ${port}`); } }, - peek: function (port: any): any { + peek: function (_port: unknown): any { + const port = helper.number("peek", "port", _port); updateDynamicRam("peek", getRamCost(Player, "peek")); const iport = helper.getValidPort("peek", port); const x = iport.peek(); return x; }, - clear: function (file: any): any { + clear: function (_file: unknown): void { + const file = helper.string("peek", "file", _file); updateDynamicRam("clear", getRamCost(Player, "clear")); if (isString(file)) { // Clear text file @@ -2035,20 +2044,23 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { } else { throw makeRuntimeErrorMsg("clear", `Invalid argument: ${file}`); } - return 0; }, - clearPort: function (port: any): any { + clearPort: function (_port: unknown): void { + const port = helper.number("clearPort", "port", _port); updateDynamicRam("clearPort", getRamCost(Player, "clearPort")); // Clear port const iport = helper.getValidPort("clearPort", port); - return iport.clear(); + iport.clear(); }, - getPortHandle: function (port: any): IPort { + getPortHandle: function (_port: unknown): IPort { + const port = helper.number("getPortHandle", "port", _port); updateDynamicRam("getPortHandle", getRamCost(Player, "getPortHandle")); const iport = helper.getValidPort("getPortHandle", port); return iport; }, - rm: function (fn: any, hostname: any): any { + rm: function (_fn: unknown, _hostname: unknown): boolean { + const fn = helper.string("rm", "fn", _fn); + let hostname = helper.string("rm", "hostname", _hostname); updateDynamicRam("rm", getRamCost(Player, "rm")); if (hostname == null || hostname === "") { @@ -2063,7 +2075,9 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { return status.res; }, - scriptRunning: function (scriptname: any, hostname: any): any { + scriptRunning: function (_scriptname: unknown, _hostname: unknown): boolean { + const scriptname = helper.string("scriptRunning", "scriptname", _scriptname); + const hostname = helper.string("scriptRunning", "hostname", _hostname); updateDynamicRam("scriptRunning", getRamCost(Player, "scriptRunning")); const server = safeGetServer(hostname, "scriptRunning"); for (let i = 0; i < server.runningScripts.length; ++i) { @@ -2073,7 +2087,9 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { } return false; }, - scriptKill: function (scriptname: any, hostname: any): any { + scriptKill: function (_scriptname: unknown, _hostname: unknown): boolean { + const scriptname = helper.string("scriptKill", "scriptname", _scriptname); + const hostname = helper.string("scriptKill", "hostname", _hostname); updateDynamicRam("scriptKill", getRamCost(Player, "scriptKill")); const server = safeGetServer(hostname, "scriptKill"); let suc = false; @@ -2086,11 +2102,13 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { } return suc; }, - getScriptName: function (): any { + getScriptName: function (): string { updateDynamicRam("getScriptName", getRamCost(Player, "getScriptName")); return workerScript.name; }, - getScriptRam: function (scriptname: any, hostname: any = workerScript.hostname): any { + getScriptRam: function (_scriptname: unknown, _hostname: unknown = workerScript.hostname): number { + const scriptname = helper.string("getScriptRam", "scriptname", _scriptname); + const hostname = helper.string("getScriptRam", "hostname", _hostname); updateDynamicRam("getScriptRam", getRamCost(Player, "getScriptRam")); const server = safeGetServer(hostname, "getScriptRam"); for (let i = 0; i < server.scripts.length; ++i) { @@ -2100,7 +2118,9 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { } return 0; }, - getRunningScript: function (fn: any, hostname: any, ...args: any[]): any { + getRunningScript: function (_fn: unknown, _hostname: unknown, ...args: any[]): IRunningScriptDef | null { + const fn = helper.string("getRunningScript", "fn", _fn); + const hostname = helper.string("getRunningScript", "hostname", _hostname); updateDynamicRam("getRunningScript", getRamCost(Player, "getRunningScript")); let runningScript; @@ -2128,7 +2148,8 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { threads: runningScript.threads, }; }, - getHackTime: function (hostname: any): any { + getHackTime: function (_hostname: unknown = workerScript.hostname): number { + const hostname = helper.string("getHackTime", "hostname", _hostname); updateDynamicRam("getHackTime", getRamCost(Player, "getHackTime")); const server = safeGetServer(hostname, "getHackTime"); if (!(server instanceof Server)) { @@ -2141,7 +2162,8 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { return calculateHackingTime(server, Player) * 1000; }, - getGrowTime: function (hostname: any): any { + getGrowTime: function (_hostname: unknown = workerScript.hostname): number { + const hostname = helper.string("getGrowTime", "hostname", _hostname); updateDynamicRam("getGrowTime", getRamCost(Player, "getGrowTime")); const server = safeGetServer(hostname, "getGrowTime"); if (!(server instanceof Server)) { @@ -2154,7 +2176,8 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { return calculateGrowTime(server, Player) * 1000; }, - getWeakenTime: function (hostname: any = workerScript.hostname): any { + getWeakenTime: function (_hostname: unknown = workerScript.hostname): number { + const hostname = helper.string("getWeakenTime", "hostname", _hostname); updateDynamicRam("getWeakenTime", getRamCost(Player, "getWeakenTime")); const server = safeGetServer(hostname, "getWeakenTime"); if (!(server instanceof Server)) { @@ -2196,7 +2219,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { return runningScriptObj.onlineMoneyMade / runningScriptObj.onlineRunningTime; } }, - getScriptExpGain: function (scriptname?: any, hostname?: any, ...args: any[]): any { + getScriptExpGain: function (scriptname?: any, hostname?: any, ...args: any[]): number { updateDynamicRam("getScriptExpGain", getRamCost(Player, "getScriptExpGain")); if (arguments.length === 0) { let total = 0; @@ -2218,40 +2241,43 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { return runningScriptObj.onlineExpGained / runningScriptObj.onlineRunningTime; } }, - nFormat: function (n: any, format: any): any { + nFormat: function (_n: unknown, _format: unknown): string { + const n = helper.number("nFormat", "n", _n); + const format = helper.string("nFormat", "format", _format); updateDynamicRam("nFormat", getRamCost(Player, "nFormat")); - if (isNaN(n) || isNaN(parseFloat(n)) || typeof format !== "string") { + if (isNaN(n)) { return ""; } - return numeralWrapper.format(parseFloat(n), format); + return numeralWrapper.format(n, format); }, - tFormat: function (milliseconds: any, milliPrecision: any = false): any { + tFormat: function (_milliseconds: unknown, _milliPrecision: unknown = false): string { + const milliseconds = helper.number("tFormat", "milliseconds", _milliseconds); + const milliPrecision = helper.boolean(_milliPrecision); updateDynamicRam("tFormat", getRamCost(Player, "tFormat")); return convertTimeMsToTimeElapsedString(milliseconds, milliPrecision); }, - getTimeSinceLastAug: function (): any { + getTimeSinceLastAug: function (): number { updateDynamicRam("getTimeSinceLastAug", getRamCost(Player, "getTimeSinceLastAug")); return Player.playtimeSinceLastAug; }, - alert: function (message: any): void { + alert: function (_message: unknown): void { + const message = helper.string("alert", "message", _message); updateDynamicRam("alert", getRamCost(Player, "alert")); - message = argsToString([message]); dialogBoxCreate(message); }, - toast: function (message: any, variant: any = "success", duration: any = 2000): void { + toast: function (_message: unknown, _variant: unknown = "success", _duration: unknown = 2000): void { + const message = helper.string("toast", "message", _message); + const variant = helper.string("toast", "variant", _variant); + const duration = helper.number("toast", "duration", _duration); updateDynamicRam("toast", getRamCost(Player, "toast")); if (!["success", "info", "warning", "error"].includes(variant)) throw new Error(`variant must be one of "success", "info", "warning", or "error"`); - - message = argsToString([message]); - SnackbarEvents.emit(message, variant, duration); + SnackbarEvents.emit(message, variant as any, duration); }, - prompt: function (txt: any, options?: { type?: string; options?: string[] }): any { + prompt: function (_txt: unknown, options?: { type?: string; options?: string[] }): Promise { + const txt = helper.string("toast", "txt", _txt); updateDynamicRam("prompt", getRamCost(Player, "prompt")); - if (!isString(txt)) { - txt = JSON.stringify(txt); - } return new Promise(function (resolve) { PromptEvent.emit({ @@ -2261,7 +2287,14 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { }); }); }, - wget: async function (url: any, target: any, hostname: any = workerScript.hostname): Promise { + wget: async function ( + _url: unknown, + _target: unknown, + _hostname: unknown = workerScript.hostname, + ): Promise { + const url = helper.string("wget", "url", _url); + const target = helper.string("wget", "target", _target); + const hostname = helper.string("wget", "hostname", _hostname); updateDynamicRam("wget", getRamCost(Player, "wget")); if (!isScriptFilename(target) && !target.endsWith(".txt")) { workerScript.log("wget", () => `Invalid target file: '${target}'. Must be a script or text file.`); @@ -2299,7 +2332,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { }); }); }, - getFavorToDonate: function (): any { + getFavorToDonate: function (): number { updateDynamicRam("getFavorToDonate", getRamCost(Player, "getFavorToDonate")); return Math.floor(CONSTANTS.BaseFavorToDonate * BitNodeMultipliers.RepToDonateToFaction); }, @@ -2420,11 +2453,12 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { f(); }; // Wrap the user function to prevent WorkerScript leaking as 'this' }, - mv: function (host: string, source: string, destination: string): void { + mv: function (_host: unknown, _source: unknown, _destination: unknown): void { + const host = helper.string("mv", "host", _host); + const source = helper.string("mv", "source", _source); + const destination = helper.string("mv", "destination", _destination); updateDynamicRam("mv", getRamCost(Player, "mv")); - if (arguments.length != 3) throw makeRuntimeErrorMsg("mv", "Takes 3 argument."); - if (!isValidFilePath(source)) throw makeRuntimeErrorMsg("mv", `Invalid filename: '${source}'`); if (!isValidFilePath(destination)) throw makeRuntimeErrorMsg("mv", `Invalid filename: '${destination}'`); diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index d7b3669ca..5e102ef1b 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -5649,7 +5649,7 @@ export interface NS extends Singularity { * @param args - Arguments to identify the script * @returns The info about the running script if found, and null otherwise. */ - getRunningScript(filename?: FilenameOrPID, hostname?: string, ...args: (string | number)[]): RunningScript; + getRunningScript(filename?: FilenameOrPID, hostname?: string, ...args: (string | number)[]): RunningScript | null; /** * Get cost of purchasing a server. From 6d591db0d2a255e315224ec3f236ab1240832486 Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Tue, 29 Mar 2022 23:49:39 -0400 Subject: [PATCH 11/12] Fix NF not working. --- src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx b/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx index b370d9974..00f0acbd7 100644 --- a/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx +++ b/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx @@ -2078,15 +2078,16 @@ export function reapplyAllAugmentations(this: IPlayer, resetMultipliers = true): this.augmentations[i].name = "Hacknet Node NIC Architecture Neural-Upload"; } - const augName = this.augmentations[i].name; + const playerAug = this.augmentations[i]; + const augName = playerAug.name; const aug = Augmentations[augName]; if (aug == null) { console.warn(`Invalid augmentation name in Player.reapplyAllAugmentations(). Aug ${augName} will be skipped`); continue; } aug.owned = true; - if (aug.name == AugmentationNames.NeuroFluxGovernor) { - for (let j = 0; j < aug.level; ++j) { + if (augName == AugmentationNames.NeuroFluxGovernor) { + for (let j = 0; j < playerAug.level; ++j) { applyAugmentation(this.augmentations[i], true); } continue; From 95f71129878f9538dc7f142502a8147bc1952d01 Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Wed, 30 Mar 2022 00:18:02 -0400 Subject: [PATCH 12/12] typo --- src/Augmentation/AugmentationCreator.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Augmentation/AugmentationCreator.tsx b/src/Augmentation/AugmentationCreator.tsx index 1c2162255..1cc19578e 100644 --- a/src/Augmentation/AugmentationCreator.tsx +++ b/src/Augmentation/AugmentationCreator.tsx @@ -1867,7 +1867,7 @@ export const churchOfTheMachineGodAugmentations = [ hacknet_node_core_cost_mult: 1 / 1.05, hacknet_node_level_cost_mult: 1 / 1.05, work_money_mult: 1 / 0.95, - stats: <>Staneks Gift has no penalty., + stats: <>Stanek's Gift has no penalty., factions: [FactionNames.ChurchOfTheMachineGod], }), ];