diff --git a/dist/engine.bundle.js b/dist/engine.bundle.js
index 402f7d853..0564edc7b 100644
--- a/dist/engine.bundle.js
+++ b/dist/engine.bundle.js
@@ -177,7 +177,7 @@ eval("/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__,
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
-eval("/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return numeralWrapper; });\n/* harmony import */ var numeral__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! numeral */ 120);\n/* harmony import */ var numeral__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(numeral__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var numeral_locales_bg__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! numeral/locales/bg */ 1095);\n/* harmony import */ var numeral_locales_bg__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(numeral_locales_bg__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var numeral_locales_cs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! numeral/locales/cs */ 1096);\n/* harmony import */ var numeral_locales_cs__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(numeral_locales_cs__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var numeral_locales_da_dk__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! numeral/locales/da-dk */ 1097);\n/* harmony import */ var numeral_locales_da_dk__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(numeral_locales_da_dk__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var numeral_locales_de__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! numeral/locales/de */ 1098);\n/* harmony import */ var numeral_locales_de__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(numeral_locales_de__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var numeral_locales_en_au__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! numeral/locales/en-au */ 1099);\n/* harmony import */ var numeral_locales_en_au__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(numeral_locales_en_au__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var numeral_locales_en_gb__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! numeral/locales/en-gb */ 1100);\n/* harmony import */ var numeral_locales_en_gb__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(numeral_locales_en_gb__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var numeral_locales_es__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! numeral/locales/es */ 1101);\n/* harmony import */ var numeral_locales_es__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(numeral_locales_es__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var numeral_locales_fr__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! numeral/locales/fr */ 1102);\n/* harmony import */ var numeral_locales_fr__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(numeral_locales_fr__WEBPACK_IMPORTED_MODULE_8__);\n/* harmony import */ var numeral_locales_hu__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! numeral/locales/hu */ 1103);\n/* harmony import */ var numeral_locales_hu__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(numeral_locales_hu__WEBPACK_IMPORTED_MODULE_9__);\n/* harmony import */ var numeral_locales_it__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! numeral/locales/it */ 1104);\n/* harmony import */ var numeral_locales_it__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(numeral_locales_it__WEBPACK_IMPORTED_MODULE_10__);\n/* harmony import */ var numeral_locales_lv__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! numeral/locales/lv */ 1105);\n/* harmony import */ var numeral_locales_lv__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(numeral_locales_lv__WEBPACK_IMPORTED_MODULE_11__);\n/* harmony import */ var numeral_locales_no__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! numeral/locales/no */ 1106);\n/* harmony import */ var numeral_locales_no__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(numeral_locales_no__WEBPACK_IMPORTED_MODULE_12__);\n/* harmony import */ var numeral_locales_pl__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! numeral/locales/pl */ 1107);\n/* harmony import */ var numeral_locales_pl__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(numeral_locales_pl__WEBPACK_IMPORTED_MODULE_13__);\n/* harmony import */ var numeral_locales_ru__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! numeral/locales/ru */ 1108);\n/* harmony import */ var numeral_locales_ru__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(numeral_locales_ru__WEBPACK_IMPORTED_MODULE_14__);\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n/* eslint-disable class-methods-use-this */\n\nconst extraFormats = [1e15, 1e18, 1e21, 1e24, 1e27, 1e30];\nconst extraNotations = [\"q\", \"Q\", \"s\", \"S\", \"o\", \"n\"];\n\nclass NumeralFormatter {\n // Default Locale\n constructor() {\n _defineProperty(this, \"defaultLocale\", \"en\");\n\n this.defaultLocale = \"en\";\n }\n\n updateLocale(l) {\n if (numeral__WEBPACK_IMPORTED_MODULE_0___default.a.locale(l) == null) {\n console.warn(`Invalid locale for numeral: ${l}`);\n numeral__WEBPACK_IMPORTED_MODULE_0___default.a.locale(this.defaultLocale);\n return false;\n }\n\n return true;\n }\n\n format(n, format) {\n // numeraljs doesnt properly format numbers that are too big or too small\n if (Math.abs(n) < 1e-6) {\n n = 0;\n }\n\n const answer = numeral__WEBPACK_IMPORTED_MODULE_0___default()(n).format(format);\n\n if (answer === \"NaN\") {\n return `${n}`;\n }\n\n return answer;\n }\n\n formatBigNumber(n) {\n return this.format(n, \"0.000a\");\n } // TODO: leverage numeral.js to do it. This function also implies you can\n // use this format in some text field but you can't. ( \"1t\" will parse but\n // \"1s\" will not)\n\n\n formatReallyBigNumber(n, decimalPlaces = 3) {\n if (n === Infinity) return \"∞\";\n\n for (let i = 0; i < extraFormats.length; i++) {\n if (extraFormats[i] < n && n <= extraFormats[i] * 1000) {\n return this.format(n / extraFormats[i], \"0.\" + \"0\".repeat(decimalPlaces)) + extraNotations[i];\n }\n }\n\n if (Math.abs(n) < 1000) {\n return this.format(n, \"0.\" + \"0\".repeat(decimalPlaces));\n }\n\n const str = this.format(n, \"0.\" + \"0\".repeat(decimalPlaces) + \"a\");\n if (str === \"NaNt\") return this.format(n, \"0.\" + \" \".repeat(decimalPlaces) + \"e+0\");\n return str;\n }\n\n formatHp(n) {\n if (n < 1e6) {\n return this.format(n, \"0,0\");\n }\n\n return this.formatReallyBigNumber(n);\n }\n\n formatMoney(n) {\n return \"$\" + this.formatReallyBigNumber(n);\n }\n\n formatSkill(n) {\n if (n < 1e15) {\n return this.format(n, \"0,0\");\n }\n\n return this.formatReallyBigNumber(n);\n }\n\n formatExp(n) {\n return this.formatReallyBigNumber(n);\n }\n\n formatHashes(n) {\n return this.formatReallyBigNumber(n);\n }\n\n formatReputation(n) {\n return this.formatReallyBigNumber(n);\n }\n\n formatFavor(n) {\n return this.format(n, \"0,0\");\n }\n\n formatRAM(n) {\n return this.format(n, \"0.00\") + \"GB\";\n }\n\n formatPercentage(n, decimalPlaces = 2) {\n const formatter = \"0.\" + \"0\".repeat(decimalPlaces) + \"%\";\n return this.format(n, formatter);\n }\n\n formatServerSecurity(n) {\n return this.format(n, \"0,0.000\");\n }\n\n formatRespect(n) {\n return this.formatReallyBigNumber(n, 5);\n }\n\n formatWanted(n) {\n return this.formatReallyBigNumber(n, 5);\n }\n\n formatMultiplier(n) {\n return this.format(n, \"0,0.00\");\n }\n\n formatSleeveShock(n) {\n return this.format(n, \"0,0.000\");\n }\n\n formatSleeveSynchro(n) {\n return this.format(n, \"0,0.000\");\n }\n\n formatSleeveMemory(n) {\n return this.format(n, \"0\");\n }\n\n formatPopulation(n) {\n return this.format(n, \"0.000a\");\n }\n\n formatStamina(n) {\n return this.format(n, \"0.0\");\n }\n\n formatShares(n) {\n if (n < 1000) {\n return this.format(n, \"0\");\n }\n\n return this.formatReallyBigNumber(n);\n }\n\n formatInfiltrationSecurity(n) {\n return this.formatReallyBigNumber(n);\n }\n\n formatThreads(n) {\n return this.format(n, \"0,0\");\n }\n\n parseMoney(s) {\n // numeral library does not handle formats like 1e10 well (returns 110),\n // so if both return a valid number, return the biggest one\n const numeralValue = numeral__WEBPACK_IMPORTED_MODULE_0___default()(s).value();\n const parsed = parseFloat(s);\n\n if (isNaN(parsed) && numeralValue === null) {\n return NaN;\n } else if (isNaN(parsed)) {\n return numeralValue;\n } else if (numeralValue === null) {\n return parsed;\n } else {\n return Math.max(numeralValue, parsed);\n }\n }\n\n}\n\nconst numeralWrapper = new NumeralFormatter();\n\n//# sourceURL=webpack:///./src/ui/numeralFormat.ts?");
+eval("/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return numeralWrapper; });\n/* harmony import */ var numeral__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! numeral */ 120);\n/* harmony import */ var numeral__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(numeral__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var numeral_locales_bg__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! numeral/locales/bg */ 1096);\n/* harmony import */ var numeral_locales_bg__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(numeral_locales_bg__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var numeral_locales_cs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! numeral/locales/cs */ 1097);\n/* harmony import */ var numeral_locales_cs__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(numeral_locales_cs__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var numeral_locales_da_dk__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! numeral/locales/da-dk */ 1098);\n/* harmony import */ var numeral_locales_da_dk__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(numeral_locales_da_dk__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var numeral_locales_de__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! numeral/locales/de */ 1099);\n/* harmony import */ var numeral_locales_de__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(numeral_locales_de__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var numeral_locales_en_au__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! numeral/locales/en-au */ 1100);\n/* harmony import */ var numeral_locales_en_au__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(numeral_locales_en_au__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var numeral_locales_en_gb__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! numeral/locales/en-gb */ 1101);\n/* harmony import */ var numeral_locales_en_gb__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(numeral_locales_en_gb__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var numeral_locales_es__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! numeral/locales/es */ 1102);\n/* harmony import */ var numeral_locales_es__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(numeral_locales_es__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var numeral_locales_fr__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! numeral/locales/fr */ 1103);\n/* harmony import */ var numeral_locales_fr__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(numeral_locales_fr__WEBPACK_IMPORTED_MODULE_8__);\n/* harmony import */ var numeral_locales_hu__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! numeral/locales/hu */ 1104);\n/* harmony import */ var numeral_locales_hu__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(numeral_locales_hu__WEBPACK_IMPORTED_MODULE_9__);\n/* harmony import */ var numeral_locales_it__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! numeral/locales/it */ 1105);\n/* harmony import */ var numeral_locales_it__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(numeral_locales_it__WEBPACK_IMPORTED_MODULE_10__);\n/* harmony import */ var numeral_locales_lv__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! numeral/locales/lv */ 1106);\n/* harmony import */ var numeral_locales_lv__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(numeral_locales_lv__WEBPACK_IMPORTED_MODULE_11__);\n/* harmony import */ var numeral_locales_no__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! numeral/locales/no */ 1107);\n/* harmony import */ var numeral_locales_no__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(numeral_locales_no__WEBPACK_IMPORTED_MODULE_12__);\n/* harmony import */ var numeral_locales_pl__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! numeral/locales/pl */ 1108);\n/* harmony import */ var numeral_locales_pl__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(numeral_locales_pl__WEBPACK_IMPORTED_MODULE_13__);\n/* harmony import */ var numeral_locales_ru__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! numeral/locales/ru */ 1109);\n/* harmony import */ var numeral_locales_ru__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(numeral_locales_ru__WEBPACK_IMPORTED_MODULE_14__);\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n/* eslint-disable class-methods-use-this */\n\nconst extraFormats = [1e15, 1e18, 1e21, 1e24, 1e27, 1e30];\nconst extraNotations = [\"q\", \"Q\", \"s\", \"S\", \"o\", \"n\"];\n\nclass NumeralFormatter {\n // Default Locale\n constructor() {\n _defineProperty(this, \"defaultLocale\", \"en\");\n\n this.defaultLocale = \"en\";\n }\n\n updateLocale(l) {\n if (numeral__WEBPACK_IMPORTED_MODULE_0___default.a.locale(l) == null) {\n console.warn(`Invalid locale for numeral: ${l}`);\n numeral__WEBPACK_IMPORTED_MODULE_0___default.a.locale(this.defaultLocale);\n return false;\n }\n\n return true;\n }\n\n format(n, format) {\n // numeraljs doesnt properly format numbers that are too big or too small\n if (Math.abs(n) < 1e-6) {\n n = 0;\n }\n\n const answer = numeral__WEBPACK_IMPORTED_MODULE_0___default()(n).format(format);\n\n if (answer === \"NaN\") {\n return `${n}`;\n }\n\n return answer;\n }\n\n formatBigNumber(n) {\n return this.format(n, \"0.000a\");\n } // TODO: leverage numeral.js to do it. This function also implies you can\n // use this format in some text field but you can't. ( \"1t\" will parse but\n // \"1s\" will not)\n\n\n formatReallyBigNumber(n, decimalPlaces = 3) {\n if (n === Infinity) return \"∞\";\n\n for (let i = 0; i < extraFormats.length; i++) {\n if (extraFormats[i] < n && n <= extraFormats[i] * 1000) {\n return this.format(n / extraFormats[i], \"0.\" + \"0\".repeat(decimalPlaces)) + extraNotations[i];\n }\n }\n\n if (Math.abs(n) < 1000) {\n return this.format(n, \"0.\" + \"0\".repeat(decimalPlaces));\n }\n\n const str = this.format(n, \"0.\" + \"0\".repeat(decimalPlaces) + \"a\");\n if (str === \"NaNt\") return this.format(n, \"0.\" + \" \".repeat(decimalPlaces) + \"e+0\");\n return str;\n }\n\n formatHp(n) {\n if (n < 1e6) {\n return this.format(n, \"0,0\");\n }\n\n return this.formatReallyBigNumber(n);\n }\n\n formatMoney(n) {\n return \"$\" + this.formatReallyBigNumber(n);\n }\n\n formatSkill(n) {\n if (n < 1e15) {\n return this.format(n, \"0,0\");\n }\n\n return this.formatReallyBigNumber(n);\n }\n\n formatExp(n) {\n return this.formatReallyBigNumber(n);\n }\n\n formatHashes(n) {\n return this.formatReallyBigNumber(n);\n }\n\n formatReputation(n) {\n return this.formatReallyBigNumber(n);\n }\n\n formatFavor(n) {\n return this.format(n, \"0,0\");\n }\n\n formatRAM(n) {\n return this.format(n, \"0.00\") + \"GB\";\n }\n\n formatPercentage(n, decimalPlaces = 2) {\n const formatter = \"0.\" + \"0\".repeat(decimalPlaces) + \"%\";\n return this.format(n, formatter);\n }\n\n formatServerSecurity(n) {\n return this.format(n, \"0,0.000\");\n }\n\n formatRespect(n) {\n return this.formatReallyBigNumber(n, 5);\n }\n\n formatWanted(n) {\n return this.formatReallyBigNumber(n, 5);\n }\n\n formatMultiplier(n) {\n return this.format(n, \"0,0.00\");\n }\n\n formatSleeveShock(n) {\n return this.format(n, \"0,0.000\");\n }\n\n formatSleeveSynchro(n) {\n return this.format(n, \"0,0.000\");\n }\n\n formatSleeveMemory(n) {\n return this.format(n, \"0\");\n }\n\n formatPopulation(n) {\n return this.format(n, \"0.000a\");\n }\n\n formatStamina(n) {\n return this.format(n, \"0.0\");\n }\n\n formatShares(n) {\n if (n < 1000) {\n return this.format(n, \"0\");\n }\n\n return this.formatReallyBigNumber(n);\n }\n\n formatInfiltrationSecurity(n) {\n return this.formatReallyBigNumber(n);\n }\n\n formatThreads(n) {\n return this.format(n, \"0,0\");\n }\n\n parseMoney(s) {\n // numeral library does not handle formats like 1e10 well (returns 110),\n // so if both return a valid number, return the biggest one\n const numeralValue = numeral__WEBPACK_IMPORTED_MODULE_0___default()(s).value();\n const parsed = parseFloat(s);\n\n if (isNaN(parsed) && numeralValue === null) {\n return NaN;\n } else if (isNaN(parsed)) {\n return numeralValue;\n } else if (numeralValue === null) {\n return parsed;\n } else {\n return Math.max(numeralValue, parsed);\n }\n }\n\n}\n\nconst numeralWrapper = new NumeralFormatter();\n\n//# sourceURL=webpack:///./src/ui/numeralFormat.ts?");
/***/ }),
/* 4 */,
@@ -412,7 +412,7 @@ eval("/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__,
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
-eval("/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"b\", function() { return AllServers; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"e\", function() { return ipExists; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"c\", function() { return createUniqueRandomIp; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return AddToAllServers; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"d\", function() { return initForeignServers; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"g\", function() { return prestigeAllServers; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"f\", function() { return loadAllServers; });\n/* harmony import */ var _Server__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Server */ 92);\n/* harmony import */ var _SpecialServerIps__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./SpecialServerIps */ 50);\n/* harmony import */ var _data_servers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./data/servers */ 655);\n/* harmony import */ var _utils_IPAddress__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../utils/IPAddress */ 239);\n/* harmony import */ var _utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils/helpers/getRandomInt */ 18);\n/* harmony import */ var _utils_JSONReviver__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../utils/JSONReviver */ 15);\n\n\n\n\n\n\n/**\n * Map of all Servers that exist in the game\n * Key (string) = IP\n * Value = Server object\n */\n\nlet AllServers = {};\nfunction ipExists(ip) {\n return AllServers[ip] != null;\n}\nfunction createUniqueRandomIp() {\n const ip = Object(_utils_IPAddress__WEBPACK_IMPORTED_MODULE_3__[/* createRandomIp */ \"a\"])(); // If the Ip already exists, recurse to create a new one\n\n if (ipExists(ip)) {\n return Object(_utils_IPAddress__WEBPACK_IMPORTED_MODULE_3__[/* createRandomIp */ \"a\"])();\n }\n\n return ip;\n} // Saftely add a Server to the AllServers map\n\nfunction AddToAllServers(server) {\n const serverIp = server.ip;\n\n if (ipExists(serverIp)) {\n console.warn(`IP of server that's being added: ${serverIp}`);\n console.warn(`Hostname of the server thats being added: ${server.hostname}`);\n console.warn(`The server that already has this IP is: ${AllServers[serverIp].hostname}`);\n throw new Error(\"Error: Trying to add a server with an existing IP\");\n }\n\n AllServers[serverIp] = server;\n}\nfunction initForeignServers(homeComputer) {\n /* Create a randomized network for all the foreign servers */\n //Groupings for creating a randomized network\n const networkLayers = [];\n\n for (let i = 0; i < 15; i++) {\n networkLayers.push([]);\n } // Essentially any property that is of type 'number | IMinMaxRange'\n\n\n const propertiesToPatternMatch = [\"hackDifficulty\", \"moneyAvailable\", \"requiredHackingSkill\", \"serverGrowth\"];\n\n const toNumber = value => {\n switch (typeof value) {\n case \"number\":\n return value;\n\n case \"object\":\n return Object(_utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_4__[/* getRandomInt */ \"a\"])(value.min, value.max);\n\n default:\n throw Error(`Do not know how to convert the type '${typeof value}' to a number`);\n }\n };\n\n for (const metadata of _data_servers__WEBPACK_IMPORTED_MODULE_2__[/* serverMetadata */ \"a\"]) {\n const serverParams = {\n hostname: metadata.hostname,\n ip: createUniqueRandomIp(),\n numOpenPortsRequired: metadata.numOpenPortsRequired,\n organizationName: metadata.organizationName\n };\n\n if (metadata.maxRamExponent !== undefined) {\n serverParams.maxRam = Math.pow(2, toNumber(metadata.maxRamExponent));\n }\n\n for (const prop of propertiesToPatternMatch) {\n if (metadata[prop] !== undefined) {\n serverParams[prop] = toNumber(metadata[prop]);\n }\n }\n\n const server = new _Server__WEBPACK_IMPORTED_MODULE_0__[/* Server */ \"a\"](serverParams);\n\n for (const filename of metadata.literature || []) {\n server.messages.push(filename);\n }\n\n if (metadata.specialName !== undefined) {\n _SpecialServerIps__WEBPACK_IMPORTED_MODULE_1__[/* SpecialServerIps */ \"a\"].addIp(metadata.specialName, server.ip);\n }\n\n AddToAllServers(server);\n\n if (metadata.networkLayer !== undefined) {\n networkLayers[toNumber(metadata.networkLayer) - 1].push(server);\n }\n }\n /* Create a randomized network for all the foreign servers */\n\n\n const linkComputers = (server1, server2) => {\n server1.serversOnNetwork.push(server2.ip);\n server2.serversOnNetwork.push(server1.ip);\n };\n\n const getRandomArrayItem = arr => arr[Math.floor(Math.random() * arr.length)];\n\n const linkNetworkLayers = (network1, selectServer) => {\n for (const server of network1) {\n linkComputers(server, selectServer());\n }\n }; // Connect the first tier of servers to the player's home computer\n\n\n linkNetworkLayers(networkLayers[0], () => homeComputer);\n\n for (let i = 1; i < networkLayers.length; i++) {\n linkNetworkLayers(networkLayers[i], () => getRandomArrayItem(networkLayers[i - 1]));\n }\n}\nfunction prestigeAllServers() {\n for (const member in AllServers) {\n delete AllServers[member];\n }\n\n AllServers = {};\n}\nfunction loadAllServers(saveString) {\n AllServers = JSON.parse(saveString, _utils_JSONReviver__WEBPACK_IMPORTED_MODULE_5__[/* Reviver */ \"c\"]);\n}\n\n//# sourceURL=webpack:///./src/Server/AllServers.ts?");
+eval("/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"b\", function() { return AllServers; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"e\", function() { return ipExists; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"c\", function() { return createUniqueRandomIp; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return AddToAllServers; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"d\", function() { return initForeignServers; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"g\", function() { return prestigeAllServers; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"f\", function() { return loadAllServers; });\n/* harmony import */ var _Server__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Server */ 92);\n/* harmony import */ var _SpecialServerIps__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./SpecialServerIps */ 51);\n/* harmony import */ var _data_servers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./data/servers */ 655);\n/* harmony import */ var _utils_IPAddress__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../utils/IPAddress */ 239);\n/* harmony import */ var _utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils/helpers/getRandomInt */ 18);\n/* harmony import */ var _utils_JSONReviver__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../utils/JSONReviver */ 15);\n\n\n\n\n\n\n/**\n * Map of all Servers that exist in the game\n * Key (string) = IP\n * Value = Server object\n */\n\nlet AllServers = {};\nfunction ipExists(ip) {\n return AllServers[ip] != null;\n}\nfunction createUniqueRandomIp() {\n const ip = Object(_utils_IPAddress__WEBPACK_IMPORTED_MODULE_3__[/* createRandomIp */ \"a\"])(); // If the Ip already exists, recurse to create a new one\n\n if (ipExists(ip)) {\n return Object(_utils_IPAddress__WEBPACK_IMPORTED_MODULE_3__[/* createRandomIp */ \"a\"])();\n }\n\n return ip;\n} // Saftely add a Server to the AllServers map\n\nfunction AddToAllServers(server) {\n const serverIp = server.ip;\n\n if (ipExists(serverIp)) {\n console.warn(`IP of server that's being added: ${serverIp}`);\n console.warn(`Hostname of the server thats being added: ${server.hostname}`);\n console.warn(`The server that already has this IP is: ${AllServers[serverIp].hostname}`);\n throw new Error(\"Error: Trying to add a server with an existing IP\");\n }\n\n AllServers[serverIp] = server;\n}\nfunction initForeignServers(homeComputer) {\n /* Create a randomized network for all the foreign servers */\n //Groupings for creating a randomized network\n const networkLayers = [];\n\n for (let i = 0; i < 15; i++) {\n networkLayers.push([]);\n } // Essentially any property that is of type 'number | IMinMaxRange'\n\n\n const propertiesToPatternMatch = [\"hackDifficulty\", \"moneyAvailable\", \"requiredHackingSkill\", \"serverGrowth\"];\n\n const toNumber = value => {\n switch (typeof value) {\n case \"number\":\n return value;\n\n case \"object\":\n return Object(_utils_helpers_getRandomInt__WEBPACK_IMPORTED_MODULE_4__[/* getRandomInt */ \"a\"])(value.min, value.max);\n\n default:\n throw Error(`Do not know how to convert the type '${typeof value}' to a number`);\n }\n };\n\n for (const metadata of _data_servers__WEBPACK_IMPORTED_MODULE_2__[/* serverMetadata */ \"a\"]) {\n const serverParams = {\n hostname: metadata.hostname,\n ip: createUniqueRandomIp(),\n numOpenPortsRequired: metadata.numOpenPortsRequired,\n organizationName: metadata.organizationName\n };\n\n if (metadata.maxRamExponent !== undefined) {\n serverParams.maxRam = Math.pow(2, toNumber(metadata.maxRamExponent));\n }\n\n for (const prop of propertiesToPatternMatch) {\n if (metadata[prop] !== undefined) {\n serverParams[prop] = toNumber(metadata[prop]);\n }\n }\n\n const server = new _Server__WEBPACK_IMPORTED_MODULE_0__[/* Server */ \"a\"](serverParams);\n\n for (const filename of metadata.literature || []) {\n server.messages.push(filename);\n }\n\n if (metadata.specialName !== undefined) {\n _SpecialServerIps__WEBPACK_IMPORTED_MODULE_1__[/* SpecialServerIps */ \"a\"].addIp(metadata.specialName, server.ip);\n }\n\n AddToAllServers(server);\n\n if (metadata.networkLayer !== undefined) {\n networkLayers[toNumber(metadata.networkLayer) - 1].push(server);\n }\n }\n /* Create a randomized network for all the foreign servers */\n\n\n const linkComputers = (server1, server2) => {\n server1.serversOnNetwork.push(server2.ip);\n server2.serversOnNetwork.push(server1.ip);\n };\n\n const getRandomArrayItem = arr => arr[Math.floor(Math.random() * arr.length)];\n\n const linkNetworkLayers = (network1, selectServer) => {\n for (const server of network1) {\n linkComputers(server, selectServer());\n }\n }; // Connect the first tier of servers to the player's home computer\n\n\n linkNetworkLayers(networkLayers[0], () => homeComputer);\n\n for (let i = 1; i < networkLayers.length; i++) {\n linkNetworkLayers(networkLayers[i], () => getRandomArrayItem(networkLayers[i - 1]));\n }\n}\nfunction prestigeAllServers() {\n for (const member in AllServers) {\n delete AllServers[member];\n }\n\n AllServers = {};\n}\nfunction loadAllServers(saveString) {\n AllServers = JSON.parse(saveString, _utils_JSONReviver__WEBPACK_IMPORTED_MODULE_5__[/* Reviver */ \"c\"]);\n}\n\n//# sourceURL=webpack:///./src/Server/AllServers.ts?");
/***/ }),
/* 30 */,
@@ -450,7 +450,7 @@ eval("/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__,
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
-eval("/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return Settings; });\n/* harmony import */ var _SettingEnums__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./SettingEnums */ 153);\n\n/**\n * Represents the default settings the player could customize.\n */\n\nconst defaultSettings = {\n AutosaveInterval: 60,\n CodeInstructionRunTime: 50,\n DisableASCIIArt: false,\n DisableHotkeys: false,\n DisableTextEffects: false,\n Locale: \"en\",\n MaxLogCapacity: 50,\n MaxPortCapacity: 50,\n MaxTerminalCapacity: 200,\n SuppressBuyAugmentationConfirmation: false,\n SuppressFactionInvites: false,\n SuppressHospitalizationPopup: false,\n SuppressMessages: false,\n SuppressTravelConfirmation: false,\n SuppressBladeburnerPopup: false\n};\n/**\n * The current options the player has customized to their play style.\n */\n// tslint:disable-next-line:variable-name\n\nconst Settings = {\n AutosaveInterval: defaultSettings.AutosaveInterval,\n CodeInstructionRunTime: 25,\n DisableASCIIArt: defaultSettings.DisableASCIIArt,\n DisableHotkeys: defaultSettings.DisableHotkeys,\n DisableTextEffects: defaultSettings.DisableTextEffects,\n Locale: \"en\",\n MaxLogCapacity: defaultSettings.MaxLogCapacity,\n MaxPortCapacity: defaultSettings.MaxPortCapacity,\n MaxTerminalCapacity: defaultSettings.MaxTerminalCapacity,\n OwnedAugmentationsOrder: _SettingEnums__WEBPACK_IMPORTED_MODULE_0__[/* OwnedAugmentationsOrderSetting */ \"a\"].AcquirementTime,\n PurchaseAugmentationsOrder: _SettingEnums__WEBPACK_IMPORTED_MODULE_0__[/* PurchaseAugmentationsOrderSetting */ \"b\"].Default,\n SuppressBuyAugmentationConfirmation: defaultSettings.SuppressBuyAugmentationConfirmation,\n SuppressFactionInvites: defaultSettings.SuppressFactionInvites,\n SuppressHospitalizationPopup: defaultSettings.SuppressHospitalizationPopup,\n SuppressMessages: defaultSettings.SuppressMessages,\n SuppressTravelConfirmation: defaultSettings.SuppressTravelConfirmation,\n SuppressBladeburnerPopup: defaultSettings.SuppressBladeburnerPopup,\n MonacoTheme: \"vs-dark\",\n MonacoInsertSpaces: false,\n\n init() {\n Object.assign(Settings, defaultSettings);\n },\n\n load(saveString) {\n Object.assign(Settings, JSON.parse(saveString));\n }\n\n};\n\n//# sourceURL=webpack:///./src/Settings/Settings.ts?");
+eval("/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return Settings; });\n/* harmony import */ var _SettingEnums__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./SettingEnums */ 152);\n\n/**\n * Represents the default settings the player could customize.\n */\n\nconst defaultSettings = {\n AutosaveInterval: 60,\n CodeInstructionRunTime: 50,\n DisableASCIIArt: false,\n DisableHotkeys: false,\n DisableTextEffects: false,\n Locale: \"en\",\n MaxLogCapacity: 50,\n MaxPortCapacity: 50,\n MaxTerminalCapacity: 200,\n SuppressBuyAugmentationConfirmation: false,\n SuppressFactionInvites: false,\n SuppressHospitalizationPopup: false,\n SuppressMessages: false,\n SuppressTravelConfirmation: false,\n SuppressBladeburnerPopup: false\n};\n/**\n * The current options the player has customized to their play style.\n */\n// tslint:disable-next-line:variable-name\n\nconst Settings = {\n AutosaveInterval: defaultSettings.AutosaveInterval,\n CodeInstructionRunTime: 25,\n DisableASCIIArt: defaultSettings.DisableASCIIArt,\n DisableHotkeys: defaultSettings.DisableHotkeys,\n DisableTextEffects: defaultSettings.DisableTextEffects,\n Locale: \"en\",\n MaxLogCapacity: defaultSettings.MaxLogCapacity,\n MaxPortCapacity: defaultSettings.MaxPortCapacity,\n MaxTerminalCapacity: defaultSettings.MaxTerminalCapacity,\n OwnedAugmentationsOrder: _SettingEnums__WEBPACK_IMPORTED_MODULE_0__[/* OwnedAugmentationsOrderSetting */ \"a\"].AcquirementTime,\n PurchaseAugmentationsOrder: _SettingEnums__WEBPACK_IMPORTED_MODULE_0__[/* PurchaseAugmentationsOrderSetting */ \"b\"].Default,\n SuppressBuyAugmentationConfirmation: defaultSettings.SuppressBuyAugmentationConfirmation,\n SuppressFactionInvites: defaultSettings.SuppressFactionInvites,\n SuppressHospitalizationPopup: defaultSettings.SuppressHospitalizationPopup,\n SuppressMessages: defaultSettings.SuppressMessages,\n SuppressTravelConfirmation: defaultSettings.SuppressTravelConfirmation,\n SuppressBladeburnerPopup: defaultSettings.SuppressBladeburnerPopup,\n MonacoTheme: \"vs-dark\",\n MonacoInsertSpaces: false,\n\n init() {\n Object.assign(Settings, defaultSettings);\n },\n\n load(saveString) {\n Object.assign(Settings, JSON.parse(saveString));\n }\n\n};\n\n//# sourceURL=webpack:///./src/Settings/Settings.ts?");
/***/ }),
/* 35 */
@@ -474,7 +474,7 @@ eval("/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__,
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
-eval("/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"h\", function() { return safetlyCreateUniqueServer; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"e\", function() { return numCycleForGrowth; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"g\", function() { return processSingleServerGrowth; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"f\", function() { return prestigeHomeComputer; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return GetServerByHostname; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"b\", function() { return getServer; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"c\", function() { return getServerOnNetwork; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"d\", function() { return isBackdoorInstalled; });\n/* harmony import */ var _AllServers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AllServers */ 29);\n/* harmony import */ var _Server__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Server */ 92);\n/* harmony import */ var _formulas_grow__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./formulas/grow */ 433);\n/* harmony import */ var _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../BitNode/BitNodeMultipliers */ 8);\n/* harmony import */ var _Constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Constants */ 5);\n/* harmony import */ var _Programs_Programs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Programs/Programs */ 53);\n/* harmony import */ var _Literature_data_LiteratureNames__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Literature/data/LiteratureNames */ 44);\n/* harmony import */ var _utils_helpers_isValidNumber__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../utils/helpers/isValidNumber */ 521);\n/* harmony import */ var _utils_helpers_isValidIPAddress__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../utils/helpers/isValidIPAddress */ 434);\n\n\n\n\n\n\n\n\n\n/**\n * Constructs a new server, while also ensuring that the new server\n * does not have a duplicate hostname/ip.\n */\n\nfunction safetlyCreateUniqueServer(params) {\n if (params.ip != null && Object(_AllServers__WEBPACK_IMPORTED_MODULE_0__[/* ipExists */ \"e\"])(params.ip)) {\n params.ip = Object(_AllServers__WEBPACK_IMPORTED_MODULE_0__[/* createUniqueRandomIp */ \"c\"])();\n }\n\n if (GetServerByHostname(params.hostname) != null) {\n // Use a for loop to ensure that we don't get suck in an infinite loop somehow\n let hostname = params.hostname;\n\n for (let i = 0; i < 200; ++i) {\n hostname = `${params.hostname}-${i}`;\n\n if (GetServerByHostname(hostname) == null) {\n break;\n }\n }\n\n params.hostname = hostname;\n }\n\n return new _Server__WEBPACK_IMPORTED_MODULE_1__[/* Server */ \"a\"](params);\n}\n/**\n * Returns the number of \"growth cycles\" needed to grow the specified server by the\n * specified amount.\n * @param server - Server being grown\n * @param growth - How much the server is being grown by, in DECIMAL form (e.g. 1.5 rather than 50)\n * @param p - Reference to Player object\n * @returns Number of \"growth cycles\" needed\n */\n\nfunction numCycleForGrowth(server, growth, p) {\n let ajdGrowthRate = 1 + (_Constants__WEBPACK_IMPORTED_MODULE_4__[/* CONSTANTS */ \"a\"].ServerBaseGrowthRate - 1) / server.hackDifficulty;\n\n if (ajdGrowthRate > _Constants__WEBPACK_IMPORTED_MODULE_4__[/* CONSTANTS */ \"a\"].ServerMaxGrowthRate) {\n ajdGrowthRate = _Constants__WEBPACK_IMPORTED_MODULE_4__[/* CONSTANTS */ \"a\"].ServerMaxGrowthRate;\n }\n\n const serverGrowthPercentage = server.serverGrowth / 100;\n const cycles = Math.log(growth) / (Math.log(ajdGrowthRate) * p.hacking_grow_mult * serverGrowthPercentage * _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_3__[/* BitNodeMultipliers */ \"a\"].ServerGrowthRate);\n return cycles;\n} //Applied server growth for a single server. Returns the percentage growth\n\nfunction processSingleServerGrowth(server, threads, p, cores = 1) {\n let serverGrowth = Object(_formulas_grow__WEBPACK_IMPORTED_MODULE_2__[/* calculateServerGrowth */ \"a\"])(server, threads, p, cores);\n\n if (serverGrowth < 1) {\n console.warn(\"serverGrowth calculated to be less than 1\");\n serverGrowth = 1;\n }\n\n const oldMoneyAvailable = server.moneyAvailable;\n server.moneyAvailable *= serverGrowth; // in case of data corruption\n\n if (Object(_utils_helpers_isValidNumber__WEBPACK_IMPORTED_MODULE_7__[/* isValidNumber */ \"a\"])(server.moneyMax) && isNaN(server.moneyAvailable)) {\n server.moneyAvailable = server.moneyMax;\n } // cap at max\n\n\n if (Object(_utils_helpers_isValidNumber__WEBPACK_IMPORTED_MODULE_7__[/* isValidNumber */ \"a\"])(server.moneyMax) && server.moneyAvailable > server.moneyMax) {\n server.moneyAvailable = server.moneyMax;\n } // if there was any growth at all, increase security\n\n\n if (oldMoneyAvailable !== server.moneyAvailable) {\n //Growing increases server security twice as much as hacking\n let usedCycles = numCycleForGrowth(server, server.moneyAvailable / oldMoneyAvailable, p);\n usedCycles = Math.max(0, usedCycles);\n server.fortify(2 * _Constants__WEBPACK_IMPORTED_MODULE_4__[/* CONSTANTS */ \"a\"].ServerFortifyAmount * Math.ceil(usedCycles));\n }\n\n return server.moneyAvailable / oldMoneyAvailable;\n}\nfunction prestigeHomeComputer(homeComp) {\n const hasBitflume = homeComp.programs.includes(_Programs_Programs__WEBPACK_IMPORTED_MODULE_5__[/* Programs */ \"a\"].BitFlume.name);\n homeComp.programs.length = 0; //Remove programs\n\n homeComp.runningScripts = [];\n homeComp.serversOnNetwork = [];\n homeComp.isConnectedTo = true;\n homeComp.ramUsed = 0;\n homeComp.programs.push(_Programs_Programs__WEBPACK_IMPORTED_MODULE_5__[/* Programs */ \"a\"].NukeProgram.name);\n\n if (hasBitflume) {\n homeComp.programs.push(_Programs_Programs__WEBPACK_IMPORTED_MODULE_5__[/* Programs */ \"a\"].BitFlume.name);\n } //Update RAM usage on all scripts\n\n\n homeComp.scripts.forEach(function (script) {\n script.updateRamUsage(homeComp.scripts);\n });\n homeComp.messages.length = 0; //Remove .lit and .msg files\n\n homeComp.messages.push(_Literature_data_LiteratureNames__WEBPACK_IMPORTED_MODULE_6__[/* LiteratureNames */ \"a\"].HackersStartingHandbook);\n} //Returns server object with corresponding hostname\n// Relatively slow, would rather not use this a lot\n\nfunction GetServerByHostname(hostname) {\n for (const ip in _AllServers__WEBPACK_IMPORTED_MODULE_0__[/* AllServers */ \"b\"]) {\n if (_AllServers__WEBPACK_IMPORTED_MODULE_0__[/* AllServers */ \"b\"].hasOwnProperty(ip)) {\n if (_AllServers__WEBPACK_IMPORTED_MODULE_0__[/* AllServers */ \"b\"][ip].hostname == hostname) {\n return _AllServers__WEBPACK_IMPORTED_MODULE_0__[/* AllServers */ \"b\"][ip];\n }\n }\n }\n\n return null;\n} //Get server by IP or hostname. Returns null if invalid\n\nfunction getServer(s) {\n if (!Object(_utils_helpers_isValidIPAddress__WEBPACK_IMPORTED_MODULE_8__[/* isValidIPAddress */ \"a\"])(s)) {\n return GetServerByHostname(s);\n }\n\n if (_AllServers__WEBPACK_IMPORTED_MODULE_0__[/* AllServers */ \"b\"][s] !== undefined) {\n return _AllServers__WEBPACK_IMPORTED_MODULE_0__[/* AllServers */ \"b\"][s];\n }\n\n return null;\n} // Returns the i-th server on the specified server's network\n// A Server's serverOnNetwork property holds only the IPs. This function returns\n// the actual Server object\n\nfunction getServerOnNetwork(server, i) {\n if (i > server.serversOnNetwork.length) {\n console.error(\"Tried to get server on network that was out of range\");\n return null;\n }\n\n return _AllServers__WEBPACK_IMPORTED_MODULE_0__[/* AllServers */ \"b\"][server.serversOnNetwork[i]];\n}\nfunction isBackdoorInstalled(server) {\n if (\"backdoorInstalled\" in server) {\n return server.backdoorInstalled;\n }\n\n return false;\n}\n\n//# sourceURL=webpack:///./src/Server/ServerHelpers.ts?");
+eval("/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"h\", function() { return safetlyCreateUniqueServer; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"e\", function() { return numCycleForGrowth; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"g\", function() { return processSingleServerGrowth; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"f\", function() { return prestigeHomeComputer; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return GetServerByHostname; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"b\", function() { return getServer; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"c\", function() { return getServerOnNetwork; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"d\", function() { return isBackdoorInstalled; });\n/* harmony import */ var _AllServers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AllServers */ 29);\n/* harmony import */ var _Server__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Server */ 92);\n/* harmony import */ var _formulas_grow__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./formulas/grow */ 433);\n/* harmony import */ var _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../BitNode/BitNodeMultipliers */ 8);\n/* harmony import */ var _Constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Constants */ 5);\n/* harmony import */ var _Programs_Programs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Programs/Programs */ 54);\n/* harmony import */ var _Literature_data_LiteratureNames__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Literature/data/LiteratureNames */ 44);\n/* harmony import */ var _utils_helpers_isValidNumber__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../utils/helpers/isValidNumber */ 521);\n/* harmony import */ var _utils_helpers_isValidIPAddress__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../utils/helpers/isValidIPAddress */ 434);\n\n\n\n\n\n\n\n\n\n/**\n * Constructs a new server, while also ensuring that the new server\n * does not have a duplicate hostname/ip.\n */\n\nfunction safetlyCreateUniqueServer(params) {\n if (params.ip != null && Object(_AllServers__WEBPACK_IMPORTED_MODULE_0__[/* ipExists */ \"e\"])(params.ip)) {\n params.ip = Object(_AllServers__WEBPACK_IMPORTED_MODULE_0__[/* createUniqueRandomIp */ \"c\"])();\n }\n\n if (GetServerByHostname(params.hostname) != null) {\n // Use a for loop to ensure that we don't get suck in an infinite loop somehow\n let hostname = params.hostname;\n\n for (let i = 0; i < 200; ++i) {\n hostname = `${params.hostname}-${i}`;\n\n if (GetServerByHostname(hostname) == null) {\n break;\n }\n }\n\n params.hostname = hostname;\n }\n\n return new _Server__WEBPACK_IMPORTED_MODULE_1__[/* Server */ \"a\"](params);\n}\n/**\n * Returns the number of \"growth cycles\" needed to grow the specified server by the\n * specified amount.\n * @param server - Server being grown\n * @param growth - How much the server is being grown by, in DECIMAL form (e.g. 1.5 rather than 50)\n * @param p - Reference to Player object\n * @returns Number of \"growth cycles\" needed\n */\n\nfunction numCycleForGrowth(server, growth, p) {\n let ajdGrowthRate = 1 + (_Constants__WEBPACK_IMPORTED_MODULE_4__[/* CONSTANTS */ \"a\"].ServerBaseGrowthRate - 1) / server.hackDifficulty;\n\n if (ajdGrowthRate > _Constants__WEBPACK_IMPORTED_MODULE_4__[/* CONSTANTS */ \"a\"].ServerMaxGrowthRate) {\n ajdGrowthRate = _Constants__WEBPACK_IMPORTED_MODULE_4__[/* CONSTANTS */ \"a\"].ServerMaxGrowthRate;\n }\n\n const serverGrowthPercentage = server.serverGrowth / 100;\n const cycles = Math.log(growth) / (Math.log(ajdGrowthRate) * p.hacking_grow_mult * serverGrowthPercentage * _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_3__[/* BitNodeMultipliers */ \"a\"].ServerGrowthRate);\n return cycles;\n} //Applied server growth for a single server. Returns the percentage growth\n\nfunction processSingleServerGrowth(server, threads, p, cores = 1) {\n let serverGrowth = Object(_formulas_grow__WEBPACK_IMPORTED_MODULE_2__[/* calculateServerGrowth */ \"a\"])(server, threads, p, cores);\n\n if (serverGrowth < 1) {\n console.warn(\"serverGrowth calculated to be less than 1\");\n serverGrowth = 1;\n }\n\n const oldMoneyAvailable = server.moneyAvailable;\n server.moneyAvailable *= serverGrowth; // in case of data corruption\n\n if (Object(_utils_helpers_isValidNumber__WEBPACK_IMPORTED_MODULE_7__[/* isValidNumber */ \"a\"])(server.moneyMax) && isNaN(server.moneyAvailable)) {\n server.moneyAvailable = server.moneyMax;\n } // cap at max\n\n\n if (Object(_utils_helpers_isValidNumber__WEBPACK_IMPORTED_MODULE_7__[/* isValidNumber */ \"a\"])(server.moneyMax) && server.moneyAvailable > server.moneyMax) {\n server.moneyAvailable = server.moneyMax;\n } // if there was any growth at all, increase security\n\n\n if (oldMoneyAvailable !== server.moneyAvailable) {\n //Growing increases server security twice as much as hacking\n let usedCycles = numCycleForGrowth(server, server.moneyAvailable / oldMoneyAvailable, p);\n usedCycles = Math.max(0, usedCycles);\n server.fortify(2 * _Constants__WEBPACK_IMPORTED_MODULE_4__[/* CONSTANTS */ \"a\"].ServerFortifyAmount * Math.ceil(usedCycles));\n }\n\n return server.moneyAvailable / oldMoneyAvailable;\n}\nfunction prestigeHomeComputer(homeComp) {\n const hasBitflume = homeComp.programs.includes(_Programs_Programs__WEBPACK_IMPORTED_MODULE_5__[/* Programs */ \"a\"].BitFlume.name);\n homeComp.programs.length = 0; //Remove programs\n\n homeComp.runningScripts = [];\n homeComp.serversOnNetwork = [];\n homeComp.isConnectedTo = true;\n homeComp.ramUsed = 0;\n homeComp.programs.push(_Programs_Programs__WEBPACK_IMPORTED_MODULE_5__[/* Programs */ \"a\"].NukeProgram.name);\n\n if (hasBitflume) {\n homeComp.programs.push(_Programs_Programs__WEBPACK_IMPORTED_MODULE_5__[/* Programs */ \"a\"].BitFlume.name);\n } //Update RAM usage on all scripts\n\n\n homeComp.scripts.forEach(function (script) {\n script.updateRamUsage(homeComp.scripts);\n });\n homeComp.messages.length = 0; //Remove .lit and .msg files\n\n homeComp.messages.push(_Literature_data_LiteratureNames__WEBPACK_IMPORTED_MODULE_6__[/* LiteratureNames */ \"a\"].HackersStartingHandbook);\n} //Returns server object with corresponding hostname\n// Relatively slow, would rather not use this a lot\n\nfunction GetServerByHostname(hostname) {\n for (const ip in _AllServers__WEBPACK_IMPORTED_MODULE_0__[/* AllServers */ \"b\"]) {\n if (_AllServers__WEBPACK_IMPORTED_MODULE_0__[/* AllServers */ \"b\"].hasOwnProperty(ip)) {\n if (_AllServers__WEBPACK_IMPORTED_MODULE_0__[/* AllServers */ \"b\"][ip].hostname == hostname) {\n return _AllServers__WEBPACK_IMPORTED_MODULE_0__[/* AllServers */ \"b\"][ip];\n }\n }\n }\n\n return null;\n} //Get server by IP or hostname. Returns null if invalid\n\nfunction getServer(s) {\n if (!Object(_utils_helpers_isValidIPAddress__WEBPACK_IMPORTED_MODULE_8__[/* isValidIPAddress */ \"a\"])(s)) {\n return GetServerByHostname(s);\n }\n\n if (_AllServers__WEBPACK_IMPORTED_MODULE_0__[/* AllServers */ \"b\"][s] !== undefined) {\n return _AllServers__WEBPACK_IMPORTED_MODULE_0__[/* AllServers */ \"b\"][s];\n }\n\n return null;\n} // Returns the i-th server on the specified server's network\n// A Server's serverOnNetwork property holds only the IPs. This function returns\n// the actual Server object\n\nfunction getServerOnNetwork(server, i) {\n if (i > server.serversOnNetwork.length) {\n console.error(\"Tried to get server on network that was out of range\");\n return null;\n }\n\n return _AllServers__WEBPACK_IMPORTED_MODULE_0__[/* AllServers */ \"b\"][server.serversOnNetwork[i]];\n}\nfunction isBackdoorInstalled(server) {\n if (\"backdoorInstalled\" in server) {\n return server.backdoorInstalled;\n }\n\n return false;\n}\n\n//# sourceURL=webpack:///./src/Server/ServerHelpers.ts?");
/***/ }),
/* 37 */
@@ -549,7 +549,7 @@ eval("/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__,
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
-eval("/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"g\", function() { return hasHacknetServers; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"l\", function() { return purchaseHacknet; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"h\", function() { return hasMaxNumberHacknetServers; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return getCostOfNextHacknetNode; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"b\", function() { return getCostOfNextHacknetServer; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"e\", function() { return getMaxNumberLevelUpgrades; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"f\", function() { return getMaxNumberRamUpgrades; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"d\", function() { return getMaxNumberCoreUpgrades; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"c\", function() { return getMaxNumberCacheUpgrades; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"n\", function() { return purchaseLevelUpgrade; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"o\", function() { return purchaseRamUpgrade; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"k\", function() { return purchaseCoreUpgrade; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"j\", function() { return purchaseCacheUpgrade; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"i\", function() { return processHacknetEarnings; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"p\", function() { return updateHashManagerCapacity; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"m\", function() { return purchaseHashUpgrade; });\n/* harmony import */ var _HacknetNode__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./HacknetNode */ 247);\n/* harmony import */ var _formulas_HacknetNodes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./formulas/HacknetNodes */ 197);\n/* harmony import */ var _formulas_HacknetServers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./formulas/HacknetServers */ 180);\n/* harmony import */ var _data_Constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./data/Constants */ 32);\n/* harmony import */ var _HacknetServer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./HacknetServer */ 84);\n/* harmony import */ var _HashManager__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./HashManager */ 287);\n/* harmony import */ var _HashUpgrades__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./HashUpgrades */ 216);\n/* harmony import */ var _CodingContractGenerator__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../CodingContractGenerator */ 288);\n/* harmony import */ var _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../InteractiveTutorial */ 48);\n/* harmony import */ var _Server_AllServers__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Server/AllServers */ 29);\n/* harmony import */ var _Server_ServerHelpers__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Server/ServerHelpers */ 36);\n/* harmony import */ var _Server_Server__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Server/Server */ 92);\n/* harmony import */ var _SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../SourceFile/SourceFileFlags */ 49);\n/**\n * Generic helper/utility functions for the Hacknet mechanic:\n * - Purchase nodes/upgrades\n * - Calculating maximum number of upgrades\n * - Processing Hacknet earnings\n * - Updating Hash Manager capacity\n * - Purchasing hash upgrades\n *\n * TODO Should probably split the different types of functions into their own modules\n */\n\n\n\n\n\n\n\n\n\n\n\n\n // Returns a boolean indicating whether the player has Hacknet Servers\n// (the upgraded form of Hacknet Nodes)\n\nfunction hasHacknetServers(player) {\n return player.bitNodeN === 9 || _SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_12__[/* SourceFileFlags */ \"a\"][9] > 0;\n}\nfunction purchaseHacknet(player) {\n /* INTERACTIVE TUTORIAL */\n if (_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_8__[/* ITutorial */ \"a\"].isRunning) {\n if (_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_8__[/* ITutorial */ \"a\"].currStep === _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_8__[/* iTutorialSteps */ \"d\"].HacknetNodesIntroduction) {\n Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_8__[/* iTutorialNextStep */ \"b\"])();\n } else {\n return -1;\n }\n }\n /* END INTERACTIVE TUTORIAL */\n\n\n const numOwned = player.hacknetNodes.length;\n\n if (hasHacknetServers(player)) {\n const cost = getCostOfNextHacknetServer(player);\n\n if (isNaN(cost)) {\n throw new Error(`Calculated cost of purchasing HacknetServer is NaN`);\n }\n\n if (!player.canAfford(cost)) {\n return -1;\n }\n\n player.loseMoney(cost);\n player.createHacknetServer();\n updateHashManagerCapacity(player);\n return numOwned;\n } else {\n const cost = getCostOfNextHacknetNode(player);\n\n if (isNaN(cost)) {\n throw new Error(`Calculated cost of purchasing HacknetNode is NaN`);\n }\n\n if (!player.canAfford(cost)) {\n return -1;\n } // Auto generate a name for the Node\n\n\n const name = \"hacknet-node-\" + numOwned;\n const node = new _HacknetNode__WEBPACK_IMPORTED_MODULE_0__[/* HacknetNode */ \"a\"](name, player.hacknet_node_money_mult);\n player.loseMoney(cost);\n player.hacknetNodes.push(node);\n return numOwned;\n }\n}\nfunction hasMaxNumberHacknetServers(player) {\n return hasHacknetServers(player) && player.hacknetNodes.length >= _data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetServerConstants */ \"b\"].MaxServers;\n}\nfunction getCostOfNextHacknetNode(player) {\n return Object(_formulas_HacknetNodes__WEBPACK_IMPORTED_MODULE_1__[/* calculateNodeCost */ \"d\"])(player.hacknetNodes.length + 1, player.hacknet_node_purchase_cost_mult);\n}\nfunction getCostOfNextHacknetServer(player) {\n return Object(_formulas_HacknetServers__WEBPACK_IMPORTED_MODULE_2__[/* calculateServerCost */ \"f\"])(player.hacknetNodes.length + 1, player.hacknet_node_purchase_cost_mult);\n} // Calculate the maximum number of times the Player can afford to upgrade a Hacknet Node's level\n\nfunction getMaxNumberLevelUpgrades(player, nodeObj, maxLevel) {\n if (maxLevel == null) {\n throw new Error(`getMaxNumberLevelUpgrades() called without maxLevel arg`);\n }\n\n if (player.money.lt(nodeObj.calculateLevelUpgradeCost(1, player.hacknet_node_level_cost_mult))) {\n return 0;\n }\n\n let min = 1;\n let max = maxLevel - 1;\n const levelsToMax = maxLevel - nodeObj.level;\n\n if (player.money.gt(nodeObj.calculateLevelUpgradeCost(levelsToMax, player.hacknet_node_level_cost_mult))) {\n return levelsToMax;\n }\n\n while (min <= max) {\n const curr = (min + max) / 2 | 0;\n\n if (curr !== maxLevel && player.money.gt(nodeObj.calculateLevelUpgradeCost(curr, player.hacknet_node_level_cost_mult)) && player.money.lt(nodeObj.calculateLevelUpgradeCost(curr + 1, player.hacknet_node_level_cost_mult))) {\n return Math.min(levelsToMax, curr);\n } else if (player.money.lt(nodeObj.calculateLevelUpgradeCost(curr, player.hacknet_node_level_cost_mult))) {\n max = curr - 1;\n } else if (player.money.gt(nodeObj.calculateLevelUpgradeCost(curr, player.hacknet_node_level_cost_mult))) {\n min = curr + 1;\n } else {\n return Math.min(levelsToMax, curr);\n }\n }\n\n return 0;\n} // Calculate the maximum number of times the Player can afford to upgrade a Hacknet Node's RAM\n\nfunction getMaxNumberRamUpgrades(player, nodeObj, maxLevel) {\n if (maxLevel == null) {\n throw new Error(`getMaxNumberRamUpgrades() called without maxLevel arg`);\n }\n\n if (player.money.lt(nodeObj.calculateRamUpgradeCost(1, player.hacknet_node_ram_cost_mult))) {\n return 0;\n }\n\n let levelsToMax;\n\n if (nodeObj instanceof _HacknetServer__WEBPACK_IMPORTED_MODULE_4__[/* HacknetServer */ \"a\"]) {\n levelsToMax = Math.round(Math.log2(maxLevel / nodeObj.maxRam));\n } else {\n levelsToMax = Math.round(Math.log2(maxLevel / nodeObj.ram));\n }\n\n if (player.money.gt(nodeObj.calculateRamUpgradeCost(levelsToMax, player.hacknet_node_ram_cost_mult))) {\n return levelsToMax;\n } //We'll just loop until we find the max\n\n\n for (let i = levelsToMax - 1; i >= 0; --i) {\n if (player.money.gt(nodeObj.calculateRamUpgradeCost(i, player.hacknet_node_ram_cost_mult))) {\n return i;\n }\n }\n\n return 0;\n} // Calculate the maximum number of times the Player can afford to upgrade a Hacknet Node's cores\n\nfunction getMaxNumberCoreUpgrades(player, nodeObj, maxLevel) {\n if (maxLevel == null) {\n throw new Error(`getMaxNumberCoreUpgrades() called without maxLevel arg`);\n }\n\n if (player.money.lt(nodeObj.calculateCoreUpgradeCost(1, player.hacknet_node_core_cost_mult))) {\n return 0;\n }\n\n let min = 1;\n let max = maxLevel - 1;\n const levelsToMax = maxLevel - nodeObj.cores;\n\n if (player.money.gt(nodeObj.calculateCoreUpgradeCost(levelsToMax, player.hacknet_node_core_cost_mult))) {\n return levelsToMax;\n } // Use a binary search to find the max possible number of upgrades\n\n\n while (min <= max) {\n const curr = (min + max) / 2 | 0;\n\n if (curr != maxLevel && player.money.gt(nodeObj.calculateCoreUpgradeCost(curr, player.hacknet_node_core_cost_mult)) && player.money.lt(nodeObj.calculateCoreUpgradeCost(curr + 1, player.hacknet_node_core_cost_mult))) {\n return Math.min(levelsToMax, curr);\n } else if (player.money.lt(nodeObj.calculateCoreUpgradeCost(curr, player.hacknet_node_core_cost_mult))) {\n max = curr - 1;\n } else if (player.money.gt(nodeObj.calculateCoreUpgradeCost(curr, player.hacknet_node_core_cost_mult))) {\n min = curr + 1;\n } else {\n return Math.min(levelsToMax, curr);\n }\n }\n\n return 0;\n} // Calculate the maximum number of times the Player can afford to upgrade a Hacknet Node's cache\n\nfunction getMaxNumberCacheUpgrades(player, nodeObj, maxLevel) {\n if (maxLevel == null) {\n throw new Error(`getMaxNumberCacheUpgrades() called without maxLevel arg`);\n }\n\n if (!player.canAfford(nodeObj.calculateCacheUpgradeCost(1))) {\n return 0;\n }\n\n let min = 1;\n let max = maxLevel - 1;\n const levelsToMax = maxLevel - nodeObj.cache;\n\n if (player.canAfford(nodeObj.calculateCacheUpgradeCost(levelsToMax))) {\n return levelsToMax;\n } // Use a binary search to find the max possible number of upgrades\n\n\n while (min <= max) {\n const curr = (min + max) / 2 | 0;\n\n if (curr != maxLevel && player.canAfford(nodeObj.calculateCacheUpgradeCost(curr)) && !player.canAfford(nodeObj.calculateCacheUpgradeCost(curr + 1))) {\n return Math.min(levelsToMax, curr);\n } else if (!player.canAfford(nodeObj.calculateCacheUpgradeCost(curr))) {\n max = curr - 1;\n } else if (player.canAfford(nodeObj.calculateCacheUpgradeCost(curr))) {\n min = curr + 1;\n } else {\n return Math.min(levelsToMax, curr);\n }\n }\n\n return 0;\n}\nfunction purchaseLevelUpgrade(player, node, levels = 1) {\n const sanitizedLevels = Math.round(levels);\n const cost = node.calculateLevelUpgradeCost(sanitizedLevels, player.hacknet_node_level_cost_mult);\n\n if (isNaN(cost) || cost <= 0 || sanitizedLevels < 0) {\n return false;\n }\n\n const isServer = node instanceof _HacknetServer__WEBPACK_IMPORTED_MODULE_4__[/* HacknetServer */ \"a\"]; // If we're at max level, return false\n\n if (node.level >= (isServer ? _data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetServerConstants */ \"b\"].MaxLevel : _data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetNodeConstants */ \"a\"].MaxLevel)) {\n return false;\n } // If the number of specified upgrades would exceed the max level, calculate\n // the maximum number of upgrades and use that\n\n\n if (node.level + sanitizedLevels > (isServer ? _data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetServerConstants */ \"b\"].MaxLevel : _data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetNodeConstants */ \"a\"].MaxLevel)) {\n const diff = Math.max(0, (isServer ? _data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetServerConstants */ \"b\"].MaxLevel : _data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetNodeConstants */ \"a\"].MaxLevel) - node.level);\n return purchaseLevelUpgrade(player, node, diff);\n }\n\n if (!player.canAfford(cost)) {\n return false;\n }\n\n player.loseMoney(cost);\n node.upgradeLevel(sanitizedLevels, player.hacknet_node_money_mult);\n return true;\n}\nfunction purchaseRamUpgrade(player, node, levels = 1) {\n const sanitizedLevels = Math.round(levels);\n const cost = node.calculateRamUpgradeCost(sanitizedLevels, player.hacknet_node_ram_cost_mult);\n\n if (isNaN(cost) || cost <= 0 || sanitizedLevels < 0) {\n return false;\n }\n\n if (node instanceof _HacknetServer__WEBPACK_IMPORTED_MODULE_4__[/* HacknetServer */ \"a\"] && node.maxRam >= _data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetServerConstants */ \"b\"].MaxRam) {\n return false;\n }\n\n if (node instanceof _HacknetNode__WEBPACK_IMPORTED_MODULE_0__[/* HacknetNode */ \"a\"] && node.ram >= _data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetNodeConstants */ \"a\"].MaxRam) {\n return false;\n } // If the number of specified upgrades would exceed the max RAM, calculate the\n // max possible number of upgrades and use that\n\n\n if (node instanceof _HacknetServer__WEBPACK_IMPORTED_MODULE_4__[/* HacknetServer */ \"a\"]) {\n if (node.maxRam * Math.pow(2, sanitizedLevels) > _data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetServerConstants */ \"b\"].MaxRam) {\n const diff = Math.max(0, Math.log2(Math.round(_data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetServerConstants */ \"b\"].MaxRam / node.maxRam)));\n return purchaseRamUpgrade(player, node, diff);\n }\n } else if (node instanceof _HacknetNode__WEBPACK_IMPORTED_MODULE_0__[/* HacknetNode */ \"a\"]) {\n if (node.ram * Math.pow(2, sanitizedLevels) > _data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetNodeConstants */ \"a\"].MaxRam) {\n const diff = Math.max(0, Math.log2(Math.round(_data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetNodeConstants */ \"a\"].MaxRam / node.ram)));\n return purchaseRamUpgrade(player, node, diff);\n }\n }\n\n if (!player.canAfford(cost)) {\n return false;\n }\n\n player.loseMoney(cost);\n node.upgradeRam(sanitizedLevels, player.hacknet_node_money_mult);\n return true;\n}\nfunction purchaseCoreUpgrade(player, node, levels = 1) {\n const sanitizedLevels = Math.round(levels);\n const cost = node.calculateCoreUpgradeCost(sanitizedLevels, player.hacknet_node_core_cost_mult);\n\n if (isNaN(cost) || cost <= 0 || sanitizedLevels < 0) {\n return false;\n }\n\n const isServer = node instanceof _HacknetServer__WEBPACK_IMPORTED_MODULE_4__[/* HacknetServer */ \"a\"]; // Fail if we're already at max\n\n if (node.cores >= (isServer ? _data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetServerConstants */ \"b\"].MaxCores : _data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetNodeConstants */ \"a\"].MaxCores)) {\n return false;\n } // If the specified number of upgrades would exceed the max Cores, calculate\n // the max possible number of upgrades and use that\n\n\n if (node.cores + sanitizedLevels > (isServer ? _data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetServerConstants */ \"b\"].MaxCores : _data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetNodeConstants */ \"a\"].MaxCores)) {\n const diff = Math.max(0, (isServer ? _data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetServerConstants */ \"b\"].MaxCores : _data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetNodeConstants */ \"a\"].MaxCores) - node.cores);\n return purchaseCoreUpgrade(player, node, diff);\n }\n\n if (!player.canAfford(cost)) {\n return false;\n }\n\n player.loseMoney(cost);\n node.upgradeCore(sanitizedLevels, player.hacknet_node_money_mult);\n return true;\n}\nfunction purchaseCacheUpgrade(player, node, levels = 1) {\n const sanitizedLevels = Math.round(levels);\n const cost = node.calculateCacheUpgradeCost(sanitizedLevels);\n\n if (isNaN(cost) || cost <= 0 || sanitizedLevels < 0) {\n return false;\n }\n\n if (!(node instanceof _HacknetServer__WEBPACK_IMPORTED_MODULE_4__[/* HacknetServer */ \"a\"])) {\n console.warn(`purchaseCacheUpgrade() called for a non-HacknetNode`);\n return false;\n } // Fail if we're already at max\n\n\n if (node.cache + sanitizedLevels > _data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetServerConstants */ \"b\"].MaxCache) {\n const diff = Math.max(0, _data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetServerConstants */ \"b\"].MaxCache - node.cache);\n return purchaseCacheUpgrade(player, node, diff);\n }\n\n if (!player.canAfford(cost)) {\n return false;\n }\n\n player.loseMoney(cost);\n node.upgradeCache(sanitizedLevels);\n return true;\n}\nfunction processHacknetEarnings(player, numCycles) {\n // Determine if player has Hacknet Nodes or Hacknet Servers, then\n // call the appropriate function\n if (player.hacknetNodes.length === 0) {\n return 0;\n }\n\n if (hasHacknetServers(player)) {\n return processAllHacknetServerEarnings(player, numCycles);\n } else if (player.hacknetNodes[0] instanceof _HacknetNode__WEBPACK_IMPORTED_MODULE_0__[/* HacknetNode */ \"a\"]) {\n return processAllHacknetNodeEarnings(player, numCycles);\n } else {\n return 0;\n }\n}\n\nfunction processAllHacknetNodeEarnings(player, numCycles) {\n let total = 0;\n\n for (let i = 0; i < player.hacknetNodes.length; ++i) {\n const node = player.hacknetNodes[i];\n if (typeof node === \"string\") throw new Error(\"player node should not be ip string\");\n total += processSingleHacknetNodeEarnings(player, numCycles, node);\n }\n\n return total;\n}\n\nfunction processSingleHacknetNodeEarnings(player, numCycles, nodeObj) {\n const totalEarnings = nodeObj.process(numCycles);\n player.gainMoney(totalEarnings);\n player.recordMoneySource(totalEarnings, \"hacknetnode\");\n return totalEarnings;\n}\n\nfunction processAllHacknetServerEarnings(player, numCycles) {\n if (!(player.hashManager instanceof _HashManager__WEBPACK_IMPORTED_MODULE_5__[/* HashManager */ \"a\"])) {\n throw new Error(`Player does not have a HashManager (should be in 'hashManager' prop)`);\n }\n\n let hashes = 0;\n\n for (let i = 0; i < player.hacknetNodes.length; ++i) {\n // hacknetNodes array only contains the IP addresses of the servers.\n // Also, update the hash rate before processing\n const ip = player.hacknetNodes[i];\n if (ip instanceof _HacknetNode__WEBPACK_IMPORTED_MODULE_0__[/* HacknetNode */ \"a\"]) throw new Error(`player nodes should not be HacketNode`);\n const hserver = _Server_AllServers__WEBPACK_IMPORTED_MODULE_9__[/* AllServers */ \"b\"][ip];\n if (hserver instanceof _Server_Server__WEBPACK_IMPORTED_MODULE_11__[/* Server */ \"a\"]) throw new Error(`player nodes shoud not be Server`);\n hserver.updateHashRate(player.hacknet_node_money_mult);\n const h = hserver.process(numCycles);\n hserver.totalHashesGenerated += h;\n hashes += h;\n }\n\n player.hashManager.storeHashes(hashes);\n return hashes;\n}\n\nfunction updateHashManagerCapacity(player) {\n if (!(player.hashManager instanceof _HashManager__WEBPACK_IMPORTED_MODULE_5__[/* HashManager */ \"a\"])) {\n console.error(`Player does not have a HashManager`);\n return;\n }\n\n const nodes = player.hacknetNodes;\n\n if (nodes.length === 0) {\n player.hashManager.updateCapacity(0);\n return;\n }\n\n let total = 0;\n\n for (let i = 0; i < nodes.length; ++i) {\n if (typeof nodes[i] !== \"string\") {\n player.hashManager.updateCapacity(0);\n return;\n }\n\n const ip = nodes[i];\n if (ip instanceof _HacknetNode__WEBPACK_IMPORTED_MODULE_0__[/* HacknetNode */ \"a\"]) throw new Error(`player nodes should be string but isn't`);\n const h = _Server_AllServers__WEBPACK_IMPORTED_MODULE_9__[/* AllServers */ \"b\"][ip];\n\n if (!(h instanceof _HacknetServer__WEBPACK_IMPORTED_MODULE_4__[/* HacknetServer */ \"a\"])) {\n player.hashManager.updateCapacity(0);\n return;\n }\n\n total += h.hashCapacity;\n }\n\n player.hashManager.updateCapacity(total);\n}\nfunction purchaseHashUpgrade(player, upgName, upgTarget) {\n if (!(player.hashManager instanceof _HashManager__WEBPACK_IMPORTED_MODULE_5__[/* HashManager */ \"a\"])) {\n console.error(`Player does not have a HashManager`);\n return false;\n } // HashManager handles the transaction. This just needs to actually implement\n // the effects of the upgrade\n\n\n if (player.hashManager.upgrade(upgName)) {\n const upg = _HashUpgrades__WEBPACK_IMPORTED_MODULE_6__[/* HashUpgrades */ \"a\"][upgName];\n\n switch (upgName) {\n case \"Sell for Money\":\n {\n player.gainMoney(upg.value);\n player.recordMoneySource(upg.value, \"hacknetnode\");\n break;\n }\n\n case \"Sell for Corporation Funds\":\n {\n // This will throw if player doesn't have a corporation\n try {\n player.corporation.funds = player.corporation.funds.plus(upg.value);\n } catch (e) {\n player.hashManager.refundUpgrade(upgName);\n return false;\n }\n\n break;\n }\n\n case \"Reduce Minimum Security\":\n {\n try {\n const target = Object(_Server_ServerHelpers__WEBPACK_IMPORTED_MODULE_10__[/* GetServerByHostname */ \"a\"])(upgTarget);\n\n if (target == null) {\n console.error(`Invalid target specified in purchaseHashUpgrade(): ${upgTarget}`);\n return false;\n }\n\n if (!(target instanceof _Server_Server__WEBPACK_IMPORTED_MODULE_11__[/* Server */ \"a\"])) throw new Error(`'${upgTarget}' is not a normal server.`);\n target.changeMinimumSecurity(upg.value, true);\n } catch (e) {\n player.hashManager.refundUpgrade(upgName);\n return false;\n }\n\n break;\n }\n\n case \"Increase Maximum Money\":\n {\n try {\n const target = Object(_Server_ServerHelpers__WEBPACK_IMPORTED_MODULE_10__[/* GetServerByHostname */ \"a\"])(upgTarget);\n\n if (target == null) {\n console.error(`Invalid target specified in purchaseHashUpgrade(): ${upgTarget}`);\n return false;\n }\n\n if (!(target instanceof _Server_Server__WEBPACK_IMPORTED_MODULE_11__[/* Server */ \"a\"])) throw new Error(`'${upgTarget}' is not a normal server.`);\n target.changeMaximumMoney(upg.value, true);\n } catch (e) {\n player.hashManager.refundUpgrade(upgName);\n return false;\n }\n\n break;\n }\n\n case \"Improve Studying\":\n {\n // Multiplier handled by HashManager\n break;\n }\n\n case \"Improve Gym Training\":\n {\n // Multiplier handled by HashManager\n break;\n }\n\n case \"Exchange for Corporation Research\":\n {\n // This will throw if player doesn't have a corporation\n try {\n for (const division of player.corporation.divisions) {\n division.sciResearch.qty += upg.value;\n }\n } catch (e) {\n player.hashManager.refundUpgrade(upgName);\n return false;\n }\n\n break;\n }\n\n case \"Exchange for Bladeburner Rank\":\n {\n // This will throw if player isnt in Bladeburner\n try {\n player.bladeburner.changeRank(player, upg.value);\n } catch (e) {\n player.hashManager.refundUpgrade(upgName);\n return false;\n }\n\n break;\n }\n\n case \"Exchange for Bladeburner SP\":\n {\n // This will throw if player isn't in Bladeburner\n try {\n // As long as we don't change `Bladeburner.totalSkillPoints`, this\n // shouldn't affect anything else\n player.bladeburner.skillPoints += upg.value;\n } catch (e) {\n player.hashManager.refundUpgrade(upgName);\n return false;\n }\n\n break;\n }\n\n case \"Generate Coding Contract\":\n {\n Object(_CodingContractGenerator__WEBPACK_IMPORTED_MODULE_7__[/* generateRandomContract */ \"b\"])();\n break;\n }\n\n default:\n console.warn(`Unrecognized upgrade name ${upgName}. Upgrade has no effect`);\n player.hashManager.refundUpgrade(upgName);\n return false;\n }\n\n return true;\n }\n\n return false;\n}\n\n//# sourceURL=webpack:///./src/Hacknet/HacknetHelpers.tsx?");
+eval("/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"g\", function() { return hasHacknetServers; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"l\", function() { return purchaseHacknet; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"h\", function() { return hasMaxNumberHacknetServers; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return getCostOfNextHacknetNode; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"b\", function() { return getCostOfNextHacknetServer; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"e\", function() { return getMaxNumberLevelUpgrades; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"f\", function() { return getMaxNumberRamUpgrades; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"d\", function() { return getMaxNumberCoreUpgrades; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"c\", function() { return getMaxNumberCacheUpgrades; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"n\", function() { return purchaseLevelUpgrade; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"o\", function() { return purchaseRamUpgrade; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"k\", function() { return purchaseCoreUpgrade; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"j\", function() { return purchaseCacheUpgrade; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"i\", function() { return processHacknetEarnings; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"p\", function() { return updateHashManagerCapacity; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"m\", function() { return purchaseHashUpgrade; });\n/* harmony import */ var _HacknetNode__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./HacknetNode */ 247);\n/* harmony import */ var _formulas_HacknetNodes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./formulas/HacknetNodes */ 197);\n/* harmony import */ var _formulas_HacknetServers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./formulas/HacknetServers */ 180);\n/* harmony import */ var _data_Constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./data/Constants */ 32);\n/* harmony import */ var _HacknetServer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./HacknetServer */ 84);\n/* harmony import */ var _HashManager__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./HashManager */ 287);\n/* harmony import */ var _HashUpgrades__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./HashUpgrades */ 216);\n/* harmony import */ var _CodingContractGenerator__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../CodingContractGenerator */ 288);\n/* harmony import */ var _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../InteractiveTutorial */ 49);\n/* harmony import */ var _Server_AllServers__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Server/AllServers */ 29);\n/* harmony import */ var _Server_ServerHelpers__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Server/ServerHelpers */ 36);\n/* harmony import */ var _Server_Server__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Server/Server */ 92);\n/* harmony import */ var _SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../SourceFile/SourceFileFlags */ 50);\n/**\n * Generic helper/utility functions for the Hacknet mechanic:\n * - Purchase nodes/upgrades\n * - Calculating maximum number of upgrades\n * - Processing Hacknet earnings\n * - Updating Hash Manager capacity\n * - Purchasing hash upgrades\n *\n * TODO Should probably split the different types of functions into their own modules\n */\n\n\n\n\n\n\n\n\n\n\n\n\n // Returns a boolean indicating whether the player has Hacknet Servers\n// (the upgraded form of Hacknet Nodes)\n\nfunction hasHacknetServers(player) {\n return player.bitNodeN === 9 || _SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_12__[/* SourceFileFlags */ \"a\"][9] > 0;\n}\nfunction purchaseHacknet(player) {\n /* INTERACTIVE TUTORIAL */\n if (_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_8__[/* ITutorial */ \"a\"].isRunning) {\n if (_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_8__[/* ITutorial */ \"a\"].currStep === _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_8__[/* iTutorialSteps */ \"d\"].HacknetNodesIntroduction) {\n Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_8__[/* iTutorialNextStep */ \"b\"])();\n } else {\n return -1;\n }\n }\n /* END INTERACTIVE TUTORIAL */\n\n\n const numOwned = player.hacknetNodes.length;\n\n if (hasHacknetServers(player)) {\n const cost = getCostOfNextHacknetServer(player);\n\n if (isNaN(cost)) {\n throw new Error(`Calculated cost of purchasing HacknetServer is NaN`);\n }\n\n if (!player.canAfford(cost)) {\n return -1;\n }\n\n player.loseMoney(cost);\n player.createHacknetServer();\n updateHashManagerCapacity(player);\n return numOwned;\n } else {\n const cost = getCostOfNextHacknetNode(player);\n\n if (isNaN(cost)) {\n throw new Error(`Calculated cost of purchasing HacknetNode is NaN`);\n }\n\n if (!player.canAfford(cost)) {\n return -1;\n } // Auto generate a name for the Node\n\n\n const name = \"hacknet-node-\" + numOwned;\n const node = new _HacknetNode__WEBPACK_IMPORTED_MODULE_0__[/* HacknetNode */ \"a\"](name, player.hacknet_node_money_mult);\n player.loseMoney(cost);\n player.hacknetNodes.push(node);\n return numOwned;\n }\n}\nfunction hasMaxNumberHacknetServers(player) {\n return hasHacknetServers(player) && player.hacknetNodes.length >= _data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetServerConstants */ \"b\"].MaxServers;\n}\nfunction getCostOfNextHacknetNode(player) {\n return Object(_formulas_HacknetNodes__WEBPACK_IMPORTED_MODULE_1__[/* calculateNodeCost */ \"d\"])(player.hacknetNodes.length + 1, player.hacknet_node_purchase_cost_mult);\n}\nfunction getCostOfNextHacknetServer(player) {\n return Object(_formulas_HacknetServers__WEBPACK_IMPORTED_MODULE_2__[/* calculateServerCost */ \"f\"])(player.hacknetNodes.length + 1, player.hacknet_node_purchase_cost_mult);\n} // Calculate the maximum number of times the Player can afford to upgrade a Hacknet Node's level\n\nfunction getMaxNumberLevelUpgrades(player, nodeObj, maxLevel) {\n if (maxLevel == null) {\n throw new Error(`getMaxNumberLevelUpgrades() called without maxLevel arg`);\n }\n\n if (player.money.lt(nodeObj.calculateLevelUpgradeCost(1, player.hacknet_node_level_cost_mult))) {\n return 0;\n }\n\n let min = 1;\n let max = maxLevel - 1;\n const levelsToMax = maxLevel - nodeObj.level;\n\n if (player.money.gt(nodeObj.calculateLevelUpgradeCost(levelsToMax, player.hacknet_node_level_cost_mult))) {\n return levelsToMax;\n }\n\n while (min <= max) {\n const curr = (min + max) / 2 | 0;\n\n if (curr !== maxLevel && player.money.gt(nodeObj.calculateLevelUpgradeCost(curr, player.hacknet_node_level_cost_mult)) && player.money.lt(nodeObj.calculateLevelUpgradeCost(curr + 1, player.hacknet_node_level_cost_mult))) {\n return Math.min(levelsToMax, curr);\n } else if (player.money.lt(nodeObj.calculateLevelUpgradeCost(curr, player.hacknet_node_level_cost_mult))) {\n max = curr - 1;\n } else if (player.money.gt(nodeObj.calculateLevelUpgradeCost(curr, player.hacknet_node_level_cost_mult))) {\n min = curr + 1;\n } else {\n return Math.min(levelsToMax, curr);\n }\n }\n\n return 0;\n} // Calculate the maximum number of times the Player can afford to upgrade a Hacknet Node's RAM\n\nfunction getMaxNumberRamUpgrades(player, nodeObj, maxLevel) {\n if (maxLevel == null) {\n throw new Error(`getMaxNumberRamUpgrades() called without maxLevel arg`);\n }\n\n if (player.money.lt(nodeObj.calculateRamUpgradeCost(1, player.hacknet_node_ram_cost_mult))) {\n return 0;\n }\n\n let levelsToMax;\n\n if (nodeObj instanceof _HacknetServer__WEBPACK_IMPORTED_MODULE_4__[/* HacknetServer */ \"a\"]) {\n levelsToMax = Math.round(Math.log2(maxLevel / nodeObj.maxRam));\n } else {\n levelsToMax = Math.round(Math.log2(maxLevel / nodeObj.ram));\n }\n\n if (player.money.gt(nodeObj.calculateRamUpgradeCost(levelsToMax, player.hacknet_node_ram_cost_mult))) {\n return levelsToMax;\n } //We'll just loop until we find the max\n\n\n for (let i = levelsToMax - 1; i >= 0; --i) {\n if (player.money.gt(nodeObj.calculateRamUpgradeCost(i, player.hacknet_node_ram_cost_mult))) {\n return i;\n }\n }\n\n return 0;\n} // Calculate the maximum number of times the Player can afford to upgrade a Hacknet Node's cores\n\nfunction getMaxNumberCoreUpgrades(player, nodeObj, maxLevel) {\n if (maxLevel == null) {\n throw new Error(`getMaxNumberCoreUpgrades() called without maxLevel arg`);\n }\n\n if (player.money.lt(nodeObj.calculateCoreUpgradeCost(1, player.hacknet_node_core_cost_mult))) {\n return 0;\n }\n\n let min = 1;\n let max = maxLevel - 1;\n const levelsToMax = maxLevel - nodeObj.cores;\n\n if (player.money.gt(nodeObj.calculateCoreUpgradeCost(levelsToMax, player.hacknet_node_core_cost_mult))) {\n return levelsToMax;\n } // Use a binary search to find the max possible number of upgrades\n\n\n while (min <= max) {\n const curr = (min + max) / 2 | 0;\n\n if (curr != maxLevel && player.money.gt(nodeObj.calculateCoreUpgradeCost(curr, player.hacknet_node_core_cost_mult)) && player.money.lt(nodeObj.calculateCoreUpgradeCost(curr + 1, player.hacknet_node_core_cost_mult))) {\n return Math.min(levelsToMax, curr);\n } else if (player.money.lt(nodeObj.calculateCoreUpgradeCost(curr, player.hacknet_node_core_cost_mult))) {\n max = curr - 1;\n } else if (player.money.gt(nodeObj.calculateCoreUpgradeCost(curr, player.hacknet_node_core_cost_mult))) {\n min = curr + 1;\n } else {\n return Math.min(levelsToMax, curr);\n }\n }\n\n return 0;\n} // Calculate the maximum number of times the Player can afford to upgrade a Hacknet Node's cache\n\nfunction getMaxNumberCacheUpgrades(player, nodeObj, maxLevel) {\n if (maxLevel == null) {\n throw new Error(`getMaxNumberCacheUpgrades() called without maxLevel arg`);\n }\n\n if (!player.canAfford(nodeObj.calculateCacheUpgradeCost(1))) {\n return 0;\n }\n\n let min = 1;\n let max = maxLevel - 1;\n const levelsToMax = maxLevel - nodeObj.cache;\n\n if (player.canAfford(nodeObj.calculateCacheUpgradeCost(levelsToMax))) {\n return levelsToMax;\n } // Use a binary search to find the max possible number of upgrades\n\n\n while (min <= max) {\n const curr = (min + max) / 2 | 0;\n\n if (curr != maxLevel && player.canAfford(nodeObj.calculateCacheUpgradeCost(curr)) && !player.canAfford(nodeObj.calculateCacheUpgradeCost(curr + 1))) {\n return Math.min(levelsToMax, curr);\n } else if (!player.canAfford(nodeObj.calculateCacheUpgradeCost(curr))) {\n max = curr - 1;\n } else if (player.canAfford(nodeObj.calculateCacheUpgradeCost(curr))) {\n min = curr + 1;\n } else {\n return Math.min(levelsToMax, curr);\n }\n }\n\n return 0;\n}\nfunction purchaseLevelUpgrade(player, node, levels = 1) {\n const sanitizedLevels = Math.round(levels);\n const cost = node.calculateLevelUpgradeCost(sanitizedLevels, player.hacknet_node_level_cost_mult);\n\n if (isNaN(cost) || cost <= 0 || sanitizedLevels < 0) {\n return false;\n }\n\n const isServer = node instanceof _HacknetServer__WEBPACK_IMPORTED_MODULE_4__[/* HacknetServer */ \"a\"]; // If we're at max level, return false\n\n if (node.level >= (isServer ? _data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetServerConstants */ \"b\"].MaxLevel : _data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetNodeConstants */ \"a\"].MaxLevel)) {\n return false;\n } // If the number of specified upgrades would exceed the max level, calculate\n // the maximum number of upgrades and use that\n\n\n if (node.level + sanitizedLevels > (isServer ? _data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetServerConstants */ \"b\"].MaxLevel : _data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetNodeConstants */ \"a\"].MaxLevel)) {\n const diff = Math.max(0, (isServer ? _data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetServerConstants */ \"b\"].MaxLevel : _data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetNodeConstants */ \"a\"].MaxLevel) - node.level);\n return purchaseLevelUpgrade(player, node, diff);\n }\n\n if (!player.canAfford(cost)) {\n return false;\n }\n\n player.loseMoney(cost);\n node.upgradeLevel(sanitizedLevels, player.hacknet_node_money_mult);\n return true;\n}\nfunction purchaseRamUpgrade(player, node, levels = 1) {\n const sanitizedLevels = Math.round(levels);\n const cost = node.calculateRamUpgradeCost(sanitizedLevels, player.hacknet_node_ram_cost_mult);\n\n if (isNaN(cost) || cost <= 0 || sanitizedLevels < 0) {\n return false;\n }\n\n if (node instanceof _HacknetServer__WEBPACK_IMPORTED_MODULE_4__[/* HacknetServer */ \"a\"] && node.maxRam >= _data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetServerConstants */ \"b\"].MaxRam) {\n return false;\n }\n\n if (node instanceof _HacknetNode__WEBPACK_IMPORTED_MODULE_0__[/* HacknetNode */ \"a\"] && node.ram >= _data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetNodeConstants */ \"a\"].MaxRam) {\n return false;\n } // If the number of specified upgrades would exceed the max RAM, calculate the\n // max possible number of upgrades and use that\n\n\n if (node instanceof _HacknetServer__WEBPACK_IMPORTED_MODULE_4__[/* HacknetServer */ \"a\"]) {\n if (node.maxRam * Math.pow(2, sanitizedLevels) > _data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetServerConstants */ \"b\"].MaxRam) {\n const diff = Math.max(0, Math.log2(Math.round(_data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetServerConstants */ \"b\"].MaxRam / node.maxRam)));\n return purchaseRamUpgrade(player, node, diff);\n }\n } else if (node instanceof _HacknetNode__WEBPACK_IMPORTED_MODULE_0__[/* HacknetNode */ \"a\"]) {\n if (node.ram * Math.pow(2, sanitizedLevels) > _data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetNodeConstants */ \"a\"].MaxRam) {\n const diff = Math.max(0, Math.log2(Math.round(_data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetNodeConstants */ \"a\"].MaxRam / node.ram)));\n return purchaseRamUpgrade(player, node, diff);\n }\n }\n\n if (!player.canAfford(cost)) {\n return false;\n }\n\n player.loseMoney(cost);\n node.upgradeRam(sanitizedLevels, player.hacknet_node_money_mult);\n return true;\n}\nfunction purchaseCoreUpgrade(player, node, levels = 1) {\n const sanitizedLevels = Math.round(levels);\n const cost = node.calculateCoreUpgradeCost(sanitizedLevels, player.hacknet_node_core_cost_mult);\n\n if (isNaN(cost) || cost <= 0 || sanitizedLevels < 0) {\n return false;\n }\n\n const isServer = node instanceof _HacknetServer__WEBPACK_IMPORTED_MODULE_4__[/* HacknetServer */ \"a\"]; // Fail if we're already at max\n\n if (node.cores >= (isServer ? _data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetServerConstants */ \"b\"].MaxCores : _data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetNodeConstants */ \"a\"].MaxCores)) {\n return false;\n } // If the specified number of upgrades would exceed the max Cores, calculate\n // the max possible number of upgrades and use that\n\n\n if (node.cores + sanitizedLevels > (isServer ? _data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetServerConstants */ \"b\"].MaxCores : _data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetNodeConstants */ \"a\"].MaxCores)) {\n const diff = Math.max(0, (isServer ? _data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetServerConstants */ \"b\"].MaxCores : _data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetNodeConstants */ \"a\"].MaxCores) - node.cores);\n return purchaseCoreUpgrade(player, node, diff);\n }\n\n if (!player.canAfford(cost)) {\n return false;\n }\n\n player.loseMoney(cost);\n node.upgradeCore(sanitizedLevels, player.hacknet_node_money_mult);\n return true;\n}\nfunction purchaseCacheUpgrade(player, node, levels = 1) {\n const sanitizedLevels = Math.round(levels);\n const cost = node.calculateCacheUpgradeCost(sanitizedLevels);\n\n if (isNaN(cost) || cost <= 0 || sanitizedLevels < 0) {\n return false;\n }\n\n if (!(node instanceof _HacknetServer__WEBPACK_IMPORTED_MODULE_4__[/* HacknetServer */ \"a\"])) {\n console.warn(`purchaseCacheUpgrade() called for a non-HacknetNode`);\n return false;\n } // Fail if we're already at max\n\n\n if (node.cache + sanitizedLevels > _data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetServerConstants */ \"b\"].MaxCache) {\n const diff = Math.max(0, _data_Constants__WEBPACK_IMPORTED_MODULE_3__[/* HacknetServerConstants */ \"b\"].MaxCache - node.cache);\n return purchaseCacheUpgrade(player, node, diff);\n }\n\n if (!player.canAfford(cost)) {\n return false;\n }\n\n player.loseMoney(cost);\n node.upgradeCache(sanitizedLevels);\n return true;\n}\nfunction processHacknetEarnings(player, numCycles) {\n // Determine if player has Hacknet Nodes or Hacknet Servers, then\n // call the appropriate function\n if (player.hacknetNodes.length === 0) {\n return 0;\n }\n\n if (hasHacknetServers(player)) {\n return processAllHacknetServerEarnings(player, numCycles);\n } else if (player.hacknetNodes[0] instanceof _HacknetNode__WEBPACK_IMPORTED_MODULE_0__[/* HacknetNode */ \"a\"]) {\n return processAllHacknetNodeEarnings(player, numCycles);\n } else {\n return 0;\n }\n}\n\nfunction processAllHacknetNodeEarnings(player, numCycles) {\n let total = 0;\n\n for (let i = 0; i < player.hacknetNodes.length; ++i) {\n const node = player.hacknetNodes[i];\n if (typeof node === \"string\") throw new Error(\"player node should not be ip string\");\n total += processSingleHacknetNodeEarnings(player, numCycles, node);\n }\n\n return total;\n}\n\nfunction processSingleHacknetNodeEarnings(player, numCycles, nodeObj) {\n const totalEarnings = nodeObj.process(numCycles);\n player.gainMoney(totalEarnings);\n player.recordMoneySource(totalEarnings, \"hacknetnode\");\n return totalEarnings;\n}\n\nfunction processAllHacknetServerEarnings(player, numCycles) {\n if (!(player.hashManager instanceof _HashManager__WEBPACK_IMPORTED_MODULE_5__[/* HashManager */ \"a\"])) {\n throw new Error(`Player does not have a HashManager (should be in 'hashManager' prop)`);\n }\n\n let hashes = 0;\n\n for (let i = 0; i < player.hacknetNodes.length; ++i) {\n // hacknetNodes array only contains the IP addresses of the servers.\n // Also, update the hash rate before processing\n const ip = player.hacknetNodes[i];\n if (ip instanceof _HacknetNode__WEBPACK_IMPORTED_MODULE_0__[/* HacknetNode */ \"a\"]) throw new Error(`player nodes should not be HacketNode`);\n const hserver = _Server_AllServers__WEBPACK_IMPORTED_MODULE_9__[/* AllServers */ \"b\"][ip];\n if (hserver instanceof _Server_Server__WEBPACK_IMPORTED_MODULE_11__[/* Server */ \"a\"]) throw new Error(`player nodes shoud not be Server`);\n hserver.updateHashRate(player.hacknet_node_money_mult);\n const h = hserver.process(numCycles);\n hserver.totalHashesGenerated += h;\n hashes += h;\n }\n\n player.hashManager.storeHashes(hashes);\n return hashes;\n}\n\nfunction updateHashManagerCapacity(player) {\n if (!(player.hashManager instanceof _HashManager__WEBPACK_IMPORTED_MODULE_5__[/* HashManager */ \"a\"])) {\n console.error(`Player does not have a HashManager`);\n return;\n }\n\n const nodes = player.hacknetNodes;\n\n if (nodes.length === 0) {\n player.hashManager.updateCapacity(0);\n return;\n }\n\n let total = 0;\n\n for (let i = 0; i < nodes.length; ++i) {\n if (typeof nodes[i] !== \"string\") {\n player.hashManager.updateCapacity(0);\n return;\n }\n\n const ip = nodes[i];\n if (ip instanceof _HacknetNode__WEBPACK_IMPORTED_MODULE_0__[/* HacknetNode */ \"a\"]) throw new Error(`player nodes should be string but isn't`);\n const h = _Server_AllServers__WEBPACK_IMPORTED_MODULE_9__[/* AllServers */ \"b\"][ip];\n\n if (!(h instanceof _HacknetServer__WEBPACK_IMPORTED_MODULE_4__[/* HacknetServer */ \"a\"])) {\n player.hashManager.updateCapacity(0);\n return;\n }\n\n total += h.hashCapacity;\n }\n\n player.hashManager.updateCapacity(total);\n}\nfunction purchaseHashUpgrade(player, upgName, upgTarget) {\n if (!(player.hashManager instanceof _HashManager__WEBPACK_IMPORTED_MODULE_5__[/* HashManager */ \"a\"])) {\n console.error(`Player does not have a HashManager`);\n return false;\n } // HashManager handles the transaction. This just needs to actually implement\n // the effects of the upgrade\n\n\n if (player.hashManager.upgrade(upgName)) {\n const upg = _HashUpgrades__WEBPACK_IMPORTED_MODULE_6__[/* HashUpgrades */ \"a\"][upgName];\n\n switch (upgName) {\n case \"Sell for Money\":\n {\n player.gainMoney(upg.value);\n player.recordMoneySource(upg.value, \"hacknetnode\");\n break;\n }\n\n case \"Sell for Corporation Funds\":\n {\n // This will throw if player doesn't have a corporation\n try {\n player.corporation.funds = player.corporation.funds.plus(upg.value);\n } catch (e) {\n player.hashManager.refundUpgrade(upgName);\n return false;\n }\n\n break;\n }\n\n case \"Reduce Minimum Security\":\n {\n try {\n const target = Object(_Server_ServerHelpers__WEBPACK_IMPORTED_MODULE_10__[/* GetServerByHostname */ \"a\"])(upgTarget);\n\n if (target == null) {\n console.error(`Invalid target specified in purchaseHashUpgrade(): ${upgTarget}`);\n return false;\n }\n\n if (!(target instanceof _Server_Server__WEBPACK_IMPORTED_MODULE_11__[/* Server */ \"a\"])) throw new Error(`'${upgTarget}' is not a normal server.`);\n target.changeMinimumSecurity(upg.value, true);\n } catch (e) {\n player.hashManager.refundUpgrade(upgName);\n return false;\n }\n\n break;\n }\n\n case \"Increase Maximum Money\":\n {\n try {\n const target = Object(_Server_ServerHelpers__WEBPACK_IMPORTED_MODULE_10__[/* GetServerByHostname */ \"a\"])(upgTarget);\n\n if (target == null) {\n console.error(`Invalid target specified in purchaseHashUpgrade(): ${upgTarget}`);\n return false;\n }\n\n if (!(target instanceof _Server_Server__WEBPACK_IMPORTED_MODULE_11__[/* Server */ \"a\"])) throw new Error(`'${upgTarget}' is not a normal server.`);\n target.changeMaximumMoney(upg.value, true);\n } catch (e) {\n player.hashManager.refundUpgrade(upgName);\n return false;\n }\n\n break;\n }\n\n case \"Improve Studying\":\n {\n // Multiplier handled by HashManager\n break;\n }\n\n case \"Improve Gym Training\":\n {\n // Multiplier handled by HashManager\n break;\n }\n\n case \"Exchange for Corporation Research\":\n {\n // This will throw if player doesn't have a corporation\n try {\n for (const division of player.corporation.divisions) {\n division.sciResearch.qty += upg.value;\n }\n } catch (e) {\n player.hashManager.refundUpgrade(upgName);\n return false;\n }\n\n break;\n }\n\n case \"Exchange for Bladeburner Rank\":\n {\n // This will throw if player isnt in Bladeburner\n try {\n player.bladeburner.changeRank(player, upg.value);\n } catch (e) {\n player.hashManager.refundUpgrade(upgName);\n return false;\n }\n\n break;\n }\n\n case \"Exchange for Bladeburner SP\":\n {\n // This will throw if player isn't in Bladeburner\n try {\n // As long as we don't change `Bladeburner.totalSkillPoints`, this\n // shouldn't affect anything else\n player.bladeburner.skillPoints += upg.value;\n } catch (e) {\n player.hashManager.refundUpgrade(upgName);\n return false;\n }\n\n break;\n }\n\n case \"Generate Coding Contract\":\n {\n Object(_CodingContractGenerator__WEBPACK_IMPORTED_MODULE_7__[/* generateRandomContract */ \"b\"])();\n break;\n }\n\n default:\n console.warn(`Unrecognized upgrade name ${upgName}. Upgrade has no effect`);\n player.hashManager.refundUpgrade(upgName);\n return false;\n }\n\n return true;\n }\n\n return false;\n}\n\n//# sourceURL=webpack:///./src/Hacknet/HacknetHelpers.tsx?");
/***/ }),
/* 46 */
@@ -566,93 +566,6 @@ eval("/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__,
/***/ }),
/* 47 */,
/* 48 */
-/*!************************************!*\
- !*** ./src/InteractiveTutorial.js ***!
- \************************************/
-/*! exports provided: iTutorialSteps, iTutorialEnd, iTutorialStart, iTutorialNextStep, ITutorial */
-/*! exports used: ITutorial, iTutorialNextStep, iTutorialStart, iTutorialSteps */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-eval("/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"d\", function() { return iTutorialSteps; });\n/* unused harmony export iTutorialEnd */\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"c\", function() { return iTutorialStart; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"b\", function() { return iTutorialNextStep; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return ITutorial; });\n/* harmony import */ var _engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./engine */ 138);\n/* harmony import */ var _Player__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Player */ 2);\n/* harmony import */ var _Settings_Settings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Settings/Settings */ 34);\n/* harmony import */ var _Literature_data_LiteratureNames__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Literature/data/LiteratureNames */ 44);\n/* harmony import */ var _utils_uiHelpers_clearEventListeners__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils/uiHelpers/clearEventListeners */ 286);\n/* harmony import */ var _utils_uiHelpers_createElement__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils/uiHelpers/createElement */ 113);\n/* harmony import */ var _utils_uiHelpers_createPopup__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../utils/uiHelpers/createPopup */ 435);\n/* harmony import */ var _utils_uiHelpers_removeElementById__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../utils/uiHelpers/removeElementById */ 211);\n\n\n\n\n\n\n\n // Ordered array of keys to Interactive Tutorial Steps\n\nconst orderedITutorialSteps = [\"Start\", \"GoToCharacterPage\", // Click on 'Stats' page\n\"CharacterPage\", // Introduction to 'Stats' page\n\"CharacterGoToTerminalPage\", // Go back to Terminal\n\"TerminalIntro\", // Introduction to Terminal\n\"TerminalHelp\", // Using 'help' Terminal command\n\"TerminalLs\", // Using 'ls' Terminal command\n\"TerminalScan\", // Using 'scan' Terminal command\n\"TerminalScanAnalyze1\", // Using 'scan-analyze' Terminal command\n\"TerminalScanAnalyze2\", // Using 'scan-analyze 3' Terminal command\n\"TerminalConnect\", // Connecting to n00dles\n\"TerminalAnalyze\", // Analyzing n00dles\n\"TerminalNuke\", // NUKE n00dles\n\"TerminalManualHack\", // Hack n00dles\n\"TerminalHackingMechanics\", // Explanation of hacking mechanics\n\"TerminalCreateScript\", // Create a script using 'nano'\n\"TerminalTypeScript\", // Script Editor page - Type script and then save & close\n\"TerminalFree\", // Using 'Free' Terminal command\n\"TerminalRunScript\", // Running script using 'run' Terminal command\n\"TerminalGoToActiveScriptsPage\", \"ActiveScriptsPage\", \"ActiveScriptsToTerminal\", \"TerminalTailScript\", \"GoToHacknetNodesPage\", \"HacknetNodesIntroduction\", \"HacknetNodesGoToWorldPage\", \"WorldDescription\", \"TutorialPageInfo\", \"End\"]; // Create an 'enum' for the Steps\n\nconst iTutorialSteps = {};\n\nfor (let i = 0; i < orderedITutorialSteps.length; ++i) {\n iTutorialSteps[orderedITutorialSteps[i]] = i;\n}\n\nconst ITutorial = {\n currStep: 0,\n // iTutorialSteps.Start\n isRunning: false,\n // Keeps track of whether each step has been done\n stepIsDone: {}\n};\n\nfunction iTutorialStart() {\n // Initialize Interactive Tutorial state by settings 'done' for each state to false\n ITutorial.stepIsDone = {};\n\n for (let i = 0; i < orderedITutorialSteps.length; ++i) {\n ITutorial.stepIsDone[i] = false;\n } // Don't autosave during this interactive tutorial\n\n\n _engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].Counters.autoSaveCounter = Infinity;\n ITutorial.currStep = 0;\n ITutorial.isRunning = true;\n document.getElementById(\"interactive-tutorial-container\").style.display = \"block\"; // Exit tutorial button\n\n const exitButton = Object(_utils_uiHelpers_clearEventListeners__WEBPACK_IMPORTED_MODULE_4__[/* clearEventListeners */ \"a\"])(\"interactive-tutorial-exit\");\n exitButton.addEventListener(\"click\", function () {\n iTutorialEnd();\n return false;\n }); // Back button\n\n const backButton = Object(_utils_uiHelpers_clearEventListeners__WEBPACK_IMPORTED_MODULE_4__[/* clearEventListeners */ \"a\"])(\"interactive-tutorial-back\");\n backButton.addEventListener(\"click\", function () {\n iTutorialPrevStep();\n return false;\n }); // Next button\n\n const nextButton = Object(_utils_uiHelpers_clearEventListeners__WEBPACK_IMPORTED_MODULE_4__[/* clearEventListeners */ \"a\"])(\"interactive-tutorial-next\");\n nextButton.addEventListener(\"click\", function () {\n iTutorialNextStep();\n return false;\n });\n iTutorialEvaluateStep();\n}\n\nfunction iTutorialEvaluateStep() {\n if (!ITutorial.isRunning) {\n return;\n } // Disable and clear main menu\n // const terminalMainMenu = clearEventListeners(\"terminal-menu-link\");\n // const statsMainMenu = clearEventListeners(\"stats-menu-link\");\n // const activeScriptsMainMenu = clearEventListeners(\"active-scripts-menu-link\");\n // const hacknetMainMenu = clearEventListeners(\"hacknet-nodes-menu-link\");\n // const cityMainMenu = clearEventListeners(\"city-menu-link\");\n // const tutorialMainMenu = clearEventListeners(\"tutorial-menu-link\");\n // terminalMainMenu.removeAttribute(\"class\");\n // statsMainMenu.removeAttribute(\"class\");\n // activeScriptsMainMenu.removeAttribute(\"class\");\n // hacknetMainMenu.removeAttribute(\"class\");\n // cityMainMenu.removeAttribute(\"class\");\n // tutorialMainMenu.removeAttribute(\"class\");\n // Interactive Tutorial Next button\n\n\n const nextBtn = document.getElementById(\"interactive-tutorial-next\");\n\n switch (ITutorial.currStep) {\n case iTutorialSteps.Start:\n 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.\");\n nextBtn.style.display = \"inline-block\";\n break;\n\n case iTutorialSteps.GoToCharacterPage:\n 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)\");\n nextBtn.style.display = \"none\";\n break;\n\n case iTutorialSteps.CharacterPage:\n iTutorialSetText(\"The Stats
page shows a lot of important information about your progress, \" + \"such as your skills, money, and bonuses. \");\n nextBtn.style.display = \"inline-block\";\n break;\n\n case iTutorialSteps.CharacterGoToTerminalPage:\n iTutorialSetText(\"Let's head to your computer's terminal by clicking the Terminal
tab on the \" + \"main navigation menu.\");\n nextBtn.style.display = \"none\";\n break;\n\n case iTutorialSteps.TerminalIntro:\n iTutorialSetText(\"The Terminal
is used to interface with your home computer as well as \" + \"all of the other machines around the world.\");\n nextBtn.style.display = \"inline-block\";\n break;\n\n case iTutorialSteps.TerminalHelp:\n 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)\");\n nextBtn.style.display = \"none\"; // next step triggered by terminal command\n\n break;\n\n case iTutorialSteps.TerminalLs:\n 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.\");\n nextBtn.style.display = \"none\"; // next step triggered by terminal command\n\n break;\n\n case iTutorialSteps.TerminalScan:\n 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.\");\n nextBtn.style.display = \"none\"; // next step triggered by terminal command\n\n break;\n\n case iTutorialSteps.TerminalScanAnalyze1:\n 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!\");\n nextBtn.style.display = \"none\"; // next step triggered by terminal command\n\n break;\n\n case iTutorialSteps.TerminalScanAnalyze2:\n 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
.\");\n nextBtn.style.display = \"none\"; // next step triggered by terminal command\n\n break;\n\n case iTutorialSteps.TerminalConnect:\n 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
\");\n nextBtn.style.display = \"none\"; // next step triggered by terminal command\n\n break;\n\n case iTutorialSteps.TerminalAnalyze:\n 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.\");\n nextBtn.style.display = \"none\"; // next step triggered by terminal command\n\n break;\n\n case iTutorialSteps.TerminalNuke:\n 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.\");\n nextBtn.style.display = \"none\"; // next step triggered by terminal command\n\n break;\n\n case iTutorialSteps.TerminalManualHack:\n iTutorialSetText(\"You now have root access! You can hack the server using the hack
command. \" + \"Try doing that now.\");\n nextBtn.style.display = \"none\"; // next step triggered by terminal command\n\n break;\n\n case iTutorialSteps.TerminalHackingMechanics:\n 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.\");\n nextBtn.style.display = \"inline-block\";\n break;\n\n case iTutorialSteps.TerminalCreateScript:\n 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)\");\n nextBtn.style.display = \"none\"; // next step triggered by terminal command\n\n break;\n\n case iTutorialSteps.TerminalTypeScript:\n 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.free
command.\");\n nextBtn.style.display = \"none\"; // next step triggered by terminal commmand\n\n break;\n\n case iTutorialSteps.TerminalRunScript:\n 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
.\");\n nextBtn.style.display = \"none\"; // next step triggered by terminal commmand\n\n break;\n\n case iTutorialSteps.TerminalGoToActiveScriptsPage:\n 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). Active Scripts
link in the main navigation menu.\");\n nextBtn.style.display = \"none\";\n break;\n\n case iTutorialSteps.ActiveScriptsPage:\n 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
\");\n nextBtn.style.display = \"none\";\n break;\n\n case iTutorialSteps.ActiveScriptsToTerminal:\n 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
\");\n nextBtn.style.display = \"none\"; // next step triggered by terminal command\n\n break;\n\n case iTutorialSteps.TerminalTailScript:\n 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! 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.Hacknet
page through the main navigation menu now.\");\n nextBtn.style.display = \"none\";\n break;\n\n case iTutorialSteps.HacknetNodesIntroduction:\n iTutorialSetText(\"here you can purchase new Hacknet Nodes and upgrade your \" + \"existing ones. Let's purchase a new one now.\");\n nextBtn.style.display = \"none\"; // Next step triggered by purchaseHacknet() (HacknetNode.js)\n\n break;\n\n case iTutorialSteps.HacknetNodesGoToWorldPage:\n 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.City
page through the main navigation menu.\");\n nextBtn.style.display = \"none\";\n break;\n\n case iTutorialSteps.WorldDescription:\n 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!Tutorial
link in the main navigation menu.\");\n nextBtn.style.display = \"none\";\n break;\n\n case iTutorialSteps.TutorialPageInfo:\n 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!\");\n nextBtn.style.display = \"inline-block\";\n nextBtn.innerHTML = \"Finish Tutorial\";\n break;\n\n case iTutorialSteps.End:\n iTutorialEnd();\n break;\n\n default:\n throw new Error(\"Invalid tutorial step\");\n }\n\n if (ITutorial.stepIsDone[ITutorial.currStep] === true) {\n nextBtn.style.display = \"inline-block\";\n }\n} // Go to the next step and evaluate it\n\n\nfunction iTutorialNextStep() {\n ITutorial.stepIsDone[ITutorial.currStep] = true;\n\n if (ITutorial.currStep < iTutorialSteps.End) {\n ITutorial.currStep += 1;\n }\n\n iTutorialEvaluateStep();\n} // Go to previous step and evaluate\n\n\nfunction iTutorialPrevStep() {\n if (ITutorial.currStep > iTutorialSteps.Start) {\n ITutorial.currStep -= 1;\n }\n\n iTutorialEvaluateStep();\n}\n\nfunction iTutorialEnd() {\n // Re-enable auto save\n if (_Settings_Settings__WEBPACK_IMPORTED_MODULE_2__[/* Settings */ \"a\"].AutosaveInterval === 0) {\n _engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].Counters.autoSaveCounter = Infinity;\n } else {\n _engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].Counters.autoSaveCounter = _Settings_Settings__WEBPACK_IMPORTED_MODULE_2__[/* Settings */ \"a\"].AutosaveInterval * 5;\n }\n\n _engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].init();\n ITutorial.currStep = iTutorialSteps.End;\n ITutorial.isRunning = false;\n document.getElementById(\"interactive-tutorial-container\").style.display = \"none\"; // Create a popup with final introductory stuff\n\n const popupId = \"interactive-tutorial-ending-popup\";\n const txt = Object(_utils_uiHelpers_createElement__WEBPACK_IMPORTED_MODULE_5__[/* createElement */ \"a\"])(\"p\", {\n innerHTML: \"If you are new to the game, the following links may be useful for you!Stats
tab on \" + \"the main navigation menu (left-hand side of the screen)\");\n nextBtn.style.display = \"none\";\n break;\n\n case iTutorialSteps.CharacterPage:\n iTutorialSetText(\"The Stats
page shows a lot of important information about your progress, \" + \"such as your skills, money, and bonuses. \");\n nextBtn.style.display = \"inline-block\";\n break;\n\n case iTutorialSteps.CharacterGoToTerminalPage:\n iTutorialSetText(\"Let's head to your computer's terminal by clicking the Terminal
tab on the \" + \"main navigation menu.\");\n nextBtn.style.display = \"none\";\n break;\n\n case iTutorialSteps.TerminalIntro:\n iTutorialSetText(\"The Terminal
is used to interface with your home computer as well as \" + \"all of the other machines around the world.\");\n nextBtn.style.display = \"inline-block\";\n break;\n\n case iTutorialSteps.TerminalHelp:\n 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)\");\n nextBtn.style.display = \"none\"; // next step triggered by terminal command\n\n break;\n\n case iTutorialSteps.TerminalLs:\n iTutorialSetText(\"The help
command displays a list of all available Terminal
commands, how to use them, \" + \"and a description of what they do. ls
command.\");\n nextBtn.style.display = \"none\"; // next step triggered by terminal command\n\n break;\n\n case iTutorialSteps.TerminalScan:\n 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. scan
command.\");\n nextBtn.style.display = \"none\"; // next step triggered by terminal command\n\n break;\n\n case iTutorialSteps.TerminalScanAnalyze1:\n 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. scan-analyze
command gives some more detailed information about servers on the \" + \"network. Try it now!\");\n nextBtn.style.display = \"none\"; // next step triggered by terminal command\n\n break;\n\n case iTutorialSteps.TerminalScanAnalyze2:\n 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). scan-analyze
with \" + \"a higher depth. Let's try a depth of two with the following command: scan-analyze 2
.\");\n nextBtn.style.display = \"none\"; // next step triggered by terminal command\n\n break;\n\n case iTutorialSteps.TerminalConnect:\n 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.scan-analyze
command, we can see that the n00dles
server is \" + \"only one node away. Let's connect so it now using: connect n00dles
\");\n nextBtn.style.display = \"none\"; // next step triggered by terminal command\n\n break;\n\n case iTutorialSteps.TerminalAnalyze:\n iTutorialSetText(\"You are now connected to another machine! What can you do now? You can hack it!analyze
command.\");\n nextBtn.style.display = \"none\"; // next step triggered by terminal command\n\n break;\n\n case iTutorialSteps.TerminalNuke:\n iTutorialSetText(\"When the analyze
command finishes running it will show useful information \" + \"about hacking the server. 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.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.\");\n nextBtn.style.display = \"none\"; // next step triggered by terminal command\n\n break;\n\n case iTutorialSteps.TerminalManualHack:\n iTutorialSetText(\"You now have root access! You can hack the server using the hack
command. \" + \"Try doing that now.\");\n nextBtn.style.display = \"none\"; // next step triggered by terminal command\n\n break;\n\n case iTutorialSteps.TerminalHackingMechanics:\n 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.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)\");\n nextBtn.style.display = \"none\"; // next step triggered by terminal command\n\n break;\n\n case iTutorialSteps.TerminalTypeScript:\n 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.free
command.\");\n nextBtn.style.display = \"none\"; // next step triggered by terminal commmand\n\n break;\n\n case iTutorialSteps.TerminalRunScript:\n 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
.\");\n nextBtn.style.display = \"none\"; // next step triggered by terminal commmand\n\n break;\n\n case iTutorialSteps.TerminalGoToActiveScriptsPage:\n 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). Active Scripts
link in the main navigation menu.\");\n nextBtn.style.display = \"none\";\n break;\n\n case iTutorialSteps.ActiveScriptsPage:\n 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
\");\n nextBtn.style.display = \"none\";\n break;\n\n case iTutorialSteps.ActiveScriptsToTerminal:\n 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
\");\n nextBtn.style.display = \"none\"; // next step triggered by terminal command\n\n break;\n\n case iTutorialSteps.TerminalTailScript:\n 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! 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.Hacknet
page through the main navigation menu now.\");\n nextBtn.style.display = \"none\";\n break;\n\n case iTutorialSteps.HacknetNodesIntroduction:\n iTutorialSetText(\"here you can purchase new Hacknet Nodes and upgrade your \" + \"existing ones. Let's purchase a new one now.\");\n nextBtn.style.display = \"none\"; // Next step triggered by purchaseHacknet() (HacknetNode.js)\n\n break;\n\n case iTutorialSteps.HacknetNodesGoToWorldPage:\n 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.City
page through the main navigation menu.\");\n nextBtn.style.display = \"none\";\n break;\n\n case iTutorialSteps.WorldDescription:\n 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!Tutorial
link in the main navigation menu.\");\n nextBtn.style.display = \"none\";\n break;\n\n case iTutorialSteps.TutorialPageInfo:\n 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!\");\n nextBtn.style.display = \"inline-block\";\n nextBtn.innerHTML = \"Finish Tutorial\";\n break;\n\n case iTutorialSteps.End:\n iTutorialEnd();\n break;\n\n default:\n throw new Error(\"Invalid tutorial step\");\n }\n\n if (ITutorial.stepIsDone[ITutorial.currStep] === true) {\n nextBtn.style.display = \"inline-block\";\n }\n} // Go to the next step and evaluate it\n\n\nfunction iTutorialNextStep() {\n ITutorial.stepIsDone[ITutorial.currStep] = true;\n\n if (ITutorial.currStep < iTutorialSteps.End) {\n ITutorial.currStep += 1;\n }\n\n iTutorialEvaluateStep();\n} // Go to previous step and evaluate\n\n\nfunction iTutorialPrevStep() {\n if (ITutorial.currStep > iTutorialSteps.Start) {\n ITutorial.currStep -= 1;\n }\n\n iTutorialEvaluateStep();\n}\n\nfunction iTutorialEnd() {\n // Re-enable auto save\n if (_Settings_Settings__WEBPACK_IMPORTED_MODULE_2__[/* Settings */ \"a\"].AutosaveInterval === 0) {\n _engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].Counters.autoSaveCounter = Infinity;\n } else {\n _engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].Counters.autoSaveCounter = _Settings_Settings__WEBPACK_IMPORTED_MODULE_2__[/* Settings */ \"a\"].AutosaveInterval * 5;\n }\n\n _engine__WEBPACK_IMPORTED_MODULE_0__[\"Engine\"].init();\n ITutorial.currStep = iTutorialSteps.End;\n ITutorial.isRunning = false;\n document.getElementById(\"interactive-tutorial-container\").style.display = \"none\"; // Create a popup with final introductory stuff\n\n const popupId = \"interactive-tutorial-ending-popup\";\n const txt = Object(_utils_uiHelpers_createElement__WEBPACK_IMPORTED_MODULE_5__[/* createElement */ \"a\"])(\"p\", {\n innerHTML: \"If you are new to the game, the following links may be useful for you!FAILED
- Contract is now self-destructing\");\n serv.removeContract(contract);\n } else {\n this.print(`ContractFAILED
- ${contract.getMaxNumTries() - contract.tries} tries remaining`);\n }\n\n break;\n\n case _CodingContracts__WEBPACK_IMPORTED_MODULE_3__[/* CodingContractResult */ \"b\"].Cancelled:\n default:\n this.print(\"Contract cancelled\");\n break;\n }\n\n this.contractOpen = false;\n }\n\n executeScanAnalyzeCommand(player, depth = 1, all = false) {\n // TODO Using array as stack for now, can make more efficient\n this.print(\"~~~~~~~~~~ Beginning scan-analyze ~~~~~~~~~~\");\n this.print(\" \"); // Map of all servers to keep track of which have been visited\n\n const visited = {};\n\n for (const ip in _Server_AllServers__WEBPACK_IMPORTED_MODULE_6__[/* AllServers */ \"b\"]) {\n visited[ip] = 0;\n }\n\n const stack = [];\n const depthQueue = [0];\n const currServ = player.getCurrentServer();\n stack.push(currServ);\n\n while (stack.length != 0) {\n const s = stack.pop();\n if (!s) continue;\n const d = depthQueue.pop();\n if (d === undefined) continue;\n const isHacknet = s instanceof _Hacknet_HacknetServer__WEBPACK_IMPORTED_MODULE_1__[/* HacknetServer */ \"a\"];\n\n if (!all && s.purchasedByPlayer && s.hostname != \"home\") {\n continue; // Purchased server\n } else if (visited[s.ip] || d > depth) {\n continue; // Already visited or out-of-depth\n } else if (!all && isHacknet) {\n continue; // Hacknet Server\n } else {\n visited[s.ip] = 1;\n }\n\n for (let i = s.serversOnNetwork.length - 1; i >= 0; --i) {\n const newS = Object(_Server_ServerHelpers__WEBPACK_IMPORTED_MODULE_13__[/* getServerOnNetwork */ \"c\"])(s, i);\n if (newS === null) continue;\n stack.push(newS);\n depthQueue.push(d + 1);\n }\n\n if (d == 0) {\n continue;\n } // Don't print current server\n\n\n const titleDashes = Array((d - 1) * 4 + 1).join(\"-\");\n\n if (player.hasProgram(_Programs_Programs__WEBPACK_IMPORTED_MODULE_2__[/* Programs */ \"a\"].AutoLink.name)) {\n this.append(new _ITerminal__WEBPACK_IMPORTED_MODULE_0__[/* Link */ \"a\"](s.hostname));\n } else {\n this.print(s.hostname);\n }\n\n const dashes = titleDashes + \"--\";\n let c = \"NO\";\n\n if (s.hasAdminRights) {\n c = \"YES\";\n }\n\n this.print(`${dashes}Root Access: ${c}${!isHacknet ? \", Required hacking skill: \" + s.requiredHackingSkill : \"\"}`);\n\n if (s.hasOwnProperty(\"numOpenPortsRequired\")) {\n this.print(dashes + \"Number of open ports required to NUKE: \" + s.numOpenPortsRequired);\n }\n\n this.print(dashes + \"RAM: \" + _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_19__[/* numeralWrapper */ \"a\"].formatRAM(s.maxRam));\n this.print(\" \");\n }\n\n const links = document.getElementsByClassName(\"scan-analyze-link\");\n\n for (let i = 0; i < links.length; ++i) {\n (() => {\n const hostname = links[i].innerHTML.toString();\n links[i].addEventListener(\"onclick\", () => {\n if (this.action !== null) {\n return;\n }\n\n this.connectToServer(player, hostname);\n });\n })(); // Immediate invocation\n\n }\n }\n\n connectToServer(player, server) {\n const serv = Object(_Server_ServerHelpers__WEBPACK_IMPORTED_MODULE_13__[/* getServer */ \"b\"])(server);\n\n if (serv == null) {\n this.error(\"Invalid server. Connection failed.\");\n return;\n }\n\n player.getCurrentServer().isConnectedTo = false;\n player.currentServer = serv.ip;\n player.getCurrentServer().isConnectedTo = true;\n this.print(\"Connected to \" + serv.hostname);\n this.setcwd(\"/\");\n\n if (player.getCurrentServer().hostname == \"darkweb\") {\n Object(_DarkWeb_DarkWeb__WEBPACK_IMPORTED_MODULE_8__[/* checkIfConnectedToDarkweb */ \"b\"])(); // Posts a 'help' message if connecting to dark web\n }\n }\n\n executeCommands(router, player, commands) {\n // Sanitize input\n commands = commands.trim();\n commands = commands.replace(/\\s\\s+/g, \" \"); // Replace all extra whitespace in command with a single space\n // Handle Terminal History - multiple commands should be saved as one\n\n if (this.commandHistory[this.commandHistory.length - 1] != commands) {\n this.commandHistory.push(commands);\n\n if (this.commandHistory.length > 50) {\n this.commandHistory.splice(0, 1);\n }\n }\n\n this.commandHistoryIndex = this.commandHistory.length;\n const allCommands = Object(_Parser__WEBPACK_IMPORTED_MODULE_14__[/* ParseCommands */ \"b\"])(commands);\n\n for (let i = 0; i < allCommands.length; i++) {\n this.executeCommand(router, player, allCommands[i]);\n }\n }\n\n clear() {\n // TODO: remove this once we figure out the height issue.\n this.outputHistory = [new _ITerminal__WEBPACK_IMPORTED_MODULE_0__[/* Output */ \"b\"](`Bitburner v${_Constants__WEBPACK_IMPORTED_MODULE_5__[/* CONSTANTS */ \"a\"].Version}`, \"primary\")];\n this.hasChanges = true;\n }\n\n prestige() {\n this.action = null;\n this.clear();\n }\n\n executeCommand(router, player, command) {\n if (this.action !== null) {\n this.error(`Cannot execute command (${command}) while an action is in progress`);\n return;\n } // Allow usage of ./\n\n\n if (command.startsWith(\"./\")) {\n command = \"run \" + command.slice(2);\n } // Only split the first space\n\n\n const commandArray = Object(_Parser__WEBPACK_IMPORTED_MODULE_14__[/* ParseCommand */ \"a\"])(command);\n\n if (commandArray.length == 0) {\n return;\n }\n\n const s = player.getCurrentServer();\n /****************** Interactive Tutorial Terminal Commands ******************/\n\n if (_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* ITutorial */ \"a\"].isRunning) {\n const n00dlesServ = Object(_Server_ServerHelpers__WEBPACK_IMPORTED_MODULE_13__[/* GetServerByHostname */ \"a\"])(\"n00dles\");\n\n if (n00dlesServ == null) {\n throw new Error(\"Could not get n00dles server\");\n return;\n }\n\n switch (_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* ITutorial */ \"a\"].currStep) {\n case _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialSteps */ \"d\"].TerminalHelp:\n if (commandArray.length === 1 && commandArray[0] == \"help\") {\n _HelpText__WEBPACK_IMPORTED_MODULE_12__[/* TerminalHelpText */ \"b\"].forEach(line => this.print(line));\n Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialNextStep */ \"b\"])();\n } else {\n this.print(\"Bad command. Please follow the tutorial\");\n }\n\n break;\n\n case _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialSteps */ \"d\"].TerminalLs:\n if (commandArray.length === 1 && commandArray[0] == \"ls\") {\n Object(_commands_ls__WEBPACK_IMPORTED_MODULE_39__[/* ls */ \"a\"])(this, router, player, s, commandArray.slice(1));\n Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialNextStep */ \"b\"])();\n } else {\n this.print(\"Bad command. Please follow the tutorial\");\n }\n\n break;\n\n case _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialSteps */ \"d\"].TerminalScan:\n if (commandArray.length === 1 && commandArray[0] == \"scan\") {\n Object(_commands_scan__WEBPACK_IMPORTED_MODULE_47__[/* scan */ \"a\"])(this, router, player, s, commandArray.slice(1));\n Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialNextStep */ \"b\"])();\n } else {\n this.print(\"Bad command. Please follow the tutorial\");\n }\n\n break;\n\n case _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialSteps */ \"d\"].TerminalScanAnalyze1:\n if (commandArray.length == 1 && commandArray[0] == \"scan-analyze\") {\n this.executeScanAnalyzeCommand(player, 1);\n Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialNextStep */ \"b\"])();\n } else {\n this.print(\"Bad command. Please follow the tutorial\");\n }\n\n break;\n\n case _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialSteps */ \"d\"].TerminalScanAnalyze2:\n if (commandArray.length == 2 && commandArray[0] == \"scan-analyze\" && commandArray[1] === 2) {\n this.executeScanAnalyzeCommand(player, 2);\n Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialNextStep */ \"b\"])();\n } else {\n this.print(\"Bad command. Please follow the tutorial\");\n }\n\n break;\n\n case _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialSteps */ \"d\"].TerminalConnect:\n if (commandArray.length == 2) {\n if (commandArray[0] == \"connect\" && (commandArray[1] == \"n00dles\" || commandArray[1] == n00dlesServ.ip)) {\n player.getCurrentServer().isConnectedTo = false;\n player.currentServer = n00dlesServ.ip;\n player.getCurrentServer().isConnectedTo = true;\n this.print(\"Connected to n00dles\");\n Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialNextStep */ \"b\"])();\n } else {\n this.print(\"Wrong command! Try again!\");\n return;\n }\n } else {\n this.print(\"Bad command. Please follow the tutorial\");\n }\n\n break;\n\n case _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialSteps */ \"d\"].TerminalAnalyze:\n if (commandArray.length === 1 && commandArray[0] === \"analyze\") {\n if (commandArray.length !== 1) {\n this.print(\"Incorrect usage of analyze command. Usage: analyze\");\n return;\n }\n\n this.startAnalyze();\n Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialNextStep */ \"b\"])();\n } else {\n this.print(\"Bad command. Please follow the tutorial\");\n }\n\n break;\n\n case _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialSteps */ \"d\"].TerminalNuke:\n if (commandArray.length == 2 && commandArray[0] == \"run\" && commandArray[1] == \"NUKE.exe\") {\n n00dlesServ.hasAdminRights = true;\n this.print(\"NUKE successful! Gained root access to n00dles\");\n Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialNextStep */ \"b\"])();\n } else {\n this.print(\"Bad command. Please follow the tutorial\");\n }\n\n break;\n\n case _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialSteps */ \"d\"].TerminalManualHack:\n if (commandArray.length == 1 && commandArray[0] == \"hack\") {\n this.startHack(player);\n Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialNextStep */ \"b\"])();\n } else {\n this.print(\"Bad command. Please follow the tutorial\");\n }\n\n break;\n\n case _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialSteps */ \"d\"].TerminalCreateScript:\n if (commandArray.length == 2 && commandArray[0] == \"nano\" && commandArray[1] == \"n00dles.script\") {\n router.toScriptEditor(\"n00dles.script\", \"\");\n Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialNextStep */ \"b\"])();\n } else {\n this.print(\"Bad command. Please follow the tutorial\");\n }\n\n break;\n\n case _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialSteps */ \"d\"].TerminalFree:\n if (commandArray.length == 1 && commandArray[0] == \"free\") {\n Object(_commands_free__WEBPACK_IMPORTED_MODULE_31__[/* free */ \"a\"])(this, router, player, s, commandArray.slice(1));\n Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialNextStep */ \"b\"])();\n } else {\n this.print(\"Bad command. Please follow the tutorial\");\n }\n\n break;\n\n case _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialSteps */ \"d\"].TerminalRunScript:\n if (commandArray.length == 2 && commandArray[0] == \"run\" && commandArray[1] == \"n00dles.script\") {\n Object(_commands_run__WEBPACK_IMPORTED_MODULE_46__[/* run */ \"a\"])(this, router, player, s, commandArray.slice(1));\n Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialNextStep */ \"b\"])();\n } else {\n this.print(\"Bad command. Please follow the tutorial\");\n }\n\n break;\n\n case _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialSteps */ \"d\"].ActiveScriptsToTerminal:\n if (commandArray.length == 2 && commandArray[0] == \"tail\" && commandArray[1] == \"n00dles.script\") {\n // Check that the script exists on this machine\n const runningScript = Object(_Script_ScriptHelpers__WEBPACK_IMPORTED_MODULE_11__[/* findRunningScript */ \"a\"])(\"n00dles.script\", [], player.getCurrentServer());\n\n if (runningScript == null) {\n this.print(\"Error: No such script exists\");\n return;\n }\n\n Object(_utils_LogBox__WEBPACK_IMPORTED_MODULE_9__[/* logBoxCreate */ \"a\"])(runningScript);\n Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialNextStep */ \"b\"])();\n } else {\n this.print(\"Bad command. Please follow the tutorial\");\n }\n\n break;\n\n default:\n this.print(\"Please follow the tutorial, or click 'Exit Tutorial' if you'd like to skip it\");\n return;\n }\n\n return;\n }\n /****************** END INTERACTIVE TUTORIAL ******************/\n\n /* Command parser */\n\n\n const commandName = commandArray[0];\n\n if (typeof commandName === \"number\") {\n this.error(`Command ${commandArray[0]} not found`);\n return;\n }\n\n const commands = {\n alias: _commands_alias__WEBPACK_IMPORTED_MODULE_21__[/* alias */ \"a\"],\n analyze: _commands_analyze__WEBPACK_IMPORTED_MODULE_22__[/* analyze */ \"a\"],\n backdoor: _commands_backdoor__WEBPACK_IMPORTED_MODULE_23__[/* backdoor */ \"a\"],\n buy: _commands_buy__WEBPACK_IMPORTED_MODULE_24__[/* buy */ \"a\"],\n cat: _commands_cat__WEBPACK_IMPORTED_MODULE_25__[/* cat */ \"a\"],\n cd: _commands_cd__WEBPACK_IMPORTED_MODULE_26__[/* cd */ \"a\"],\n check: _commands_check__WEBPACK_IMPORTED_MODULE_27__[/* check */ \"a\"],\n cls: () => this.clear(),\n clear: () => this.clear(),\n connect: _commands_connect__WEBPACK_IMPORTED_MODULE_28__[/* connect */ \"a\"],\n download: _commands_download__WEBPACK_IMPORTED_MODULE_29__[/* download */ \"a\"],\n expr: _commands_expr__WEBPACK_IMPORTED_MODULE_30__[/* expr */ \"a\"],\n free: _commands_free__WEBPACK_IMPORTED_MODULE_31__[/* free */ \"a\"],\n hack: _commands_hack__WEBPACK_IMPORTED_MODULE_32__[/* hack */ \"a\"],\n help: _commands_help__WEBPACK_IMPORTED_MODULE_33__[/* help */ \"a\"],\n home: _commands_home__WEBPACK_IMPORTED_MODULE_34__[/* home */ \"a\"],\n hostname: _commands_hostname__WEBPACK_IMPORTED_MODULE_35__[/* hostname */ \"a\"],\n ifconfig: _commands_ifconfig__WEBPACK_IMPORTED_MODULE_36__[/* ifconfig */ \"a\"],\n kill: _commands_kill__WEBPACK_IMPORTED_MODULE_37__[/* kill */ \"a\"],\n killall: _commands_killall__WEBPACK_IMPORTED_MODULE_38__[/* killall */ \"a\"],\n ls: _commands_ls__WEBPACK_IMPORTED_MODULE_39__[/* ls */ \"a\"],\n lscpu: _commands_lscpu__WEBPACK_IMPORTED_MODULE_40__[/* lscpu */ \"a\"],\n mem: _commands_mem__WEBPACK_IMPORTED_MODULE_41__[/* mem */ \"a\"],\n mv: _commands_mv__WEBPACK_IMPORTED_MODULE_42__[/* mv */ \"a\"],\n nano: _commands_nano__WEBPACK_IMPORTED_MODULE_43__[/* nano */ \"a\"],\n ps: _commands_ps__WEBPACK_IMPORTED_MODULE_44__[/* ps */ \"a\"],\n rm: _commands_rm__WEBPACK_IMPORTED_MODULE_45__[/* rm */ \"a\"],\n run: _commands_run__WEBPACK_IMPORTED_MODULE_46__[/* run */ \"a\"],\n scan: _commands_scan__WEBPACK_IMPORTED_MODULE_47__[/* scan */ \"a\"],\n \"scan-analyze\": _commands_scananalyze__WEBPACK_IMPORTED_MODULE_48__[/* scananalyze */ \"a\"],\n scp: _commands_scp__WEBPACK_IMPORTED_MODULE_49__[/* scp */ \"a\"],\n sudov: _commands_sudov__WEBPACK_IMPORTED_MODULE_50__[/* sudov */ \"a\"],\n tail: _commands_tail__WEBPACK_IMPORTED_MODULE_51__[/* tail */ \"a\"],\n theme: _commands_theme__WEBPACK_IMPORTED_MODULE_52__[/* theme */ \"a\"],\n top: _commands_top__WEBPACK_IMPORTED_MODULE_53__[/* top */ \"a\"],\n unalias: _commands_unalias__WEBPACK_IMPORTED_MODULE_54__[/* unalias */ \"a\"],\n wget: _commands_wget__WEBPACK_IMPORTED_MODULE_55__[/* wget */ \"a\"]\n };\n const f = commands[commandName.toLowerCase()];\n\n if (!f) {\n this.error(`Command ${commandArray[0]} not found`);\n return;\n }\n\n f(this, router, player, s, commandArray.slice(1));\n }\n\n getProgressText() {\n if (this.action === null) throw new Error(\"trying to get the progress text when there's no action\");\n return Object(_utils_helpers_createProgressBarText__WEBPACK_IMPORTED_MODULE_17__[/* createProgressBarText */ \"a\"])({\n progress: (this.action.time - this.action.timeLeft) / this.action.time,\n totalTicks: 50\n });\n }\n\n}\n\n//# sourceURL=webpack:///./src/Terminal/Terminal.ts?"); +eval("/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return Terminal; });\n/* harmony import */ var _ITerminal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ITerminal */ 249);\n/* harmony import */ var _Hacknet_HacknetServer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Hacknet/HacknetServer */ 84);\n/* harmony import */ var _Programs_Programs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Programs/Programs */ 54);\n/* harmony import */ var _CodingContracts__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../CodingContracts */ 79);\n/* harmony import */ var _Script_ScriptHelpersTS__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Script/ScriptHelpersTS */ 83);\n/* harmony import */ var _Constants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Constants */ 5);\n/* harmony import */ var _Server_AllServers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Server/AllServers */ 29);\n/* harmony import */ var _DirectoryHelpers__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./DirectoryHelpers */ 86);\n/* harmony import */ var _DarkWeb_DarkWeb__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../DarkWeb/DarkWeb */ 389);\n/* harmony import */ var _utils_LogBox__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../utils/LogBox */ 213);\n/* harmony import */ var _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../InteractiveTutorial */ 49);\n/* harmony import */ var _Script_ScriptHelpers__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Script/ScriptHelpers */ 169);\n/* harmony import */ var _HelpText__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./HelpText */ 390);\n/* harmony import */ var _Server_ServerHelpers__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../Server/ServerHelpers */ 36);\n/* harmony import */ var _Parser__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./Parser */ 522);\n/* harmony import */ var _Server_SpecialServerIps__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../Server/SpecialServerIps */ 51);\n/* harmony import */ var _Settings_Settings__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../Settings/Settings */ 34);\n/* harmony import */ var _utils_helpers_createProgressBarText__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../../utils/helpers/createProgressBarText */ 127);\n/* harmony import */ var _Hacking__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../Hacking */ 81);\n/* harmony import */ var _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../ui/numeralFormat */ 3);\n/* harmony import */ var _utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../../utils/StringHelperFunctions */ 12);\n/* harmony import */ var _commands_alias__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./commands/alias */ 662);\n/* harmony import */ var _commands_analyze__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./commands/analyze */ 663);\n/* harmony import */ var _commands_backdoor__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./commands/backdoor */ 664);\n/* harmony import */ var _commands_buy__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./commands/buy */ 665);\n/* harmony import */ var _commands_cat__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./commands/cat */ 666);\n/* harmony import */ var _commands_cd__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./commands/cd */ 667);\n/* harmony import */ var _commands_check__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./commands/check */ 668);\n/* harmony import */ var _commands_connect__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./commands/connect */ 669);\n/* harmony import */ var _commands_download__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./commands/download */ 670);\n/* harmony import */ var _commands_expr__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./commands/expr */ 673);\n/* harmony import */ var _commands_free__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./commands/free */ 523);\n/* harmony import */ var _commands_hack__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./commands/hack */ 674);\n/* harmony import */ var _commands_help__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./commands/help */ 675);\n/* harmony import */ var _commands_home__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ./commands/home */ 676);\n/* harmony import */ var _commands_hostname__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ./commands/hostname */ 677);\n/* harmony import */ var _commands_ifconfig__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ./commands/ifconfig */ 678);\n/* harmony import */ var _commands_kill__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! ./commands/kill */ 679);\n/* harmony import */ var _commands_killall__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(/*! ./commands/killall */ 680);\n/* harmony import */ var _commands_ls__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(/*! ./commands/ls */ 524);\n/* harmony import */ var _commands_lscpu__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(/*! ./commands/lscpu */ 681);\n/* harmony import */ var _commands_mem__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(/*! ./commands/mem */ 682);\n/* harmony import */ var _commands_mv__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(/*! ./commands/mv */ 683);\n/* harmony import */ var _commands_nano__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(/*! ./commands/nano */ 684);\n/* harmony import */ var _commands_ps__WEBPACK_IMPORTED_MODULE_44__ = __webpack_require__(/*! ./commands/ps */ 685);\n/* harmony import */ var _commands_rm__WEBPACK_IMPORTED_MODULE_45__ = __webpack_require__(/*! ./commands/rm */ 686);\n/* harmony import */ var _commands_run__WEBPACK_IMPORTED_MODULE_46__ = __webpack_require__(/*! ./commands/run */ 525);\n/* harmony import */ var _commands_scan__WEBPACK_IMPORTED_MODULE_47__ = __webpack_require__(/*! ./commands/scan */ 526);\n/* harmony import */ var _commands_scananalyze__WEBPACK_IMPORTED_MODULE_48__ = __webpack_require__(/*! ./commands/scananalyze */ 689);\n/* harmony import */ var _commands_scp__WEBPACK_IMPORTED_MODULE_49__ = __webpack_require__(/*! ./commands/scp */ 690);\n/* harmony import */ var _commands_sudov__WEBPACK_IMPORTED_MODULE_50__ = __webpack_require__(/*! ./commands/sudov */ 691);\n/* harmony import */ var _commands_tail__WEBPACK_IMPORTED_MODULE_51__ = __webpack_require__(/*! ./commands/tail */ 692);\n/* harmony import */ var _commands_theme__WEBPACK_IMPORTED_MODULE_52__ = __webpack_require__(/*! ./commands/theme */ 693);\n/* harmony import */ var _commands_top__WEBPACK_IMPORTED_MODULE_53__ = __webpack_require__(/*! ./commands/top */ 694);\n/* harmony import */ var _commands_unalias__WEBPACK_IMPORTED_MODULE_54__ = __webpack_require__(/*! ./commands/unalias */ 695);\n/* harmony import */ var _commands_wget__WEBPACK_IMPORTED_MODULE_55__ = __webpack_require__(/*! ./commands/wget */ 696);\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nclass Terminal {\n constructor() {\n _defineProperty(this, \"hasChanges\", false);\n\n _defineProperty(this, \"action\", null);\n\n _defineProperty(this, \"commandHistory\", []);\n\n _defineProperty(this, \"commandHistoryIndex\", 0);\n\n _defineProperty(this, \"outputHistory\", [new _ITerminal__WEBPACK_IMPORTED_MODULE_0__[/* Output */ \"b\"](`Bitburner v${_Constants__WEBPACK_IMPORTED_MODULE_5__[/* CONSTANTS */ \"a\"].Version}`, \"primary\")]);\n\n _defineProperty(this, \"contractOpen\", false);\n\n _defineProperty(this, \"currDir\", \"/\");\n }\n\n process(router, player, cycles) {\n if (this.action === null) return;\n this.action.timeLeft -= _Constants__WEBPACK_IMPORTED_MODULE_5__[/* CONSTANTS */ \"a\"]._idleSpeed * cycles / 1000;\n this.hasChanges = true;\n if (this.action.timeLeft < 0) this.finishAction(router, player, false);\n }\n\n pollChanges() {\n if (this.hasChanges) {\n this.hasChanges = false;\n return true;\n }\n\n return false;\n }\n\n append(item) {\n this.outputHistory.push(item);\n\n if (this.outputHistory.length > _Settings_Settings__WEBPACK_IMPORTED_MODULE_16__[/* Settings */ \"a\"].MaxTerminalCapacity) {\n this.outputHistory.slice(this.outputHistory.length - _Settings_Settings__WEBPACK_IMPORTED_MODULE_16__[/* Settings */ \"a\"].MaxTerminalCapacity);\n }\n }\n\n print(s) {\n this.append(new _ITerminal__WEBPACK_IMPORTED_MODULE_0__[/* Output */ \"b\"](s, \"primary\"));\n this.hasChanges = true;\n }\n\n error(s) {\n this.append(new _ITerminal__WEBPACK_IMPORTED_MODULE_0__[/* Output */ \"b\"](s, \"error\"));\n this.hasChanges = true;\n }\n\n startHack(player) {\n // Hacking through Terminal should be faster than hacking through a script\n this.startAction(Object(_Hacking__WEBPACK_IMPORTED_MODULE_18__[/* calculateHackingTime */ \"d\"])(player.getCurrentServer(), player) / 4, \"h\");\n }\n\n startBackdoor(player) {\n // Backdoor should take the same amount of time as hack\n this.startAction(Object(_Hacking__WEBPACK_IMPORTED_MODULE_18__[/* calculateHackingTime */ \"d\"])(player.getCurrentServer(), player) / 4, \"b\");\n }\n\n startAnalyze() {\n this.print(\"Analyzing system...\");\n this.startAction(1, \"a\");\n }\n\n startAction(n, action) {\n this.action = new _ITerminal__WEBPACK_IMPORTED_MODULE_0__[/* TTimer */ \"c\"](n, action);\n } // Complete the hack/analyze command\n\n\n finishHack(router, player, cancelled = false) {\n if (cancelled) return;\n const server = player.getCurrentServer(); // Calculate whether hack was successful\n\n const hackChance = Object(_Hacking__WEBPACK_IMPORTED_MODULE_18__[/* calculateHackingChance */ \"b\"])(server, player);\n const rand = Math.random();\n const expGainedOnSuccess = Object(_Hacking__WEBPACK_IMPORTED_MODULE_18__[/* calculateHackingExpGain */ \"c\"])(server, player);\n const expGainedOnFailure = expGainedOnSuccess / 4;\n\n if (rand < hackChance) {\n // Success!\n if (_Server_SpecialServerIps__WEBPACK_IMPORTED_MODULE_15__[/* SpecialServerIps */ \"a\"][_Server_SpecialServerIps__WEBPACK_IMPORTED_MODULE_15__[/* SpecialServerNames */ \"b\"].WorldDaemon] && _Server_SpecialServerIps__WEBPACK_IMPORTED_MODULE_15__[/* SpecialServerIps */ \"a\"][_Server_SpecialServerIps__WEBPACK_IMPORTED_MODULE_15__[/* SpecialServerNames */ \"b\"].WorldDaemon] == server.ip) {\n if (player.bitNodeN == null) {\n player.bitNodeN = 1;\n }\n\n router.toBitVerse(false, false);\n return;\n }\n\n server.backdoorInstalled = true;\n let moneyGained = Object(_Hacking__WEBPACK_IMPORTED_MODULE_18__[/* calculatePercentMoneyHacked */ \"e\"])(server, player);\n moneyGained = Math.floor(server.moneyAvailable * moneyGained);\n\n if (moneyGained <= 0) {\n moneyGained = 0;\n } // Safety check\n\n\n server.moneyAvailable -= moneyGained;\n player.gainMoney(moneyGained);\n player.recordMoneySource(moneyGained, \"hacking\");\n player.gainHackingExp(expGainedOnSuccess);\n player.gainIntelligenceExp(expGainedOnSuccess / _Constants__WEBPACK_IMPORTED_MODULE_5__[/* CONSTANTS */ \"a\"].IntelligenceTerminalHackBaseExpGain);\n server.fortify(_Constants__WEBPACK_IMPORTED_MODULE_5__[/* CONSTANTS */ \"a\"].ServerFortifyAmount);\n this.print(`Hack successful! Gained ${_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_19__[/* numeralWrapper */ \"a\"].formatMoney(moneyGained)} and ${_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_19__[/* numeralWrapper */ \"a\"].formatExp(expGainedOnSuccess)} hacking exp`);\n } else {\n // Failure\n // player only gains 25% exp for failure? TODO Can change this later to balance\n player.gainHackingExp(expGainedOnFailure);\n this.print(`Failed to hack ${server.hostname}. Gained ${_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_19__[/* numeralWrapper */ \"a\"].formatExp(expGainedOnFailure)} hacking exp`);\n }\n }\n\n finishBackdoor(router, player, cancelled = false) {\n if (!cancelled) {\n const server = player.getCurrentServer();\n\n if (_Server_SpecialServerIps__WEBPACK_IMPORTED_MODULE_15__[/* SpecialServerIps */ \"a\"][_Server_SpecialServerIps__WEBPACK_IMPORTED_MODULE_15__[/* SpecialServerNames */ \"b\"].WorldDaemon] && _Server_SpecialServerIps__WEBPACK_IMPORTED_MODULE_15__[/* SpecialServerIps */ \"a\"][_Server_SpecialServerIps__WEBPACK_IMPORTED_MODULE_15__[/* SpecialServerNames */ \"b\"].WorldDaemon] == server.ip) {\n if (player.bitNodeN == null) {\n player.bitNodeN = 1;\n }\n\n router.toBitVerse(false, false);\n return;\n }\n\n server.backdoorInstalled = true;\n this.print(\"Backdoor successful!\");\n }\n }\n\n finishAnalyze(player, cancelled = false) {\n if (!cancelled) {\n const currServ = player.getCurrentServer();\n const isHacknet = currServ instanceof _Hacknet_HacknetServer__WEBPACK_IMPORTED_MODULE_1__[/* HacknetServer */ \"a\"];\n this.print(currServ.hostname + \": \");\n const org = currServ.organizationName;\n this.print(\"Organization name: \" + (!isHacknet ? org : \"player\"));\n const hasAdminRights = !isHacknet && currServ.hasAdminRights || isHacknet;\n this.print(\"Root Access: \" + (hasAdminRights ? \"YES\" : \"NO\"));\n const hackingSkill = currServ.requiredHackingSkill;\n this.print(\"Required hacking skill: \" + (!isHacknet ? hackingSkill : \"N/A\"));\n const security = currServ.hackDifficulty;\n this.print(\"Server security level: \" + (!isHacknet ? _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_19__[/* numeralWrapper */ \"a\"].formatServerSecurity(security) : \"N/A\"));\n const hackingChance = Object(_Hacking__WEBPACK_IMPORTED_MODULE_18__[/* calculateHackingChance */ \"b\"])(currServ, player);\n this.print(\"Chance to hack: \" + (!isHacknet ? _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_19__[/* numeralWrapper */ \"a\"].formatPercentage(hackingChance) : \"N/A\"));\n const hackingTime = Object(_Hacking__WEBPACK_IMPORTED_MODULE_18__[/* calculateHackingTime */ \"d\"])(currServ, player) * 1000;\n this.print(\"Time to hack: \" + (!isHacknet ? Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_20__[/* convertTimeMsToTimeElapsedString */ \"b\"])(hackingTime, true) : \"N/A\"));\n this.print(`Total money available on server: ${!isHacknet ? _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_19__[/* numeralWrapper */ \"a\"].formatMoney(currServ.moneyAvailable) : \"N/A\"}`);\n const numPort = currServ.numOpenPortsRequired;\n this.print(\"Required number of open ports for NUKE: \" + (!isHacknet ? numPort : \"N/A\"));\n this.print(\"SSH port: \" + (currServ.sshPortOpen ? \"Open\" : \"Closed\"));\n this.print(\"FTP port: \" + (currServ.ftpPortOpen ? \"Open\" : \"Closed\"));\n this.print(\"SMTP port: \" + (currServ.smtpPortOpen ? \"Open\" : \"Closed\"));\n this.print(\"HTTP port: \" + (currServ.httpPortOpen ? \"Open\" : \"Closed\"));\n this.print(\"SQL port: \" + (currServ.sqlPortOpen ? \"Open\" : \"Closed\"));\n }\n }\n\n finishAction(router, player, cancelled = false) {\n if (this.action === null) {\n if (!cancelled) throw new Error(\"Finish action called when there was no action\");\n return;\n }\n\n this.print(this.getProgressText());\n\n if (this.action.action === \"h\") {\n this.finishHack(router, player, cancelled);\n } else if (this.action.action === \"b\") {\n this.finishBackdoor(router, player, cancelled);\n } else if (this.action.action === \"a\") {\n this.finishAnalyze(player, cancelled);\n }\n\n if (cancelled) {\n this.print(\"Cancelled\");\n }\n\n this.action = null;\n }\n\n getFile(player, filename) {\n if (Object(_Script_ScriptHelpersTS__WEBPACK_IMPORTED_MODULE_4__[/* isScriptFilename */ \"a\"])(filename)) {\n return this.getScript(player, filename);\n }\n\n if (filename.endsWith(\".lit\")) {\n return this.getLitFile(player, filename);\n }\n\n if (filename.endsWith(\".txt\")) {\n return this.getTextFile(player, filename);\n }\n\n return null;\n }\n\n getFilepath(filename) {\n const path = Object(_DirectoryHelpers__WEBPACK_IMPORTED_MODULE_7__[/* evaluateFilePath */ \"b\"])(filename, this.cwd());\n\n if (path == null) {\n throw new Error(`Invalid file path specified: ${filename}`);\n }\n\n if (Object(_DirectoryHelpers__WEBPACK_IMPORTED_MODULE_7__[/* isInRootDirectory */ \"e\"])(path)) {\n return Object(_DirectoryHelpers__WEBPACK_IMPORTED_MODULE_7__[/* removeLeadingSlash */ \"h\"])(path);\n }\n\n return path;\n }\n\n getScript(player, filename) {\n const s = player.getCurrentServer();\n const filepath = this.getFilepath(filename);\n\n for (const script of s.scripts) {\n if (filepath === script.filename) {\n return script;\n }\n }\n\n return null;\n }\n\n getTextFile(player, filename) {\n const s = player.getCurrentServer();\n const filepath = this.getFilepath(filename);\n\n for (const txt of s.textFiles) {\n if (filepath === txt.fn) {\n return txt;\n }\n }\n\n return null;\n }\n\n getLitFile(player, filename) {\n const s = player.getCurrentServer();\n const filepath = this.getFilepath(filename);\n\n for (const lit of s.messages) {\n if (typeof lit === \"string\" && filepath === lit) {\n return lit;\n }\n }\n\n return null;\n }\n\n cwd() {\n return this.currDir;\n }\n\n setcwd(dir) {\n this.currDir = dir;\n this.hasChanges = true;\n }\n\n async runContract(player, contractName) {\n // There's already an opened contract\n if (this.contractOpen) {\n return this.error(\"There's already a Coding Contract in Progress\");\n }\n\n const serv = player.getCurrentServer();\n const contract = serv.getContract(contractName);\n\n if (contract == null) {\n return this.error(\"No such contract\");\n }\n\n this.contractOpen = true;\n const res = await contract.prompt();\n\n switch (res) {\n case _CodingContracts__WEBPACK_IMPORTED_MODULE_3__[/* CodingContractResult */ \"b\"].Success:\n if (contract.reward !== null) {\n const reward = player.gainCodingContractReward(contract.reward, contract.getDifficulty());\n this.print(`Contract SUCCESS - ${reward}`);\n }\n\n serv.removeContract(contract);\n break;\n\n case _CodingContracts__WEBPACK_IMPORTED_MODULE_3__[/* CodingContractResult */ \"b\"].Failure:\n ++contract.tries;\n\n if (contract.tries >= contract.getMaxNumTries()) {\n this.print(\"ContractFAILED
- Contract is now self-destructing\");\n serv.removeContract(contract);\n } else {\n this.print(`ContractFAILED
- ${contract.getMaxNumTries() - contract.tries} tries remaining`);\n }\n\n break;\n\n case _CodingContracts__WEBPACK_IMPORTED_MODULE_3__[/* CodingContractResult */ \"b\"].Cancelled:\n default:\n this.print(\"Contract cancelled\");\n break;\n }\n\n this.contractOpen = false;\n }\n\n executeScanAnalyzeCommand(player, depth = 1, all = false) {\n // TODO Using array as stack for now, can make more efficient\n this.print(\"~~~~~~~~~~ Beginning scan-analyze ~~~~~~~~~~\");\n this.print(\" \"); // Map of all servers to keep track of which have been visited\n\n const visited = {};\n\n for (const ip in _Server_AllServers__WEBPACK_IMPORTED_MODULE_6__[/* AllServers */ \"b\"]) {\n visited[ip] = 0;\n }\n\n const stack = [];\n const depthQueue = [0];\n const currServ = player.getCurrentServer();\n stack.push(currServ);\n\n while (stack.length != 0) {\n const s = stack.pop();\n if (!s) continue;\n const d = depthQueue.pop();\n if (d === undefined) continue;\n const isHacknet = s instanceof _Hacknet_HacknetServer__WEBPACK_IMPORTED_MODULE_1__[/* HacknetServer */ \"a\"];\n\n if (!all && s.purchasedByPlayer && s.hostname != \"home\") {\n continue; // Purchased server\n } else if (visited[s.ip] || d > depth) {\n continue; // Already visited or out-of-depth\n } else if (!all && isHacknet) {\n continue; // Hacknet Server\n } else {\n visited[s.ip] = 1;\n }\n\n for (let i = s.serversOnNetwork.length - 1; i >= 0; --i) {\n const newS = Object(_Server_ServerHelpers__WEBPACK_IMPORTED_MODULE_13__[/* getServerOnNetwork */ \"c\"])(s, i);\n if (newS === null) continue;\n stack.push(newS);\n depthQueue.push(d + 1);\n }\n\n if (d == 0) {\n continue;\n } // Don't print current server\n\n\n const titleDashes = Array((d - 1) * 4 + 1).join(\"-\");\n\n if (player.hasProgram(_Programs_Programs__WEBPACK_IMPORTED_MODULE_2__[/* Programs */ \"a\"].AutoLink.name)) {\n this.append(new _ITerminal__WEBPACK_IMPORTED_MODULE_0__[/* Link */ \"a\"](s.hostname));\n } else {\n this.print(s.hostname);\n }\n\n const dashes = titleDashes + \"--\";\n let c = \"NO\";\n\n if (s.hasAdminRights) {\n c = \"YES\";\n }\n\n this.print(`${dashes}Root Access: ${c}${!isHacknet ? \", Required hacking skill: \" + s.requiredHackingSkill : \"\"}`);\n\n if (s.hasOwnProperty(\"numOpenPortsRequired\")) {\n this.print(dashes + \"Number of open ports required to NUKE: \" + s.numOpenPortsRequired);\n }\n\n this.print(dashes + \"RAM: \" + _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_19__[/* numeralWrapper */ \"a\"].formatRAM(s.maxRam));\n this.print(\" \");\n }\n\n const links = document.getElementsByClassName(\"scan-analyze-link\");\n\n for (let i = 0; i < links.length; ++i) {\n (() => {\n const hostname = links[i].innerHTML.toString();\n links[i].addEventListener(\"onclick\", () => {\n if (this.action !== null) {\n return;\n }\n\n this.connectToServer(player, hostname);\n });\n })(); // Immediate invocation\n\n }\n }\n\n connectToServer(player, server) {\n const serv = Object(_Server_ServerHelpers__WEBPACK_IMPORTED_MODULE_13__[/* getServer */ \"b\"])(server);\n\n if (serv == null) {\n this.error(\"Invalid server. Connection failed.\");\n return;\n }\n\n player.getCurrentServer().isConnectedTo = false;\n player.currentServer = serv.ip;\n player.getCurrentServer().isConnectedTo = true;\n this.print(\"Connected to \" + serv.hostname);\n this.setcwd(\"/\");\n\n if (player.getCurrentServer().hostname == \"darkweb\") {\n Object(_DarkWeb_DarkWeb__WEBPACK_IMPORTED_MODULE_8__[/* checkIfConnectedToDarkweb */ \"b\"])(); // Posts a 'help' message if connecting to dark web\n }\n }\n\n executeCommands(router, player, commands) {\n // Sanitize input\n commands = commands.trim();\n commands = commands.replace(/\\s\\s+/g, \" \"); // Replace all extra whitespace in command with a single space\n // Handle Terminal History - multiple commands should be saved as one\n\n if (this.commandHistory[this.commandHistory.length - 1] != commands) {\n this.commandHistory.push(commands);\n\n if (this.commandHistory.length > 50) {\n this.commandHistory.splice(0, 1);\n }\n }\n\n this.commandHistoryIndex = this.commandHistory.length;\n const allCommands = Object(_Parser__WEBPACK_IMPORTED_MODULE_14__[/* ParseCommands */ \"b\"])(commands);\n\n for (let i = 0; i < allCommands.length; i++) {\n this.executeCommand(router, player, allCommands[i]);\n }\n }\n\n clear() {\n // TODO: remove this once we figure out the height issue.\n this.outputHistory = [new _ITerminal__WEBPACK_IMPORTED_MODULE_0__[/* Output */ \"b\"](`Bitburner v${_Constants__WEBPACK_IMPORTED_MODULE_5__[/* CONSTANTS */ \"a\"].Version}`, \"primary\")];\n this.hasChanges = true;\n }\n\n prestige() {\n this.action = null;\n this.clear();\n }\n\n executeCommand(router, player, command) {\n if (this.action !== null) {\n this.error(`Cannot execute command (${command}) while an action is in progress`);\n return;\n } // Allow usage of ./\n\n\n if (command.startsWith(\"./\")) {\n command = \"run \" + command.slice(2);\n } // Only split the first space\n\n\n const commandArray = Object(_Parser__WEBPACK_IMPORTED_MODULE_14__[/* ParseCommand */ \"a\"])(command);\n\n if (commandArray.length == 0) {\n return;\n }\n\n const s = player.getCurrentServer();\n /****************** Interactive Tutorial Terminal Commands ******************/\n\n if (_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* ITutorial */ \"a\"].isRunning) {\n const n00dlesServ = Object(_Server_ServerHelpers__WEBPACK_IMPORTED_MODULE_13__[/* GetServerByHostname */ \"a\"])(\"n00dles\");\n\n if (n00dlesServ == null) {\n throw new Error(\"Could not get n00dles server\");\n return;\n }\n\n switch (_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* ITutorial */ \"a\"].currStep) {\n case _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialSteps */ \"d\"].TerminalHelp:\n if (commandArray.length === 1 && commandArray[0] == \"help\") {\n _HelpText__WEBPACK_IMPORTED_MODULE_12__[/* TerminalHelpText */ \"b\"].forEach(line => this.print(line));\n Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialNextStep */ \"b\"])();\n } else {\n this.print(\"Bad command. Please follow the tutorial\");\n }\n\n break;\n\n case _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialSteps */ \"d\"].TerminalLs:\n if (commandArray.length === 1 && commandArray[0] == \"ls\") {\n Object(_commands_ls__WEBPACK_IMPORTED_MODULE_39__[/* ls */ \"a\"])(this, router, player, s, commandArray.slice(1));\n Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialNextStep */ \"b\"])();\n } else {\n this.print(\"Bad command. Please follow the tutorial\");\n }\n\n break;\n\n case _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialSteps */ \"d\"].TerminalScan:\n if (commandArray.length === 1 && commandArray[0] == \"scan\") {\n Object(_commands_scan__WEBPACK_IMPORTED_MODULE_47__[/* scan */ \"a\"])(this, router, player, s, commandArray.slice(1));\n Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialNextStep */ \"b\"])();\n } else {\n this.print(\"Bad command. Please follow the tutorial\");\n }\n\n break;\n\n case _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialSteps */ \"d\"].TerminalScanAnalyze1:\n if (commandArray.length == 1 && commandArray[0] == \"scan-analyze\") {\n this.executeScanAnalyzeCommand(player, 1);\n Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialNextStep */ \"b\"])();\n } else {\n this.print(\"Bad command. Please follow the tutorial\");\n }\n\n break;\n\n case _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialSteps */ \"d\"].TerminalScanAnalyze2:\n if (commandArray.length == 2 && commandArray[0] == \"scan-analyze\" && commandArray[1] === 2) {\n this.executeScanAnalyzeCommand(player, 2);\n Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialNextStep */ \"b\"])();\n } else {\n this.print(\"Bad command. Please follow the tutorial\");\n }\n\n break;\n\n case _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialSteps */ \"d\"].TerminalConnect:\n if (commandArray.length == 2) {\n if (commandArray[0] == \"connect\" && (commandArray[1] == \"n00dles\" || commandArray[1] == n00dlesServ.ip)) {\n player.getCurrentServer().isConnectedTo = false;\n player.currentServer = n00dlesServ.ip;\n player.getCurrentServer().isConnectedTo = true;\n this.print(\"Connected to n00dles\");\n Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialNextStep */ \"b\"])();\n } else {\n this.print(\"Wrong command! Try again!\");\n return;\n }\n } else {\n this.print(\"Bad command. Please follow the tutorial\");\n }\n\n break;\n\n case _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialSteps */ \"d\"].TerminalAnalyze:\n if (commandArray.length === 1 && commandArray[0] === \"analyze\") {\n if (commandArray.length !== 1) {\n this.print(\"Incorrect usage of analyze command. Usage: analyze\");\n return;\n }\n\n this.startAnalyze();\n Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialNextStep */ \"b\"])();\n } else {\n this.print(\"Bad command. Please follow the tutorial\");\n }\n\n break;\n\n case _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialSteps */ \"d\"].TerminalNuke:\n if (commandArray.length == 2 && commandArray[0] == \"run\" && commandArray[1] == \"NUKE.exe\") {\n n00dlesServ.hasAdminRights = true;\n this.print(\"NUKE successful! Gained root access to n00dles\");\n Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialNextStep */ \"b\"])();\n } else {\n this.print(\"Bad command. Please follow the tutorial\");\n }\n\n break;\n\n case _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialSteps */ \"d\"].TerminalManualHack:\n if (commandArray.length == 1 && commandArray[0] == \"hack\") {\n this.startHack(player);\n Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialNextStep */ \"b\"])();\n } else {\n this.print(\"Bad command. Please follow the tutorial\");\n }\n\n break;\n\n case _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialSteps */ \"d\"].TerminalCreateScript:\n if (commandArray.length == 2 && commandArray[0] == \"nano\" && commandArray[1] == \"n00dles.script\") {\n router.toScriptEditor(\"n00dles.script\", \"\");\n Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialNextStep */ \"b\"])();\n } else {\n this.print(\"Bad command. Please follow the tutorial\");\n }\n\n break;\n\n case _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialSteps */ \"d\"].TerminalFree:\n if (commandArray.length == 1 && commandArray[0] == \"free\") {\n Object(_commands_free__WEBPACK_IMPORTED_MODULE_31__[/* free */ \"a\"])(this, router, player, s, commandArray.slice(1));\n Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialNextStep */ \"b\"])();\n } else {\n this.print(\"Bad command. Please follow the tutorial\");\n }\n\n break;\n\n case _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialSteps */ \"d\"].TerminalRunScript:\n if (commandArray.length == 2 && commandArray[0] == \"run\" && commandArray[1] == \"n00dles.script\") {\n Object(_commands_run__WEBPACK_IMPORTED_MODULE_46__[/* run */ \"a\"])(this, router, player, s, commandArray.slice(1));\n Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialNextStep */ \"b\"])();\n } else {\n this.print(\"Bad command. Please follow the tutorial\");\n }\n\n break;\n\n case _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialSteps */ \"d\"].ActiveScriptsToTerminal:\n if (commandArray.length == 2 && commandArray[0] == \"tail\" && commandArray[1] == \"n00dles.script\") {\n // Check that the script exists on this machine\n const runningScript = Object(_Script_ScriptHelpers__WEBPACK_IMPORTED_MODULE_11__[/* findRunningScript */ \"a\"])(\"n00dles.script\", [], player.getCurrentServer());\n\n if (runningScript == null) {\n this.print(\"Error: No such script exists\");\n return;\n }\n\n Object(_utils_LogBox__WEBPACK_IMPORTED_MODULE_9__[/* logBoxCreate */ \"a\"])(runningScript);\n Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_10__[/* iTutorialNextStep */ \"b\"])();\n } else {\n this.print(\"Bad command. Please follow the tutorial\");\n }\n\n break;\n\n default:\n this.print(\"Please follow the tutorial, or click 'Exit Tutorial' if you'd like to skip it\");\n return;\n }\n\n return;\n }\n /****************** END INTERACTIVE TUTORIAL ******************/\n\n /* Command parser */\n\n\n const commandName = commandArray[0];\n\n if (typeof commandName === \"number\") {\n this.error(`Command ${commandArray[0]} not found`);\n return;\n }\n\n const commands = {\n alias: _commands_alias__WEBPACK_IMPORTED_MODULE_21__[/* alias */ \"a\"],\n analyze: _commands_analyze__WEBPACK_IMPORTED_MODULE_22__[/* analyze */ \"a\"],\n backdoor: _commands_backdoor__WEBPACK_IMPORTED_MODULE_23__[/* backdoor */ \"a\"],\n buy: _commands_buy__WEBPACK_IMPORTED_MODULE_24__[/* buy */ \"a\"],\n cat: _commands_cat__WEBPACK_IMPORTED_MODULE_25__[/* cat */ \"a\"],\n cd: _commands_cd__WEBPACK_IMPORTED_MODULE_26__[/* cd */ \"a\"],\n check: _commands_check__WEBPACK_IMPORTED_MODULE_27__[/* check */ \"a\"],\n cls: () => this.clear(),\n clear: () => this.clear(),\n connect: _commands_connect__WEBPACK_IMPORTED_MODULE_28__[/* connect */ \"a\"],\n download: _commands_download__WEBPACK_IMPORTED_MODULE_29__[/* download */ \"a\"],\n expr: _commands_expr__WEBPACK_IMPORTED_MODULE_30__[/* expr */ \"a\"],\n free: _commands_free__WEBPACK_IMPORTED_MODULE_31__[/* free */ \"a\"],\n hack: _commands_hack__WEBPACK_IMPORTED_MODULE_32__[/* hack */ \"a\"],\n help: _commands_help__WEBPACK_IMPORTED_MODULE_33__[/* help */ \"a\"],\n home: _commands_home__WEBPACK_IMPORTED_MODULE_34__[/* home */ \"a\"],\n hostname: _commands_hostname__WEBPACK_IMPORTED_MODULE_35__[/* hostname */ \"a\"],\n ifconfig: _commands_ifconfig__WEBPACK_IMPORTED_MODULE_36__[/* ifconfig */ \"a\"],\n kill: _commands_kill__WEBPACK_IMPORTED_MODULE_37__[/* kill */ \"a\"],\n killall: _commands_killall__WEBPACK_IMPORTED_MODULE_38__[/* killall */ \"a\"],\n ls: _commands_ls__WEBPACK_IMPORTED_MODULE_39__[/* ls */ \"a\"],\n lscpu: _commands_lscpu__WEBPACK_IMPORTED_MODULE_40__[/* lscpu */ \"a\"],\n mem: _commands_mem__WEBPACK_IMPORTED_MODULE_41__[/* mem */ \"a\"],\n mv: _commands_mv__WEBPACK_IMPORTED_MODULE_42__[/* mv */ \"a\"],\n nano: _commands_nano__WEBPACK_IMPORTED_MODULE_43__[/* nano */ \"a\"],\n ps: _commands_ps__WEBPACK_IMPORTED_MODULE_44__[/* ps */ \"a\"],\n rm: _commands_rm__WEBPACK_IMPORTED_MODULE_45__[/* rm */ \"a\"],\n run: _commands_run__WEBPACK_IMPORTED_MODULE_46__[/* run */ \"a\"],\n scan: _commands_scan__WEBPACK_IMPORTED_MODULE_47__[/* scan */ \"a\"],\n \"scan-analyze\": _commands_scananalyze__WEBPACK_IMPORTED_MODULE_48__[/* scananalyze */ \"a\"],\n scp: _commands_scp__WEBPACK_IMPORTED_MODULE_49__[/* scp */ \"a\"],\n sudov: _commands_sudov__WEBPACK_IMPORTED_MODULE_50__[/* sudov */ \"a\"],\n tail: _commands_tail__WEBPACK_IMPORTED_MODULE_51__[/* tail */ \"a\"],\n theme: _commands_theme__WEBPACK_IMPORTED_MODULE_52__[/* theme */ \"a\"],\n top: _commands_top__WEBPACK_IMPORTED_MODULE_53__[/* top */ \"a\"],\n unalias: _commands_unalias__WEBPACK_IMPORTED_MODULE_54__[/* unalias */ \"a\"],\n wget: _commands_wget__WEBPACK_IMPORTED_MODULE_55__[/* wget */ \"a\"]\n };\n const f = commands[commandName.toLowerCase()];\n\n if (!f) {\n this.error(`Command ${commandArray[0]} not found`);\n return;\n }\n\n f(this, router, player, s, commandArray.slice(1));\n }\n\n getProgressText() {\n if (this.action === null) throw new Error(\"trying to get the progress text when there's no action\");\n return Object(_utils_helpers_createProgressBarText__WEBPACK_IMPORTED_MODULE_17__[/* createProgressBarText */ \"a\"])({\n progress: (this.action.time - this.action.timeLeft) / this.action.time,\n totalTicks: 50\n });\n }\n\n}\n\n//# sourceURL=webpack:///./src/Terminal/Terminal.ts?"); /***/ }), /* 662 */ @@ -3919,7 +3919,7 @@ eval("/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return buy; });\n/* harmony import */ var _DarkWeb_DarkWeb__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../DarkWeb/DarkWeb */ 389);\n/* harmony import */ var _Server_SpecialServerIps__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Server/SpecialServerIps */ 50);\n\n\nfunction buy(terminal, router, player, server, args) {\n if (!_Server_SpecialServerIps__WEBPACK_IMPORTED_MODULE_1__[/* SpecialServerIps */ \"a\"].hasOwnProperty(\"Darkweb Server\")) {\n terminal.error(\"You need to be able to connect to the Dark Web to use the buy command. (Maybe there's a TOR router you can buy somewhere)\");\n return;\n }\n\n if (args.length != 1) {\n terminal.print(\"Incorrect number of arguments. Usage: \");\n terminal.print(\"buy -l\");\n terminal.print(\"buy [item name]\");\n return;\n }\n\n const arg = args[0] + \"\";\n\n if (arg == \"-l\" || arg == \"-1\" || arg == \"--list\") {\n Object(_DarkWeb_DarkWeb__WEBPACK_IMPORTED_MODULE_0__[/* listAllDarkwebItems */ \"c\"])();\n } else {\n Object(_DarkWeb_DarkWeb__WEBPACK_IMPORTED_MODULE_0__[/* buyDarkwebItem */ \"a\"])(arg);\n }\n}\n\n//# sourceURL=webpack:///./src/Terminal/commands/buy.ts?"); +eval("/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return buy; });\n/* harmony import */ var _DarkWeb_DarkWeb__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../DarkWeb/DarkWeb */ 389);\n/* harmony import */ var _Server_SpecialServerIps__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Server/SpecialServerIps */ 51);\n\n\nfunction buy(terminal, router, player, server, args) {\n if (!_Server_SpecialServerIps__WEBPACK_IMPORTED_MODULE_1__[/* SpecialServerIps */ \"a\"].hasOwnProperty(\"Darkweb Server\")) {\n terminal.error(\"You need to be able to connect to the Dark Web to use the buy command. (Maybe there's a TOR router you can buy somewhere)\");\n return;\n }\n\n if (args.length != 1) {\n terminal.print(\"Incorrect number of arguments. Usage: \");\n terminal.print(\"buy -l\");\n terminal.print(\"buy [item name]\");\n return;\n }\n\n const arg = args[0] + \"\";\n\n if (arg == \"-l\" || arg == \"-1\" || arg == \"--list\") {\n Object(_DarkWeb_DarkWeb__WEBPACK_IMPORTED_MODULE_0__[/* listAllDarkwebItems */ \"c\"])();\n } else {\n Object(_DarkWeb_DarkWeb__WEBPACK_IMPORTED_MODULE_0__[/* buyDarkwebItem */ \"a\"])(arg);\n }\n}\n\n//# sourceURL=webpack:///./src/Terminal/commands/buy.ts?"); /***/ }), /* 666 */ @@ -4173,7 +4173,7 @@ eval("/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return runProgram; });\n/* harmony import */ var _Programs_Programs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Programs/Programs */ 53);\n\nfunction runProgram(terminal, router, player, server, args) {\n if (args.length < 1) {\n return;\n } // Check if you have the program on your computer. If you do, execute it, otherwise\n // display an error message\n\n\n const programName = args[0] + \"\";\n\n if (!player.hasProgram(programName)) {\n terminal.error(\"No such executable on home computer (Only programs that exist on your home computer can be run)\");\n return;\n }\n\n if (args.length < 1) {\n return;\n }\n\n for (const program of Object.values(_Programs_Programs__WEBPACK_IMPORTED_MODULE_0__[/* Programs */ \"a\"])) {\n if (program.name === programName) {\n program.run(router, terminal, player, server, args.slice(1).map(arg => arg + \"\"));\n return;\n }\n }\n\n terminal.print(\"Invalid executable. Cannot be run\");\n}\n\n//# sourceURL=webpack:///./src/Terminal/commands/runProgram.ts?"); +eval("/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return runProgram; });\n/* harmony import */ var _Programs_Programs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Programs/Programs */ 54);\n\nfunction runProgram(terminal, router, player, server, args) {\n if (args.length < 1) {\n return;\n } // Check if you have the program on your computer. If you do, execute it, otherwise\n // display an error message\n\n\n const programName = args[0] + \"\";\n\n if (!player.hasProgram(programName)) {\n terminal.error(\"No such executable on home computer (Only programs that exist on your home computer can be run)\");\n return;\n }\n\n if (args.length < 1) {\n return;\n }\n\n for (const program of Object.values(_Programs_Programs__WEBPACK_IMPORTED_MODULE_0__[/* Programs */ \"a\"])) {\n if (program.name === programName) {\n program.run(router, terminal, player, server, args.slice(1).map(arg => arg + \"\"));\n return;\n }\n }\n\n terminal.print(\"Invalid executable. Cannot be run\");\n}\n\n//# sourceURL=webpack:///./src/Terminal/commands/runProgram.ts?"); /***/ }), /* 689 */ @@ -4185,7 +4185,7 @@ eval("/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return scananalyze; });\n/* harmony import */ var _Programs_Programs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Programs/Programs */ 53);\n\nfunction scananalyze(terminal, router, player, server, args) {\n if (args.length === 0) {\n terminal.executeScanAnalyzeCommand(player, 1);\n } else {\n // # of args must be 2 or 3\n if (args.length > 2) {\n terminal.error(\"Incorrect usage of scan-analyze command. usage: scan-analyze [depth]\");\n return;\n }\n\n let all = false;\n\n if (args.length === 2 && args[1] === \"-a\") {\n all = true;\n }\n\n const depth = parseInt(args[0] + \"\");\n\n if (isNaN(depth) || depth < 0) {\n terminal.error(\"Incorrect usage of scan-analyze command. depth argument must be positive numeric\");\n return;\n }\n\n if (depth > 3 && !player.hasProgram(_Programs_Programs__WEBPACK_IMPORTED_MODULE_0__[/* Programs */ \"a\"].DeepscanV1.name) && !player.hasProgram(_Programs_Programs__WEBPACK_IMPORTED_MODULE_0__[/* Programs */ \"a\"].DeepscanV2.name)) {\n terminal.error(\"You cannot scan-analyze with that high of a depth. Maximum depth is 3\");\n return;\n } else if (depth > 5 && !player.hasProgram(_Programs_Programs__WEBPACK_IMPORTED_MODULE_0__[/* Programs */ \"a\"].DeepscanV2.name)) {\n terminal.error(\"You cannot scan-analyze with that high of a depth. Maximum depth is 5\");\n return;\n } else if (depth > 10) {\n terminal.error(\"You cannot scan-analyze with that high of a depth. Maximum depth is 10\");\n return;\n }\n\n terminal.executeScanAnalyzeCommand(player, depth, all);\n }\n}\n\n//# sourceURL=webpack:///./src/Terminal/commands/scananalyze.ts?"); +eval("/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return scananalyze; });\n/* harmony import */ var _Programs_Programs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Programs/Programs */ 54);\n\nfunction scananalyze(terminal, router, player, server, args) {\n if (args.length === 0) {\n terminal.executeScanAnalyzeCommand(player, 1);\n } else {\n // # of args must be 2 or 3\n if (args.length > 2) {\n terminal.error(\"Incorrect usage of scan-analyze command. usage: scan-analyze [depth]\");\n return;\n }\n\n let all = false;\n\n if (args.length === 2 && args[1] === \"-a\") {\n all = true;\n }\n\n const depth = parseInt(args[0] + \"\");\n\n if (isNaN(depth) || depth < 0) {\n terminal.error(\"Incorrect usage of scan-analyze command. depth argument must be positive numeric\");\n return;\n }\n\n if (depth > 3 && !player.hasProgram(_Programs_Programs__WEBPACK_IMPORTED_MODULE_0__[/* Programs */ \"a\"].DeepscanV1.name) && !player.hasProgram(_Programs_Programs__WEBPACK_IMPORTED_MODULE_0__[/* Programs */ \"a\"].DeepscanV2.name)) {\n terminal.error(\"You cannot scan-analyze with that high of a depth. Maximum depth is 3\");\n return;\n } else if (depth > 5 && !player.hasProgram(_Programs_Programs__WEBPACK_IMPORTED_MODULE_0__[/* Programs */ \"a\"].DeepscanV2.name)) {\n terminal.error(\"You cannot scan-analyze with that high of a depth. Maximum depth is 5\");\n return;\n } else if (depth > 10) {\n terminal.error(\"You cannot scan-analyze with that high of a depth. Maximum depth is 10\");\n return;\n }\n\n terminal.executeScanAnalyzeCommand(player, depth, all);\n }\n}\n\n//# sourceURL=webpack:///./src/Terminal/commands/scananalyze.ts?"); /***/ }), /* 690 */ @@ -4341,7 +4341,7 @@ eval("/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return GangMember; });\n/* harmony import */ var _GangMemberTask__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./GangMemberTask */ 440);\n/* harmony import */ var _GangMemberTasks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./GangMemberTasks */ 177);\n/* harmony import */ var _GangMemberUpgrades__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./GangMemberUpgrades */ 155);\n/* harmony import */ var _AllGangs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./AllGangs */ 59);\n/* harmony import */ var _utils_JSONReviver__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils/JSONReviver */ 15);\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n\n\n\n\n\nclass GangMember {\n // Names of upgrades\n // Names of augmentations only\n constructor(name = \"\") {\n _defineProperty(this, \"task\", \"Unassigned\");\n\n _defineProperty(this, \"earnedRespect\", 0);\n\n _defineProperty(this, \"hack\", 1);\n\n _defineProperty(this, \"str\", 1);\n\n _defineProperty(this, \"def\", 1);\n\n _defineProperty(this, \"dex\", 1);\n\n _defineProperty(this, \"agi\", 1);\n\n _defineProperty(this, \"cha\", 1);\n\n _defineProperty(this, \"hack_exp\", 0);\n\n _defineProperty(this, \"str_exp\", 0);\n\n _defineProperty(this, \"def_exp\", 0);\n\n _defineProperty(this, \"dex_exp\", 0);\n\n _defineProperty(this, \"agi_exp\", 0);\n\n _defineProperty(this, \"cha_exp\", 0);\n\n _defineProperty(this, \"hack_mult\", 1);\n\n _defineProperty(this, \"str_mult\", 1);\n\n _defineProperty(this, \"def_mult\", 1);\n\n _defineProperty(this, \"dex_mult\", 1);\n\n _defineProperty(this, \"agi_mult\", 1);\n\n _defineProperty(this, \"cha_mult\", 1);\n\n _defineProperty(this, \"hack_asc_points\", 0);\n\n _defineProperty(this, \"str_asc_points\", 0);\n\n _defineProperty(this, \"def_asc_points\", 0);\n\n _defineProperty(this, \"dex_asc_points\", 0);\n\n _defineProperty(this, \"agi_asc_points\", 0);\n\n _defineProperty(this, \"cha_asc_points\", 0);\n\n _defineProperty(this, \"upgrades\", []);\n\n _defineProperty(this, \"augmentations\", []);\n\n this.name = name;\n }\n\n calculateSkill(exp, mult = 1) {\n return Math.max(Math.floor(mult * (32 * Math.log(exp + 534.5) - 200)), 1);\n }\n\n calculateAscensionMult(points) {\n return Math.max(Math.pow(points / 4000, 0.7), 1);\n }\n\n updateSkillLevels() {\n this.hack = this.calculateSkill(this.hack_exp, this.hack_mult * this.calculateAscensionMult(this.hack_asc_points));\n this.str = this.calculateSkill(this.str_exp, this.str_mult * this.calculateAscensionMult(this.str_asc_points));\n this.def = this.calculateSkill(this.def_exp, this.def_mult * this.calculateAscensionMult(this.def_asc_points));\n this.dex = this.calculateSkill(this.dex_exp, this.dex_mult * this.calculateAscensionMult(this.dex_asc_points));\n this.agi = this.calculateSkill(this.agi_exp, this.agi_mult * this.calculateAscensionMult(this.agi_asc_points));\n this.cha = this.calculateSkill(this.cha_exp, this.cha_mult * this.calculateAscensionMult(this.cha_asc_points));\n }\n\n calculatePower() {\n return (this.hack + this.str + this.def + this.dex + this.agi + this.cha) / 95;\n }\n\n assignToTask(taskName) {\n if (!_GangMemberTasks__WEBPACK_IMPORTED_MODULE_1__[/* GangMemberTasks */ \"a\"].hasOwnProperty(taskName)) {\n this.task = \"Unassigned\";\n return false;\n }\n\n this.task = taskName;\n return true;\n }\n\n unassignFromTask() {\n this.task = \"Unassigned\";\n }\n\n getTask() {\n // TODO(hydroflame): transfer that to a save file migration function\n // Backwards compatibility\n if (this.task instanceof _GangMemberTask__WEBPACK_IMPORTED_MODULE_0__[/* GangMemberTask */ \"a\"]) {\n this.task = this.task.name;\n }\n\n if (_GangMemberTasks__WEBPACK_IMPORTED_MODULE_1__[/* GangMemberTasks */ \"a\"].hasOwnProperty(this.task)) {\n return _GangMemberTasks__WEBPACK_IMPORTED_MODULE_1__[/* GangMemberTasks */ \"a\"][this.task];\n }\n\n return _GangMemberTasks__WEBPACK_IMPORTED_MODULE_1__[/* GangMemberTasks */ \"a\"][\"Unassigned\"];\n }\n\n calculateRespectGain(gang) {\n const task = this.getTask();\n if (task.baseRespect === 0) return 0;\n let statWeight = task.hackWeight / 100 * this.hack + task.strWeight / 100 * this.str + task.defWeight / 100 * this.def + task.dexWeight / 100 * this.dex + task.agiWeight / 100 * this.agi + task.chaWeight / 100 * this.cha;\n statWeight -= 4 * task.difficulty;\n if (statWeight <= 0) return 0;\n const territoryMult = Math.max(0.005, Math.pow(_AllGangs__WEBPACK_IMPORTED_MODULE_3__[/* AllGangs */ \"a\"][gang.facName].territory * 100, task.territory.respect) / 100);\n if (isNaN(territoryMult) || territoryMult <= 0) return 0;\n const respectMult = gang.getWantedPenalty();\n return 11 * task.baseRespect * statWeight * territoryMult * respectMult;\n }\n\n calculateWantedLevelGain(gang) {\n const task = this.getTask();\n if (task.baseWanted === 0) return 0;\n let statWeight = task.hackWeight / 100 * this.hack + task.strWeight / 100 * this.str + task.defWeight / 100 * this.def + task.dexWeight / 100 * this.dex + task.agiWeight / 100 * this.agi + task.chaWeight / 100 * this.cha;\n statWeight -= 3.5 * task.difficulty;\n if (statWeight <= 0) return 0;\n const territoryMult = Math.max(0.005, Math.pow(_AllGangs__WEBPACK_IMPORTED_MODULE_3__[/* AllGangs */ \"a\"][gang.facName].territory * 100, task.territory.wanted) / 100);\n if (isNaN(territoryMult) || territoryMult <= 0) return 0;\n\n if (task.baseWanted < 0) {\n return 0.4 * task.baseWanted * statWeight * territoryMult;\n }\n\n const calc = 7 * task.baseWanted / Math.pow(3 * statWeight * territoryMult, 0.8); // Put an arbitrary cap on this to prevent wanted level from rising too fast if the\n // denominator is very small. Might want to rethink formula later\n\n return Math.min(100, calc);\n }\n\n calculateMoneyGain(gang) {\n const task = this.getTask();\n if (task.baseMoney === 0) return 0;\n let statWeight = task.hackWeight / 100 * this.hack + task.strWeight / 100 * this.str + task.defWeight / 100 * this.def + task.dexWeight / 100 * this.dex + task.agiWeight / 100 * this.agi + task.chaWeight / 100 * this.cha;\n statWeight -= 3.2 * task.difficulty;\n if (statWeight <= 0) return 0;\n const territoryMult = Math.max(0.005, Math.pow(_AllGangs__WEBPACK_IMPORTED_MODULE_3__[/* AllGangs */ \"a\"][gang.facName].territory * 100, task.territory.money) / 100);\n if (isNaN(territoryMult) || territoryMult <= 0) return 0;\n const respectMult = gang.getWantedPenalty();\n return 5 * task.baseMoney * statWeight * territoryMult * respectMult;\n }\n\n expMult() {\n return {\n hack: (this.hack_mult - 1) / 4 + 1,\n str: (this.str_mult - 1) / 4 + 1,\n def: (this.def_mult - 1) / 4 + 1,\n dex: (this.dex_mult - 1) / 4 + 1,\n agi: (this.agi_mult - 1) / 4 + 1,\n cha: (this.cha_mult - 1) / 4 + 1\n };\n }\n\n gainExperience(numCycles = 1) {\n const task = this.getTask();\n if (task === _GangMemberTasks__WEBPACK_IMPORTED_MODULE_1__[/* GangMemberTasks */ \"a\"][\"Unassigned\"]) return;\n const difficultyMult = Math.pow(task.difficulty, 0.9);\n const difficultyPerCycles = difficultyMult * numCycles;\n const weightDivisor = 1500;\n const expMult = this.expMult();\n this.hack_exp += task.hackWeight / weightDivisor * difficultyPerCycles * expMult.hack;\n this.str_exp += task.strWeight / weightDivisor * difficultyPerCycles * expMult.str;\n this.def_exp += task.defWeight / weightDivisor * difficultyPerCycles * expMult.def;\n this.dex_exp += task.dexWeight / weightDivisor * difficultyPerCycles * expMult.dex;\n this.agi_exp += task.agiWeight / weightDivisor * difficultyPerCycles * expMult.agi;\n this.cha_exp += task.chaWeight / weightDivisor * difficultyPerCycles * expMult.cha;\n }\n\n recordEarnedRespect(numCycles = 1, gang) {\n this.earnedRespect += this.calculateRespectGain(gang) * numCycles;\n }\n\n getGainedAscensionPoints() {\n return {\n hack: Math.max(this.hack_exp - 1000, 0),\n str: Math.max(this.str_exp - 1000, 0),\n def: Math.max(this.def_exp - 1000, 0),\n dex: Math.max(this.dex_exp - 1000, 0),\n agi: Math.max(this.agi_exp - 1000, 0),\n cha: Math.max(this.cha_exp - 1000, 0)\n };\n }\n\n canAscend() {\n const points = this.getGainedAscensionPoints();\n return points.hack > 0 || points.str > 0 || points.def > 0 || points.dex > 0 || points.agi > 0 || points.cha > 0;\n }\n\n getAscensionResults() {\n const points = this.getGainedAscensionPoints();\n return {\n hack: this.calculateAscensionMult(this.hack_asc_points + points.hack) / this.calculateAscensionMult(this.hack_asc_points),\n str: this.calculateAscensionMult(this.str_asc_points + points.str) / this.calculateAscensionMult(this.str_asc_points),\n def: this.calculateAscensionMult(this.def_asc_points + points.def) / this.calculateAscensionMult(this.def_asc_points),\n dex: this.calculateAscensionMult(this.dex_asc_points + points.dex) / this.calculateAscensionMult(this.dex_asc_points),\n agi: this.calculateAscensionMult(this.agi_asc_points + points.agi) / this.calculateAscensionMult(this.agi_asc_points),\n cha: this.calculateAscensionMult(this.cha_asc_points + points.cha) / this.calculateAscensionMult(this.cha_asc_points)\n };\n }\n\n ascend() {\n const res = this.getAscensionResults();\n const points = this.getGainedAscensionPoints();\n this.hack_asc_points += points.hack;\n this.str_asc_points += points.str;\n this.def_asc_points += points.def;\n this.dex_asc_points += points.dex;\n this.agi_asc_points += points.agi;\n this.cha_asc_points += points.cha; // Remove upgrades. Then re-calculate multipliers and stats\n\n this.upgrades.length = 0;\n this.hack_mult = 1;\n this.str_mult = 1;\n this.def_mult = 1;\n this.dex_mult = 1;\n this.agi_mult = 1;\n this.cha_mult = 1;\n\n for (let i = 0; i < this.augmentations.length; ++i) {\n const aug = _GangMemberUpgrades__WEBPACK_IMPORTED_MODULE_2__[/* GangMemberUpgrades */ \"a\"][this.augmentations[i]];\n this.applyUpgrade(aug);\n } // Clear exp and recalculate stats\n\n\n this.hack_exp = 0;\n this.str_exp = 0;\n this.def_exp = 0;\n this.dex_exp = 0;\n this.agi_exp = 0;\n this.cha_exp = 0;\n this.updateSkillLevels();\n const respectToDeduct = this.earnedRespect;\n this.earnedRespect = 0;\n return {\n respect: respectToDeduct,\n hack: res.hack,\n str: res.str,\n def: res.def,\n dex: res.dex,\n agi: res.agi,\n cha: res.cha\n };\n }\n\n applyUpgrade(upg) {\n if (upg.mults.str != null) this.str_mult *= upg.mults.str;\n if (upg.mults.def != null) this.def_mult *= upg.mults.def;\n if (upg.mults.dex != null) this.dex_mult *= upg.mults.dex;\n if (upg.mults.agi != null) this.agi_mult *= upg.mults.agi;\n if (upg.mults.cha != null) this.cha_mult *= upg.mults.cha;\n if (upg.mults.hack != null) this.hack_mult *= upg.mults.hack;\n }\n\n buyUpgrade(upg, player, gang) {\n // Prevent purchasing of already-owned upgrades\n if (this.augmentations.includes(upg.name) || this.upgrades.includes(upg.name)) return false;\n if (player.money.lt(gang.getUpgradeCost(upg))) return false;\n player.loseMoney(gang.getUpgradeCost(upg));\n\n if (upg.type === \"g\") {\n this.augmentations.push(upg.name);\n } else {\n this.upgrades.push(upg.name);\n }\n\n this.applyUpgrade(upg);\n return true;\n }\n /**\n * Serialize the current object to a JSON save state.\n */\n\n\n toJSON() {\n return Object(_utils_JSONReviver__WEBPACK_IMPORTED_MODULE_4__[/* Generic_toJSON */ \"b\"])(\"GangMember\", this);\n }\n /**\n * Initiatizes a GangMember object from a JSON save state.\n */\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\n\n static fromJSON(value) {\n return Object(_utils_JSONReviver__WEBPACK_IMPORTED_MODULE_4__[/* Generic_fromJSON */ \"a\"])(GangMember, value.data);\n }\n\n}\n_utils_JSONReviver__WEBPACK_IMPORTED_MODULE_4__[/* Reviver */ \"c\"].constructors.GangMember = GangMember;\n\n//# sourceURL=webpack:///./src/Gang/GangMember.ts?"); +eval("/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return GangMember; });\n/* harmony import */ var _GangMemberTask__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./GangMemberTask */ 440);\n/* harmony import */ var _GangMemberTasks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./GangMemberTasks */ 177);\n/* harmony import */ var _GangMemberUpgrades__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./GangMemberUpgrades */ 154);\n/* harmony import */ var _AllGangs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./AllGangs */ 59);\n/* harmony import */ var _utils_JSONReviver__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils/JSONReviver */ 15);\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n\n\n\n\n\nclass GangMember {\n // Names of upgrades\n // Names of augmentations only\n constructor(name = \"\") {\n _defineProperty(this, \"task\", \"Unassigned\");\n\n _defineProperty(this, \"earnedRespect\", 0);\n\n _defineProperty(this, \"hack\", 1);\n\n _defineProperty(this, \"str\", 1);\n\n _defineProperty(this, \"def\", 1);\n\n _defineProperty(this, \"dex\", 1);\n\n _defineProperty(this, \"agi\", 1);\n\n _defineProperty(this, \"cha\", 1);\n\n _defineProperty(this, \"hack_exp\", 0);\n\n _defineProperty(this, \"str_exp\", 0);\n\n _defineProperty(this, \"def_exp\", 0);\n\n _defineProperty(this, \"dex_exp\", 0);\n\n _defineProperty(this, \"agi_exp\", 0);\n\n _defineProperty(this, \"cha_exp\", 0);\n\n _defineProperty(this, \"hack_mult\", 1);\n\n _defineProperty(this, \"str_mult\", 1);\n\n _defineProperty(this, \"def_mult\", 1);\n\n _defineProperty(this, \"dex_mult\", 1);\n\n _defineProperty(this, \"agi_mult\", 1);\n\n _defineProperty(this, \"cha_mult\", 1);\n\n _defineProperty(this, \"hack_asc_points\", 0);\n\n _defineProperty(this, \"str_asc_points\", 0);\n\n _defineProperty(this, \"def_asc_points\", 0);\n\n _defineProperty(this, \"dex_asc_points\", 0);\n\n _defineProperty(this, \"agi_asc_points\", 0);\n\n _defineProperty(this, \"cha_asc_points\", 0);\n\n _defineProperty(this, \"upgrades\", []);\n\n _defineProperty(this, \"augmentations\", []);\n\n this.name = name;\n }\n\n calculateSkill(exp, mult = 1) {\n return Math.max(Math.floor(mult * (32 * Math.log(exp + 534.5) - 200)), 1);\n }\n\n calculateAscensionMult(points) {\n return Math.max(Math.pow(points / 4000, 0.7), 1);\n }\n\n updateSkillLevels() {\n this.hack = this.calculateSkill(this.hack_exp, this.hack_mult * this.calculateAscensionMult(this.hack_asc_points));\n this.str = this.calculateSkill(this.str_exp, this.str_mult * this.calculateAscensionMult(this.str_asc_points));\n this.def = this.calculateSkill(this.def_exp, this.def_mult * this.calculateAscensionMult(this.def_asc_points));\n this.dex = this.calculateSkill(this.dex_exp, this.dex_mult * this.calculateAscensionMult(this.dex_asc_points));\n this.agi = this.calculateSkill(this.agi_exp, this.agi_mult * this.calculateAscensionMult(this.agi_asc_points));\n this.cha = this.calculateSkill(this.cha_exp, this.cha_mult * this.calculateAscensionMult(this.cha_asc_points));\n }\n\n calculatePower() {\n return (this.hack + this.str + this.def + this.dex + this.agi + this.cha) / 95;\n }\n\n assignToTask(taskName) {\n if (!_GangMemberTasks__WEBPACK_IMPORTED_MODULE_1__[/* GangMemberTasks */ \"a\"].hasOwnProperty(taskName)) {\n this.task = \"Unassigned\";\n return false;\n }\n\n this.task = taskName;\n return true;\n }\n\n unassignFromTask() {\n this.task = \"Unassigned\";\n }\n\n getTask() {\n // TODO(hydroflame): transfer that to a save file migration function\n // Backwards compatibility\n if (this.task instanceof _GangMemberTask__WEBPACK_IMPORTED_MODULE_0__[/* GangMemberTask */ \"a\"]) {\n this.task = this.task.name;\n }\n\n if (_GangMemberTasks__WEBPACK_IMPORTED_MODULE_1__[/* GangMemberTasks */ \"a\"].hasOwnProperty(this.task)) {\n return _GangMemberTasks__WEBPACK_IMPORTED_MODULE_1__[/* GangMemberTasks */ \"a\"][this.task];\n }\n\n return _GangMemberTasks__WEBPACK_IMPORTED_MODULE_1__[/* GangMemberTasks */ \"a\"][\"Unassigned\"];\n }\n\n calculateRespectGain(gang) {\n const task = this.getTask();\n if (task.baseRespect === 0) return 0;\n let statWeight = task.hackWeight / 100 * this.hack + task.strWeight / 100 * this.str + task.defWeight / 100 * this.def + task.dexWeight / 100 * this.dex + task.agiWeight / 100 * this.agi + task.chaWeight / 100 * this.cha;\n statWeight -= 4 * task.difficulty;\n if (statWeight <= 0) return 0;\n const territoryMult = Math.max(0.005, Math.pow(_AllGangs__WEBPACK_IMPORTED_MODULE_3__[/* AllGangs */ \"a\"][gang.facName].territory * 100, task.territory.respect) / 100);\n if (isNaN(territoryMult) || territoryMult <= 0) return 0;\n const respectMult = gang.getWantedPenalty();\n return 11 * task.baseRespect * statWeight * territoryMult * respectMult;\n }\n\n calculateWantedLevelGain(gang) {\n const task = this.getTask();\n if (task.baseWanted === 0) return 0;\n let statWeight = task.hackWeight / 100 * this.hack + task.strWeight / 100 * this.str + task.defWeight / 100 * this.def + task.dexWeight / 100 * this.dex + task.agiWeight / 100 * this.agi + task.chaWeight / 100 * this.cha;\n statWeight -= 3.5 * task.difficulty;\n if (statWeight <= 0) return 0;\n const territoryMult = Math.max(0.005, Math.pow(_AllGangs__WEBPACK_IMPORTED_MODULE_3__[/* AllGangs */ \"a\"][gang.facName].territory * 100, task.territory.wanted) / 100);\n if (isNaN(territoryMult) || territoryMult <= 0) return 0;\n\n if (task.baseWanted < 0) {\n return 0.4 * task.baseWanted * statWeight * territoryMult;\n }\n\n const calc = 7 * task.baseWanted / Math.pow(3 * statWeight * territoryMult, 0.8); // Put an arbitrary cap on this to prevent wanted level from rising too fast if the\n // denominator is very small. Might want to rethink formula later\n\n return Math.min(100, calc);\n }\n\n calculateMoneyGain(gang) {\n const task = this.getTask();\n if (task.baseMoney === 0) return 0;\n let statWeight = task.hackWeight / 100 * this.hack + task.strWeight / 100 * this.str + task.defWeight / 100 * this.def + task.dexWeight / 100 * this.dex + task.agiWeight / 100 * this.agi + task.chaWeight / 100 * this.cha;\n statWeight -= 3.2 * task.difficulty;\n if (statWeight <= 0) return 0;\n const territoryMult = Math.max(0.005, Math.pow(_AllGangs__WEBPACK_IMPORTED_MODULE_3__[/* AllGangs */ \"a\"][gang.facName].territory * 100, task.territory.money) / 100);\n if (isNaN(territoryMult) || territoryMult <= 0) return 0;\n const respectMult = gang.getWantedPenalty();\n return 5 * task.baseMoney * statWeight * territoryMult * respectMult;\n }\n\n expMult() {\n return {\n hack: (this.hack_mult - 1) / 4 + 1,\n str: (this.str_mult - 1) / 4 + 1,\n def: (this.def_mult - 1) / 4 + 1,\n dex: (this.dex_mult - 1) / 4 + 1,\n agi: (this.agi_mult - 1) / 4 + 1,\n cha: (this.cha_mult - 1) / 4 + 1\n };\n }\n\n gainExperience(numCycles = 1) {\n const task = this.getTask();\n if (task === _GangMemberTasks__WEBPACK_IMPORTED_MODULE_1__[/* GangMemberTasks */ \"a\"][\"Unassigned\"]) return;\n const difficultyMult = Math.pow(task.difficulty, 0.9);\n const difficultyPerCycles = difficultyMult * numCycles;\n const weightDivisor = 1500;\n const expMult = this.expMult();\n this.hack_exp += task.hackWeight / weightDivisor * difficultyPerCycles * expMult.hack;\n this.str_exp += task.strWeight / weightDivisor * difficultyPerCycles * expMult.str;\n this.def_exp += task.defWeight / weightDivisor * difficultyPerCycles * expMult.def;\n this.dex_exp += task.dexWeight / weightDivisor * difficultyPerCycles * expMult.dex;\n this.agi_exp += task.agiWeight / weightDivisor * difficultyPerCycles * expMult.agi;\n this.cha_exp += task.chaWeight / weightDivisor * difficultyPerCycles * expMult.cha;\n }\n\n recordEarnedRespect(numCycles = 1, gang) {\n this.earnedRespect += this.calculateRespectGain(gang) * numCycles;\n }\n\n getGainedAscensionPoints() {\n return {\n hack: Math.max(this.hack_exp - 1000, 0),\n str: Math.max(this.str_exp - 1000, 0),\n def: Math.max(this.def_exp - 1000, 0),\n dex: Math.max(this.dex_exp - 1000, 0),\n agi: Math.max(this.agi_exp - 1000, 0),\n cha: Math.max(this.cha_exp - 1000, 0)\n };\n }\n\n canAscend() {\n const points = this.getGainedAscensionPoints();\n return points.hack > 0 || points.str > 0 || points.def > 0 || points.dex > 0 || points.agi > 0 || points.cha > 0;\n }\n\n getAscensionResults() {\n const points = this.getGainedAscensionPoints();\n return {\n hack: this.calculateAscensionMult(this.hack_asc_points + points.hack) / this.calculateAscensionMult(this.hack_asc_points),\n str: this.calculateAscensionMult(this.str_asc_points + points.str) / this.calculateAscensionMult(this.str_asc_points),\n def: this.calculateAscensionMult(this.def_asc_points + points.def) / this.calculateAscensionMult(this.def_asc_points),\n dex: this.calculateAscensionMult(this.dex_asc_points + points.dex) / this.calculateAscensionMult(this.dex_asc_points),\n agi: this.calculateAscensionMult(this.agi_asc_points + points.agi) / this.calculateAscensionMult(this.agi_asc_points),\n cha: this.calculateAscensionMult(this.cha_asc_points + points.cha) / this.calculateAscensionMult(this.cha_asc_points)\n };\n }\n\n ascend() {\n const res = this.getAscensionResults();\n const points = this.getGainedAscensionPoints();\n this.hack_asc_points += points.hack;\n this.str_asc_points += points.str;\n this.def_asc_points += points.def;\n this.dex_asc_points += points.dex;\n this.agi_asc_points += points.agi;\n this.cha_asc_points += points.cha; // Remove upgrades. Then re-calculate multipliers and stats\n\n this.upgrades.length = 0;\n this.hack_mult = 1;\n this.str_mult = 1;\n this.def_mult = 1;\n this.dex_mult = 1;\n this.agi_mult = 1;\n this.cha_mult = 1;\n\n for (let i = 0; i < this.augmentations.length; ++i) {\n const aug = _GangMemberUpgrades__WEBPACK_IMPORTED_MODULE_2__[/* GangMemberUpgrades */ \"a\"][this.augmentations[i]];\n this.applyUpgrade(aug);\n } // Clear exp and recalculate stats\n\n\n this.hack_exp = 0;\n this.str_exp = 0;\n this.def_exp = 0;\n this.dex_exp = 0;\n this.agi_exp = 0;\n this.cha_exp = 0;\n this.updateSkillLevels();\n const respectToDeduct = this.earnedRespect;\n this.earnedRespect = 0;\n return {\n respect: respectToDeduct,\n hack: res.hack,\n str: res.str,\n def: res.def,\n dex: res.dex,\n agi: res.agi,\n cha: res.cha\n };\n }\n\n applyUpgrade(upg) {\n if (upg.mults.str != null) this.str_mult *= upg.mults.str;\n if (upg.mults.def != null) this.def_mult *= upg.mults.def;\n if (upg.mults.dex != null) this.dex_mult *= upg.mults.dex;\n if (upg.mults.agi != null) this.agi_mult *= upg.mults.agi;\n if (upg.mults.cha != null) this.cha_mult *= upg.mults.cha;\n if (upg.mults.hack != null) this.hack_mult *= upg.mults.hack;\n }\n\n buyUpgrade(upg, player, gang) {\n // Prevent purchasing of already-owned upgrades\n if (this.augmentations.includes(upg.name) || this.upgrades.includes(upg.name)) return false;\n if (player.money.lt(gang.getUpgradeCost(upg))) return false;\n player.loseMoney(gang.getUpgradeCost(upg));\n\n if (upg.type === \"g\") {\n this.augmentations.push(upg.name);\n } else {\n this.upgrades.push(upg.name);\n }\n\n this.applyUpgrade(upg);\n return true;\n }\n /**\n * Serialize the current object to a JSON save state.\n */\n\n\n toJSON() {\n return Object(_utils_JSONReviver__WEBPACK_IMPORTED_MODULE_4__[/* Generic_toJSON */ \"b\"])(\"GangMember\", this);\n }\n /**\n * Initiatizes a GangMember object from a JSON save state.\n */\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\n\n static fromJSON(value) {\n return Object(_utils_JSONReviver__WEBPACK_IMPORTED_MODULE_4__[/* Generic_fromJSON */ \"a\"])(GangMember, value.data);\n }\n\n}\n_utils_JSONReviver__WEBPACK_IMPORTED_MODULE_4__[/* Reviver */ \"c\"].constructors.GangMember = GangMember;\n\n//# sourceURL=webpack:///./src/Gang/GangMember.ts?"); /***/ }), /* 703 */ @@ -4425,7 +4425,7 @@ eval("/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"canAccessCorporation\", function() { return canAccessCorporation; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"hasCorporation\", function() { return hasCorporation; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"startCorporation\", function() { return startCorporation; });\n/* harmony import */ var _Corporation_Corporation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Corporation/Corporation */ 259);\n/* harmony import */ var _SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../SourceFile/SourceFileFlags */ 49);\n\n\nfunction canAccessCorporation() {\n return this.bitNodeN === 3 || _SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_1__[/* SourceFileFlags */ \"a\"][3] > 0;\n}\nfunction hasCorporation() {\n if (this.corporation == null) {\n return false;\n }\n\n return this.corporation instanceof _Corporation_Corporation__WEBPACK_IMPORTED_MODULE_0__[/* Corporation */ \"a\"];\n}\nfunction startCorporation(corpName, additionalShares = 0) {\n this.corporation = new _Corporation_Corporation__WEBPACK_IMPORTED_MODULE_0__[/* Corporation */ \"a\"]({\n name: corpName\n });\n this.corporation.totalShares += additionalShares;\n}\n\n//# sourceURL=webpack:///./src/PersonObjects/Player/PlayerObjectCorporationMethods.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"canAccessCorporation\", function() { return canAccessCorporation; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"hasCorporation\", function() { return hasCorporation; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"startCorporation\", function() { return startCorporation; });\n/* harmony import */ var _Corporation_Corporation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Corporation/Corporation */ 259);\n/* harmony import */ var _SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../SourceFile/SourceFileFlags */ 50);\n\n\nfunction canAccessCorporation() {\n return this.bitNodeN === 3 || _SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_1__[/* SourceFileFlags */ \"a\"][3] > 0;\n}\nfunction hasCorporation() {\n if (this.corporation == null) {\n return false;\n }\n\n return this.corporation instanceof _Corporation_Corporation__WEBPACK_IMPORTED_MODULE_0__[/* Corporation */ \"a\"];\n}\nfunction startCorporation(corpName, additionalShares = 0) {\n this.corporation = new _Corporation_Corporation__WEBPACK_IMPORTED_MODULE_0__[/* Corporation */ \"a\"]({\n name: corpName\n });\n this.corporation.totalShares += additionalShares;\n}\n\n//# sourceURL=webpack:///./src/PersonObjects/Player/PlayerObjectCorporationMethods.js?"); /***/ }), /* 710 */ @@ -4437,7 +4437,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) * /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"canAccessGang\", function() { return canAccessGang; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getGangFaction\", function() { return getGangFaction; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getGangName\", function() { return getGangName; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"hasGangWith\", function() { return hasGangWith; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"inGang\", function() { return inGang; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"startGang\", function() { return startGang; });\n/* harmony import */ var _Faction_Factions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Faction/Factions */ 22);\n/* harmony import */ var _Gang_Gang__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Gang/Gang */ 393);\n/* harmony import */ var _SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../SourceFile/SourceFileFlags */ 49);\n/* harmony import */ var _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../BitNode/BitNodeMultipliers */ 8);\n\n\n\n // Amount of negative karma needed to manage a gang in BitNodes other than 2\n\nconst GangKarmaRequirement = -54000;\nfunction canAccessGang() {\n if (this.bitNodeN === 2) {\n return true;\n }\n\n if (_SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_2__[/* SourceFileFlags */ \"a\"][2] <= 0) {\n return false;\n }\n\n return this.karma <= _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_3__[/* BitNodeMultipliers */ \"a\"].GangKarmaRequirement * GangKarmaRequirement;\n}\nfunction getGangFaction() {\n const fac = _Faction_Factions__WEBPACK_IMPORTED_MODULE_0__[/* Factions */ \"a\"][this.gang.facName];\n\n if (fac == null) {\n throw new Error(`Gang has invalid faction name: ${this.gang.facName}`);\n }\n\n return fac;\n}\nfunction getGangName() {\n return this.inGang() ? this.gang.facName : \"\";\n}\nfunction hasGangWith(facName) {\n return this.inGang() && this.gang.facName === facName;\n}\nfunction inGang() {\n if (this.gang == null || this.gang == undefined) {\n return false;\n }\n\n return this.gang instanceof _Gang_Gang__WEBPACK_IMPORTED_MODULE_1__[/* Gang */ \"a\"];\n}\nfunction startGang(factionName, hacking) {\n this.gang = new _Gang_Gang__WEBPACK_IMPORTED_MODULE_1__[/* Gang */ \"a\"](factionName, hacking);\n const fac = _Faction_Factions__WEBPACK_IMPORTED_MODULE_0__[/* Factions */ \"a\"][factionName];\n\n if (fac == null) {\n throw new Error(`Invalid faction name when creating gang: ${factionName}`);\n }\n\n fac.playerReputation = 0;\n}\n\n//# sourceURL=webpack:///./src/PersonObjects/Player/PlayerObjectGangMethods.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"canAccessGang\", function() { return canAccessGang; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getGangFaction\", function() { return getGangFaction; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getGangName\", function() { return getGangName; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"hasGangWith\", function() { return hasGangWith; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"inGang\", function() { return inGang; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"startGang\", function() { return startGang; });\n/* harmony import */ var _Faction_Factions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Faction/Factions */ 22);\n/* harmony import */ var _Gang_Gang__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Gang/Gang */ 393);\n/* harmony import */ var _SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../SourceFile/SourceFileFlags */ 50);\n/* harmony import */ var _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../BitNode/BitNodeMultipliers */ 8);\n\n\n\n // Amount of negative karma needed to manage a gang in BitNodes other than 2\n\nconst GangKarmaRequirement = -54000;\nfunction canAccessGang() {\n if (this.bitNodeN === 2) {\n return true;\n }\n\n if (_SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_2__[/* SourceFileFlags */ \"a\"][2] <= 0) {\n return false;\n }\n\n return this.karma <= _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_3__[/* BitNodeMultipliers */ \"a\"].GangKarmaRequirement * GangKarmaRequirement;\n}\nfunction getGangFaction() {\n const fac = _Faction_Factions__WEBPACK_IMPORTED_MODULE_0__[/* Factions */ \"a\"][this.gang.facName];\n\n if (fac == null) {\n throw new Error(`Gang has invalid faction name: ${this.gang.facName}`);\n }\n\n return fac;\n}\nfunction getGangName() {\n return this.inGang() ? this.gang.facName : \"\";\n}\nfunction hasGangWith(facName) {\n return this.inGang() && this.gang.facName === facName;\n}\nfunction inGang() {\n if (this.gang == null || this.gang == undefined) {\n return false;\n }\n\n return this.gang instanceof _Gang_Gang__WEBPACK_IMPORTED_MODULE_1__[/* Gang */ \"a\"];\n}\nfunction startGang(factionName, hacking) {\n this.gang = new _Gang_Gang__WEBPACK_IMPORTED_MODULE_1__[/* Gang */ \"a\"](factionName, hacking);\n const fac = _Faction_Factions__WEBPACK_IMPORTED_MODULE_0__[/* Factions */ \"a\"][factionName];\n\n if (fac == null) {\n throw new Error(`Invalid faction name when creating gang: ${factionName}`);\n }\n\n fac.playerReputation = 0;\n}\n\n//# sourceURL=webpack:///./src/PersonObjects/Player/PlayerObjectGangMethods.js?"); /***/ }), /* 711 */ @@ -4449,7 +4449,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) * /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"init\", function() { return init; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"prestigeAugmentation\", function() { return prestigeAugmentation; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"prestigeSourceFile\", function() { return prestigeSourceFile; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"receiveInvite\", function() { return receiveInvite; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"calculateSkill\", function() { return calculateSkill; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"updateSkillLevels\", function() { return updateSkillLevels; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"resetMultipliers\", function() { return resetMultipliers; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"hasProgram\", function() { return hasProgram; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"setMoney\", function() { return setMoney; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"gainMoney\", function() { return gainMoney; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"loseMoney\", function() { return loseMoney; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"canAfford\", function() { return canAfford; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"recordMoneySource\", function() { return recordMoneySource; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"gainHackingExp\", function() { return gainHackingExp; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"gainStrengthExp\", function() { return gainStrengthExp; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"gainDefenseExp\", function() { return gainDefenseExp; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"gainDexterityExp\", function() { return gainDexterityExp; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"gainAgilityExp\", function() { return gainAgilityExp; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"gainCharismaExp\", function() { return gainCharismaExp; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"gainIntelligenceExp\", function() { return gainIntelligenceExp; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"queryStatFromString\", function() { return queryStatFromString; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"resetWorkStatus\", function() { return resetWorkStatus; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"processWorkEarnings\", function() { return processWorkEarnings; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"startWork\", function() { return startWork; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"cancelationPenalty\", function() { return cancelationPenalty; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"work\", function() { return work; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"finishWork\", function() { return finishWork; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"startWorkPartTime\", function() { return startWorkPartTime; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"workPartTime\", function() { return workPartTime; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"finishWorkPartTime\", function() { return finishWorkPartTime; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"startFocusing\", function() { return startFocusing; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"stopFocusing\", function() { return stopFocusing; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"startFactionWork\", function() { return startFactionWork; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"startFactionHackWork\", function() { return startFactionHackWork; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"startFactionFieldWork\", function() { return startFactionFieldWork; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"startFactionSecurityWork\", function() { return startFactionSecurityWork; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"workForFaction\", function() { return workForFaction; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"finishFactionWork\", function() { return finishFactionWork; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getWorkMoneyGain\", function() { return getWorkMoneyGain; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getWorkHackExpGain\", function() { return getWorkHackExpGain; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getWorkStrExpGain\", function() { return getWorkStrExpGain; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getWorkDefExpGain\", function() { return getWorkDefExpGain; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getWorkDexExpGain\", function() { return getWorkDexExpGain; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getWorkAgiExpGain\", function() { return getWorkAgiExpGain; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getWorkChaExpGain\", function() { return getWorkChaExpGain; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getWorkRepGain\", function() { return getWorkRepGain; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"startCreateProgramWork\", function() { return startCreateProgramWork; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"createProgramWork\", function() { return createProgramWork; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"finishCreateProgramWork\", function() { return finishCreateProgramWork; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"startClass\", function() { return startClass; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"takeClass\", function() { return takeClass; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"finishClass\", function() { return finishClass; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"startCrime\", function() { return startCrime; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"commitCrime\", function() { return commitCrime; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"finishCrime\", function() { return finishCrime; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"singularityStopWork\", function() { return singularityStopWork; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"takeDamage\", function() { return takeDamage; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"regenerateHp\", function() { return regenerateHp; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"hospitalize\", function() { return hospitalize; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"applyForJob\", function() { return applyForJob; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getNextCompanyPosition\", function() { return getNextCompanyPosition; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"quitJob\", function() { return quitJob; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"applyForSoftwareJob\", function() { return applyForSoftwareJob; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"applyForSoftwareConsultantJob\", function() { return applyForSoftwareConsultantJob; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"applyForItJob\", function() { return applyForItJob; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"applyForSecurityEngineerJob\", function() { return applyForSecurityEngineerJob; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"applyForNetworkEngineerJob\", function() { return applyForNetworkEngineerJob; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"applyForBusinessJob\", function() { return applyForBusinessJob; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"applyForBusinessConsultantJob\", function() { return applyForBusinessConsultantJob; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"applyForSecurityJob\", function() { return applyForSecurityJob; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"applyForAgentJob\", function() { return applyForAgentJob; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"applyForEmployeeJob\", function() { return applyForEmployeeJob; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"applyForPartTimeEmployeeJob\", function() { return applyForPartTimeEmployeeJob; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"applyForWaiterJob\", function() { return applyForWaiterJob; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"applyForPartTimeWaiterJob\", function() { return applyForPartTimeWaiterJob; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isQualified\", function() { return isQualified; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"reapplyAllAugmentations\", function() { return reapplyAllAugmentations; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"reapplyAllSourceFiles\", function() { return reapplyAllSourceFiles; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"checkForFactionInvitations\", function() { return checkForFactionInvitations; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"setBitNodeNumber\", function() { return setBitNodeNumber; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"queueAugmentation\", function() { return queueAugmentation; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"gainCodingContractReward\", function() { return gainCodingContractReward; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"travel\", function() { return travel; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"gotoLocation\", function() { return gotoLocation; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"canAccessResleeving\", function() { return canAccessResleeving; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"giveExploit\", function() { return giveExploit; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getIntelligenceBonus\", function() { return getIntelligenceBonus; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getCasinoWinnings\", function() { return getCasinoWinnings; });\n/* harmony import */ var _Augmentation_Augmentations__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Augmentation/Augmentations */ 20);\n/* harmony import */ var _Augmentation_AugmentationHelpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Augmentation/AugmentationHelpers */ 117);\n/* harmony import */ var _Augmentation_PlayerOwnedAugmentation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Augmentation/PlayerOwnedAugmentation */ 272);\n/* harmony import */ var _Augmentation_data_AugmentationNames__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Augmentation/data/AugmentationNames */ 6);\n/* harmony import */ var _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../BitNode/BitNodeMultipliers */ 8);\n/* harmony import */ var _CodingContracts__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../CodingContracts */ 79);\n/* harmony import */ var _Company_Company__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Company/Company */ 172);\n/* harmony import */ var _Company_Companies__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../Company/Companies */ 46);\n/* harmony import */ var _Company_GetNextCompanyPosition__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../Company/GetNextCompanyPosition */ 474);\n/* harmony import */ var _Company_GetJobRequirementText__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../Company/GetJobRequirementText */ 395);\n/* harmony import */ var _Company_CompanyPositions__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../Company/CompanyPositions */ 63);\n/* harmony import */ var _Company_data_companypositionnames__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../Company/data/companypositionnames */ 24);\n/* harmony import */ var _Constants__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../Constants */ 5);\n/* harmony import */ var _Programs_Programs__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../../Programs/Programs */ 53);\n/* harmony import */ var _Crime_CrimeHelpers__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../../Crime/CrimeHelpers */ 352);\n/* harmony import */ var _Crime_Crimes__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../../Crime/Crimes */ 60);\n/* harmony import */ var _Faction_Faction__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../../Faction/Faction */ 135);\n/* harmony import */ var _Faction_Factions__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../../Faction/Factions */ 22);\n/* harmony import */ var _Gang_AllGangs__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../../Gang/AllGangs */ 59);\n/* harmony import */ var _Hacknet_HacknetHelpers__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../../Hacknet/HacknetHelpers */ 45);\n/* harmony import */ var _Locations_Cities__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../../Locations/Cities */ 104);\n/* harmony import */ var _Locations_Locations__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../../Locations/Locations */ 277);\n/* harmony import */ var _Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../../Locations/data/CityNames */ 21);\n/* harmony import */ var _Locations_data_LocationNames__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ../../Locations/data/LocationNames */ 9);\n/* harmony import */ var _PersonObjects_Sleeve_Sleeve__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ../../PersonObjects/Sleeve/Sleeve */ 245);\n/* harmony import */ var _formulas_skill__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ../formulas/skill */ 198);\n/* harmony import */ var _formulas_intelligence__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ../formulas/intelligence */ 310);\n/* harmony import */ var _formulas_reputation__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ../formulas/reputation */ 188);\n/* harmony import */ var _Server_AllServers__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ../../Server/AllServers */ 29);\n/* harmony import */ var _Server_ServerHelpers__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ../../Server/ServerHelpers */ 36);\n/* harmony import */ var _Settings_Settings__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ../../Settings/Settings */ 34);\n/* harmony import */ var _Server_SpecialServerIps__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ../../Server/SpecialServerIps */ 50);\n/* harmony import */ var _SourceFile_applySourceFile__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ../../SourceFile/applySourceFile */ 713);\n/* harmony import */ var _Exploits_applyExploits__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ../../Exploits/applyExploits */ 714);\n/* harmony import */ var _SourceFile_SourceFiles__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ../../SourceFile/SourceFiles */ 276);\n/* harmony import */ var _SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ../../SourceFile/SourceFileFlags */ 49);\n/* harmony import */ var _StockMarket_PlayerInfluencing__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ../../StockMarket/PlayerInfluencing */ 394);\n/* harmony import */ var _Hospital_Hospital__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! ../../Hospital/Hospital */ 308);\n/* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(/*! decimal.js */ 77);\n/* harmony import */ var _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(/*! ../../ui/numeralFormat */ 3);\n/* harmony import */ var _utils_MoneySourceTracker__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(/*! ../../utils/MoneySourceTracker */ 291);\n/* harmony import */ var _utils_DialogBox__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(/*! ../../../utils/DialogBox */ 10);\n/* harmony import */ var _utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(/*! ../../../utils/StringHelperFunctions */ 12);\n/* harmony import */ var _ui_React_Reputation__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(/*! ../../ui/React/Reputation */ 76);\n/* harmony import */ var _ui_React_Money__WEBPACK_IMPORTED_MODULE_44__ = __webpack_require__(/*! ../../ui/React/Money */ 13);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_45__ = __webpack_require__(/*! react */ 0);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_45___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_45__);\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nfunction init() {\n /* Initialize Player's home computer */\n var t_homeComp = Object(_Server_ServerHelpers__WEBPACK_IMPORTED_MODULE_29__[/* safetlyCreateUniqueServer */ \"h\"])({\n adminRights: true,\n hostname: \"home\",\n ip: Object(_Server_AllServers__WEBPACK_IMPORTED_MODULE_28__[/* createUniqueRandomIp */ \"c\"])(),\n isConnectedTo: true,\n maxRam: 8,\n organizationName: \"Home PC\",\n purchasedByPlayer: true\n });\n this.homeComputer = t_homeComp.ip;\n this.currentServer = t_homeComp.ip;\n Object(_Server_AllServers__WEBPACK_IMPORTED_MODULE_28__[/* AddToAllServers */ \"a\"])(t_homeComp);\n this.getHomeComputer().programs.push(_Programs_Programs__WEBPACK_IMPORTED_MODULE_13__[/* Programs */ \"a\"].NukeProgram.name);\n}\nfunction prestigeAugmentation() {\n var homeComp = this.getHomeComputer();\n this.currentServer = homeComp.ip;\n this.homeComputer = homeComp.ip;\n this.numPeopleKilled = 0;\n this.karma = 0; //Reset stats\n\n this.hacking_skill = 1;\n this.strength = 1;\n this.defense = 1;\n this.dexterity = 1;\n this.agility = 1;\n this.charisma = 1;\n this.hacking_exp = 0;\n this.strength_exp = 0;\n this.defense_exp = 0;\n this.dexterity_exp = 0;\n this.agility_exp = 0;\n this.charisma_exp = 0;\n this.money = new decimal_js__WEBPACK_IMPORTED_MODULE_38__[/* default */ \"a\"](1000);\n this.city = _Locations_data_CityNames__WEBPACK_IMPORTED_MODULE_22__[/* CityName */ \"a\"].Sector12;\n this.location = \"\";\n this.companyName = \"\";\n this.jobs = {};\n this.purchasedServers = [];\n this.factions = [];\n this.factionInvitations = [];\n this.queuedAugmentations = [];\n this.resleeves = [];\n let numSleeves = Math.min(3, _SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_35__[/* SourceFileFlags */ \"a\"][10] + (this.bitNodeN === 10 ? 1 : 0)) + this.sleevesFromCovenant;\n if (this.sleeves.length > numSleeves) this.sleeves.length = numSleeves;\n\n for (let i = this.sleeves.length; i < numSleeves; i++) {\n this.sleeves.push(new _PersonObjects_Sleeve_Sleeve__WEBPACK_IMPORTED_MODULE_24__[/* Sleeve */ \"a\"](this));\n }\n\n for (let i = 0; i < this.sleeves.length; ++i) {\n if (this.sleeves[i] instanceof _PersonObjects_Sleeve_Sleeve__WEBPACK_IMPORTED_MODULE_24__[/* Sleeve */ \"a\"]) {\n if (this.sleeves[i].shock >= 100) {\n this.sleeves[i].synchronize(this);\n } else {\n this.sleeves[i].shockRecovery(this);\n }\n }\n }\n\n this.isWorking = false;\n this.currentWorkFactionName = \"\";\n this.currentWorkFactionDescription = \"\";\n this.createProgramName = \"\";\n this.className = \"\";\n this.crimeType = \"\";\n this.workHackExpGainRate = 0;\n this.workStrExpGainRate = 0;\n this.workDefExpGainRate = 0;\n this.workDexExpGainRate = 0;\n this.workAgiExpGainRate = 0;\n this.workChaExpGainRate = 0;\n this.workRepGainRate = 0;\n this.workMoneyGainRate = 0;\n this.workHackExpGained = 0;\n this.workStrExpGained = 0;\n this.workDefExpGained = 0;\n this.workDexExpGained = 0;\n this.workAgiExpGained = 0;\n this.workChaExpGained = 0;\n this.workRepGained = 0;\n this.workMoneyGained = 0;\n this.timeWorked = 0;\n this.lastUpdate = new Date().getTime(); // Statistics Trackers\n\n this.playtimeSinceLastAug = 0;\n this.scriptProdSinceLastAug = 0;\n this.moneySourceA.reset();\n this.hacknetNodes.length = 0;\n this.hashManager.prestige(); // Reapply augs, re-calculate skills and reset HP\n\n this.reapplyAllAugmentations(true);\n this.hp = this.max_hp;\n}\nfunction prestigeSourceFile() {\n this.prestigeAugmentation(); // Duplicate sleeves are reset to level 1 every Bit Node (but the number of sleeves you have persists)\n\n for (let i = 0; i < this.sleeves.length; ++i) {\n if (this.sleeves[i] instanceof _PersonObjects_Sleeve_Sleeve__WEBPACK_IMPORTED_MODULE_24__[/* Sleeve */ \"a\"]) {\n this.sleeves[i].prestige(this);\n } else {\n this.sleeves[i] = new _PersonObjects_Sleeve_Sleeve__WEBPACK_IMPORTED_MODULE_24__[/* Sleeve */ \"a\"](this);\n }\n }\n\n if (this.bitNodeN === 10) {\n for (let i = 0; i < this.sleeves.length; i++) {\n this.sleeves[i].shock = Math.max(25, this.sleeves[i].shock);\n this.sleeves[i].sync = Math.max(25, this.sleeves[i].sync);\n }\n }\n\n this.timeWorked = 0; // Gang\n\n this.gang = null;\n Object(_Gang_AllGangs__WEBPACK_IMPORTED_MODULE_18__[/* resetGangs */ \"c\"])(); // Reset Stock market\n\n this.hasWseAccount = false;\n this.hasTixApiAccess = false;\n this.has4SData = false;\n this.has4SDataTixApi = false; // BitNode 3: Corporatocracy\n\n this.corporation = 0;\n this.moneySourceB.reset();\n this.playtimeSinceLastBitnode = 0;\n this.augmentations = [];\n}\nfunction receiveInvite(factionName) {\n if (this.factionInvitations.includes(factionName) || this.factions.includes(factionName)) {\n return;\n }\n\n this.firstFacInvRecvd = true;\n this.factionInvitations.push(factionName);\n} //Calculates skill level based on experience. The same formula will be used for every skill\n\nfunction calculateSkill(exp, mult = 1) {\n return Object(_formulas_skill__WEBPACK_IMPORTED_MODULE_25__[/* calculateSkill */ \"b\"])(exp, mult);\n}\nfunction updateSkillLevels() {\n this.hacking_skill = Math.max(1, Math.floor(this.calculateSkill(this.hacking_exp, this.hacking_mult * _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_4__[/* BitNodeMultipliers */ \"a\"].HackingLevelMultiplier)));\n this.strength = Math.max(1, Math.floor(this.calculateSkill(this.strength_exp, this.strength_mult * _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_4__[/* BitNodeMultipliers */ \"a\"].StrengthLevelMultiplier)));\n this.defense = Math.max(1, Math.floor(this.calculateSkill(this.defense_exp, this.defense_mult * _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_4__[/* BitNodeMultipliers */ \"a\"].DefenseLevelMultiplier)));\n this.dexterity = Math.max(1, Math.floor(this.calculateSkill(this.dexterity_exp, this.dexterity_mult * _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_4__[/* BitNodeMultipliers */ \"a\"].DexterityLevelMultiplier)));\n this.agility = Math.max(1, Math.floor(this.calculateSkill(this.agility_exp, this.agility_mult * _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_4__[/* BitNodeMultipliers */ \"a\"].AgilityLevelMultiplier)));\n this.charisma = Math.max(1, Math.floor(this.calculateSkill(this.charisma_exp, this.charisma_mult * _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_4__[/* BitNodeMultipliers */ \"a\"].CharismaLevelMultiplier)));\n\n if (this.intelligence > 0) {\n this.intelligence = Math.floor(this.calculateSkill(this.intelligence_exp));\n } else {\n this.intelligence = 0;\n }\n\n var ratio = this.hp / this.max_hp;\n this.max_hp = Math.floor(10 + this.defense / 10);\n this.hp = Math.round(this.max_hp * ratio);\n}\nfunction resetMultipliers() {\n this.hacking_chance_mult = 1;\n this.hacking_speed_mult = 1;\n this.hacking_money_mult = 1;\n this.hacking_grow_mult = 1;\n this.hacking_mult = 1;\n this.strength_mult = 1;\n this.defense_mult = 1;\n this.dexterity_mult = 1;\n this.agility_mult = 1;\n this.charisma_mult = 1;\n this.hacking_exp_mult = 1;\n this.strength_exp_mult = 1;\n this.defense_exp_mult = 1;\n this.dexterity_exp_mult = 1;\n this.agility_exp_mult = 1;\n this.charisma_exp_mult = 1;\n this.company_rep_mult = 1;\n this.faction_rep_mult = 1;\n this.crime_money_mult = 1;\n this.crime_success_mult = 1;\n this.hacknet_node_money_mult = 1;\n this.hacknet_node_purchase_cost_mult = 1;\n this.hacknet_node_ram_cost_mult = 1;\n this.hacknet_node_core_cost_mult = 1;\n this.hacknet_node_level_cost_mult = 1;\n this.work_money_mult = 1;\n this.bladeburner_max_stamina_mult = 1;\n this.bladeburner_stamina_gain_mult = 1;\n this.bladeburner_analysis_mult = 1;\n this.bladeburner_success_chance_mult = 1;\n}\nfunction hasProgram(programName) {\n const home = this.getHomeComputer();\n\n if (home == null) {\n return false;\n }\n\n for (var i = 0; i < home.programs.length; ++i) {\n if (programName.toLowerCase() == home.programs[i].toLowerCase()) {\n return true;\n }\n }\n\n return false;\n}\nfunction setMoney(money) {\n if (isNaN(money)) {\n console.error(\"NaN passed into Player.setMoney()\");\n return;\n }\n\n this.money = new decimal_js__WEBPACK_IMPORTED_MODULE_38__[/* default */ \"a\"](money);\n}\nfunction gainMoney(money) {\n if (isNaN(money)) {\n console.error(\"NaN passed into Player.gainMoney()\");\n return;\n }\n\n this.money = this.money.plus(money);\n}\nfunction loseMoney(money) {\n if (isNaN(money)) {\n console.error(\"NaN passed into Player.loseMoney()\");\n return;\n }\n\n if (this.money.eq(Infinity) && money === Infinity) return;\n this.money = this.money.minus(money);\n}\nfunction canAfford(cost) {\n if (isNaN(cost)) {\n console.error(`NaN passed into Player.canAfford()`);\n return false;\n }\n\n return this.money.gte(cost);\n}\nfunction recordMoneySource(amt, source) {\n if (!(this.moneySourceA instanceof _utils_MoneySourceTracker__WEBPACK_IMPORTED_MODULE_40__[/* MoneySourceTracker */ \"a\"])) {\n console.warn(`Player.moneySourceA was not properly initialized. Resetting`);\n this.moneySourceA = new _utils_MoneySourceTracker__WEBPACK_IMPORTED_MODULE_40__[/* MoneySourceTracker */ \"a\"]();\n }\n\n if (!(this.moneySourceB instanceof _utils_MoneySourceTracker__WEBPACK_IMPORTED_MODULE_40__[/* MoneySourceTracker */ \"a\"])) {\n console.warn(`Player.moneySourceB was not properly initialized. Resetting`);\n this.moneySourceB = new _utils_MoneySourceTracker__WEBPACK_IMPORTED_MODULE_40__[/* MoneySourceTracker */ \"a\"]();\n }\n\n this.moneySourceA.record(amt, source);\n this.moneySourceB.record(amt, source);\n}\nfunction gainHackingExp(exp) {\n if (isNaN(exp)) {\n console.error(\"ERR: NaN passed into Player.gainHackingExp()\");\n return;\n }\n\n this.hacking_exp += exp;\n\n if (this.hacking_exp < 0) {\n this.hacking_exp = 0;\n }\n\n this.hacking_skill = Object(_formulas_skill__WEBPACK_IMPORTED_MODULE_25__[/* calculateSkill */ \"b\"])(this.hacking_exp, this.hacking_mult * _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_4__[/* BitNodeMultipliers */ \"a\"].HackingLevelMultiplier);\n}\nfunction gainStrengthExp(exp) {\n if (isNaN(exp)) {\n console.error(\"ERR: NaN passed into Player.gainStrengthExp()\");\n return;\n }\n\n this.strength_exp += exp;\n\n if (this.strength_exp < 0) {\n this.strength_exp = 0;\n }\n\n this.strength = Object(_formulas_skill__WEBPACK_IMPORTED_MODULE_25__[/* calculateSkill */ \"b\"])(this.strength_exp, this.strength_mult * _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_4__[/* BitNodeMultipliers */ \"a\"].StrengthLevelMultiplier);\n}\nfunction gainDefenseExp(exp) {\n if (isNaN(exp)) {\n console.error(\"ERR: NaN passed into player.gainDefenseExp()\");\n return;\n }\n\n this.defense_exp += exp;\n\n if (this.defense_exp < 0) {\n this.defense_exp = 0;\n }\n\n this.defense = Object(_formulas_skill__WEBPACK_IMPORTED_MODULE_25__[/* calculateSkill */ \"b\"])(this.defense_exp, this.defense_mult * _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_4__[/* BitNodeMultipliers */ \"a\"].DefenseLevelMultiplier);\n}\nfunction gainDexterityExp(exp) {\n if (isNaN(exp)) {\n console.error(\"ERR: NaN passed into Player.gainDexterityExp()\");\n return;\n }\n\n this.dexterity_exp += exp;\n\n if (this.dexterity_exp < 0) {\n this.dexterity_exp = 0;\n }\n\n this.dexterity = Object(_formulas_skill__WEBPACK_IMPORTED_MODULE_25__[/* calculateSkill */ \"b\"])(this.dexterity_exp, this.dexterity_mult * _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_4__[/* BitNodeMultipliers */ \"a\"].DexterityLevelMultiplier);\n}\nfunction gainAgilityExp(exp) {\n if (isNaN(exp)) {\n console.error(\"ERR: NaN passed into Player.gainAgilityExp()\");\n return;\n }\n\n this.agility_exp += exp;\n\n if (this.agility_exp < 0) {\n this.agility_exp = 0;\n }\n\n this.agility = Object(_formulas_skill__WEBPACK_IMPORTED_MODULE_25__[/* calculateSkill */ \"b\"])(this.agility_exp, this.agility_mult * _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_4__[/* BitNodeMultipliers */ \"a\"].AgilityLevelMultiplier);\n}\nfunction gainCharismaExp(exp) {\n if (isNaN(exp)) {\n console.error(\"ERR: NaN passed into Player.gainCharismaExp()\");\n return;\n }\n\n this.charisma_exp += exp;\n\n if (this.charisma_exp < 0) {\n this.charisma_exp = 0;\n }\n\n this.charisma = Object(_formulas_skill__WEBPACK_IMPORTED_MODULE_25__[/* calculateSkill */ \"b\"])(this.charisma_exp, this.charisma_mult * _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_4__[/* BitNodeMultipliers */ \"a\"].CharismaLevelMultiplier);\n}\nfunction gainIntelligenceExp(exp) {\n if (isNaN(exp)) {\n console.error(\"ERROR: NaN passed into Player.gainIntelligenceExp()\");\n return;\n }\n\n if (_SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_35__[/* SourceFileFlags */ \"a\"][5] > 0 || this.intelligence > 0) {\n this.intelligence_exp += exp;\n }\n} //Given a string expression like \"str\" or \"strength\", returns the given stat\n\nfunction queryStatFromString(str) {\n const tempStr = str.toLowerCase();\n\n if (tempStr.includes(\"hack\")) {\n return this.hacking_skill;\n }\n\n if (tempStr.includes(\"str\")) {\n return this.strength;\n }\n\n if (tempStr.includes(\"def\")) {\n return this.defense;\n }\n\n if (tempStr.includes(\"dex\")) {\n return this.dexterity;\n }\n\n if (tempStr.includes(\"agi\")) {\n return this.agility;\n }\n\n if (tempStr.includes(\"cha\")) {\n return this.charisma;\n }\n\n if (tempStr.includes(\"int\")) {\n return this.intelligence;\n }\n}\n/******* Working functions *******/\n\nfunction resetWorkStatus(generalType, group, workType) {\n if (generalType === this.workType && group === this.companyName) return;\n if (generalType === this.workType && group === this.currentWorkFactionName && workType === this.factionWorkType) return;\n if (this.isWorking) this.singularityStopWork();\n this.workHackExpGainRate = 0;\n this.workStrExpGainRate = 0;\n this.workDefExpGainRate = 0;\n this.workDexExpGainRate = 0;\n this.workAgiExpGainRate = 0;\n this.workChaExpGainRate = 0;\n this.workRepGainRate = 0;\n this.workMoneyGainRate = 0;\n this.workMoneyLossRate = 0;\n this.workHackExpGained = 0;\n this.workStrExpGained = 0;\n this.workDefExpGained = 0;\n this.workDexExpGained = 0;\n this.workAgiExpGained = 0;\n this.workChaExpGained = 0;\n this.workRepGained = 0;\n this.workMoneyGained = 0;\n this.timeWorked = 0;\n this.timeWorkedCreateProgram = 0;\n this.currentWorkFactionName = \"\";\n this.currentWorkFactionDescription = \"\";\n this.createProgramName = \"\";\n this.className = \"\";\n}\nfunction processWorkEarnings(numCycles = 1) {\n const focusBonus = this.focus ? 1 : 0.8;\n const hackExpGain = focusBonus * this.workHackExpGainRate * numCycles;\n const strExpGain = focusBonus * this.workStrExpGainRate * numCycles;\n const defExpGain = focusBonus * this.workDefExpGainRate * numCycles;\n const dexExpGain = focusBonus * this.workDexExpGainRate * numCycles;\n const agiExpGain = focusBonus * this.workAgiExpGainRate * numCycles;\n const chaExpGain = focusBonus * this.workChaExpGainRate * numCycles;\n const moneyGain = (this.workMoneyGainRate - this.workMoneyLossRate) * numCycles;\n this.gainHackingExp(hackExpGain);\n this.gainStrengthExp(strExpGain);\n this.gainDefenseExp(defExpGain);\n this.gainDexterityExp(dexExpGain);\n this.gainAgilityExp(agiExpGain);\n this.gainCharismaExp(chaExpGain);\n this.gainMoney(moneyGain);\n\n if (this.className) {\n this.recordMoneySource(moneyGain, \"class\");\n } else {\n this.recordMoneySource(moneyGain, \"work\");\n }\n\n this.workHackExpGained += hackExpGain;\n this.workStrExpGained += strExpGain;\n this.workDefExpGained += defExpGain;\n this.workDexExpGained += dexExpGain;\n this.workAgiExpGained += agiExpGain;\n this.workChaExpGained += chaExpGain;\n this.workRepGained += focusBonus * this.workRepGainRate * numCycles;\n this.workMoneyGained += focusBonus * this.workMoneyGainRate * numCycles;\n this.workMoneyGained -= focusBonus * this.workMoneyLossRate * numCycles;\n}\n/* Working for Company */\n\nfunction startWork(companyName) {\n this.resetWorkStatus(_Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"].WorkTypeCompany, companyName);\n this.isWorking = true;\n this.focus = true;\n this.companyName = companyName;\n this.workType = _Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"].WorkTypeCompany;\n this.workHackExpGainRate = this.getWorkHackExpGain();\n this.workStrExpGainRate = this.getWorkStrExpGain();\n this.workDefExpGainRate = this.getWorkDefExpGain();\n this.workDexExpGainRate = this.getWorkDexExpGain();\n this.workAgiExpGainRate = this.getWorkAgiExpGain();\n this.workChaExpGainRate = this.getWorkChaExpGain();\n this.workRepGainRate = this.getWorkRepGain();\n this.workMoneyGainRate = this.getWorkMoneyGain();\n this.timeNeededToCompleteWork = _Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"].MillisecondsPer8Hours;\n}\nfunction cancelationPenalty() {\n const specialIp = _Server_SpecialServerIps__WEBPACK_IMPORTED_MODULE_31__[/* SpecialServerIps */ \"a\"][this.companyName];\n\n if (specialIp) {\n const server = _Server_AllServers__WEBPACK_IMPORTED_MODULE_28__[/* AllServers */ \"b\"][specialIp];\n if (server && server.backdoorInstalled) return 0.75;\n }\n\n return 0.5;\n}\nfunction work(numCycles) {\n // Cap the number of cycles being processed to whatever would put you at\n // the work time limit (8 hours)\n var overMax = false;\n\n if (this.timeWorked + _Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"]._idleSpeed * numCycles >= _Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"].MillisecondsPer8Hours) {\n overMax = true;\n numCycles = Math.round((_Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"].MillisecondsPer8Hours - this.timeWorked) / _Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"]._idleSpeed);\n }\n\n this.timeWorked += _Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"]._idleSpeed * numCycles;\n this.workRepGainRate = this.getWorkRepGain();\n this.processWorkEarnings(numCycles); // If timeWorked == 8 hours, then finish. You can only gain 8 hours worth of exp and money\n\n if (overMax || this.timeWorked >= _Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"].MillisecondsPer8Hours) {\n return this.finishWork(false);\n }\n\n const comp = _Company_Companies__WEBPACK_IMPORTED_MODULE_7__[/* Companies */ \"a\"][this.companyName];\n Object(_StockMarket_PlayerInfluencing__WEBPACK_IMPORTED_MODULE_36__[/* influenceStockThroughCompanyWork */ \"a\"])(comp, this.workRepGainRate, numCycles);\n}\nfunction finishWork(cancelled, sing = false) {\n //Since the work was cancelled early, player only gains half of what they've earned so far\n if (cancelled) {\n this.workRepGained *= this.cancelationPenalty();\n }\n\n const company = _Company_Companies__WEBPACK_IMPORTED_MODULE_7__[/* Companies */ \"a\"][this.companyName];\n company.playerReputation += this.workRepGained;\n this.updateSkillLevels();\n let content = react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_45___default.a.Fragment, null, \"You earned a total of: \", react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(\"br\", null), react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(_ui_React_Money__WEBPACK_IMPORTED_MODULE_44__[/* Money */ \"a\"], {\n money: this.workMoneyGained\n }), react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(\"br\", null), Object(_ui_React_Reputation__WEBPACK_IMPORTED_MODULE_43__[/* Reputation */ \"a\"])(this.workRepGained), \" reputation for the company \", react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(\"br\", null), _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__[/* numeralWrapper */ \"a\"].formatExp(this.workHackExpGained), \" hacking exp \", react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(\"br\", null), _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__[/* numeralWrapper */ \"a\"].formatExp(this.workStrExpGained), \" strength exp \", react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(\"br\", null), _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__[/* numeralWrapper */ \"a\"].formatExp(this.workDefExpGained), \" defense exp \", react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(\"br\", null), _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__[/* numeralWrapper */ \"a\"].formatExp(this.workDexExpGained), \" dexterity exp \", react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(\"br\", null), _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__[/* numeralWrapper */ \"a\"].formatExp(this.workAgiExpGained), \" agility exp \", react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(\"br\", null), _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__[/* numeralWrapper */ \"a\"].formatExp(this.workChaExpGained), \" charisma exp\", react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(\"br\", null));\n\n if (cancelled) {\n content = react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_45___default.a.Fragment, null, \"You worked a short shift of \", Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_42__[/* convertTimeMsToTimeElapsedString */ \"b\"])(this.timeWorked), \" \", react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(\"br\", null), react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(\"br\", null), \"Since you cancelled your work early, you only gained half of the reputation you earned. \", react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(\"br\", null), react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(\"br\", null), content);\n } else {\n content = react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_45___default.a.Fragment, null, \"You worked a full shift of 8 hours! \", react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(\"br\", null), react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(\"br\", null), content);\n }\n\n if (!sing) {\n Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_41__[/* dialogBoxCreate */ \"a\"])(content);\n }\n\n this.isWorking = false;\n\n if (sing) {\n var res = \"You worked a short shift of \" + Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_42__[/* convertTimeMsToTimeElapsedString */ \"b\"])(this.timeWorked) + \" and \" + \"earned $\" + _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__[/* numeralWrapper */ \"a\"].formatMoney(this.workMoneyGained) + \", \" + _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__[/* numeralWrapper */ \"a\"].formatReputation(this.workRepGained) + \" reputation, \" + _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__[/* numeralWrapper */ \"a\"].formatExp(this.workHackExpGained) + \" hacking exp, \" + _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__[/* numeralWrapper */ \"a\"].formatExp(this.workStrExpGained) + \" strength exp, \" + _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__[/* numeralWrapper */ \"a\"].formatExp(this.workDefExpGained) + \" defense exp, \" + _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__[/* numeralWrapper */ \"a\"].formatExp(this.workDexExpGained) + \" dexterity exp, \" + _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__[/* numeralWrapper */ \"a\"].formatExp(this.workAgiExpGained) + \" agility exp, and \" + _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__[/* numeralWrapper */ \"a\"].formatExp(this.workChaExpGained) + \" charisma exp.\";\n this.resetWorkStatus();\n return res;\n }\n\n this.resetWorkStatus();\n}\nfunction startWorkPartTime(companyName) {\n this.resetWorkStatus(_Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"].WorkTypeCompanyPartTime, companyName);\n this.isWorking = true;\n this.focus = true;\n this.companyName = companyName;\n this.workType = _Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"].WorkTypeCompanyPartTime;\n this.workHackExpGainRate = this.getWorkHackExpGain();\n this.workStrExpGainRate = this.getWorkStrExpGain();\n this.workDefExpGainRate = this.getWorkDefExpGain();\n this.workDexExpGainRate = this.getWorkDexExpGain();\n this.workAgiExpGainRate = this.getWorkAgiExpGain();\n this.workChaExpGainRate = this.getWorkChaExpGain();\n this.workRepGainRate = this.getWorkRepGain();\n this.workMoneyGainRate = this.getWorkMoneyGain();\n this.timeNeededToCompleteWork = _Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"].MillisecondsPer8Hours;\n}\nfunction workPartTime(numCycles) {\n //Cap the number of cycles being processed to whatever would put you at the\n //work time limit (8 hours)\n var overMax = false;\n\n if (this.timeWorked + _Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"]._idleSpeed * numCycles >= _Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"].MillisecondsPer8Hours) {\n overMax = true;\n numCycles = Math.round((_Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"].MillisecondsPer8Hours - this.timeWorked) / _Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"]._idleSpeed);\n }\n\n this.timeWorked += _Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"]._idleSpeed * numCycles;\n this.workRepGainRate = this.getWorkRepGain();\n this.processWorkEarnings(numCycles); //If timeWorked == 8 hours, then finish. You can only gain 8 hours worth of exp and money\n\n if (overMax || this.timeWorked >= _Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"].MillisecondsPer8Hours) {\n return this.finishWorkPartTime();\n }\n}\nfunction finishWorkPartTime(sing = false) {\n var company = _Company_Companies__WEBPACK_IMPORTED_MODULE_7__[/* Companies */ \"a\"][this.companyName];\n company.playerReputation += this.workRepGained;\n this.updateSkillLevels();\n const content = react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_45___default.a.Fragment, null, \"You worked for \", Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_42__[/* convertTimeMsToTimeElapsedString */ \"b\"])(this.timeWorked), react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(\"br\", null), react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(\"br\", null), \"You earned a total of: \", react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(\"br\", null), react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(_ui_React_Money__WEBPACK_IMPORTED_MODULE_44__[/* Money */ \"a\"], {\n money: this.workMoneyGained\n }), react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(\"br\", null), Object(_ui_React_Reputation__WEBPACK_IMPORTED_MODULE_43__[/* Reputation */ \"a\"])(this.workRepGained), \" reputation for the company \", react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(\"br\", null), _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__[/* numeralWrapper */ \"a\"].formatExp(this.workHackExpGained), \" hacking exp \", react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(\"br\", null), _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__[/* numeralWrapper */ \"a\"].formatExp(this.workStrExpGained), \" strength exp \", react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(\"br\", null), _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__[/* numeralWrapper */ \"a\"].formatExp(this.workDefExpGained), \" defense exp \", react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(\"br\", null), _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__[/* numeralWrapper */ \"a\"].formatExp(this.workDexExpGained), \" dexterity exp \", react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(\"br\", null), _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__[/* numeralWrapper */ \"a\"].formatExp(this.workAgiExpGained), \" agility exp \", react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(\"br\", null), _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__[/* numeralWrapper */ \"a\"].formatExp(this.workChaExpGained), \" charisma exp\", react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(\"br\", null));\n\n if (!sing) {\n Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_41__[/* dialogBoxCreate */ \"a\"])(content);\n }\n\n this.isWorking = false;\n\n if (sing) {\n var res = \"You worked for \" + Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_42__[/* convertTimeMsToTimeElapsedString */ \"b\"])(this.timeWorked) + \" and \" + \"earned a total of \" + \"$\" + _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__[/* numeralWrapper */ \"a\"].formatMoney(this.workMoneyGained) + \", \" + _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__[/* numeralWrapper */ \"a\"].formatReputation(this.workRepGained) + \" reputation, \" + _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__[/* numeralWrapper */ \"a\"].formatExp(this.workHackExpGained) + \" hacking exp, \" + _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__[/* numeralWrapper */ \"a\"].formatExp(this.workStrExpGained) + \" strength exp, \" + _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__[/* numeralWrapper */ \"a\"].formatExp(this.workDefExpGained) + \" defense exp, \" + _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__[/* numeralWrapper */ \"a\"].formatExp(this.workDexExpGained) + \" dexterity exp, \" + _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__[/* numeralWrapper */ \"a\"].formatExp(this.workAgiExpGained) + \" agility exp, and \" + _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__[/* numeralWrapper */ \"a\"].formatExp(this.workChaExpGained) + \" charisma exp\";\n this.resetWorkStatus();\n return res;\n }\n\n this.resetWorkStatus();\n}\nfunction startFocusing() {\n this.focus = true;\n}\nfunction stopFocusing() {\n this.focus = false;\n}\n/* Working for Faction */\n\nfunction startFactionWork(faction) {\n //Update reputation gain rate to account for faction favor\n var favorMult = 1 + faction.favor / 100;\n\n if (isNaN(favorMult)) {\n favorMult = 1;\n }\n\n this.workRepGainRate *= favorMult;\n this.workRepGainRate *= _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_4__[/* BitNodeMultipliers */ \"a\"].FactionWorkRepGain;\n this.isWorking = true;\n this.focus = true;\n this.workType = _Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"].WorkTypeFaction;\n this.currentWorkFactionName = faction.name;\n this.timeNeededToCompleteWork = _Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"].MillisecondsPer20Hours;\n}\nfunction startFactionHackWork(faction) {\n this.resetWorkStatus(_Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"].WorkTypeFaction, faction.name, _Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"].FactionWorkHacking);\n this.workHackExpGainRate = 0.15 * this.hacking_exp_mult * _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_4__[/* BitNodeMultipliers */ \"a\"].FactionWorkExpGain;\n this.workRepGainRate = (this.hacking_skill + this.intelligence) / _Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"].MaxSkillLevel * this.faction_rep_mult * this.getIntelligenceBonus(0.5);\n this.factionWorkType = _Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"].FactionWorkHacking;\n this.currentWorkFactionDescription = \"carrying out hacking contracts\";\n this.startFactionWork(faction);\n}\nfunction startFactionFieldWork(faction) {\n this.resetWorkStatus(_Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"].WorkTypeFaction, faction.name, _Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"].FactionWorkField);\n this.workHackExpGainRate = 0.1 * this.hacking_exp_mult * _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_4__[/* BitNodeMultipliers */ \"a\"].FactionWorkExpGain;\n this.workStrExpGainRate = 0.1 * this.strength_exp_mult * _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_4__[/* BitNodeMultipliers */ \"a\"].FactionWorkExpGain;\n this.workDefExpGainRate = 0.1 * this.defense_exp_mult * _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_4__[/* BitNodeMultipliers */ \"a\"].FactionWorkExpGain;\n this.workDexExpGainRate = 0.1 * this.dexterity_exp_mult * _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_4__[/* BitNodeMultipliers */ \"a\"].FactionWorkExpGain;\n this.workAgiExpGainRate = 0.1 * this.agility_exp_mult * _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_4__[/* BitNodeMultipliers */ \"a\"].FactionWorkExpGain;\n this.workChaExpGainRate = 0.1 * this.charisma_exp_mult * _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_4__[/* BitNodeMultipliers */ \"a\"].FactionWorkExpGain;\n this.workRepGainRate = Object(_formulas_reputation__WEBPACK_IMPORTED_MODULE_27__[/* getFactionFieldWorkRepGain */ \"a\"])(this, faction);\n this.factionWorkType = _Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"].FactionWorkField;\n this.currentWorkFactionDescription = \"carrying out field missions\";\n this.startFactionWork(faction);\n}\nfunction startFactionSecurityWork(faction) {\n this.resetWorkStatus(_Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"].WorkTypeFaction, faction.name, _Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"].FactionWorkSecurity);\n this.workHackExpGainRate = 0.05 * this.hacking_exp_mult * _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_4__[/* BitNodeMultipliers */ \"a\"].FactionWorkExpGain;\n this.workStrExpGainRate = 0.15 * this.strength_exp_mult * _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_4__[/* BitNodeMultipliers */ \"a\"].FactionWorkExpGain;\n this.workDefExpGainRate = 0.15 * this.defense_exp_mult * _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_4__[/* BitNodeMultipliers */ \"a\"].FactionWorkExpGain;\n this.workDexExpGainRate = 0.15 * this.dexterity_exp_mult * _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_4__[/* BitNodeMultipliers */ \"a\"].FactionWorkExpGain;\n this.workAgiExpGainRate = 0.15 * this.agility_exp_mult * _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_4__[/* BitNodeMultipliers */ \"a\"].FactionWorkExpGain;\n this.workChaExpGainRate = 0.0 * this.charisma_exp_mult * _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_4__[/* BitNodeMultipliers */ \"a\"].FactionWorkExpGain;\n this.workRepGainRate = Object(_formulas_reputation__WEBPACK_IMPORTED_MODULE_27__[/* getFactionSecurityWorkRepGain */ \"b\"])(this, faction);\n this.factionWorkType = _Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"].FactionWorkSecurity;\n this.currentWorkFactionDescription = \"performing security detail\";\n this.startFactionWork(faction);\n}\nfunction workForFaction(numCycles) {\n const faction = _Faction_Factions__WEBPACK_IMPORTED_MODULE_17__[/* Factions */ \"a\"][this.currentWorkFactionName]; //Constantly update the rep gain rate\n\n switch (this.factionWorkType) {\n case _Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"].FactionWorkHacking:\n this.workRepGainRate = Object(_formulas_reputation__WEBPACK_IMPORTED_MODULE_27__[/* getHackingWorkRepGain */ \"c\"])(this, faction);\n break;\n\n case _Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"].FactionWorkField:\n this.workRepGainRate = Object(_formulas_reputation__WEBPACK_IMPORTED_MODULE_27__[/* getFactionFieldWorkRepGain */ \"a\"])(this, faction);\n break;\n\n case _Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"].FactionWorkSecurity:\n this.workRepGainRate = Object(_formulas_reputation__WEBPACK_IMPORTED_MODULE_27__[/* getFactionSecurityWorkRepGain */ \"b\"])(this, faction);\n break;\n\n default:\n break;\n } //Cap the number of cycles being processed to whatever would put you at limit (20 hours)\n\n\n var overMax = false;\n\n if (this.timeWorked + _Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"]._idleSpeed * numCycles >= _Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"].MillisecondsPer20Hours) {\n overMax = true;\n numCycles = Math.round((_Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"].MillisecondsPer20Hours - this.timeWorked) / _Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"]._idleSpeed);\n }\n\n this.timeWorked += _Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"]._idleSpeed * numCycles;\n this.processWorkEarnings(numCycles); //If timeWorked == 20 hours, then finish. You can only work for the faction for 20 hours\n\n if (overMax || this.timeWorked >= _Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"].MillisecondsPer20Hours) {\n return this.finishFactionWork(false);\n }\n}\nfunction finishFactionWork(cancelled, sing = false) {\n var faction = _Faction_Factions__WEBPACK_IMPORTED_MODULE_17__[/* Factions */ \"a\"][this.currentWorkFactionName];\n faction.playerReputation += this.workRepGained;\n this.updateSkillLevels();\n\n if (!sing) {\n Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_41__[/* dialogBoxCreate */ \"a\"])(react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_45___default.a.Fragment, null, \"You worked for your faction \", faction.name, \" for a total of \", Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_42__[/* convertTimeMsToTimeElapsedString */ \"b\"])(this.timeWorked), \" \", react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(\"br\", null), react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(\"br\", null), \"You earned a total of: \", react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(\"br\", null), react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(_ui_React_Money__WEBPACK_IMPORTED_MODULE_44__[/* Money */ \"a\"], {\n money: this.workMoneyGained\n }), react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(\"br\", null), Object(_ui_React_Reputation__WEBPACK_IMPORTED_MODULE_43__[/* Reputation */ \"a\"])(this.workRepGained), \" reputation for the faction \", react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(\"br\", null), _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__[/* numeralWrapper */ \"a\"].formatExp(this.workHackExpGained), \" hacking exp \", react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(\"br\", null), _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__[/* numeralWrapper */ \"a\"].formatExp(this.workStrExpGained), \" strength exp \", react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(\"br\", null), _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__[/* numeralWrapper */ \"a\"].formatExp(this.workDefExpGained), \" defense exp \", react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(\"br\", null), _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__[/* numeralWrapper */ \"a\"].formatExp(this.workDexExpGained), \" dexterity exp \", react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(\"br\", null), _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__[/* numeralWrapper */ \"a\"].formatExp(this.workAgiExpGained), \" agility exp \", react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(\"br\", null), _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__[/* numeralWrapper */ \"a\"].formatExp(this.workChaExpGained), \" charisma exp\", react__WEBPACK_IMPORTED_MODULE_45___default.a.createElement(\"br\", null)));\n }\n\n this.isWorking = false;\n\n if (sing) {\n var res = \"You worked for your faction \" + faction.name + \" for a total of \" + Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_42__[/* convertTimeMsToTimeElapsedString */ \"b\"])(this.timeWorked) + \". \" + \"You earned \" + _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__[/* numeralWrapper */ \"a\"].formatReputation(this.workRepGained) + \" rep, \" + _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__[/* numeralWrapper */ \"a\"].formatExp(this.workHackExpGained) + \" hacking exp, \" + _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__[/* numeralWrapper */ \"a\"].formatExp(this.workStrExpGained) + \" str exp, \" + _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__[/* numeralWrapper */ \"a\"].formatExp(this.workDefExpGained) + \" def exp, \" + _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__[/* numeralWrapper */ \"a\"].formatExp(this.workDexExpGained) + \" dex exp, \" + _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__[/* numeralWrapper */ \"a\"].formatExp(this.workAgiExpGained) + \" agi exp, and \" + _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_39__[/* numeralWrapper */ \"a\"].formatExp(this.workChaExpGained) + \" cha exp.\";\n this.resetWorkStatus();\n return res;\n }\n\n this.resetWorkStatus();\n} //Money gained per game cycle\n\nfunction getWorkMoneyGain() {\n // If player has SF-11, calculate salary multiplier from favor\n let bn11Mult = 1;\n const company = _Company_Companies__WEBPACK_IMPORTED_MODULE_7__[/* Companies */ \"a\"][this.companyName];\n\n if (_SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_35__[/* SourceFileFlags */ \"a\"][11] > 0) {\n bn11Mult = 1 + company.favor / 100;\n } // Get base salary\n\n\n const companyPositionName = this.jobs[this.companyName];\n const companyPosition = _Company_CompanyPositions__WEBPACK_IMPORTED_MODULE_10__[/* CompanyPositions */ \"a\"][companyPositionName];\n\n if (companyPosition == null) {\n console.error(`Could not find CompanyPosition object for ${companyPositionName}. Work salary will be 0`);\n return 0;\n }\n\n return companyPosition.baseSalary * company.salaryMultiplier * this.work_money_mult * _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_4__[/* BitNodeMultipliers */ \"a\"].CompanyWorkMoney * bn11Mult;\n} //Hack exp gained per game cycle\n\nfunction getWorkHackExpGain() {\n const company = _Company_Companies__WEBPACK_IMPORTED_MODULE_7__[/* Companies */ \"a\"][this.companyName];\n const companyPositionName = this.jobs[this.companyName];\n const companyPosition = _Company_CompanyPositions__WEBPACK_IMPORTED_MODULE_10__[/* CompanyPositions */ \"a\"][companyPositionName];\n\n if (company == null || companyPosition == null) {\n console.error([`Could not find Company object for ${this.companyName}`, `or CompanyPosition object for ${companyPositionName}.`, `Work hack exp gain will be 0`].join(\" \"));\n return 0;\n }\n\n return companyPosition.hackingExpGain * company.expMultiplier * this.hacking_exp_mult * _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_4__[/* BitNodeMultipliers */ \"a\"].CompanyWorkExpGain;\n} //Str exp gained per game cycle\n\nfunction getWorkStrExpGain() {\n const company = _Company_Companies__WEBPACK_IMPORTED_MODULE_7__[/* Companies */ \"a\"][this.companyName];\n const companyPositionName = this.jobs[this.companyName];\n const companyPosition = _Company_CompanyPositions__WEBPACK_IMPORTED_MODULE_10__[/* CompanyPositions */ \"a\"][companyPositionName];\n\n if (company == null || companyPosition == null) {\n console.error([`Could not find Company object for ${this.companyName}`, `or CompanyPosition object for ${companyPositionName}.`, `Work str exp gain will be 0`].join(\" \"));\n return 0;\n }\n\n return companyPosition.strengthExpGain * company.expMultiplier * this.strength_exp_mult * _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_4__[/* BitNodeMultipliers */ \"a\"].CompanyWorkExpGain;\n} //Def exp gained per game cycle\n\nfunction getWorkDefExpGain() {\n const company = _Company_Companies__WEBPACK_IMPORTED_MODULE_7__[/* Companies */ \"a\"][this.companyName];\n const companyPositionName = this.jobs[this.companyName];\n const companyPosition = _Company_CompanyPositions__WEBPACK_IMPORTED_MODULE_10__[/* CompanyPositions */ \"a\"][companyPositionName];\n\n if (company == null || companyPosition == null) {\n console.error([`Could not find Company object for ${this.companyName}`, `or CompanyPosition object for ${companyPositionName}.`, `Work def exp gain will be 0`].join(\" \"));\n return 0;\n }\n\n return companyPosition.defenseExpGain * company.expMultiplier * this.defense_exp_mult * _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_4__[/* BitNodeMultipliers */ \"a\"].CompanyWorkExpGain;\n} //Dex exp gained per game cycle\n\nfunction getWorkDexExpGain() {\n const company = _Company_Companies__WEBPACK_IMPORTED_MODULE_7__[/* Companies */ \"a\"][this.companyName];\n const companyPositionName = this.jobs[this.companyName];\n const companyPosition = _Company_CompanyPositions__WEBPACK_IMPORTED_MODULE_10__[/* CompanyPositions */ \"a\"][companyPositionName];\n\n if (company == null || companyPosition == null) {\n console.error([`Could not find Company object for ${this.companyName}`, `or CompanyPosition object for ${companyPositionName}.`, `Work dex exp gain will be 0`].join(\" \"));\n return 0;\n }\n\n return companyPosition.dexterityExpGain * company.expMultiplier * this.dexterity_exp_mult * _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_4__[/* BitNodeMultipliers */ \"a\"].CompanyWorkExpGain;\n} //Agi exp gained per game cycle\n\nfunction getWorkAgiExpGain() {\n const company = _Company_Companies__WEBPACK_IMPORTED_MODULE_7__[/* Companies */ \"a\"][this.companyName];\n const companyPositionName = this.jobs[this.companyName];\n const companyPosition = _Company_CompanyPositions__WEBPACK_IMPORTED_MODULE_10__[/* CompanyPositions */ \"a\"][companyPositionName];\n\n if (company == null || companyPosition == null) {\n console.error([`Could not find Company object for ${this.companyName}`, `or CompanyPosition object for ${companyPositionName}.`, `Work agi exp gain will be 0`].join(\" \"));\n return 0;\n }\n\n return companyPosition.agilityExpGain * company.expMultiplier * this.agility_exp_mult * _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_4__[/* BitNodeMultipliers */ \"a\"].CompanyWorkExpGain;\n} //Charisma exp gained per game cycle\n\nfunction getWorkChaExpGain() {\n const company = _Company_Companies__WEBPACK_IMPORTED_MODULE_7__[/* Companies */ \"a\"][this.companyName];\n const companyPositionName = this.jobs[this.companyName];\n const companyPosition = _Company_CompanyPositions__WEBPACK_IMPORTED_MODULE_10__[/* CompanyPositions */ \"a\"][companyPositionName];\n\n if (company == null || companyPosition == null) {\n console.error([`Could not find Company object for ${this.companyName}`, `or CompanyPosition object for ${companyPositionName}.`, `Work cha exp gain will be 0`].join(\" \"));\n return 0;\n }\n\n return companyPosition.charismaExpGain * company.expMultiplier * this.charisma_exp_mult * _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_4__[/* BitNodeMultipliers */ \"a\"].CompanyWorkExpGain;\n} //Reputation gained per game cycle\n\nfunction getWorkRepGain() {\n const company = _Company_Companies__WEBPACK_IMPORTED_MODULE_7__[/* Companies */ \"a\"][this.companyName];\n const companyPositionName = this.jobs[this.companyName];\n const companyPosition = _Company_CompanyPositions__WEBPACK_IMPORTED_MODULE_10__[/* CompanyPositions */ \"a\"][companyPositionName];\n\n if (company == null || companyPosition == null) {\n console.error([`Could not find Company object for ${this.companyName}`, `or CompanyPosition object for ${companyPositionName}.`, `Work rep gain will be 0`].join(\" \"));\n return 0;\n }\n\n var jobPerformance = companyPosition.calculateJobPerformance(this.hacking_skill, this.strength, this.defense, this.dexterity, this.agility, this.charisma); //Intelligence provides a flat bonus to job performance\n\n jobPerformance += this.intelligence / _Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"].MaxSkillLevel; //Update reputation gain rate to account for company favor\n\n var favorMult = 1 + company.favor / 100;\n\n if (isNaN(favorMult)) {\n favorMult = 1;\n }\n\n return jobPerformance * this.company_rep_mult * favorMult;\n} // export function getFactionSecurityWorkRepGain() {\n// var t = 0.9 * (this.hacking_skill / CONSTANTS.MaxSkillLevel +\n// this.strength / CONSTANTS.MaxSkillLevel +\n// this.defense / CONSTANTS.MaxSkillLevel +\n// this.dexterity / CONSTANTS.MaxSkillLevel +\n// this.agility / CONSTANTS.MaxSkillLevel) / 4.5;\n// return t * this.faction_rep_mult;\n// }\n// export function getFactionFieldWorkRepGain() {\n// var t = 0.9 * (this.hacking_skill / CONSTANTS.MaxSkillLevel +\n// this.strength / CONSTANTS.MaxSkillLevel +\n// this.defense / CONSTANTS.MaxSkillLevel +\n// this.dexterity / CONSTANTS.MaxSkillLevel +\n// this.agility / CONSTANTS.MaxSkillLevel +\n// this.charisma / CONSTANTS.MaxSkillLevel +\n// this.intelligence / CONSTANTS.MaxSkillLevel) / 5.5;\n// return t * this.faction_rep_mult;\n// }\n\n/* Creating a Program */\n\nfunction startCreateProgramWork(programName, time, reqLevel) {\n this.resetWorkStatus();\n this.isWorking = true;\n this.focus = true;\n this.workType = _Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"].WorkTypeCreateProgram; //Time needed to complete work affected by hacking skill (linearly based on\n //ratio of (your skill - required level) to MAX skill)\n //var timeMultiplier = (CONSTANTS.MaxSkillLevel - (this.hacking_skill - reqLevel)) / CONSTANTS.MaxSkillLevel;\n //if (timeMultiplier > 1) {timeMultiplier = 1;}\n //if (timeMultiplier < 0.01) {timeMultiplier = 0.01;}\n\n this.createProgramReqLvl = reqLevel;\n this.timeNeededToCompleteWork = time; //Check for incomplete program\n\n for (var i = 0; i < this.getHomeComputer().programs.length; ++i) {\n var programFile = this.getHomeComputer().programs[i];\n\n if (programFile.startsWith(programName) && programFile.endsWith(\"%-INC\")) {\n var res = programFile.split(\"-\");\n\n if (res.length != 3) {\n break;\n }\n\n var percComplete = Number(res[1].slice(0, -1));\n\n if (isNaN(percComplete) || percComplete < 0 || percComplete >= 100) {\n break;\n }\n\n this.timeWorkedCreateProgram = percComplete / 100 * this.timeNeededToCompleteWork;\n this.getHomeComputer().programs.splice(i, 1);\n }\n }\n\n this.createProgramName = programName;\n}\nfunction createProgramWork(numCycles) {\n //Higher hacking skill will allow you to create programs faster\n var reqLvl = this.createProgramReqLvl;\n var skillMult = this.hacking_skill / reqLvl * this.getIntelligenceBonus(3); //This should always be greater than 1;\n\n skillMult = 1 + (skillMult - 1) / 5; //The divider constant can be adjusted as necessary\n //Skill multiplier directly applied to \"time worked\"\n\n this.timeWorked += _Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"]._idleSpeed * numCycles;\n this.timeWorkedCreateProgram += _Constants__WEBPACK_IMPORTED_MODULE_12__[/* CONSTANTS */ \"a\"]._idleSpeed * numCycles * skillMult;\n\n if (this.timeWorkedCreateProgram >= this.timeNeededToCompleteWork) {\n this.finishCreateProgramWork(false);\n }\n}\nfunction finishCreateProgramWork(cancelled) {\n var programName = this.createProgramName;\n\n if (cancelled === false) {\n Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_41__[/* dialogBoxCreate */ \"a\"])(\"You've finished creating \" + programName + \"!