/******/ (function(modules) { // webpackBootstrap /******/ // install a JSONP callback for chunk loading /******/ function webpackJsonpCallback(data) { /******/ var chunkIds = data[0]; /******/ var moreModules = data[1]; /******/ var executeModules = data[2]; /******/ /******/ // add "moreModules" to the modules object, /******/ // then flag all "chunkIds" as loaded and fire callback /******/ var moduleId, chunkId, i = 0, resolves = []; /******/ for(;i < chunkIds.length; i++) { /******/ chunkId = chunkIds[i]; /******/ if(installedChunks[chunkId]) { /******/ resolves.push(installedChunks[chunkId][0]); /******/ } /******/ installedChunks[chunkId] = 0; /******/ } /******/ for(moduleId in moreModules) { /******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { /******/ modules[moduleId] = moreModules[moduleId]; /******/ } /******/ } /******/ if(parentJsonpFunction) parentJsonpFunction(data); /******/ /******/ while(resolves.length) { /******/ resolves.shift()(); /******/ } /******/ /******/ // add entry modules from loaded chunk to deferred list /******/ deferredModules.push.apply(deferredModules, executeModules || []); /******/ /******/ // run deferred modules when all chunks ready /******/ return checkDeferredModules(); /******/ }; /******/ function checkDeferredModules() { /******/ var result; /******/ for(var i = 0; i < deferredModules.length; i++) { /******/ var deferredModule = deferredModules[i]; /******/ var fulfilled = true; /******/ for(var j = 1; j < deferredModule.length; j++) { /******/ var depId = deferredModule[j]; /******/ if(installedChunks[depId] !== 0) fulfilled = false; /******/ } /******/ if(fulfilled) { /******/ deferredModules.splice(i--, 1); /******/ result = __webpack_require__(__webpack_require__.s = deferredModule[0]); /******/ } /******/ } /******/ return result; /******/ } /******/ /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // object to store loaded and loading chunks /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched /******/ // Promise = chunk loading, 0 = chunk loaded /******/ var installedChunks = { /******/ 2: 0 /******/ }; /******/ /******/ var deferredModules = []; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ var jsonpArray = window["webpackJsonp"] = window["webpackJsonp"] || []; /******/ var oldJsonpFunction = jsonpArray.push.bind(jsonpArray); /******/ jsonpArray.push = webpackJsonpCallback; /******/ jsonpArray = jsonpArray.slice(); /******/ for(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]); /******/ var parentJsonpFunction = oldJsonpFunction; /******/ /******/ /******/ // add entry module to deferred list /******/ deferredModules.push([15,0]); /******/ // run deferred modules when ready /******/ return checkDeferredModules(); /******/ }) /************************************************************************/ /******/ ([ /* 0 */, /* 1 */, /* 2 */ /*!***********************!*\ !*** ./src/Player.js ***! \***********************/ /*! exports provided: Player, loadPlayer */ /*! all exports used */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Player", function() { return Player; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "loadPlayer", function() { return loadPlayer; }); /* harmony import */ var _Corporation_Corporation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Corporation/Corporation */ 122); /* harmony import */ var _Corporation_Corporation__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_Corporation_Corporation__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _PersonObjects_Player_PlayerObject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./PersonObjects/Player/PlayerObject */ 794); /* harmony import */ var _Exploits_Exploit__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Exploits/Exploit */ 168); /* harmony import */ var _Exploits_Exploit__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_Exploits_Exploit__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var _utils_JSONReviver__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils/JSONReviver */ 29); /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! decimal.js */ 65); let Player = new _PersonObjects_Player_PlayerObject__WEBPACK_IMPORTED_MODULE_1__[/* PlayerObject */ "a"](); function loadPlayer(saveString) { Player = JSON.parse(saveString, _utils_JSONReviver__WEBPACK_IMPORTED_MODULE_3__["Reviver"]); // Parse Decimal.js objects Player.money = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["default"](Player.money); if (Player.corporation instanceof _Corporation_Corporation__WEBPACK_IMPORTED_MODULE_0__["Corporation"]) { Player.corporation.funds = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["default"](Player.corporation.funds); Player.corporation.revenue = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["default"](Player.corporation.revenue); Player.corporation.expenses = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["default"](Player.corporation.expenses); for (var i = 0; i < Player.corporation.divisions.length; ++i) { var ind = Player.corporation.divisions[i]; ind.lastCycleRevenue = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["default"](ind.lastCycleRevenue); ind.lastCycleExpenses = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["default"](ind.lastCycleExpenses); ind.thisCycleRevenue = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["default"](ind.thisCycleRevenue); ind.thisCycleExpenses = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["default"](ind.thisCycleExpenses); } } Player.exploits = Object(_Exploits_Exploit__WEBPACK_IMPORTED_MODULE_2__["sanitizeExploits"])(Player.exploits); } /***/ }), /* 3 */, /* 4 */ /*!****************************************************!*\ !*** ./src/Augmentation/data/AugmentationNames.ts ***! \****************************************************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AugmentationNames = void 0; exports.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", 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 BranchiBlades 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", //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, }; /***/ }), /* 5 */, /* 6 */, /* 7 */ /*!*********************************!*\ !*** ./src/ui/numeralFormat.ts ***! \*********************************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.numeralWrapper = void 0; const numeral_1 = __importDefault(__webpack_require__(/*! numeral */ 99)); __webpack_require__(/*! numeral/locales/bg */ 1158); __webpack_require__(/*! numeral/locales/cs */ 1157); __webpack_require__(/*! numeral/locales/da-dk */ 1156); __webpack_require__(/*! numeral/locales/de */ 1155); __webpack_require__(/*! numeral/locales/en-au */ 1154); __webpack_require__(/*! numeral/locales/en-gb */ 1153); __webpack_require__(/*! numeral/locales/es */ 1152); __webpack_require__(/*! numeral/locales/fr */ 1151); __webpack_require__(/*! numeral/locales/hu */ 1150); __webpack_require__(/*! numeral/locales/it */ 1149); __webpack_require__(/*! numeral/locales/lv */ 1148); __webpack_require__(/*! numeral/locales/no */ 1147); __webpack_require__(/*! numeral/locales/pl */ 1146); __webpack_require__(/*! numeral/locales/ru */ 1145); /* eslint-disable class-methods-use-this */ const extraFormats = [1e15, 1e18, 1e21, 1e24, 1e27, 1e30]; const extraNotations = ['q', 'Q', 's', 'S', 'o', 'n']; class NumeralFormatter { constructor() { // Default Locale this.defaultLocale = "en"; this.defaultLocale = 'en'; } updateLocale(l) { if (numeral_1.default.locale(l) == null) { console.warn(`Invalid locale for numeral: ${l}`); numeral_1.default.locale(this.defaultLocale); return false; } return true; } format(n, format) { // numeraljs doesnt properly format numbers that are too big or too small if (Math.abs(n) < 1e-6) { n = 0; } const answer = numeral_1.default(n).format(format); if (answer === 'NaN') { return `${n}`; } return answer; } formatBigNumber(n) { return this.format(n, "0.000a"); } // TODO: leverage numeral.js to do it. This function also implies you can // use this format in some text field but you can't. ( "1t" will parse but // "1s" will not) formatReallyBigNumber(n, decimalPlaces = 3) { if (n === Infinity) return "∞"; for (let i = 0; i < extraFormats.length; i++) { if (extraFormats[i] < n && n <= extraFormats[i] * 1000) { return this.format(n / extraFormats[i], '0.' + '0'.repeat(decimalPlaces)) + extraNotations[i]; } } if (Math.abs(n) < 1000) { return this.format(n, '0.' + '0'.repeat(decimalPlaces)); } const str = this.format(n, '0.' + '0'.repeat(decimalPlaces) + 'a'); if (str === "NaNt") return this.format(n, '0.' + ' '.repeat(decimalPlaces) + 'e+0'); return str; } formatHp(n) { if (n < 1e6) { return this.format(n, "0,0"); } return this.formatReallyBigNumber(n); } formatMoney(n) { return "$" + this.formatReallyBigNumber(n); } formatSkill(n) { if (n < 1e15) { return this.format(n, "0,0"); } return this.formatReallyBigNumber(n); } formatExp(n) { return this.formatReallyBigNumber(n); } formatHashes(n) { return this.formatReallyBigNumber(n); } formatReputation(n) { return this.formatReallyBigNumber(n); } formatFavor(n) { return this.format(n, "0,0"); } formatRAM(n) { return this.format(n, "0.00") + "GB"; } formatPercentage(n, decimalPlaces = 2) { const formatter = "0." + "0".repeat(decimalPlaces) + "%"; return this.format(n, formatter); } formatServerSecurity(n) { return this.format(n, "0,0.000"); } formatRespect(n) { return this.formatReallyBigNumber(n, 5); } formatWanted(n) { return this.formatReallyBigNumber(n, 5); } formatMultiplier(n) { return this.format(n, "0,0.00"); } formatSleeveShock(n) { return this.format(n, "0,0.000"); } formatSleeveSynchro(n) { return this.format(n, "0,0.000"); } formatSleeveMemory(n) { return this.format(n, "0"); } formatPopulation(n) { return this.format(n, "0.000a"); } formatStamina(n) { return this.format(n, "0.0"); } formatShares(n) { if (n < 1000) { return this.format(n, "0"); } return this.formatReallyBigNumber(n); } formatInfiltrationSecurity(n) { return this.formatReallyBigNumber(n); } formatThreads(n) { return this.format(n, "0,0"); } parseMoney(s) { // numeral library does not handle formats like 1e10 well (returns 110), // so if both return a valid number, return the biggest one const numeralValue = numeral_1.default(s).value(); const parsed = parseFloat(s); if (isNaN(parsed) && numeralValue === null) { return NaN; } else if (isNaN(parsed)) { return numeralValue; } else if (numeralValue === null) { return parsed; } else { return Math.max(numeralValue, parsed); } } } exports.numeralWrapper = new NumeralFormatter(); /***/ }), /* 8 */ /*!***********************************!*\ !*** ./src/ui/postToTerminal.tsx ***! \***********************************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.postContent = exports.postElement = exports.hackProgressPost = exports.hackProgressBarPost = exports.postError = exports.post = void 0; const server_1 = __webpack_require__(/*! react-dom/server */ 398); const getElementById_1 = __webpack_require__(/*! ../../utils/uiHelpers/getElementById */ 190); /** * Adds some output to the terminal. * @param input Text or HTML to output to the terminal */ function post(input) { postContent(input); } exports.post = post; function postError(input) { postContent(`ERROR: ${input}`, { color: "#ff2929" }); } exports.postError = postError; /** * Adds some output to the terminal with an identifier of "hack-progress-bar" * @param input Text or HTML to output to the terminal */ function hackProgressBarPost(input) { postContent(input, { id: "hack-progress-bar" }); } exports.hackProgressBarPost = hackProgressBarPost; /** * Adds some output to the terminal with an identifier of "hack-progress" * @param input Text or HTML to output to the terminal */ function hackProgressPost(input) { postContent(input, { id: "hack-progress" }); } exports.hackProgressPost = hackProgressPost; function postElement(element) { postContent(server_1.renderToStaticMarkup(element)); } exports.postElement = postElement; function postContent(input, config = {}) { // tslint:disable-next-line:max-line-length const style = `color: ${config.color != null ? config.color : "var(--my-font-color)"}; background-color:var(--my-background-color);${config.id === undefined ? " white-space:pre-wrap;" : ""}`; // tslint:disable-next-line:max-line-length const content = `${input}`; const inputElement = getElementById_1.getElementById("terminal-input"); inputElement.insertAdjacentHTML("beforebegin", content); scrollTerminalToBottom(); } exports.postContent = postContent; function scrollTerminalToBottom() { const container = getElementById_1.getElementById("terminal-container"); container.scrollTop = container.scrollHeight; } /***/ }), /* 9 */, /* 10 */ /*!*******************************************!*\ !*** ./src/Netscript/RamCostGenerator.ts ***! \*******************************************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getRamCost = exports.RamCosts = exports.RamCostConstants = void 0; // TODO remember to update RamCalculations.js and WorkerScript.js // RAM costs for Netscript functions exports.RamCostConstants = { ScriptBaseRamCost: 1.6, ScriptDomRamCost: 25, ScriptHackRamCost: 0.1, ScriptHackAnalyzeRamCost: 1, ScriptGrowRamCost: 0.15, ScriptGrowthAnalyzeRamCost: 1, ScriptWeakenRamCost: 0.15, ScriptScanRamCost: 0.2, ScriptPortProgramRamCost: 0.05, ScriptRunRamCost: 1.0, ScriptExecRamCost: 1.3, ScriptSpawnRamCost: 2.0, ScriptScpRamCost: 0.6, ScriptKillRamCost: 0.5, ScriptHasRootAccessRamCost: 0.05, ScriptGetHostnameRamCost: 0.05, ScriptGetHackingLevelRamCost: 0.05, ScriptGetMultipliersRamCost: 4.0, ScriptGetServerRamCost: 0.1, ScriptGetServerMaxRam: 0.05, ScriptGetServerUsedRam: 0.05, ScriptFileExistsRamCost: 0.1, ScriptIsRunningRamCost: 0.1, ScriptHacknetNodesRamCost: 4.0, ScriptHNUpgLevelRamCost: 0.4, ScriptHNUpgRamRamCost: 0.6, ScriptHNUpgCoreRamCost: 0.8, ScriptGetStockRamCost: 2.0, ScriptBuySellStockRamCost: 2.5, ScriptGetPurchaseServerRamCost: 0.25, ScriptPurchaseServerRamCost: 2.25, ScriptGetPurchasedServerLimit: 0.05, ScriptGetPurchasedServerMaxRam: 0.05, ScriptRoundRamCost: 0.05, ScriptReadWriteRamCost: 1.0, ScriptArbScriptRamCost: 1.0, ScriptGetScriptRamCost: 0.1, ScriptGetRunningScriptRamCost: 0.3, ScriptGetHackTimeRamCost: 0.05, ScriptGetFavorToDonate: 0.10, ScriptCodingContractBaseRamCost: 10, ScriptSleeveBaseRamCost: 4, ScriptSingularityFn1RamCost: 2, ScriptSingularityFn2RamCost: 3, ScriptSingularityFn3RamCost: 5, ScriptGangApiBaseRamCost: 4, ScriptBladeburnerApiBaseRamCost: 4, }; exports.RamCosts = { hacknet: { numNodes: () => 0, purchaseNode: () => 0, getPurchaseNodeCost: () => 0, getNodeStats: () => 0, upgradeLevel: () => 0, upgradeRam: () => 0, upgradeCore: () => 0, upgradeCache: () => 0, getLevelUpgradeCost: () => 0, getRamUpgradeCost: () => 0, getCoreUpgradeCost: () => 0, getCacheUpgradeCost: () => 0, numHashes: () => 0, hashCost: () => 0, spendHashes: () => 0, }, sprintf: () => 0, vsprintf: () => 0, scan: () => exports.RamCostConstants.ScriptScanRamCost, hack: () => exports.RamCostConstants.ScriptHackRamCost, hackAnalyzeThreads: () => exports.RamCostConstants.ScriptHackAnalyzeRamCost, hackAnalyzePercent: () => exports.RamCostConstants.ScriptHackAnalyzeRamCost, hackChance: () => exports.RamCostConstants.ScriptHackAnalyzeRamCost, sleep: () => 0, grow: () => exports.RamCostConstants.ScriptGrowRamCost, growthAnalyze: () => exports.RamCostConstants.ScriptGrowthAnalyzeRamCost, weaken: () => exports.RamCostConstants.ScriptWeakenRamCost, print: () => 0, tprint: () => 0, clearLog: () => 0, disableLog: () => 0, enableLog: () => 0, isLogEnabled: () => 0, getScriptLogs: () => 0, nuke: () => exports.RamCostConstants.ScriptPortProgramRamCost, brutessh: () => exports.RamCostConstants.ScriptPortProgramRamCost, ftpcrack: () => exports.RamCostConstants.ScriptPortProgramRamCost, relaysmtp: () => exports.RamCostConstants.ScriptPortProgramRamCost, httpworm: () => exports.RamCostConstants.ScriptPortProgramRamCost, sqlinject: () => exports.RamCostConstants.ScriptPortProgramRamCost, run: () => exports.RamCostConstants.ScriptRunRamCost, exec: () => exports.RamCostConstants.ScriptExecRamCost, spawn: () => exports.RamCostConstants.ScriptSpawnRamCost, kill: () => exports.RamCostConstants.ScriptKillRamCost, killall: () => exports.RamCostConstants.ScriptKillRamCost, exit: () => 0, scp: () => exports.RamCostConstants.ScriptScpRamCost, ls: () => exports.RamCostConstants.ScriptScanRamCost, ps: () => exports.RamCostConstants.ScriptScanRamCost, hasRootAccess: () => exports.RamCostConstants.ScriptHasRootAccessRamCost, getIp: () => exports.RamCostConstants.ScriptGetHostnameRamCost, getHostname: () => exports.RamCostConstants.ScriptGetHostnameRamCost, getHackingLevel: () => exports.RamCostConstants.ScriptGetHackingLevelRamCost, getHackingMultipliers: () => exports.RamCostConstants.ScriptGetMultipliersRamCost, getHacknetMultipliers: () => exports.RamCostConstants.ScriptGetMultipliersRamCost, getBitNodeMultipliers: () => exports.RamCostConstants.ScriptGetMultipliersRamCost, getServer: () => exports.RamCostConstants.ScriptGetMultipliersRamCost / 2, getServerMoneyAvailable: () => exports.RamCostConstants.ScriptGetServerRamCost, getServerSecurityLevel: () => exports.RamCostConstants.ScriptGetServerRamCost, getServerBaseSecurityLevel: () => exports.RamCostConstants.ScriptGetServerRamCost, getServerMinSecurityLevel: () => exports.RamCostConstants.ScriptGetServerRamCost, getServerRequiredHackingLevel: () => exports.RamCostConstants.ScriptGetServerRamCost, getServerMaxMoney: () => exports.RamCostConstants.ScriptGetServerRamCost, getServerGrowth: () => exports.RamCostConstants.ScriptGetServerRamCost, getServerNumPortsRequired: () => exports.RamCostConstants.ScriptGetServerRamCost, getServerRam: () => exports.RamCostConstants.ScriptGetServerRamCost, getServerMaxRam: () => exports.RamCostConstants.ScriptGetServerMaxRam, getServerUsedRam: () => exports.RamCostConstants.ScriptGetServerUsedRam, serverExists: () => exports.RamCostConstants.ScriptGetServerRamCost, fileExists: () => exports.RamCostConstants.ScriptFileExistsRamCost, isRunning: () => exports.RamCostConstants.ScriptIsRunningRamCost, getStockSymbols: () => exports.RamCostConstants.ScriptGetStockRamCost, getStockPrice: () => exports.RamCostConstants.ScriptGetStockRamCost, getStockAskPrice: () => exports.RamCostConstants.ScriptGetStockRamCost, getStockBidPrice: () => exports.RamCostConstants.ScriptGetStockRamCost, getStockPosition: () => exports.RamCostConstants.ScriptGetStockRamCost, getStockMaxShares: () => exports.RamCostConstants.ScriptGetStockRamCost, getStockPurchaseCost: () => exports.RamCostConstants.ScriptGetStockRamCost, getStockSaleGain: () => exports.RamCostConstants.ScriptGetStockRamCost, buyStock: () => exports.RamCostConstants.ScriptBuySellStockRamCost, sellStock: () => exports.RamCostConstants.ScriptBuySellStockRamCost, shortStock: () => exports.RamCostConstants.ScriptBuySellStockRamCost, sellShort: () => exports.RamCostConstants.ScriptBuySellStockRamCost, placeOrder: () => exports.RamCostConstants.ScriptBuySellStockRamCost, cancelOrder: () => exports.RamCostConstants.ScriptBuySellStockRamCost, getOrders: () => exports.RamCostConstants.ScriptBuySellStockRamCost, getStockVolatility: () => exports.RamCostConstants.ScriptBuySellStockRamCost, getStockForecast: () => exports.RamCostConstants.ScriptBuySellStockRamCost, purchase4SMarketData: () => exports.RamCostConstants.ScriptBuySellStockRamCost, purchase4SMarketDataTixApi: () => exports.RamCostConstants.ScriptBuySellStockRamCost, getPurchasedServerLimit: () => exports.RamCostConstants.ScriptGetPurchasedServerLimit, getPurchasedServerMaxRam: () => exports.RamCostConstants.ScriptGetPurchasedServerMaxRam, getPurchasedServerCost: () => exports.RamCostConstants.ScriptGetPurchaseServerRamCost, purchaseServer: () => exports.RamCostConstants.ScriptPurchaseServerRamCost, deleteServer: () => exports.RamCostConstants.ScriptPurchaseServerRamCost, getPurchasedServers: () => exports.RamCostConstants.ScriptPurchaseServerRamCost, write: () => exports.RamCostConstants.ScriptReadWriteRamCost, tryWrite: () => exports.RamCostConstants.ScriptReadWriteRamCost, read: () => exports.RamCostConstants.ScriptReadWriteRamCost, peek: () => exports.RamCostConstants.ScriptReadWriteRamCost, clear: () => exports.RamCostConstants.ScriptReadWriteRamCost, getPortHandle: () => exports.RamCostConstants.ScriptReadWriteRamCost * 10, rm: () => exports.RamCostConstants.ScriptReadWriteRamCost, scriptRunning: () => exports.RamCostConstants.ScriptArbScriptRamCost, scriptKill: () => exports.RamCostConstants.ScriptArbScriptRamCost, getScriptName: () => 0, getScriptRam: () => exports.RamCostConstants.ScriptGetScriptRamCost, getHackTime: () => exports.RamCostConstants.ScriptGetHackTimeRamCost, getGrowTime: () => exports.RamCostConstants.ScriptGetHackTimeRamCost, getWeakenTime: () => exports.RamCostConstants.ScriptGetHackTimeRamCost, getScriptIncome: () => exports.RamCostConstants.ScriptGetScriptRamCost, getScriptExpGain: () => exports.RamCostConstants.ScriptGetScriptRamCost, getRunningScript: () => exports.RamCostConstants.ScriptGetRunningScriptRamCost, nFormat: () => 0, getTimeSinceLastAug: () => exports.RamCostConstants.ScriptGetHackTimeRamCost, prompt: () => 0, wget: () => 0, getFavorToDonate: () => exports.RamCostConstants.ScriptGetFavorToDonate, // Singularity Functions universityCourse: () => exports.RamCostConstants.ScriptSingularityFn1RamCost, gymWorkout: () => exports.RamCostConstants.ScriptSingularityFn1RamCost, travelToCity: () => exports.RamCostConstants.ScriptSingularityFn1RamCost, purchaseTor: () => exports.RamCostConstants.ScriptSingularityFn1RamCost, purchaseProgram: () => exports.RamCostConstants.ScriptSingularityFn1RamCost, getCurrentServer: () => exports.RamCostConstants.ScriptSingularityFn1RamCost, connect: () => exports.RamCostConstants.ScriptSingularityFn1RamCost, manualHack: () => exports.RamCostConstants.ScriptSingularityFn1RamCost, installBackdoor: () => exports.RamCostConstants.ScriptSingularityFn1RamCost, getStats: () => exports.RamCostConstants.ScriptSingularityFn1RamCost / 4, getCharacterInformation: () => exports.RamCostConstants.ScriptSingularityFn1RamCost / 4, getPlayer: () => exports.RamCostConstants.ScriptSingularityFn1RamCost / 4, hospitalize: () => exports.RamCostConstants.ScriptSingularityFn1RamCost / 4, isBusy: () => exports.RamCostConstants.ScriptSingularityFn1RamCost / 4, stopAction: () => exports.RamCostConstants.ScriptSingularityFn1RamCost / 2, upgradeHomeRam: () => exports.RamCostConstants.ScriptSingularityFn2RamCost, getUpgradeHomeRamCost: () => exports.RamCostConstants.ScriptSingularityFn2RamCost / 2, workForCompany: () => exports.RamCostConstants.ScriptSingularityFn2RamCost, applyToCompany: () => exports.RamCostConstants.ScriptSingularityFn2RamCost, getCompanyRep: () => exports.RamCostConstants.ScriptSingularityFn2RamCost / 3, getCompanyFavor: () => exports.RamCostConstants.ScriptSingularityFn2RamCost / 3, getCompanyFavorGain: () => exports.RamCostConstants.ScriptSingularityFn2RamCost / 4, checkFactionInvitations: () => exports.RamCostConstants.ScriptSingularityFn2RamCost, joinFaction: () => exports.RamCostConstants.ScriptSingularityFn2RamCost, workForFaction: () => exports.RamCostConstants.ScriptSingularityFn2RamCost, getFactionRep: () => exports.RamCostConstants.ScriptSingularityFn2RamCost / 3, getFactionFavor: () => exports.RamCostConstants.ScriptSingularityFn2RamCost / 3, getFactionFavorGain: () => exports.RamCostConstants.ScriptSingularityFn2RamCost / 4, donateToFaction: () => exports.RamCostConstants.ScriptSingularityFn3RamCost, createProgram: () => exports.RamCostConstants.ScriptSingularityFn3RamCost, commitCrime: () => exports.RamCostConstants.ScriptSingularityFn3RamCost, getCrimeChance: () => exports.RamCostConstants.ScriptSingularityFn3RamCost, getCrimeStats: () => exports.RamCostConstants.ScriptSingularityFn3RamCost, getOwnedAugmentations: () => exports.RamCostConstants.ScriptSingularityFn3RamCost, getOwnedSourceFiles: () => exports.RamCostConstants.ScriptSingularityFn3RamCost, getAugmentationsFromFaction: () => exports.RamCostConstants.ScriptSingularityFn3RamCost, getAugmentationPrereq: () => exports.RamCostConstants.ScriptSingularityFn3RamCost, getAugmentationCost: () => exports.RamCostConstants.ScriptSingularityFn3RamCost, getAugmentationStats: () => exports.RamCostConstants.ScriptSingularityFn3RamCost, purchaseAugmentation: () => exports.RamCostConstants.ScriptSingularityFn3RamCost, softReset: () => exports.RamCostConstants.ScriptSingularityFn3RamCost, installAugmentations: () => exports.RamCostConstants.ScriptSingularityFn3RamCost, // Gang API gang: { createGang: () => exports.RamCostConstants.ScriptGangApiBaseRamCost / 4, inGang: () => exports.RamCostConstants.ScriptGangApiBaseRamCost / 4, getMemberNames: () => exports.RamCostConstants.ScriptGangApiBaseRamCost / 4, getGangInformation: () => exports.RamCostConstants.ScriptGangApiBaseRamCost / 2, getOtherGangInformation: () => exports.RamCostConstants.ScriptGangApiBaseRamCost / 2, getMemberInformation: () => exports.RamCostConstants.ScriptGangApiBaseRamCost / 2, canRecruitMember: () => exports.RamCostConstants.ScriptGangApiBaseRamCost / 4, recruitMember: () => exports.RamCostConstants.ScriptGangApiBaseRamCost / 2, getTaskNames: () => exports.RamCostConstants.ScriptGangApiBaseRamCost / 4, getTaskStats: () => exports.RamCostConstants.ScriptGangApiBaseRamCost / 4, setMemberTask: () => exports.RamCostConstants.ScriptGangApiBaseRamCost / 2, getEquipmentNames: () => exports.RamCostConstants.ScriptGangApiBaseRamCost / 4, getEquipmentCost: () => exports.RamCostConstants.ScriptGangApiBaseRamCost / 2, getEquipmentType: () => exports.RamCostConstants.ScriptGangApiBaseRamCost / 2, getEquipmentStats: () => exports.RamCostConstants.ScriptGangApiBaseRamCost / 2, purchaseEquipment: () => exports.RamCostConstants.ScriptGangApiBaseRamCost, ascendMember: () => exports.RamCostConstants.ScriptGangApiBaseRamCost, setTerritoryWarfare: () => exports.RamCostConstants.ScriptGangApiBaseRamCost / 2, getChanceToWinClash: () => exports.RamCostConstants.ScriptGangApiBaseRamCost, getBonusTime: () => 0, }, // Bladeburner API bladeburner: { getContractNames: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost / 10, getOperationNames: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost / 10, getBlackOpNames: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost / 10, getBlackOpRank: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost / 2, getGeneralActionNames: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost / 10, getSkillNames: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost / 10, startAction: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, stopBladeburnerAction: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost / 2, getCurrentAction: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost / 4, getActionTime: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, getActionEstimatedSuccessChance: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, getActionRepGain: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, getActionCountRemaining: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, getActionMaxLevel: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, getActionCurrentLevel: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, getActionAutolevel: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, setActionAutolevel: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, setActionLevel: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, getRank: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, getSkillPoints: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, getSkillLevel: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, getSkillUpgradeCost: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, upgradeSkill: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, getTeamSize: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, setTeamSize: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, getCityEstimatedPopulation: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, getCityEstimatedCommunities: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, getCityChaos: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, getCity: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, switchCity: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, getStamina: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, joinBladeburnerFaction: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, joinBladeburnerDivision: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, getBonusTime: () => 0, }, // Coding Contract API codingcontract: { attempt: () => exports.RamCostConstants.ScriptCodingContractBaseRamCost, getContractType: () => exports.RamCostConstants.ScriptCodingContractBaseRamCost / 2, getData: () => exports.RamCostConstants.ScriptCodingContractBaseRamCost / 2, getDescription: () => exports.RamCostConstants.ScriptCodingContractBaseRamCost / 2, getNumTriesRemaining: () => exports.RamCostConstants.ScriptCodingContractBaseRamCost / 5, }, // Duplicate Sleeve API sleeve: { getNumSleeves: () => exports.RamCostConstants.ScriptSleeveBaseRamCost, setToShockRecovery: () => exports.RamCostConstants.ScriptSleeveBaseRamCost, setToSynchronize: () => exports.RamCostConstants.ScriptSleeveBaseRamCost, setToCommitCrime: () => exports.RamCostConstants.ScriptSleeveBaseRamCost, setToUniversityCourse: () => exports.RamCostConstants.ScriptSleeveBaseRamCost, travel: () => exports.RamCostConstants.ScriptSleeveBaseRamCost, setToCompanyWork: () => exports.RamCostConstants.ScriptSleeveBaseRamCost, setToFactionWork: () => exports.RamCostConstants.ScriptSleeveBaseRamCost, setToGymWorkout: () => exports.RamCostConstants.ScriptSleeveBaseRamCost, getSleeveStats: () => exports.RamCostConstants.ScriptSleeveBaseRamCost, getTask: () => exports.RamCostConstants.ScriptSleeveBaseRamCost, getInformation: () => exports.RamCostConstants.ScriptSleeveBaseRamCost, getSleeveAugmentations: () => exports.RamCostConstants.ScriptSleeveBaseRamCost, getSleevePurchasableAugs: () => exports.RamCostConstants.ScriptSleeveBaseRamCost, purchaseSleeveAug: () => exports.RamCostConstants.ScriptSleeveBaseRamCost, }, heart: { // Easter egg function break: () => 0, }, }; function getRamCost(...args) { if (args.length === 0) { console.warn(`No arguments passed to getRamCost()`); return 0; } let curr = exports.RamCosts[args[0]]; for (let i = 1; i < args.length; ++i) { if (curr == null) { console.warn(`Invalid function passed to getRamCost: ${args}`); return 0; } const currType = typeof curr; if (currType === "function" || currType === "number") { break; } curr = curr[args[i]]; } const currType = typeof curr; if (currType === "function") { return curr(); } if (currType === "number") { return curr; } console.warn(`Unexpected type (${currType}) for value [${args}]`); return 0; } exports.getRamCost = getRamCost; /***/ }), /* 11 */ /*!**************************!*\ !*** ./src/Constants.ts ***! \**************************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CONSTANTS = void 0; exports.CONSTANTS = { Version: "0.52.9", // Speed (in ms) at which the main loop is updated _idleSpeed: 200, /** Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience * and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then * the player will have this level assuming no multipliers. Multipliers can cause skills to go above this. */ MaxSkillLevel: 975, // Milliseconds per game cycle MilliPerCycle: 200, // How much reputation is needed to join a megacorporation's faction CorpFactionRepRequirement: 200e3, // Base RAM costs BaseCostFor1GBOfRamHome: 32000, BaseCostFor1GBOfRamServer: 55000, // Cost to travel to another city TravelCost: 200e3, // Faction and Company favor-related things BaseFavorToDonate: 150, DonateMoneyToRepDivisor: 1e6, FactionReputationToFavorBase: 500, FactionReputationToFavorMult: 1.02, CompanyReputationToFavorBase: 500, CompanyReputationToFavorMult: 1.02, // NeuroFlux Governor Augmentation cost multiplier NeuroFluxGovernorLevelMult: 1.14, NumNetscriptPorts: 20, // Server-related constants HomeComputerMaxRam: 1073741824, ServerBaseGrowthRate: 1.03, ServerMaxGrowthRate: 1.0035, ServerFortifyAmount: 0.002, ServerWeakenAmount: 0.05, PurchasedServerLimit: 25, PurchasedServerMaxRam: 1048576, // Augmentation Constants MultipleAugMultiplier: 1.9, // TOR Router TorRouterCost: 200e3, // Infiltration InfiltrationBribeBaseAmount: 100e3, InfiltrationMoneyValue: 5e3, InfiltrationRepValue: 1.4, InfiltrationExpPow: 0.8, // Stock market WSEAccountCost: 200e6, TIXAPICost: 5e9, MarketData4SCost: 1e9, MarketDataTixApi4SCost: 25e9, StockMarketCommission: 100e3, // Hospital/Health HospitalCostPerHp: 100e3, // Intelligence-related constants IntelligenceCrimeWeight: 0.025, IntelligenceInfiltrationWeight: 0.1, IntelligenceCrimeBaseExpGain: 0.05, IntelligenceProgramBaseExpGain: 2.5, IntelligenceTerminalHackBaseExpGain: 200, IntelligenceSingFnBaseExpGain: 1.5, IntelligenceClassBaseExpGain: 0.01, IntelligenceHackingMissionBaseExpGain: 3, // Hacking Missions // TODO Move this into Hacking Mission implementation HackingMissionRepToDiffConversion: 10000, HackingMissionRepToRewardConversion: 7, HackingMissionSpamTimeIncrease: 25000, HackingMissionTransferAttackIncrease: 1.05, HackingMissionMiscDefenseIncrease: 1.05, HackingMissionDifficultyToHacking: 135, HackingMissionHowToPlay: "Hacking missions are a minigame that, if won, will reward you with faction reputation.

" + "In this game you control a set of Nodes and use them to try and defeat an enemy. Your Nodes " + "are colored blue, while the enemy's are red. There are also other nodes on the map colored gray " + "that initially belong to neither you nor the enemy. The goal of the game is " + "to capture all of the enemy's Database nodes within the time limit. " + "If you fail to do this, you will lose.

" + "Each Node has three stats: Attack, Defense, and HP. There are five different actions that " + "a Node can take:

" + "Attack - Targets an enemy Node and lowers its HP. The effectiveness is determined by the owner's Attack, the Player's " + "hacking level, and the enemy's defense.

" + "Scan - Targets an enemy Node and lowers its Defense. The effectiveness is determined by the owner's Attack, the Player's hacking level, and the " + "enemy's defense.

" + "Weaken - Targets an enemy Node and lowers its Attack. The effectiveness is determined by the owner's Attack, the Player's hacking level, and the enemy's " + "defense.

" + "Fortify - Raises the Node's Defense. The effectiveness is determined by your hacking level.

" + "Overflow - Raises the Node's Attack but lowers its Defense. The effectiveness is determined by your hacking level.

" + "Note that when determining the effectiveness of the above actions, the TOTAL Attack or Defense of the team is used, not just the " + "Attack/Defense of the individual Node that is performing the action.

" + "To capture a Node, you must lower its HP down to 0.

" + "There are six different types of Nodes:

" + "CPU Core - These are your main Nodes that are used to perform actions. Capable of performing every action

" + "Firewall - Nodes with high defense. These Nodes can 'Fortify'

" + "Database - A special type of Node. The player's objective is to conquer all of the enemy's Database Nodes within " + "the time limit. These Nodes cannot perform any actions

" + "Spam - Conquering one of these Nodes will slow the enemy's trace, giving the player additional time to complete " + "the mission. These Nodes cannot perform any actions

" + "Transfer - Conquering one of these nodes will increase the Attack of all of your CPU Cores by a small fixed percentage. " + "These Nodes are capable of performing every action except the 'Attack' action

" + "Shield - Nodes with high defense. These Nodes can 'Fortify'

" + "To assign an action to a Node, you must first select one of your Nodes. This can be done by simply clicking on it. Double-clicking " + "a node will select all of your Nodes of the same type (e.g. select all CPU Core Nodes or all Transfer Nodes). Note that only Nodes " + "that can perform actions (CPU Core, Transfer, Shield, Firewall) can be selected. Selected Nodes will be denoted with a white highlight. After selecting a Node or multiple Nodes, " + "select its action using the Action Buttons near the top of the screen. Every action also has a corresponding keyboard " + "shortcut.

" + "For certain actions such as attacking, scanning, and weakening, the Node performing the action must have a target. To target " + "another node, simply click-and-drag from the 'source' Node to a target. A Node can only have one target, and you can target " + "any Node that is adjacent to one of your Nodes (immediately above, below, or to the side. NOT diagonal). Furthermore, only CPU Cores and Transfer Nodes " + "can target, since they are the only ones that can perform the related actions. To remove a target, you can simply click on the line that represents " + "the connection between one of your Nodes and its target. Alternatively, you can select the 'source' Node and click the 'Drop Connection' button, " + "or press 'd'.

" + "Other Notes:

" + "-Whenever a miscellenaous Node (not owned by the player or enemy) is conquered, the defense of all remaining miscellaneous Nodes that " + "are not actively being targeted will increase by a fixed percentage.

" + "-Whenever a Node is conquered, its stats are significantly reduced

" + "-Miscellaneous Nodes slowly raise their defense over time

" + "-Nodes slowly regenerate health over time.", // Time-related constants MillisecondsPer20Hours: 72000000, GameCyclesPer20Hours: 72000000 / 200, MillisecondsPer10Hours: 36000000, GameCyclesPer10Hours: 36000000 / 200, MillisecondsPer8Hours: 28800000, GameCyclesPer8Hours: 28800000 / 200, MillisecondsPer4Hours: 14400000, GameCyclesPer4Hours: 14400000 / 200, MillisecondsPer2Hours: 7200000, GameCyclesPer2Hours: 7200000 / 200, MillisecondsPerHour: 3600000, GameCyclesPerHour: 3600000 / 200, MillisecondsPerHalfHour: 1800000, GameCyclesPerHalfHour: 1800000 / 200, MillisecondsPerQuarterHour: 900000, GameCyclesPerQuarterHour: 900000 / 200, MillisecondsPerFiveMinutes: 300000, GameCyclesPerFiveMinutes: 300000 / 200, // Player Work & Action FactionWorkHacking: "Faction Hacking Work", FactionWorkField: "Faction Field Work", FactionWorkSecurity: "Faction Security Work", WorkTypeCompany: "Working for Company", WorkTypeCompanyPartTime: "Working for Company part-time", WorkTypeFaction: "Working for Faction", WorkTypeCreateProgram: "Working on Create a Program", WorkTypeStudyClass: "Studying or Taking a class at university", WorkTypeCrime: "Committing a crime", ClassStudyComputerScience: "studying Computer Science", ClassDataStructures: "taking a Data Structures course", ClassNetworks: "taking a Networks course", ClassAlgorithms: "taking an Algorithms course", ClassManagement: "taking a Management course", ClassLeadership: "taking a Leadership course", ClassGymStrength: "training your strength at a gym", ClassGymDefense: "training your defense at a gym", ClassGymDexterity: "training your dexterity at a gym", ClassGymAgility: "training your agility at a gym", ClassDataStructuresBaseCost: 40, ClassNetworksBaseCost: 80, ClassAlgorithmsBaseCost: 320, ClassManagementBaseCost: 160, ClassLeadershipBaseCost: 320, ClassGymBaseCost: 120, ClassStudyComputerScienceBaseExp: 0.5, ClassDataStructuresBaseExp: 1, ClassNetworksBaseExp: 2, ClassAlgorithmsBaseExp: 4, ClassManagementBaseExp: 2, ClassLeadershipBaseExp: 4, CrimeShoplift: "shoplift", CrimeRobStore: "rob a store", CrimeMug: "mug someone", CrimeLarceny: "commit larceny", CrimeDrugs: "deal drugs", CrimeBondForgery: "forge corporate bonds", CrimeTraffickArms: "traffick illegal arms", CrimeHomicide: "commit homicide", CrimeGrandTheftAuto: "commit grand theft auto", CrimeKidnap: "kidnap someone for ransom", CrimeAssassination: "assassinate a high-profile target", CrimeHeist: "pull off the ultimate heist", // Coding Contract // TODO: Move this into Coding contract implementation? CodingContractBaseFactionRepGain: 2500, CodingContractBaseCompanyRepGain: 4000, CodingContractBaseMoneyGain: 75e6, // BitNode/Source-File related stuff TotalNumBitNodes: 24, LatestUpdate: ` v0.52.9 - 2021-07-27 Less lag! (hydroflame & community) ------------------------------------------- ** Active Scripts page ** * Now less laggy, has pagination. ** File diagnostic ** * Added a popup found under options that shows the files you own and how large they are. This help find bugs and leftover massive logs files. ** Corporation ** * Added safeguard against a very specific bug that causes NaN money. I'm still not sure what the root cause is but it should prevent corp from breaking. ** Netscript ** * tprintf is a new function that doesn't print the filename. ** Misc. ** * Infiltration kills you if you try to automate it. (@threehams) * Fix beautify button not working * Added bladeburner_analysis_mult to getPlayer() (@brusby) * Fixed joining bladeburner via netscript functions. (@omuretsu) * All bladeburner actions are click-to-copy * nerf noodle bar `, /* */ }; /***/ }), /* 12 */ /*!*******************************************!*\ !*** ./src/Augmentation/Augmentations.ts ***! \*******************************************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Augmentations = void 0; exports.Augmentations = {}; /***/ }), /* 13 */ /*!*****************************!*\ !*** ./utils/DialogBox.tsx ***! \*****************************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.dialogBoxCreate = exports.MessagePopup = void 0; const createPopup_1 = __webpack_require__(/*! ../src/ui/React/createPopup */ 41); const getRandomInt_1 = __webpack_require__(/*! ./helpers/getRandomInt */ 45); const react_1 = __importDefault(__webpack_require__(/*! react */ 0)); function MessagePopup(props) { return (react_1.default.createElement(react_1.default.Fragment, null, props.content)); } exports.MessagePopup = MessagePopup; function dialogBoxCreate(txt, preformatted = false) { const popupId = `popup-` + (Array.from(Array(16))).map(() => `${getRandomInt_1.getRandomInt(0, 9)}`).join(''); if (typeof txt === 'string') { if (preformatted) { // For text files as they are often computed data that // shouldn't be wrapped and should retain tabstops. createPopup_1.createPopup(popupId, MessagePopup, { content: (react_1.default.createElement("pre", { dangerouslySetInnerHTML: { __html: txt } })), }); } else { createPopup_1.createPopup(popupId, MessagePopup, { content: (react_1.default.createElement("p", { dangerouslySetInnerHTML: { __html: txt.replace(/(?:\r\n|\r|\n)/g, '
') } })), }); } } else { createPopup_1.createPopup(popupId, MessagePopup, { content: txt, }); } } exports.dialogBoxCreate = dialogBoxCreate; /***/ }), /* 14 */, /* 15 */ /*!************************!*\ !*** ./src/engine.jsx ***! \************************/ /*! exports provided: Engine */ /*! all exports used */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Engine", function() { return Engine; }); /* harmony import */ var _utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/StringHelperFunctions */ 23); /* harmony import */ var _utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _Augmentation_Augmentations__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Augmentation/Augmentations */ 12); /* harmony import */ var _Augmentation_Augmentations__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_Augmentation_Augmentations__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _Augmentation_AugmentationHelpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Augmentation/AugmentationHelpers */ 79); /* harmony import */ var _Augmentation_data_AugmentationNames__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Augmentation/data/AugmentationNames */ 4); /* harmony import */ var _Augmentation_data_AugmentationNames__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_Augmentation_data_AugmentationNames__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var _BitNode_BitNode__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./BitNode/BitNode */ 127); /* harmony import */ var _BitNode_BitNode__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_BitNode_BitNode__WEBPACK_IMPORTED_MODULE_4__); /* harmony import */ var _Bladeburner_Bladeburner__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Bladeburner/Bladeburner */ 94); /* harmony import */ var _Bladeburner_Bladeburner__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_Bladeburner_Bladeburner__WEBPACK_IMPORTED_MODULE_5__); /* harmony import */ var _ui_React_CharacterOverview__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ui/React/CharacterOverview */ 767); /* harmony import */ var _CinematicText__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./CinematicText */ 450); /* harmony import */ var _CodingContractGenerator__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./CodingContractGenerator */ 176); /* harmony import */ var _CodingContractGenerator__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_CodingContractGenerator__WEBPACK_IMPORTED_MODULE_8__); /* harmony import */ var _Company_Companies__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./Company/Companies */ 33); /* harmony import */ var _Company_Companies__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_Company_Companies__WEBPACK_IMPORTED_MODULE_9__); /* harmony import */ var _Corporation_Corporation__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./Corporation/Corporation */ 122); /* harmony import */ var _Corporation_Corporation__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_Corporation_Corporation__WEBPACK_IMPORTED_MODULE_10__); /* harmony import */ var _Constants__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./Constants */ 11); /* harmony import */ var _Constants__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(_Constants__WEBPACK_IMPORTED_MODULE_11__); /* harmony import */ var _DevMenu__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./DevMenu */ 532); /* harmony import */ var _Faction_Factions__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./Faction/Factions */ 17); /* harmony import */ var _Faction_Factions__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(_Faction_Factions__WEBPACK_IMPORTED_MODULE_13__); /* harmony import */ var _Faction_FactionHelpers__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./Faction/FactionHelpers */ 71); /* harmony import */ var _Faction_ui_FactionList__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./Faction/ui/FactionList */ 766); /* harmony import */ var _Faction_ui_FactionList__WEBPACK_IMPORTED_MODULE_15___default = /*#__PURE__*/__webpack_require__.n(_Faction_ui_FactionList__WEBPACK_IMPORTED_MODULE_15__); /* harmony import */ var _Gang_Helpers__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./Gang/Helpers */ 765); /* harmony import */ var _Gang_Helpers__WEBPACK_IMPORTED_MODULE_16___default = /*#__PURE__*/__webpack_require__.n(_Gang_Helpers__WEBPACK_IMPORTED_MODULE_16__); /* harmony import */ var _Bladeburner_ui_Root__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./Bladeburner/ui/Root */ 764); /* harmony import */ var _Bladeburner_ui_Root__WEBPACK_IMPORTED_MODULE_17___default = /*#__PURE__*/__webpack_require__.n(_Bladeburner_ui_Root__WEBPACK_IMPORTED_MODULE_17__); /* harmony import */ var _Infiltration_Helper__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./Infiltration/Helper */ 763); /* harmony import */ var _Infiltration_Helper__WEBPACK_IMPORTED_MODULE_18___default = /*#__PURE__*/__webpack_require__.n(_Infiltration_Helper__WEBPACK_IMPORTED_MODULE_18__); /* harmony import */ var _PersonObjects_formulas_reputation__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./PersonObjects/formulas/reputation */ 109); /* harmony import */ var _PersonObjects_formulas_reputation__WEBPACK_IMPORTED_MODULE_19___default = /*#__PURE__*/__webpack_require__.n(_PersonObjects_formulas_reputation__WEBPACK_IMPORTED_MODULE_19__); /* harmony import */ var _Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./Fconf/FconfSettings */ 39); /* harmony import */ var _Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_20___default = /*#__PURE__*/__webpack_require__.n(_Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_20__); /* harmony import */ var _Hacknet_HacknetHelpers__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./Hacknet/HacknetHelpers */ 25); /* harmony import */ var _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./InteractiveTutorial */ 43); /* harmony import */ var _Locations_data_LocationNames__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./Locations/data/LocationNames */ 40); /* harmony import */ var _Locations_data_LocationNames__WEBPACK_IMPORTED_MODULE_23___default = /*#__PURE__*/__webpack_require__.n(_Locations_data_LocationNames__WEBPACK_IMPORTED_MODULE_23__); /* harmony import */ var _Locations_ui_Root__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./Locations/ui/Root */ 455); /* harmony import */ var _Locations_ui_Root__WEBPACK_IMPORTED_MODULE_24___default = /*#__PURE__*/__webpack_require__.n(_Locations_ui_Root__WEBPACK_IMPORTED_MODULE_24__); /* harmony import */ var _Message_MessageHelpers__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./Message/MessageHelpers */ 87); /* harmony import */ var _Missions__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./Missions */ 81); /* harmony import */ var _Netscript_WorkerScripts__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./Netscript/WorkerScripts */ 112); /* harmony import */ var _Netscript_WorkerScripts__WEBPACK_IMPORTED_MODULE_27___default = /*#__PURE__*/__webpack_require__.n(_Netscript_WorkerScripts__WEBPACK_IMPORTED_MODULE_27__); /* harmony import */ var _NetscriptWorker__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./NetscriptWorker */ 80); /* harmony import */ var _Server_ServerHelpers__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./Server/ServerHelpers */ 22); /* harmony import */ var _Server_ServerHelpers__WEBPACK_IMPORTED_MODULE_29___default = /*#__PURE__*/__webpack_require__.n(_Server_ServerHelpers__WEBPACK_IMPORTED_MODULE_29__); /* harmony import */ var _Player__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./Player */ 2); /* harmony import */ var _Prestige__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./Prestige */ 173); /* harmony import */ var _Programs_ProgramHelpers__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./Programs/ProgramHelpers */ 304); /* harmony import */ var _RedPill__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./RedPill */ 103); /* harmony import */ var _SaveObject__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ./SaveObject */ 114); /* harmony import */ var _ScriptEditor_ui_Root__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ./ScriptEditor/ui/Root */ 714); /* harmony import */ var _ScriptEditor_ui_Root__WEBPACK_IMPORTED_MODULE_35___default = /*#__PURE__*/__webpack_require__.n(_ScriptEditor_ui_Root__WEBPACK_IMPORTED_MODULE_35__); /* harmony import */ var _Server_AllServers__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ./Server/AllServers */ 20); /* harmony import */ var _Server_AllServers__WEBPACK_IMPORTED_MODULE_36___default = /*#__PURE__*/__webpack_require__.n(_Server_AllServers__WEBPACK_IMPORTED_MODULE_36__); /* harmony import */ var _Settings_Settings__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! ./Settings/Settings */ 24); /* harmony import */ var _Settings_Settings__WEBPACK_IMPORTED_MODULE_37___default = /*#__PURE__*/__webpack_require__.n(_Settings_Settings__WEBPACK_IMPORTED_MODULE_37__); /* harmony import */ var _SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(/*! ./SourceFile/SourceFileFlags */ 37); /* harmony import */ var _SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_38___default = /*#__PURE__*/__webpack_require__.n(_SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_38__); /* harmony import */ var _Server_SpecialServerIps__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(/*! ./Server/SpecialServerIps */ 38); /* harmony import */ var _Server_SpecialServerIps__WEBPACK_IMPORTED_MODULE_39___default = /*#__PURE__*/__webpack_require__.n(_Server_SpecialServerIps__WEBPACK_IMPORTED_MODULE_39__); /* harmony import */ var _StockMarket_StockMarket__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(/*! ./StockMarket/StockMarket */ 47); /* harmony import */ var _StockMarket_StockMarket__WEBPACK_IMPORTED_MODULE_40___default = /*#__PURE__*/__webpack_require__.n(_StockMarket_StockMarket__WEBPACK_IMPORTED_MODULE_40__); /* harmony import */ var _Milestones_MilestoneHelpers__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(/*! ./Milestones/MilestoneHelpers */ 701); /* harmony import */ var _Milestones_MilestoneHelpers__WEBPACK_IMPORTED_MODULE_41___default = /*#__PURE__*/__webpack_require__.n(_Milestones_MilestoneHelpers__WEBPACK_IMPORTED_MODULE_41__); /* harmony import */ var _Terminal__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(/*! ./Terminal */ 74); /* harmony import */ var _PersonObjects_Sleeve_Sleeve__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(/*! ./PersonObjects/Sleeve/Sleeve */ 178); /* harmony import */ var _PersonObjects_Sleeve_Sleeve__WEBPACK_IMPORTED_MODULE_43___default = /*#__PURE__*/__webpack_require__.n(_PersonObjects_Sleeve_Sleeve__WEBPACK_IMPORTED_MODULE_43__); /* harmony import */ var _PersonObjects_Sleeve_SleeveUI__WEBPACK_IMPORTED_MODULE_44__ = __webpack_require__(/*! ./PersonObjects/Sleeve/SleeveUI */ 451); /* harmony import */ var _PersonObjects_Sleeve_SleeveUI__WEBPACK_IMPORTED_MODULE_44___default = /*#__PURE__*/__webpack_require__.n(_PersonObjects_Sleeve_SleeveUI__WEBPACK_IMPORTED_MODULE_44__); /* harmony import */ var _PersonObjects_Resleeving_ResleevingUI__WEBPACK_IMPORTED_MODULE_45__ = __webpack_require__(/*! ./PersonObjects/Resleeving/ResleevingUI */ 526); /* harmony import */ var _PersonObjects_Resleeving_ResleevingUI__WEBPACK_IMPORTED_MODULE_45___default = /*#__PURE__*/__webpack_require__.n(_PersonObjects_Resleeving_ResleevingUI__WEBPACK_IMPORTED_MODULE_45__); /* harmony import */ var _ui_createStatusText__WEBPACK_IMPORTED_MODULE_46__ = __webpack_require__(/*! ./ui/createStatusText */ 141); /* harmony import */ var _ui_createStatusText__WEBPACK_IMPORTED_MODULE_46___default = /*#__PURE__*/__webpack_require__.n(_ui_createStatusText__WEBPACK_IMPORTED_MODULE_46__); /* harmony import */ var _ui_CharacterInfo__WEBPACK_IMPORTED_MODULE_47__ = __webpack_require__(/*! ./ui/CharacterInfo */ 700); /* harmony import */ var _ui_CharacterInfo__WEBPACK_IMPORTED_MODULE_47___default = /*#__PURE__*/__webpack_require__.n(_ui_CharacterInfo__WEBPACK_IMPORTED_MODULE_47__); /* harmony import */ var _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__ = __webpack_require__(/*! ./ui/navigationTracking */ 18); /* harmony import */ var _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48___default = /*#__PURE__*/__webpack_require__.n(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__); /* harmony import */ var _ui_setSettingsLabels__WEBPACK_IMPORTED_MODULE_49__ = __webpack_require__(/*! ./ui/setSettingsLabels */ 699); /* harmony import */ var _ui_React_Money__WEBPACK_IMPORTED_MODULE_50__ = __webpack_require__(/*! ./ui/React/Money */ 27); /* harmony import */ var _ui_React_Money__WEBPACK_IMPORTED_MODULE_50___default = /*#__PURE__*/__webpack_require__.n(_ui_React_Money__WEBPACK_IMPORTED_MODULE_50__); /* harmony import */ var _ui_React_Hashes__WEBPACK_IMPORTED_MODULE_51__ = __webpack_require__(/*! ./ui/React/Hashes */ 126); /* harmony import */ var _ui_React_Hashes__WEBPACK_IMPORTED_MODULE_51___default = /*#__PURE__*/__webpack_require__.n(_ui_React_Hashes__WEBPACK_IMPORTED_MODULE_51__); /* harmony import */ var _ui_React_Reputation__WEBPACK_IMPORTED_MODULE_52__ = __webpack_require__(/*! ./ui/React/Reputation */ 59); /* harmony import */ var _ui_React_Reputation__WEBPACK_IMPORTED_MODULE_52___default = /*#__PURE__*/__webpack_require__.n(_ui_React_Reputation__WEBPACK_IMPORTED_MODULE_52__); /* harmony import */ var _ui_ActiveScripts_Root__WEBPACK_IMPORTED_MODULE_53__ = __webpack_require__(/*! ./ui/ActiveScripts/Root */ 525); /* harmony import */ var _ui_ActiveScripts_Root__WEBPACK_IMPORTED_MODULE_53___default = /*#__PURE__*/__webpack_require__.n(_ui_ActiveScripts_Root__WEBPACK_IMPORTED_MODULE_53__); /* harmony import */ var _ui_MainMenu_Headers__WEBPACK_IMPORTED_MODULE_54__ = __webpack_require__(/*! ./ui/MainMenu/Headers */ 698); /* harmony import */ var _ui_MainMenu_Headers__WEBPACK_IMPORTED_MODULE_54___default = /*#__PURE__*/__webpack_require__.n(_ui_MainMenu_Headers__WEBPACK_IMPORTED_MODULE_54__); /* harmony import */ var _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__ = __webpack_require__(/*! ./ui/MainMenu/Links */ 31); /* harmony import */ var _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55___default = /*#__PURE__*/__webpack_require__.n(_ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__); /* harmony import */ var _Diagnostic_FileDiagnosticPopup__WEBPACK_IMPORTED_MODULE_56__ = __webpack_require__(/*! ./Diagnostic/FileDiagnosticPopup */ 697); /* harmony import */ var _Diagnostic_FileDiagnosticPopup__WEBPACK_IMPORTED_MODULE_56___default = /*#__PURE__*/__webpack_require__.n(_Diagnostic_FileDiagnosticPopup__WEBPACK_IMPORTED_MODULE_56__); /* harmony import */ var _ui_React_createPopup__WEBPACK_IMPORTED_MODULE_57__ = __webpack_require__(/*! ./ui/React/createPopup */ 41); /* harmony import */ var _ui_React_createPopup__WEBPACK_IMPORTED_MODULE_57___default = /*#__PURE__*/__webpack_require__.n(_ui_React_createPopup__WEBPACK_IMPORTED_MODULE_57__); /* harmony import */ var _utils_DialogBox__WEBPACK_IMPORTED_MODULE_58__ = __webpack_require__(/*! ../utils/DialogBox */ 13); /* harmony import */ var _utils_DialogBox__WEBPACK_IMPORTED_MODULE_58___default = /*#__PURE__*/__webpack_require__.n(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_58__); /* harmony import */ var _utils_GameOptions__WEBPACK_IMPORTED_MODULE_59__ = __webpack_require__(/*! ../utils/GameOptions */ 303); /* harmony import */ var _utils_helpers_exceptionAlert__WEBPACK_IMPORTED_MODULE_60__ = __webpack_require__(/*! ../utils/helpers/exceptionAlert */ 91); /* harmony import */ var _utils_helpers_exceptionAlert__WEBPACK_IMPORTED_MODULE_60___default = /*#__PURE__*/__webpack_require__.n(_utils_helpers_exceptionAlert__WEBPACK_IMPORTED_MODULE_60__); /* harmony import */ var _utils_uiHelpers_removeLoadingScreen__WEBPACK_IMPORTED_MODULE_61__ = __webpack_require__(/*! ../utils/uiHelpers/removeLoadingScreen */ 524); /* harmony import */ var _utils_uiHelpers_removeLoadingScreen__WEBPACK_IMPORTED_MODULE_61___default = /*#__PURE__*/__webpack_require__.n(_utils_uiHelpers_removeLoadingScreen__WEBPACK_IMPORTED_MODULE_61__); /* harmony import */ var _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_62__ = __webpack_require__(/*! ../utils/helpers/keyCodes */ 44); /* harmony import */ var _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_62___default = /*#__PURE__*/__webpack_require__.n(_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_62__); /* harmony import */ var _Exploits_tampering__WEBPACK_IMPORTED_MODULE_63__ = __webpack_require__(/*! ./Exploits/tampering */ 863); /* harmony import */ var _Exploits_tampering__WEBPACK_IMPORTED_MODULE_63___default = /*#__PURE__*/__webpack_require__.n(_Exploits_tampering__WEBPACK_IMPORTED_MODULE_63__); /* harmony import */ var _Exploits_unclickable__WEBPACK_IMPORTED_MODULE_64__ = __webpack_require__(/*! ./Exploits/unclickable */ 862); /* harmony import */ var _Exploits_unclickable__WEBPACK_IMPORTED_MODULE_64___default = /*#__PURE__*/__webpack_require__.n(_Exploits_unclickable__WEBPACK_IMPORTED_MODULE_64__); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_65__ = __webpack_require__(/*! react */ 0); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_65___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_65__); /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_66__ = __webpack_require__(/*! react-dom */ 21); /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_66___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_66__); /** * Game engine. Handles the main game loop as well as the main UI pages * * TODO: Separate UI functionality into its own component */ /** * Shortcuts to navigate through the game * Alt-t - Terminal * Alt-c - Character * Alt-e - Script editor * Alt-s - Active scripts * Alt-h - Hacknet Nodes * Alt-w - City * Alt-j - Job * Alt-r - Travel Agency of current city * Alt-p - Create program * Alt-f - Factions * Alt-a - Augmentations * Alt-u - Tutorial * Alt-o - Options */ $(document).keydown(function (e) { if (_Settings_Settings__WEBPACK_IMPORTED_MODULE_37__["Settings"].DisableHotkeys === true) { return; } if (!_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].isWorking && !_RedPill__WEBPACK_IMPORTED_MODULE_33__["redPillFlag"] && !_Missions__WEBPACK_IMPORTED_MODULE_26__[/* inMission */ "c"] && !_CinematicText__WEBPACK_IMPORTED_MODULE_7__[/* cinematicTextFlag */ "a"]) { if (e.keyCode == _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_62__["KEY"].T && e.altKey) { e.preventDefault(); Engine.loadTerminalContent(); } else if (e.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_62__["KEY"].C && e.altKey) { e.preventDefault(); Engine.loadCharacterContent(); } else if (e.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_62__["KEY"].E && e.altKey) { e.preventDefault(); Engine.loadScriptEditorContent(); } else if (e.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_62__["KEY"].S && e.altKey) { e.preventDefault(); Engine.loadActiveScriptsContent(); } else if (e.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_62__["KEY"].H && e.altKey) { e.preventDefault(); Engine.loadHacknetNodesContent(); } else if (e.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_62__["KEY"].W && e.altKey) { e.preventDefault(); Engine.loadLocationContent(); } else if (e.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_62__["KEY"].J && e.altKey) { e.preventDefault(); Engine.loadJobContent(); } else if (e.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_62__["KEY"].R && e.altKey) { e.preventDefault(); Engine.loadTravelContent(); } else if (e.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_62__["KEY"].P && e.altKey) { e.preventDefault(); Engine.loadCreateProgramContent(); } else if (e.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_62__["KEY"].F && e.altKey) { // Overriden by Fconf if (_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].isOn(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].Terminal) && _Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_20__["FconfSettings"].ENABLE_BASH_HOTKEYS) { return; } e.preventDefault(); Engine.loadFactionsContent(); } else if (e.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_62__["KEY"].A && e.altKey) { e.preventDefault(); Engine.loadAugmentationsContent(); } else if (e.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_62__["KEY"].U && e.altKey) { e.preventDefault(); Engine.loadTutorialContent(); } else if (e.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_62__["KEY"].B && e.altKey) { e.preventDefault(); Engine.loadBladeburnerContent(); } else if (e.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_62__["KEY"].G && e.altKey) { e.preventDefault(); Engine.loadGangContent(); } } if (e.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_62__["KEY"].O && e.altKey) { e.preventDefault(); Object(_utils_GameOptions__WEBPACK_IMPORTED_MODULE_59__[/* gameOptionsBoxOpen */ "b"])(); } }); const Engine = { // Clickable objects Clickables: { // Main menu buttons saveMainMenuButton: null, deleteMainMenuButton: null }, // Display objects // TODO-Refactor this into its own component Display: { // Main menu content terminalContent: null, characterContent: null, scriptEditorContent: null, activeScriptsContent: null, hacknetNodesContent: null, createProgramContent: null, factionsContent: null, factionContent: null, augmentationsContent: null, milestonesContent: null, tutorialContent: null, infiltrationContent: null, stockMarketContent: null, gangContent: null, bladeburnerContent: null, locationContent: null, workInProgressContent: null, redPillContent: null, cinematicTextContent: null, missionContent: null, // Character info characterInfo: null }, indexedDb: undefined, // Time variables (milliseconds unix epoch time) _lastUpdate: new Date().getTime(), _idleSpeed: 200, // Speed (in ms) at which the main loop is updated loadTerminalContent: function () { Engine.hideAllContent(); Engine.Display.terminalContent.style.display = "block"; _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].Terminal); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Terminal.classList.add("active"); }, loadCharacterContent: function () { Engine.hideAllContent(); Engine.Display.characterContent.style.display = "block"; Engine.updateCharacterInfo(); _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].CharacterInfo); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Stats.classList.add("active"); }, loadScriptEditorContent: function (filename = "", code = "") { Engine.hideAllContent(); Engine.Display.scriptEditorContent.style.display = "block"; _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].ScriptEditor); react_dom__WEBPACK_IMPORTED_MODULE_66___default.a.render(react__WEBPACK_IMPORTED_MODULE_65___default.a.createElement(_ScriptEditor_ui_Root__WEBPACK_IMPORTED_MODULE_35__["Root"], { filename: filename, code: code, player: _Player__WEBPACK_IMPORTED_MODULE_30__["Player"], engine: this }), Engine.Display.scriptEditorContent); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].ScriptEditor.classList.add("active"); }, loadActiveScriptsContent: function () { Engine.hideAllContent(); Engine.Display.activeScriptsContent.style.display = "block"; _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].ActiveScripts); react_dom__WEBPACK_IMPORTED_MODULE_66___default.a.render(react__WEBPACK_IMPORTED_MODULE_65___default.a.createElement(_ui_ActiveScripts_Root__WEBPACK_IMPORTED_MODULE_53__["ActiveScriptsRoot"], { p: _Player__WEBPACK_IMPORTED_MODULE_30__["Player"], workerScripts: _Netscript_WorkerScripts__WEBPACK_IMPORTED_MODULE_27__["workerScripts"] }), Engine.Display.activeScriptsContent); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].ActiveScripts.classList.add("active"); }, loadHacknetNodesContent: function () { Engine.hideAllContent(); Engine.Display.hacknetNodesContent.style.display = "block"; _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].HacknetNodes); Object(_Hacknet_HacknetHelpers__WEBPACK_IMPORTED_MODULE_21__[/* renderHacknetNodesUI */ "q"])(); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].HacknetNodes.classList.add("active"); }, loadCreateProgramContent: function () { Engine.hideAllContent(); Engine.Display.createProgramContent.style.display = "block"; Object(_Programs_ProgramHelpers__WEBPACK_IMPORTED_MODULE_32__[/* displayCreateProgramContent */ "a"])(); _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].CreateProgram); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].CreateProgram.classList.add("active"); }, loadFactionsContent: function () { Engine.hideAllContent(); Engine.Display.factionsContent.style.display = "block"; _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].Factions); react_dom__WEBPACK_IMPORTED_MODULE_66___default.a.render(react__WEBPACK_IMPORTED_MODULE_65___default.a.createElement(_Faction_ui_FactionList__WEBPACK_IMPORTED_MODULE_15__["FactionList"], { player: _Player__WEBPACK_IMPORTED_MODULE_30__["Player"], engine: this }), Engine.Display.factionsContent); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Factions.classList.add("active"); }, loadFactionContent: function () { Engine.hideAllContent(); Engine.Display.factionContent.style.display = "block"; _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].Faction); }, loadAugmentationsContent: function () { Engine.hideAllContent(); Engine.Display.augmentationsContent.style.display = "block"; _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].Augmentations); Object(_Augmentation_AugmentationHelpers__WEBPACK_IMPORTED_MODULE_2__[/* displayAugmentationsContent */ "c"])(Engine.Display.augmentationsContent); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Augmentations.classList.add("active"); }, loadMilestonesContent: function () { Engine.hideAllContent(); Engine.Display.milestonesContent.style.display = "block"; _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].Milestones); Object(_Milestones_MilestoneHelpers__WEBPACK_IMPORTED_MODULE_41__["displayMilestonesContent"])(); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Milestones.classList.add("active"); }, loadTutorialContent: function () { Engine.hideAllContent(); Engine.Display.tutorialContent.style.display = "block"; _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].Tutorial); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Tutorial.classList.add("active"); }, loadDevMenuContent: function () { Engine.hideAllContent(); Object(_DevMenu__WEBPACK_IMPORTED_MODULE_12__[/* createDevMenu */ "b"])(); _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].DevMenu); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].DevMenu.classList.add("active"); }, loadLocationContent: function (initiallyInCity = true) { Engine.hideAllContent(); Engine.Display.locationContent.style.display = "block"; _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].City.classList.add("active"); _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].Location); const rootComponent = react__WEBPACK_IMPORTED_MODULE_65___default.a.createElement(_Locations_ui_Root__WEBPACK_IMPORTED_MODULE_24__["LocationRoot"], { initiallyInCity: initiallyInCity, engine: Engine, p: _Player__WEBPACK_IMPORTED_MODULE_30__["Player"] }); react_dom__WEBPACK_IMPORTED_MODULE_66___default.a.render(rootComponent, Engine.Display.locationContent); }, loadTravelContent: function () { // Same as loadLocationContent() except first set the location to the travel agency, // and make sure that the 'City' main menu link doesnt become 'active' Engine.hideAllContent(); _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].gotoLocation(_Locations_data_LocationNames__WEBPACK_IMPORTED_MODULE_23__["LocationName"].TravelAgency); Engine.Display.locationContent.style.display = "block"; _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Travel.classList.add("active"); _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].Location); const rootComponent = react__WEBPACK_IMPORTED_MODULE_65___default.a.createElement(_Locations_ui_Root__WEBPACK_IMPORTED_MODULE_24__["LocationRoot"], { initiallyInCity: false, engine: Engine, p: _Player__WEBPACK_IMPORTED_MODULE_30__["Player"] }); react_dom__WEBPACK_IMPORTED_MODULE_66___default.a.render(rootComponent, Engine.Display.locationContent); }, loadJobContent: function () { // Same as loadLocationContent(), except first set the location to the job. // Make sure that the 'City' main menu link doesnt become 'active' if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].companyName == "") { Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_58__["dialogBoxCreate"])("You do not currently have a job! You can visit various companies " + "in the city and try to find a job."); return; } Engine.hideAllContent(); _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].gotoLocation(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].companyName); Engine.Display.locationContent.style.display = "block"; _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Job.classList.add("active"); _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].Location); const rootComponent = react__WEBPACK_IMPORTED_MODULE_65___default.a.createElement(_Locations_ui_Root__WEBPACK_IMPORTED_MODULE_24__["LocationRoot"], { initiallyInCity: false, engine: Engine, p: _Player__WEBPACK_IMPORTED_MODULE_30__["Player"] }); react_dom__WEBPACK_IMPORTED_MODULE_66___default.a.render(rootComponent, Engine.Display.locationContent); }, loadWorkInProgressContent: function () { Engine.hideAllContent(); var mainMenu = document.getElementById("mainmenu-container"); mainMenu.style.visibility = "hidden"; Engine.Display.workInProgressContent.style.display = "block"; _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].WorkInProgress); }, loadRedPillContent: function () { Engine.hideAllContent(); var mainMenu = document.getElementById("mainmenu-container"); mainMenu.style.visibility = "hidden"; Engine.Display.redPillContent.style.display = "block"; _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].RedPill); }, loadCinematicTextContent: function () { Engine.hideAllContent(); var mainMenu = document.getElementById("mainmenu-container"); mainMenu.style.visibility = "hidden"; Engine.Display.cinematicTextContent.style.display = "block"; _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].CinematicText); }, loadInfiltrationContent: function (name, difficulty, maxLevel) { Engine.hideAllContent(); const mainMenu = document.getElementById("mainmenu-container"); mainMenu.style.visibility = "hidden"; Engine.Display.infiltrationContent.style.display = "block"; _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].Infiltration); Object(_Infiltration_Helper__WEBPACK_IMPORTED_MODULE_18__["displayInfiltrationContent"])(this, _Player__WEBPACK_IMPORTED_MODULE_30__["Player"], name, difficulty, maxLevel); }, loadStockMarketContent: function () { Engine.hideAllContent(); Engine.Display.stockMarketContent.style.display = "block"; _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].StockMarket); Object(_StockMarket_StockMarket__WEBPACK_IMPORTED_MODULE_40__["displayStockMarketContent"])(); }, loadGangContent: function () { Engine.hideAllContent(); if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].inGang()) { Engine.Display.gangContent.style.display = "block"; _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].Gang); Object(_Gang_Helpers__WEBPACK_IMPORTED_MODULE_16__["displayGangContent"])(this, _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].gang, _Player__WEBPACK_IMPORTED_MODULE_30__["Player"]); } else { Engine.loadTerminalContent(); _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].Terminal); } }, loadMissionContent: function () { Engine.hideAllContent(); document.getElementById("mainmenu-container").style.visibility = "hidden"; document.getElementById("character-overview-wrapper").style.visibility = "hidden"; Engine.Display.missionContent.style.display = "block"; _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].Mission); }, loadCorporationContent: function () { if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].corporation instanceof _Corporation_Corporation__WEBPACK_IMPORTED_MODULE_10__["Corporation"]) { Engine.hideAllContent(); _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].Corporation); _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].corporation.createUI(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"]); } }, loadBladeburnerContent: function () { if (!(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].bladeburner instanceof _Bladeburner_Bladeburner__WEBPACK_IMPORTED_MODULE_5__["Bladeburner"])) return; Engine.hideAllContent(); _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].Bladeburner); Engine.Display.bladeburnerContent.style.display = "block"; react_dom__WEBPACK_IMPORTED_MODULE_66___default.a.render(react__WEBPACK_IMPORTED_MODULE_65___default.a.createElement(_Bladeburner_ui_Root__WEBPACK_IMPORTED_MODULE_17__["Root"], { bladeburner: _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].bladeburner, player: _Player__WEBPACK_IMPORTED_MODULE_30__["Player"], engine: this }), Engine.Display.bladeburnerContent); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Bladeburner.classList.add("active"); }, loadSleevesContent: function () { // This is for Duplicate Sleeves page, not Re-sleeving @ Vita Life try { Engine.hideAllContent(); _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].Sleeves); Object(_PersonObjects_Sleeve_SleeveUI__WEBPACK_IMPORTED_MODULE_44__["createSleevesPage"])(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"]); } catch (e) { Object(_utils_helpers_exceptionAlert__WEBPACK_IMPORTED_MODULE_60__["exceptionAlert"])(e); } }, loadResleevingContent: function () { try { Engine.hideAllContent(); _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].Resleeves); Object(_PersonObjects_Resleeving_ResleevingUI__WEBPACK_IMPORTED_MODULE_45__["createResleevesPage"])(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"]); } catch (e) { Object(_utils_helpers_exceptionAlert__WEBPACK_IMPORTED_MODULE_60__["exceptionAlert"])(e); } }, // Helper function that hides all content hideAllContent: function () { Engine.Display.terminalContent.style.display = "none"; Engine.Display.characterContent.style.display = "none"; Engine.Display.scriptEditorContent.style.display = "none"; react_dom__WEBPACK_IMPORTED_MODULE_66___default.a.unmountComponentAtNode(Engine.Display.scriptEditorContent); Engine.Display.activeScriptsContent.style.display = "none"; react_dom__WEBPACK_IMPORTED_MODULE_66___default.a.unmountComponentAtNode(Engine.Display.activeScriptsContent); Engine.Display.infiltrationContent.style.display = "none"; react_dom__WEBPACK_IMPORTED_MODULE_66___default.a.unmountComponentAtNode(Engine.Display.infiltrationContent); Object(_Hacknet_HacknetHelpers__WEBPACK_IMPORTED_MODULE_21__[/* clearHacknetNodesUI */ "a"])(); Engine.Display.createProgramContent.style.display = "none"; Engine.Display.factionsContent.style.display = "none"; react_dom__WEBPACK_IMPORTED_MODULE_66___default.a.unmountComponentAtNode(Engine.Display.factionsContent); Engine.Display.factionContent.style.display = "none"; react_dom__WEBPACK_IMPORTED_MODULE_66___default.a.unmountComponentAtNode(Engine.Display.factionContent); Engine.Display.augmentationsContent.style.display = "none"; react_dom__WEBPACK_IMPORTED_MODULE_66___default.a.unmountComponentAtNode(Engine.Display.augmentationsContent); Engine.Display.milestonesContent.style.display = "none"; Engine.Display.tutorialContent.style.display = "none"; Engine.Display.locationContent.style.display = "none"; react_dom__WEBPACK_IMPORTED_MODULE_66___default.a.unmountComponentAtNode(Engine.Display.locationContent); Engine.Display.gangContent.style.display = "none"; react_dom__WEBPACK_IMPORTED_MODULE_66___default.a.unmountComponentAtNode(Engine.Display.gangContent); Engine.Display.bladeburnerContent.style.display = "none"; react_dom__WEBPACK_IMPORTED_MODULE_66___default.a.unmountComponentAtNode(Engine.Display.bladeburnerContent); Engine.Display.workInProgressContent.style.display = "none"; Engine.Display.redPillContent.style.display = "none"; Engine.Display.cinematicTextContent.style.display = "none"; Engine.Display.stockMarketContent.style.display = "none"; Engine.Display.missionContent.style.display = "none"; if (document.getElementById("gang-container")) { document.getElementById("gang-container").style.display = "none"; } if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].corporation instanceof _Corporation_Corporation__WEBPACK_IMPORTED_MODULE_10__["Corporation"]) { _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].corporation.clearUI(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"]); } Object(_PersonObjects_Resleeving_ResleevingUI__WEBPACK_IMPORTED_MODULE_45__["clearResleevesPage"])(); Object(_PersonObjects_Sleeve_SleeveUI__WEBPACK_IMPORTED_MODULE_44__["clearSleevesPage"])(); // Make nav menu tabs inactive Engine.inactivateMainMenuLinks(); // Close dev menu Object(_DevMenu__WEBPACK_IMPORTED_MODULE_12__[/* closeDevMenu */ "a"])(); }, // Remove 'active' css class from all main menu links inactivateMainMenuLinks: function () { _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Terminal.classList.remove("active"); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].ScriptEditor.classList.remove("active"); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].ActiveScripts.classList.remove("active"); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].CreateProgram.classList.remove("active"); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Stats.classList.remove("active"); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Factions.classList.remove("active"); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Augmentations.classList.remove("active"); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].HacknetNodes.classList.remove("active"); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Sleeves.classList.remove("active"); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].City.classList.remove("active"); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Travel.classList.remove("active"); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Job.classList.remove("active"); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].StockMarket.classList.remove("active"); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Gang.classList.remove("active"); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Bladeburner.classList.remove("active"); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Corporation.classList.remove("active"); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Gang.classList.remove("active"); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Milestones.classList.remove("active"); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Tutorial.classList.remove("active"); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Options.classList.remove("active"); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].DevMenu.classList.remove("active"); }, displayCharacterOverviewInfo: function () { react_dom__WEBPACK_IMPORTED_MODULE_66___default.a.render(react__WEBPACK_IMPORTED_MODULE_65___default.a.createElement(_ui_React_CharacterOverview__WEBPACK_IMPORTED_MODULE_6__[/* CharacterOverviewComponent */ "a"], null), document.getElementById('character-overview-text')); const save = document.getElementById("character-overview-save-button"); const flashClass = "flashing-button"; if (!_Settings_Settings__WEBPACK_IMPORTED_MODULE_37__["Settings"].AutosaveInterval) { save.classList.add(flashClass); } else { save.classList.remove(flashClass); } }, /// Display character info updateCharacterInfo: function () { react_dom__WEBPACK_IMPORTED_MODULE_66___default.a.render(Object(_ui_CharacterInfo__WEBPACK_IMPORTED_MODULE_47__["CharacterInfo"])(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"]), Engine.Display.characterInfo); }, // Main Game Loop idleTimer: function () { // Get time difference const _thisUpdate = new Date().getTime(); let diff = _thisUpdate - Engine._lastUpdate; const offset = diff % Engine._idleSpeed; // Divide this by cycle time to determine how many cycles have elapsed since last update diff = Math.floor(diff / Engine._idleSpeed); if (diff > 0) { // Update the game engine by the calculated number of cycles Engine._lastUpdate = _thisUpdate - offset; _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].lastUpdate = _thisUpdate - offset; Engine.updateGame(diff); } window.requestAnimationFrame(Engine.idleTimer); }, updateGame: function (numCycles = 1) { const time = numCycles * Engine._idleSpeed; if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].totalPlaytime == null) { _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].totalPlaytime = 0; } if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].playtimeSinceLastAug == null) { _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].playtimeSinceLastAug = 0; } if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].playtimeSinceLastBitnode == null) { _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].playtimeSinceLastBitnode = 0; } _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].totalPlaytime += time; _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].playtimeSinceLastAug += time; _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].playtimeSinceLastBitnode += time; // Start Manual hack if (_Terminal__WEBPACK_IMPORTED_MODULE_42__[/* Terminal */ "a"].actionStarted === true) { Engine._totalActionTime = _Terminal__WEBPACK_IMPORTED_MODULE_42__[/* Terminal */ "a"].actionTime; Engine._actionTimeLeft = _Terminal__WEBPACK_IMPORTED_MODULE_42__[/* Terminal */ "a"].actionTime; Engine._actionInProgress = true; Engine._actionProgressBarCount = 1; Engine._actionProgressStr = "[ ]"; Engine._actionTimeStr = "Time left: "; _Terminal__WEBPACK_IMPORTED_MODULE_42__[/* Terminal */ "a"].actionStarted = false; } // Working if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].isWorking) { if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].workType == _Constants__WEBPACK_IMPORTED_MODULE_11__["CONSTANTS"].WorkTypeFaction) { _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].workForFaction(numCycles); } else if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].workType == _Constants__WEBPACK_IMPORTED_MODULE_11__["CONSTANTS"].WorkTypeCreateProgram) { _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].createProgramWork(numCycles); } else if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].workType == _Constants__WEBPACK_IMPORTED_MODULE_11__["CONSTANTS"].WorkTypeStudyClass) { _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].takeClass(numCycles); } else if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].workType == _Constants__WEBPACK_IMPORTED_MODULE_11__["CONSTANTS"].WorkTypeCrime) { _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].commitCrime(numCycles); } else if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].workType == _Constants__WEBPACK_IMPORTED_MODULE_11__["CONSTANTS"].WorkTypeCompanyPartTime) { _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].workPartTime(numCycles); } else { _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].work(numCycles); } } // Update stock prices if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].hasWseAccount) { Object(_StockMarket_StockMarket__WEBPACK_IMPORTED_MODULE_40__["processStockPrices"])(numCycles); } // Gang, if applicable if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].inGang()) { _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].gang.process(numCycles, _Player__WEBPACK_IMPORTED_MODULE_30__["Player"]); } // Mission if (_Missions__WEBPACK_IMPORTED_MODULE_26__[/* inMission */ "c"] && _Missions__WEBPACK_IMPORTED_MODULE_26__[/* currMission */ "b"]) { _Missions__WEBPACK_IMPORTED_MODULE_26__[/* currMission */ "b"].process(numCycles); } // Corporation if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].corporation instanceof _Corporation_Corporation__WEBPACK_IMPORTED_MODULE_10__["Corporation"]) { // Stores cycles in a "buffer". Processed separately using Engine Counters _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].corporation.storeCycles(numCycles); } if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].bladeburner instanceof _Bladeburner_Bladeburner__WEBPACK_IMPORTED_MODULE_5__["Bladeburner"]) { _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].bladeburner.storeCycles(numCycles); } // Sleeves for (let i = 0; i < _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].sleeves.length; ++i) { if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].sleeves[i] instanceof _PersonObjects_Sleeve_Sleeve__WEBPACK_IMPORTED_MODULE_43__["Sleeve"]) { const expForOtherSleeves = _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].sleeves[i].process(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"], numCycles); // This sleeve earns experience for other sleeves if (expForOtherSleeves == null) { continue; } for (let j = 0; j < _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].sleeves.length; ++j) { if (j === i) { continue; } _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].sleeves[j].gainExperience(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"], expForOtherSleeves, numCycles, true); } } } // Counters Engine.decrementAllCounters(numCycles); Engine.checkCounters(); // Manual hacks if (Engine._actionInProgress == true) { Engine.updateHackProgress(numCycles); } // Update the running time of all active scripts Object(_NetscriptWorker__WEBPACK_IMPORTED_MODULE_28__[/* updateOnlineScriptTimes */ "f"])(numCycles); // Hacknet Nodes Object(_Hacknet_HacknetHelpers__WEBPACK_IMPORTED_MODULE_21__[/* processHacknetEarnings */ "j"])(numCycles); }, /** * Counters for the main event loop. Represent the number of game cycles that * are required for something to happen. These counters are in game cycles, * which is once every 200ms */ Counters: { autoSaveCounter: 300, updateSkillLevelsCounter: 10, updateDisplays: 3, updateDisplaysMed: 9, updateDisplaysLong: 15, updateActiveScriptsDisplay: 5, createProgramNotifications: 10, augmentationsNotifications: 10, checkFactionInvitations: 100, passiveFactionGrowth: 5, messages: 150, mechanicProcess: 5, // Processes certain mechanics (Corporation, Bladeburner) contractGeneration: 3000 // Generate Coding Contracts }, decrementAllCounters: function (numCycles = 1) { for (var counter in Engine.Counters) { if (Engine.Counters.hasOwnProperty(counter)) { Engine.Counters[counter] = Engine.Counters[counter] - numCycles; } } }, /** * Checks if any counters are 0. If they are, executes whatever * is necessary and then resets the counter */ checkCounters: function () { if (Engine.Counters.autoSaveCounter <= 0) { if (_Settings_Settings__WEBPACK_IMPORTED_MODULE_37__["Settings"].AutosaveInterval == null) { _Settings_Settings__WEBPACK_IMPORTED_MODULE_37__["Settings"].AutosaveInterval = 60; } if (_Settings_Settings__WEBPACK_IMPORTED_MODULE_37__["Settings"].AutosaveInterval === 0) { Engine.Counters.autoSaveCounter = Infinity; } else { Engine.Counters.autoSaveCounter = _Settings_Settings__WEBPACK_IMPORTED_MODULE_37__["Settings"].AutosaveInterval * 5; _SaveObject__WEBPACK_IMPORTED_MODULE_34__[/* saveObject */ "b"].saveGame(Engine.indexedDb); } } if (Engine.Counters.updateSkillLevelsCounter <= 0) { _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].updateSkillLevels(); Engine.Counters.updateSkillLevelsCounter = 10; } if (Engine.Counters.updateActiveScriptsDisplay <= 0) { if (_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].isOn(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].ActiveScripts)) { react_dom__WEBPACK_IMPORTED_MODULE_66___default.a.render(react__WEBPACK_IMPORTED_MODULE_65___default.a.createElement(_ui_ActiveScripts_Root__WEBPACK_IMPORTED_MODULE_53__["ActiveScriptsRoot"], { p: _Player__WEBPACK_IMPORTED_MODULE_30__["Player"], workerScripts: _Netscript_WorkerScripts__WEBPACK_IMPORTED_MODULE_27__["workerScripts"] }), Engine.Display.activeScriptsContent); } Engine.Counters.updateActiveScriptsDisplay = 5; } if (Engine.Counters.updateDisplays <= 0) { Engine.displayCharacterOverviewInfo(); if (_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].isOn(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].HacknetNodes)) { Object(_Hacknet_HacknetHelpers__WEBPACK_IMPORTED_MODULE_21__[/* renderHacknetNodesUI */ "q"])(); } else if (_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].isOn(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].CreateProgram)) { Object(_Programs_ProgramHelpers__WEBPACK_IMPORTED_MODULE_32__[/* displayCreateProgramContent */ "a"])(); } else if (_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].isOn(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].Sleeves)) { Object(_PersonObjects_Sleeve_SleeveUI__WEBPACK_IMPORTED_MODULE_44__["updateSleevesPage"])(); } Engine.Counters.updateDisplays = 3; } if (Engine.Counters.updateDisplaysMed <= 0) { if (_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].isOn(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].CharacterInfo)) { Engine.updateCharacterInfo(); } Engine.Counters.updateDisplaysMed = 9; } if (Engine.Counters.createProgramNotifications <= 0) { var num = Object(_Programs_ProgramHelpers__WEBPACK_IMPORTED_MODULE_32__[/* getNumAvailableCreateProgram */ "b"])(); var elem = document.getElementById("create-program-notification"); if (num > 0) { elem.innerHTML = num; elem.setAttribute("class", "notification-on"); } else { elem.innerHTML = ""; elem.setAttribute("class", "notification-off"); } Engine.Counters.createProgramNotifications = 10; } if (Engine.Counters.augmentationsNotifications <= 0) { var num = _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].queuedAugmentations.length; var elem = document.getElementById("augmentations-notification"); if (num > 0) { elem.innerHTML = num; elem.setAttribute("class", "notification-on"); } else { elem.innerHTML = ""; elem.setAttribute("class", "notification-off"); } Engine.Counters.augmentationsNotifications = 10; } if (Engine.Counters.checkFactionInvitations <= 0) { var invitedFactions = _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].checkForFactionInvitations(); if (invitedFactions.length > 0) { if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].firstFacInvRecvd === false) { _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].firstFacInvRecvd = true; document.getElementById("factions-tab").style.display = "list-item"; document.getElementById("character-menu-header").click(); document.getElementById("character-menu-header").click(); } var randFaction = invitedFactions[Math.floor(Math.random() * invitedFactions.length)]; Object(_Faction_FactionHelpers__WEBPACK_IMPORTED_MODULE_14__["inviteToFaction"])(randFaction); } const num = _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].factionInvitations.length; const elem = document.getElementById("factions-notification"); if (num > 0) { elem.innerHTML = num; elem.setAttribute("class", "notification-on"); } else { elem.innerHTML = ""; elem.setAttribute("class", "notification-off"); } Engine.Counters.checkFactionInvitations = 100; } if (Engine.Counters.passiveFactionGrowth <= 0) { var adjustedCycles = Math.floor(5 - Engine.Counters.passiveFactionGrowth); Object(_Faction_FactionHelpers__WEBPACK_IMPORTED_MODULE_14__["processPassiveFactionRepGain"])(adjustedCycles); Engine.Counters.passiveFactionGrowth = 5; } if (Engine.Counters.messages <= 0) { Object(_Message_MessageHelpers__WEBPACK_IMPORTED_MODULE_25__[/* checkForMessagesToSend */ "b"])(); if (_Augmentation_Augmentations__WEBPACK_IMPORTED_MODULE_1__["Augmentations"][_Augmentation_data_AugmentationNames__WEBPACK_IMPORTED_MODULE_3__["AugmentationNames"].TheRedPill].owned) { Engine.Counters.messages = 4500; // 15 minutes for Red pill message } else { Engine.Counters.messages = 150; } } if (Engine.Counters.mechanicProcess <= 0) { if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].corporation instanceof _Corporation_Corporation__WEBPACK_IMPORTED_MODULE_10__["Corporation"]) { _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].corporation.process(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"]); } if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].bladeburner instanceof _Bladeburner_Bladeburner__WEBPACK_IMPORTED_MODULE_5__["Bladeburner"]) { try { _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].bladeburner.process(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"]); } catch (e) { Object(_utils_helpers_exceptionAlert__WEBPACK_IMPORTED_MODULE_60__["exceptionAlert"])("Exception caught in Bladeburner.process(): " + e); } } Engine.Counters.mechanicProcess = 5; } if (Engine.Counters.contractGeneration <= 0) { // X% chance of a contract being generated if (Math.random() <= 0.25) { Object(_CodingContractGenerator__WEBPACK_IMPORTED_MODULE_8__["generateRandomContract"])(); } Engine.Counters.contractGeneration = 3000; } }, // Calculates the hack progress for a manual (non-scripted) hack and updates the progress bar/time accordingly // TODO Refactor this into Terminal module _totalActionTime: 0, _actionTimeLeft: 0, _actionTimeStr: "Time left: ", _actionProgressStr: "[ ]", _actionProgressBarCount: 1, _actionInProgress: false, updateHackProgress: function (numCycles = 1) { var timeElapsedMilli = numCycles * Engine._idleSpeed; Engine._actionTimeLeft -= timeElapsedMilli / 1000; // Substract idle speed (ms) Engine._actionTimeLeft = Math.max(Engine._actionTimeLeft, 0); // Calculate percent filled var percent = Math.round((1 - Engine._actionTimeLeft / Engine._totalActionTime) * 100); // Update progress bar while (Engine._actionProgressBarCount * 2 <= percent) { Engine._actionProgressStr = Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_0__["replaceAt"])(Engine._actionProgressStr, Engine._actionProgressBarCount, "|"); Engine._actionProgressBarCount += 1; } // Update hack time remaining Engine._actionTimeStr = "Time left: " + Math.max(0, Math.round(Engine._actionTimeLeft)).toString() + "s"; document.getElementById("hack-progress").innerHTML = Engine._actionTimeStr; // Dynamically update progress bar document.getElementById("hack-progress-bar").innerHTML = Engine._actionProgressStr.replace(/ /g, " "); // Once percent is 100, the hack is completed if (percent >= 100) { Engine._actionInProgress = false; _Terminal__WEBPACK_IMPORTED_MODULE_42__[/* Terminal */ "a"].finishAction(); } }, /** * Collapses a main menu header. Used when initializing the game. * @param elems {HTMLElement[]} Elements under header */ closeMainMenuHeader: function (elems) { for (var i = 0; i < elems.length; ++i) { elems[i].style.maxHeight = null; elems[i].style.opacity = 0; elems[i].style.pointerEvents = "none"; } }, /** * Expands a main menu header. Used when initializing the game. * @param elems {HTMLElement[]} Elements under header */ openMainMenuHeader: function (elems) { for (var i = 0; i < elems.length; ++i) { elems[i].style.maxHeight = elems[i].scrollHeight + "px"; elems[i].style.display = "block"; } }, /** * Used in game when clicking on a main menu header (NOT used for initialization) * @param open {boolean} Whether header is being opened or closed * @param elems {HTMLElement[]} li Elements under header * @param links {HTMLElement[]} a elements under header */ toggleMainMenuHeader: function (open, elems, links) { for (var i = 0; i < elems.length; ++i) { if (open) { elems[i].style.opacity = 1; elems[i].style.maxHeight = elems[i].scrollHeight + "px"; } else { elems[i].style.opacity = 0; elems[i].style.maxHeight = null; } } for (var i = 0; i < links.length; ++i) { if (open) { links[i].style.opacity = 1; links[i].style.maxHeight = links[i].scrollHeight + "px"; links[i].style.pointerEvents = "auto"; } else { links[i].style.opacity = 0; links[i].style.maxHeight = null; links[i].style.pointerEvents = "none"; } } }, load: function (saveString) { // Initialize main menu accordion panels to all start as "open" const terminal = document.getElementById("terminal-tab"); const createScript = document.getElementById("create-script-tab"); const activeScripts = document.getElementById("active-scripts-tab"); const createProgram = document.getElementById("create-program-tab"); const stats = document.getElementById("stats-tab"); const factions = document.getElementById("factions-tab"); const augmentations = document.getElementById("augmentations-tab"); const hacknetnodes = document.getElementById("hacknet-nodes-tab"); const city = document.getElementById("city-tab"); const travel = document.getElementById("travel-tab"); const job = document.getElementById("job-tab"); const stockmarket = document.getElementById("stock-market-tab"); const bladeburner = document.getElementById("bladeburner-tab"); const corp = document.getElementById("corporation-tab"); const gang = document.getElementById("gang-tab"); const milestones = document.getElementById("milestones-tab"); const tutorial = document.getElementById("tutorial-tab"); const options = document.getElementById("options-tab"); const dev = document.getElementById("dev-tab"); // Load game from save or create new game if (Object(_SaveObject__WEBPACK_IMPORTED_MODULE_34__[/* loadGame */ "a"])(saveString)) { Object(_BitNode_BitNode__WEBPACK_IMPORTED_MODULE_4__["initBitNodeMultipliers"])(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"]); Engine.setDisplayElements(); // Sets variables for important DOM elements Engine.init(); // Initialize buttons, work, etc. Object(_SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_38__["updateSourceFileFlags"])(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"]); Object(_Augmentation_AugmentationHelpers__WEBPACK_IMPORTED_MODULE_2__[/* initAugmentations */ "d"])(); // Also calls Player.reapplyAllAugmentations() _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].reapplyAllSourceFiles(); if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].hasWseAccount) { Object(_StockMarket_StockMarket__WEBPACK_IMPORTED_MODULE_40__["initSymbolToStockMap"])(); } // Calculate the number of cycles have elapsed while offline Engine._lastUpdate = new Date().getTime(); const lastUpdate = _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].lastUpdate; const timeOffline = Engine._lastUpdate - lastUpdate; const numCyclesOffline = Math.floor(timeOffline / Engine._idleSpeed); let offlineReputation = 0; const offlineHackingIncome = _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].moneySourceA.hacking / _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].playtimeSinceLastAug * timeOffline * 0.75; _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].gainMoney(offlineHackingIncome); // Process offline progress Object(_NetscriptWorker__WEBPACK_IMPORTED_MODULE_28__[/* loadAllRunningScripts */ "b"])(); // This also takes care of offline production for those scripts if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].isWorking) { _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].focus = true; if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].workType == _Constants__WEBPACK_IMPORTED_MODULE_11__["CONSTANTS"].WorkTypeFaction) { _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].workForFaction(numCyclesOffline); } else if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].workType == _Constants__WEBPACK_IMPORTED_MODULE_11__["CONSTANTS"].WorkTypeCreateProgram) { _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].createProgramWork(numCyclesOffline); } else if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].workType == _Constants__WEBPACK_IMPORTED_MODULE_11__["CONSTANTS"].WorkTypeStudyClass) { _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].takeClass(numCyclesOffline); } else if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].workType == _Constants__WEBPACK_IMPORTED_MODULE_11__["CONSTANTS"].WorkTypeCrime) { _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].commitCrime(numCyclesOffline); } else if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].workType == _Constants__WEBPACK_IMPORTED_MODULE_11__["CONSTANTS"].WorkTypeCompanyPartTime) { _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].workPartTime(numCyclesOffline); } else { _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].work(numCyclesOffline); } } else { for (let i = 0; i < _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].factions.length; i++) { const facName = _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].factions[i]; if (!_Faction_Factions__WEBPACK_IMPORTED_MODULE_13__["Factions"].hasOwnProperty(facName)) continue; const faction = _Faction_Factions__WEBPACK_IMPORTED_MODULE_13__["Factions"][facName]; if (!faction.isMember) continue; // No rep for special factions. const info = faction.getInfo(); if (!info.offersWork()) continue; // No rep for gangs. if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].getGangName() === facName) continue; const hRep = Object(_PersonObjects_formulas_reputation__WEBPACK_IMPORTED_MODULE_19__["getHackingWorkRepGain"])(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"], faction); const sRep = Object(_PersonObjects_formulas_reputation__WEBPACK_IMPORTED_MODULE_19__["getFactionSecurityWorkRepGain"])(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"], faction); const fRep = Object(_PersonObjects_formulas_reputation__WEBPACK_IMPORTED_MODULE_19__["getFactionFieldWorkRepGain"])(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"], faction); // can be infinite, doesn't matter. const reputationRate = Math.max(hRep, sRep, fRep) / _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].factions.length; const rep = reputationRate * numCyclesOffline; faction.playerReputation += rep; offlineReputation += rep; } } // Hacknet Nodes offline progress var offlineProductionFromHacknetNodes = Object(_Hacknet_HacknetHelpers__WEBPACK_IMPORTED_MODULE_21__[/* processHacknetEarnings */ "j"])(numCyclesOffline); const hacknetProdInfo = Object(_Hacknet_HacknetHelpers__WEBPACK_IMPORTED_MODULE_21__[/* hasHacknetServers */ "h"])() ? react__WEBPACK_IMPORTED_MODULE_65___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_65___default.a.Fragment, null, Object(_ui_React_Hashes__WEBPACK_IMPORTED_MODULE_51__["Hashes"])(offlineProductionFromHacknetNodes), " hashes") : Object(_ui_React_Money__WEBPACK_IMPORTED_MODULE_50__["Money"])(offlineProductionFromHacknetNodes); // Passive faction rep gain offline Object(_Faction_FactionHelpers__WEBPACK_IMPORTED_MODULE_14__["processPassiveFactionRepGain"])(numCyclesOffline); // Stock Market offline progress if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].hasWseAccount) { Object(_StockMarket_StockMarket__WEBPACK_IMPORTED_MODULE_40__["processStockPrices"])(numCyclesOffline); } // Gang progress for BitNode 2 if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].inGang()) { _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].gang.process(numCyclesOffline, _Player__WEBPACK_IMPORTED_MODULE_30__["Player"]); } // Corporation offline progress if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].corporation instanceof _Corporation_Corporation__WEBPACK_IMPORTED_MODULE_10__["Corporation"]) { _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].corporation.storeCycles(numCyclesOffline); } // Bladeburner offline progress if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].bladeburner instanceof _Bladeburner_Bladeburner__WEBPACK_IMPORTED_MODULE_5__["Bladeburner"]) { _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].bladeburner.storeCycles(numCyclesOffline); } // Sleeves offline progress for (let i = 0; i < _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].sleeves.length; ++i) { if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].sleeves[i] instanceof _PersonObjects_Sleeve_Sleeve__WEBPACK_IMPORTED_MODULE_43__["Sleeve"]) { const expForOtherSleeves = _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].sleeves[i].process(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"], numCyclesOffline); // This sleeve earns experience for other sleeves if (expForOtherSleeves == null) { continue; } for (let j = 0; j < _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].sleeves.length; ++j) { if (j === i) { continue; } _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].sleeves[j].gainExperience(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"], expForOtherSleeves, numCyclesOffline, true); } } } // Update total playtime var time = numCyclesOffline * Engine._idleSpeed; if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].totalPlaytime == null) { _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].totalPlaytime = 0; } if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].playtimeSinceLastAug == null) { _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].playtimeSinceLastAug = 0; } if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].playtimeSinceLastBitnode == null) { _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].playtimeSinceLastBitnode = 0; } _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].totalPlaytime += time; _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].playtimeSinceLastAug += time; _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].playtimeSinceLastBitnode += time; _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].lastUpdate = Engine._lastUpdate; Engine.start(); // Run main game loop and Scripts loop Object(_utils_uiHelpers_removeLoadingScreen__WEBPACK_IMPORTED_MODULE_61__["removeLoadingScreen"])(); const timeOfflineString = Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_0__["convertTimeMsToTimeElapsedString"])(time); Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_58__["dialogBoxCreate"])(react__WEBPACK_IMPORTED_MODULE_65___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_65___default.a.Fragment, null, "Offline for ", timeOfflineString, ". While you were offline, your scripts generated ", Object(_ui_React_Money__WEBPACK_IMPORTED_MODULE_50__["Money"])(offlineHackingIncome), ", your Hacknet Nodes generated ", hacknetProdInfo, " and you gained ", Object(_ui_React_Reputation__WEBPACK_IMPORTED_MODULE_52__["Reputation"])(offlineReputation), " divided amongst your factions.")); // Close main menu accordions for loaded game var visibleMenuTabs = [terminal, createScript, activeScripts, stats, hacknetnodes, city, milestones, tutorial, options, dev]; if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].firstFacInvRecvd) { visibleMenuTabs.push(factions); } else { factions.style.display = "none"; } if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].firstAugPurchased) { visibleMenuTabs.push(augmentations); } else { augmentations.style.display = "none"; } if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].companyName !== "") { visibleMenuTabs.push(job); } else { job.style.display = "none"; } if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].firstTimeTraveled) { visibleMenuTabs.push(travel); } else { travel.style.display = "none"; } if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].firstProgramAvailable) { visibleMenuTabs.push(createProgram); } else { createProgram.style.display = "none"; } if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].hasWseAccount) { visibleMenuTabs.push(stockmarket); } else { stockmarket.style.display = "none"; } if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].bladeburner instanceof _Bladeburner_Bladeburner__WEBPACK_IMPORTED_MODULE_5__["Bladeburner"]) { visibleMenuTabs.push(bladeburner); } else { bladeburner.style.display = "none"; } if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].corporation instanceof _Corporation_Corporation__WEBPACK_IMPORTED_MODULE_10__["Corporation"]) { visibleMenuTabs.push(corp); } else { corp.style.display = "none"; } if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].inGang()) { visibleMenuTabs.push(gang); } else { gang.style.display = "none"; } Engine.closeMainMenuHeader(visibleMenuTabs); } else { // No save found, start new game Object(_BitNode_BitNode__WEBPACK_IMPORTED_MODULE_4__["initBitNodeMultipliers"])(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"]); Object(_Server_SpecialServerIps__WEBPACK_IMPORTED_MODULE_39__["initSpecialServerIps"])(); Engine.setDisplayElements(); // Sets variables for important DOM elements Engine.start(); // Run main game loop and Scripts loop _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].init(); Object(_Server_AllServers__WEBPACK_IMPORTED_MODULE_36__["initForeignServers"])(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].getHomeComputer()); Object(_Company_Companies__WEBPACK_IMPORTED_MODULE_9__["initCompanies"])(); Object(_Faction_Factions__WEBPACK_IMPORTED_MODULE_13__["initFactions"])(); Object(_Augmentation_AugmentationHelpers__WEBPACK_IMPORTED_MODULE_2__[/* initAugmentations */ "d"])(); Object(_Message_MessageHelpers__WEBPACK_IMPORTED_MODULE_25__[/* initMessages */ "c"])(); Object(_SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_38__["updateSourceFileFlags"])(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"]); // Open main menu accordions for new game const hackingHdr = document.getElementById("hacking-menu-header"); hackingHdr.classList.toggle("opened"); const characterHdr = document.getElementById("character-menu-header"); characterHdr.classList.toggle("opened"); const worldHdr = document.getElementById("world-menu-header"); worldHdr.classList.toggle("opened"); const helpHdr = document.getElementById("help-menu-header"); helpHdr.classList.toggle("opened"); // Hide tabs that wont be revealed until later factions.style.display = "none"; augmentations.style.display = "none"; job.style.display = "none"; stockmarket.style.display = "none"; travel.style.display = "none"; createProgram.style.display = "none"; bladeburner.style.display = "none"; corp.style.display = "none"; gang.style.display = "none"; dev.style.display = "none"; Engine.openMainMenuHeader([terminal, createScript, activeScripts, stats, hacknetnodes, city, milestones, tutorial, options]); // Start interactive tutorial Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_22__["iTutorialStart"])(); Object(_utils_uiHelpers_removeLoadingScreen__WEBPACK_IMPORTED_MODULE_61__["removeLoadingScreen"])(); } // Initialize labels on game settings Object(_ui_setSettingsLabels__WEBPACK_IMPORTED_MODULE_49__[/* setSettingsLabels */ "a"])(); _Terminal__WEBPACK_IMPORTED_MODULE_42__[/* Terminal */ "a"].resetTerminalInput(); }, setDisplayElements: function () { // Content elements Engine.Display.terminalContent = document.getElementById("terminal-container"); _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].Terminal); Engine.Display.characterContent = document.getElementById("character-container"); Engine.Display.characterContent.style.display = "none"; Engine.Display.scriptEditorContent = document.getElementById("script-editor-container"); Engine.Display.scriptEditorContent.style.display = "none"; Engine.Display.activeScriptsContent = document.getElementById("active-scripts-container"); Engine.Display.activeScriptsContent.style.display = "none"; Engine.Display.hacknetNodesContent = document.getElementById("hacknet-nodes-container"); Engine.Display.hacknetNodesContent.style.display = "none"; Engine.Display.createProgramContent = document.getElementById("create-program-container"); Engine.Display.createProgramContent.style.display = "none"; Engine.Display.factionsContent = document.getElementById("factions-container"); Engine.Display.factionsContent.style.display = "none"; Engine.Display.factionContent = document.getElementById("faction-container"); Engine.Display.factionContent.style.display = "none"; Engine.Display.augmentationsContent = document.getElementById("augmentations-container"); Engine.Display.augmentationsContent.style.display = "none"; Engine.Display.milestonesContent = document.getElementById("milestones-container"); Engine.Display.milestonesContent.style.display = "none"; Engine.Display.tutorialContent = document.getElementById("tutorial-container"); Engine.Display.tutorialContent.style.display = "none"; Engine.Display.infiltrationContent = document.getElementById("infiltration-container"); Engine.Display.infiltrationContent.style.display = "none"; Engine.Display.stockMarketContent = document.getElementById("stock-market-container"); Engine.Display.stockMarketContent.style.display = "none"; Engine.Display.gangContent = document.getElementById("gang-container"); Engine.Display.gangContent.style.display = "none"; Engine.Display.bladeburnerContent = document.getElementById("gang-container"); Engine.Display.bladeburnerContent.style.display = "none"; Engine.Display.missionContent = document.getElementById("mission-container"); Engine.Display.missionContent.style.display = "none"; // Character info Engine.Display.characterInfo = document.getElementById("character-content"); // Location page (page that shows up when you visit a specific location in World) Engine.Display.locationContent = document.getElementById("location-container"); Engine.Display.locationContent.style.display = "none"; // Work In Progress Engine.Display.workInProgressContent = document.getElementById("work-in-progress-container"); Engine.Display.workInProgressContent.style.display = "none"; // Red Pill / Hack World Daemon Engine.Display.redPillContent = document.getElementById("red-pill-container"); Engine.Display.redPillContent.style.display = "none"; // Cinematic Text Engine.Display.cinematicTextContent = document.getElementById("cinematic-text-container"); Engine.Display.cinematicTextContent.style.display = "none"; // Initialize references to main menu links if (!Object(_ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["initializeMainMenuLinks"])()) { const errorMsg = "Failed to initialize Main Menu Links. Please try refreshing the page. " + "If that doesn't work, report the issue to the developer"; Object(_utils_helpers_exceptionAlert__WEBPACK_IMPORTED_MODULE_60__["exceptionAlert"])(new Error(errorMsg)); console.error(errorMsg); return; } }, // Initialization init: function () { // Import game link document.getElementById("import-game-link").onclick = function () { _SaveObject__WEBPACK_IMPORTED_MODULE_34__[/* saveObject */ "b"].importGame(); }; // Initialize Main Menu Headers (this must be done after initializing the links) if (!Object(_ui_MainMenu_Headers__WEBPACK_IMPORTED_MODULE_54__["initializeMainMenuHeaders"])(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"], "development" === "development")) { const errorMsg = "Failed to initialize Main Menu Headers. Please try refreshing the page. " + "If that doesn't work, report the issue to the developer"; Object(_utils_helpers_exceptionAlert__WEBPACK_IMPORTED_MODULE_60__["exceptionAlert"])(new Error(errorMsg)); console.error(errorMsg); return; } _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Terminal.addEventListener("click", function () { Engine.loadTerminalContent(); return false; }); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].ScriptEditor.addEventListener("click", function () { Engine.loadScriptEditorContent(); return false; }); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].ActiveScripts.addEventListener("click", function () { Engine.loadActiveScriptsContent(); return false; }); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].CreateProgram.addEventListener("click", function () { Engine.loadCreateProgramContent(); return false; }); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Stats.addEventListener("click", function () { Engine.loadCharacterContent(); return false; }); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Factions.addEventListener("click", function () { Engine.loadFactionsContent(); return false; }); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Augmentations.addEventListener("click", function () { Engine.loadAugmentationsContent(); return false; }); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].HacknetNodes.addEventListener("click", function () { Engine.loadHacknetNodesContent(); return false; }); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Sleeves.addEventListener("click", function () { Engine.loadSleevesContent(); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Sleeves.classList.add("active"); return false; }); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].City.addEventListener("click", function () { Engine.loadLocationContent(); return false; }); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Travel.addEventListener("click", function () { Engine.loadTravelContent(); return false; }); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Job.addEventListener("click", function () { Engine.loadJobContent(); return false; }); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].StockMarket.addEventListener("click", function () { Engine.loadStockMarketContent(); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].StockMarket.classList.add("active"); return false; }); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Bladeburner.addEventListener("click", function () { Engine.loadBladeburnerContent(); return false; }); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Corporation.addEventListener("click", function () { Engine.loadCorporationContent(); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Corporation.classList.add("active"); return false; }); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Gang.addEventListener("click", function () { Engine.loadGangContent(); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Gang.classList.add('active'); return false; }); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Milestones.addEventListener("click", function () { Engine.loadMilestonesContent(); return false; }); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Tutorial.addEventListener("click", function () { Engine.loadTutorialContent(); return false; }); _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].DevMenu.addEventListener("click", function () { if (true) { Engine.loadDevMenuContent(); } return false; }); // Active scripts list Engine.ActiveScriptsList = document.getElementById("active-scripts-list"); // Save, Delete, Import/Export buttons Engine.Clickables.saveMainMenuButton = document.getElementById("save-game-link"); Engine.Clickables.saveMainMenuButton.addEventListener("click", function () { _SaveObject__WEBPACK_IMPORTED_MODULE_34__[/* saveObject */ "b"].saveGame(Engine.indexedDb); return false; }); Engine.Clickables.deleteMainMenuButton = document.getElementById("delete-game-link"); Engine.Clickables.deleteMainMenuButton.addEventListener("click", function () { _SaveObject__WEBPACK_IMPORTED_MODULE_34__[/* saveObject */ "b"].deleteGame(Engine.indexedDb); return false; }); document.getElementById("export-game-link").addEventListener("click", function () { _SaveObject__WEBPACK_IMPORTED_MODULE_34__[/* saveObject */ "b"].exportGame(); return false; }); // Character Overview buttons document.getElementById("character-overview-save-button").addEventListener("click", function () { _SaveObject__WEBPACK_IMPORTED_MODULE_34__[/* saveObject */ "b"].saveGame(Engine.indexedDb); return false; }); document.getElementById("character-overview-options-button").addEventListener("click", function () { Object(_utils_GameOptions__WEBPACK_IMPORTED_MODULE_59__[/* gameOptionsBoxOpen */ "b"])(); return false; }); // Create Program buttons Object(_Programs_ProgramHelpers__WEBPACK_IMPORTED_MODULE_32__[/* initCreateProgramButtons */ "c"])(); // Message at the top of terminal Object(_Terminal__WEBPACK_IMPORTED_MODULE_42__[/* postNetburnerText */ "b"])(); // Player was working cancel button if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].isWorking) { var cancelButton = document.getElementById("work-in-progress-cancel-button"); cancelButton.addEventListener("click", function () { if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].workType == _Constants__WEBPACK_IMPORTED_MODULE_11__["CONSTANTS"].WorkTypeFaction) { _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].finishFactionWork(true); } else if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].workType == _Constants__WEBPACK_IMPORTED_MODULE_11__["CONSTANTS"].WorkTypeCreateProgram) { _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].finishCreateProgramWork(true); } else if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].workType == _Constants__WEBPACK_IMPORTED_MODULE_11__["CONSTANTS"].WorkTypeStudyClass) { _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].finishClass(); } else if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].workType == _Constants__WEBPACK_IMPORTED_MODULE_11__["CONSTANTS"].WorkTypeCrime) { _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].finishCrime(true); } else if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].workType == _Constants__WEBPACK_IMPORTED_MODULE_11__["CONSTANTS"].WorkTypeCompanyPartTime) { _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].finishWorkPartTime(); } else { _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].finishWork(true); } }); const focusButton = document.getElementById("work-in-progress-something-else-button"); focusButton.style.visibility = "hidden"; const focusable = [_Constants__WEBPACK_IMPORTED_MODULE_11__["CONSTANTS"].WorkTypeFaction, _Constants__WEBPACK_IMPORTED_MODULE_11__["CONSTANTS"].WorkTypeCompanyPartTime, _Constants__WEBPACK_IMPORTED_MODULE_11__["CONSTANTS"].WorkTypeCompany]; if (focusable.includes(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].workType)) { focusButton.style.visibility = "visible"; focusButton.addEventListener("click", function () { _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].stopFocusing(); }); } Engine.loadWorkInProgressContent(); } // Character overview screen document.getElementById("character-overview-container").style.display = "block"; // Remove classes from links (they might be set from tutorial) document.getElementById("terminal-menu-link").removeAttribute("class"); document.getElementById("stats-menu-link").removeAttribute("class"); document.getElementById("create-script-menu-link").removeAttribute("class"); document.getElementById("active-scripts-menu-link").removeAttribute("class"); document.getElementById("hacknet-nodes-menu-link").removeAttribute("class"); document.getElementById("city-menu-link").removeAttribute("class"); document.getElementById("milestones-menu-link").removeAttribute("class"); document.getElementById("tutorial-menu-link").removeAttribute("class"); // Copy Save Data to Clipboard document.getElementById("copy-save-to-clipboard-link").addEventListener("click", function () { const saveString = _SaveObject__WEBPACK_IMPORTED_MODULE_34__[/* saveObject */ "b"].getSaveString(); if (!navigator.clipboard) { // Async Clipboard API not supported, so we'll use this using the // textarea and document.execCommand('copy') trick const textArea = document.createElement("textarea"); textArea.value = saveString; textArea.setAttribute("readonly", ''); textArea.style.position = 'absolute'; textArea.left = '-9999px'; document.body.appendChild(textArea); textArea.focus(); textArea.select(); try { const successful = document.execCommand("copy"); if (successful) { Object(_ui_createStatusText__WEBPACK_IMPORTED_MODULE_46__["createStatusText"])("Copied save to clipboard"); } else { Object(_ui_createStatusText__WEBPACK_IMPORTED_MODULE_46__["createStatusText"])("Failed to copy save"); } } catch (e) { console.error("Unable to copy save data to clipboard using document.execCommand('copy')"); Object(_ui_createStatusText__WEBPACK_IMPORTED_MODULE_46__["createStatusText"])("Failed to copy save"); } document.body.removeChild(textArea); } else { // Use the Async Clipboard API navigator.clipboard.writeText(saveString).then(function () { Object(_ui_createStatusText__WEBPACK_IMPORTED_MODULE_46__["createStatusText"])("Copied save to clipboard"); }, function (err) { console.error(err); console.error("Unable to copy save data to clipboard using Async API"); Object(_ui_createStatusText__WEBPACK_IMPORTED_MODULE_46__["createStatusText"])("Failed to copy save"); }); } }); // DEBUG Delete active Scripts on home document.getElementById("debug-delete-scripts-link").addEventListener("click", function () { for (const hostname of Object.keys(_Server_AllServers__WEBPACK_IMPORTED_MODULE_36__["AllServers"])) { _Server_AllServers__WEBPACK_IMPORTED_MODULE_36__["AllServers"][hostname].runningScripts = []; } Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_58__["dialogBoxCreate"])("Forcefully deleted all running scripts. Please save and refresh page."); Object(_utils_GameOptions__WEBPACK_IMPORTED_MODULE_59__[/* gameOptionsBoxClose */ "a"])(); return false; }); // DEBUG Soft Reset document.getElementById("debug-soft-reset").addEventListener("click", function () { Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_58__["dialogBoxCreate"])("Soft Reset!"); Object(_Prestige__WEBPACK_IMPORTED_MODULE_31__[/* prestigeAugmentation */ "a"])(); Object(_utils_GameOptions__WEBPACK_IMPORTED_MODULE_59__[/* gameOptionsBoxClose */ "a"])(); return false; }); // DEBUG File diagnostic document.getElementById("debug-files").addEventListener("click", function () { Object(_ui_React_createPopup__WEBPACK_IMPORTED_MODULE_57__["createPopup"])("debug-files-diagnostic-popup", _Diagnostic_FileDiagnosticPopup__WEBPACK_IMPORTED_MODULE_56__["FileDiagnosticPopup"], {}); return false; }); }, start: function () { // Run main loop Engine.idleTimer(); } }; var indexedDbRequest; window.onload = function () { if (!window.indexedDB) { return Engine.load(null); // Will try to load from localstorage } /** * DB is called bitburnerSave * Object store is called savestring * key for the Object store is called save */ indexedDbRequest = window.indexedDB.open("bitburnerSave", 1); indexedDbRequest.onerror = function (e) { console.error("Error opening indexedDB: "); console.error(e); return Engine.load(null); // Try to load from localstorage }; indexedDbRequest.onsuccess = function (e) { Engine.indexedDb = e.target.result; var transaction = Engine.indexedDb.transaction(["savestring"]); var objectStore = transaction.objectStore("savestring"); var request = objectStore.get("save"); request.onerror = function (e) { console.error("Error in Database request to get savestring: " + e); return Engine.load(null); // Try to load from localstorage }; request.onsuccess = function () { Engine.load(request.result); }; }; indexedDbRequest.onupgradeneeded = function (e) { const db = e.target.result; db.createObjectStore("savestring"); }; }; /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ 143))) /***/ }), /* 16 */ /*!*******************************************!*\ !*** ./src/Augmentation/Augmentation.tsx ***! \*******************************************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Augmentation = void 0; // Class definition for a single Augmentation object const React = __importStar(__webpack_require__(/*! react */ 0)); const BitNodeMultipliers_1 = __webpack_require__(/*! ../BitNode/BitNodeMultipliers */ 19); const Factions_1 = __webpack_require__(/*! ../Faction/Factions */ 17); const numeralFormat_1 = __webpack_require__(/*! ../ui/numeralFormat */ 7); const Money_1 = __webpack_require__(/*! ../ui/React/Money */ 27); const JSONReviver_1 = __webpack_require__(/*! ../../utils/JSONReviver */ 29); function generateStatsDescription(mults, programs, startingMoney) { const f = (x, decimals = 0) => { // look, I don't know how to make a "smart decimals" // todo, make it smarter if (x === 1.0777 - 1) return "7.77%"; if (x === 1.777 - 1) return "77.7%"; return numeralFormat_1.numeralWrapper.formatPercentage(x, decimals); }; let desc = React.createElement(React.Fragment, null, "Effects:"); if (mults.hacking_mult && mults.hacking_mult == mults.strength_mult && mults.hacking_mult == mults.defense_mult && mults.hacking_mult == mults.dexterity_mult && mults.hacking_mult == mults.agility_mult && mults.hacking_mult == mults.charisma_mult) { desc = React.createElement(React.Fragment, null, desc, React.createElement("br", null), "+", f(mults.hacking_mult - 1), " all skills"); } else { if (mults.hacking_mult) desc = React.createElement(React.Fragment, null, desc, React.createElement("br", null), "+", f(mults.hacking_mult - 1), " hacking skill"); if (mults.strength_mult && mults.strength_mult == mults.defense_mult && mults.strength_mult == mults.dexterity_mult && mults.strength_mult == mults.agility_mult) { desc = React.createElement(React.Fragment, null, desc, React.createElement("br", null), "+", f(mults.strength_mult - 1), " combat skills"); } else { if (mults.strength_mult) desc = React.createElement(React.Fragment, null, desc, React.createElement("br", null), "+", f(mults.strength_mult - 1), " strength skill"); if (mults.defense_mult) desc = React.createElement(React.Fragment, null, desc, React.createElement("br", null), "+", f(mults.defense_mult - 1), " defense skill"); if (mults.dexterity_mult) desc = React.createElement(React.Fragment, null, desc, React.createElement("br", null), "+", f(mults.dexterity_mult - 1), " dexterity skill"); if (mults.agility_mult) desc = React.createElement(React.Fragment, null, desc, React.createElement("br", null), "+", f(mults.agility_mult - 1), " agility skill"); } if (mults.charisma_mult) desc = React.createElement(React.Fragment, null, desc, React.createElement("br", null), "+", f(mults.charisma_mult - 1), " Charisma skill"); } if (mults.hacking_exp_mult && mults.hacking_exp_mult === mults.strength_exp_mult && mults.hacking_exp_mult === mults.defense_exp_mult && mults.hacking_exp_mult === mults.dexterity_exp_mult && mults.hacking_exp_mult === mults.agility_exp_mult && mults.hacking_exp_mult === mults.charisma_exp_mult) { desc = React.createElement(React.Fragment, null, desc, React.createElement("br", null), "+", f(mults.hacking_exp_mult - 1), " exp for all skills"); } else { if (mults.hacking_exp_mult) desc = React.createElement(React.Fragment, null, desc, React.createElement("br", null), "+", f(mults.hacking_exp_mult - 1), " hacking exp"); if (mults.strength_exp_mult && mults.strength_exp_mult === mults.defense_exp_mult && mults.strength_exp_mult === mults.dexterity_exp_mult && mults.strength_exp_mult === mults.agility_exp_mult) { desc = React.createElement(React.Fragment, null, desc, React.createElement("br", null), "+", f(mults.strength_exp_mult - 1), " combat exp"); } else { if (mults.strength_exp_mult) desc = React.createElement(React.Fragment, null, desc, React.createElement("br", null), "+", f(mults.strength_exp_mult - 1), " strength exp"); if (mults.defense_exp_mult) desc = React.createElement(React.Fragment, null, desc, React.createElement("br", null), "+", f(mults.defense_exp_mult - 1), " defense exp"); if (mults.dexterity_exp_mult) desc = React.createElement(React.Fragment, null, desc, React.createElement("br", null), "+", f(mults.dexterity_exp_mult - 1), " dexterity exp"); if (mults.agility_exp_mult) desc = React.createElement(React.Fragment, null, desc, React.createElement("br", null), "+", f(mults.agility_exp_mult - 1), " agility exp"); } if (mults.charisma_exp_mult) desc = React.createElement(React.Fragment, null, desc, React.createElement("br", null), "+", f(mults.charisma_exp_mult - 1), " charisma exp"); } if (mults.hacking_speed_mult) desc = React.createElement(React.Fragment, null, desc, React.createElement("br", null), "+", f(mults.hacking_speed_mult - 1), " faster hacking"); if (mults.hacking_chance_mult) desc = React.createElement(React.Fragment, null, desc, React.createElement("br", null), "+", f(mults.hacking_chance_mult - 1), " hack() success chance"); if (mults.hacking_money_mult) desc = React.createElement(React.Fragment, null, desc, React.createElement("br", null), "+", f(mults.hacking_money_mult - 1), " hack() power"); if (mults.hacking_grow_mult) desc = React.createElement(React.Fragment, null, desc, React.createElement("br", null), "+", f(mults.hacking_grow_mult - 1), " grow() power"); if (mults.faction_rep_mult && mults.faction_rep_mult === mults.company_rep_mult) { desc = React.createElement(React.Fragment, null, desc, React.createElement("br", null), "+", f(mults.faction_rep_mult - 1), " reputation from factions and companies"); } else { if (mults.faction_rep_mult) desc = React.createElement(React.Fragment, null, desc, React.createElement("br", null), "+", f(mults.faction_rep_mult - 1), " reputation from factions"); if (mults.company_rep_mult) desc = React.createElement(React.Fragment, null, desc, React.createElement("br", null), "+", f(mults.company_rep_mult - 1), " reputation from companies"); } if (mults.crime_money_mult) desc = React.createElement(React.Fragment, null, desc, React.createElement("br", null), "+", f(mults.crime_money_mult - 1), " crime money"); if (mults.crime_success_mult) desc = React.createElement(React.Fragment, null, desc, React.createElement("br", null), "+", f(mults.crime_success_mult - 1), " crime success rate"); if (mults.work_money_mult) desc = React.createElement(React.Fragment, null, desc, React.createElement("br", null), "+", f(mults.work_money_mult - 1), " work money"); if (mults.hacknet_node_money_mult) desc = React.createElement(React.Fragment, null, desc, React.createElement("br", null), "+", f(mults.hacknet_node_money_mult - 1), " hacknet production"); if (mults.hacknet_node_purchase_cost_mult) desc = React.createElement(React.Fragment, null, desc, React.createElement("br", null), "-", f(-(mults.hacknet_node_purchase_cost_mult - 1)), " hacknet nodes cost"); if (mults.hacknet_node_level_cost_mult) desc = React.createElement(React.Fragment, null, desc, React.createElement("br", null), "-", f(-(mults.hacknet_node_level_cost_mult - 1)), " hacknet nodes upgrade cost"); if (mults.bladeburner_max_stamina_mult) desc = React.createElement(React.Fragment, null, desc, React.createElement("br", null), "+", f(mults.bladeburner_max_stamina_mult - 1), " Bladeburner Max Stamina"); if (mults.bladeburner_stamina_gain_mult) desc = React.createElement(React.Fragment, null, desc, React.createElement("br", null), "+", f(mults.bladeburner_stamina_gain_mult - 1), " Bladeburner Stamina gain"); if (mults.bladeburner_analysis_mult) desc = React.createElement(React.Fragment, null, desc, React.createElement("br", null), "+", f(mults.bladeburner_analysis_mult - 1), " Bladeburner Field Analysis effectiveness"); if (mults.bladeburner_success_chance_mult) desc = React.createElement(React.Fragment, null, desc, React.createElement("br", null), "+", f(mults.bladeburner_success_chance_mult - 1), " Bladeburner Contracts and Operations success chance"); if (startingMoney) desc = React.createElement(React.Fragment, null, desc, React.createElement("br", null), "Start with ", Money_1.Money(startingMoney), " after installing Augmentations."); if (programs) desc = React.createElement(React.Fragment, null, desc, React.createElement("br", null), "Start with ", programs.join(' and '), " after installing Augmentations."); return desc; } class Augmentation { constructor(params = { info: "", moneyCost: 0, name: "", repCost: 0 }) { // How much money this costs to buy this.baseCost = 0; // How much faction reputation is required to unlock this this.baseRepRequirement = 0; // Any Augmentation not immediately available in BitNode-1 is special (e.g. Bladeburner augs) this.isSpecial = false; // Augmentation level - for repeatable Augs like NeuroFlux Governor this.level = 0; // Name of Augmentation this.name = ""; // Whether the player owns this Augmentation this.owned = false; // Array of names of all prerequisites this.prereqs = []; // Multipliers given by this Augmentation. Must match the property name in // The Player/Person classes this.mults = {}; // Initial cost. Doesn't change when you purchase multiple Augmentation this.startingCost = 0; this.name = params.name; this.info = params.info; this.prereqs = params.prereqs ? params.prereqs : []; this.baseRepRequirement = params.repCost * BitNodeMultipliers_1.BitNodeMultipliers.AugmentationRepCost; this.baseCost = params.moneyCost * BitNodeMultipliers_1.BitNodeMultipliers.AugmentationMoneyCost; this.startingCost = this.baseCost; if (params.isSpecial) { this.isSpecial = true; } this.level = 0; // Set multipliers if (params.hacking_mult) { this.mults.hacking_mult = params.hacking_mult; } if (params.strength_mult) { this.mults.strength_mult = params.strength_mult; } if (params.defense_mult) { this.mults.defense_mult = params.defense_mult; } if (params.dexterity_mult) { this.mults.dexterity_mult = params.dexterity_mult; } if (params.agility_mult) { this.mults.agility_mult = params.agility_mult; } if (params.charisma_mult) { this.mults.charisma_mult = params.charisma_mult; } if (params.hacking_exp_mult) { this.mults.hacking_exp_mult = params.hacking_exp_mult; } if (params.strength_exp_mult) { this.mults.strength_exp_mult = params.strength_exp_mult; } if (params.defense_exp_mult) { this.mults.defense_exp_mult = params.defense_exp_mult; } if (params.dexterity_exp_mult) { this.mults.dexterity_exp_mult = params.dexterity_exp_mult; } if (params.agility_exp_mult) { this.mults.agility_exp_mult = params.agility_exp_mult; } if (params.charisma_exp_mult) { this.mults.charisma_exp_mult = params.charisma_exp_mult; } if (params.hacking_chance_mult) { this.mults.hacking_chance_mult = params.hacking_chance_mult; } if (params.hacking_speed_mult) { this.mults.hacking_speed_mult = params.hacking_speed_mult; } if (params.hacking_money_mult) { this.mults.hacking_money_mult = params.hacking_money_mult; } if (params.hacking_grow_mult) { this.mults.hacking_grow_mult = params.hacking_grow_mult; } if (params.company_rep_mult) { this.mults.company_rep_mult = params.company_rep_mult; } if (params.faction_rep_mult) { this.mults.faction_rep_mult = params.faction_rep_mult; } if (params.crime_money_mult) { this.mults.crime_money_mult = params.crime_money_mult; } if (params.crime_success_mult) { this.mults.crime_success_mult = params.crime_success_mult; } if (params.work_money_mult) { this.mults.work_money_mult = params.work_money_mult; } if (params.hacknet_node_money_mult) { this.mults.hacknet_node_money_mult = params.hacknet_node_money_mult; } if (params.hacknet_node_purchase_cost_mult) { this.mults.hacknet_node_purchase_cost_mult = params.hacknet_node_purchase_cost_mult; } if (params.hacknet_node_ram_cost_mult) { this.mults.hacknet_node_ram_cost_mult = params.hacknet_node_ram_cost_mult; } if (params.hacknet_node_core_cost_mult) { this.mults.hacknet_node_core_cost_mult = params.hacknet_node_core_cost_mult; } if (params.hacknet_node_level_cost_mult) { this.mults.hacknet_node_level_cost_mult = params.hacknet_node_level_cost_mult; } if (params.bladeburner_max_stamina_mult) { this.mults.bladeburner_max_stamina_mult = params.bladeburner_max_stamina_mult; } if (params.bladeburner_stamina_gain_mult) { this.mults.bladeburner_stamina_gain_mult = params.bladeburner_stamina_gain_mult; } if (params.bladeburner_analysis_mult) { this.mults.bladeburner_analysis_mult = params.bladeburner_analysis_mult; } if (params.bladeburner_success_chance_mult) { this.mults.bladeburner_success_chance_mult = params.bladeburner_success_chance_mult; } if (params.stats) this.stats = params.stats; else this.stats = generateStatsDescription(this.mults, params.programs, params.startingMoney); } // Adds this Augmentation to the specified Factions addToFactions(factionList) { for (let i = 0; i < factionList.length; ++i) { const faction = Factions_1.Factions[factionList[i]]; if (faction == null) { console.warn(`In Augmentation.addToFactions(), could not find faction with this name: ${factionList[i]}`); continue; } faction.augmentations.push(this.name); } } // Adds this Augmentation to all Factions addToAllFactions() { for (const fac in Factions_1.Factions) { if (Factions_1.Factions.hasOwnProperty(fac)) { const facObj = Factions_1.Factions[fac]; if (facObj == null) { console.warn(`Invalid Faction object in addToAllFactions(). Key value: ${fac}`); continue; } facObj.augmentations.push(this.name); } } } // Serialize the current object to a JSON save state. toJSON() { return JSONReviver_1.Generic_toJSON("Augmentation", this); } // Initiatizes a Augmentation object from a JSON save state. // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types static fromJSON(value) { return JSONReviver_1.Generic_fromJSON(Augmentation, value.data); } } exports.Augmentation = Augmentation; JSONReviver_1.Reviver.constructors.Augmentation = Augmentation; /***/ }), /* 17 */ /*!*********************************!*\ !*** ./src/Faction/Factions.ts ***! \*********************************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.resetFaction = exports.initFactions = exports.factionExists = exports.AddToFactions = exports.loadFactions = exports.Factions = void 0; /** * Initialization and manipulation of the Factions object, which stores data * about all Factions in the game */ const Faction_1 = __webpack_require__(/*! ./Faction */ 125); const FactionInfo_1 = __webpack_require__(/*! ./FactionInfo */ 695); const JSONReviver_1 = __webpack_require__(/*! ../../utils/JSONReviver */ 29); exports.Factions = {}; function loadFactions(saveString) { exports.Factions = JSON.parse(saveString, JSONReviver_1.Reviver); } exports.loadFactions = loadFactions; function AddToFactions(faction) { const name = faction.name; exports.Factions[name] = faction; } exports.AddToFactions = AddToFactions; function factionExists(name) { return exports.Factions.hasOwnProperty(name); } exports.factionExists = factionExists; function initFactions() { for (const name in FactionInfo_1.FactionInfos) { resetFaction(new Faction_1.Faction(name)); } } exports.initFactions = initFactions; //Resets a faction during (re-)initialization. Saves the favor in the new //Faction object and deletes the old Faction Object from "Factions". Then //reinserts the new Faction object function resetFaction(newFactionObject) { if (!(newFactionObject instanceof Faction_1.Faction)) { throw new Error("Invalid argument 'newFactionObject' passed into resetFaction()"); } const factionName = newFactionObject.name; if (factionExists(factionName)) { newFactionObject.favor = exports.Factions[factionName].favor; delete exports.Factions[factionName]; } AddToFactions(newFactionObject); } exports.resetFaction = resetFaction; /***/ }), /* 18 */ /*!**************************************!*\ !*** ./src/ui/navigationTracking.ts ***! \**************************************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.routing = exports.Page = void 0; /** * The full-screen page the player is currently be on. * These pages are mutually exclusive. */ var Page; (function (Page) { /** * (Default) The terminal is where the player issues all commands, executes scripts, etc. */ Page["Terminal"] = "Terminal"; /** * Displays most of the statistics about the player. */ Page["CharacterInfo"] = "CharacterInfo"; /** * The console for editing Netscript files. */ Page["ScriptEditor"] = "ScriptEditor"; /** * Monitor the scripts currently executing across the servers. */ Page["ActiveScripts"] = "ActiveScripts"; /** * View, purchase, and upgrade Hacknet nodes. */ Page["HacknetNodes"] = "HacknetNodes"; /** * The list of programs the player could potentially build. */ Page["CreateProgram"] = "CreateProgram"; /** * The list of all factions, and invites, available to the player. */ Page["Factions"] = "Factions"; /** * Information about a specific faction. */ Page["Faction"] = "Faction"; /** * The list of installed, and yet-to-be installed, augmentations the player has purchased. */ Page["Augmentations"] = "Augmentations"; /** * List of milestones that players should follow. */ Page["Milestones"] = "Milestones"; /** * A collection of in-game material to learn about the game. */ Page["Tutorial"] = "Tutorial"; /** * A collection of items to manipulate the state of the game. Useful for development. */ Page["DevMenu"] = "Dev Menu"; /** * Visiting a location in the world */ Page["Location"] = "Location"; /** * A blocking page to show the player they are currently doing some action (building a program, working, etc.). */ Page["workInProgress"] = "WorkInProgress"; /** * A special screen to show the player they've reached a certain point in the game. */ Page["RedPill"] = "RedPill"; /** * A special screen to show the player they've reached a certain point in the game. */ Page["CinematicText"] = "CinematicText"; /** * Mini-game to infiltrate a company, gaining experience from successful progress. */ Page["Infiltration"] = "Infiltration"; /** * View the in-game stock market. */ Page["StockMarket"] = "StockMarket"; /** * Manage gang actions and members. */ Page["Gang"] = "Gang"; /** * Perform missions for a Faction. */ Page["Mission"] = "Mission"; /** * Manage a corporation. */ Page["Corporation"] = "Corporation"; /** * Manage special Bladeburner activities. */ Page["Bladeburner"] = "Bladeburner"; /** * Manage your Sleeves */ Page["Sleeves"] = "Sleeves"; /** * Purchase Resleeves */ Page["Resleeves"] = "Re-sleeving"; })(Page = exports.Page || (exports.Page = {})); /** * This class keeps track of player navigation/routing within the game. */ class Routing { constructor() { /** * Tracking the what page the user is currently on. */ this.currentPage = null; } /** * Determines if the player is currently on the specified page. * @param page The page to compare against the current state. */ isOn(page) { return this.currentPage === page; } /** * Routes the player to the appropriate page. * @param page The page to navigate to. */ navigateTo(page) { this.currentPage = page; } } /** * The routing instance for tracking page navigation. */ exports.routing = new Routing(); /***/ }), /* 19 */ /*!*******************************************!*\ !*** ./src/BitNode/BitNodeMultipliers.ts ***! \*******************************************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BitNodeMultipliers = void 0; /** * The multipliers that are influenced by current Bitnode progression. */ // tslint:disable-next-line:variable-name exports.BitNodeMultipliers = { HackingLevelMultiplier: 1, StrengthLevelMultiplier: 1, DefenseLevelMultiplier: 1, DexterityLevelMultiplier: 1, AgilityLevelMultiplier: 1, CharismaLevelMultiplier: 1, ServerGrowthRate: 1, ServerMaxMoney: 1, ServerStartingMoney: 1, ServerStartingSecurity: 1, ServerWeakenRate: 1, HomeComputerRamCost: 1, PurchasedServerCost: 1, PurchasedServerLimit: 1, PurchasedServerMaxRam: 1, CompanyWorkMoney: 1, CrimeMoney: 1, HacknetNodeMoney: 1, ManualHackMoney: 1, ScriptHackMoney: 1, ScriptHackMoneyGain: 1, CodingContractMoney: 1, ClassGymExpGain: 1, CompanyWorkExpGain: 1, CrimeExpGain: 1, FactionWorkExpGain: 1, HackExpGain: 1, FactionPassiveRepGain: 1, FactionWorkRepGain: 1, RepToDonateToFaction: 1, AugmentationMoneyCost: 1, AugmentationRepCost: 1, InfiltrationMoney: 1, InfiltrationRep: 1, FourSigmaMarketDataCost: 1, FourSigmaMarketDataApiCost: 1, CorporationValuation: 1, BladeburnerRank: 1, BladeburnerSkillCost: 1, DaedalusAugsRequirement: 1, GangKarmaRequirement: 1, }; /***/ }), /* 20 */ /*!**********************************!*\ !*** ./src/Server/AllServers.ts ***! \**********************************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.loadAllServers = exports.prestigeAllServers = exports.initForeignServers = exports.AddToAllServers = exports.createUniqueRandomIp = exports.ipExists = exports.AllServers = void 0; const Server_1 = __webpack_require__(/*! ./Server */ 488); const SpecialServerIps_1 = __webpack_require__(/*! ./SpecialServerIps */ 38); const servers_1 = __webpack_require__(/*! ./data/servers */ 1060); const IPAddress_1 = __webpack_require__(/*! ../../utils/IPAddress */ 399); const getRandomInt_1 = __webpack_require__(/*! ../../utils/helpers/getRandomInt */ 45); const JSONReviver_1 = __webpack_require__(/*! ../../utils/JSONReviver */ 29); /** * Map of all Servers that exist in the game * Key (string) = IP * Value = Server object */ exports.AllServers = {}; function ipExists(ip) { return (exports.AllServers[ip] != null); } exports.ipExists = ipExists; function createUniqueRandomIp() { const ip = IPAddress_1.createRandomIp(); // If the Ip already exists, recurse to create a new one if (ipExists(ip)) { return IPAddress_1.createRandomIp(); } return ip; } exports.createUniqueRandomIp = createUniqueRandomIp; // Saftely add a Server to the AllServers map function AddToAllServers(server) { const serverIp = server.ip; if (ipExists(serverIp)) { console.warn(`IP of server that's being added: ${serverIp}`); console.warn(`Hostname of the server thats being added: ${server.hostname}`); console.warn(`The server that already has this IP is: ${exports.AllServers[serverIp].hostname}`); throw new Error("Error: Trying to add a server with an existing IP"); } exports.AllServers[serverIp] = server; } exports.AddToAllServers = AddToAllServers; function initForeignServers(homeComputer) { /* Create a randomized network for all the foreign servers */ //Groupings for creating a randomized network const networkLayers = []; for (let i = 0; i < 15; i++) { networkLayers.push([]); } // Essentially any property that is of type 'number | IMinMaxRange' const propertiesToPatternMatch = [ "hackDifficulty", "moneyAvailable", "requiredHackingSkill", "serverGrowth", ]; const toNumber = (value) => { switch (typeof value) { case 'number': return value; case 'object': return getRandomInt_1.getRandomInt(value.min, value.max); default: throw Error(`Do not know how to convert the type '${typeof value}' to a number`); } }; for (const metadata of servers_1.serverMetadata) { const serverParams = { hostname: metadata.hostname, ip: createUniqueRandomIp(), numOpenPortsRequired: metadata.numOpenPortsRequired, organizationName: metadata.organizationName, }; if (metadata.maxRamExponent !== undefined) { serverParams.maxRam = Math.pow(2, toNumber(metadata.maxRamExponent)); } for (const prop of propertiesToPatternMatch) { if (metadata[prop] !== undefined) { serverParams[prop] = toNumber(metadata[prop]); } } const server = new Server_1.Server(serverParams); for (const filename of (metadata.literature || [])) { server.messages.push(filename); } if (metadata.specialName !== undefined) { SpecialServerIps_1.SpecialServerIps.addIp(metadata.specialName, server.ip); } AddToAllServers(server); if (metadata.networkLayer !== undefined) { networkLayers[toNumber(metadata.networkLayer) - 1].push(server); } } /* Create a randomized network for all the foreign servers */ const linkComputers = (server1, server2) => { server1.serversOnNetwork.push(server2.ip); server2.serversOnNetwork.push(server1.ip); }; const getRandomArrayItem = (arr) => arr[Math.floor(Math.random() * arr.length)]; const linkNetworkLayers = (network1, selectServer) => { for (const server of network1) { linkComputers(server, selectServer()); } }; // Connect the first tier of servers to the player's home computer linkNetworkLayers(networkLayers[0], () => homeComputer); for (let i = 1; i < networkLayers.length; i++) { linkNetworkLayers(networkLayers[i], () => getRandomArrayItem(networkLayers[i - 1])); } } exports.initForeignServers = initForeignServers; function prestigeAllServers() { for (const member in exports.AllServers) { delete exports.AllServers[member]; } exports.AllServers = {}; } exports.prestigeAllServers = prestigeAllServers; function loadAllServers(saveString) { exports.AllServers = JSON.parse(saveString, JSONReviver_1.Reviver); } exports.loadAllServers = loadAllServers; /***/ }), /* 21 */, /* 22 */ /*!*************************************!*\ !*** ./src/Server/ServerHelpers.ts ***! \*************************************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isBackdoorInstalled = exports.getServerOnNetwork = exports.getServer = exports.GetServerByHostname = exports.prestigeHomeComputer = exports.processSingleServerGrowth = exports.numCycleForGrowth = exports.safetlyCreateUniqueServer = void 0; const AllServers_1 = __webpack_require__(/*! ./AllServers */ 20); const Server_1 = __webpack_require__(/*! ./Server */ 488); const grow_1 = __webpack_require__(/*! ./formulas/grow */ 522); const BitNodeMultipliers_1 = __webpack_require__(/*! ../BitNode/BitNodeMultipliers */ 19); const Constants_1 = __webpack_require__(/*! ../Constants */ 11); const Programs_1 = __webpack_require__(/*! ../Programs/Programs */ 30); const LiteratureNames_1 = __webpack_require__(/*! ../Literature/data/LiteratureNames */ 144); const isValidNumber_1 = __webpack_require__(/*! ../utils/helpers/isValidNumber */ 1059); const isValidIPAddress_1 = __webpack_require__(/*! ../../utils/helpers/isValidIPAddress */ 679); /** * Constructs a new server, while also ensuring that the new server * does not have a duplicate hostname/ip. */ function safetlyCreateUniqueServer(params) { if (params.ip != null && AllServers_1.ipExists(params.ip)) { params.ip = AllServers_1.createUniqueRandomIp(); } if (GetServerByHostname(params.hostname) != null) { // Use a for loop to ensure that we don't get suck in an infinite loop somehow let hostname = params.hostname; for (let i = 0; i < 200; ++i) { hostname = `${params.hostname}-${i}`; if (GetServerByHostname(hostname) == null) { break; } } params.hostname = hostname; } return new Server_1.Server(params); } exports.safetlyCreateUniqueServer = safetlyCreateUniqueServer; /** * Returns the number of "growth cycles" needed to grow the specified server by the * specified amount. * @param server - Server being grown * @param growth - How much the server is being grown by, in DECIMAL form (e.g. 1.5 rather than 50) * @param p - Reference to Player object * @returns Number of "growth cycles" needed */ function numCycleForGrowth(server, growth, p) { let ajdGrowthRate = 1 + (Constants_1.CONSTANTS.ServerBaseGrowthRate - 1) / server.hackDifficulty; if (ajdGrowthRate > Constants_1.CONSTANTS.ServerMaxGrowthRate) { ajdGrowthRate = Constants_1.CONSTANTS.ServerMaxGrowthRate; } const serverGrowthPercentage = server.serverGrowth / 100; const cycles = Math.log(growth) / (Math.log(ajdGrowthRate) * p.hacking_grow_mult * serverGrowthPercentage * BitNodeMultipliers_1.BitNodeMultipliers.ServerGrowthRate); return cycles; } exports.numCycleForGrowth = numCycleForGrowth; //Applied server growth for a single server. Returns the percentage growth function processSingleServerGrowth(server, threads, p, cores = 1) { let serverGrowth = grow_1.calculateServerGrowth(server, threads, p, cores); if (serverGrowth < 1) { console.warn("serverGrowth calculated to be less than 1"); serverGrowth = 1; } const oldMoneyAvailable = server.moneyAvailable; server.moneyAvailable *= serverGrowth; // in case of data corruption if (isValidNumber_1.isValidNumber(server.moneyMax) && isNaN(server.moneyAvailable)) { server.moneyAvailable = server.moneyMax; } // cap at max if (isValidNumber_1.isValidNumber(server.moneyMax) && server.moneyAvailable > server.moneyMax) { server.moneyAvailable = server.moneyMax; } // if there was any growth at all, increase security if (oldMoneyAvailable !== server.moneyAvailable) { //Growing increases server security twice as much as hacking let usedCycles = numCycleForGrowth(server, server.moneyAvailable / oldMoneyAvailable, p); usedCycles = Math.max(0, usedCycles); server.fortify(2 * Constants_1.CONSTANTS.ServerFortifyAmount * Math.ceil(usedCycles)); } return server.moneyAvailable / oldMoneyAvailable; } exports.processSingleServerGrowth = processSingleServerGrowth; function prestigeHomeComputer(homeComp) { const hasBitflume = homeComp.programs.includes(Programs_1.Programs.BitFlume.name); homeComp.programs.length = 0; //Remove programs homeComp.runningScripts = []; homeComp.serversOnNetwork = []; homeComp.isConnectedTo = true; homeComp.ramUsed = 0; homeComp.programs.push(Programs_1.Programs.NukeProgram.name); if (hasBitflume) { homeComp.programs.push(Programs_1.Programs.BitFlume.name); } //Update RAM usage on all scripts homeComp.scripts.forEach(function (script) { script.updateRamUsage(homeComp.scripts); }); homeComp.messages.length = 0; //Remove .lit and .msg files homeComp.messages.push(LiteratureNames_1.LiteratureNames.HackersStartingHandbook); } exports.prestigeHomeComputer = prestigeHomeComputer; //Returns server object with corresponding hostname // Relatively slow, would rather not use this a lot function GetServerByHostname(hostname) { for (const ip in AllServers_1.AllServers) { if (AllServers_1.AllServers.hasOwnProperty(ip)) { if (AllServers_1.AllServers[ip].hostname == hostname) { return AllServers_1.AllServers[ip]; } } } return null; } exports.GetServerByHostname = GetServerByHostname; //Get server by IP or hostname. Returns null if invalid function getServer(s) { if (!isValidIPAddress_1.isValidIPAddress(s)) { return GetServerByHostname(s); } if (AllServers_1.AllServers[s] !== undefined) { return AllServers_1.AllServers[s]; } return null; } exports.getServer = getServer; // Returns the i-th server on the specified server's network // A Server's serverOnNetwork property holds only the IPs. This function returns // the actual Server object function getServerOnNetwork(server, i) { if (i > server.serversOnNetwork.length) { console.error("Tried to get server on network that was out of range"); return null; } return AllServers_1.AllServers[server.serversOnNetwork[i]]; } exports.getServerOnNetwork = getServerOnNetwork; function isBackdoorInstalled(server) { if ("backdoorInstalled" in server) { return server.backdoorInstalled; } return false; } exports.isBackdoorInstalled = isBackdoorInstalled; /***/ }), /* 23 */ /*!****************************************!*\ !*** ./utils/StringHelperFunctions.ts ***! \****************************************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.replaceAt = exports.generateRandomString = exports.isHTML = exports.formatNumber = exports.containsAllStrings = exports.longestCommonStart = exports.convertTimeMsToTimeElapsedString = void 0; const isString_1 = __webpack_require__(/*! ./helpers/isString */ 72); // Netburner String helper functions // Replaces the character at an index with a new character function replaceAt(base, index, character) { return base.substr(0, index) + character + base.substr(index + character.length); } exports.replaceAt = replaceAt; /* Converts a date representing time in milliseconds to a string with the format H hours M minutes and S seconds e.g. 10000 -> "10 seconds" 120000 -> "2 minutes and 0 seconds" */ function convertTimeMsToTimeElapsedString(time, showMilli = false) { time = Math.floor(time); const millisecondsPerSecond = 1000; const secondPerMinute = 60; const minutesPerHours = 60; const secondPerHours = secondPerMinute * minutesPerHours; const hoursPerDays = 24; const secondPerDay = secondPerHours * hoursPerDays; // Convert ms to seconds, since we only have second-level precision const totalSeconds = Math.floor(time / millisecondsPerSecond); const days = Math.floor(totalSeconds / secondPerDay); const secTruncDays = totalSeconds % secondPerDay; const hours = Math.floor(secTruncDays / secondPerHours); const secTruncHours = secTruncDays % secondPerHours; const minutes = Math.floor(secTruncHours / secondPerMinute); const secTruncMinutes = secTruncHours % secondPerMinute; const milliTruncSec = (() => { let str = `${time % millisecondsPerSecond}`; while (str.length < 3) str = "0" + str; return str; })(); const seconds = showMilli ? `${secTruncMinutes}.${milliTruncSec}` : `${secTruncMinutes}`; let res = ""; if (days > 0) { res += `${days} days `; } if (hours > 0) { res += `${hours} hours `; } if (minutes > 0) { res += `${minutes} minutes `; } res += `${seconds} seconds`; return res; } exports.convertTimeMsToTimeElapsedString = convertTimeMsToTimeElapsedString; // Finds the longest common starting substring in a set of strings function longestCommonStart(strings) { if (!containsAllStrings(strings)) { return ""; } if (strings.length === 0) { return ""; } const A = strings.concat() .sort(); const a1 = A[0]; const a2 = A[A.length - 1]; const L = a1.length; let i = 0; const areEqualCaseInsensitive = (a, b) => a.toUpperCase() === b.toUpperCase(); while (i < L && areEqualCaseInsensitive(a1.charAt(i), a2.charAt(i))) { i++; } return a1.substring(0, i); } exports.longestCommonStart = longestCommonStart; // Returns whether an array contains entirely of string objects function containsAllStrings(arr) { return arr.every(isString_1.isString); } exports.containsAllStrings = containsAllStrings; // Formats a number with commas and a specific number of decimal digits function formatNumber(num, numFractionDigits = 0) { return num.toLocaleString(undefined, { maximumFractionDigits: numFractionDigits, minimumFractionDigits: numFractionDigits, }); } exports.formatNumber = formatNumber; // Checks if a string contains HTML elements function isHTML(str) { const element = document.createElement("div"); element.innerHTML = str; const c = element.childNodes; for (let i = c.length - 1; i >= 0; i--) { if (c[i].nodeType === 1) { return true; } } return false; } exports.isHTML = isHTML; // Generates a random alphanumeric string with N characters function generateRandomString(n) { let str = ""; const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; for (let i = 0; i < n; i++) { str += chars.charAt(Math.floor(Math.random() * chars.length)); } return str; } exports.generateRandomString = generateRandomString; /***/ }), /* 24 */ /*!**********************************!*\ !*** ./src/Settings/Settings.ts ***! \**********************************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Settings = void 0; const SettingEnums_1 = __webpack_require__(/*! ./SettingEnums */ 222); const defaultSettings = { AutosaveInterval: 60, CodeInstructionRunTime: 50, DisableASCIIArt: false, DisableHotkeys: false, DisableTextEffects: false, Locale: "en", MaxLogCapacity: 50, MaxPortCapacity: 50, SuppressBuyAugmentationConfirmation: false, SuppressFactionInvites: false, SuppressHospitalizationPopup: false, SuppressMessages: false, SuppressTravelConfirmation: false, SuppressBladeburnerPopup: false, }; /** * The current options the player has customized to their play style. */ // tslint:disable-next-line:variable-name exports.Settings = { AutosaveInterval: defaultSettings.AutosaveInterval, CodeInstructionRunTime: 25, DisableASCIIArt: defaultSettings.DisableASCIIArt, DisableHotkeys: defaultSettings.DisableHotkeys, DisableTextEffects: defaultSettings.DisableTextEffects, Locale: "en", MaxLogCapacity: defaultSettings.MaxLogCapacity, MaxPortCapacity: defaultSettings.MaxPortCapacity, OwnedAugmentationsOrder: SettingEnums_1.OwnedAugmentationsOrderSetting.AcquirementTime, PurchaseAugmentationsOrder: SettingEnums_1.PurchaseAugmentationsOrderSetting.Default, SuppressBuyAugmentationConfirmation: defaultSettings.SuppressBuyAugmentationConfirmation, SuppressFactionInvites: defaultSettings.SuppressFactionInvites, SuppressHospitalizationPopup: defaultSettings.SuppressHospitalizationPopup, SuppressMessages: defaultSettings.SuppressMessages, SuppressTravelConfirmation: defaultSettings.SuppressTravelConfirmation, SuppressBladeburnerPopup: defaultSettings.SuppressBladeburnerPopup, MonacoTheme: 'vs-dark', MonacoInsertSpaces: false, init() { Object.assign(exports.Settings, defaultSettings); }, load(saveString) { Object.assign(exports.Settings, JSON.parse(saveString)); }, }; /***/ }), /* 25 */ /*!****************************************!*\ !*** ./src/Hacknet/HacknetHelpers.jsx ***! \****************************************/ /*! exports provided: hasHacknetServers, purchaseHacknet, hasMaxNumberHacknetServers, getCostOfNextHacknetNode, getCostOfNextHacknetServer, getMaxNumberLevelUpgrades, getMaxNumberRamUpgrades, getMaxNumberCoreUpgrades, getMaxNumberCacheUpgrades, purchaseLevelUpgrade, purchaseRamUpgrade, purchaseCoreUpgrade, purchaseCacheUpgrade, renderHacknetNodesUI, clearHacknetNodesUI, processHacknetEarnings, updateHashManagerCapacity, purchaseHashUpgrade */ /*! exports used: clearHacknetNodesUI, getCostOfNextHacknetNode, getCostOfNextHacknetServer, getMaxNumberCacheUpgrades, getMaxNumberCoreUpgrades, getMaxNumberLevelUpgrades, getMaxNumberRamUpgrades, hasHacknetServers, hasMaxNumberHacknetServers, processHacknetEarnings, purchaseCacheUpgrade, purchaseCoreUpgrade, purchaseHacknet, purchaseHashUpgrade, purchaseLevelUpgrade, purchaseRamUpgrade, renderHacknetNodesUI, updateHashManagerCapacity */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return hasHacknetServers; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return purchaseHacknet; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return hasMaxNumberHacknetServers; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getCostOfNextHacknetNode; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return getCostOfNextHacknetServer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return getMaxNumberLevelUpgrades; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return getMaxNumberRamUpgrades; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return getMaxNumberCoreUpgrades; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return getMaxNumberCacheUpgrades; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return purchaseLevelUpgrade; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return purchaseRamUpgrade; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return purchaseCoreUpgrade; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return purchaseCacheUpgrade; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return renderHacknetNodesUI; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return clearHacknetNodesUI; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return processHacknetEarnings; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return updateHashManagerCapacity; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return purchaseHashUpgrade; }); /* harmony import */ var _HacknetNode__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./HacknetNode */ 535); /* harmony import */ var _HacknetNode__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_HacknetNode__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _formulas_HacknetNodes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./formulas/HacknetNodes */ 153); /* harmony import */ var _formulas_HacknetNodes__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_formulas_HacknetNodes__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _formulas_HacknetServers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./formulas/HacknetServers */ 139); /* harmony import */ var _formulas_HacknetServers__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_formulas_HacknetServers__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var _data_Constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./data/Constants */ 34); /* harmony import */ var _data_Constants__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_data_Constants__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var _HacknetServer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./HacknetServer */ 78); /* harmony import */ var _HacknetServer__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_HacknetServer__WEBPACK_IMPORTED_MODULE_4__); /* harmony import */ var _HashManager__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./HashManager */ 177); /* harmony import */ var _HashManager__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_HashManager__WEBPACK_IMPORTED_MODULE_5__); /* harmony import */ var _HashUpgrades__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./HashUpgrades */ 241); /* harmony import */ var _HashUpgrades__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_HashUpgrades__WEBPACK_IMPORTED_MODULE_6__); /* harmony import */ var _CodingContractGenerator__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../CodingContractGenerator */ 176); /* harmony import */ var _CodingContractGenerator__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_CodingContractGenerator__WEBPACK_IMPORTED_MODULE_7__); /* harmony import */ var _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../InteractiveTutorial */ 43); /* harmony import */ var _Player__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Player */ 2); /* harmony import */ var _Server_AllServers__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Server/AllServers */ 20); /* harmony import */ var _Server_AllServers__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_Server_AllServers__WEBPACK_IMPORTED_MODULE_10__); /* harmony import */ var _Server_ServerHelpers__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Server/ServerHelpers */ 22); /* harmony import */ var _Server_ServerHelpers__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(_Server_ServerHelpers__WEBPACK_IMPORTED_MODULE_11__); /* harmony import */ var _SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../SourceFile/SourceFileFlags */ 37); /* harmony import */ var _SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(_SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_12__); /* harmony import */ var _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../ui/navigationTracking */ 18); /* harmony import */ var _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_13__); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! react */ 0); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_14__); /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! react-dom */ 21); /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_15___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_15__); /* harmony import */ var _ui_Root__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./ui/Root */ 449); /** * Generic helper/utility functions for the Hacknet mechanic: * - Purchase nodes/upgrades * - Calculating maximum number of upgrades * - Processing Hacknet earnings * - Updating Hash Manager capacity * - Purchasing hash upgrades * * TODO Should probably split the different types of functions into their own modules */ let hacknetNodesDiv; function hacknetNodesInit() { hacknetNodesDiv = document.getElementById("hacknet-nodes-container"); document.removeEventListener("DOMContentLoaded", hacknetNodesInit); } document.addEventListener("DOMContentLoaded", hacknetNodesInit); // Returns a boolean indicating whether the player has Hacknet Servers // (the upgraded form of Hacknet Nodes) function hasHacknetServers() { return _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].bitNodeN === 9 || _SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_12__["SourceFileFlags"][9] > 0; } function purchaseHacknet() { /* INTERACTIVE TUTORIAL */ if (_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_8__["ITutorial"].isRunning) { if (_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_8__["ITutorial"].currStep === _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_8__["iTutorialSteps"].HacknetNodesIntroduction) { Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_8__["iTutorialNextStep"])(); } else { return; } } /* END INTERACTIVE TUTORIAL */ const numOwned = _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknetNodes.length; if (hasHacknetServers()) { const cost = getCostOfNextHacknetServer(); if (isNaN(cost)) { throw new Error(`Calculated cost of purchasing HacknetServer is NaN`); } if (!_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].canAfford(cost)) { return -1; } _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].loseMoney(cost); _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].createHacknetServer(); updateHashManagerCapacity(); return numOwned; } else { const cost = getCostOfNextHacknetNode(); if (isNaN(cost)) { throw new Error(`Calculated cost of purchasing HacknetNode is NaN`); } if (!_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].canAfford(cost)) { return -1; } // Auto generate a name for the Node const name = "hacknet-node-" + numOwned; const node = new _HacknetNode__WEBPACK_IMPORTED_MODULE_0__["HacknetNode"](name, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_money_mult); _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].loseMoney(cost); _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknetNodes.push(node); return numOwned; } } function hasMaxNumberHacknetServers() { return hasHacknetServers() && _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknetNodes.length >= _data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetServerConstants"].MaxServers; } function getCostOfNextHacknetNode() { return Object(_formulas_HacknetNodes__WEBPACK_IMPORTED_MODULE_1__["calculateNodeCost"])(_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknetNodes.length + 1, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_purchase_cost_mult); } function getCostOfNextHacknetServer() { return Object(_formulas_HacknetServers__WEBPACK_IMPORTED_MODULE_2__["calculateServerCost"])(_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknetNodes.length + 1, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_purchase_cost_mult); } // Calculate the maximum number of times the Player can afford to upgrade a Hacknet Node's level function getMaxNumberLevelUpgrades(nodeObj, maxLevel) { if (maxLevel == null) { throw new Error(`getMaxNumberLevelUpgrades() called without maxLevel arg`); } if (_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].money.lt(nodeObj.calculateLevelUpgradeCost(1, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_level_cost_mult))) { return 0; } let min = 1; let max = maxLevel - 1; let levelsToMax = maxLevel - nodeObj.level; if (_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].money.gt(nodeObj.calculateLevelUpgradeCost(levelsToMax, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_level_cost_mult))) { return levelsToMax; } while (min <= max) { var curr = (min + max) / 2 | 0; if (curr !== maxLevel && _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].money.gt(nodeObj.calculateLevelUpgradeCost(curr, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_level_cost_mult)) && _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].money.lt(nodeObj.calculateLevelUpgradeCost(curr + 1, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_level_cost_mult))) { return Math.min(levelsToMax, curr); } else if (_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].money.lt(nodeObj.calculateLevelUpgradeCost(curr, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_level_cost_mult))) { max = curr - 1; } else if (_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].money.gt(nodeObj.calculateLevelUpgradeCost(curr, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_level_cost_mult))) { min = curr + 1; } else { return Math.min(levelsToMax, curr); } } return 0; } // Calculate the maximum number of times the Player can afford to upgrade a Hacknet Node's RAM function getMaxNumberRamUpgrades(nodeObj, maxLevel) { if (maxLevel == null) { throw new Error(`getMaxNumberRamUpgrades() called without maxLevel arg`); } if (_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].money.lt(nodeObj.calculateRamUpgradeCost(1, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_ram_cost_mult))) { return 0; } let levelsToMax; if (nodeObj instanceof _HacknetServer__WEBPACK_IMPORTED_MODULE_4__["HacknetServer"]) { levelsToMax = Math.round(Math.log2(maxLevel / nodeObj.maxRam)); } else { levelsToMax = Math.round(Math.log2(maxLevel / nodeObj.ram)); } if (_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].money.gt(nodeObj.calculateRamUpgradeCost(levelsToMax, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_ram_cost_mult))) { return levelsToMax; } //We'll just loop until we find the max for (let i = levelsToMax - 1; i >= 0; --i) { if (_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].money.gt(nodeObj.calculateRamUpgradeCost(i, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_ram_cost_mult))) { return i; } } return 0; } // Calculate the maximum number of times the Player can afford to upgrade a Hacknet Node's cores function getMaxNumberCoreUpgrades(nodeObj, maxLevel) { if (maxLevel == null) { throw new Error(`getMaxNumberCoreUpgrades() called without maxLevel arg`); } if (_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].money.lt(nodeObj.calculateCoreUpgradeCost(1, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_core_cost_mult))) { return 0; } let min = 1; let max = maxLevel - 1; const levelsToMax = maxLevel - nodeObj.cores; if (_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].money.gt(nodeObj.calculateCoreUpgradeCost(levelsToMax, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_core_cost_mult))) { return levelsToMax; } // Use a binary search to find the max possible number of upgrades while (min <= max) { let curr = (min + max) / 2 | 0; if (curr != maxLevel && _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].money.gt(nodeObj.calculateCoreUpgradeCost(curr, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_core_cost_mult)) && _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].money.lt(nodeObj.calculateCoreUpgradeCost(curr + 1, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_core_cost_mult))) { return Math.min(levelsToMax, curr); } else if (_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].money.lt(nodeObj.calculateCoreUpgradeCost(curr, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_core_cost_mult))) { max = curr - 1; } else if (_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].money.gt(nodeObj.calculateCoreUpgradeCost(curr, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_core_cost_mult))) { min = curr + 1; } else { return Math.min(levelsToMax, curr); } } return 0; } // Calculate the maximum number of times the Player can afford to upgrade a Hacknet Node's cache function getMaxNumberCacheUpgrades(nodeObj, maxLevel) { if (maxLevel == null) { throw new Error(`getMaxNumberCacheUpgrades() called without maxLevel arg`); } if (!_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].canAfford(nodeObj.calculateCacheUpgradeCost(1))) { return 0; } let min = 1; let max = maxLevel - 1; const levelsToMax = maxLevel - nodeObj.cache; if (_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].canAfford(nodeObj.calculateCacheUpgradeCost(levelsToMax))) { return levelsToMax; } // Use a binary search to find the max possible number of upgrades while (min <= max) { let curr = (min + max) / 2 | 0; if (curr != maxLevel && _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].canAfford(nodeObj.calculateCacheUpgradeCost(curr)) && !_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].canAfford(nodeObj.calculateCacheUpgradeCost(curr + 1))) { return Math.min(levelsToMax, curr); } else if (!_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].canAfford(nodeObj.calculateCacheUpgradeCost(curr))) { max = curr - 1; } else if (_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].canAfford(nodeObj.calculateCacheUpgradeCost(curr))) { min = curr + 1; } else { return Math.min(levelsToMax, curr); } } return 0; } function purchaseLevelUpgrade(node, levels = 1) { const sanitizedLevels = Math.round(levels); const cost = node.calculateLevelUpgradeCost(sanitizedLevels, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_level_cost_mult); if (isNaN(cost) || cost <= 0 || sanitizedLevels < 0) { return false; } const isServer = node instanceof _HacknetServer__WEBPACK_IMPORTED_MODULE_4__["HacknetServer"]; // If we're at max level, return false if (node.level >= (isServer ? _data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetServerConstants"].MaxLevel : _data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetNodeConstants"].MaxLevel)) { return false; } // If the number of specified upgrades would exceed the max level, calculate // the maximum number of upgrades and use that if (node.level + sanitizedLevels > (isServer ? _data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetServerConstants"].MaxLevel : _data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetNodeConstants"].MaxLevel)) { const diff = Math.max(0, (isServer ? _data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetServerConstants"].MaxLevel : _data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetNodeConstants"].MaxLevel) - node.level); return purchaseLevelUpgrade(node, diff); } if (!_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].canAfford(cost)) { return false; } _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].loseMoney(cost); node.upgradeLevel(sanitizedLevels, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_money_mult); return true; } function purchaseRamUpgrade(node, levels = 1) { const sanitizedLevels = Math.round(levels); const cost = node.calculateRamUpgradeCost(sanitizedLevels, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_ram_cost_mult); if (isNaN(cost) || cost <= 0 || sanitizedLevels < 0) { return false; } const isServer = node instanceof _HacknetServer__WEBPACK_IMPORTED_MODULE_4__["HacknetServer"]; // Fail if we're already at max if (node.ram >= (isServer ? _data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetServerConstants"].MaxRam : _data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetNodeConstants"].MaxRam)) { return false; } // If the number of specified upgrades would exceed the max RAM, calculate the // max possible number of upgrades and use that if (isServer) { if (node.maxRam * Math.pow(2, sanitizedLevels) > _data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetServerConstants"].MaxRam) { const diff = Math.max(0, Math.log2(Math.round(_data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetServerConstants"].MaxRam / node.maxRam))); return purchaseRamUpgrade(node, diff); } } else { if (node.ram * Math.pow(2, sanitizedLevels) > _data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetNodeConstants"].MaxRam) { const diff = Math.max(0, Math.log2(Math.round(_data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetNodeConstants"].MaxRam / node.ram))); return purchaseRamUpgrade(node, diff); } } if (!_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].canAfford(cost)) { return false; } _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].loseMoney(cost); node.upgradeRam(sanitizedLevels, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_money_mult); return true; } function purchaseCoreUpgrade(node, levels = 1) { const sanitizedLevels = Math.round(levels); const cost = node.calculateCoreUpgradeCost(sanitizedLevels, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_core_cost_mult); if (isNaN(cost) || cost <= 0 || sanitizedLevels < 0) { return false; } const isServer = node instanceof _HacknetServer__WEBPACK_IMPORTED_MODULE_4__["HacknetServer"]; // Fail if we're already at max if (node.cores >= (isServer ? _data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetServerConstants"].MaxCores : _data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetNodeConstants"].MaxCores)) { return false; } // If the specified number of upgrades would exceed the max Cores, calculate // the max possible number of upgrades and use that if (node.cores + sanitizedLevels > (isServer ? _data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetServerConstants"].MaxCores : _data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetNodeConstants"].MaxCores)) { const diff = Math.max(0, (isServer ? _data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetServerConstants"].MaxCores : _data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetNodeConstants"].MaxCores) - node.cores); return purchaseCoreUpgrade(node, diff); } if (!_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].canAfford(cost)) { return false; } _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].loseMoney(cost); node.upgradeCore(sanitizedLevels, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_money_mult); return true; } function purchaseCacheUpgrade(node, levels = 1) { const sanitizedLevels = Math.round(levels); const cost = node.calculateCacheUpgradeCost(sanitizedLevels); if (isNaN(cost) || cost <= 0 || sanitizedLevels < 0) { return false; } if (!(node instanceof _HacknetServer__WEBPACK_IMPORTED_MODULE_4__["HacknetServer"])) { console.warn(`purchaseCacheUpgrade() called for a non-HacknetNode`); return false; } // Fail if we're already at max if (node.cache + sanitizedLevels > _data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetServerConstants"].MaxCache) { const diff = Math.max(0, _data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetServerConstants"].MaxCache - node.cache); return purchaseCacheUpgrade(node, diff); } if (!_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].canAfford(cost)) { return false; } _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].loseMoney(cost); node.upgradeCache(sanitizedLevels); return true; } // Create/Refresh Hacknet Nodes UI function renderHacknetNodesUI() { if (!_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_13__["routing"].isOn(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_13__["Page"].HacknetNodes)) { return; } react_dom__WEBPACK_IMPORTED_MODULE_15___default.a.render(react__WEBPACK_IMPORTED_MODULE_14___default.a.createElement(_ui_Root__WEBPACK_IMPORTED_MODULE_16__[/* HacknetRoot */ "a"], null), hacknetNodesDiv); } function clearHacknetNodesUI() { if (hacknetNodesDiv instanceof HTMLElement) { react_dom__WEBPACK_IMPORTED_MODULE_15___default.a.unmountComponentAtNode(hacknetNodesDiv); } hacknetNodesDiv.style.display = "none"; } function processHacknetEarnings(numCycles) { // Determine if player has Hacknet Nodes or Hacknet Servers, then // call the appropriate function if (_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknetNodes.length === 0) { return 0; } if (hasHacknetServers()) { return processAllHacknetServerEarnings(numCycles); } else if (_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknetNodes[0] instanceof _HacknetNode__WEBPACK_IMPORTED_MODULE_0__["HacknetNode"]) { return processAllHacknetNodeEarnings(numCycles); } else { return 0; } } function processAllHacknetNodeEarnings(numCycles) { let total = 0; for (let i = 0; i < _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknetNodes.length; ++i) { total += processSingleHacknetNodeEarnings(numCycles, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknetNodes[i]); } return total; } function processSingleHacknetNodeEarnings(numCycles, nodeObj) { const totalEarnings = nodeObj.process(numCycles); _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].gainMoney(totalEarnings); _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].recordMoneySource(totalEarnings, "hacknetnode"); return totalEarnings; } function processAllHacknetServerEarnings(numCycles) { if (!(_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hashManager instanceof _HashManager__WEBPACK_IMPORTED_MODULE_5__["HashManager"])) { throw new Error(`Player does not have a HashManager (should be in 'hashManager' prop)`); } let hashes = 0; for (let i = 0; i < _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknetNodes.length; ++i) { // hacknetNodes array only contains the IP addresses of the servers. // Also, update the hash rate before processing const hserver = _Server_AllServers__WEBPACK_IMPORTED_MODULE_10__["AllServers"][_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknetNodes[i]]; hserver.updateHashRate(_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_money_mult); const h = hserver.process(numCycles); hserver.totalHashesGenerated += h; hashes += h; } _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hashManager.storeHashes(hashes); return hashes; } function updateHashManagerCapacity() { if (!(_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hashManager instanceof _HashManager__WEBPACK_IMPORTED_MODULE_5__["HashManager"])) { console.error(`Player does not have a HashManager`); return; } const nodes = _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknetNodes; if (nodes.length === 0) { _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hashManager.updateCapacity(0); return; } let total = 0; for (let i = 0; i < nodes.length; ++i) { if (typeof nodes[i] !== "string") { _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hashManager.updateCapacity(0); return; } const h = _Server_AllServers__WEBPACK_IMPORTED_MODULE_10__["AllServers"][nodes[i]]; if (!(h instanceof _HacknetServer__WEBPACK_IMPORTED_MODULE_4__["HacknetServer"])) { _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hashManager.updateCapacity(0); return; } total += h.hashCapacity; } _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hashManager.updateCapacity(total); } function purchaseHashUpgrade(upgName, upgTarget) { if (!(_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hashManager instanceof _HashManager__WEBPACK_IMPORTED_MODULE_5__["HashManager"])) { console.error(`Player does not have a HashManager`); return false; } // HashManager handles the transaction. This just needs to actually implement // the effects of the upgrade if (_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hashManager.upgrade(upgName)) { const upg = _HashUpgrades__WEBPACK_IMPORTED_MODULE_6__["HashUpgrades"][upgName]; switch (upgName) { case "Sell for Money": { _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].gainMoney(upg.value); _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].recordMoneySource(upg.value, "hacknetnode"); break; } case "Sell for Corporation Funds": { // This will throw if player doesn't have a corporation try { _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].corporation.funds = _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].corporation.funds.plus(upg.value); } catch (e) { _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hashManager.refundUpgrade(upgName); return false; } break; } case "Reduce Minimum Security": { try { const target = Object(_Server_ServerHelpers__WEBPACK_IMPORTED_MODULE_11__["GetServerByHostname"])(upgTarget); if (target == null) { console.error(`Invalid target specified in purchaseHashUpgrade(): ${upgTarget}`); return false; } target.changeMinimumSecurity(upg.value, true); } catch (e) { _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hashManager.refundUpgrade(upgName); return false; } break; } case "Increase Maximum Money": { try { const target = Object(_Server_ServerHelpers__WEBPACK_IMPORTED_MODULE_11__["GetServerByHostname"])(upgTarget); if (target == null) { console.error(`Invalid target specified in purchaseHashUpgrade(): ${upgTarget}`); return false; } target.changeMaximumMoney(upg.value, true); } catch (e) { _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hashManager.refundUpgrade(upgName); return false; } break; } case "Improve Studying": { // Multiplier handled by HashManager break; } case "Improve Gym Training": { // Multiplier handled by HashManager break; } case "Exchange for Corporation Research": { // This will throw if player doesn't have a corporation try { for (const division of _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].corporation.divisions) { division.sciResearch.qty += upg.value; } } catch (e) { _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hashManager.refundUpgrade(upgName); return false; } break; } case "Exchange for Bladeburner Rank": { // This will throw if player isnt in Bladeburner try { _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].bladeburner.changeRank(_Player__WEBPACK_IMPORTED_MODULE_9__["Player"], upg.value); } catch (e) { _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hashManager.refundUpgrade(upgName); return false; } break; } case "Exchange for Bladeburner SP": { // This will throw if player isn't in Bladeburner try { // As long as we don't change `Bladeburner.totalSkillPoints`, this // shouldn't affect anything else _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].bladeburner.skillPoints += upg.value; } catch (e) { _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hashManager.refundUpgrade(upgName); return false; } break; } case "Generate Coding Contract": { Object(_CodingContractGenerator__WEBPACK_IMPORTED_MODULE_7__["generateRandomContract"])(); break; } default: console.warn(`Unrecognized upgrade name ${upgName}. Upgrade has no effect`); _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hashManager.refundUpgrade(upgName); return false; } return true; } return false; } /***/ }), /* 26 */, /* 27 */ /*!********************************!*\ !*** ./src/ui/React/Money.tsx ***! \********************************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Money = void 0; const React = __importStar(__webpack_require__(/*! react */ 0)); const numeralFormat_1 = __webpack_require__(/*! ../../ui/numeralFormat */ 7); function Money(money) { return React.createElement("span", { className: "money-gold samefont" }, typeof money === 'number' ? numeralFormat_1.numeralWrapper.formatMoney(money) : money); } exports.Money = Money; /***/ }), /* 28 */, /* 29 */ /*!******************************!*\ !*** ./utils/JSONReviver.js ***! \******************************/ /*! exports provided: Reviver, Generic_toJSON, Generic_fromJSON */ /*! all exports used */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Reviver", function() { return Reviver; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Generic_toJSON", function() { return Generic_toJSON; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Generic_fromJSON", function() { return Generic_fromJSON; }); /* Generic Reviver, toJSON, and fromJSON functions used for saving and loading objects */ // A generic "smart reviver" function. // Looks for object values with a `ctor` property and // a `data` property. If it finds them, and finds a matching // constructor that has a `fromJSON` property on it, it hands // off to that `fromJSON` fuunction, passing in the value. function Reviver(key, value) { var ctor; if (value == null) { console.log("Reviver WRONGLY called with key: " + key + ", and value: " + value); return 0; } if (typeof value === "object" && typeof value.ctor === "string" && typeof value.data !== "undefined") { // Compatibility for version v0.43.1 // TODO Remove this eventually if (value.ctor === "AllServersMap") { console.log('Converting AllServersMap for v0.43.1'); return value.data; } ctor = Reviver.constructors[value.ctor] || window[value.ctor]; if (typeof ctor === "function" && typeof ctor.fromJSON === "function") { return ctor.fromJSON(value); } } return value; } Reviver.constructors = {}; // A list of constructors the smart reviver should know about // A generic "toJSON" function that creates the data expected // by Reviver. // `ctorName` The name of the constructor to use to revive it // `obj` The object being serialized // `keys` (Optional) Array of the properties to serialize, // if not given then all of the objects "own" properties // that don't have function values will be serialized. // (Note: If you list a property in `keys`, it will be serialized // regardless of whether it's an "own" property.) // Returns: The structure (which will then be turned into a string // as part of the JSON.stringify algorithm) function Generic_toJSON(ctorName, obj, keys) { var data, key; if (!keys) { keys = Object.keys(obj); // Only "own" properties are included } data = {}; for (let index = 0; index < keys.length; ++index) { key = keys[index]; data[key] = obj[key]; } return {ctor: ctorName, data: data}; } // A generic "fromJSON" function for use with Reviver: Just calls the // constructor function with no arguments, then applies all of the // key/value pairs from the raw data to the instance. Only useful for // constructors that can be reasonably called without arguments! // `ctor` The constructor to call // `data` The data to apply // Returns: The object function Generic_fromJSON(ctor, data) { var obj, name; obj = new ctor(); for (name in data) { obj[name] = data[name]; } return obj; } /***/ }), /* 30 */ /*!**********************************!*\ !*** ./src/Programs/Programs.ts ***! \**********************************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Programs = void 0; const Program_1 = __webpack_require__(/*! ./Program */ 1082); const ProgramsMetadata_1 = __webpack_require__(/*! ./data/ProgramsMetadata */ 1081); exports.Programs = {}; for (const params of ProgramsMetadata_1.programsMetadata) { exports.Programs[params.key] = new Program_1.Program(params.name, params.create); } /***/ }), /* 31 */ /*!**********************************!*\ !*** ./src/ui/MainMenu/Links.ts ***! \**********************************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.initializeMainMenuLinks = exports.MainMenuLinks = void 0; // Get references to the Main Menu link DOM elements // Does NOT include collapsible headers for the links const clearEventListeners_1 = __webpack_require__(/*! ../../../utils/uiHelpers/clearEventListeners */ 49); const emptyElement = (() => { const elem = document.createElement('div'); if (elem === null) throw new Error("unable to create empty div element"); return elem; })(); exports.MainMenuLinks = { Terminal: emptyElement, ScriptEditor: emptyElement, ActiveScripts: emptyElement, CreateProgram: emptyElement, Stats: emptyElement, Factions: emptyElement, Augmentations: emptyElement, HacknetNodes: emptyElement, Sleeves: emptyElement, City: emptyElement, Travel: emptyElement, Job: emptyElement, StockMarket: emptyElement, Bladeburner: emptyElement, Corporation: emptyElement, Gang: emptyElement, Milestones: emptyElement, Tutorial: emptyElement, Options: emptyElement, DevMenu: emptyElement, }; function initializeMainMenuLinks() { try { function safeGetLink(id) { const elem = clearEventListeners_1.clearEventListeners(id); if (elem == null) { throw new Error(`clearEventListeners() failed for element with id: ${id}`); } return elem; } exports.MainMenuLinks.Terminal = safeGetLink("terminal-menu-link"); exports.MainMenuLinks.ScriptEditor = safeGetLink("create-script-menu-link"); exports.MainMenuLinks.ActiveScripts = safeGetLink("active-scripts-menu-link"); exports.MainMenuLinks.CreateProgram = safeGetLink("create-program-menu-link"); exports.MainMenuLinks.Stats = safeGetLink("stats-menu-link"); exports.MainMenuLinks.Factions = safeGetLink("factions-menu-link"); exports.MainMenuLinks.Augmentations = safeGetLink("augmentations-menu-link"); exports.MainMenuLinks.HacknetNodes = safeGetLink("hacknet-nodes-menu-link"); exports.MainMenuLinks.Sleeves = safeGetLink("sleeves-menu-link"); exports.MainMenuLinks.City = safeGetLink("city-menu-link"); exports.MainMenuLinks.Travel = safeGetLink("travel-menu-link"); exports.MainMenuLinks.Job = safeGetLink("job-menu-link"); exports.MainMenuLinks.StockMarket = safeGetLink("stock-market-menu-link"); exports.MainMenuLinks.Bladeburner = safeGetLink("bladeburner-menu-link"); exports.MainMenuLinks.Corporation = safeGetLink("corporation-menu-link"); exports.MainMenuLinks.Gang = safeGetLink("gang-menu-link"); exports.MainMenuLinks.Milestones = safeGetLink("milestones-menu-link"); exports.MainMenuLinks.Tutorial = safeGetLink("tutorial-menu-link"); const op = document.getElementById("options-menu-link"); if (op === null) throw new Error(`Could not find element with id: "options-menu-link"`); exports.MainMenuLinks.Options = op; // This click listener is already set, so don't clear it exports.MainMenuLinks.DevMenu = safeGetLink("dev-menu-link"); return true; } catch (e) { console.error(`Failed to initialize Main Menu Links: ${e}`); return false; } } exports.initializeMainMenuLinks = initializeMainMenuLinks; /***/ }), /* 32 */, /* 33 */ /*!**********************************!*\ !*** ./src/Company/Companies.ts ***! \**********************************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.companyExists = exports.loadCompanies = exports.initCompanies = exports.Companies = void 0; // Constructs all CompanyPosition objects using the metadata in data/companypositions.ts const CompaniesMetadata_1 = __webpack_require__(/*! ./data/CompaniesMetadata */ 1083); const Company_1 = __webpack_require__(/*! ./Company */ 138); const JSONReviver_1 = __webpack_require__(/*! ../../utils/JSONReviver */ 29); exports.Companies = {}; function addCompany(params) { if (exports.Companies[params.name] != null) { console.warn(`Duplicate Company Position being defined: ${params.name}`); } exports.Companies[params.name] = new Company_1.Company(params); } // Used to initialize new Company objects for the Companies map // Called when creating new game or after a prestige/reset function initCompanies() { // Save Old Company data for 'favor' const oldCompanies = exports.Companies; // Re-construct all Companies exports.Companies = {}; CompaniesMetadata_1.companiesMetadata.forEach((e) => { addCompany(e); }); // Reset data for (const companyName in exports.Companies) { const company = exports.Companies[companyName]; const oldCompany = oldCompanies[companyName]; if (!(oldCompany instanceof Company_1.Company)) { // New game, so no OldCompanies data company.favor = 0; } else { company.favor = oldCompanies[companyName].favor; if (isNaN(company.favor)) { company.favor = 0; } } } } exports.initCompanies = initCompanies; // Used to load Companies map from a save function loadCompanies(saveString) { exports.Companies = JSON.parse(saveString, JSONReviver_1.Reviver); } exports.loadCompanies = loadCompanies; // Utility function to check if a string is valid company name function companyExists(name) { return exports.Companies.hasOwnProperty(name); } exports.companyExists = companyExists; /***/ }), /* 34 */ /*!***************************************!*\ !*** ./src/Hacknet/data/Constants.ts ***! \***************************************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.HacknetServerConstants = exports.HacknetNodeConstants = void 0; exports.HacknetNodeConstants = { MoneyGainPerLevel: 1.6, BaseCost: 1000, LevelBaseCost: 1, RamBaseCost: 30e3, CoreBaseCost: 500e3, PurchaseNextMult: 1.85, UpgradeLevelMult: 1.04, UpgradeRamMult: 1.28, UpgradeCoreMult: 1.48, MaxLevel: 200, MaxRam: 64, MaxCores: 16, }; exports.HacknetServerConstants = { HashesPerLevel: 0.001, BaseCost: 50e3, RamBaseCost: 200e3, CoreBaseCost: 1e6, CacheBaseCost: 10e6, PurchaseMult: 3.20, UpgradeLevelMult: 1.10, UpgradeRamMult: 1.40, UpgradeCoreMult: 1.55, UpgradeCacheMult: 1.85, MaxServers: 20, MaxLevel: 300, MaxRam: 8192, MaxCores: 128, MaxCache: 15, }; /***/ }), /* 35 */, /* 36 */, /* 37 */ /*!*******************************************!*\ !*** ./src/SourceFile/SourceFileFlags.ts ***! \*******************************************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // Contains an array containing information about the player's source files // Array[n] returns what level the player has of Source-File N. Object.defineProperty(exports, "__esModule", { value: true }); exports.updateSourceFileFlags = exports.SourceFileFlags = void 0; const Constants_1 = __webpack_require__(/*! ../Constants */ 11); exports.SourceFileFlags = Array(Constants_1.CONSTANTS.TotalNumBitNodes + 1); // Skip index 0 function updateSourceFileFlags(p) { for (let i = 0; i < exports.SourceFileFlags.length; ++i) { exports.SourceFileFlags[i] = 0; } for (let i = 0; i < p.sourceFiles.length; ++i) { const sf = p.sourceFiles[i]; exports.SourceFileFlags[sf.n] = sf.lvl; } } exports.updateSourceFileFlags = updateSourceFileFlags; /***/ }), /* 38 */ /*!****************************************!*\ !*** ./src/Server/SpecialServerIps.ts ***! \****************************************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.initSpecialServerIps = exports.loadSpecialServerIps = exports.prestigeSpecialServerIps = exports.SpecialServerIps = exports.SpecialServerIpsMap = exports.SpecialServerNames = void 0; const JSONReviver_1 = __webpack_require__(/*! ../../utils/JSONReviver */ 29); /* Holds IP of Special Servers */ exports.SpecialServerNames = { FulcrumSecretTechnologies: "Fulcrum Secret Technologies Server", CyberSecServer: "CyberSec Server", NiteSecServer: "NiteSec Server", TheBlackHandServer: "The Black Hand Server", BitRunnersServer: "BitRunners Server", TheDarkArmyServer: "The Dark Army Server", DaedalusServer: "Daedalus Server", WorldDaemon: "w0r1d_d43m0n", }; class SpecialServerIpsMap { addIp(name, ip) { this[name] = ip; } getIp(name) { return this[name]; } // Serialize the current object to a JSON save state toJSON() { return JSONReviver_1.Generic_toJSON("SpecialServerIpsMap", this); } // Initializes a SpecialServerIpsMap Object from a JSON save state // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types static fromJSON(value) { return JSONReviver_1.Generic_fromJSON(SpecialServerIpsMap, value.data); } } exports.SpecialServerIpsMap = SpecialServerIpsMap; JSONReviver_1.Reviver.constructors.SpecialServerIpsMap = SpecialServerIpsMap; exports.SpecialServerIps = new SpecialServerIpsMap(); function prestigeSpecialServerIps() { for (const member in exports.SpecialServerIps) { delete exports.SpecialServerIps[member]; } exports.SpecialServerIps = new SpecialServerIpsMap(); } exports.prestigeSpecialServerIps = prestigeSpecialServerIps; function loadSpecialServerIps(saveString) { exports.SpecialServerIps = JSON.parse(saveString, JSONReviver_1.Reviver); } exports.loadSpecialServerIps = loadSpecialServerIps; function initSpecialServerIps() { exports.SpecialServerIps = new SpecialServerIpsMap(); } exports.initSpecialServerIps = initSpecialServerIps; /***/ }), /* 39 */ /*!************************************!*\ !*** ./src/Fconf/FconfSettings.ts ***! \************************************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FconfSettings = void 0; exports.FconfSettings = { ENABLE_BASH_HOTKEYS: false, ENABLE_TIMESTAMPS: false, MAIN_MENU_STYLE: "default", THEME_BACKGROUND_COLOR: "#000000", THEME_FONT_COLOR: "#66ff33", THEME_HIGHLIGHT_COLOR: "#ffffff", THEME_PROMPT_COLOR: "#f92672", WRAP_INPUT: false, }; /***/ }), /* 40 */ /*!*********************************************!*\ !*** ./src/Locations/data/LocationNames.ts ***! \*********************************************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.LocationName = void 0; /** * Names of all locations */ var LocationName; (function (LocationName) { // Cities LocationName["Aevum"] = "Aevum"; LocationName["Chongqing"] = "Chongqing"; LocationName["Ishima"] = "Ishima"; LocationName["NewTokyo"] = "New Tokyo"; LocationName["Sector12"] = "Sector-12"; LocationName["Volhaven"] = "Volhaven"; // Aevum Locations LocationName["AevumAeroCorp"] = "AeroCorp"; LocationName["AevumBachmanAndAssociates"] = "Bachman & Associates"; LocationName["AevumClarkeIncorporated"] = "Clarke Incorporated"; LocationName["AevumCrushFitnessGym"] = "Crush Fitness Gym"; LocationName["AevumECorp"] = "ECorp"; LocationName["AevumFulcrumTechnologies"] = "Fulcrum Technologies"; LocationName["AevumGalacticCybersystems"] = "Galactic Cybersystems"; LocationName["AevumNetLinkTechnologies"] = "NetLink Technologies"; LocationName["AevumPolice"] = "Aevum Police Headquarters"; LocationName["AevumRhoConstruction"] = "Rho Construction"; LocationName["AevumSnapFitnessGym"] = "Snap Fitness Gym"; LocationName["AevumSummitUniversity"] = "Summit University"; LocationName["AevumWatchdogSecurity"] = "Watchdog Security"; LocationName["AevumCasino"] = "Iker Molina Casino"; // Chongqing locations LocationName["ChongqingKuaiGongInternational"] = "KuaiGong International"; LocationName["ChongqingSolarisSpaceSystems"] = "Solaris Space Systems"; // Sector 12 LocationName["Sector12AlphaEnterprises"] = "Alpha Enterprises"; LocationName["Sector12BladeIndustries"] = "Blade Industries"; LocationName["Sector12CIA"] = "Central Intelligence Agency"; LocationName["Sector12CarmichaelSecurity"] = "Carmichael Security"; LocationName["Sector12CityHall"] = "Sector-12 City Hall"; LocationName["Sector12DeltaOne"] = "DeltaOne"; LocationName["Sector12FoodNStuff"] = "FoodNStuff"; LocationName["Sector12FourSigma"] = "Four Sigma"; LocationName["Sector12IcarusMicrosystems"] = "Icarus Microsystems"; LocationName["Sector12IronGym"] = "Iron Gym"; LocationName["Sector12JoesGuns"] = "Joe's Guns"; LocationName["Sector12MegaCorp"] = "MegaCorp"; LocationName["Sector12NSA"] = "National Security Agency"; LocationName["Sector12PowerhouseGym"] = "Powerhouse Gym"; LocationName["Sector12RothmanUniversity"] = "Rothman University"; LocationName["Sector12UniversalEnergy"] = "Universal Energy"; // New Tokyo LocationName["NewTokyoDefComm"] = "DefComm"; LocationName["NewTokyoGlobalPharmaceuticals"] = "Global Pharmaceuticals"; LocationName["NewTokyoNoodleBar"] = "Noodle Bar"; LocationName["NewTokyoVitaLife"] = "VitaLife"; // Ishima LocationName["IshimaNovaMedical"] = "Nova Medical"; LocationName["IshimaOmegaSoftware"] = "Omega Software"; LocationName["IshimaStormTechnologies"] = "Storm Technologies"; // Volhaven LocationName["VolhavenCompuTek"] = "CompuTek"; LocationName["VolhavenHeliosLabs"] = "Helios Labs"; LocationName["VolhavenLexoCorp"] = "LexoCorp"; LocationName["VolhavenMilleniumFitnessGym"] = "Millenium Fitness Gym"; LocationName["VolhavenNWO"] = "NWO"; LocationName["VolhavenOmniTekIncorporated"] = "OmniTek Incorporated"; LocationName["VolhavenOmniaCybersystems"] = "Omnia Cybersystems"; LocationName["VolhavenSysCoreSecurities"] = "SysCore Securities"; LocationName["VolhavenZBInstituteOfTechnology"] = "ZB Institute of Technology"; // Generic locations LocationName["Hospital"] = "Hospital"; LocationName["Slums"] = "The Slums"; LocationName["TravelAgency"] = "Travel Agency"; LocationName["WorldStockExchange"] = "World Stock Exchange"; // Default name for Location objects LocationName["Void"] = "The Void"; })(LocationName = exports.LocationName || (exports.LocationName = {})); /***/ }), /* 41 */ /*!**************************************!*\ !*** ./src/ui/React/createPopup.tsx ***! \**************************************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.removePopup = exports.createPopup = void 0; /** * Create a pop-up dialog box using React. * * Calling this function with the same ID and React Root Component will trigger a re-render * * @param id The (hopefully) unique identifier for the popup container * @param rootComponent Root React Component for the content (NOT the popup containers themselves) */ const React = __importStar(__webpack_require__(/*! react */ 0)); const ReactDOM = __importStar(__webpack_require__(/*! react-dom */ 21)); const Popup_1 = __webpack_require__(/*! ./Popup */ 1136); const createElement_1 = __webpack_require__(/*! ../../../utils/uiHelpers/createElement */ 51); const removeElementById_1 = __webpack_require__(/*! ../../../utils/uiHelpers/removeElementById */ 90); let gameContainer; (function () { function getGameContainer() { const container = document.getElementById("entire-game-container"); if (container == null) { throw new Error(`Failed to find game container DOM element`); } gameContainer = container; document.removeEventListener("DOMContentLoaded", getGameContainer); } document.addEventListener("DOMContentLoaded", getGameContainer); })(); // This variable is used to avoid setting the semi-transparent background // several times on top of one another. Sometimes there's several popup at once. let deepestPopupId = ""; // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types function createPopup(id, rootComponent, props) { let container = document.getElementById(id); if (container == null) { function onClick(event) { if (!event.srcElement) return; if (!(event.srcElement instanceof HTMLElement)) return; const clickedId = event.srcElement.id; if (clickedId !== id) return; removePopup(id); } const backgroundColor = deepestPopupId === "" ? 'rgba(0,0,0,0.5)' : 'rgba(0,0,0,0)'; container = createElement_1.createElement("div", { class: "popup-box-container", display: "flex", id: id, backgroundColor: backgroundColor, clickListener: onClick, }); gameContainer.appendChild(container); } if (deepestPopupId === "") deepestPopupId = id; ReactDOM.render(React.createElement(Popup_1.Popup, { content: rootComponent, id: id, props: props, removePopup: removePopup }), container); return container; } exports.createPopup = createPopup; /** * Closes a popup created with the createPopup() function above */ function removePopup(id) { const content = document.getElementById(`${id}`); if (content == null) return; ReactDOM.unmountComponentAtNode(content); removeElementById_1.removeElementById(id); removeElementById_1.removeElementById(`${id}-close`); if (id === deepestPopupId) deepestPopupId = ""; } exports.removePopup = removePopup; /***/ }), /* 42 */ /*!*****************************************!*\ !*** ./src/Locations/data/CityNames.ts ***! \*****************************************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CityName = void 0; /** * All possible Cities in the game. Names only, not actual "City" object * Implemented as an enum for typing purposes */ var CityName; (function (CityName) { CityName["Aevum"] = "Aevum"; CityName["Chongqing"] = "Chongqing"; CityName["Ishima"] = "Ishima"; CityName["NewTokyo"] = "New Tokyo"; CityName["Sector12"] = "Sector-12"; CityName["Volhaven"] = "Volhaven"; })(CityName = exports.CityName || (exports.CityName = {})); /***/ }), /* 43 */ /*!************************************!*\ !*** ./src/InteractiveTutorial.js ***! \************************************/ /*! exports provided: iTutorialSteps, iTutorialEnd, iTutorialStart, iTutorialNextStep, ITutorial */ /*! all exports used */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "iTutorialSteps", function() { return iTutorialSteps; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "iTutorialEnd", function() { return iTutorialEnd; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "iTutorialStart", function() { return iTutorialStart; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "iTutorialNextStep", function() { return iTutorialNextStep; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ITutorial", function() { return ITutorial; }); /* harmony import */ var _engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./engine */ 15); /* harmony import */ var _Player__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Player */ 2); /* harmony import */ var _Settings_Settings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Settings/Settings */ 24); /* harmony import */ var _Settings_Settings__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_Settings_Settings__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ui/MainMenu/Links */ 31); /* harmony import */ var _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var _Literature_data_LiteratureNames__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Literature/data/LiteratureNames */ 144); /* harmony import */ var _Literature_data_LiteratureNames__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_Literature_data_LiteratureNames__WEBPACK_IMPORTED_MODULE_4__); /* harmony import */ var _utils_helpers_exceptionAlert__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils/helpers/exceptionAlert */ 91); /* harmony import */ var _utils_helpers_exceptionAlert__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_utils_helpers_exceptionAlert__WEBPACK_IMPORTED_MODULE_5__); /* harmony import */ var _utils_uiHelpers_clearEventListeners__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../utils/uiHelpers/clearEventListeners */ 49); /* harmony import */ var _utils_uiHelpers_clearEventListeners__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_utils_uiHelpers_clearEventListeners__WEBPACK_IMPORTED_MODULE_6__); /* harmony import */ var _utils_uiHelpers_createElement__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../utils/uiHelpers/createElement */ 51); /* harmony import */ var _utils_uiHelpers_createElement__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_utils_uiHelpers_createElement__WEBPACK_IMPORTED_MODULE_7__); /* harmony import */ var _utils_uiHelpers_createPopup__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../utils/uiHelpers/createPopup */ 129); /* harmony import */ var _utils_uiHelpers_createPopup__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_utils_uiHelpers_createPopup__WEBPACK_IMPORTED_MODULE_8__); /* harmony import */ var _utils_uiHelpers_removeElementById__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../utils/uiHelpers/removeElementById */ 90); /* harmony import */ var _utils_uiHelpers_removeElementById__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_utils_uiHelpers_removeElementById__WEBPACK_IMPORTED_MODULE_9__); // Ordered array of keys to Interactive Tutorial Steps const orderedITutorialSteps = [ "Start", "GoToCharacterPage", // Click on 'Stats' page "CharacterPage", // Introduction to 'Stats' page "CharacterGoToTerminalPage", // Go back to Terminal "TerminalIntro", // Introduction to Terminal "TerminalHelp", // Using 'help' Terminal command "TerminalLs", // Using 'ls' Terminal command "TerminalScan", // Using 'scan' Terminal command "TerminalScanAnalyze1", // Using 'scan-analyze' Terminal command "TerminalScanAnalyze2", // Using 'scan-analyze 3' Terminal command "TerminalConnect", // Connecting to n00dles "TerminalAnalyze", // Analyzing n00dles "TerminalNuke", // NUKE n00dles "TerminalManualHack", // Hack n00dles "TerminalHackingMechanics", // Explanation of hacking mechanics "TerminalCreateScript", // Create a script using 'nano' "TerminalTypeScript", // Script Editor page - Type script and then save & close "TerminalFree", // Using 'Free' Terminal command "TerminalRunScript", // Running script using 'run' Terminal command "TerminalGoToActiveScriptsPage", "ActiveScriptsPage", "ActiveScriptsToTerminal", "TerminalTailScript", "GoToHacknetNodesPage", "HacknetNodesIntroduction", "HacknetNodesGoToWorldPage", "WorldDescription", "TutorialPageInfo", "End", ] // Create an 'enum' for the Steps const iTutorialSteps = {}; for (let i = 0; i < orderedITutorialSteps.length; ++i) { iTutorialSteps[orderedITutorialSteps[i]] = i; } const ITutorial = { currStep: 0, // iTutorialSteps.Start isRunning: false, // Keeps track of whether each step has been done stepIsDone: {}, } function iTutorialStart() { // Initialize Interactive Tutorial state by settings 'done' for each state to false ITutorial.stepIsDone = {}; for (let i = 0; i < orderedITutorialSteps.length; ++i) { ITutorial.stepIsDone[i] = false; } _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); // Don't autosave during this interactive tutorial _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].Counters.autoSaveCounter = Infinity; ITutorial.currStep = 0; ITutorial.isRunning = true; document.getElementById("interactive-tutorial-container").style.display = "block"; // Exit tutorial button const exitButton = Object(_utils_uiHelpers_clearEventListeners__WEBPACK_IMPORTED_MODULE_6__["clearEventListeners"])("interactive-tutorial-exit"); exitButton.addEventListener("click", function() { iTutorialEnd(); return false; }); // Back button const backButton = Object(_utils_uiHelpers_clearEventListeners__WEBPACK_IMPORTED_MODULE_6__["clearEventListeners"])("interactive-tutorial-back"); backButton.addEventListener("click", function() { iTutorialPrevStep(); return false; }); // Next button const nextButton = Object(_utils_uiHelpers_clearEventListeners__WEBPACK_IMPORTED_MODULE_6__["clearEventListeners"])("interactive-tutorial-next"); nextButton.addEventListener("click", function() { iTutorialNextStep(); return false; }); iTutorialEvaluateStep(); } function iTutorialEvaluateStep() { if (!ITutorial.isRunning) {return;} // Disable and clear main menu const terminalMainMenu = Object(_utils_uiHelpers_clearEventListeners__WEBPACK_IMPORTED_MODULE_6__["clearEventListeners"])("terminal-menu-link"); const statsMainMenu = Object(_utils_uiHelpers_clearEventListeners__WEBPACK_IMPORTED_MODULE_6__["clearEventListeners"])("stats-menu-link"); const activeScriptsMainMenu = Object(_utils_uiHelpers_clearEventListeners__WEBPACK_IMPORTED_MODULE_6__["clearEventListeners"])("active-scripts-menu-link"); const hacknetMainMenu = Object(_utils_uiHelpers_clearEventListeners__WEBPACK_IMPORTED_MODULE_6__["clearEventListeners"])("hacknet-nodes-menu-link"); const cityMainMenu = Object(_utils_uiHelpers_clearEventListeners__WEBPACK_IMPORTED_MODULE_6__["clearEventListeners"])("city-menu-link"); const tutorialMainMenu = Object(_utils_uiHelpers_clearEventListeners__WEBPACK_IMPORTED_MODULE_6__["clearEventListeners"])("tutorial-menu-link"); terminalMainMenu.removeAttribute("class"); statsMainMenu.removeAttribute("class"); activeScriptsMainMenu.removeAttribute("class"); hacknetMainMenu.removeAttribute("class"); cityMainMenu.removeAttribute("class"); tutorialMainMenu.removeAttribute("class"); // Interactive Tutorial Next button const nextBtn = document.getElementById("interactive-tutorial-next"); switch(ITutorial.currStep) { case iTutorialSteps.Start: _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); iTutorialSetText("Welcome to Bitburner, a cyberpunk-themed incremental RPG! " + "The game takes place in a dark, dystopian future... The year is 2077...

" + "This tutorial will show you the basics of the game. " + "You may skip the tutorial at any time."); nextBtn.style.display = "inline-block"; break; case iTutorialSteps.GoToCharacterPage: _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); iTutorialSetText("Let's start by heading to the Stats page. Click the Stats tab on " + "the main navigation menu (left-hand side of the screen)"); nextBtn.style.display = "none"; // Flash 'Stats' menu and set its tutorial click handler statsMainMenu.setAttribute("class", "flashing-button"); statsMainMenu.addEventListener("click", function() { _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadCharacterContent(); iTutorialNextStep(); //Opening the character page will go to the next step return false; }); break; case iTutorialSteps.CharacterPage: _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadCharacterContent(); iTutorialSetText("The Stats page shows a lot of important information about your progress, " + "such as your skills, money, and bonuses. ") nextBtn.style.display = "inline-block"; break; case iTutorialSteps.CharacterGoToTerminalPage: _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadCharacterContent(); iTutorialSetText("Let's head to your computer's terminal by clicking the Terminal tab on the " + "main navigation menu."); nextBtn.style.display = "none"; // Flash 'Terminal' menu and set its tutorial click handler terminalMainMenu.setAttribute("class", "flashing-button"); terminalMainMenu.addEventListener("click", function() { _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); iTutorialNextStep(); return false; }); break; case iTutorialSteps.TerminalIntro: _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); iTutorialSetText("The Terminal is used to interface with your home computer as well as " + "all of the other machines around the world."); nextBtn.style.display = "inline-block"; break; case iTutorialSteps.TerminalHelp: _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); iTutorialSetText("Let's try it out. Start by entering the help command into the Terminal " + "(Don't forget to press Enter after typing the command)"); nextBtn.style.display = "none"; // next step triggered by terminal command break; case iTutorialSteps.TerminalLs: _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); iTutorialSetText("The help command displays a list of all available Terminal commands, how to use them, " + "and a description of what they do.

Let's try another command. Enter the ls command."); nextBtn.style.display = "none"; // next step triggered by terminal command break; case iTutorialSteps.TerminalScan: _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); iTutorialSetText(" ls is a basic command that shows files " + "on the computer. Right now, it shows that you have a program called NUKE.exe on your computer. " + "We'll get to what this does later.

Using your home computer's terminal, you can connect " + "to other machines throughout the world. Let's do that now by first entering " + "the scan command."); nextBtn.style.display = "none"; // next step triggered by terminal command break; case iTutorialSteps.TerminalScanAnalyze1: _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); iTutorialSetText("The scan command shows all available network connections. In other words, " + "it displays a list of all servers that can be connected to from your " + "current machine. A server is identified by its hostname.

" + "That's great and all, but there's so many servers. Which one should you go to? " + "The scan-analyze command gives some more detailed information about servers on the " + "network. Try it now!"); nextBtn.style.display = "none"; // next step triggered by terminal command break; case iTutorialSteps.TerminalScanAnalyze2: _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); iTutorialSetText("You just ran scan-analyze with a depth of one. This command shows more detailed " + "information about each server that you can connect to (servers that are a distance of " + "one node away).

It is also possible to run scan-analyze with " + "a higher depth. Let's try a depth of two with the following command: scan-analyze 2.") nextBtn.style.display = "none"; // next step triggered by terminal command break; case iTutorialSteps.TerminalConnect: _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); iTutorialSetText("Now you can see information about all servers that are up to two nodes away, as well " + "as figure out how to navigate to those servers through the network. You can only connect to " + "a server that is one node away. To connect to a machine, use the connect [hostname] command.

" + "From the results of the scan-analyze command, we can see that the n00dles server is " + "only one node away. Let's connect so it now using: connect n00dles"); nextBtn.style.display = "none"; // next step triggered by terminal command break; case iTutorialSteps.TerminalAnalyze: _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); iTutorialSetText("You are now connected to another machine! What can you do now? You can hack it!

In the year 2077, currency has " + "become digital and decentralized. People and corporations store their money " + "on servers and computers. Using your hacking abilities, you can hack servers " + "to steal money and gain experience.

" + "Before you try to hack a server, you should run diagnostics using the analyze command."); nextBtn.style.display = "none"; // next step triggered by terminal command break; case iTutorialSteps.TerminalNuke: _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); iTutorialSetText("When the analyze command finishes running it will show useful information " + "about hacking the server.

For this server, the required hacking skill is only 1, " + "which means you can hack it right now. However, in order to hack a server " + "you must first gain root access. The NUKE.exe program that we saw earlier on your " + "home computer is a virus that will grant you root access to a machine if there are enough " + "open ports.

The analyze results shows that there do not need to be any open ports " + "on this machine for the NUKE virus to work, so go ahead and run the virus using the " + "run NUKE.exe command."); nextBtn.style.display = "none"; // next step triggered by terminal command break; case iTutorialSteps.TerminalManualHack: _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); iTutorialSetText("You now have root access! You can hack the server using the hack command. " + "Try doing that now."); nextBtn.style.display = "none"; // next step triggered by terminal command break; case iTutorialSteps.TerminalHackingMechanics: _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); iTutorialSetText("You are now attempting to hack the server. Performing a hack takes time and " + "only has a certain percentage chance " + "of success. This time and success chance is determined by a variety of factors, including " + "your hacking skill and the server's security level.

" + "If your attempt to hack the server is successful, you will steal a certain percentage " + "of the server's total money. This percentage is affected by your hacking skill and " + "the server's security level.

The amount of money on a server is not limitless. So, if " + "you constantly hack a server and deplete its money, then you will encounter " + "diminishing returns in your hacking."); nextBtn.style.display = "inline-block"; break; case iTutorialSteps.TerminalCreateScript: _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); iTutorialSetText("Hacking is the core mechanic of the game and is necessary for progressing. However, " + "you don't want to be hacking manually the entire time. You can automate your hacking " + "by writing scripts!

To create a new script or edit an existing one, you can use the nano " + "command. Scripts must end with the .script extension. Let's make a script now by " + "entering nano n00dles.script after the hack command finishes running (Sidenote: Pressing ctrl + c" + " will end a command like hack early)"); nextBtn.style.display = "none"; // next step triggered by terminal command break; case iTutorialSteps.TerminalTypeScript: _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadScriptEditorContent("n00dles.script", ""); iTutorialSetText("This is the script editor. You can use it to program your scripts. Scripts are " + "written in a simplified version of javascript. Copy and paste the following code into the script editor:

" + "
" +
                         "while(true) {\n" +
                         "  hack('n00dles');\n" +
                         "}
" + "For anyone with basic programming experience, this code should be straightforward. " + "This script will continuously hack the n00dles server.

" + "To save and close the script editor, press the button in the bottom left, or press ctrl + b."); nextBtn.style.display = "none"; // next step triggered in saveAndCloseScriptEditor() (Script.js) break; case iTutorialSteps.TerminalFree: _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); iTutorialSetText("Now we'll run the script. Scripts require a certain amount of RAM to run, and can be " + "run on any machine which you have root access to. Different servers have different " + "amounts of RAM. You can also purchase more RAM for your home server.

To check how much " + "RAM is available on this machine, enter the free command."); nextBtn.style.display = "none"; // next step triggered by terminal commmand break; case iTutorialSteps.TerminalRunScript: _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); iTutorialSetText("We have 4GB of free RAM on this machine, which is enough to run our " + "script. Let's run our script using run n00dles.script."); nextBtn.style.display = "none"; // next step triggered by terminal commmand break; case iTutorialSteps.TerminalGoToActiveScriptsPage: _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); iTutorialSetText("Your script is now running! " + "It will continuously run in the background and will automatically stop if " + "the code ever completes (the n00dles.script will never complete because it " + "runs an infinite loop).

These scripts can passively earn you income and hacking experience. " + "Your scripts will also earn money and experience while you are offline, although at a " + "slightly slower rate.

" + "Let's check out some statistics for our running scripts by clicking the " + "Active Scripts link in the main navigation menu."); nextBtn.style.display = "none"; // Flash 'Active Scripts' menu and set its tutorial click handler activeScriptsMainMenu.setAttribute("class", "flashing-button"); activeScriptsMainMenu.addEventListener("click", function() { _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadActiveScriptsContent(); iTutorialNextStep(); return false; }); break; case iTutorialSteps.ActiveScriptsPage: _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadActiveScriptsContent(); iTutorialSetText("This page displays information about all of your scripts that are " + "running across every server. You can use this to gauge how well " + "your scripts are doing. Let's go back to the Terminal"); nextBtn.style.display = "none"; // Flash 'Terminal' button and set its tutorial click handler terminalMainMenu.setAttribute("class", "flashing-button"); terminalMainMenu.addEventListener("click", function() { _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); iTutorialNextStep(); return false; }); break; case iTutorialSteps.ActiveScriptsToTerminal: _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); iTutorialSetText("One last thing about scripts, each active script contains logs that detail " + "what it's doing. We can check these logs using the tail command. Do that " + "now for the script we just ran by typing tail n00dles.script"); nextBtn.style.display = "none"; // next step triggered by terminal command break; case iTutorialSteps.TerminalTailScript: _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); iTutorialSetText("The log for this script won't show much right now (it might show nothing at all) because it " + "just started running...but check back again in a few minutes!

" + "This covers the basics of hacking. To learn more about writing " + "scripts, select the Tutorial link in the " + "main navigation menu to look at the documentation. " + "If you are an experienced JavaScript " + "developer, I would highly suggest you check out the section on " + "NetscriptJS/Netscript 2.0, it's faster and more powerful.

For now, let's move on to something else!"); nextBtn.style.display = "inline-block"; break; case iTutorialSteps.GoToHacknetNodesPage: _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); iTutorialSetText("Hacking is not the only way to earn money. One other way to passively " + "earn money is by purchasing and upgrading Hacknet Nodes. Let's go to " + "the Hacknet page through the main navigation menu now."); nextBtn.style.display = "none"; // Flash 'Hacknet' menu and set its tutorial click handler hacknetMainMenu.setAttribute("class", "flashing-button"); hacknetMainMenu.addEventListener("click", function() { _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadHacknetNodesContent(); iTutorialNextStep(); return false; }); break; case iTutorialSteps.HacknetNodesIntroduction: _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadHacknetNodesContent(); iTutorialSetText("here you can purchase new Hacknet Nodes and upgrade your " + "existing ones. Let's purchase a new one now."); nextBtn.style.display = "none"; // Next step triggered by purchaseHacknet() (HacknetNode.js) break; case iTutorialSteps.HacknetNodesGoToWorldPage: _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadHacknetNodesContent(); iTutorialSetText("You just purchased a Hacknet Node! This Hacknet Node will passively " + "earn you money over time, both online and offline. When you get enough " + " money, you can upgrade " + "your newly-purchased Hacknet Node below.

" + "Let's go to the City page through the main navigation menu."); nextBtn.style.display = "none"; // Flash 'City' menu and set its tutorial click handler cityMainMenu.setAttribute("class", "flashing-button"); cityMainMenu.addEventListener("click", function() { _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadLocationContent(); iTutorialNextStep(); return false; }); break; case iTutorialSteps.WorldDescription: _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadLocationContent(); iTutorialSetText("This page lists all of the different locations you can currently " + "travel to. Each location has something that you can do. " + "There's a lot of content out in the world, make sure " + "you explore and discover!

" + "Lastly, click on the Tutorial link in the main navigation menu."); nextBtn.style.display = "none"; // Flash 'Tutorial' menu and set its tutorial click handler tutorialMainMenu.setAttribute("class", "flashing-button"); tutorialMainMenu.addEventListener("click", function() { _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTutorialContent(); iTutorialNextStep(); return false; }); break; case iTutorialSteps.TutorialPageInfo: _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTutorialContent(); iTutorialSetText("This page contains a lot of different documentation about the game's " + "content and mechanics. I know it's a lot, but I highly suggest you read " + "(or at least skim) through this before you start playing. That's the end of the tutorial. " + "Hope you enjoy the game!"); nextBtn.style.display = "inline-block"; nextBtn.innerHTML = "Finish Tutorial"; break; case iTutorialSteps.End: iTutorialEnd(); break; default: throw new Error("Invalid tutorial step"); } if (ITutorial.stepIsDone[ITutorial.currStep] === true) { nextBtn.style.display = "inline-block"; } } // Go to the next step and evaluate it function iTutorialNextStep() { // Special behavior for certain steps if (ITutorial.currStep === iTutorialSteps.GoToCharacterPage) { document.getElementById("stats-menu-link").removeAttribute("class"); } if (ITutorial.currStep === iTutorialSteps.CharacterGoToTerminalPage) { document.getElementById("terminal-menu-link").removeAttribute("class"); } if (ITutorial.currStep === iTutorialSteps.TerminalGoToActiveScriptsPage) { document.getElementById("active-scripts-menu-link").removeAttribute("class"); } if (ITutorial.currStep === iTutorialSteps.ActiveScriptsPage) { document.getElementById("terminal-menu-link").removeAttribute("class"); } if (ITutorial.currStep === iTutorialSteps.GoToHacknetNodesPage) { document.getElementById("hacknet-nodes-menu-link").removeAttribute("class"); } if (ITutorial.currStep === iTutorialSteps.HacknetNodesGoToWorldPage) { document.getElementById("city-menu-link").removeAttribute("class"); } if (ITutorial.currStep === iTutorialSteps.WorldDescription) { document.getElementById("tutorial-menu-link").removeAttribute("class"); } ITutorial.stepIsDone[ITutorial.currStep] = true; if (ITutorial.currStep < iTutorialSteps.End) { ITutorial.currStep += 1; } iTutorialEvaluateStep(); } // Go to previous step and evaluate function iTutorialPrevStep() { if (ITutorial.currStep > iTutorialSteps.Start) { ITutorial.currStep -= 1; } iTutorialEvaluateStep(); } function iTutorialEnd() { // Re-enable auto save if (_Settings_Settings__WEBPACK_IMPORTED_MODULE_2__["Settings"].AutosaveInterval === 0) { _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].Counters.autoSaveCounter = Infinity; } else { _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].Counters.autoSaveCounter = _Settings_Settings__WEBPACK_IMPORTED_MODULE_2__["Settings"].AutosaveInterval * 5; } // Initialize references to main menu links // We have to call initializeMainMenuLinks() again because the Interactive Tutorial // re-creates Main menu links with clearEventListeners() if (!Object(_ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_3__["initializeMainMenuLinks"])()) { const errorMsg = "Failed to initialize Main Menu Links. Please try refreshing the page. " + "If that doesn't work, report the issue to the developer"; Object(_utils_helpers_exceptionAlert__WEBPACK_IMPORTED_MODULE_5__["exceptionAlert"])(new Error(errorMsg)); console.error(errorMsg); return; } _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].init(); ITutorial.currStep = iTutorialSteps.End; ITutorial.isRunning = false; document.getElementById("interactive-tutorial-container").style.display = "none"; // Create a popup with final introductory stuff const popupId = "interactive-tutorial-ending-popup"; const txt = Object(_utils_uiHelpers_createElement__WEBPACK_IMPORTED_MODULE_7__["createElement"])("p", { innerHTML: "If you are new to the game, the following links may be useful for you!

" + "Getting Started Guide" + "Documentation

" + "The Beginner's Guide to Hacking was added to your home computer! It contains some tips/pointers for starting out with the game. " + "To read it, go to Terminal and enter

cat " + _Literature_data_LiteratureNames__WEBPACK_IMPORTED_MODULE_4__["LiteratureNames"].HackersStartingHandbook, }); const gotitBtn = Object(_utils_uiHelpers_createElement__WEBPACK_IMPORTED_MODULE_7__["createElement"])("a", { class:"a-link-button", float:"right", padding:"6px", innerText:"Got it!", clickListener:()=>{ Object(_utils_uiHelpers_removeElementById__WEBPACK_IMPORTED_MODULE_9__["removeElementById"])(popupId); }, }); Object(_utils_uiHelpers_createPopup__WEBPACK_IMPORTED_MODULE_8__["createPopup"])(popupId, [txt, gotitBtn]); _Player__WEBPACK_IMPORTED_MODULE_1__["Player"].getHomeComputer().messages.push(_Literature_data_LiteratureNames__WEBPACK_IMPORTED_MODULE_4__["LiteratureNames"].HackersStartingHandbook); } let textBox = null; (function() { function set() { textBox = document.getElementById("interactive-tutorial-text"); document.removeEventListener("DOMContentLoaded", set); } document.addEventListener("DOMContentLoaded", set); })(); function iTutorialSetText(txt) { textBox.innerHTML = txt; textBox.parentElement.scrollTop = 0; // this resets scroll position } /***/ }), /* 44 */ /*!***********************************!*\ !*** ./utils/helpers/keyCodes.ts ***! \***********************************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.KEY = void 0; /** * Keyboard key codes */ exports.KEY = { CTRL: 17, DOWNARROW: 40, ENTER: 13, ESC: 27, TAB: 9, UPARROW: 38, "0": 48, "1": 49, "2": 50, "3": 51, "4": 52, "5": 53, "6": 54, "7": 55, "8": 56, "9": 57, A: 65, B: 66, C: 67, D: 68, E: 69, F: 70, G: 71, H: 72, I: 73, J: 74, K: 75, L: 76, M: 77, N: 78, O: 79, P: 80, Q: 81, R: 82, S: 83, T: 84, U: 85, V: 86, W: 87, X: 88, Y: 89, Z: 90, }; /***/ }), /* 45 */ /*!***************************************!*\ !*** ./utils/helpers/getRandomInt.ts ***! \***************************************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getRandomInt = void 0; /** * Gets a random integer bounded by the values passed in. * @param min The minimum value in the range. * @param max The maximum value in the range. */ function getRandomInt(min, max) { const lower = Math.min(min, max); const upper = Math.max(min, max); return Math.floor(Math.random() * (upper - lower + 1)) + lower; } exports.getRandomInt = getRandomInt; /***/ }), /* 46 */, /* 47 */ /*!*****************************************!*\ !*** ./src/StockMarket/StockMarket.tsx ***! \*****************************************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.displayStockMarketContent = exports.processStockPrices = exports.stockMarketCycle = exports.initSymbolToStockMap = exports.initStockMarket = exports.deleteStockMarket = exports.loadStockMarket = exports.cancelOrder = exports.placeOrder = exports.SymbolToStockMap = exports.StockMarket = void 0; const BuyingAndSelling_1 = __webpack_require__(/*! ./BuyingAndSelling */ 174); const Order_1 = __webpack_require__(/*! ./Order */ 996); const OrderProcessing_1 = __webpack_require__(/*! ./OrderProcessing */ 995); const Stock_1 = __webpack_require__(/*! ./Stock */ 191); const StockMarketConstants_1 = __webpack_require__(/*! ./StockMarketConstants */ 994); const InitStockMetadata_1 = __webpack_require__(/*! ./data/InitStockMetadata */ 993); const OrderTypes_1 = __webpack_require__(/*! ./data/OrderTypes */ 111); const PositionTypes_1 = __webpack_require__(/*! ./data/PositionTypes */ 98); const StockSymbols_1 = __webpack_require__(/*! ./data/StockSymbols */ 284); const Root_1 = __webpack_require__(/*! ./ui/Root */ 992); const Constants_1 = __webpack_require__(/*! ../Constants */ 11); const Player_1 = __webpack_require__(/*! ../Player */ 2); const EventEmitter_1 = __webpack_require__(/*! ../utils/EventEmitter */ 487); const navigationTracking_1 = __webpack_require__(/*! .././ui/navigationTracking */ 18); const numeralFormat_1 = __webpack_require__(/*! .././ui/numeralFormat */ 7); const DialogBox_1 = __webpack_require__(/*! ../../utils/DialogBox */ 13); const JSONReviver_1 = __webpack_require__(/*! ../../utils/JSONReviver */ 29); const React = __importStar(__webpack_require__(/*! react */ 0)); const ReactDOM = __importStar(__webpack_require__(/*! react-dom */ 21)); exports.StockMarket = {}; // Maps full stock name -> Stock object exports.SymbolToStockMap = {}; // Maps symbol -> Stock object function placeOrder(stock, shares, price, type, position, workerScript = null) { if (!(stock instanceof Stock_1.Stock)) { if (workerScript) { workerScript.log("placeOrder", `Invalid stock: '${stock}'`); } else { DialogBox_1.dialogBoxCreate(`ERROR: Invalid stock passed to placeOrder() function`); } return false; } if (typeof shares !== "number" || typeof price !== "number") { if (workerScript) { workerScript.log("placeOrder", `Invalid arguments: shares='${shares}' price='${price}'`); } else { DialogBox_1.dialogBoxCreate("ERROR: Invalid numeric value provided for either 'shares' or 'price' argument"); } return false; } const order = new Order_1.Order(stock.symbol, shares, price, type, position); if (exports.StockMarket["Orders"] == null) { const orders = {}; for (const name in exports.StockMarket) { const stk = exports.StockMarket[name]; if (!(stk instanceof Stock_1.Stock)) { continue; } orders[stk.symbol] = []; } exports.StockMarket["Orders"] = orders; } exports.StockMarket["Orders"][stock.symbol].push(order); // Process to see if it should be executed immediately const processOrderRefs = { rerenderFn: displayStockMarketContent, stockMarket: exports.StockMarket, symbolToStockMap: exports.SymbolToStockMap, }; OrderProcessing_1.processOrders(stock, order.type, order.pos, processOrderRefs); displayStockMarketContent(); return true; } exports.placeOrder = placeOrder; function cancelOrder(params, workerScript = null) { if (exports.StockMarket["Orders"] == null) { return false; } if (params.order && params.order instanceof Order_1.Order) { const order = params.order; // An 'Order' object is passed in const stockOrders = exports.StockMarket["Orders"][order.stockSymbol]; for (let i = 0; i < stockOrders.length; ++i) { if (order == stockOrders[i]) { stockOrders.splice(i, 1); displayStockMarketContent(); return true; } } return false; } else if (params.stock && params.shares && params.price && params.type && params.pos && params.stock instanceof Stock_1.Stock) { // Order properties are passed in. Need to look for the order const stockOrders = exports.StockMarket["Orders"][params.stock.symbol]; const orderTxt = params.stock.symbol + " - " + params.shares + " @ " + numeralFormat_1.numeralWrapper.formatMoney(params.price); for (let i = 0; i < stockOrders.length; ++i) { const order = stockOrders[i]; if (params.shares === order.shares && params.price === order.price && params.type === order.type && params.pos === order.pos) { stockOrders.splice(i, 1); displayStockMarketContent(); if (workerScript) { workerScript.scriptRef.log("Successfully cancelled order: " + orderTxt); } return true; } } if (workerScript) { workerScript.scriptRef.log("Failed to cancel order: " + orderTxt); } return false; } return false; } exports.cancelOrder = cancelOrder; function loadStockMarket(saveString) { if (saveString === "") { exports.StockMarket = {}; } else { exports.StockMarket = JSON.parse(saveString, JSONReviver_1.Reviver); } } exports.loadStockMarket = loadStockMarket; function deleteStockMarket() { exports.StockMarket = {}; } exports.deleteStockMarket = deleteStockMarket; function initStockMarket() { for (const stk in exports.StockMarket) { if (exports.StockMarket.hasOwnProperty(stk)) { delete exports.StockMarket[stk]; } } for (const metadata of InitStockMetadata_1.InitStockMetadata) { const name = metadata.name; exports.StockMarket[name] = new Stock_1.Stock(metadata); } const orders = {}; for (const name in exports.StockMarket) { const stock = exports.StockMarket[name]; if (!(stock instanceof Stock_1.Stock)) { continue; } orders[stock.symbol] = []; } exports.StockMarket["Orders"] = orders; exports.StockMarket.storedCycles = 0; exports.StockMarket.lastUpdate = 0; exports.StockMarket.ticksUntilCycle = StockMarketConstants_1.TicksPerCycle; } exports.initStockMarket = initStockMarket; function initSymbolToStockMap() { for (const name in StockSymbols_1.StockSymbols) { if (StockSymbols_1.StockSymbols.hasOwnProperty(name)) { const stock = exports.StockMarket[name]; if (stock == null) { console.error(`Could not find Stock for ${name}`); continue; } const symbol = StockSymbols_1.StockSymbols[name]; exports.SymbolToStockMap[symbol] = stock; } } } exports.initSymbolToStockMap = initSymbolToStockMap; function stockMarketCycle() { for (const name in exports.StockMarket) { const stock = exports.StockMarket[name]; if (!(stock instanceof Stock_1.Stock)) { continue; } const roll = Math.random(); if (roll < 0.45) { stock.b = !stock.b; stock.flipForecastForecast(); } exports.StockMarket.ticksUntilCycle = StockMarketConstants_1.TicksPerCycle; } } exports.stockMarketCycle = stockMarketCycle; // Stock prices updated every 6 seconds const msPerStockUpdate = 6e3; const cyclesPerStockUpdate = msPerStockUpdate / Constants_1.CONSTANTS.MilliPerCycle; function processStockPrices(numCycles = 1) { if (exports.StockMarket.storedCycles == null || isNaN(exports.StockMarket.storedCycles)) { exports.StockMarket.storedCycles = 0; } exports.StockMarket.storedCycles += numCycles; if (exports.StockMarket.storedCycles < cyclesPerStockUpdate) { return; } // We can process the update every 4 seconds as long as there are enough // stored cycles. This lets us account for offline time const timeNow = new Date().getTime(); if (timeNow - exports.StockMarket.lastUpdate < 4e3) { return; } exports.StockMarket.lastUpdate = timeNow; exports.StockMarket.storedCycles -= cyclesPerStockUpdate; // Cycle if (exports.StockMarket.ticksUntilCycle == null || typeof exports.StockMarket.ticksUntilCycle !== "number") { exports.StockMarket.ticksUntilCycle = StockMarketConstants_1.TicksPerCycle; } --exports.StockMarket.ticksUntilCycle; if (exports.StockMarket.ticksUntilCycle <= 0) { stockMarketCycle(); } const v = Math.random(); for (const name in exports.StockMarket) { const stock = exports.StockMarket[name]; if (!(stock instanceof Stock_1.Stock)) { continue; } let av = (v * stock.mv) / 100; if (isNaN(av)) { av = .02; } let chc = 50; if (stock.b) { chc = (chc + stock.otlkMag) / 100; } else { chc = (chc - stock.otlkMag) / 100; } if (stock.price >= stock.cap) { chc = 0.1; // "Soft Limit" on stock price. It could still go up but its unlikely stock.b = false; } if (isNaN(chc)) { chc = 0.5; } const c = Math.random(); const processOrderRefs = { rerenderFn: displayStockMarketContent, stockMarket: exports.StockMarket, symbolToStockMap: exports.SymbolToStockMap, }; if (c < chc) { stock.changePrice(stock.price * (1 + av)); OrderProcessing_1.processOrders(stock, OrderTypes_1.OrderTypes.LimitBuy, PositionTypes_1.PositionTypes.Short, processOrderRefs); OrderProcessing_1.processOrders(stock, OrderTypes_1.OrderTypes.LimitSell, PositionTypes_1.PositionTypes.Long, processOrderRefs); OrderProcessing_1.processOrders(stock, OrderTypes_1.OrderTypes.StopBuy, PositionTypes_1.PositionTypes.Long, processOrderRefs); OrderProcessing_1.processOrders(stock, OrderTypes_1.OrderTypes.StopSell, PositionTypes_1.PositionTypes.Short, processOrderRefs); } else { stock.changePrice(stock.price / (1 + av)); OrderProcessing_1.processOrders(stock, OrderTypes_1.OrderTypes.LimitBuy, PositionTypes_1.PositionTypes.Long, processOrderRefs); OrderProcessing_1.processOrders(stock, OrderTypes_1.OrderTypes.LimitSell, PositionTypes_1.PositionTypes.Short, processOrderRefs); OrderProcessing_1.processOrders(stock, OrderTypes_1.OrderTypes.StopBuy, PositionTypes_1.PositionTypes.Short, processOrderRefs); OrderProcessing_1.processOrders(stock, OrderTypes_1.OrderTypes.StopSell, PositionTypes_1.PositionTypes.Long, processOrderRefs); } let otlkMagChange = stock.otlkMag * av; if (stock.otlkMag < 5) { if (stock.otlkMag <= 1) { otlkMagChange = 1; } else { otlkMagChange *= 10; } } stock.cycleForecast(otlkMagChange); stock.cycleForecastForecast(otlkMagChange / 2); // Shares required for price movement gradually approaches max over time stock.shareTxUntilMovement = Math.min(stock.shareTxUntilMovement + 10, stock.shareTxForMovement); } displayStockMarketContent(); } exports.processStockPrices = processStockPrices; let stockMarketContainer = null; function setStockMarketContainer() { stockMarketContainer = document.getElementById("stock-market-container"); document.removeEventListener("DOMContentLoaded", setStockMarketContainer); } document.addEventListener("DOMContentLoaded", setStockMarketContainer); function initStockMarketFnForReact() { initStockMarket(); initSymbolToStockMap(); } const eventEmitterForUiReset = new EventEmitter_1.EventEmitter(); function displayStockMarketContent() { if (!navigationTracking_1.routing.isOn(navigationTracking_1.Page.StockMarket)) { return; } eventEmitterForUiReset.emitEvent(); if (stockMarketContainer instanceof HTMLElement) { const castedStockMarket = exports.StockMarket; ReactDOM.render(React.createElement(Root_1.StockMarketRoot, { buyStockLong: BuyingAndSelling_1.buyStock, buyStockShort: BuyingAndSelling_1.shortStock, cancelOrder: cancelOrder, eventEmitterForReset: eventEmitterForUiReset, initStockMarket: initStockMarketFnForReact, p: Player_1.Player, placeOrder: placeOrder, sellStockLong: BuyingAndSelling_1.sellStock, sellStockShort: BuyingAndSelling_1.sellShort, stockMarket: castedStockMarket }), stockMarketContainer); } } exports.displayStockMarketContent = displayStockMarketContent; /***/ }), /* 48 */, /* 49 */ /*!************************************************!*\ !*** ./utils/uiHelpers/clearEventListeners.ts ***! \************************************************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.clearEventListeners = void 0; const getElementById_1 = __webpack_require__(/*! ./getElementById */ 190); /** * Given an element by its ID, removes all event listeners from that element by cloning and * replacing. Then returns the new cloned element. * @param elemId The HTML ID to retrieve the element by. */ function clearEventListeners(elemId) { try { let elem; if (typeof elemId === "string") { elem = getElementById_1.getElementById(elemId); } else { elem = elemId; } const newElem = elem.cloneNode(true); if (elem.parentNode !== null) { elem.parentNode.replaceChild(newElem, elem); } return newElem; } catch (e) { // tslint:disable-next-line:no-console console.error(e); return null; } } exports.clearEventListeners = clearEventListeners; /***/ }), /* 50 */ /*!************************!*\ !*** ./src/Hacking.ts ***! \************************/ /*! no static exports found */ /*! exports used: calculateGrowTime, calculateHackingChance, calculateHackingExpGain, calculateHackingTime, calculatePercentMoneyHacked, calculateWeakenTime */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.calculateWeakenTime = exports.calculateGrowTime = exports.calculateHackingTime = exports.calculatePercentMoneyHacked = exports.calculateHackingExpGain = exports.calculateHackingChance = void 0; const BitNodeMultipliers_1 = __webpack_require__(/*! ./BitNode/BitNodeMultipliers */ 19); const intelligence_1 = __webpack_require__(/*! ./PersonObjects/formulas/intelligence */ 411); /** * Returns the chance the player has to successfully hack a server */ function calculateHackingChance(server, player) { const hackFactor = 1.75; const difficultyMult = (100 - server.hackDifficulty) / 100; const skillMult = hackFactor * player.hacking_skill; const skillChance = (skillMult - server.requiredHackingSkill) / skillMult; const chance = skillChance * difficultyMult * player.hacking_chance_mult * intelligence_1.calculateIntelligenceBonus(player.intelligence, 1); if (chance > 1) { return 1; } if (chance < 0) { return 0; } return chance; } exports.calculateHackingChance = calculateHackingChance; /** * Returns the amount of hacking experience the player will gain upon * successfully hacking a server */ function calculateHackingExpGain(server, player) { const baseExpGain = 3; const diffFactor = 0.3; if (server.baseDifficulty == null) { server.baseDifficulty = server.hackDifficulty; } let expGain = baseExpGain; expGain += (server.baseDifficulty * player.hacking_exp_mult * diffFactor); return expGain * BitNodeMultipliers_1.BitNodeMultipliers.HackExpGain; } exports.calculateHackingExpGain = calculateHackingExpGain; /** * Returns the percentage of money that will be stolen from a server if * it is successfully hacked (returns the decimal form, not the actual percent value) */ function calculatePercentMoneyHacked(server, player) { // Adjust if needed for balancing. This is the divisor for the final calculation const balanceFactor = 240; const difficultyMult = (100 - server.hackDifficulty) / 100; const skillMult = (player.hacking_skill - (server.requiredHackingSkill - 1)) / player.hacking_skill; const percentMoneyHacked = difficultyMult * skillMult * player.hacking_money_mult / balanceFactor; if (percentMoneyHacked < 0) { return 0; } if (percentMoneyHacked > 1) { return 1; } return percentMoneyHacked * BitNodeMultipliers_1.BitNodeMultipliers.ScriptHackMoney; } exports.calculatePercentMoneyHacked = calculatePercentMoneyHacked; /** * Returns time it takes to complete a hack on a server, in seconds */ function calculateHackingTime(server, player) { const difficultyMult = server.requiredHackingSkill * server.hackDifficulty; const baseDiff = 500; const baseSkill = 50; const diffFactor = 2.5; let skillFactor = (diffFactor * difficultyMult + baseDiff); // tslint:disable-next-line skillFactor /= (player.hacking_skill + baseSkill); const hackTimeMultiplier = 5; const hackingTime = hackTimeMultiplier * skillFactor / (player.hacking_speed_mult * intelligence_1.calculateIntelligenceBonus(player.intelligence, 1)); return hackingTime; } exports.calculateHackingTime = calculateHackingTime; /** * Returns time it takes to complete a grow operation on a server, in seconds */ function calculateGrowTime(server, player) { const growTimeMultiplier = 3.2; // Relative to hacking time. 16/5 = 3.2 return growTimeMultiplier * calculateHackingTime(server, player); } exports.calculateGrowTime = calculateGrowTime; /** * Returns time it takes to complete a weaken operation on a server, in seconds */ function calculateWeakenTime(server, player) { const weakenTimeMultiplier = 4; // Relative to hacking time return weakenTimeMultiplier * calculateHackingTime(server, player); } exports.calculateWeakenTime = calculateWeakenTime; /***/ }), /* 51 */ /*!******************************************!*\ !*** ./utils/uiHelpers/createElement.ts ***! \******************************************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createElement = void 0; function setElementAnchor(el, params) { if (params.text !== undefined) { el.text = params.text; } if (params.href !== undefined) { el.href = params.href; } if (params.target !== undefined) { el.target = params.target; } } function setElementInput(el, params) { if (params.name !== undefined) { el.name = params.name; } if (params.value !== undefined) { el.value = params.value; } if (params.type !== undefined) { el.type = params.type; } if (params.checked !== undefined) { el.checked = params.checked; } if (params.pattern !== undefined) { el.pattern = params.pattern; } if (params.maxLength !== undefined) { el.maxLength = params.maxLength; } if (params.placeholder !== undefined) { el.placeholder = params.placeholder; } if (params.max !== undefined) { el.max = params.max; } if (params.min !== undefined) { el.min = params.min; } if (params.step !== undefined) { el.step = params.step; } } function setElementLabel(el, params) { if (params.for !== undefined) { el.htmlFor = params.for; } } function setElementListeners(el, params) { // tslint:disable:no-unbound-method if (params.clickListener !== undefined) { el.addEventListener("click", params.clickListener); } if (params.inputListener !== undefined) { el.addEventListener("input", params.inputListener); } if (params.changeListener !== undefined) { el.addEventListener("change", params.changeListener); } if (params.onkeyup !== undefined) { el.addEventListener("keyup", params.onkeyup); } if (params.onkeydown !== undefined) { el.addEventListener("keydown", params.onkeydown); } if (params.onfocus !== undefined) { el.addEventListener("focus", params.onfocus); } // tslint:enable:no-unbound-method } function setElementStyle(el, params) { if (params.display !== undefined) { el.style.display = params.display; } if (params.visibility !== undefined) { el.style.visibility = params.visibility; } if (params.margin !== undefined) { el.style.margin = params.margin; } if (params.marginLeft !== undefined) { el.style.marginLeft = params.marginLeft; } if (params.marginTop !== undefined) { el.style.marginTop = params.marginTop; } if (params.padding !== undefined) { el.style.padding = params.padding; } if (params.color !== undefined) { el.style.color = params.color; } if (params.border !== undefined) { el.style.border = params.border; } if (params.float !== undefined) { el.style.cssFloat = params.float; } if (params.fontSize !== undefined) { el.style.fontSize = params.fontSize; } if (params.whiteSpace !== undefined) { el.style.whiteSpace = params.whiteSpace; } if (params.width !== undefined) { el.style.width = params.width; } if (params.height !== undefined) { el.style.height = params.height; } if (params.top !== undefined) { el.style.top = params.top; } if (params.left !== undefined) { el.style.left = params.left; } if (params.backgroundColor !== undefined) { el.style.backgroundColor = params.backgroundColor; } if (params.position !== undefined) { el.style.position = params.position; } if (params.overflow !== undefined) { el.style.overflow = params.overflow; } } function setElementTooltip(el, params) { if (params.tooltip !== undefined && params.tooltip !== "") { el.className += " tooltip"; el.appendChild(createElement("span", { class: "tooltiptext", innerHTML: params.tooltip, })); } else if (params.tooltipleft !== undefined) { el.className += " tooltip"; el.appendChild(createElement("span", { class: "tooltiptextleft", innerHTML: params.tooltipleft, })); } else if (params.tooltipsmall !== undefined) { el.className += " tooltip"; el.appendChild(createElement("span", { class: "tooltiptext smallfont", innerHTML: params.tooltipsmall, })); } else if (params.tooltiplow !== undefined) { el.className += "tooltip"; el.appendChild(createElement("span", { class: "tooltiptextlow", innerHTML: params.tooltiplow, })); } } /** * An all-in-one-call way of creating an element to be added to the DOM at some point. * @param tagName The HTML tag/element name * @param params Additional parameters to set on the element */ function createElement(tagName, params = {}) { const el = document.createElement(tagName); if (params.id !== undefined) { el.id = params.id; } if (params.class !== undefined) { el.className = params.class; } if (params.innerHTML !== undefined) { el.innerHTML = params.innerHTML; } if (params.innerText !== undefined) { el.innerText = params.innerText; } if (params.tabIndex !== undefined) { el.tabIndex = params.tabIndex; } setElementAnchor(el, params); setElementInput(el, params); setElementLabel(el, params); setElementListeners(el, params); setElementStyle(el, params); setElementTooltip(el, params); return el; } exports.createElement = createElement; /***/ }), /* 52 */ /*!*****************************************!*\ !*** ./src/Company/CompanyPositions.ts ***! \*****************************************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CompanyPositions = void 0; // Constructs all CompanyPosition objects using the metadata in data/companypositions.ts const CompanyPositionsMetadata_1 = __webpack_require__(/*! ./data/CompanyPositionsMetadata */ 1069); const CompanyPosition_1 = __webpack_require__(/*! ./CompanyPosition */ 286); exports.CompanyPositions = {}; function addCompanyPosition(params) { if (exports.CompanyPositions[params.name] != null) { console.warn(`Duplicate Company Position being defined: ${params.name}`); } exports.CompanyPositions[params.name] = new CompanyPosition_1.CompanyPosition(params); } CompanyPositionsMetadata_1.companyPositionMetadata.forEach((e) => { addCompanyPosition(e); }); /***/ }), /* 53 */, /* 54 */, /* 55 */, /* 56 */ /*!************************************!*\ !*** ./src/ui/React/StdButton.tsx ***! \************************************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.StdButton = void 0; /** * Basic stateless button * Uses the 'std-button' css class */ const React = __importStar(__webpack_require__(/*! react */ 0)); function StdButton(props) { const hasTooltip = props.tooltip != null && props.tooltip !== ""; let className = props.disabled ? "std-button-disabled" : "std-button"; if (hasTooltip) { className += " tooltip"; } if (typeof props.addClasses === "string") { className += ` ${props.addClasses}`; } // Tooltip will be set using inner HTML let tooltip; if (hasTooltip) { if (typeof props.tooltip === 'string') { const tooltipMarkup = { __html: props.tooltip, }; tooltip = React.createElement("span", { className: "tooltiptext", dangerouslySetInnerHTML: tooltipMarkup }); } else { tooltip = React.createElement("span", { className: "tooltiptext" }, props.tooltip); } } return (React.createElement("button", { className: className, id: props.id, onClick: props.onClick, style: props.style }, props.text, hasTooltip && tooltip)); } exports.StdButton = StdButton; /***/ }), /* 57 */, /* 58 */ /*!**************************************************!*\ !*** ./src/Company/data/companypositionnames.ts ***! \**************************************************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // Defs for job titles, stored in arrays and categorized by job "type" Object.defineProperty(exports, "__esModule", { value: true }); exports.PartTimeCompanyPositions = exports.BusinessConsultantCompanyPositions = exports.SoftwareConsultantCompanyPositions = exports.MiscCompanyPositions = exports.AgentCompanyPositions = exports.SecurityCompanyPositions = exports.BusinessCompanyPositions = exports.NetworkEngineerCompanyPositions = exports.SecurityEngineerCompanyPositions = exports.ITCompanyPositions = exports.SoftwareCompanyPositions = void 0; exports.SoftwareCompanyPositions = [ "Software Engineering Intern", "Junior Software Engineer", "Senior Software Engineer", "Lead Software Developer", "Head of Software", "Head of Engineering", "Vice President of Technology", "Chief Technology Officer", ]; exports.ITCompanyPositions = [ "IT Intern", "IT Analyst", "IT Manager", "Systems Administrator", ]; exports.SecurityEngineerCompanyPositions = [ "Security Engineer", ]; exports.NetworkEngineerCompanyPositions = [ "Network Engineer", "Network Administrator", ]; exports.BusinessCompanyPositions = [ "Business Intern", "Business Analyst", "Business Manager", "Operations Manager", "Chief Financial Officer", "Chief Executive Officer", ]; exports.SecurityCompanyPositions = [ "Police Officer", "Police Chief", "Security Guard", "Security Officer", "Security Supervisor", "Head of Security", ]; exports.AgentCompanyPositions = [ "Field Agent", "Secret Agent", "Special Operative", ]; exports.MiscCompanyPositions = [ "Waiter", "Employee", ]; exports.SoftwareConsultantCompanyPositions = [ "Software Consultant", "Senior Software Consultant", ]; exports.BusinessConsultantCompanyPositions = [ "Business Consultant", "Senior Business Consultant", ]; exports.PartTimeCompanyPositions = [ "Part-time Waiter", "Part-time Employee", ]; /***/ }), /* 59 */ /*!*************************************!*\ !*** ./src/ui/React/Reputation.tsx ***! \*************************************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Reputation = void 0; const React = __importStar(__webpack_require__(/*! react */ 0)); const numeralFormat_1 = __webpack_require__(/*! ../../ui/numeralFormat */ 7); function Reputation(reputation) { return React.createElement("span", { className: "reputation samefont" }, typeof reputation === 'number' ? numeralFormat_1.numeralWrapper.formatReputation(reputation) : reputation); } exports.Reputation = Reputation; /***/ }), /* 60 */, /* 61 */ /*!***************************!*\ !*** ./utils/YesNoBox.ts ***! \***************************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.yesNoTxtInpBoxCreate = exports.yesNoTxtInpBoxGetInput = exports.yesNoTxtInpBoxGetNoButton = exports.yesNoTxtInpBoxGetYesButton = exports.yesNoTxtInpBoxClose = exports.yesNoTxtInpBoxHotkeyHandler = exports.yesNoBoxCreate = exports.yesNoBoxGetNoButton = exports.yesNoBoxGetYesButton = exports.yesNoBoxClose = exports.yesNoBoxOpen = void 0; /** * Generic Yes-No Pop-up box * Used to create pop-up boxes that require a yes/no response from player * * There are two types of pop ups: * 1. Just a Yes/No response from player * 2. Popup also includes a text input field in addition to the Yes/No response */ const clearEventListeners_1 = __webpack_require__(/*! ./uiHelpers/clearEventListeners */ 49); const keyCodes_1 = __webpack_require__(/*! ./helpers/keyCodes */ 44); const ReactDOM = __importStar(__webpack_require__(/*! react-dom */ 21)); exports.yesNoBoxOpen = false; const yesNoBoxContainer = document.getElementById("yes-no-box-container"); const yesNoBoxTextElement = document.getElementById("yes-no-box-text"); function yesNoBoxHotkeyHandler(e) { if (e.keyCode === keyCodes_1.KEY.ESC) { yesNoBoxClose(); } else if (e.keyCode === keyCodes_1.KEY.ENTER) { const yesBtn = document.getElementById("yes-no-box-yes"); if (yesBtn) { yesBtn.click(); } else { console.error(`Could not find YesNoBox Yes button DOM element`); } } } function yesNoBoxClose() { if (yesNoBoxContainer) { yesNoBoxContainer.style.display = "none"; } else { console.error("Container not found for YesNoBox"); } exports.yesNoBoxOpen = false; // Remove hotkey handler document.removeEventListener("keydown", yesNoBoxHotkeyHandler); return false; //So that 'return yesNoBoxClose()' is return false in event listeners } exports.yesNoBoxClose = yesNoBoxClose; function yesNoBoxGetYesButton() { return clearEventListeners_1.clearEventListeners("yes-no-box-yes"); } exports.yesNoBoxGetYesButton = yesNoBoxGetYesButton; function yesNoBoxGetNoButton() { return clearEventListeners_1.clearEventListeners("yes-no-box-no"); } exports.yesNoBoxGetNoButton = yesNoBoxGetNoButton; function yesNoBoxCreate(txt) { if (exports.yesNoBoxOpen) { return false; } //Already open exports.yesNoBoxOpen = true; if (yesNoBoxTextElement) { ReactDOM.unmountComponentAtNode(yesNoBoxTextElement); yesNoBoxTextElement.innerHTML = ''; if (typeof txt === 'string') { yesNoBoxTextElement.innerHTML = txt; } else { ReactDOM.render(txt, yesNoBoxTextElement); } } else { console.error(`Text element not found for YesNoBox`); } if (yesNoBoxContainer) { yesNoBoxContainer.style.display = "flex"; } else { console.error("Container not found for YesNoBox"); } // Add event listener for Esc and Enter hotkeys document.addEventListener("keydown", yesNoBoxHotkeyHandler); return true; } exports.yesNoBoxCreate = yesNoBoxCreate; /** * Yes-No pop up box with text input field */ const yesNoTextInputBoxContainer = document.getElementById("yes-no-text-input-box-container"); const yesNoTextInputBoxInput = document.getElementById("yes-no-text-input-box-input"); const yesNoTextInputBoxTextElement = document.getElementById("yes-no-text-input-box-text"); function yesNoTxtInpBoxHotkeyHandler(e) { if (e.keyCode === keyCodes_1.KEY.ESC) { yesNoTxtInpBoxClose(); } else if (e.keyCode === keyCodes_1.KEY.ENTER) { const yesBtn = document.getElementById("yes-no-text-input-box-yes"); if (yesBtn) { yesBtn.click(); } else { console.error(`Could not find YesNoTxtInputBox Yes button DOM element`); } } } exports.yesNoTxtInpBoxHotkeyHandler = yesNoTxtInpBoxHotkeyHandler; function yesNoTxtInpBoxClose() { if (yesNoTextInputBoxContainer != null) { yesNoTextInputBoxContainer.style.display = "none"; } else { console.error("Container not found for YesNoTextInputBox"); return false; } if (!yesNoTextInputBoxInput) throw new Error("yesNoTextInputBoxInput was not set"); exports.yesNoBoxOpen = false; yesNoTextInputBoxInput.value = ""; // Remove hotkey handler document.removeEventListener("keydown", yesNoTxtInpBoxHotkeyHandler); return false; } exports.yesNoTxtInpBoxClose = yesNoTxtInpBoxClose; function yesNoTxtInpBoxGetYesButton() { const elem = clearEventListeners_1.clearEventListeners("yes-no-text-input-box-yes"); if (elem === null) throw new Error("Could not find element with id: 'yes-no-text-input-box-yes'"); return elem; } exports.yesNoTxtInpBoxGetYesButton = yesNoTxtInpBoxGetYesButton; function yesNoTxtInpBoxGetNoButton() { const elem = clearEventListeners_1.clearEventListeners("yes-no-text-input-box-no"); if (elem === null) throw new Error("Could not find element with id: 'yes-no-text-input-box-no'"); return elem; } exports.yesNoTxtInpBoxGetNoButton = yesNoTxtInpBoxGetNoButton; function yesNoTxtInpBoxGetInput() { if (!yesNoTextInputBoxInput) { console.error("Could not find YesNoTextInputBox input element"); return ""; } let val = yesNoTextInputBoxInput.value; val = val.replace(/\s+/g, ''); return val; } exports.yesNoTxtInpBoxGetInput = yesNoTxtInpBoxGetInput; function yesNoTxtInpBoxCreate(txt) { exports.yesNoBoxOpen = true; if (yesNoTextInputBoxTextElement) { ReactDOM.unmountComponentAtNode(yesNoTextInputBoxTextElement); yesNoTextInputBoxTextElement.innerHTML = ''; if (typeof txt === 'string') { yesNoTextInputBoxTextElement.innerHTML = txt; } else { ReactDOM.render(txt, yesNoTextInputBoxTextElement); } } if (yesNoTextInputBoxContainer) { yesNoTextInputBoxContainer.style.display = "flex"; } else { console.error("Container not found for YesNoTextInputBox"); } // Add event listener for Esc and Enter hotkeys document.addEventListener("keydown", yesNoTxtInpBoxHotkeyHandler); if (!yesNoTextInputBoxInput) throw new Error("yesNoTextInputBoxInput was not set"); yesNoTextInputBoxInput.focus(); } exports.yesNoTxtInpBoxCreate = yesNoTxtInpBoxCreate; /***/ }), /* 62 */, /* 63 */, /* 64 */, /* 65 */, /* 66 */ /*!***************************************!*\ !*** ./src/Script/ScriptHelpersTS.ts ***! \***************************************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isScriptFilename = void 0; // Script helper functions function isScriptFilename(f) { return f.endsWith(".js") || f.endsWith(".script") || f.endsWith(".ns"); } exports.isScriptFilename = isScriptFilename; /***/ }), /* 67 */ /*!**********************!*\ !*** ./src/Alias.ts ***! \**********************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.substituteAliases = exports.removeAlias = exports.parseAliasDeclaration = exports.printAliases = exports.loadGlobalAliases = exports.loadAliases = exports.GlobalAliases = exports.Aliases = void 0; const postToTerminal_1 = __webpack_require__(/*! ./ui/postToTerminal */ 8); exports.Aliases = {}; exports.GlobalAliases = {}; function loadAliases(saveString) { if (saveString === "") { exports.Aliases = {}; } else { exports.Aliases = JSON.parse(saveString); } } exports.loadAliases = loadAliases; function loadGlobalAliases(saveString) { if (saveString === "") { exports.GlobalAliases = {}; } else { exports.GlobalAliases = JSON.parse(saveString); } } exports.loadGlobalAliases = loadGlobalAliases; // Prints all aliases to terminal function printAliases() { for (const name in exports.Aliases) { if (exports.Aliases.hasOwnProperty(name)) { postToTerminal_1.post("alias " + name + "=" + exports.Aliases[name]); } } for (const name in exports.GlobalAliases) { if (exports.GlobalAliases.hasOwnProperty(name)) { postToTerminal_1.post("global alias " + name + "=" + exports.GlobalAliases[name]); } } } exports.printAliases = printAliases; // Returns true if successful, false otherwise function parseAliasDeclaration(dec, global = false) { const re = /^([_|\w|!|%|,|@]+)="(.+)"$/; const matches = dec.match(re); if (matches == null || matches.length != 3) { return false; } if (global) { addGlobalAlias(matches[1], matches[2]); } else { addAlias(matches[1], matches[2]); } return true; } exports.parseAliasDeclaration = parseAliasDeclaration; function addAlias(name, value) { if (name in exports.GlobalAliases) { delete exports.GlobalAliases[name]; } exports.Aliases[name] = value.trim(); } function addGlobalAlias(name, value) { if (name in exports.Aliases) { delete exports.Aliases[name]; } exports.GlobalAliases[name] = value.trim(); } function getAlias(name) { if (exports.Aliases.hasOwnProperty(name)) { return exports.Aliases[name]; } return null; } function getGlobalAlias(name) { if (exports.GlobalAliases.hasOwnProperty(name)) { return exports.GlobalAliases[name]; } return null; } function removeAlias(name) { if (exports.Aliases.hasOwnProperty(name)) { delete exports.Aliases[name]; return true; } if (exports.GlobalAliases.hasOwnProperty(name)) { delete exports.GlobalAliases[name]; return true; } return false; } exports.removeAlias = removeAlias; /** * Returns the original string with any aliases substituted in. * Aliases are only applied to "whole words", one level deep */ function substituteAliases(origCommand) { var _a, _b; const commandArray = origCommand.split(" "); if (commandArray.length > 0) { // For the alias and unalias commands, dont substite if (commandArray[0] === "unalias" || commandArray[0] === "alias") { return commandArray.join(" "); } let somethingSubstituted = true; let depth = 0; while (somethingSubstituted && depth < 10) { depth++; somethingSubstituted = false; const alias = (_a = getAlias(commandArray[0])) === null || _a === void 0 ? void 0 : _a.split(" "); if (alias != null) { somethingSubstituted = true; commandArray.splice(0, 1, ...alias); //commandArray[0] = alias; } for (let i = 0; i < commandArray.length; ++i) { const alias = (_b = getGlobalAlias(commandArray[i])) === null || _b === void 0 ? void 0 : _b.split(" "); if (alias != null) { somethingSubstituted = true; commandArray.splice(i, 1, ...alias); i += alias.length - 1; //commandArray[i] = alias; } } } } return commandArray.join(" "); } exports.substituteAliases = substituteAliases; /***/ }), /* 68 */ /*!***********************************!*\ !*** ./src/NetscriptEvaluator.js ***! \***********************************/ /*! exports provided: netscriptDelay, makeRuntimeRejectMsg, resolveNetscriptRequestedThreads, getErrorLineNumber, isScriptErrorMessage */ /*! exports used: isScriptErrorMessage, makeRuntimeRejectMsg, netscriptDelay, resolveNetscriptRequestedThreads */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return netscriptDelay; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return makeRuntimeRejectMsg; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return resolveNetscriptRequestedThreads; }); /* unused harmony export getErrorLineNumber */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return isScriptErrorMessage; }); /* harmony import */ var _utils_SetTimeoutRef__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils/SetTimeoutRef */ 76); /* harmony import */ var _utils_SetTimeoutRef__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_utils_SetTimeoutRef__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _utils_helpers_isString__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/helpers/isString */ 72); /* harmony import */ var _utils_helpers_isString__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_utils_helpers_isString__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _Server_AllServers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Server/AllServers */ 20); /* harmony import */ var _Server_AllServers__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_Server_AllServers__WEBPACK_IMPORTED_MODULE_2__); function netscriptDelay(time, workerScript) { return new Promise(function(resolve) { workerScript.delay = Object(_utils_SetTimeoutRef__WEBPACK_IMPORTED_MODULE_0__["setTimeoutRef"])(() => { workerScript.delay = null; resolve(); }, time); workerScript.delayResolve = resolve; }); } function makeRuntimeRejectMsg(workerScript, msg, exp=null) { var lineNum = ""; if (exp != null) { var num = getErrorLineNumber(exp, workerScript); lineNum = " (Line " + num + ")" } const server = _Server_AllServers__WEBPACK_IMPORTED_MODULE_2__["AllServers"][workerScript.serverIp]; if (server == null) { throw new Error(`WorkerScript constructed with invalid server ip: ${this.serverIp}`); } return "|"+server.hostname+"|"+workerScript.name+"|" + msg + lineNum; } function resolveNetscriptRequestedThreads(workerScript, functionName, requestedThreads) { const threads = workerScript.scriptRef.threads; if (!requestedThreads) { return (isNaN(threads) || threads < 1) ? 1 : threads; } const requestedThreadsAsInt = requestedThreads|0; if (isNaN(requestedThreads) || requestedThreadsAsInt < 1) { throw makeRuntimeRejectMsg(workerScript, `Invalid thread count passed to ${functionName}: ${requestedThreads}. Threads must be a positive number.`); } if (requestedThreads > threads) { throw makeRuntimeRejectMsg(workerScript, `Too many threads requested by ${functionName}. Requested: ${requestedThreads}. Has: ${threads}.`); } return requestedThreadsAsInt; } function getErrorLineNumber(exp, workerScript) { var code = workerScript.scriptRef.codeCode(); //Split code up to the start of the node try { code = code.substring(0, exp.start); return (code.match(/\n/g) || []).length + 1; } catch(e) { return -1; } } function isScriptErrorMessage(msg) { if (!Object(_utils_helpers_isString__WEBPACK_IMPORTED_MODULE_1__["isString"])(msg)) {return false;} let splitMsg = msg.split("|"); if (splitMsg.length != 4){ return false; } return true; } /***/ }), /* 69 */, /* 70 */ /*!*******************************************!*\ !*** ./src/Netscript/killWorkerScript.ts ***! \*******************************************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.killWorkerScript = void 0; /** * Stops an actively-running script (represented by a WorkerScript object) * and removes it from the global pool of active scripts. */ const WorkerScript_1 = __webpack_require__(/*! ./WorkerScript */ 247); const WorkerScripts_1 = __webpack_require__(/*! ./WorkerScripts */ 112); const WorkerScriptStartStopEventEmitter_1 = __webpack_require__(/*! ./WorkerScriptStartStopEventEmitter */ 147); const RunningScript_1 = __webpack_require__(/*! ../Script/RunningScript */ 194); const AllServers_1 = __webpack_require__(/*! ../Server/AllServers */ 20); const compareArrays_1 = __webpack_require__(/*! ../../utils/helpers/compareArrays */ 195); const roundToTwo_1 = __webpack_require__(/*! ../../utils/helpers/roundToTwo */ 290); function killWorkerScript(script, serverIp, rerenderUi) { if (rerenderUi == null || typeof rerenderUi !== "boolean") { rerenderUi = true; } if (script instanceof WorkerScript_1.WorkerScript) { stopAndCleanUpWorkerScript(script); return true; } else if (script instanceof RunningScript_1.RunningScript && typeof serverIp === "string") { // Try to kill by PID const res = killWorkerScriptByPid(script.pid, rerenderUi); if (res) { return res; } // If for some reason that doesn't work, we'll try the old way for (const ws of WorkerScripts_1.workerScripts.values()) { if (ws.name == script.filename && ws.serverIp == serverIp && compareArrays_1.compareArrays(ws.args, script.args)) { stopAndCleanUpWorkerScript(ws, rerenderUi); return true; } } return false; } else if (typeof script === "number") { return killWorkerScriptByPid(script, rerenderUi); } else { console.error(`killWorkerScript() called with invalid argument:`); console.error(script); return false; } } exports.killWorkerScript = killWorkerScript; function killWorkerScriptByPid(pid, rerenderUi = true) { const ws = WorkerScripts_1.workerScripts.get(pid); if (ws instanceof WorkerScript_1.WorkerScript) { stopAndCleanUpWorkerScript(ws, rerenderUi); return true; } return false; } function stopAndCleanUpWorkerScript(workerScript, rerenderUi = true) { workerScript.env.stopFlag = true; killNetscriptDelay(workerScript); removeWorkerScript(workerScript, rerenderUi); } /** * Helper function that removes the script being killed from the global pool. * Also handles other cleanup-time operations * * @param {WorkerScript | number} - Identifier for WorkerScript. Either the object itself, or * its index in the global workerScripts array */ function removeWorkerScript(workerScript, rerenderUi = true) { if (workerScript instanceof WorkerScript_1.WorkerScript) { const ip = workerScript.serverIp; const name = workerScript.name; // Get the server on which the script runs const server = AllServers_1.AllServers[ip]; if (server == null) { console.error(`Could not find server on which this script is running: ${ip}`); return; } // Recalculate ram used on that server server.ramUsed = roundToTwo_1.roundToTwo(server.ramUsed - workerScript.ramUsage); if (server.ramUsed < 0) { console.warn(`Server (${server.hostname}) RAM usage went negative (if it's due to floating pt imprecision, it's okay): ${server.ramUsed}`); server.ramUsed = 0; } // Delete the RunningScript object from that server for (let i = 0; i < server.runningScripts.length; ++i) { const runningScript = server.runningScripts[i]; if (runningScript.filename === name && compareArrays_1.compareArrays(runningScript.args, workerScript.args)) { server.runningScripts.splice(i, 1); break; } } // Delete script from global pool (workerScripts) const res = WorkerScripts_1.workerScripts.delete(workerScript.pid); if (!res) { console.warn(`removeWorkerScript() called with WorkerScript that wasn't in the global map:`); console.warn(workerScript); } if (rerenderUi) { WorkerScriptStartStopEventEmitter_1.WorkerScriptStartStopEventEmitter.emitEvent(); } } else { console.error(`Invalid argument passed into removeWorkerScript():`); console.error(workerScript); return; } } /** * Helper function that interrupts a script's delay if it is in the middle of a * timed, blocked operation (like hack(), sleep(), etc.). This allows scripts to * be killed immediately even if they're in the middle of one of those long operations */ function killNetscriptDelay(workerScript) { if (workerScript instanceof WorkerScript_1.WorkerScript) { if (workerScript.delay) { clearTimeout(workerScript.delay); if (workerScript.delayResolve) { workerScript.delayResolve(); } } } } /***/ }), /* 71 */ /*!****************************************!*\ !*** ./src/Faction/FactionHelpers.jsx ***! \****************************************/ /*! exports provided: inviteToFaction, joinFaction, startHackingMission, displayFactionContent, purchaseAugmentationBoxCreate, hasAugmentationPrereqs, purchaseAugmentation, getNextNeurofluxLevel, processPassiveFactionRepGain */ /*! all exports used */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inviteToFaction", function() { return inviteToFaction; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "joinFaction", function() { return joinFaction; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "startHackingMission", function() { return startHackingMission; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "displayFactionContent", function() { return displayFactionContent; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "purchaseAugmentationBoxCreate", function() { return purchaseAugmentationBoxCreate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hasAugmentationPrereqs", function() { return hasAugmentationPrereqs; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "purchaseAugmentation", function() { return purchaseAugmentation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getNextNeurofluxLevel", function() { return getNextNeurofluxLevel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "processPassiveFactionRepGain", function() { return processPassiveFactionRepGain; }); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 0); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ 21); /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _ui_Root__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ui/Root */ 791); /* harmony import */ var _ui_Root__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_ui_Root__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var _Augmentation_Augmentations__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Augmentation/Augmentations */ 12); /* harmony import */ var _Augmentation_Augmentations__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_Augmentation_Augmentations__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var _Augmentation_AugmentationHelpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Augmentation/AugmentationHelpers */ 79); /* harmony import */ var _Augmentation_PlayerOwnedAugmentation__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Augmentation/PlayerOwnedAugmentation */ 196); /* harmony import */ var _Augmentation_PlayerOwnedAugmentation__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_Augmentation_PlayerOwnedAugmentation__WEBPACK_IMPORTED_MODULE_5__); /* harmony import */ var _Augmentation_data_AugmentationNames__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Augmentation/data/AugmentationNames */ 4); /* harmony import */ var _Augmentation_data_AugmentationNames__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_Augmentation_data_AugmentationNames__WEBPACK_IMPORTED_MODULE_6__); /* harmony import */ var _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../BitNode/BitNodeMultipliers */ 19); /* harmony import */ var _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_7__); /* harmony import */ var _Constants__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Constants */ 11); /* harmony import */ var _Constants__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_Constants__WEBPACK_IMPORTED_MODULE_8__); /* harmony import */ var _engine__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../engine */ 15); /* harmony import */ var _Faction__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./Faction */ 125); /* harmony import */ var _Faction__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_Faction__WEBPACK_IMPORTED_MODULE_10__); /* harmony import */ var _Factions__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./Factions */ 17); /* harmony import */ var _Factions__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(_Factions__WEBPACK_IMPORTED_MODULE_11__); /* harmony import */ var _Missions__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../Missions */ 81); /* harmony import */ var _Player__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../Player */ 2); /* harmony import */ var _Settings_Settings__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../Settings/Settings */ 24); /* harmony import */ var _Settings_Settings__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(_Settings_Settings__WEBPACK_IMPORTED_MODULE_14__); /* harmony import */ var _PersonObjects_formulas_reputation__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../PersonObjects/formulas/reputation */ 109); /* harmony import */ var _PersonObjects_formulas_reputation__WEBPACK_IMPORTED_MODULE_15___default = /*#__PURE__*/__webpack_require__.n(_PersonObjects_formulas_reputation__WEBPACK_IMPORTED_MODULE_15__); /* harmony import */ var _SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../SourceFile/SourceFileFlags */ 37); /* harmony import */ var _SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_16___default = /*#__PURE__*/__webpack_require__.n(_SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_16__); /* harmony import */ var _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../ui/navigationTracking */ 18); /* harmony import */ var _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_17___default = /*#__PURE__*/__webpack_require__.n(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_17__); /* harmony import */ var _utils_DialogBox__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../../utils/DialogBox */ 13); /* harmony import */ var _utils_DialogBox__WEBPACK_IMPORTED_MODULE_18___default = /*#__PURE__*/__webpack_require__.n(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_18__); /* harmony import */ var _utils_FactionInvitationBox__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../../utils/FactionInvitationBox */ 790); /* harmony import */ var _ui_React_Money__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../ui/React/Money */ 27); /* harmony import */ var _ui_React_Money__WEBPACK_IMPORTED_MODULE_20___default = /*#__PURE__*/__webpack_require__.n(_ui_React_Money__WEBPACK_IMPORTED_MODULE_20__); /* harmony import */ var _utils_YesNoBox__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../../utils/YesNoBox */ 61); /* harmony import */ var _utils_YesNoBox__WEBPACK_IMPORTED_MODULE_21___default = /*#__PURE__*/__webpack_require__.n(_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_21__); function inviteToFaction(faction) { if (_Settings_Settings__WEBPACK_IMPORTED_MODULE_14__["Settings"].SuppressFactionInvites) { faction.alreadyInvited = true; _Player__WEBPACK_IMPORTED_MODULE_13__["Player"].factionInvitations.push(faction.name); if (_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_17__["routing"].isOn(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_17__["Page"].Factions)) { _engine__WEBPACK_IMPORTED_MODULE_9__["Engine"].loadFactionsContent(); } } else { Object(_utils_FactionInvitationBox__WEBPACK_IMPORTED_MODULE_19__[/* factionInvitationBoxCreate */ "a"])(faction); } } function joinFaction(faction) { if (faction.isMember) return; faction.isMember = true; _Player__WEBPACK_IMPORTED_MODULE_13__["Player"].factions.push(faction.name); const factionInfo = faction.getInfo(); //Determine what factions you are banned from now that you have joined this faction for (const i in factionInfo.enemies) { const enemy = factionInfo.enemies[i]; if (_Factions__WEBPACK_IMPORTED_MODULE_11__["Factions"][enemy] instanceof _Faction__WEBPACK_IMPORTED_MODULE_10__["Faction"]) { _Factions__WEBPACK_IMPORTED_MODULE_11__["Factions"][enemy].isBanned = true; } } for (var i = 0; i < _Player__WEBPACK_IMPORTED_MODULE_13__["Player"].factionInvitations.length; ++i) { if (_Player__WEBPACK_IMPORTED_MODULE_13__["Player"].factionInvitations[i] == faction.name || _Factions__WEBPACK_IMPORTED_MODULE_11__["Factions"][_Player__WEBPACK_IMPORTED_MODULE_13__["Player"].factionInvitations[i]].isBanned) { _Player__WEBPACK_IMPORTED_MODULE_13__["Player"].factionInvitations.splice(i, 1); i--; } } } function startHackingMission(faction) { const mission = new _Missions__WEBPACK_IMPORTED_MODULE_12__[/* HackingMission */ "a"](faction.playerReputation, faction); Object(_Missions__WEBPACK_IMPORTED_MODULE_12__[/* setInMission */ "d"])(true, mission); //Sets inMission flag to true mission.init(); } //Displays the HTML content for a specific faction function displayFactionContent(factionName, initiallyOnAugmentationsPage = false) { const faction = _Factions__WEBPACK_IMPORTED_MODULE_11__["Factions"][factionName]; if (faction == null) { throw new Error(`Invalid factionName passed into displayFactionContent(): ${factionName}`); } if (!faction.isMember) { throw new Error(`Not a member of this faction. Cannot display faction information`); } react_dom__WEBPACK_IMPORTED_MODULE_1___default.a.render(react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_ui_Root__WEBPACK_IMPORTED_MODULE_2__["FactionRoot"], { engine: _engine__WEBPACK_IMPORTED_MODULE_9__["Engine"], initiallyOnAugmentationsPage: initiallyOnAugmentationsPage, faction: faction, p: _Player__WEBPACK_IMPORTED_MODULE_13__["Player"], startHackingMissionFn: startHackingMission }), _engine__WEBPACK_IMPORTED_MODULE_9__["Engine"].Display.factionContent); } function purchaseAugmentationBoxCreate(aug, fac) { const factionInfo = fac.getInfo(); const yesBtn = Object(_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_21__["yesNoBoxGetYesButton"])(); yesBtn.innerHTML = "Purchase"; yesBtn.addEventListener("click", function () { if (!Object(_Augmentation_AugmentationHelpers__WEBPACK_IMPORTED_MODULE_4__[/* isRepeatableAug */ "f"])(aug) && _Player__WEBPACK_IMPORTED_MODULE_13__["Player"].hasAugmentation(aug)) { return; } purchaseAugmentation(aug, fac); Object(_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_21__["yesNoBoxClose"])(); }); const noBtn = Object(_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_21__["yesNoBoxGetNoButton"])(); noBtn.innerHTML = "Cancel"; noBtn.addEventListener("click", function () { Object(_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_21__["yesNoBoxClose"])(); }); let content = react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { dangerouslySetInnerHTML: { __html: aug.info } }); if (typeof aug.info !== 'string') { content = react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", null, aug.info); } Object(_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_21__["yesNoBoxCreate"])(react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0___default.a.Fragment, null, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("h2", null, aug.name), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br", null), content, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br", null), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br", null), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br", null), "Would you like to purchase the ", aug.name, " Augmentation for\xA0", Object(_ui_React_Money__WEBPACK_IMPORTED_MODULE_20__["Money"])(aug.baseCost * factionInfo.augmentationPriceMult), "?")); } //Returns a boolean indicating whether the player has the prerequisites for the //specified Augmentation function hasAugmentationPrereqs(aug) { let hasPrereqs = true; if (aug.prereqs && aug.prereqs.length > 0) { for (let i = 0; i < aug.prereqs.length; ++i) { const prereqAug = _Augmentation_Augmentations__WEBPACK_IMPORTED_MODULE_3__["Augmentations"][aug.prereqs[i]]; if (prereqAug == null) { console.error(`Invalid prereq Augmentation ${aug.prereqs[i]}`); continue; } if (prereqAug.owned === false) { hasPrereqs = false; // Check if the aug is purchased for (let j = 0; j < _Player__WEBPACK_IMPORTED_MODULE_13__["Player"].queuedAugmentations.length; ++j) { if (_Player__WEBPACK_IMPORTED_MODULE_13__["Player"].queuedAugmentations[j].name === prereqAug.name) { hasPrereqs = true; break; } } } } } return hasPrereqs; } function purchaseAugmentation(aug, fac, sing = false) { const factionInfo = fac.getInfo(); var hasPrereqs = hasAugmentationPrereqs(aug); if (!hasPrereqs) { var txt = "You must first purchase or install " + aug.prereqs.join(",") + " before you can " + "purchase this one."; if (sing) { return txt; } else { Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_18__["dialogBoxCreate"])(txt); } } else if (aug.baseCost !== 0 && _Player__WEBPACK_IMPORTED_MODULE_13__["Player"].money.lt(aug.baseCost * factionInfo.augmentationPriceMult)) { let txt = "You don't have enough money to purchase " + aug.name; if (sing) { return txt; } Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_18__["dialogBoxCreate"])(txt); } else if (fac.playerReputation < aug.baseRepRequirement) { let txt = "You don't have enough faction reputation to purchase " + aug.name; if (sing) { return txt; } Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_18__["dialogBoxCreate"])(txt); } else if (aug.baseCost === 0 || _Player__WEBPACK_IMPORTED_MODULE_13__["Player"].money.gte(aug.baseCost * factionInfo.augmentationPriceMult)) { if (_Player__WEBPACK_IMPORTED_MODULE_13__["Player"].firstAugPurchased === false) { _Player__WEBPACK_IMPORTED_MODULE_13__["Player"].firstAugPurchased = true; document.getElementById("augmentations-tab").style.display = "list-item"; document.getElementById("character-menu-header").click(); document.getElementById("character-menu-header").click(); } var queuedAugmentation = new _Augmentation_PlayerOwnedAugmentation__WEBPACK_IMPORTED_MODULE_5__["PlayerOwnedAugmentation"](aug.name); if (aug.name == _Augmentation_data_AugmentationNames__WEBPACK_IMPORTED_MODULE_6__["AugmentationNames"].NeuroFluxGovernor) { queuedAugmentation.level = getNextNeurofluxLevel(); } _Player__WEBPACK_IMPORTED_MODULE_13__["Player"].queuedAugmentations.push(queuedAugmentation); _Player__WEBPACK_IMPORTED_MODULE_13__["Player"].loseMoney(aug.baseCost * factionInfo.augmentationPriceMult); // If you just purchased Neuroflux Governor, recalculate the cost if (aug.name == _Augmentation_data_AugmentationNames__WEBPACK_IMPORTED_MODULE_6__["AugmentationNames"].NeuroFluxGovernor) { var nextLevel = getNextNeurofluxLevel(); --nextLevel; var mult = Math.pow(_Constants__WEBPACK_IMPORTED_MODULE_8__["CONSTANTS"].NeuroFluxGovernorLevelMult, nextLevel); aug.baseRepRequirement = 500 * mult * _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_7__["BitNodeMultipliers"].AugmentationRepCost; aug.baseCost = 750e3 * mult * _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_7__["BitNodeMultipliers"].AugmentationMoneyCost; for (var i = 0; i < _Player__WEBPACK_IMPORTED_MODULE_13__["Player"].queuedAugmentations.length - 1; ++i) { aug.baseCost *= _Constants__WEBPACK_IMPORTED_MODULE_8__["CONSTANTS"].MultipleAugMultiplier * [1, 0.96, 0.94, 0.93][_SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_16__["SourceFileFlags"][11]]; } } for (var name in _Augmentation_Augmentations__WEBPACK_IMPORTED_MODULE_3__["Augmentations"]) { if (_Augmentation_Augmentations__WEBPACK_IMPORTED_MODULE_3__["Augmentations"].hasOwnProperty(name)) { _Augmentation_Augmentations__WEBPACK_IMPORTED_MODULE_3__["Augmentations"][name].baseCost *= _Constants__WEBPACK_IMPORTED_MODULE_8__["CONSTANTS"].MultipleAugMultiplier * [1, 0.96, 0.94, 0.93][_SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_16__["SourceFileFlags"][11]]; } } if (sing) { return "You purchased " + aug.name; } else { if (!_Settings_Settings__WEBPACK_IMPORTED_MODULE_14__["Settings"].SuppressBuyAugmentationConfirmation) { Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_18__["dialogBoxCreate"])("You purchased " + aug.name + ". It's enhancements will not take " + "effect until they are installed. To install your augmentations, go to the " + "'Augmentations' tab on the left-hand navigation menu. Purchasing additional " + "augmentations will now be more expensive."); } } // Force a rerender of the Augmentations page displayFactionContent(fac.name, true); } else { Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_18__["dialogBoxCreate"])("Hmm, something went wrong when trying to purchase an Augmentation. " + "Please report this to the game developer with an explanation of how to " + "reproduce this."); } } function getNextNeurofluxLevel() { // Get current Neuroflux level based on Player's augmentations let currLevel = 0; for (var i = 0; i < _Player__WEBPACK_IMPORTED_MODULE_13__["Player"].augmentations.length; ++i) { if (_Player__WEBPACK_IMPORTED_MODULE_13__["Player"].augmentations[i].name === _Augmentation_data_AugmentationNames__WEBPACK_IMPORTED_MODULE_6__["AugmentationNames"].NeuroFluxGovernor) { currLevel = _Player__WEBPACK_IMPORTED_MODULE_13__["Player"].augmentations[i].level; } } // Account for purchased but uninstalled Augmentations for (var i = 0; i < _Player__WEBPACK_IMPORTED_MODULE_13__["Player"].queuedAugmentations.length; ++i) { if (_Player__WEBPACK_IMPORTED_MODULE_13__["Player"].queuedAugmentations[i].name == _Augmentation_data_AugmentationNames__WEBPACK_IMPORTED_MODULE_6__["AugmentationNames"].NeuroFluxGovernor) { ++currLevel; } } return currLevel + 1; } function processPassiveFactionRepGain(numCycles) { for (const name in _Factions__WEBPACK_IMPORTED_MODULE_11__["Factions"]) { if (name === _Player__WEBPACK_IMPORTED_MODULE_13__["Player"].currentWorkFactionName) continue; if (!_Factions__WEBPACK_IMPORTED_MODULE_11__["Factions"].hasOwnProperty(name)) continue; const faction = _Factions__WEBPACK_IMPORTED_MODULE_11__["Factions"][name]; if (!faction.isMember) continue; // No passive rep for special factions const info = faction.getInfo(); if (!info.offersWork()) continue; // No passive rep for gangs. if (_Player__WEBPACK_IMPORTED_MODULE_13__["Player"].getGangName() === name) continue; // 0 favor = 1%/s // 50 favor = 6%/s // 100 favor = 11%/s const favorMult = Math.min(0.1, faction.favor / 1000 + 0.01); // Find the best of all possible favor gain, minimum 1 rep / 2 minute. const hRep = Object(_PersonObjects_formulas_reputation__WEBPACK_IMPORTED_MODULE_15__["getHackingWorkRepGain"])(_Player__WEBPACK_IMPORTED_MODULE_13__["Player"], faction); const sRep = Object(_PersonObjects_formulas_reputation__WEBPACK_IMPORTED_MODULE_15__["getFactionSecurityWorkRepGain"])(_Player__WEBPACK_IMPORTED_MODULE_13__["Player"], faction); const fRep = Object(_PersonObjects_formulas_reputation__WEBPACK_IMPORTED_MODULE_15__["getFactionFieldWorkRepGain"])(_Player__WEBPACK_IMPORTED_MODULE_13__["Player"], faction); const rate = Math.max(hRep * favorMult, sRep * favorMult, fRep * favorMult, 1 / 120); faction.playerReputation += rate * numCycles * _Player__WEBPACK_IMPORTED_MODULE_13__["Player"].faction_rep_mult * _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_7__["BitNodeMultipliers"].FactionPassiveRepGain; } } /***/ }), /* 72 */ /*!***********************************!*\ !*** ./utils/helpers/isString.ts ***! \***********************************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isString = void 0; /** * Checks whether the value passed in can be considered a string. * @param value The value to check if it is a string. */ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types function isString(value) { return (typeof value === "string" || value instanceof String); } exports.isString = isString; /***/ }), /* 73 */ /*!********************************!*\ !*** ./src/Message/Message.ts ***! \********************************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Message = void 0; const JSONReviver_1 = __webpack_require__(/*! ../../utils/JSONReviver */ 29); class Message { constructor(filename = "", msg = "") { // Name of Message file this.filename = ""; // The text contains in the Message this.msg = ""; // Flag indicating whether this Message has been received by the player this.recvd = false; this.filename = filename; this.msg = msg; this.recvd = false; } // Serialize the current object to a JSON save state toJSON() { return JSONReviver_1.Generic_toJSON("Message", this); } // Initializes a Message Object from a JSON save state // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types static fromJSON(value) { return JSONReviver_1.Generic_fromJSON(Message, value.data); } } exports.Message = Message; JSONReviver_1.Reviver.constructors.Message = Message; /***/ }), /* 74 */ /*!**************************!*\ !*** ./src/Terminal.jsx ***! \**************************/ /*! exports provided: postNetburnerText, Terminal */ /*! exports used: Terminal, postNetburnerText */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return postNetburnerText; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Terminal; }); /* harmony import */ var _Terminal_DirectoryHelpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Terminal/DirectoryHelpers */ 86); /* harmony import */ var _Terminal_DirectoryHelpers__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_Terminal_DirectoryHelpers__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _Terminal_determineAllPossibilitiesForTabCompletion__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Terminal/determineAllPossibilitiesForTabCompletion */ 782); /* harmony import */ var _Terminal_determineAllPossibilitiesForTabCompletion__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_Terminal_determineAllPossibilitiesForTabCompletion__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _Terminal_HelpText__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Terminal/HelpText */ 458); /* harmony import */ var _Terminal_HelpText__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_Terminal_HelpText__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var _Terminal_tabCompletion__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Terminal/tabCompletion */ 781); /* harmony import */ var _Terminal_tabCompletion__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_Terminal_tabCompletion__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var _Fconf_Fconf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Fconf/Fconf */ 193); /* harmony import */ var _Alias__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Alias */ 67); /* harmony import */ var _Alias__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_Alias__WEBPACK_IMPORTED_MODULE_5__); /* harmony import */ var _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./BitNode/BitNodeMultipliers */ 19); /* harmony import */ var _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_6__); /* harmony import */ var _CodingContracts__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./CodingContracts */ 93); /* harmony import */ var _CodingContracts__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_CodingContracts__WEBPACK_IMPORTED_MODULE_7__); /* harmony import */ var _Constants__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Constants */ 11); /* harmony import */ var _Constants__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_Constants__WEBPACK_IMPORTED_MODULE_8__); /* harmony import */ var _Programs_Programs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./Programs/Programs */ 30); /* harmony import */ var _Programs_Programs__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_Programs_Programs__WEBPACK_IMPORTED_MODULE_9__); /* harmony import */ var _DarkWeb_DarkWeb__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./DarkWeb/DarkWeb */ 533); /* harmony import */ var _DarkWeb_DarkWeb__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_DarkWeb_DarkWeb__WEBPACK_IMPORTED_MODULE_10__); /* harmony import */ var _engine__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./engine */ 15); /* harmony import */ var _Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./Fconf/FconfSettings */ 39); /* harmony import */ var _Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(_Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_12__); /* harmony import */ var _Hacking__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./Hacking */ 50); /* harmony import */ var _Hacking__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(_Hacking__WEBPACK_IMPORTED_MODULE_13__); /* harmony import */ var _Hacknet_HacknetServer__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./Hacknet/HacknetServer */ 78); /* harmony import */ var _Hacknet_HacknetServer__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(_Hacknet_HacknetServer__WEBPACK_IMPORTED_MODULE_14__); /* harmony import */ var _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./InteractiveTutorial */ 43); /* harmony import */ var _Literature_LiteratureHelpers__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./Literature/LiteratureHelpers */ 523); /* harmony import */ var _Literature_LiteratureHelpers__WEBPACK_IMPORTED_MODULE_16___default = /*#__PURE__*/__webpack_require__.n(_Literature_LiteratureHelpers__WEBPACK_IMPORTED_MODULE_16__); /* harmony import */ var _Message_Message__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./Message/Message */ 73); /* harmony import */ var _Message_Message__WEBPACK_IMPORTED_MODULE_17___default = /*#__PURE__*/__webpack_require__.n(_Message_Message__WEBPACK_IMPORTED_MODULE_17__); /* harmony import */ var _Message_MessageHelpers__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./Message/MessageHelpers */ 87); /* harmony import */ var _NetscriptWorker__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./NetscriptWorker */ 80); /* harmony import */ var _Netscript_killWorkerScript__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./Netscript/killWorkerScript */ 70); /* harmony import */ var _Netscript_killWorkerScript__WEBPACK_IMPORTED_MODULE_20___default = /*#__PURE__*/__webpack_require__.n(_Netscript_killWorkerScript__WEBPACK_IMPORTED_MODULE_20__); /* harmony import */ var _Netscript_WorkerScriptStartStopEventEmitter__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./Netscript/WorkerScriptStartStopEventEmitter */ 147); /* harmony import */ var _Netscript_WorkerScriptStartStopEventEmitter__WEBPACK_IMPORTED_MODULE_21___default = /*#__PURE__*/__webpack_require__.n(_Netscript_WorkerScriptStartStopEventEmitter__WEBPACK_IMPORTED_MODULE_21__); /* harmony import */ var _Player__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./Player */ 2); /* harmony import */ var _RedPill__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./RedPill */ 103); /* harmony import */ var _Script_RunningScript__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./Script/RunningScript */ 194); /* harmony import */ var _Script_RunningScript__WEBPACK_IMPORTED_MODULE_24___default = /*#__PURE__*/__webpack_require__.n(_Script_RunningScript__WEBPACK_IMPORTED_MODULE_24__); /* harmony import */ var _utils_helpers_compareArrays__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ../utils/helpers/compareArrays */ 195); /* harmony import */ var _utils_helpers_compareArrays__WEBPACK_IMPORTED_MODULE_25___default = /*#__PURE__*/__webpack_require__.n(_utils_helpers_compareArrays__WEBPACK_IMPORTED_MODULE_25__); /* harmony import */ var _Script_RunningScriptHelpers__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./Script/RunningScriptHelpers */ 444); /* harmony import */ var _Script_RunningScriptHelpers__WEBPACK_IMPORTED_MODULE_26___default = /*#__PURE__*/__webpack_require__.n(_Script_RunningScriptHelpers__WEBPACK_IMPORTED_MODULE_26__); /* harmony import */ var _Script_ScriptHelpers__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./Script/ScriptHelpers */ 120); /* harmony import */ var _Script_ScriptHelpersTS__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./Script/ScriptHelpersTS */ 66); /* harmony import */ var _Script_ScriptHelpersTS__WEBPACK_IMPORTED_MODULE_28___default = /*#__PURE__*/__webpack_require__.n(_Script_ScriptHelpersTS__WEBPACK_IMPORTED_MODULE_28__); /* harmony import */ var _Server_AllServers__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./Server/AllServers */ 20); /* harmony import */ var _Server_AllServers__WEBPACK_IMPORTED_MODULE_29___default = /*#__PURE__*/__webpack_require__.n(_Server_AllServers__WEBPACK_IMPORTED_MODULE_29__); /* harmony import */ var _Server_ServerHelpers__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./Server/ServerHelpers */ 22); /* harmony import */ var _Server_ServerHelpers__WEBPACK_IMPORTED_MODULE_30___default = /*#__PURE__*/__webpack_require__.n(_Server_ServerHelpers__WEBPACK_IMPORTED_MODULE_30__); /* harmony import */ var _Server_SpecialServerIps__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./Server/SpecialServerIps */ 38); /* harmony import */ var _Server_SpecialServerIps__WEBPACK_IMPORTED_MODULE_31___default = /*#__PURE__*/__webpack_require__.n(_Server_SpecialServerIps__WEBPACK_IMPORTED_MODULE_31__); /* harmony import */ var _utils_SetTimeoutRef__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./utils/SetTimeoutRef */ 76); /* harmony import */ var _utils_SetTimeoutRef__WEBPACK_IMPORTED_MODULE_32___default = /*#__PURE__*/__webpack_require__.n(_utils_SetTimeoutRef__WEBPACK_IMPORTED_MODULE_32__); /* harmony import */ var _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./ui/navigationTracking */ 18); /* harmony import */ var _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_33___default = /*#__PURE__*/__webpack_require__.n(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_33__); /* harmony import */ var _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ./ui/numeralFormat */ 7); /* harmony import */ var _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_34___default = /*#__PURE__*/__webpack_require__.n(_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_34__); /* harmony import */ var _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ../utils/helpers/keyCodes */ 44); /* harmony import */ var _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35___default = /*#__PURE__*/__webpack_require__.n(_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__); /* harmony import */ var _utils_helpers_arrayToString__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ../utils/helpers/arrayToString */ 113); /* harmony import */ var _utils_helpers_arrayToString__WEBPACK_IMPORTED_MODULE_36___default = /*#__PURE__*/__webpack_require__.n(_utils_helpers_arrayToString__WEBPACK_IMPORTED_MODULE_36__); /* harmony import */ var _utils_helpers_getTimestamp__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! ../utils/helpers/getTimestamp */ 409); /* harmony import */ var _utils_helpers_getTimestamp__WEBPACK_IMPORTED_MODULE_37___default = /*#__PURE__*/__webpack_require__.n(_utils_helpers_getTimestamp__WEBPACK_IMPORTED_MODULE_37__); /* harmony import */ var _utils_LogBox__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(/*! ../utils/LogBox */ 151); /* harmony import */ var _utils_LogBox__WEBPACK_IMPORTED_MODULE_38___default = /*#__PURE__*/__webpack_require__.n(_utils_LogBox__WEBPACK_IMPORTED_MODULE_38__); /* harmony import */ var _utils_YesNoBox__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(/*! ../utils/YesNoBox */ 61); /* harmony import */ var _utils_YesNoBox__WEBPACK_IMPORTED_MODULE_39___default = /*#__PURE__*/__webpack_require__.n(_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_39__); /* harmony import */ var _ui_postToTerminal__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(/*! ./ui/postToTerminal */ 8); /* harmony import */ var _ui_postToTerminal__WEBPACK_IMPORTED_MODULE_40___default = /*#__PURE__*/__webpack_require__.n(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_40__); /* harmony import */ var _utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(/*! ../utils/StringHelperFunctions */ 23); /* harmony import */ var _utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_41___default = /*#__PURE__*/__webpack_require__.n(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_41__); /* harmony import */ var _ui_React_Money__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(/*! ./ui/React/Money */ 27); /* harmony import */ var _ui_React_Money__WEBPACK_IMPORTED_MODULE_42___default = /*#__PURE__*/__webpack_require__.n(_ui_React_Money__WEBPACK_IMPORTED_MODULE_42__); /* harmony import */ var autosize__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(/*! autosize */ 780); /* harmony import */ var autosize__WEBPACK_IMPORTED_MODULE_43___default = /*#__PURE__*/__webpack_require__.n(autosize__WEBPACK_IMPORTED_MODULE_43__); /* harmony import */ var jszip__WEBPACK_IMPORTED_MODULE_44__ = __webpack_require__(/*! jszip */ 779); /* harmony import */ var jszip__WEBPACK_IMPORTED_MODULE_44___default = /*#__PURE__*/__webpack_require__.n(jszip__WEBPACK_IMPORTED_MODULE_44__); /* harmony import */ var file_saver__WEBPACK_IMPORTED_MODULE_45__ = __webpack_require__(/*! file-saver */ 778); /* harmony import */ var file_saver__WEBPACK_IMPORTED_MODULE_45___default = /*#__PURE__*/__webpack_require__.n(file_saver__WEBPACK_IMPORTED_MODULE_45__); /* harmony import */ var arg__WEBPACK_IMPORTED_MODULE_46__ = __webpack_require__(/*! arg */ 445); /* harmony import */ var arg__WEBPACK_IMPORTED_MODULE_46___default = /*#__PURE__*/__webpack_require__.n(arg__WEBPACK_IMPORTED_MODULE_46__); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_47__ = __webpack_require__(/*! react */ 0); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_47___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_47__); /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_48__ = __webpack_require__(/*! react-dom */ 21); /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_48___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_48__); function postNetburnerText() { Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_40__["post"])("Bitburner v" + _Constants__WEBPACK_IMPORTED_MODULE_8__["CONSTANTS"].Version); } // Helper function that checks if an argument (which is a string) is a valid number function isNumber(str) { if (typeof str != "string") { return false; } // Only process strings return !isNaN(str) && !isNaN(parseFloat(str)); } function getTerminalInput() { return document.getElementById("terminal-input-text-box").value; } // Defines key commands in terminal $(document).keydown(function (event) { // Terminal if (_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_33__["routing"].isOn(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_33__["Page"].Terminal)) { var terminalInput = document.getElementById("terminal-input-text-box"); if (terminalInput != null && !event.ctrlKey && !event.shiftKey && !Terminal.contractOpen) { terminalInput.focus(); } if (event.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__["KEY"].ENTER) { event.preventDefault(); // Prevent newline from being entered in Script Editor const command = getTerminalInput(); const dir = Terminal.currDir; Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_40__["post"])("[" + (_Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_12__["FconfSettings"].ENABLE_TIMESTAMPS ? Object(_utils_helpers_getTimestamp__WEBPACK_IMPORTED_MODULE_37__["getTimestamp"])() + " " : "") + _Player__WEBPACK_IMPORTED_MODULE_22__["Player"].getCurrentServer().hostname + ` ~${dir}]> ${command}`); if (command.length > 0) { Terminal.resetTerminalInput(); // Clear input first Terminal.executeCommands(command); } } if (event.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__["KEY"].C && event.ctrlKey) { if (_engine__WEBPACK_IMPORTED_MODULE_11__["Engine"]._actionInProgress) { // Cancel action Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_40__["post"])("Cancelling..."); _engine__WEBPACK_IMPORTED_MODULE_11__["Engine"]._actionInProgress = false; Terminal.finishAction(true); } else if (_Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_12__["FconfSettings"].ENABLE_BASH_HOTKEYS) { // Dont prevent default so it still copies Terminal.resetTerminalInput(); // Clear Terminal } } if (event.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__["KEY"].L && event.ctrlKey) { event.preventDefault(); Terminal.executeCommand("clear"); // Clear screen } // Ctrl p same as up arrow // Ctrl n same as down arrow if (event.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__["KEY"].UPARROW || _Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_12__["FconfSettings"].ENABLE_BASH_HOTKEYS && event.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__["KEY"].P && event.ctrlKey) { if (_Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_12__["FconfSettings"].ENABLE_BASH_HOTKEYS) { event.preventDefault(); } // Cycle through past commands if (terminalInput == null) { return; } var i = Terminal.commandHistoryIndex; var len = Terminal.commandHistory.length; if (len == 0) { return; } if (i < 0 || i > len) { Terminal.commandHistoryIndex = len; } if (i != 0) { --Terminal.commandHistoryIndex; } var prevCommand = Terminal.commandHistory[Terminal.commandHistoryIndex]; terminalInput.value = prevCommand; Object(_utils_SetTimeoutRef__WEBPACK_IMPORTED_MODULE_32__["setTimeoutRef"])(function () { terminalInput.selectionStart = terminalInput.selectionEnd = 10000; }, 10); } if (event.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__["KEY"].DOWNARROW || _Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_12__["FconfSettings"].ENABLE_BASH_HOTKEYS && event.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__["KEY"].M && event.ctrlKey) { if (_Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_12__["FconfSettings"].ENABLE_BASH_HOTKEYS) { event.preventDefault(); } // Cycle through past commands if (terminalInput == null) { return; } var i = Terminal.commandHistoryIndex; var len = Terminal.commandHistory.length; if (len == 0) { return; } if (i < 0 || i > len) { Terminal.commandHistoryIndex = len; } // Latest command, put nothing if (i == len || i == len - 1) { Terminal.commandHistoryIndex = len; terminalInput.value = ""; } else { ++Terminal.commandHistoryIndex; var prevCommand = Terminal.commandHistory[Terminal.commandHistoryIndex]; terminalInput.value = prevCommand; } } if (event.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__["KEY"].TAB) { event.preventDefault(); // Autocomplete if (terminalInput == null) { return; } let input = terminalInput.value; if (input == "") { return; } const semiColonIndex = input.lastIndexOf(";"); if (semiColonIndex !== -1) { input = input.slice(semiColonIndex + 1); } input = input.trim(); input = input.replace(/\s\s+/g, ' '); const commandArray = input.split(" "); let index = commandArray.length - 2; if (index < -1) { index = 0; } const allPos = Object(_Terminal_determineAllPossibilitiesForTabCompletion__WEBPACK_IMPORTED_MODULE_1__["determineAllPossibilitiesForTabCompletion"])(_Player__WEBPACK_IMPORTED_MODULE_22__["Player"], input, index, Terminal.currDir); if (allPos.length == 0) { return; } let arg = ""; let command = ""; if (commandArray.length == 0) { return; } if (commandArray.length == 1) { command = commandArray[0]; } else if (commandArray.length == 2) { command = commandArray[0]; arg = commandArray[1]; } else if (commandArray.length == 3) { command = commandArray[0] + " " + commandArray[1]; arg = commandArray[2]; } else { arg = commandArray.pop(); command = commandArray.join(" "); } Object(_Terminal_tabCompletion__WEBPACK_IMPORTED_MODULE_3__["tabCompletion"])(command, arg, allPos); terminalInput.focus(); } // Extra Bash Emulation Hotkeys, must be enabled through .fconf if (_Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_12__["FconfSettings"].ENABLE_BASH_HOTKEYS) { if (event.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__["KEY"].A && event.ctrlKey) { event.preventDefault(); Terminal.moveTextCursor("home"); } if (event.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__["KEY"].E && event.ctrlKey) { event.preventDefault(); Terminal.moveTextCursor("end"); } if (event.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__["KEY"].B && event.ctrlKey) { event.preventDefault(); Terminal.moveTextCursor("prevchar"); } if (event.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__["KEY"].B && event.altKey) { event.preventDefault(); Terminal.moveTextCursor("prevword"); } if (event.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__["KEY"].F && event.ctrlKey) { event.preventDefault(); Terminal.moveTextCursor("nextchar"); } if (event.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__["KEY"].F && event.altKey) { event.preventDefault(); Terminal.moveTextCursor("nextword"); } if ((event.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__["KEY"].H || event.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__["KEY"].D) && event.ctrlKey) { Terminal.modifyInput("backspace"); event.preventDefault(); } // TODO AFTER THIS: // alt + d deletes word after cursor // ^w deletes word before cursor // ^k clears line after cursor // ^u clears line before cursor } } }); // Keep terminal in focus let terminalCtrlPressed = false, shiftKeyPressed = false; $(document).ready(function () { if (_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_33__["routing"].isOn(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_33__["Page"].Terminal)) { $('.terminal-input').focus(); } }); $(document).keydown(function (e) { if (_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_33__["routing"].isOn(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_33__["Page"].Terminal)) { if (e.which == _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__["KEY"].CTRL) { terminalCtrlPressed = true; } else if (e.shiftKey) { shiftKeyPressed = true; } else if (terminalCtrlPressed || shiftKeyPressed || Terminal.contractOpen) {// Don't focus } else { var inputTextBox = document.getElementById("terminal-input-text-box"); if (inputTextBox != null) { inputTextBox.focus(); } terminalCtrlPressed = false; shiftKeyPressed = false; } } }); $(document).keyup(function (e) { if (_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_33__["routing"].isOn(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_33__["Page"].Terminal)) { if (e.which == _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__["KEY"].CTRL) { terminalCtrlPressed = false; } if (e.shiftKey) { shiftKeyPressed = false; } } }); let Terminal = { // Flags to determine whether the player is currently running a hack or an analyze hackFlag: false, backdoorFlag: false, analyzeFlag: false, actionStarted: false, actionTime: 0, commandHistory: [], commandHistoryIndex: 0, // True if a Coding Contract prompt is opened contractOpen: false, // Full Path of current directory // Excludes the trailing forward slash currDir: "/", resetTerminalInput: function (keepInput = false) { let input = ""; if (keepInput) { input = getTerminalInput(); } const dir = Terminal.currDir; if (_Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_12__["FconfSettings"].WRAP_INPUT) { document.getElementById("terminal-input-td").innerHTML = `
[${_Player__WEBPACK_IMPORTED_MODULE_22__["Player"].getCurrentServer().hostname} ~${dir}]$
` + `