diff --git a/dist/bundle.js b/dist/bundle.js
index 994fd930a..df20086f4 100644
--- a/dist/bundle.js
+++ b/dist/bundle.js
@@ -81,27 +81,27 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Player", function() { return Player; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "loadPlayer", function() { return loadPlayer; });
/* harmony import */ var _Augmentations_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Augmentations.js */ 18);
-/* harmony import */ var _BitNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./BitNode.js */ 16);
+/* harmony import */ var _BitNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./BitNode.js */ 15);
/* harmony import */ var _Company_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Company.js */ 9);
/* harmony import */ var _Constants_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Constants.js */ 3);
/* harmony import */ var _CompanyManagement_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./CompanyManagement.js */ 40);
-/* harmony import */ var _CreateProgram_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./CreateProgram.js */ 13);
+/* harmony import */ var _CreateProgram_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./CreateProgram.js */ 14);
/* harmony import */ var _Crimes_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Crimes.js */ 19);
/* harmony import */ var _engine_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./engine.js */ 5);
-/* harmony import */ var _Faction_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Faction.js */ 14);
-/* harmony import */ var _Gang_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./Gang.js */ 35);
+/* harmony import */ var _Faction_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Faction.js */ 11);
+/* harmony import */ var _Gang_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./Gang.js */ 36);
/* harmony import */ var _Location_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./Location.js */ 4);
-/* harmony import */ var _NetscriptFunctions_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./NetscriptFunctions.js */ 30);
+/* harmony import */ var _NetscriptFunctions_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./NetscriptFunctions.js */ 29);
/* harmony import */ var _Server_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./Server.js */ 10);
/* harmony import */ var _SpecialServerIps_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./SpecialServerIps.js */ 17);
-/* harmony import */ var _SourceFile_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./SourceFile.js */ 44);
+/* harmony import */ var _SourceFile_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./SourceFile.js */ 42);
/* harmony import */ var _utils_decimal_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../utils/decimal.js */ 23);
/* harmony import */ var _utils_decimal_js__WEBPACK_IMPORTED_MODULE_15___default = /*#__PURE__*/__webpack_require__.n(_utils_decimal_js__WEBPACK_IMPORTED_MODULE_15__);
/* harmony import */ var _utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../utils/DialogBox.js */ 6);
/* harmony import */ var _utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../utils/HelperFunctions.js */ 1);
-/* harmony import */ var _utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../utils/IPAddress.js */ 15);
+/* harmony import */ var _utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../utils/IPAddress.js */ 16);
/* harmony import */ var _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../utils/JSONReviver.js */ 8);
-/* harmony import */ var _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../utils/numeral.min.js */ 12);
+/* harmony import */ var _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../utils/numeral.min.js */ 13);
/* harmony import */ var _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_20___default = /*#__PURE__*/__webpack_require__.n(_utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_20__);
/* harmony import */ var _utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../utils/StringHelperFunctions.js */ 2);
@@ -1512,8 +1512,8 @@ PlayerObject.prototype.takeClass = function(numCycles) {
"$" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_21__["formatNumber"])(this.workMoneyGained, 2) + " ($" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_21__["formatNumber"])(this.workMoneyLossRate * cyclesPerSec, 2) + " / sec)
" +
"You have gained:
" +
Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_21__["formatNumber"])(this.workHackExpGained, 4) + " (" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_21__["formatNumber"])(this.workHackExpGainRate * cyclesPerSec, 4) + " / sec) hacking exp
" +
- Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_21__["formatNumber"])(this.workDefExpGained, 4) + " (" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_21__["formatNumber"])(this.workDefExpGainRate * cyclesPerSec, 4) + " / sec) defense exp
" +
Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_21__["formatNumber"])(this.workStrExpGained, 4) + " (" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_21__["formatNumber"])(this.workStrExpGainRate * cyclesPerSec, 4) + " / sec) strength exp
" +
+ Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_21__["formatNumber"])(this.workDefExpGained, 4) + " (" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_21__["formatNumber"])(this.workDefExpGainRate * cyclesPerSec, 4) + " / sec) defense exp
" +
Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_21__["formatNumber"])(this.workDexExpGained, 4) + " (" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_21__["formatNumber"])(this.workDexExpGainRate * cyclesPerSec, 4) + " / sec) dexterity exp
" +
Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_21__["formatNumber"])(this.workAgiExpGained, 4) + " (" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_21__["formatNumber"])(this.workAgiExpGainRate * cyclesPerSec, 4) + " / sec) agility exp
" +
Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_21__["formatNumber"])(this.workChaExpGained, 4) + " (" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_21__["formatNumber"])(this.workChaExpGainRate * cyclesPerSec, 4) + " / sec) charisma exp
" +
@@ -4089,6 +4089,8 @@ let CONSTANTS = {
"World Stock Exchange account and TIX API Access
",
LatestUpdate:
+ "v0.36.1
" +
+ "* The ctrl+b hotkey in the text editor is now also triggered by command+b or winkey+b
" +
"v0.36.0
" +
"* Added BN-6: Bladeburners
" +
"* Rebalanced many combat Augmentations so that they are slightly less powerful
" +
@@ -4111,25 +4113,25 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Locations", function() { return Locations; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "displayLocationContent", function() { return displayLocationContent; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "initLocationButtons", function() { return initLocationButtons; });
-/* harmony import */ var _Bladeburner_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Bladeburner.js */ 45);
+/* harmony import */ var _Bladeburner_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Bladeburner.js */ 47);
/* harmony import */ var _Company_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Company.js */ 9);
/* harmony import */ var _CompanyManagement_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./CompanyManagement.js */ 40);
/* harmony import */ var _Constants_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Constants.js */ 3);
/* harmony import */ var _Crimes_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Crimes.js */ 19);
/* harmony import */ var _engine_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./engine.js */ 5);
-/* harmony import */ var _Infiltration_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Infiltration.js */ 113);
-/* harmony import */ var _NetscriptFunctions_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./NetscriptFunctions.js */ 30);
+/* harmony import */ var _Infiltration_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Infiltration.js */ 112);
+/* harmony import */ var _NetscriptFunctions_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./NetscriptFunctions.js */ 29);
/* harmony import */ var _Player_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Player.js */ 0);
/* harmony import */ var _Server_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./Server.js */ 10);
/* harmony import */ var _ServerPurchases_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./ServerPurchases.js */ 78);
/* harmony import */ var _SpecialServerIps_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./SpecialServerIps.js */ 17);
/* harmony import */ var _utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../utils/DialogBox.js */ 6);
/* harmony import */ var _utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../utils/HelperFunctions.js */ 1);
-/* harmony import */ var _utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../utils/IPAddress.js */ 15);
-/* harmony import */ var _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../utils/numeral.min.js */ 12);
+/* harmony import */ var _utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../utils/IPAddress.js */ 16);
+/* harmony import */ var _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../utils/numeral.min.js */ 13);
/* harmony import */ var _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_15___default = /*#__PURE__*/__webpack_require__.n(_utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_15__);
/* harmony import */ var _utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../utils/StringHelperFunctions.js */ 2);
-/* harmony import */ var _utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../utils/YesNoBox.js */ 11);
+/* harmony import */ var _utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../utils/YesNoBox.js */ 12);
@@ -6323,40 +6325,40 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var _utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/DialogBox.js */ 6);
/* harmony import */ var _utils_GameOptions_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/GameOptions.js */ 54);
/* harmony import */ var _utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/HelperFunctions.js */ 1);
-/* harmony import */ var _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils/numeral.min.js */ 12);
+/* harmony import */ var _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils/numeral.min.js */ 13);
/* harmony import */ var _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils/StringHelperFunctions.js */ 2);
-/* harmony import */ var _utils_LogBox_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils/LogBox.js */ 50);
-/* harmony import */ var _ActiveScriptsUI_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ActiveScriptsUI.js */ 42);
+/* harmony import */ var _utils_LogBox_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils/LogBox.js */ 51);
+/* harmony import */ var _ActiveScriptsUI_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ActiveScriptsUI.js */ 43);
/* harmony import */ var _Augmentations_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Augmentations.js */ 18);
-/* harmony import */ var _BitNode_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./BitNode.js */ 16);
-/* harmony import */ var _Bladeburner_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./Bladeburner.js */ 45);
-/* harmony import */ var _CinematicText_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./CinematicText.js */ 66);
+/* harmony import */ var _BitNode_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./BitNode.js */ 15);
+/* harmony import */ var _Bladeburner_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./Bladeburner.js */ 47);
+/* harmony import */ var _CinematicText_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./CinematicText.js */ 67);
/* harmony import */ var _Company_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./Company.js */ 9);
/* harmony import */ var _CompanyManagement_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./CompanyManagement.js */ 40);
/* harmony import */ var _Constants_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./Constants.js */ 3);
-/* harmony import */ var _CreateProgram_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./CreateProgram.js */ 13);
-/* harmony import */ var _Faction_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./Faction.js */ 14);
+/* harmony import */ var _CreateProgram_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./CreateProgram.js */ 14);
+/* harmony import */ var _Faction_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./Faction.js */ 11);
/* harmony import */ var _Fconf_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./Fconf.js */ 34);
/* harmony import */ var _Location_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./Location.js */ 4);
-/* harmony import */ var _Gang_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./Gang.js */ 35);
-/* harmony import */ var _HacknetNode_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./HacknetNode.js */ 38);
+/* harmony import */ var _Gang_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./Gang.js */ 36);
+/* harmony import */ var _HacknetNode_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./HacknetNode.js */ 39);
/* harmony import */ var _InteractiveTutorial_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./InteractiveTutorial.js */ 25);
/* harmony import */ var _Literature_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./Literature.js */ 53);
/* harmony import */ var _Message_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./Message.js */ 27);
/* harmony import */ var _Missions_js__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./Missions.js */ 32);
-/* harmony import */ var _NetscriptFunctions_js__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./NetscriptFunctions.js */ 30);
-/* harmony import */ var _NetscriptWorker_js__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./NetscriptWorker.js */ 21);
+/* harmony import */ var _NetscriptFunctions_js__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./NetscriptFunctions.js */ 29);
+/* harmony import */ var _NetscriptWorker_js__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./NetscriptWorker.js */ 20);
/* harmony import */ var _Player_js__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./Player.js */ 0);
-/* harmony import */ var _Prestige_js__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./Prestige.js */ 67);
-/* harmony import */ var _RedPill_js__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./RedPill.js */ 49);
-/* harmony import */ var _SaveObject_js__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./SaveObject.js */ 51);
-/* harmony import */ var _Script_js__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./Script.js */ 29);
+/* harmony import */ var _Prestige_js__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./Prestige.js */ 57);
+/* harmony import */ var _RedPill_js__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./RedPill.js */ 44);
+/* harmony import */ var _SaveObject_js__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./SaveObject.js */ 46);
+/* harmony import */ var _Script_js__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./Script.js */ 28);
/* harmony import */ var _Server_js__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./Server.js */ 10);
/* harmony import */ var _Settings_js__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./Settings.js */ 24);
-/* harmony import */ var _SourceFile_js__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./SourceFile.js */ 44);
+/* harmony import */ var _SourceFile_js__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./SourceFile.js */ 42);
/* harmony import */ var _SpecialServerIps_js__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ./SpecialServerIps.js */ 17);
-/* harmony import */ var _StockMarket_js__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ./StockMarket.js */ 20);
+/* harmony import */ var _StockMarket_js__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ./StockMarket.js */ 21);
/* harmony import */ var _Terminal_js__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ./Terminal.js */ 22);
@@ -8109,7 +8111,7 @@ window.onload = function() {
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ 41)))
+/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ 38)))
/***/ }),
/* 6 */
@@ -8195,7 +8197,7 @@ function dialogBoxCreate(txt, preformatted=false) {
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ 41)))
+/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ 38)))
/***/ }),
/* 7 */
@@ -8219,18 +8221,18 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isScriptErrorMessage", function() { return isScriptErrorMessage; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "killNetscriptDelay", function() { return killNetscriptDelay; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "evaluateImport", function() { return evaluateImport; });
-/* harmony import */ var _BitNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BitNode.js */ 16);
+/* harmony import */ var _BitNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BitNode.js */ 15);
/* harmony import */ var _Constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Constants.js */ 3);
/* harmony import */ var _Player_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Player.js */ 0);
-/* harmony import */ var _NetscriptEnvironment_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./NetscriptEnvironment.js */ 65);
-/* harmony import */ var _NetscriptWorker_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./NetscriptWorker.js */ 21);
+/* harmony import */ var _NetscriptEnvironment_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./NetscriptEnvironment.js */ 66);
+/* harmony import */ var _NetscriptWorker_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./NetscriptWorker.js */ 20);
/* harmony import */ var _Server_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Server.js */ 10);
/* harmony import */ var _Settings_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Settings.js */ 24);
-/* harmony import */ var _Script_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Script.js */ 29);
-/* harmony import */ var _utils_acorn_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../utils/acorn.js */ 36);
+/* harmony import */ var _Script_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Script.js */ 28);
+/* harmony import */ var _utils_acorn_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../utils/acorn.js */ 35);
/* harmony import */ var _utils_acorn_js__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_utils_acorn_js__WEBPACK_IMPORTED_MODULE_8__);
/* harmony import */ var _utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../utils/HelperFunctions.js */ 1);
-/* harmony import */ var _utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../utils/IPAddress.js */ 15);
+/* harmony import */ var _utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../utils/IPAddress.js */ 16);
/* harmony import */ var _utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../utils/StringHelperFunctions.js */ 2);
@@ -8246,7 +8248,7 @@ __webpack_require__.r(__webpack_exports__);
-var Promise = __webpack_require__(/*! bluebird */ 167);
+var Promise = __webpack_require__(/*! bluebird */ 115);
Promise.config({
warnings: false,
@@ -10435,14 +10437,14 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "initForeignServers", function() { return initForeignServers; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "prestigeAllServers", function() { return prestigeAllServers; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "prestigeHomeComputer", function() { return prestigeHomeComputer; });
-/* harmony import */ var _BitNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BitNode.js */ 16);
+/* harmony import */ var _BitNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BitNode.js */ 15);
/* harmony import */ var _Constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Constants.js */ 3);
-/* harmony import */ var _CreateProgram_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./CreateProgram.js */ 13);
+/* harmony import */ var _CreateProgram_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./CreateProgram.js */ 14);
/* harmony import */ var _Player_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Player.js */ 0);
-/* harmony import */ var _Script_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Script.js */ 29);
+/* harmony import */ var _Script_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Script.js */ 28);
/* harmony import */ var _SpecialServerIps_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./SpecialServerIps.js */ 17);
/* harmony import */ var _utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../utils/HelperFunctions.js */ 1);
-/* harmony import */ var _utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../utils/IPAddress.js */ 15);
+/* harmony import */ var _utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../utils/IPAddress.js */ 16);
/* harmony import */ var _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../utils/JSONReviver.js */ 8);
@@ -10454,11 +10456,12 @@ __webpack_require__.r(__webpack_exports__);
-function Server(ip=Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname="", organizationName="",
- isConnectedTo=false, adminRights=false, purchasedByPlayer=false, maxRam=0) {
- /* Properties */
- //Connection information
- this.ip = ip;
+function Server(params={ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:""}) {
+ /* Properties */
+ //Connection information
+ this.ip = params.ip ? params.ip : Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])();
+
+ var hostname = params.hostname;
var i = 0;
var suffix = "";
while (GetServerByHostname(hostname+suffix) != null) {
@@ -10466,76 +10469,74 @@ function Server(ip=Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["crea
suffix = "-" + i;
++i;
}
- this.hostname = hostname + suffix;
- this.organizationName = organizationName;
- this.isConnectedTo = isConnectedTo; //Whether the player is connected to this server
+ this.hostname = hostname + suffix;
+ this.organizationName = params.organizationName ? params.organizationName : "";
+ this.isConnectedTo = params.isConnectedTo ? params.isConnectedTo : false;
- //Access information
- this.hasAdminRights = adminRights; //Whether player has admin rights
- this.purchasedByPlayer = purchasedByPlayer;
- this.manuallyHacked = false; //Flag that tracks whether or not the server has been hacked at least once
+ //Access information
+ this.hasAdminRights = params.adminRights ? params.adminRights : false;
+ this.purchasedByPlayer = params.purchasedByPlayer ? params.purchasedByPlayer : false;
+ this.manuallyHacked = false; //Flag that tracks whether or not the server has been hacked at least once
- //RAM, CPU speed and Scripts
- this.maxRam = maxRam; //GB
- this.ramUsed = 0;
- this.cpuCores = 1; //Max of 8, affects hacking times and Hacking Mission starting Cores
+ //RAM, CPU speed and Scripts
+ this.maxRam = params.maxRam ? params.maxRam : 0; //GB
+ this.ramUsed = 0;
+ this.cpuCores = 1; //Max of 8, affects hacking times and Hacking Mission starting Cores
- this.scripts = [];
- this.runningScripts = []; //Stores RunningScript objects
- this.programs = [];
- this.messages = [];
- this.textFiles = [];
- this.dir = 0; //new Directory(this, null, "");
+ this.scripts = [];
+ this.runningScripts = []; //Stores RunningScript objects
+ this.programs = [];
+ this.messages = [];
+ this.textFiles = [];
+ this.dir = 0; //new Directory(this, null, ""); TODO
- /* Hacking information (only valid for "foreign" aka non-purchased servers) */
- //Skill required to attempt a hack. Whether a hack is successful will be determined
- //by a separate formula
- this.requiredHackingSkill = 1;
+ /* Hacking information (only valid for "foreign" aka non-purchased servers) */
+ this.requiredHackingSkill = params.requiredHackingSkill ? params.requiredHackingSkill : 1;
+ this.moneyAvailable = params.moneyAvailable ? params.moneyAvailable * _BitNode_js__WEBPACK_IMPORTED_MODULE_0__["BitNodeMultipliers"].ServerStartingMoney : 1e6;
+ this.moneyMax = 25 * this.moneyAvailable * _BitNode_js__WEBPACK_IMPORTED_MODULE_0__["BitNodeMultipliers"].ServerMaxMoney;
- //Total money available on this server
- this.moneyAvailable = 0;
- this.moneyMax = 0;
+ //Hack Difficulty is synonymous with server security. Base Difficulty = Starting difficulty
+ this.hackDifficulty = params.hackDifficulty ? params.hackDifficulty * _BitNode_js__WEBPACK_IMPORTED_MODULE_0__["BitNodeMultipliers"].ServerStartingSecurity : 1;
+ this.baseDifficulty = this.hackDifficulty;
+ this.minDifficulty = Math.max(1, Math.round(this.hackDifficulty / 3));
+ this.serverGrowth = params.serverGrowth ? params.serverGrowth : 1; //Integer from 0 to 100. Affects money increase from grow()
- //Parameters used in formulas that dictate how moneyAvailable and requiredHackingSkill change.
- this.hackDifficulty = 1; //Affects hack success rate and how the requiredHackingSkill increases over time (1-100)
- this.baseDifficulty = 1; //Starting difficulty
- this.minDifficulty = 1;
- this.serverGrowth = 0; //Affects how the moneyAvailable increases (0-100)
-
- //The IP's of all servers reachable from this one (what shows up if you run scan/netstat)
+ //The IP's of all servers reachable from this one (what shows up if you run scan/netstat)
// NOTE: Only contains IP and not the Server objects themselves
- this.serversOnNetwork = [];
+ this.serversOnNetwork = [];
- //Port information, required for porthacking servers to get admin rights
- this.numOpenPortsRequired = 5;
- this.sshPortOpen = false; //Port 22
- this.ftpPortOpen = false; //Port 21
- this.smtpPortOpen = false; //Port 25
- this.httpPortOpen = false; //Port 80
- this.sqlPortOpen = false; //Port 1433
- this.openPortCount = 0;
+ //Port information, required for porthacking servers to get admin rights
+ this.numOpenPortsRequired = params.numOpenPortsRequired ? params.numOpenPortsRequired : 5;
+ this.sshPortOpen = false; //Port 22
+ this.ftpPortOpen = false; //Port 21
+ this.smtpPortOpen = false; //Port 25
+ this.httpPortOpen = false; //Port 80
+ this.sqlPortOpen = false; //Port 1433
+ this.openPortCount = 0;
};
+/*
//Set the hacking properties of a server
Server.prototype.setHackingParameters = function(requiredHackingSkill, moneyAvailable, hackDifficulty, serverGrowth) {
- this.requiredHackingSkill = requiredHackingSkill;
+ this.requiredHackingSkill = requiredHackingSkill;
if (isNaN(moneyAvailable)) {
this.moneyAvailable = 1e6;
} else {
- this.moneyAvailable = moneyAvailable * _BitNode_js__WEBPACK_IMPORTED_MODULE_0__["BitNodeMultipliers"].ServerStartingMoney;
+ this.moneyAvailable = moneyAvailable * BitNodeMultipliers.ServerStartingMoney;
}
- this.moneyMax = 25 * this.moneyAvailable * _BitNode_js__WEBPACK_IMPORTED_MODULE_0__["BitNodeMultipliers"].ServerMaxMoney;
- this.hackDifficulty = hackDifficulty * _BitNode_js__WEBPACK_IMPORTED_MODULE_0__["BitNodeMultipliers"].ServerStartingSecurity;
- this.baseDifficulty = hackDifficulty * _BitNode_js__WEBPACK_IMPORTED_MODULE_0__["BitNodeMultipliers"].ServerStartingSecurity;
+ this.moneyMax =
+ this.hackDifficulty = hackDifficulty * BitNodeMultipliers.ServerStartingSecurity;
+ this.baseDifficulty = hackDifficulty * BitNodeMultipliers.ServerStartingSecurity;
this.minDifficulty = Math.max(1, Math.round(this.hackDifficulty / 3));
- this.serverGrowth = serverGrowth;
+ this.serverGrowth = serverGrowth;
}
//Set the port properties of a server
//Right now its only the number of open ports needed to PortHack the server.
Server.prototype.setPortProperties = function(numOpenPortsReq) {
- this.numOpenPortsRequired = numOpenPortsReq;
+ this.numOpenPortsRequired = numOpenPortsReq;
}
+*/
Server.prototype.setMaxRam = function(ram) {
this.maxRam = ram;
@@ -10554,12 +10555,12 @@ Server.prototype.getServerOnNetwork = function(i) {
//Given the name of the script, returns the corresponding
//script object on the server (if it exists)
Server.prototype.getScript = function(scriptName) {
- for (var i = 0; i < this.scripts.length; i++) {
- if (this.scripts[i].filename == scriptName) {
- return this.scripts[i];
- }
- }
- return null;
+ for (var i = 0; i < this.scripts.length; i++) {
+ if (this.scripts[i].filename == scriptName) {
+ return this.scripts[i];
+ }
+ }
+ return null;
}
//Strengthens a server's security level (difficulty) by the specified amount
@@ -10578,413 +10579,554 @@ Server.prototype.weaken = function(amt) {
//Functions for loading and saving a Server
Server.prototype.toJSON = function() {
- return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_8__["Generic_toJSON"])("Server", this);
+ return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_8__["Generic_toJSON"])("Server", this);
}
Server.fromJSON = function(value) {
- return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_8__["Generic_fromJSON"])(Server, value.data);
+ return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_8__["Generic_fromJSON"])(Server, value.data);
}
_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_8__["Reviver"].constructors.Server = Server;
function initForeignServers() {
//MegaCorporations
- var ECorpServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "ecorp", "ECorp", false, false, false, 0);
- ECorpServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(1150, 1300), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(30000000000, 70000000000), 99, 99);
- ECorpServer.setPortProperties(5);
+ var ECorpServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"ecorp", organizationName:"ECorp",
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(1150, 1300), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(30e9, 70e9),
+ hackDifficulty:99,serverGrowth:99, numOpenPortsRequired: 5,
+ });
AddToAllServers(ECorpServer);
- var MegaCorpServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "megacorp", "MegaCorp", false, false, false, 0);
- MegaCorpServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(1150, 1300), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(40000000000, 60000000000), 99, 99);
- MegaCorpServer.setPortProperties(5);
+ var MegaCorpServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"megacorp", organizationName:"MegaCorp",
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(1150, 1300), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(40e9, 60e9),
+ hackDifficulty:99, serverGrowth:99, numOpenPortsRequired:5
+ });
AddToAllServers(MegaCorpServer);
- var BachmanAndAssociatesServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "b-and-a", "Bachman & Associates", false, false, false, 0);
- BachmanAndAssociatesServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(1000, 1050), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(20000000000, 25000000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(75, 85), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(65, 75));
- BachmanAndAssociatesServer.setPortProperties(5);
+ var BachmanAndAssociatesServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"b-and-a", organizationName:"Bachman & Associates",
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(1000, 1050), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(20e9, 25e9),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(75, 85), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(65, 75), numOpenPortsRequired:5
+ });
AddToAllServers(BachmanAndAssociatesServer);
- var BladeIndustriesServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "blade", "Blade Industries", false, false, false, 2);
- BladeIndustriesServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(1000, 1100), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(12000000000, 20000000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(90, 95), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(60, 75));
- BladeIndustriesServer.setPortProperties(5);
+ var BladeIndustriesServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"blade", organizationName:"Blade Industries", maxRam:128,
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(1000, 1100), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(12e9, 20e9),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(90, 95), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(60, 75), numOpenPortsRequired:5
+ });
BladeIndustriesServer.messages.push("beyond-man.lit");
AddToAllServers(BladeIndustriesServer);
- var NWOServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "nwo", "New World Order", false, false, false, 2);
- NWOServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(1000, 1200), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(25000000000, 35000000000), 99, Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(75, 85));
- NWOServer.setPortProperties(5);
+ var NWOServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"nwo", organizationName:"New World Order",
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(1000, 1200), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(25e9, 35e9),
+ hackDifficulty:99, serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(75, 85), numOpenPortsRequired:5
+ });
NWOServer.messages.push("the-hidden-world.lit");
AddToAllServers(NWOServer);
- var ClarkeIncorporatedServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "clarkeinc", "Clarke Incorporated", false, false, false, 2);
- ClarkeIncorporatedServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(1000, 1200), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(15000000000, 25000000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(50, 60), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(50, 70));
- ClarkeIncorporatedServer.setPortProperties(5);
+ var ClarkeIncorporatedServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"clarkeinc", organizationName:"Clarke Incorporated",
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(1000, 1200), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(15e9, 25e9),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(50, 60), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(50, 70), numOpenPortsRequired:5
+ });
ClarkeIncorporatedServer.messages.push("beyond-man.lit");
ClarkeIncorporatedServer.messages.push("cost-of-immortality.lit");
AddToAllServers(ClarkeIncorporatedServer);
- var OmniTekIncorporatedServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "omnitek", "OmniTek Incorporated", false, false, false, 2);
- OmniTekIncorporatedServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(900, 1100), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(15000000000, 20000000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(90, 99), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(95, 99));
- OmniTekIncorporatedServer.setPortProperties(5);
+ var OmniTekIncorporatedServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"omnitek", organizationName:"OmniTek Incorporated", maxRam:256,
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(900, 1100), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(15e9, 20e9),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(90, 99), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(95, 99), numOpenPortsRequired:5
+ });
OmniTekIncorporatedServer.messages.push("coded-intelligence.lit");
+ OmniTekIncorporatedServer.messages.push("history-of-synthoids.lit");
AddToAllServers(OmniTekIncorporatedServer);
- var FourSigmaServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "4sigma", "FourSigma", false, false, false, 0);
- FourSigmaServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(950, 1200), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(15000000000, 25000000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(60, 70), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(75, 99));
- FourSigmaServer.setPortProperties(5);
+ var FourSigmaServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"4sigma", organizationName:"FourSigma",
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(950, 1200), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(15e9, 25e9),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(60, 70), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(75, 99), numOpenPortsRequired:5
+ });
AddToAllServers(FourSigmaServer);
- var KuaiGongInternationalServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "kuai-gong", "KuaiGong International", false, false, false, 0);
- KuaiGongInternationalServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(1000, 1250), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(20000000000, 30000000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(95, 99), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(90, 99));
- KuaiGongInternationalServer.setPortProperties(5);
+ var KuaiGongInternationalServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"kuai-gong", organizationName:"KuaiGong International",
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(1000, 1250), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(20e9, 30e9),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(95, 99), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(90, 99), numOpenPortsRequired:5,
+ });
AddToAllServers(KuaiGongInternationalServer);
//Technology and communications companies (large targets)
- var FulcrumTechnologiesServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "fulcrumtech", "Fulcrum Technologies", false, false, false, 64);
- FulcrumTechnologiesServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(1000, 1200), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(1400000000, 1800000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(85, 95), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(80, 99));
- FulcrumTechnologiesServer.setPortProperties(5);
+ var FulcrumTechnologiesServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"fulcrumtech", organizationName:"Fulcrum Technologies", maxRam:512,
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(1000, 1200), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(1.4e9, 1.8e9),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(85, 95), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(80, 99), numOpenPortsRequired:5
+ });
FulcrumTechnologiesServer.messages.push("simulated-reality.lit");
AddToAllServers(FulcrumTechnologiesServer);
- var FulcrumSecretTechnologiesServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "fulcrumassets", "Fulcrum Technologies Assets", false, false, false, 0);
- FulcrumSecretTechnologiesServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(1200, 1500), 1000000, 99, 1);
- FulcrumSecretTechnologiesServer.setPortProperties(5);
+ var FulcrumSecretTechnologiesServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"fulcrumassets", organizationName:"Fulcrum Technologies Assets",
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(1200, 1500), moneyAvailable:1e6,
+ hackDifficulty:99, serverGrowth:1, numOpenPortsRequired:5
+ });
AddToAllServers(FulcrumSecretTechnologiesServer);
- _SpecialServerIps_js__WEBPACK_IMPORTED_MODULE_5__["SpecialServerIps"].addIp(_SpecialServerIps_js__WEBPACK_IMPORTED_MODULE_5__["SpecialServerNames"].FulcrumSecretTechnologies, FulcrumSecretTechnologiesServer.ip);
+ _SpecialServerIps_js__WEBPACK_IMPORTED_MODULE_5__["SpecialServerIps"].addIp(_SpecialServerIps_js__WEBPACK_IMPORTED_MODULE_5__["SpecialServerNames"].FulcrumSecretTechnologies, FulcrumSecretTechnologiesServer.ip);
- var StormTechnologiesServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "stormtech", "Storm Technologies", false, false, false, 0);
- StormTechnologiesServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(900, 1050), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(1000000000, 1200000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(80, 90), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(70, 90));
- StormTechnologiesServer.setPortProperties(5);
+ var StormTechnologiesServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"stormtech", organizationName:"Storm Technologies",
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(900, 1050), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(1e9, 1.2e9),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(80, 90), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(70, 90), numOpenPortsRequired:5
+ });
AddToAllServers(StormTechnologiesServer);
- var DefCommServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "defcomm", "DefComm", false, false, false, 0);
- DefCommServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(900, 1000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(800000000, 950000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(85, 95), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(50, 70));
- DefCommServer.setPortProperties(5);
+ var DefCommServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"defcomm", organizationName:"DefComm",
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(900, 1000), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(800e6, 950e6),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(85, 95), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(50, 70), numOpenPortsRequired:5
+ });
AddToAllServers(DefCommServer);
- var InfoCommServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "infocomm", "InfoComm", false, false, false, 0);
- InfoCommServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(875, 950), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(600000000, 900000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(70, 90), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(35, 75));
- InfoCommServer.setPortProperties(5);
+ var InfoCommServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"infocomm", organizationName:"InfoComm",
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(875, 950), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(600e6, 900e6),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(70, 90), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(35, 75), numOpenPortsRequired:5
+ });
AddToAllServers(InfoCommServer);
- var HeliosLabsServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "helios", "Helios Labs", false, false, false, 2);
- HeliosLabsServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(800, 900), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(550000000, 750000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(85, 95), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(70, 80));
- HeliosLabsServer.setPortProperties(5);
+ var HeliosLabsServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"helios", organizationName:"Helios Labs", maxRam:128,
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(800, 900), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(550e6, 750e6),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(85, 95), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(70, 80), numOpenPortsRequired:5
+ });
HeliosLabsServer.messages.push("beyond-man.lit");
AddToAllServers(HeliosLabsServer);
- var VitaLifeServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "vitalife", "VitaLife", false, false, false, 32);
- VitaLifeServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(775, 900), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(700000000, 800000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(80, 90), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(60, 80));
- VitaLifeServer.setPortProperties(5);
+ var VitaLifeServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"vitalife", organizationName:"VitaLife", maxRam:64,
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(775, 900), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(700e6, 800e6),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(80, 90), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(60, 80), numOpenPortsRequired:5
+ });
VitaLifeServer.messages.push("A-Green-Tomorrow.lit");
AddToAllServers(VitaLifeServer);
- var IcarusMicrosystemsServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "icarus", "Icarus Microsystems", false, false, false, 0);
- IcarusMicrosystemsServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(850, 925), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(900000000, 1000000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(85, 95), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(85, 95));
- IcarusMicrosystemsServer.setPortProperties(5);
+ var IcarusMicrosystemsServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"icarus", organizationName:"Icarus Microsystems",
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(850, 925), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(900e6, 1000e6),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(85, 95), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(85, 95), numOpenPortsRequired:5
+ });
AddToAllServers(IcarusMicrosystemsServer);
- var UniversalEnergyServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "univ-energy", "Universal Energy", false, false, false, 32);
- UniversalEnergyServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(800, 900), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(1100000000, 1200000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(80, 90), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(80, 90));
- UniversalEnergyServer.setPortProperties(4);
+ var UniversalEnergyServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"univ-energy", organizationName:"Universal Energy", maxRam:64,
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(800, 900), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(1.1e9, 1.2e9),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(80, 90), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(80, 90), numOpenPortsRequired:4
+ });
AddToAllServers(UniversalEnergyServer);
- var TitanLabsServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "titan-labs", "Titan Laboratories", false, false, false, 32);
- TitanLabsServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(800, 875), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(750000000, 900000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(70, 80), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(60, 80));
- TitanLabsServer.setPortProperties(5);
+ var TitanLabsServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"titan-labs", organizationName:"Titan Laboratories", maxRam:64,
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(800, 875), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(750e6, 900e6),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(70, 80), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(60, 80), numOpenPortsRequired:5
+ });
TitanLabsServer.messages.push("coded-intelligence.lit");
AddToAllServers(TitanLabsServer);
- var MicrodyneTechnologiesServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "microdyne", "Microdyne Technologies", false, false, false, 16);
- MicrodyneTechnologiesServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(800, 875), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(500000000, 700000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(65, 75), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(70, 90));
- MicrodyneTechnologiesServer.setPortProperties(5);
+ var MicrodyneTechnologiesServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"microdyne", organizationName:"Microdyne Technologies", maxRam:32,
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(800, 875), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(500e6, 700e6),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(65, 75), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(70, 90), numOpenPortsRequired:5
+ });
MicrodyneTechnologiesServer.messages.push("synthetic-muscles.lit");
AddToAllServers(MicrodyneTechnologiesServer);
- var TaiYangDigitalServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "taiyang-digital", "Taiyang Digital", false, false, false, 2);
- TaiYangDigitalServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(850, 950), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(800000000, 900000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(70, 80), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(70, 80));
- TaiYangDigitalServer.setPortProperties(5);
+ var TaiYangDigitalServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"taiyang-digital", organizationName:"Taiyang Digital",
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(850, 950), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(800e6, 900e6),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(70, 80), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(70, 80), numOpenPortsRequired:5
+ });
TaiYangDigitalServer.messages.push("A-Green-Tomorrow.lit");
TaiYangDigitalServer.messages.push("brighter-than-the-sun.lit");
AddToAllServers(TaiYangDigitalServer);
- var GalacticCyberSystemsServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "galactic-cyber", "Galactic Cybersystems", false, false, false, 0);
- GalacticCyberSystemsServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(825, 875), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(750000000, 850000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(55, 65), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(70, 90));
- GalacticCyberSystemsServer.setPortProperties(5);
+ var GalacticCyberSystemsServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"galactic-cyber", organizationName:"Galactic Cybersystems",
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(825, 875), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(750e6, 850e6),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(55, 65), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(70, 90), numOpenPortsRequired:5
+ });
AddToAllServers(GalacticCyberSystemsServer);
//Defense Companies ("Large" Companies)
- var AeroCorpServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "aerocorp", "AeroCorp", false, false, false, 2);
- AeroCorpServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(850, 925), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(1000000000, 1200000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(80, 90), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(55, 65));
- AeroCorpServer.setPortProperties(5);
+ var AeroCorpServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"aerocorp", organizationName:"AeroCorp",
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(850, 925), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(1e9, 1.2e9),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(80, 90), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(55, 65), numOpenPortsRequired:5
+ });
AeroCorpServer.messages.push("man-and-machine.lit");
AddToAllServers(AeroCorpServer);
- var OmniaCybersystemsServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "omnia", "Omnia Cybersystems", false, false, false, 0);
- OmniaCybersystemsServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(850, 950), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(900000000, 1000000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(85, 95), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(60, 70));
- OmniaCybersystemsServer.setPortProperties(5);
+ var OmniaCybersystemsServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"omnia", organizationName:"Omnia Cybersystems", maxRam:64,
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(850, 950), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(900e6, 1e9),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(85, 95), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(60, 70), numOpenPortsRequired:5
+ });
+ OmniaCybersystemsServer.messages.push("history-of-synthoids.lit");
AddToAllServers(OmniaCybersystemsServer);
- var ZBDefenseServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "zb-def", "ZB Defense Industries", false, false, false, 2);
- ZBDefenseServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(775, 825), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(900000000, 1100000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(55, 65), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(65, 75));
- ZBDefenseServer.setPortProperties(4);
+ var ZBDefenseServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"zb-def", organizationName:"ZB Defense Industries",
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(775, 825), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(900e6, 1.1e9),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(55, 65), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(65, 75), numOpenPortsRequired:4
+ });
ZBDefenseServer.messages.push("synthetic-muscles.lit");
AddToAllServers(ZBDefenseServer);
- var AppliedEnergeticsServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "applied-energetics", "Applied Energetics", false, false, false, 0);
- AppliedEnergeticsServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(775, 850), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(700000000, 1000000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(60, 80), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(70, 75));
- AppliedEnergeticsServer.setPortProperties(4);
+ var AppliedEnergeticsServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"applied-energetics", organizationName:"Applied Energetics",
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(775, 850), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(700e6, 1e9),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(60, 80), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(70, 75), numOpenPortsRequired:4
+ });
AddToAllServers(AppliedEnergeticsServer);
- var SolarisSpaceSystemsServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "solaris", "Solaris Space Systems", false, false, false, 2);
- SolarisSpaceSystemsServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(750, 850), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(700000000, 900000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(70, 80), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(70, 80));
- SolarisSpaceSystemsServer.setPortProperties(5);
+ var SolarisSpaceSystemsServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"solaris", organizationName:"Solaris Space Systems", maxRam:64,
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(750, 850), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(700e6, 900e6),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(70, 80), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(70, 80), numOpenPortsRequired:5
+ });
SolarisSpaceSystemsServer.messages.push("A-Green-Tomorrow.lit");
SolarisSpaceSystemsServer.messages.push("the-failed-frontier.lit");
AddToAllServers(SolarisSpaceSystemsServer);
- var DeltaOneServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "deltaone", "Delta One", false, false, false, 0);
- DeltaOneServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(800, 900), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(1300000000, 1700000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(75, 85), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(50, 70));
- DeltaOneServer.setPortProperties(5);
+ var DeltaOneServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"deltaone", organizationName:"Delta One",
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(800, 900), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(1.3e9, 1.7e9),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(75, 85), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(50, 70), numOpenPortsRequired:5
+ });
AddToAllServers(DeltaOneServer);
//Health, medicine, pharmaceutical companies ("Large" targets)
- var GlobalPharmaceuticalsServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "global-pharm", "Global Pharmaceuticals", false, false, false, 16);
- GlobalPharmaceuticalsServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(750, 850), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(1500000000, 1750000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(75, 85), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(80, 90));
- GlobalPharmaceuticalsServer.setPortProperties(4);
+ var GlobalPharmaceuticalsServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"global-pharm", organizationName:"Global Pharmaceuticals", maxRam:32,
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(750, 850), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(1.5e9, 1.75e9),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(75, 85), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(80, 90), numOpenPortsRequired:4
+ });
GlobalPharmaceuticalsServer.messages.push("A-Green-Tomorrow.lit");
AddToAllServers(GlobalPharmaceuticalsServer);
- var NovaMedicalServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "nova-med", "Nova Medical", false, false, false, 0);
- NovaMedicalServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(775, 850), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(1100000000, 1250000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(60, 80), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(65, 85));
- NovaMedicalServer.setPortProperties(4);
+ var NovaMedicalServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"nova-med", organizationName:"Nova Medical",
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(775, 850), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(1.1e9, 1.25e9),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(60, 80), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(65, 85), numOpenPortsRequired:4
+ });
AddToAllServers(NovaMedicalServer);
- var ZeusMedicalServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "zeus-med", "Zeus Medical", false, false, false, 0);
- ZeusMedicalServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(800, 850), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(1300000000, 1500000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(70, 90), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(70, 80));
- ZeusMedicalServer.setPortProperties(5);
+ var ZeusMedicalServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"zeus-med", organizationName:"Zeus Medical",
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(800, 850), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(1.3e9, 1.5e9),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(70, 90), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(70, 80), numOpenPortsRequired:5
+ });
AddToAllServers(ZeusMedicalServer);
- var UnitaLifeGroupServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "unitalife", "UnitaLife Group", false, false, false, 32);
- UnitaLifeGroupServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(775, 825), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(1000000000, 1100000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(70, 80), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(70, 80));
- UnitaLifeGroupServer.setPortProperties(4);
+ var UnitaLifeGroupServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"unitalife", organizationName:"UnitaLife Group", maxRam:32,
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(775, 825), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(1e9, 1.1e9),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(70, 80), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(70, 80), numOpenPortsRequired:4
+ });
AddToAllServers(UnitaLifeGroupServer);
//"Medium level" targets
- var LexoCorpServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "lexo-corp", "Lexo Corporation", false, false, false, 16);
- LexoCorpServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(650, 750), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(700000000, 800000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(60, 80), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(55, 65));
- LexoCorpServer.setPortProperties(4);
+ var LexoCorpServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"lexo-corp", organizationName:"Lexo Corporation", maxRam:32,
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(650, 750), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(700e6, 800e6),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(60, 80), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(55, 65), numOpenPortsRequired:4
+ });
AddToAllServers(LexoCorpServer);
- var RhoConstructionServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "rho-construction", "Rho Construction", false, false, false, 0);
- RhoConstructionServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(475, 525), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(500000000, 700000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(40, 60), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(40, 60));
- RhoConstructionServer.setPortProperties(3);
+ var RhoConstructionServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"rho-construction", organizationName:"Rho Construction",
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(475, 525), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(500e6, 700e6),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(40, 60), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(40, 60), numOpenPortsRequired:3
+ });
AddToAllServers(RhoConstructionServer);
- var AlphaEnterprisesServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "alpha-ent", "Alpha Enterprises", false, false, false, 2);
- AlphaEnterprisesServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(500, 600), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(600000000, 750000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(50, 70), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(50, 60));
- AlphaEnterprisesServer.setPortProperties(4);
+ var AlphaEnterprisesServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"alpha-ent", organizationName:"Alpha Enterprises", maxRam:32,
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(500, 600), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(600e6, 750e6),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(50, 70), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(50, 60),numOpenPortsRequired:4
+ });
AlphaEnterprisesServer.messages.push("sector-12-crime.lit");
AddToAllServers(AlphaEnterprisesServer);
- var AevumPoliceServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "aevum-police", "Aevum Police Network", false, false, false, 0);
- AevumPoliceServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(400, 450), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(200000000, 400000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(70, 80), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(30, 50));
- AevumPoliceServer.setPortProperties(4);
+ var AevumPoliceServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"aevum-police", organizationName:"Aevum Police Network", maxRam:32,
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(400, 450), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(200e6, 400e6),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(70, 80), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(30, 50), numOpenPortsRequired:4
+ });
AddToAllServers(AevumPoliceServer);
- var RothmanUniversityServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "rothman-uni", "Rothman University Network", false, false, false, 4);
- RothmanUniversityServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(370, 430), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(175000000, 250000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(45, 55), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(35, 45));
- RothmanUniversityServer.setPortProperties(3);
+ var RothmanUniversityServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"rothman-uni", organizationName:"Rothman University Network", maxRam:64,
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(370, 430), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(175e6, 250e6),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(45, 55), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(35, 45), numOpenPortsRequired:3
+ });
RothmanUniversityServer.messages.push("secret-societies.lit");
RothmanUniversityServer.messages.push("the-failed-frontier.lit");
RothmanUniversityServer.messages.push("tensions-in-tech-race.lit");
AddToAllServers(RothmanUniversityServer);
- var ZBInstituteOfTechnologyServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "zb-institute", "ZB Institute of Technology Network", false, false, false, 4);
- ZBInstituteOfTechnologyServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(725, 775), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(800000000, 1100000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(65, 85), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(75, 85));
- ZBInstituteOfTechnologyServer.setPortProperties(5);
+ var ZBInstituteOfTechnologyServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"zb-institute", organizationName:"ZB Institute of Technology Network", maxRam:64,
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(725, 775), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(800e6, 1.1e9),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(65, 85), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(75, 85), numOpenPortsRequired:5
+ });
AddToAllServers(ZBInstituteOfTechnologyServer);
- var SummitUniversityServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "summit-uni", "Summit University Network", false, false, false, 4);
- SummitUniversityServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(425, 475), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(200000000, 350000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(45, 65), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(40, 60));
- SummitUniversityServer.setPortProperties(3);
+ var SummitUniversityServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"summit-uni", organizationName:"Summit University Network", maxRam:32,
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(425, 475), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(200e6, 350e6),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(45, 65), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(40, 60), numOpenPortsRequired:3
+ });
SummitUniversityServer.messages.push("secret-societies.lit");
SummitUniversityServer.messages.push("the-failed-frontier.lit");
SummitUniversityServer.messages.push("synthetic-muscles.lit");
AddToAllServers(SummitUniversityServer);
- var SysCoreSecuritiesServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "syscore", "SysCore Securities", false, false, false, 0);
- SysCoreSecuritiesServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(550, 650), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(400000000, 600000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(60, 80), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(60, 70));
- SysCoreSecuritiesServer.setPortProperties(4);
+ var SysCoreSecuritiesServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"syscore", organizationName:"SysCore Securities",
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(550, 650), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(400e6, 600e6),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(60, 80), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(60, 70), numOpenPortsRequired:4
+ });
AddToAllServers(SysCoreSecuritiesServer);
- var CatalystVenturesServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "catalyst", "Catalyst Ventures", false, false, false, 2);
- CatalystVenturesServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(400, 450), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(300000000, 550000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(60, 70), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(25, 55));
- CatalystVenturesServer.setPortProperties(3);
+ var CatalystVenturesServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"catalyst", organizationName:"Catalyst Ventures",
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(400, 450), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(300e6, 550e6),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(60, 70), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(25, 55), numOpenPortsRequired:3,
+ });
CatalystVenturesServer.messages.push("tensions-in-tech-race.lit");
AddToAllServers(CatalystVenturesServer);
- var TheHubServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "the-hub", "The Hub", false, false, false, 0);
- TheHubServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(275, 325), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(150000000, 200000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(35, 45), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(45, 55));
- TheHubServer.setPortProperties(2);
+ var TheHubServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"the-hub", organizationName:"The Hub",
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(275, 325), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(150e6, 200e6),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(35, 45), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(45, 55), numOpenPortsRequired:2
+ });
AddToAllServers(TheHubServer);
- var CompuTekServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "comptek", "CompuTek", false, false, false, 8);
- CompuTekServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(300, 400), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(220000000, 250000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(55, 65), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(45, 65));
- CompuTekServer.setPortProperties(3);
+ var CompuTekServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"comptek", organizationName:"CompuTek",
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(300, 400), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(220e6, 250e6),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(55, 65), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(45, 65), numOpenPortsRequired:3
+ });
CompuTekServer.messages.push("man-and-machine.lit");
AddToAllServers(CompuTekServer);
- var NetLinkTechnologiesServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "netlink", "NetLink Technologies", false, false, false, 2);
- NetLinkTechnologiesServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(375, 425), 275000000, Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(60, 80), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(45, 75));
- NetLinkTechnologiesServer.setPortProperties(3);
+ var NetLinkTechnologiesServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"netlink", organizationName:"NetLink Technologies", maxRam:64,
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(375, 425), moneyAvailable:275e6,
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(60, 80), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(45, 75), numOpenPortsRequired:3
+ });
NetLinkTechnologiesServer.messages.push("simulated-reality.lit");
AddToAllServers(NetLinkTechnologiesServer);
- var JohnsonOrthopedicsServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "johnson-ortho", "Johnson Orthopedics", false, false, false, 4);
- JohnsonOrthopedicsServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(250, 300), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(70000000, 85000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(35, 65), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(35, 65));
- JohnsonOrthopedicsServer.setPortProperties(2);
+ var JohnsonOrthopedicsServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"johnson-ortho", organizationName:"Johnson Orthopedics",
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(250, 300), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(70e6, 85e6),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(35, 65), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(35, 65), numOpenPortsRequired:2
+ });
AddToAllServers(JohnsonOrthopedicsServer);
//"Low level" targets
- var FoodNStuffServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "foodnstuff", "Food N Stuff Supermarket", false, false, false, 16);
- FoodNStuffServer.setHackingParameters(1, 2000000, 10, 5);
- FoodNStuffServer.setPortProperties(0);
+ var FoodNStuffServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"foodnstuff", organizationName:"Food N Stuff Supermarket", maxRam:16,
+ requiredHackingSkill:1, moneyAvailable:2e6,
+ hackDifficulty:10, serverGrowth:5, numOpenPortsRequired:0
+ });
FoodNStuffServer.messages.push("sector-12-crime.lit");
AddToAllServers(FoodNStuffServer);
- var SigmaCosmeticsServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "sigma-cosmetics", "Sigma Cosmetics", false, false, false, 16);
- SigmaCosmeticsServer.setHackingParameters(5, 2300000, 10, 10);
- SigmaCosmeticsServer.setPortProperties(0);
+ var SigmaCosmeticsServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"sigma-cosmetics", organizationName:"Sigma Cosmetics", maxRam:16,
+ requiredHackingSkill:5, moneyAvailable:2.3e6,
+ hackDifficulty:10, serverGrowth:10, numOpenPortsRequired:0
+ });
AddToAllServers(SigmaCosmeticsServer);
- var JoesGunsServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "joesguns", "Joe's Guns", false, false, false, 16);
- JoesGunsServer.setHackingParameters(10, 2500000, 15, 20);
- JoesGunsServer.setPortProperties(0);
+ var JoesGunsServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"joesguns", organizationName:"Joe's Guns", maxRam:16,
+ requiredHackingSkill:10, moneyAvailable:2.5e6,
+ hackDifficulty:15, serverGrowth:20, numOpenPortsRequired:0
+ });
AddToAllServers(JoesGunsServer);
- var Zer0NightclubServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "zer0", "ZER0 Nightclub", false, false, false, 32);
- Zer0NightclubServer.setHackingParameters(75, 7500000, 25, 40);
- Zer0NightclubServer.setPortProperties(1);
+ var Zer0NightclubServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"zer0", organizationName:"ZER0 Nightclub", maxRam:32,
+ requiredHackingSkill:75, moneyAvailable:7.5e6,
+ hackDifficulty:25, serverGrowth:40, numOpenPortsRequired:1
+ });
AddToAllServers(Zer0NightclubServer);
- var NectarNightclubServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "nectar-net", "Nectar Nightclub Network", false, false, false, 8);
- NectarNightclubServer.setHackingParameters(20, 2750000, 20, 25);
+ var NectarNightclubServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"nectar-net", organizationName:"Nectar Nightclub Network", maxRam:16,
+ requiredHackingSkill:20, moneyAvailable:2.75e6,
+ hackDifficulty:20, serverGrowth:25, numOpenPortsRequired:0
+ });
NectarNightclubServer.setPortProperties(0);
AddToAllServers(NectarNightclubServer);
- var NeoNightclubServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "neo-net", "Neo Nightclub Network", false, false, false, 32);
- NeoNightclubServer.setHackingParameters(50, 5000000, 25, 25);
- NeoNightclubServer.setPortProperties(1);
+ var NeoNightclubServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"neo-net", organizationName:"Neo Nightclub Network", maxRam:32,
+ requiredHackingSkill:50, moneyAvailable:5e6,
+ hackDifficulty:25, serverGrowth:25, numOpenPortsRequired:1
+ });
NeoNightclubServer.messages.push("the-hidden-world.lit");
AddToAllServers(NeoNightclubServer);
- var SilverHelixServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "silver-helix", "Silver Helix", false, false, false, 64);
- SilverHelixServer.setHackingParameters(150, 45000000, 30, 30);
- SilverHelixServer.setPortProperties(2);
+ var SilverHelixServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"silver-helix", organizationName:"Silver Helix", maxRam:64,
+ requiredHackingSkill:150, moneyAvailable:45e6,
+ hackDifficulty:30, serverGrowth:30, numOpenPortsRequired:2
+ });
SilverHelixServer.messages.push("new-triads.lit");
AddToAllServers(SilverHelixServer);
- var HongFangTeaHouseServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "hong-fang-tea", "HongFang Teahouse", false, false, false, 16);
- HongFangTeaHouseServer.setHackingParameters(30, 3000000, 15, 20);
- HongFangTeaHouseServer.setPortProperties(0);
+ var HongFangTeaHouseServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"hong-fang-tea", organizationName:"HongFang Teahouse", maxRam:16,
+ requiredHackingSkill:30, moneyAvailable:3e6,
+ hackDifficulty:15, serverGrowth:20, numOpenPortsRequired:0
+ });
HongFangTeaHouseServer.messages.push("brighter-than-the-sun.lit");
AddToAllServers(HongFangTeaHouseServer);
- var HaraKiriSushiBarServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "harakiri-sushi", "HaraKiri Sushi Bar Network", false, false, false, 16);
- HaraKiriSushiBarServer.setHackingParameters(40, 4000000, 15, 40);
- HaraKiriSushiBarServer.setPortProperties(0);
+ var HaraKiriSushiBarServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"harakiri-sushi", organizationName:"HaraKiri Sushi Bar Network",maxRam:16,
+ requiredHackingSkill:40, moneyAvailable:4e6,
+ hackDifficulty:15, serverGrowth:40, numOpenPortsRequired:0
+ });
AddToAllServers(HaraKiriSushiBarServer);
- var PhantasyServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "phantasy", "Phantasy Club", false, false, false, 32);
- PhantasyServer.setHackingParameters(100, 24000000, 20, 35);
- PhantasyServer.setPortProperties(2);
+ var PhantasyServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"phantasy", organizationName:"Phantasy Club", maxRam:32,
+ requiredHackingSkill:100, moneyAvailable:24e6,
+ hackDifficulty:20, serverGrowth:35, numOpenPortsRequired:2
+ });
AddToAllServers(PhantasyServer);
- var MaxHardwareServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "max-hardware", "Max Hardware Store", false, false, false, 32);
- MaxHardwareServer.setHackingParameters(80, 10000000, 15, 30);
- MaxHardwareServer.setPortProperties(1);
+ var MaxHardwareServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"max-hardware", organizationName:"Max Hardware Store", maxRam:32,
+ requiredHackingSkill:80, moneyAvailable:10e6,
+ hackDifficulty:15, serverGrowth:30, numOpenPortsRequired:1,
+ });
AddToAllServers(MaxHardwareServer);
- var OmegaSoftwareServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "omega-net", "Omega Software", false, false, false, 32);
- OmegaSoftwareServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(180, 220), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(60000000, 70000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(25, 35), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(30, 40));
- OmegaSoftwareServer.setPortProperties(2);
+ var OmegaSoftwareServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"omega-net", organizationName:"Omega Software", maxRam:32,
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(180, 220), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(60e6, 70e6),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(25, 35), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(30, 40), numOpenPortsRequired:2
+ });
OmegaSoftwareServer.messages.push("the-new-god.lit");
AddToAllServers(OmegaSoftwareServer);
//Gyms
- var CrushFitnessGymServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "crush-fitness", "Crush Fitness", false, false, false, 0);
- CrushFitnessGymServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(225, 275), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(40000000, 60000000), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(35, 45), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(27, 33));
- CrushFitnessGymServer.setPortProperties(2);
+ var CrushFitnessGymServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"crush-fitness", organizationName:"Crush Fitness",
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(225, 275), moneyAvailable:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(40e6, 60e6),
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(35, 45), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(27, 33), numOpenPortsRequired:2
+ });
AddToAllServers(CrushFitnessGymServer);
- var IronGymServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "iron-gym", "Iron Gym Network", false, false, false, 32);
- IronGymServer.setHackingParameters(100, 20000000, 30, 20);
- IronGymServer.setPortProperties(1);
+ var IronGymServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"iron-gym", organizationName:"Iron Gym Network", maxRam:32,
+ requiredHackingSkill:100, moneyAvailable:20e6,
+ hackDifficulty:30, serverGrowth:20, numOpenPortsRequired:1
+ });
AddToAllServers(IronGymServer);
- var MilleniumFitnessGymServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "millenium-fitness", "Millenium Fitness Network", false, false, false, 0);
- MilleniumFitnessGymServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(475, 525), 250000000, Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(45, 55), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(25, 45));
- MilleniumFitnessGymServer.setPortProperties(3);
+ var MilleniumFitnessGymServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"millenium-fitness", organizationName:"Millenium Fitness Network",
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(475, 525), moneyAvailable:250e6,
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(45, 55), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(25, 45), numOpenPortsRequired:3,
+ });
AddToAllServers(MilleniumFitnessGymServer);
- var PowerhouseGymServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "powerhouse-fitness", "Powerhouse Fitness", false, false, false, 0);
- PowerhouseGymServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(950, 1100), 900000000, Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(55, 65), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(50, 60));
- PowerhouseGymServer.setPortProperties(5);
+ var PowerhouseGymServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"powerhouse-fitness", organizationName:"Powerhouse Fitness",
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(950, 1100), moneyAvailable:900e6,
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(55, 65), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(50, 60), numOpenPortsRequired:5,
+ });
AddToAllServers(PowerhouseGymServer);
- var SnapFitnessGymServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "snap-fitness", "Snap Fitness", false, false, false, 0);
- SnapFitnessGymServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(675, 800), 450000000, Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(40, 60), Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(40, 60));
- SnapFitnessGymServer.setPortProperties(4);
+ var SnapFitnessGymServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"snap-fitness", organizationName:"Snap Fitness",
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(675, 800), moneyAvailable:450e6,
+ hackDifficulty:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(40, 60), serverGrowth:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(40, 60), numOpenPortsRequired:4
+ });
AddToAllServers(SnapFitnessGymServer);
- //Faction servers, cannot hack money from these
- var BitRunnersServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "run4theh111z", "The Runners", false, false, false, 2);
- BitRunnersServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(505, 550), 0, 0, 0);
- BitRunnersServer.setPortProperties(4);
+ //Faction servers, cannot hack money from these
+ var BitRunnersServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"run4theh111z", organizationName:"The Runners", maxRam:128,
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(505, 550), moneyAvailable:0,
+ hackDifficulty:0, serverGrowth:0, numOpenPortsRequired:4
+ });
BitRunnersServer.messages.push("simulated-reality.lit");
BitRunnersServer.messages.push("the-new-god.lit");
- AddToAllServers(BitRunnersServer);
+ AddToAllServers(BitRunnersServer);
_SpecialServerIps_js__WEBPACK_IMPORTED_MODULE_5__["SpecialServerIps"].addIp(_SpecialServerIps_js__WEBPACK_IMPORTED_MODULE_5__["SpecialServerNames"].BitRunnersServer, BitRunnersServer.ip);
- var TheBlackHandServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "I.I.I.I", "I.I.I.I", false, false, false, 2);
- TheBlackHandServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(340, 365), 0, 0, 0);
- TheBlackHandServer.setPortProperties(3);
+ var TheBlackHandServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"I.I.I.I", organizationName:"I.I.I.I", maxRam:64,
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(340, 365), moneyAvailable:0,
+ hackDifficulty:0, serverGrowth:0, numOpenPortsRequired:3,
+ });
TheBlackHandServer.messages.push("democracy-is-dead.lit");
AddToAllServers(TheBlackHandServer);
_SpecialServerIps_js__WEBPACK_IMPORTED_MODULE_5__["SpecialServerIps"].addIp(_SpecialServerIps_js__WEBPACK_IMPORTED_MODULE_5__["SpecialServerNames"].TheBlackHandServer, TheBlackHandServer.ip);
- var NiteSecServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "avmnite-02h", "NiteSec", false, false, false, 2);
- NiteSecServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(202, 220), 0, 0, 0);
- NiteSecServer.setPortProperties(2);
+ var NiteSecServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"avmnite-02h", organizationName:"NiteSec", maxRam:32,
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(202, 220), moneyAvailable:0,
+ hackDifficulty:0, serverGrowth:0, numOpenPortsRequired:2
+ });
NiteSecServer.messages.push("democracy-is-dead.lit");
- AddToAllServers(NiteSecServer);
+ AddToAllServers(NiteSecServer);
_SpecialServerIps_js__WEBPACK_IMPORTED_MODULE_5__["SpecialServerIps"].addIp(_SpecialServerIps_js__WEBPACK_IMPORTED_MODULE_5__["SpecialServerNames"].NiteSecServer, NiteSecServer.ip);
- var DarkArmyServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), ".", ".", false, false, false, 0);
- DarkArmyServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(505, 550), 0, 0, 0);
- DarkArmyServer.setPortProperties(4);
- AddToAllServers(DarkArmyServer);
+ var DarkArmyServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:".", organizationName:".", maxRam:16,
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(505, 550), moneyAvailable:0,
+ hackDifficulty:0, serverGrowth:0, numOpenPortsRequired:4
+ });
+ AddToAllServers(DarkArmyServer);
_SpecialServerIps_js__WEBPACK_IMPORTED_MODULE_5__["SpecialServerIps"].addIp(_SpecialServerIps_js__WEBPACK_IMPORTED_MODULE_5__["SpecialServerNames"].TheDarkArmyServer, DarkArmyServer.ip);
- var CyberSecServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "CSEC", "CyberSec", false, false, false, 2);
- CyberSecServer.setHackingParameters(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(51, 60), 0, 0, 0);
- CyberSecServer.setPortProperties(1);
+ var CyberSecServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"CSEC", organizationName:"CyberSec", maxRam:8,
+ requiredHackingSkill:Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(51, 60), moneyAvailable:0,
+ hackDifficulty:0, serverGrowth:0, numOpenPortsRequired:1
+ });
CyberSecServer.messages.push("democracy-is-dead.lit");
- AddToAllServers(CyberSecServer);
+ AddToAllServers(CyberSecServer);
_SpecialServerIps_js__WEBPACK_IMPORTED_MODULE_5__["SpecialServerIps"].addIp(_SpecialServerIps_js__WEBPACK_IMPORTED_MODULE_5__["SpecialServerNames"].CyberSecServer, CyberSecServer.ip);
- var DaedalusServer = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), "The-Cave", "Helios", false, false, false, 2);
- DaedalusServer.setHackingParameters(925, 0, 0, 0);
- DaedalusServer.setPortProperties(5);
+ var DaedalusServer = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:"The-Cave", organizationName:"Helios",
+ requiredHackingSkill:925, moneyAvailable:0,
+ hackDifficulty:0, serverGrowth:0, numOpenPortsRequired:5
+ });
DaedalusServer.messages.push("alpha-omega.lit");
AddToAllServers(DaedalusServer);
_SpecialServerIps_js__WEBPACK_IMPORTED_MODULE_5__["SpecialServerIps"].addIp(_SpecialServerIps_js__WEBPACK_IMPORTED_MODULE_5__["SpecialServerNames"].DaedalusServer, DaedalusServer.ip);
//Super special Servers
- var WorldDaemon = new Server(Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), _SpecialServerIps_js__WEBPACK_IMPORTED_MODULE_5__["SpecialServerNames"].WorldDaemon, _SpecialServerIps_js__WEBPACK_IMPORTED_MODULE_5__["SpecialServerNames"].WorldDaemon, false, false, false, 0);
- WorldDaemon.setHackingParameters(3000, 0, 0, 0);
- WorldDaemon.setPortProperties(5);
+ var WorldDaemon = new Server({
+ ip:Object(_utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_7__["createRandomIp"])(), hostname:_SpecialServerIps_js__WEBPACK_IMPORTED_MODULE_5__["SpecialServerNames"].WorldDaemon, organizationName:_SpecialServerIps_js__WEBPACK_IMPORTED_MODULE_5__["SpecialServerNames"].WorldDaemon,
+ requiredHackingSkill:3000, moneyAvailable:0,
+ hackDifficulty:0, serverGrowth:0, numOpenPortsRequired:5
+ });
AddToAllServers(WorldDaemon);
_SpecialServerIps_js__WEBPACK_IMPORTED_MODULE_5__["SpecialServerIps"].addIp(_SpecialServerIps_js__WEBPACK_IMPORTED_MODULE_5__["SpecialServerNames"].WorldDaemon, WorldDaemon.ip);
@@ -11100,7 +11242,7 @@ function initForeignServers() {
//Applied server growth for a single server. Returns the percentage growth
function processSingleServerGrowth(server, numCycles) {
//Server growth processed once every 450 game cycles
- var numServerGrowthCycles = Math.max(Math.floor(numCycles / 450), 0);
+ var numServerGrowthCycles = Math.max(Math.floor(numCycles / 450), 0);
//Get adjusted growth rate, which accounts for server security
var growthRate = _Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].ServerBaseGrowthRate;
@@ -11165,11 +11307,11 @@ function loadAllServers(saveString) {
}
function SizeOfAllServers() {
- var size = 0, key;
- for (key in AllServers) {
- if (AllServers.hasOwnProperty(key)) size++;
- }
- return size;
+ var size = 0, key;
+ for (key in AllServers) {
+ if (AllServers.hasOwnProperty(key)) size++;
+ }
+ return size;
}
//Add a server onto the map of all servers in the game
@@ -11186,16 +11328,16 @@ function AddToAllServers(server) {
}
//Returns server object with corresponding hostname
-// Relatively slow, would rather not use this a lot
+// Relatively slow, would rather not use this a lot
function GetServerByHostname(hostname) {
- for (var ip in AllServers) {
- if (AllServers.hasOwnProperty(ip)) {
- if (AllServers[ip].hostname == hostname) {
- return AllServers[ip];
- }
- }
- }
- return null;
+ for (var ip in AllServers) {
+ if (AllServers.hasOwnProperty(ip)) {
+ if (AllServers[ip].hostname == hostname) {
+ return AllServers[ip];
+ }
+ }
+ }
+ return null;
}
//Get server by IP or hostname. Returns null if invalid
@@ -11249,412 +11391,6 @@ Directory.prototype.getPath = function(name) {
/***/ }),
/* 11 */
-/*!***************************!*\
- !*** ./utils/YesNoBox.js ***!
- \***************************/
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "yesNoBoxCreate", function() { return yesNoBoxCreate; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "yesNoTxtInpBoxCreate", function() { return yesNoTxtInpBoxCreate; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "yesNoBoxGetYesButton", function() { return yesNoBoxGetYesButton; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "yesNoBoxGetNoButton", function() { return yesNoBoxGetNoButton; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "yesNoTxtInpBoxGetYesButton", function() { return yesNoTxtInpBoxGetYesButton; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "yesNoTxtInpBoxGetNoButton", function() { return yesNoTxtInpBoxGetNoButton; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "yesNoTxtInpBoxGetInput", function() { return yesNoTxtInpBoxGetInput; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "yesNoBoxClose", function() { return yesNoBoxClose; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "yesNoTxtInpBoxClose", function() { return yesNoTxtInpBoxClose; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "yesNoBoxOpen", function() { return yesNoBoxOpen; });
-/* harmony import */ var _HelperFunctions_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./HelperFunctions.js */ 1);
-
-/* Generic Yes-No Pop-up box
- * Can be used to create pop-up boxes that require a yes/no response from player
- */
-var yesNoBoxOpen = false;
-function yesNoBoxClose() {
- var container = document.getElementById("yes-no-box-container");
- if (container) {
- container.style.display = "none";
- } else {
- console.log("ERROR: Container not found for YesNoBox");
- }
- yesNoBoxOpen = false;
- return false; //So that 'return yesNoBoxClose()' is return false in event listeners
-}
-
-function yesNoBoxGetYesButton() {
- return Object(_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_0__["clearEventListeners"])("yes-no-box-yes");
-}
-
-function yesNoBoxGetNoButton() {
- return Object(_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_0__["clearEventListeners"])("yes-no-box-no");
-}
-
-function yesNoBoxCreate(txt) {
- if (yesNoBoxOpen) {return false;} //Already open
- yesNoBoxOpen = true;
- var textElement = document.getElementById("yes-no-box-text");
- if (textElement) {
- textElement.innerHTML = txt;
- }
-
- var c = document.getElementById("yes-no-box-container");
- if (c) {
- c.style.display = "block";
- } else {
- console.log("ERROR: Container not found for YesNoBox");
- }
- return true;
-}
-
-/* Generic Yes-No POp-up Box with Text input */
-function yesNoTxtInpBoxClose() {
- var c = document.getElementById("yes-no-text-input-box-container");
- if (c) {
- c.style.display = "none";
- } else {
- console.log("ERROR: Container not found for YesNoTextInputBox");
- }
- yesNoBoxOpen = false;
- document.getElementById("yes-no-text-input-box-input").value = "";
- return false;
-}
-
-function yesNoTxtInpBoxGetYesButton() {
- return Object(_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_0__["clearEventListeners"])("yes-no-text-input-box-yes");
-}
-
-function yesNoTxtInpBoxGetNoButton() {
- return Object(_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_0__["clearEventListeners"])("yes-no-text-input-box-no");
-}
-
-function yesNoTxtInpBoxGetInput() {
- var val = document.getElementById("yes-no-text-input-box-input").value;
- val = val.replace(/\s+/g, '');
- return val;
-}
-
-function yesNoTxtInpBoxCreate(txt) {
- yesNoBoxOpen = true;
- var txtE = document.getElementById("yes-no-text-input-box-text");
- if (txtE) {
- txtE.innerHTML = txt;
- }
-
- var c = document.getElementById("yes-no-text-input-box-container");
- if (c) {
- c.style.display = "block";
- } else {
- console.log("ERROR: Container not found for YesNoTextInputBox");
- }
-
- document.getElementById("yes-no-text-input-box-input").focus();
-}
-
-
-
-
-/***/ }),
-/* 12 */
-/*!******************************!*\
- !*** ./utils/numeral.min.js ***!
- \******************************/
-/***/ (function(module, exports, __webpack_require__) {
-
-var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! @preserve
- * numeral.js
- * version : 2.0.6
- * author : Adam Draper
- * license : MIT
- * http://adamwdraper.github.com/Numeral-js/
- */
-!function(a,b){ true?!(__WEBPACK_AMD_DEFINE_FACTORY__ = (b),
- __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
- (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
- __WEBPACK_AMD_DEFINE_FACTORY__),
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)):undefined}(this,function(){function a(a,b){this._input=a,this._value=b}var b,c,d="2.0.6",e={},f={},g={currentLocale:"en",zeroFormat:null,nullFormat:null,defaultFormat:"0,0",scalePercentBy100:!0},h={currentLocale:g.currentLocale,zeroFormat:g.zeroFormat,nullFormat:g.nullFormat,defaultFormat:g.defaultFormat,scalePercentBy100:g.scalePercentBy100};return b=function(d){var f,g,i,j;if(b.isNumeral(d))f=d.value();else if(0===d||"undefined"==typeof d)f=0;else if(null===d||c.isNaN(d))f=null;else if("string"==typeof d)if(h.zeroFormat&&d===h.zeroFormat)f=0;else if(h.nullFormat&&d===h.nullFormat||!d.replace(/[^0-9]+/g,"").length)f=null;else{for(g in e)if(j="function"==typeof e[g].regexps.unformat?e[g].regexps.unformat():e[g].regexps.unformat,j&&d.match(j)){i=e[g].unformat;break}i=i||b._.stringToNumber,f=i(d)}else f=Number(d)||null;return new a(d,f)},b.version=d,b.isNumeral=function(b){return b instanceof a},b._=c={numberToFormat:function(a,c,d){var e,g,h,i,j,k,l,m=f[b.options.currentLocale],n=!1,o=!1,p=0,q="",r=1e12,s=1e9,t=1e6,u=1e3,v="",w=!1;if(a=a||0,g=Math.abs(a),b._.includes(c,"(")?(n=!0,c=c.replace(/[\(|\)]/g,"")):(b._.includes(c,"+")||b._.includes(c,"-"))&&(j=b._.includes(c,"+")?c.indexOf("+"):0>a?c.indexOf("-"):-1,c=c.replace(/[\+|\-]/g,"")),b._.includes(c,"a")&&(e=c.match(/a(k|m|b|t)?/),e=e?e[1]:!1,b._.includes(c," a")&&(q=" "),c=c.replace(new RegExp(q+"a[kmbt]?"),""),g>=r&&!e||"t"===e?(q+=m.abbreviations.trillion,a/=r):r>g&&g>=s&&!e||"b"===e?(q+=m.abbreviations.billion,a/=s):s>g&&g>=t&&!e||"m"===e?(q+=m.abbreviations.million,a/=t):(t>g&&g>=u&&!e||"k"===e)&&(q+=m.abbreviations.thousand,a/=u)),b._.includes(c,"[.]")&&(o=!0,c=c.replace("[.]",".")),h=a.toString().split(".")[0],i=c.split(".")[1],k=c.indexOf(","),p=(c.split(".")[0].split(",")[0].match(/0/g)||[]).length,i?(b._.includes(i,"[")?(i=i.replace("]",""),i=i.split("["),v=b._.toFixed(a,i[0].length+i[1].length,d,i[1].length)):v=b._.toFixed(a,i.length,d),h=v.split(".")[0],v=b._.includes(v,".")?m.delimiters.decimal+v.split(".")[1]:"",o&&0===Number(v.slice(1))&&(v="")):h=b._.toFixed(a,0,d),q&&!e&&Number(h)>=1e3&&q!==m.abbreviations.trillion)switch(h=String(Number(h)/1e3),q){case m.abbreviations.thousand:q=m.abbreviations.million;break;case m.abbreviations.million:q=m.abbreviations.billion;break;case m.abbreviations.billion:q=m.abbreviations.trillion}if(b._.includes(h,"-")&&(h=h.slice(1),w=!0),h.length
0;x--)h="0"+h;return k>-1&&(h=h.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+m.delimiters.thousands)),0===c.indexOf(".")&&(h=""),l=h+v+(q?q:""),n?l=(n&&w?"(":"")+l+(n&&w?")":""):j>=0?l=0===j?(w?"-":"+")+l:l+(w?"-":"+"):w&&(l="-"+l),l},stringToNumber:function(a){var b,c,d,e=f[h.currentLocale],g=a,i={thousand:3,million:6,billion:9,trillion:12};if(h.zeroFormat&&a===h.zeroFormat)c=0;else if(h.nullFormat&&a===h.nullFormat||!a.replace(/[^0-9]+/g,"").length)c=null;else{c=1,"."!==e.delimiters.decimal&&(a=a.replace(/\./g,"").replace(e.delimiters.decimal,"."));for(b in i)if(d=new RegExp("[^a-zA-Z]"+e.abbreviations[b]+"(?:\\)|(\\"+e.currency.symbol+")?(?:\\))?)?$"),g.match(d)){c*=Math.pow(10,i[b]);break}c*=(a.split("-").length+Math.min(a.split("(").length-1,a.split(")").length-1))%2?1:-1,a=a.replace(/[^0-9\.]+/g,""),c*=Number(a)}return c},isNaN:function(a){return"number"==typeof a&&isNaN(a)},includes:function(a,b){return-1!==a.indexOf(b)},insert:function(a,b,c){return a.slice(0,c)+b+a.slice(c)},reduce:function(a,b){if(null===this)throw new TypeError("Array.prototype.reduce called on null or undefined");if("function"!=typeof b)throw new TypeError(b+" is not a function");var c,d=Object(a),e=d.length>>>0,f=0;if(3===arguments.length)c=arguments[2];else{for(;e>f&&!(f in d);)f++;if(f>=e)throw new TypeError("Reduce of empty array with no initial value");c=d[f++]}for(;e>f;f++)f in d&&(c=b(c,d[f],f,d));return c},multiplier:function(a){var b=a.toString().split(".");return b.length<2?1:Math.pow(10,b[1].length)},correctionFactor:function(){var a=Array.prototype.slice.call(arguments);return a.reduce(function(a,b){var d=c.multiplier(b);return a>d?a:d},1)},toFixed:function(a,b,c,d){var e,f,g,h,i=a.toString().split("."),j=b-(d||0);return e=2===i.length?Math.min(Math.max(i[1].length,j),b):j,g=Math.pow(10,e),h=(c(a+"e+"+e)/g).toFixed(e),d>b-e&&(f=new RegExp("\\.?0{1,"+(d-(b-e))+"}$"),h=h.replace(f,"")),h}},b.options=h,b.formats=e,b.locales=f,b.locale=function(a){return a&&(h.currentLocale=a.toLowerCase()),h.currentLocale},b.localeData=function(a){if(!a)return f[h.currentLocale];if(a=a.toLowerCase(),!f[a])throw new Error("Unknown locale : "+a);return f[a]},b.reset=function(){for(var a in g)h[a]=g[a]},b.zeroFormat=function(a){h.zeroFormat="string"==typeof a?a:null},b.nullFormat=function(a){h.nullFormat="string"==typeof a?a:null},b.defaultFormat=function(a){h.defaultFormat="string"==typeof a?a:"0.0"},b.register=function(a,b,c){if(b=b.toLowerCase(),this[a+"s"][b])throw new TypeError(b+" "+a+" already registered.");return this[a+"s"][b]=c,c},b.validate=function(a,c){var d,e,f,g,h,i,j,k;if("string"!=typeof a&&(a+="",console.warn&&console.warn("Numeral.js: Value is not string. It has been co-erced to: ",a)),a=a.trim(),a.match(/^\d+$/))return!0;if(""===a)return!1;try{j=b.localeData(c)}catch(l){j=b.localeData(b.locale())}return f=j.currency.symbol,h=j.abbreviations,d=j.delimiters.decimal,e="."===j.delimiters.thousands?"\\.":j.delimiters.thousands,k=a.match(/^[^\d]+/),null!==k&&(a=a.substr(1),k[0]!==f)?!1:(k=a.match(/[^\d]+$/),null!==k&&(a=a.slice(0,-1),k[0]!==h.thousand&&k[0]!==h.million&&k[0]!==h.billion&&k[0]!==h.trillion)?!1:(i=new RegExp(e+"{2}"),a.match(/[^\d.,]/g)?!1:(g=a.split(d),g.length>2?!1:g.length<2?!!g[0].match(/^\d+.*\d$/)&&!g[0].match(i):1===g[0].length?!!g[0].match(/^\d+$/)&&!g[0].match(i)&&!!g[1].match(/^\d+$/):!!g[0].match(/^\d+.*\d$/)&&!g[0].match(i)&&!!g[1].match(/^\d+$/))))},b.fn=a.prototype={clone:function(){return b(this)},format:function(a,c){var d,f,g,i=this._value,j=a||h.defaultFormat;if(c=c||Math.round,0===i&&null!==h.zeroFormat)f=h.zeroFormat;else if(null===i&&null!==h.nullFormat)f=h.nullFormat;else{for(d in e)if(j.match(e[d].regexps.format)){g=e[d].format;break}g=g||b._.numberToFormat,f=g(i,j,c)}return f},value:function(){return this._value},input:function(){return this._input},set:function(a){return this._value=Number(a),this},add:function(a){function b(a,b,c,e){return a+Math.round(d*b)}var d=c.correctionFactor.call(null,this._value,a);return this._value=c.reduce([this._value,a],b,0)/d,this},subtract:function(a){function b(a,b,c,e){return a-Math.round(d*b)}var d=c.correctionFactor.call(null,this._value,a);return this._value=c.reduce([a],b,Math.round(this._value*d))/d,this},multiply:function(a){function b(a,b,d,e){var f=c.correctionFactor(a,b);return Math.round(a*f)*Math.round(b*f)/Math.round(f*f)}return this._value=c.reduce([this._value,a],b,1),this},divide:function(a){function b(a,b,d,e){var f=c.correctionFactor(a,b);return Math.round(a*f)/Math.round(b*f)}return this._value=c.reduce([this._value,a],b),this},difference:function(a){return Math.abs(b(this._value).subtract(a).value())}},b.register("locale","en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(a){var b=a%10;return 1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th"},currency:{symbol:"$"}}),function(){b.register("format","bps",{regexps:{format:/(BPS)/,unformat:/(BPS)/},format:function(a,c,d){var e,f=b._.includes(c," BPS")?" ":"";return a=1e4*a,c=c.replace(/\s?BPS/,""),e=b._.numberToFormat(a,c,d),b._.includes(e,")")?(e=e.split(""),e.splice(-1,0,f+"BPS"),e=e.join("")):e=e+f+"BPS",e},unformat:function(a){return+(1e-4*b._.stringToNumber(a)).toFixed(15)}})}(),function(){var a={base:1e3,suffixes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]},c={base:1024,suffixes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},d=a.suffixes.concat(c.suffixes.filter(function(b){return a.suffixes.indexOf(b)<0})),e=d.join("|");e="("+e.replace("B","B(?!PS)")+")",b.register("format","bytes",{regexps:{format:/([0\s]i?b)/,unformat:new RegExp(e)},format:function(d,e,f){var g,h,i,j,k=b._.includes(e,"ib")?c:a,l=b._.includes(e," b")||b._.includes(e," ib")?" ":"";for(e=e.replace(/\s?i?b/,""),h=0;h<=k.suffixes.length;h++)if(i=Math.pow(k.base,h),j=Math.pow(k.base,h+1),null===d||0===d||d>=i&&j>d){l+=k.suffixes[h],i>0&&(d/=i);break}return g=b._.numberToFormat(d,e,f),g+l},unformat:function(d){var e,f,g=b._.stringToNumber(d);if(g){for(e=a.suffixes.length-1;e>=0;e--){if(b._.includes(d,a.suffixes[e])){f=Math.pow(a.base,e);break}if(b._.includes(d,c.suffixes[e])){f=Math.pow(c.base,e);break}}g*=f||1}return g}})}(),function(){b.register("format","currency",{regexps:{format:/(\$)/},format:function(a,c,d){var e,f,g,h=b.locales[b.options.currentLocale],i={before:c.match(/^([\+|\-|\(|\s|\$]*)/)[0],after:c.match(/([\+|\-|\)|\s|\$]*)$/)[0]};for(c=c.replace(/\s?\$\s?/,""),e=b._.numberToFormat(a,c,d),a>=0?(i.before=i.before.replace(/[\-\(]/,""),i.after=i.after.replace(/[\-\)]/,"")):0>a&&!b._.includes(i.before,"-")&&!b._.includes(i.before,"(")&&(i.before="-"+i.before),g=0;g 0;x--)h="0"+h;return k>-1&&(h=h.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+m.delimiters.thousands)),0===c.indexOf(".")&&(h=""),l=h+v+(q?q:""),n?l=(n&&w?"(":"")+l+(n&&w?")":""):j>=0?l=0===j?(w?"-":"+")+l:l+(w?"-":"+"):w&&(l="-"+l),l},stringToNumber:function(a){var b,c,d,e=f[h.currentLocale],g=a,i={thousand:3,million:6,billion:9,trillion:12};if(h.zeroFormat&&a===h.zeroFormat)c=0;else if(h.nullFormat&&a===h.nullFormat||!a.replace(/[^0-9]+/g,"").length)c=null;else{c=1,"."!==e.delimiters.decimal&&(a=a.replace(/\./g,"").replace(e.delimiters.decimal,"."));for(b in i)if(d=new RegExp("[^a-zA-Z]"+e.abbreviations[b]+"(?:\\)|(\\"+e.currency.symbol+")?(?:\\))?)?$"),g.match(d)){c*=Math.pow(10,i[b]);break}c*=(a.split("-").length+Math.min(a.split("(").length-1,a.split(")").length-1))%2?1:-1,a=a.replace(/[^0-9\.]+/g,""),c*=Number(a)}return c},isNaN:function(a){return"number"==typeof a&&isNaN(a)},includes:function(a,b){return-1!==a.indexOf(b)},insert:function(a,b,c){return a.slice(0,c)+b+a.slice(c)},reduce:function(a,b){if(null===this)throw new TypeError("Array.prototype.reduce called on null or undefined");if("function"!=typeof b)throw new TypeError(b+" is not a function");var c,d=Object(a),e=d.length>>>0,f=0;if(3===arguments.length)c=arguments[2];else{for(;e>f&&!(f in d);)f++;if(f>=e)throw new TypeError("Reduce of empty array with no initial value");c=d[f++]}for(;e>f;f++)f in d&&(c=b(c,d[f],f,d));return c},multiplier:function(a){var b=a.toString().split(".");return b.length<2?1:Math.pow(10,b[1].length)},correctionFactor:function(){var a=Array.prototype.slice.call(arguments);return a.reduce(function(a,b){var d=c.multiplier(b);return a>d?a:d},1)},toFixed:function(a,b,c,d){var e,f,g,h,i=a.toString().split("."),j=b-(d||0);return e=2===i.length?Math.min(Math.max(i[1].length,j),b):j,g=Math.pow(10,e),h=(c(a+"e+"+e)/g).toFixed(e),d>b-e&&(f=new RegExp("\\.?0{1,"+(d-(b-e))+"}$"),h=h.replace(f,"")),h}},b.options=h,b.formats=e,b.locales=f,b.locale=function(a){return a&&(h.currentLocale=a.toLowerCase()),h.currentLocale},b.localeData=function(a){if(!a)return f[h.currentLocale];if(a=a.toLowerCase(),!f[a])throw new Error("Unknown locale : "+a);return f[a]},b.reset=function(){for(var a in g)h[a]=g[a]},b.zeroFormat=function(a){h.zeroFormat="string"==typeof a?a:null},b.nullFormat=function(a){h.nullFormat="string"==typeof a?a:null},b.defaultFormat=function(a){h.defaultFormat="string"==typeof a?a:"0.0"},b.register=function(a,b,c){if(b=b.toLowerCase(),this[a+"s"][b])throw new TypeError(b+" "+a+" already registered.");return this[a+"s"][b]=c,c},b.validate=function(a,c){var d,e,f,g,h,i,j,k;if("string"!=typeof a&&(a+="",console.warn&&console.warn("Numeral.js: Value is not string. It has been co-erced to: ",a)),a=a.trim(),a.match(/^\d+$/))return!0;if(""===a)return!1;try{j=b.localeData(c)}catch(l){j=b.localeData(b.locale())}return f=j.currency.symbol,h=j.abbreviations,d=j.delimiters.decimal,e="."===j.delimiters.thousands?"\\.":j.delimiters.thousands,k=a.match(/^[^\d]+/),null!==k&&(a=a.substr(1),k[0]!==f)?!1:(k=a.match(/[^\d]+$/),null!==k&&(a=a.slice(0,-1),k[0]!==h.thousand&&k[0]!==h.million&&k[0]!==h.billion&&k[0]!==h.trillion)?!1:(i=new RegExp(e+"{2}"),a.match(/[^\d.,]/g)?!1:(g=a.split(d),g.length>2?!1:g.length<2?!!g[0].match(/^\d+.*\d$/)&&!g[0].match(i):1===g[0].length?!!g[0].match(/^\d+$/)&&!g[0].match(i)&&!!g[1].match(/^\d+$/):!!g[0].match(/^\d+.*\d$/)&&!g[0].match(i)&&!!g[1].match(/^\d+$/))))},b.fn=a.prototype={clone:function(){return b(this)},format:function(a,c){var d,f,g,i=this._value,j=a||h.defaultFormat;if(c=c||Math.round,0===i&&null!==h.zeroFormat)f=h.zeroFormat;else if(null===i&&null!==h.nullFormat)f=h.nullFormat;else{for(d in e)if(j.match(e[d].regexps.format)){g=e[d].format;break}g=g||b._.numberToFormat,f=g(i,j,c)}return f},value:function(){return this._value},input:function(){return this._input},set:function(a){return this._value=Number(a),this},add:function(a){function b(a,b,c,e){return a+Math.round(d*b)}var d=c.correctionFactor.call(null,this._value,a);return this._value=c.reduce([this._value,a],b,0)/d,this},subtract:function(a){function b(a,b,c,e){return a-Math.round(d*b)}var d=c.correctionFactor.call(null,this._value,a);return this._value=c.reduce([a],b,Math.round(this._value*d))/d,this},multiply:function(a){function b(a,b,d,e){var f=c.correctionFactor(a,b);return Math.round(a*f)*Math.round(b*f)/Math.round(f*f)}return this._value=c.reduce([this._value,a],b,1),this},divide:function(a){function b(a,b,d,e){var f=c.correctionFactor(a,b);return Math.round(a*f)/Math.round(b*f)}return this._value=c.reduce([this._value,a],b),this},difference:function(a){return Math.abs(b(this._value).subtract(a).value())}},b.register("locale","en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(a){var b=a%10;return 1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th"},currency:{symbol:"$"}}),function(){b.register("format","bps",{regexps:{format:/(BPS)/,unformat:/(BPS)/},format:function(a,c,d){var e,f=b._.includes(c," BPS")?" ":"";return a=1e4*a,c=c.replace(/\s?BPS/,""),e=b._.numberToFormat(a,c,d),b._.includes(e,")")?(e=e.split(""),e.splice(-1,0,f+"BPS"),e=e.join("")):e=e+f+"BPS",e},unformat:function(a){return+(1e-4*b._.stringToNumber(a)).toFixed(15)}})}(),function(){var a={base:1e3,suffixes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]},c={base:1024,suffixes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},d=a.suffixes.concat(c.suffixes.filter(function(b){return a.suffixes.indexOf(b)<0})),e=d.join("|");e="("+e.replace("B","B(?!PS)")+")",b.register("format","bytes",{regexps:{format:/([0\s]i?b)/,unformat:new RegExp(e)},format:function(d,e,f){var g,h,i,j,k=b._.includes(e,"ib")?c:a,l=b._.includes(e," b")||b._.includes(e," ib")?" ":"";for(e=e.replace(/\s?i?b/,""),h=0;h<=k.suffixes.length;h++)if(i=Math.pow(k.base,h),j=Math.pow(k.base,h+1),null===d||0===d||d>=i&&j>d){l+=k.suffixes[h],i>0&&(d/=i);break}return g=b._.numberToFormat(d,e,f),g+l},unformat:function(d){var e,f,g=b._.stringToNumber(d);if(g){for(e=a.suffixes.length-1;e>=0;e--){if(b._.includes(d,a.suffixes[e])){f=Math.pow(a.base,e);break}if(b._.includes(d,c.suffixes[e])){f=Math.pow(c.base,e);break}}g*=f||1}return g}})}(),function(){b.register("format","currency",{regexps:{format:/(\$)/},format:function(a,c,d){var e,f,g,h=b.locales[b.options.currentLocale],i={before:c.match(/^([\+|\-|\(|\s|\$]*)/)[0],after:c.match(/([\+|\-|\)|\s|\$]*)$/)[0]};for(c=c.replace(/\s?\$\s?/,""),e=b._.numberToFormat(a,c,d),a>=0?(i.before=i.before.replace(/[\-\(]/,""),i.after=i.after.replace(/[\-\)]/,"")):0>a&&!b._.includes(i.before,"-")&&!b._.includes(i.before,"(")&&(i.before="-"+i.before),g=0;g " + mat.name + ": " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(mat.qty, 3) +
- "(" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(totalGain, 3) + "/s)" +
- "Buy: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(mat.buy, 3) +
- "/s MP: $" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(mat.bCost, 2) +
- "Market Price: The price you would pay if " +
- "you were to buy this material on the market Quality: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(mat.qlt, 2) +
- "The quality of your material. Higher quality " +
- "will lead to more sales " + product.name + ": " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(product.data[city][0], 3) + //Quantity
- "(" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(totalGain, 3) + "/s)" +
- "Prod: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(product.data[city][1], 3) + "/s Rating: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(product.rat, 3) +
- "Quality: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(product.qlt, 3) + " Est. Production Cost: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(product.pCost / ProductProductionCostRatio).format("$0.000a") +
- "An estimate of the material cost it takes to create this Product. Est. Market Price: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(product.pCost + product.rat / product.mku).format("$0.000a") +
- "An estimate of how much consumers are willing to pay for this product. " +
- "Setting the sale price above this may result in less sales. Setting the sale price below this may result " +
- "in more sales. Advertising Multiplier: x" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(totalAdvertisingFac, 3) +
- "Total multiplier for this industry's sales due to its awareness and popularity " + mat.name + ": " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(mat.qty, 3) +
+ "(" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(totalGain, 3) + "/s)" +
+ "Buy: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(mat.buy, 3) +
+ "/s MP: $" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(mat.bCost, 2) +
+ "Market Price: The price you would pay if " +
+ "you were to buy this material on the market Quality: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(mat.qlt, 2) +
+ "The quality of your material. Higher quality " +
+ "will lead to more sales " + product.name + ": " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(product.data[city][0], 3) + //Quantity
+ "(" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(totalGain, 3) + "/s)" +
+ "Prod: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(product.data[city][1], 3) + "/s Rating: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(product.rat, 3) +
+ "Quality: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(product.qlt, 3) + " Est. Production Cost: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(product.pCost / ProductProductionCostRatio).format("$0.000a") +
+ "An estimate of the material cost it takes to create this Product. Est. Market Price: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(product.pCost + product.rat / product.mku).format("$0.000a") +
+ "An estimate of how much consumers are willing to pay for this product. " +
+ "Setting the sale price above this may result in less sales. Setting the sale price below this may result " +
+ "in more sales. Advertising Multiplier: x" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(totalAdvertisingFac, 3) +
+ "Total multiplier for this industry's sales due to its awareness and popularity
" + e);
+ workerScripts[i].env.stopFlag = true;
+ continue;
+ }
+
+ workerScripts[i].running = true;
+ var p = Object(_NetscriptEvaluator_js__WEBPACK_IMPORTED_MODULE_4__["evaluate"])(ast, workerScripts[i]);
+ //Once the code finishes (either resolved or rejected, doesnt matter), set its
+ //running status to false
+ p.then(function(w) {
+ console.log("Stopping script " + w.name + " because it finished running naturally");
+ w.running = false;
+ w.env.stopFlag = true;
+ w.scriptRef.log("Script finished running");
+ }).catch(function(w) {
+ if (w instanceof Error) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_9__["dialogBoxCreate"])("Script runtime unknown error. This is a bug please contact game developer");
+ console.log("ERROR: Evaluating workerscript returns an Error. THIS SHOULDN'T HAPPEN: " + w.toString());
+ return;
+ } else if (w.constructor === Array && w.length === 2 && w[0] === "RETURNSTATEMENT") {
+ //Script ends with a return statement
+ console.log("Script returning with value: " + w[1]);
+ //TODO maybe do something with this in the future
+ return;
+ } else if (w instanceof WorkerScript) {
+ if (Object(_NetscriptEvaluator_js__WEBPACK_IMPORTED_MODULE_4__["isScriptErrorMessage"])(w.errorMessage)) {
+ var errorTextArray = w.errorMessage.split("|");
+ if (errorTextArray.length != 4) {
+ console.log("ERROR: Something wrong with Error text in evaluator...");
+ console.log("Error text: " + errorText);
+ return;
+ }
+ var serverIp = errorTextArray[1];
+ var scriptName = errorTextArray[2];
+ var errorMsg = errorTextArray[3];
+
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_9__["dialogBoxCreate"])("Script runtime error:
Server Ip: " + serverIp +
+ "
Script name: " + scriptName +
+ "
Args:" + Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_10__["printArray"])(w.args) + "
" + errorMsg);
+ w.scriptRef.log("Script crashed with runtime error");
+ } else {
+ w.scriptRef.log("Script killed");
+ }
+ w.running = false;
+ w.env.stopFlag = true;
+
+ } else if (Object(_NetscriptEvaluator_js__WEBPACK_IMPORTED_MODULE_4__["isScriptErrorMessage"])(w)) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_9__["dialogBoxCreate"])("Script runtime unknown error. This is a bug please contact game developer");
+ console.log("ERROR: Evaluating workerscript returns only error message rather than WorkerScript object. THIS SHOULDN'T HAPPEN: " + w.toString());
+ return;
+ } else {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_9__["dialogBoxCreate"])("An unknown script died for an unknown reason. This is a bug please contact game dev");
+ }
+ });
+ }
+ }
+
+ setTimeout(runScriptsLoop, 6000);
+}
+
+//Queues a script to be killed by settings its stop flag to true. Then, the code will reject
+//all of its promises recursively, and when it does so it will no longer be running.
+//The runScriptsLoop() will then delete the script from worker scripts
+function killWorkerScript(runningScriptObj, serverIp) {
+ for (var i = 0; i < workerScripts.length; i++) {
+ if (workerScripts[i].name == runningScriptObj.filename && workerScripts[i].serverIp == serverIp &&
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_10__["compareArrays"])(workerScripts[i].args, runningScriptObj.args)) {
+ workerScripts[i].env.stopFlag = true;
+ Object(_NetscriptEvaluator_js__WEBPACK_IMPORTED_MODULE_4__["killNetscriptDelay"])(workerScripts[i]);
+ //Recursively kill all functions
+ var curr = workerScripts[i];
+ while (curr.fnWorker) {
+ curr.fnWorker.env.stopFlag = true;
+ Object(_NetscriptEvaluator_js__WEBPACK_IMPORTED_MODULE_4__["killNetscriptDelay"])(curr.fnWorker);
+ curr = curr.fnWorker;
+ }
+ return true;
+ }
+ }
+ return false;
+}
+
+//Queues a script to be run
+function addWorkerScript(runningScriptObj, server) {
+ var filename = runningScriptObj.filename;
+
+ //Update server's ram usage
+ var threads = 1;
+ if (runningScriptObj.threads && !isNaN(runningScriptObj.threads)) {
+ threads = runningScriptObj.threads;
+ } else {
+ runningScriptObj.threads = 1;
+ }
+ var ramUsage = runningScriptObj.scriptRef.ramUsage * threads
+ * Math.pow(_Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].MultithreadingRAMCost, threads-1);
+ var ramAvailable = server.maxRam - server.ramUsed;
+ if (ramUsage > ramAvailable) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_9__["dialogBoxCreate"])("Not enough RAM to run script " + runningScriptObj.filename + " with args " +
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_10__["printArray"])(runningScriptObj.args) + ". This likely occurred because you re-loaded " +
+ "the game and the script's RAM usage increased (either because of an update to the game or " +
+ "your changes to the script.)");
+ return;
+ }
+ server.ramUsed += ramUsage;
+
+ //Create the WorkerScript
+ var s = new WorkerScript(runningScriptObj);
+ s.serverIp = server.ip;
+ s.ramUsage = ramUsage;
+
+ //Add the WorkerScript to the Active Scripts list
+ Object(_ActiveScriptsUI_js__WEBPACK_IMPORTED_MODULE_0__["addActiveScriptsItem"])(s);
+
+ //Add the WorkerScript
+ workerScripts.push(s);
+ return;
+}
+
+//Updates the online running time stat of all running scripts
+function updateOnlineScriptTimes(numCycles = 1) {
+ var time = (numCycles * _engine_js__WEBPACK_IMPORTED_MODULE_2__["Engine"]._idleSpeed) / 1000; //seconds
+ for (var i = 0; i < workerScripts.length; ++i) {
+ workerScripts[i].scriptRef.onlineRunningTime += time;
+ }
+}
+
+
+
+
+/***/ }),
+/* 21 */
/*!****************************!*\
!*** ./src/StockMarket.js ***!
\****************************/
@@ -16256,16 +16647,16 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Constants.js */ 3);
/* harmony import */ var _engine_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./engine.js */ 5);
/* harmony import */ var _Location_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Location.js */ 4);
-/* harmony import */ var _NetscriptFunctions_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./NetscriptFunctions.js */ 30);
-/* harmony import */ var _NetscriptWorker_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./NetscriptWorker.js */ 21);
+/* harmony import */ var _NetscriptFunctions_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./NetscriptFunctions.js */ 29);
+/* harmony import */ var _NetscriptWorker_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./NetscriptWorker.js */ 20);
/* harmony import */ var _Player_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Player.js */ 0);
/* harmony import */ var _utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../utils/DialogBox.js */ 6);
/* harmony import */ var _utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../utils/HelperFunctions.js */ 1);
/* harmony import */ var _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../utils/JSONReviver.js */ 8);
-/* harmony import */ var _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../utils/numeral.min.js */ 12);
+/* harmony import */ var _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../utils/numeral.min.js */ 13);
/* harmony import */ var _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_9__);
/* harmony import */ var _utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../utils/StringHelperFunctions.js */ 2);
-/* harmony import */ var _utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../utils/YesNoBox.js */ 11);
+/* harmony import */ var _utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../utils/YesNoBox.js */ 12);
@@ -17597,255 +17988,6 @@ function updateStockOrderList(stock) {
-/***/ }),
-/* 21 */
-/*!********************************!*\
- !*** ./src/NetscriptWorker.js ***!
- \********************************/
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WorkerScript", function() { return WorkerScript; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "workerScripts", function() { return workerScripts; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NetscriptPorts", function() { return NetscriptPorts; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "runScriptsLoop", function() { return runScriptsLoop; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "killWorkerScript", function() { return killWorkerScript; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addWorkerScript", function() { return addWorkerScript; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateOnlineScriptTimes", function() { return updateOnlineScriptTimes; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "prestigeWorkerScripts", function() { return prestigeWorkerScripts; });
-/* harmony import */ var _ActiveScriptsUI_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ActiveScriptsUI.js */ 42);
-/* harmony import */ var _Constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Constants.js */ 3);
-/* harmony import */ var _engine_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./engine.js */ 5);
-/* harmony import */ var _NetscriptEnvironment_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./NetscriptEnvironment.js */ 65);
-/* harmony import */ var _NetscriptEvaluator_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./NetscriptEvaluator.js */ 7);
-/* harmony import */ var _NetscriptPort_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./NetscriptPort.js */ 43);
-/* harmony import */ var _Server_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Server.js */ 10);
-/* harmony import */ var _Settings_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Settings.js */ 24);
-/* harmony import */ var _utils_acorn_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../utils/acorn.js */ 36);
-/* harmony import */ var _utils_acorn_js__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_utils_acorn_js__WEBPACK_IMPORTED_MODULE_8__);
-/* harmony import */ var _utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../utils/DialogBox.js */ 6);
-/* harmony import */ var _utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../utils/HelperFunctions.js */ 1);
-
-
-
-
-
-
-
-
-
-
-
-
-
-function WorkerScript(runningScriptObj) {
- this.name = runningScriptObj.filename;
- this.running = false;
- this.serverIp = null;
- this.code = runningScriptObj.scriptRef.code;
- this.env = new _NetscriptEnvironment_js__WEBPACK_IMPORTED_MODULE_3__["Environment"](this);
- this.env.set("args", runningScriptObj.args.slice());
- this.output = "";
- this.ramUsage = 0;
- this.scriptRef = runningScriptObj;
- this.errorMessage = "";
- this.args = runningScriptObj.args.slice();
- this.delay = null;
- this.fnWorker = null; //Workerscript for a function call
- this.checkingRam = false;
- this.loadedFns = {}; //Stores names of fns that are "loaded" by this script, thus using RAM
- this.disableLogs = {}; //Stores names of fns that should have logs disabled
-}
-
-//Returns the server on which the workerScript is running
-WorkerScript.prototype.getServer = function() {
- return _Server_js__WEBPACK_IMPORTED_MODULE_6__["AllServers"][this.serverIp];
-}
-
-//Array containing all scripts that are running across all servers, to easily run them all
-let workerScripts = [];
-
-var NetscriptPorts = [];
-for (var i = 0; i < _Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].NumNetscriptPorts; ++i) {
- NetscriptPorts.push(new _NetscriptPort_js__WEBPACK_IMPORTED_MODULE_5__["NetscriptPort"]());
-}
-
-function prestigeWorkerScripts() {
- for (var i = 0; i < workerScripts.length; ++i) {
- Object(_ActiveScriptsUI_js__WEBPACK_IMPORTED_MODULE_0__["deleteActiveScriptsItem"])(workerScripts[i]);
- workerScripts[i].env.stopFlag = true;
- }
- workerScripts.length = 0;
-}
-
-//Loop through workerScripts and run every script that is not currently running
-function runScriptsLoop() {
- //Delete any scripts that finished or have been killed. Loop backwards bc removing
- //items fucks up the indexing
- for (var i = workerScripts.length - 1; i >= 0; i--) {
- if (workerScripts[i].running == false && workerScripts[i].env.stopFlag == true) {
- //Delete script from the runningScripts array on its host serverIp
- var ip = workerScripts[i].serverIp;
- var name = workerScripts[i].name;
-
- //Free RAM
- _Server_js__WEBPACK_IMPORTED_MODULE_6__["AllServers"][ip].ramUsed -= workerScripts[i].ramUsage;
-
- //Delete script from Active Scripts
- Object(_ActiveScriptsUI_js__WEBPACK_IMPORTED_MODULE_0__["deleteActiveScriptsItem"])(workerScripts[i]);
-
- for (var j = 0; j < _Server_js__WEBPACK_IMPORTED_MODULE_6__["AllServers"][ip].runningScripts.length; j++) {
- if (_Server_js__WEBPACK_IMPORTED_MODULE_6__["AllServers"][ip].runningScripts[j].filename == name &&
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_10__["compareArrays"])(_Server_js__WEBPACK_IMPORTED_MODULE_6__["AllServers"][ip].runningScripts[j].args, workerScripts[i].args)) {
- _Server_js__WEBPACK_IMPORTED_MODULE_6__["AllServers"][ip].runningScripts.splice(j, 1);
- break;
- }
- }
-
- //Delete script from workerScripts
- workerScripts.splice(i, 1);
- }
- }
-
- //Run any scripts that haven't been started
- for (var i = 0; i < workerScripts.length; i++) {
- //If it isn't running, start the script
- if (workerScripts[i].running == false && workerScripts[i].env.stopFlag == false) {
- try {
- var ast = Object(_utils_acorn_js__WEBPACK_IMPORTED_MODULE_8__["parse"])(workerScripts[i].code, {sourceType:"module"});
- //console.log(ast);
- } catch (e) {
- console.log("Error parsing script: " + workerScripts[i].name);
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_9__["dialogBoxCreate"])("Syntax ERROR in " + workerScripts[i].name + ":
" + e);
- workerScripts[i].env.stopFlag = true;
- continue;
- }
-
- workerScripts[i].running = true;
- var p = Object(_NetscriptEvaluator_js__WEBPACK_IMPORTED_MODULE_4__["evaluate"])(ast, workerScripts[i]);
- //Once the code finishes (either resolved or rejected, doesnt matter), set its
- //running status to false
- p.then(function(w) {
- console.log("Stopping script " + w.name + " because it finished running naturally");
- w.running = false;
- w.env.stopFlag = true;
- w.scriptRef.log("Script finished running");
- }).catch(function(w) {
- if (w instanceof Error) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_9__["dialogBoxCreate"])("Script runtime unknown error. This is a bug please contact game developer");
- console.log("ERROR: Evaluating workerscript returns an Error. THIS SHOULDN'T HAPPEN: " + w.toString());
- return;
- } else if (w.constructor === Array && w.length === 2 && w[0] === "RETURNSTATEMENT") {
- //Script ends with a return statement
- console.log("Script returning with value: " + w[1]);
- //TODO maybe do something with this in the future
- return;
- } else if (w instanceof WorkerScript) {
- if (Object(_NetscriptEvaluator_js__WEBPACK_IMPORTED_MODULE_4__["isScriptErrorMessage"])(w.errorMessage)) {
- var errorTextArray = w.errorMessage.split("|");
- if (errorTextArray.length != 4) {
- console.log("ERROR: Something wrong with Error text in evaluator...");
- console.log("Error text: " + errorText);
- return;
- }
- var serverIp = errorTextArray[1];
- var scriptName = errorTextArray[2];
- var errorMsg = errorTextArray[3];
-
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_9__["dialogBoxCreate"])("Script runtime error:
Server Ip: " + serverIp +
- "
Script name: " + scriptName +
- "
Args:" + Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_10__["printArray"])(w.args) + "
" + errorMsg);
- w.scriptRef.log("Script crashed with runtime error");
- } else {
- w.scriptRef.log("Script killed");
- }
- w.running = false;
- w.env.stopFlag = true;
-
- } else if (Object(_NetscriptEvaluator_js__WEBPACK_IMPORTED_MODULE_4__["isScriptErrorMessage"])(w)) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_9__["dialogBoxCreate"])("Script runtime unknown error. This is a bug please contact game developer");
- console.log("ERROR: Evaluating workerscript returns only error message rather than WorkerScript object. THIS SHOULDN'T HAPPEN: " + w.toString());
- return;
- } else {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_9__["dialogBoxCreate"])("An unknown script died for an unknown reason. This is a bug please contact game dev");
- }
- });
- }
- }
-
- setTimeout(runScriptsLoop, 6000);
-}
-
-//Queues a script to be killed by settings its stop flag to true. Then, the code will reject
-//all of its promises recursively, and when it does so it will no longer be running.
-//The runScriptsLoop() will then delete the script from worker scripts
-function killWorkerScript(runningScriptObj, serverIp) {
- for (var i = 0; i < workerScripts.length; i++) {
- if (workerScripts[i].name == runningScriptObj.filename && workerScripts[i].serverIp == serverIp &&
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_10__["compareArrays"])(workerScripts[i].args, runningScriptObj.args)) {
- workerScripts[i].env.stopFlag = true;
- Object(_NetscriptEvaluator_js__WEBPACK_IMPORTED_MODULE_4__["killNetscriptDelay"])(workerScripts[i]);
- //Recursively kill all functions
- var curr = workerScripts[i];
- while (curr.fnWorker) {
- curr.fnWorker.env.stopFlag = true;
- Object(_NetscriptEvaluator_js__WEBPACK_IMPORTED_MODULE_4__["killNetscriptDelay"])(curr.fnWorker);
- curr = curr.fnWorker;
- }
- return true;
- }
- }
- return false;
-}
-
-//Queues a script to be run
-function addWorkerScript(runningScriptObj, server) {
- var filename = runningScriptObj.filename;
-
- //Update server's ram usage
- var threads = 1;
- if (runningScriptObj.threads && !isNaN(runningScriptObj.threads)) {
- threads = runningScriptObj.threads;
- } else {
- runningScriptObj.threads = 1;
- }
- var ramUsage = runningScriptObj.scriptRef.ramUsage * threads
- * Math.pow(_Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].MultithreadingRAMCost, threads-1);
- var ramAvailable = server.maxRam - server.ramUsed;
- if (ramUsage > ramAvailable) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_9__["dialogBoxCreate"])("Not enough RAM to run script " + runningScriptObj.filename + " with args " +
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_10__["printArray"])(runningScriptObj.args) + ". This likely occurred because you re-loaded " +
- "the game and the script's RAM usage increased (either because of an update to the game or " +
- "your changes to the script.)");
- return;
- }
- server.ramUsed += ramUsage;
-
- //Create the WorkerScript
- var s = new WorkerScript(runningScriptObj);
- s.serverIp = server.ip;
- s.ramUsage = ramUsage;
-
- //Add the WorkerScript to the Active Scripts list
- Object(_ActiveScriptsUI_js__WEBPACK_IMPORTED_MODULE_0__["addActiveScriptsItem"])(s);
-
- //Add the WorkerScript
- workerScripts.push(s);
- return;
-}
-
-//Updates the online running time stat of all running scripts
-function updateOnlineScriptTimes(numCycles = 1) {
- var time = (numCycles * _engine_js__WEBPACK_IMPORTED_MODULE_2__["Engine"]._idleSpeed) / 1000; //seconds
- for (var i = 0; i < workerScripts.length; ++i) {
- workerScripts[i].scriptRef.onlineRunningTime += time;
- }
-}
-
-
-
-
/***/ }),
/* 22 */
/*!*************************!*\
@@ -17859,9 +18001,9 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "post", function() { return post; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Terminal", function() { return Terminal; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "KEY", function() { return KEY; });
-/* harmony import */ var _Alias_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Alias.js */ 28);
+/* harmony import */ var _Alias_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Alias.js */ 30);
/* harmony import */ var _Constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Constants.js */ 3);
-/* harmony import */ var _CreateProgram_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./CreateProgram.js */ 13);
+/* harmony import */ var _CreateProgram_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./CreateProgram.js */ 14);
/* harmony import */ var _DarkWeb_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./DarkWeb.js */ 33);
/* harmony import */ var _engine_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./engine.js */ 5);
/* harmony import */ var _Fconf_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Fconf.js */ 34);
@@ -17870,21 +18012,21 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Literature_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Literature.js */ 53);
/* harmony import */ var _Message_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./Message.js */ 27);
/* harmony import */ var _NetscriptEvaluator_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./NetscriptEvaluator.js */ 7);
-/* harmony import */ var _NetscriptWorker_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./NetscriptWorker.js */ 21);
+/* harmony import */ var _NetscriptWorker_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./NetscriptWorker.js */ 20);
/* harmony import */ var _Player_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./Player.js */ 0);
-/* harmony import */ var _RedPill_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./RedPill.js */ 49);
-/* harmony import */ var _Script_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./Script.js */ 29);
+/* harmony import */ var _RedPill_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./RedPill.js */ 44);
+/* harmony import */ var _Script_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./Script.js */ 28);
/* harmony import */ var _Server_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./Server.js */ 10);
/* harmony import */ var _Settings_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./Settings.js */ 24);
/* harmony import */ var _SpecialServerIps_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./SpecialServerIps.js */ 17);
-/* harmony import */ var _TextFile_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./TextFile.js */ 39);
+/* harmony import */ var _TextFile_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./TextFile.js */ 41);
/* harmony import */ var _utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../utils/StringHelperFunctions.js */ 2);
/* harmony import */ var _utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../utils/HelperFunctions.js */ 1);
-/* harmony import */ var _utils_LogBox_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../utils/LogBox.js */ 50);
-/* harmony import */ var _utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../utils/YesNoBox.js */ 11);
-/* harmony import */ var jszip__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! jszip */ 111);
+/* harmony import */ var _utils_LogBox_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../utils/LogBox.js */ 51);
+/* harmony import */ var _utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../utils/YesNoBox.js */ 12);
+/* harmony import */ var jszip__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! jszip */ 114);
/* harmony import */ var jszip__WEBPACK_IMPORTED_MODULE_23___default = /*#__PURE__*/__webpack_require__.n(jszip__WEBPACK_IMPORTED_MODULE_23__);
-/* harmony import */ var file_saver__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! file-saver */ 110);
+/* harmony import */ var file_saver__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! file-saver */ 113);
/* harmony import */ var file_saver__WEBPACK_IMPORTED_MODULE_24___default = /*#__PURE__*/__webpack_require__.n(file_saver__WEBPACK_IMPORTED_MODULE_24__);
@@ -19899,7 +20041,7 @@ let Terminal = {
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ 41)))
+/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ 38)))
/***/ }),
/* 23 */
@@ -25682,10 +25824,10 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "initMessages", function() { return initMessages; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Message", function() { return Message; });
/* harmony import */ var _Augmentations_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Augmentations.js */ 18);
-/* harmony import */ var _CreateProgram_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./CreateProgram.js */ 13);
+/* harmony import */ var _CreateProgram_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./CreateProgram.js */ 14);
/* harmony import */ var _Missions_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Missions.js */ 32);
/* harmony import */ var _Player_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Player.js */ 0);
-/* harmony import */ var _RedPill_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./RedPill.js */ 49);
+/* harmony import */ var _RedPill_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./RedPill.js */ 44);
/* harmony import */ var _Server_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Server.js */ 10);
/* harmony import */ var _Settings_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Settings.js */ 24);
/* harmony import */ var _utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../utils/DialogBox.js */ 6);
@@ -25885,139 +26027,6 @@ function initMessages() {
/***/ }),
/* 28 */
-/*!**********************!*\
- !*** ./src/Alias.js ***!
- \**********************/
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Aliases", function() { return Aliases; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GlobalAliases", function() { return GlobalAliases; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "printAliases", function() { return printAliases; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseAliasDeclaration", function() { return parseAliasDeclaration; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeAlias", function() { return removeAlias; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "substituteAliases", function() { return substituteAliases; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "loadAliases", function() { return loadAliases; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "loadGlobalAliases", function() { return loadGlobalAliases; });
-/* harmony import */ var _Terminal_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Terminal.js */ 22);
-
-
-let Aliases = {};
-let GlobalAliases = {};
-
-function loadAliases(saveString) {
- if (saveString === "") {
- Aliases = {};
- } else {
- Aliases = JSON.parse(saveString);
- }
-}
-
-function loadGlobalAliases(saveString) {
- if (saveString === "") {
- GlobalAliases = {};
- } else {
- GlobalAliases = JSON.parse(saveString);
- }
-}
-
-//Print all aliases to terminal
-function printAliases() {
- for (var name in Aliases) {
- if (Aliases.hasOwnProperty(name)) {
- Object(_Terminal_js__WEBPACK_IMPORTED_MODULE_0__["post"])("alias " + name + "=" + Aliases[name]);
- }
- }
- for (var name in GlobalAliases) {
- if (GlobalAliases.hasOwnProperty(name)) {
- Object(_Terminal_js__WEBPACK_IMPORTED_MODULE_0__["post"])("global alias " + name + "=" + GlobalAliases[name]);
- }
- }
-}
-
-//True if successful, false otherwise
-function parseAliasDeclaration(dec,global=false) {
- var re = /^([_|\w|!|%|,|@]+)="(.+)"$/;
- var matches = dec.match(re);
- if (matches == null || matches.length != 3) {return false;}
- if (global){
- addGlobalAlias(matches[1],matches[2]);
- } else {
- addAlias(matches[1], matches[2]);
- }
- return true;
-}
-
-function addAlias(name, value) {
- if (name in GlobalAliases){
- delete GlobalAliases[name];
- }
- Aliases[name] = value;
-}
-
-function addGlobalAlias(name, value) {
- if (name in Aliases){
- delete Aliases[name];
- }
- GlobalAliases[name] = value;
-}
-
-function getAlias(name) {
- if (Aliases.hasOwnProperty(name)) {
- return Aliases[name];
- }
- return null;
-}
-
-function getGlobalAlias(name) {
- if (GlobalAliases.hasOwnProperty(name)) {
- return GlobalAliases[name];
- }
- return null;
-}
-
-function removeAlias(name) {
- if (Aliases.hasOwnProperty(name)) {
- delete Aliases[name];
- return true;
- }
- if (GlobalAliases.hasOwnProperty(name)) {
- delete GlobalAliases[name];
- return true;
- }
- return false;
-}
-
-//Returns the original string with any aliases substituted in
-//Aliases only applied to "whole words", one level deep
-function substituteAliases(origCommand) {
- var commandArray = origCommand.split(" ");
- if (commandArray.length>0){
- var alias = getAlias(commandArray[0]);
- if (alias != null) {
- commandArray[0] = alias;
- } else {
- var alias = getGlobalAlias(commandArray[0]);
- if (alias != null) {
- commandArray[0] = alias;
- }
- }
- for (var i = 0; i < commandArray.length; ++i) {
- var alias = getGlobalAlias(commandArray[i]);
- if (alias != null) {
- commandArray[i] = alias;
- }
- }
- }
- return commandArray.join(" ");
-}
-
-
-
-
-/***/ }),
-/* 29 */
/*!***********************!*\
!*** ./src/Script.js ***!
\***********************/
@@ -26037,14 +26046,14 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Fconf_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Fconf.js */ 34);
/* harmony import */ var _InteractiveTutorial_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./InteractiveTutorial.js */ 25);
/* harmony import */ var _NetscriptEvaluator_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./NetscriptEvaluator.js */ 7);
-/* harmony import */ var _NetscriptFunctions_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./NetscriptFunctions.js */ 30);
-/* harmony import */ var _NetscriptWorker_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./NetscriptWorker.js */ 21);
+/* harmony import */ var _NetscriptFunctions_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./NetscriptFunctions.js */ 29);
+/* harmony import */ var _NetscriptWorker_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./NetscriptWorker.js */ 20);
/* harmony import */ var _Player_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Player.js */ 0);
/* harmony import */ var _Server_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Server.js */ 10);
/* harmony import */ var _Settings_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./Settings.js */ 24);
/* harmony import */ var _Terminal_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./Terminal.js */ 22);
-/* harmony import */ var _TextFile_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./TextFile.js */ 39);
-/* harmony import */ var _utils_acorn_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../utils/acorn.js */ 36);
+/* harmony import */ var _TextFile_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./TextFile.js */ 41);
+/* harmony import */ var _utils_acorn_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../utils/acorn.js */ 35);
/* harmony import */ var _utils_acorn_js__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(_utils_acorn_js__WEBPACK_IMPORTED_MODULE_12__);
/* harmony import */ var _utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../utils/DialogBox.js */ 6);
/* harmony import */ var _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../utils/JSONReviver.js */ 8);
@@ -26276,7 +26285,7 @@ function updateScriptEditorContent() {
$(document).keydown(function(e) {
if (_engine_js__WEBPACK_IMPORTED_MODULE_1__["Engine"].currentPage == _engine_js__WEBPACK_IMPORTED_MODULE_1__["Engine"].Page.ScriptEditor) {
//Ctrl + b
- if (e.keyCode == 66 && e.ctrlKey) {
+ if (e.keyCode == 66 && (e.ctrlKey || e.metaKey)) {
e.preventDefault();
saveAndCloseScriptEditor();
}
@@ -26761,10 +26770,10 @@ _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_14__["Reviver"].constructors.AllS
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ 41)))
+/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ 38)))
/***/ }),
-/* 30 */
+/* 29 */
/*!***********************************!*\
!*** ./src/NetscriptFunctions.js ***!
\***********************************/
@@ -26781,41 +26790,41 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hasCorporationSF", function() { return hasCorporationSF; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hasAISF", function() { return hasAISF; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hasBladeburnerSF", function() { return hasBladeburnerSF; });
-/* harmony import */ var _ActiveScriptsUI_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ActiveScriptsUI.js */ 42);
+/* harmony import */ var _ActiveScriptsUI_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ActiveScriptsUI.js */ 43);
/* harmony import */ var _Augmentations_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Augmentations.js */ 18);
-/* harmony import */ var _BitNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./BitNode.js */ 16);
+/* harmony import */ var _BitNode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./BitNode.js */ 15);
/* harmony import */ var _Crimes_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Crimes.js */ 19);
/* harmony import */ var _Company_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Company.js */ 9);
/* harmony import */ var _Constants_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Constants.js */ 3);
-/* harmony import */ var _CreateProgram_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./CreateProgram.js */ 13);
+/* harmony import */ var _CreateProgram_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./CreateProgram.js */ 14);
/* harmony import */ var _DarkWeb_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./DarkWeb.js */ 33);
/* harmony import */ var _engine_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./engine.js */ 5);
-/* harmony import */ var _Faction_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./Faction.js */ 14);
-/* harmony import */ var _HacknetNode_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./HacknetNode.js */ 38);
+/* harmony import */ var _Faction_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./Faction.js */ 11);
+/* harmony import */ var _HacknetNode_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./HacknetNode.js */ 39);
/* harmony import */ var _Location_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./Location.js */ 4);
/* harmony import */ var _Message_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./Message.js */ 27);
/* harmony import */ var _Missions_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./Missions.js */ 32);
/* harmony import */ var _Player_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./Player.js */ 0);
-/* harmony import */ var _Script_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./Script.js */ 29);
+/* harmony import */ var _Script_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./Script.js */ 28);
/* harmony import */ var _Server_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./Server.js */ 10);
/* harmony import */ var _Settings_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./Settings.js */ 24);
/* harmony import */ var _SpecialServerIps_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./SpecialServerIps.js */ 17);
-/* harmony import */ var _StockMarket_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./StockMarket.js */ 20);
+/* harmony import */ var _StockMarket_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./StockMarket.js */ 21);
/* harmony import */ var _Terminal_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./Terminal.js */ 22);
-/* harmony import */ var _TextFile_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./TextFile.js */ 39);
-/* harmony import */ var _NetscriptWorker_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./NetscriptWorker.js */ 21);
+/* harmony import */ var _TextFile_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./TextFile.js */ 41);
+/* harmony import */ var _NetscriptWorker_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./NetscriptWorker.js */ 20);
/* harmony import */ var _NetscriptEvaluator_js__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./NetscriptEvaluator.js */ 7);
-/* harmony import */ var _NetscriptEnvironment_js__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./NetscriptEnvironment.js */ 65);
-/* harmony import */ var _NetscriptPort_js__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./NetscriptPort.js */ 43);
+/* harmony import */ var _NetscriptEnvironment_js__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./NetscriptEnvironment.js */ 66);
+/* harmony import */ var _NetscriptPort_js__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./NetscriptPort.js */ 45);
/* harmony import */ var _utils_decimal_js__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ../utils/decimal.js */ 23);
/* harmony import */ var _utils_decimal_js__WEBPACK_IMPORTED_MODULE_26___default = /*#__PURE__*/__webpack_require__.n(_utils_decimal_js__WEBPACK_IMPORTED_MODULE_26__);
/* harmony import */ var _utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ../utils/DialogBox.js */ 6);
/* harmony import */ var _utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ../utils/HelperFunctions.js */ 1);
-/* harmony import */ var _utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ../utils/IPAddress.js */ 15);
+/* harmony import */ var _utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ../utils/IPAddress.js */ 16);
/* harmony import */ var _utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ../utils/StringHelperFunctions.js */ 2);
-/* harmony import */ var _utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ../utils/YesNoBox.js */ 11);
-var sprintf = __webpack_require__(/*! sprintf-js */ 109).sprintf,
- vsprintf = __webpack_require__(/*! sprintf-js */ 109).vsprintf
+/* harmony import */ var _utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ../utils/YesNoBox.js */ 12);
+var sprintf = __webpack_require__(/*! sprintf-js */ 108).sprintf,
+ vsprintf = __webpack_require__(/*! sprintf-js */ 108).vsprintf
@@ -30358,6 +30367,139 @@ function NetscriptFunctions(workerScript) {
+/***/ }),
+/* 30 */
+/*!**********************!*\
+ !*** ./src/Alias.js ***!
+ \**********************/
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Aliases", function() { return Aliases; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GlobalAliases", function() { return GlobalAliases; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "printAliases", function() { return printAliases; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseAliasDeclaration", function() { return parseAliasDeclaration; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeAlias", function() { return removeAlias; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "substituteAliases", function() { return substituteAliases; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "loadAliases", function() { return loadAliases; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "loadGlobalAliases", function() { return loadGlobalAliases; });
+/* harmony import */ var _Terminal_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Terminal.js */ 22);
+
+
+let Aliases = {};
+let GlobalAliases = {};
+
+function loadAliases(saveString) {
+ if (saveString === "") {
+ Aliases = {};
+ } else {
+ Aliases = JSON.parse(saveString);
+ }
+}
+
+function loadGlobalAliases(saveString) {
+ if (saveString === "") {
+ GlobalAliases = {};
+ } else {
+ GlobalAliases = JSON.parse(saveString);
+ }
+}
+
+//Print all aliases to terminal
+function printAliases() {
+ for (var name in Aliases) {
+ if (Aliases.hasOwnProperty(name)) {
+ Object(_Terminal_js__WEBPACK_IMPORTED_MODULE_0__["post"])("alias " + name + "=" + Aliases[name]);
+ }
+ }
+ for (var name in GlobalAliases) {
+ if (GlobalAliases.hasOwnProperty(name)) {
+ Object(_Terminal_js__WEBPACK_IMPORTED_MODULE_0__["post"])("global alias " + name + "=" + GlobalAliases[name]);
+ }
+ }
+}
+
+//True if successful, false otherwise
+function parseAliasDeclaration(dec,global=false) {
+ var re = /^([_|\w|!|%|,|@]+)="(.+)"$/;
+ var matches = dec.match(re);
+ if (matches == null || matches.length != 3) {return false;}
+ if (global){
+ addGlobalAlias(matches[1],matches[2]);
+ } else {
+ addAlias(matches[1], matches[2]);
+ }
+ return true;
+}
+
+function addAlias(name, value) {
+ if (name in GlobalAliases){
+ delete GlobalAliases[name];
+ }
+ Aliases[name] = value;
+}
+
+function addGlobalAlias(name, value) {
+ if (name in Aliases){
+ delete Aliases[name];
+ }
+ GlobalAliases[name] = value;
+}
+
+function getAlias(name) {
+ if (Aliases.hasOwnProperty(name)) {
+ return Aliases[name];
+ }
+ return null;
+}
+
+function getGlobalAlias(name) {
+ if (GlobalAliases.hasOwnProperty(name)) {
+ return GlobalAliases[name];
+ }
+ return null;
+}
+
+function removeAlias(name) {
+ if (Aliases.hasOwnProperty(name)) {
+ delete Aliases[name];
+ return true;
+ }
+ if (GlobalAliases.hasOwnProperty(name)) {
+ delete GlobalAliases[name];
+ return true;
+ }
+ return false;
+}
+
+//Returns the original string with any aliases substituted in
+//Aliases only applied to "whole words", one level deep
+function substituteAliases(origCommand) {
+ var commandArray = origCommand.split(" ");
+ if (commandArray.length>0){
+ var alias = getAlias(commandArray[0]);
+ if (alias != null) {
+ commandArray[0] = alias;
+ } else {
+ var alias = getGlobalAlias(commandArray[0]);
+ if (alias != null) {
+ commandArray[0] = alias;
+ }
+ }
+ for (var i = 0; i < commandArray.length; ++i) {
+ var alias = getGlobalAlias(commandArray[i]);
+ if (alias != null) {
+ commandArray[i] = alias;
+ }
+ }
+ }
+ return commandArray.join(" ");
+}
+
+
+
+
/***/ }),
/* 31 */
/*!*****************************************!*\
@@ -30368,11 +30510,11 @@ function NetscriptFunctions(workerScript) {
"use strict";
-var support = __webpack_require__(/*! ./support */ 47);
+var support = __webpack_require__(/*! ./support */ 50);
var base64 = __webpack_require__(/*! ./base64 */ 99);
-var nodejsUtils = __webpack_require__(/*! ./nodejsUtils */ 62);
-var setImmediate = __webpack_require__(/*! core-js/library/fn/set-immediate */ 152);
-var external = __webpack_require__(/*! ./external */ 57);
+var nodejsUtils = __webpack_require__(/*! ./nodejsUtils */ 63);
+var setImmediate = __webpack_require__(/*! core-js/library/fn/set-immediate */ 153);
+var external = __webpack_require__(/*! ./external */ 58);
/**
@@ -30859,7 +31001,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "currMission", function() { return currMission; });
/* harmony import */ var _Constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Constants.js */ 3);
/* harmony import */ var _engine_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./engine.js */ 5);
-/* harmony import */ var _Faction_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Faction.js */ 14);
+/* harmony import */ var _Faction_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Faction.js */ 11);
/* harmony import */ var _Player_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Player.js */ 0);
/* harmony import */ var _utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils/DialogBox.js */ 6);
/* harmony import */ var _utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils/HelperFunctions.js */ 1);
@@ -32401,7 +32543,7 @@ HackingMission.prototype.finishMission = function(win) {
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ 41)))
+/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ 38)))
/***/ }),
/* 33 */
@@ -32418,11 +32560,11 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buyDarkwebItem", function() { return buyDarkwebItem; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseDarkwebItemPrice", function() { return parseDarkwebItemPrice; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DarkWebItems", function() { return DarkWebItems; });
-/* harmony import */ var _CreateProgram_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./CreateProgram.js */ 13);
+/* harmony import */ var _CreateProgram_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./CreateProgram.js */ 14);
/* harmony import */ var _Player_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Player.js */ 0);
/* harmony import */ var _SpecialServerIps_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SpecialServerIps.js */ 17);
/* harmony import */ var _Terminal_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Terminal.js */ 22);
-/* harmony import */ var _utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils/IPAddress.js */ 15);
+/* harmony import */ var _utils_IPAddress_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils/IPAddress.js */ 16);
/* harmony import */ var _utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils/StringHelperFunctions.js */ 2);
@@ -32635,7 +32777,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFconf", function() { return createFconf; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseFconfSettings", function() { return parseFconfSettings; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "loadFconf", function() { return loadFconf; });
-/* harmony import */ var _utils_acorn_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/acorn.js */ 36);
+/* harmony import */ var _utils_acorn_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/acorn.js */ 35);
/* harmony import */ var _utils_acorn_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_utils_acorn_js__WEBPACK_IMPORTED_MODULE_0__);
@@ -32759,1474 +32901,6 @@ function loadFconf(saveString) {
/***/ }),
/* 35 */
-/*!*********************!*\
- !*** ./src/Gang.js ***!
- \*********************/
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Gang", function() { return Gang; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "displayGangContent", function() { return displayGangContent; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateGangContent", function() { return updateGangContent; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "loadAllGangs", function() { return loadAllGangs; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AllGangs", function() { return AllGangs; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "resetGangs", function() { return resetGangs; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "deleteGangDisplayContent", function() { return deleteGangDisplayContent; });
-/* harmony import */ var _Constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Constants.js */ 3);
-/* harmony import */ var _engine_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./engine.js */ 5);
-/* harmony import */ var _Faction_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Faction.js */ 14);
-/* harmony import */ var _Player_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Player.js */ 0);
-/* harmony import */ var _utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils/DialogBox.js */ 6);
-/* harmony import */ var _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils/JSONReviver.js */ 8);
-/* harmony import */ var _utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../utils/HelperFunctions.js */ 1);
-/* harmony import */ var _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../utils/numeral.min.js */ 12);
-/* harmony import */ var _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_7__);
-/* harmony import */ var _utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../utils/StringHelperFunctions.js */ 2);
-/* harmony import */ var _utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../utils/YesNoBox.js */ 11);
-
-
-
-
-
-
-
-
-
-
-
-/* Gang.js */
-//Switch between territory and management screen with 1 and 2
-$(document).keydown(function(event) {
- if (_engine_js__WEBPACK_IMPORTED_MODULE_1__["Engine"].currentPage == _engine_js__WEBPACK_IMPORTED_MODULE_1__["Engine"].Page.Gang && !_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_9__["yesNoBoxOpen"]) {
- if (gangMemberFilter != null && gangMemberFilter === document.activeElement) {return;}
- if (event.keyCode === 49) {
- if(gangTerritorySubpage.style.display === "block") {
- managementButton.click();
- }
- } else if (event.keyCode === 50) {
- if (gangManagementSubpage.style.display === "block") {
- territoryButton.click();
- }
- }
- }
-});
-
-//Delete upgrade box when clicking outside
-$(document).mousedown(function(event) {
- var boxId = "gang-member-upgrade-popup-box";
- var contentId = "gang-member-upgrade-popup-box-content";
- if (gangMemberUpgradeBoxOpened) {
- if ( $(event.target).closest("#" + contentId).get(0) == null ) {
- //Delete the box
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["removeElement"])(gangMemberUpgradeBox);
- gangMemberUpgradeBox = null;
- gangMemberUpgradeBoxContent = null;
- gangMemberUpgradeBoxOpened = false;
- gangMemberUpgradeBoxElements = null;
- }
- }
-});
-
-let GangNames = ["Slum Snakes", "Tetrads", "The Syndicate", "The Dark Army", "Speakers for the Dead",
- "NiteSec", "The Black Hand"];
-let AllGangs = {
- "Slum Snakes" : {
- power: 1,
- territory: 1/7,
- },
- "Tetrads" : {
- power: 1,
- territory: 1/7,
- },
- "The Syndicate" : {
- power: 1,
- territory: 1/7,
- },
- "The Dark Army" : {
- power: 1,
- territory: 1/7,
- },
- "Speakers for the Dead" : {
- power: 1,
- territory: 1/7,
- },
- "NiteSec" : {
- power: 1,
- territory: 1/7,
- },
- "The Black Hand" : {
- power: 1,
- territory: 1/7,
- },
-}
-
-function resetGangs() {
- AllGangs = {
- "Slum Snakes" : {
- power: 1,
- territory: 1/7,
- },
- "Tetrads" : {
- power: 1,
- territory: 1/7,
- },
- "The Syndicate" : {
- power: 1,
- territory: 1/7,
- },
- "The Dark Army" : {
- power: 1,
- territory: 1/7,
- },
- "Speakers for the Dead" : {
- power: 1,
- territory: 1/7,
- },
- "NiteSec" : {
- power: 1,
- territory: 1/7,
- },
- "The Black Hand" : {
- power: 1,
- territory: 1/7,
- },
- }
-}
-
-function loadAllGangs(saveString) {
- AllGangs = JSON.parse(saveString, _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_5__["Reviver"]);
-}
-
-//Power is an estimate of a gang's ability to gain/defend territory
-let gangStoredPowerCycles = 0;
-function processAllGangPowerGains(numCycles=1) {
- if (!_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].inGang()) {return;}
- gangStoredPowerCycles += numCycles;
- if (gangStoredPowerCycles < 150) {return;}
- var playerGangName = _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.facName;
- for (var name in AllGangs) {
- if (AllGangs.hasOwnProperty(name)) {
- if (name == playerGangName) {
- AllGangs[name].power += _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.calculatePower();
- } else {
- var gain = Math.random() * 0.02; //TODO Adjust as necessary
- AllGangs[name].power += (gain);
- }
- }
- }
-
- gangStoredPowerCycles -= 150;
-}
-
-let gangStoredTerritoryCycles = 0;
-function processAllGangTerritory(numCycles=1) {
- if (!_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].inGang()) {return;}
- gangStoredTerritoryCycles += numCycles;
- if (gangStoredTerritoryCycles < _Constants_js__WEBPACK_IMPORTED_MODULE_0__["CONSTANTS"].GangTerritoryUpdateTimer) {return;}
-
- for (var i = 0; i < GangNames.length; ++i) {
- var other = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(0, GangNames.length-1);
- while(other == i) {
- other = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(0, GangNames.length-1);
- }
- var thisPwr = AllGangs[GangNames[i]].power;
- var otherPwr = AllGangs[GangNames[other]].power;
- var thisChance = thisPwr / (thisPwr + otherPwr);
-
- if (Math.random() < thisChance) {
- if (AllGangs[GangNames[other]].territory <= 0) {
- return;
- }
- AllGangs[GangNames[i]].territory += 0.0001;
- AllGangs[GangNames[other]].territory -= 0.0001;
- } else {
- if (AllGangs[GangNames[i]].territory <= 0) {
- return;
- }
- AllGangs[GangNames[i]].territory -= 0.0001;
- AllGangs[GangNames[other]].territory += 0.0001;
- }
- }
-
- gangStoredTerritoryCycles -= _Constants_js__WEBPACK_IMPORTED_MODULE_0__["CONSTANTS"].GangTerritoryUpdateTimer;
-}
-
-/* faction - Name of corresponding faction
- hacking - Boolean indicating whether its a hacking gang or not
- */
-function Gang(facName, hacking=false) {
- this.facName = facName;
- this.members = []; //Array of GangMembers
- this.wanted = 1;
- this.respect = 1;
- this.power = 0;
-
- this.isHackingGang = hacking;
-
- this.respectGainRate = 0;
- this.wantedGainRate = 0;
- this.moneyGainRate = 0;
-
- //When processing gains, this stores the number of cycles until some
- //limit is reached, and then calculates and applies the gains only at that limit
- this.storedCycles = 0;
-}
-
-Gang.prototype.process = function(numCycles=1) {
- this.processGains(numCycles);
- this.processExperienceGains(numCycles);
- processAllGangPowerGains(numCycles);
- processAllGangTerritory(numCycles);
-}
-
-Gang.prototype.processGains = function(numCycles=1) {
- this.storedCycles += numCycles;
- if (isNaN(this.storedCycles)) {
- console.log("ERROR: Gang's storedCylces is NaN");
- this.storedCycles = 0;
- }
- if (this.storedCycles < 25) {return;} //Only process every 5 seconds at least
-
- //Get gains per cycle
- var moneyGains = 0, respectGains = 0, wantedLevelGains = 0;
- for (var i = 0; i < this.members.length; ++i) {
- respectGains += (this.members[i].calculateRespectGain());
- wantedLevelGains += (this.members[i].calculateWantedLevelGain());
- moneyGains += (this.members[i].calculateMoneyGain());
- }
- this.respectGainRate = respectGains;
- this.wantedGainRate = wantedLevelGains;
- this.moneyGainRate = moneyGains;
-
- if (!isNaN(respectGains)) {
- var gain = respectGains * this.storedCycles;
- this.respect += (gain);
- //Faction reputation gains is respect gain divided by some constant
- var fac = _Faction_js__WEBPACK_IMPORTED_MODULE_2__["Factions"][this.facName];
- if (!(fac instanceof _Faction_js__WEBPACK_IMPORTED_MODULE_2__["Faction"])) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_4__["dialogBoxCreate"])("ERROR: Could not get Faction associates with your gang. This is a bug, please report to game dev");
- } else {
- var favorMult = 1 + (fac.favor / 100);
- fac.playerReputation += ((_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].faction_rep_mult * gain * favorMult) / _Constants_js__WEBPACK_IMPORTED_MODULE_0__["CONSTANTS"].GangRespectToReputationRatio);
- }
-
- } else {
- console.log("ERROR: respectGains is NaN");
- }
- if (!isNaN(wantedLevelGains)) {
- if (this.wanted === 1 && wantedLevelGains < 0) {
- //Do nothing
- } else {
- this.wanted += (wantedLevelGains * this.storedCycles);
- if (this.wanted < 1) {this.wanted = 1;}
- }
- } else {
- console.log("ERROR: wantedLevelGains is NaN");
- }
- if (!isNaN(moneyGains)) {
- _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gainMoney(moneyGains * this.storedCycles);
- } else {
- console.log("ERROR: respectGains is NaN");
- }
-
- this.storedCycles = 0;
-}
-
-Gang.prototype.processExperienceGains = function(numCycles=1) {
- for (var i = 0; i < this.members.length; ++i) {
- this.members[i].gainExperience(numCycles);
- this.members[i].updateSkillLevels();
- }
-}
-
-//Calculates power GAIN, which is added onto the Gang's existing power
-Gang.prototype.calculatePower = function() {
- var memberTotal = 0;
- for (var i = 0; i < this.members.length; ++i) {
- if (this.members[i].task instanceof GangMemberTask &&
- this.members[i].task.name == "Territory Warfare") {
- memberTotal += this.members[i].calculatePower();
- }
- }
- return (0.0005 * memberTotal);
-}
-
-Gang.prototype.autoAssignMemberToTask = function(taskName) {
- for (var i = 0; i < this.members.length; ++i) {
- if (this.members[i].task.name === taskName) {
- this.members[i].assignToTask(taskName);
- return true;
- }
- }
- return false;
-}
-
-Gang.prototype.autoUnassignMemberFromTask = function(taskName) {
- for (var i = 0; i < this.members.length; ++i) {
- if (this.members[i].task.name === taskName) {
- this.members[i].unassignFromTask();
- return true;
- }
- }
- return false;
-}
-
-Gang.prototype.toJSON = function() {
- return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_5__["Generic_toJSON"])("Gang", this);
-}
-
-Gang.fromJSON = function(value) {
- return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_5__["Generic_fromJSON"])(Gang, value.data);
-}
-
-_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_5__["Reviver"].constructors.Gang = Gang;
-
-/*** Gang Member object ***/
-function GangMember(name) {
- this.name = name;
- this.task = GangMemberTasks["Unassigned"]; //GangMemberTask object
- this.city = _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].city;
-
- this.hack = 1;
- this.str = 1;
- this.def = 1;
- this.dex = 1;
- this.agi = 1;
- this.cha = 1;
-
- this.hack_exp = 0;
- this.str_exp = 0;
- this.def_exp = 0;
- this.dex_exp = 0;
- this.agi_exp = 0;
- this.cha_exp = 0;
-
- this.hack_mult = 1;
- this.str_mult = 1;
- this.def_mult = 1;
- this.dex_mult = 1;
- this.agi_mult = 1;
- this.cha_mult = 1;
-
- this.upgrades = []; //Names of upgrades
-}
-
-//Same formula for Player
-GangMember.prototype.calculateSkill = function(exp) {
- return Math.max(Math.floor(32 * Math.log(exp + 534.5) - 200), 1);
-}
-
-GangMember.prototype.updateSkillLevels = function() {
- this.hack = Math.floor(this.calculateSkill(this.hack_exp) * this.hack_mult);
- this.str = Math.floor(this.calculateSkill(this.str_exp) * this.str_mult);
- this.def = Math.floor(this.calculateSkill(this.def_exp) * this.def_mult);
- this.dex = Math.floor(this.calculateSkill(this.dex_exp) * this.dex_mult);
- this.agi = Math.floor(this.calculateSkill(this.agi_exp) * this.agi_mult);
- this.cha = Math.floor(this.calculateSkill(this.cha_exp) * this.cha_mult);
-}
-
-GangMember.prototype.calculatePower = function() {
- return (this.hack + this.str + this.def +
- this.dex + this.agi + this.cha) / 100;
-}
-
-GangMember.prototype.assignToTask = function(taskName) {
- if (GangMemberTasks.hasOwnProperty(taskName)) {
- this.task = GangMemberTasks[taskName];
- } else {
- this.task = GangMemberTasks["Unassigned"];
- }
-}
-
-GangMember.prototype.unassignFromTask = function() {
- if (GangMemberTasks.hasOwnProperty("Unassigned")) {
- this.task = GangMemberTasks["Unassigned"];
- } else {
- console.log("ERROR: Can't find Unassigned Gang member task");
- this.task = null;
- }
-}
-
-//Gains are per cycle
-GangMember.prototype.calculateRespectGain = function() {
- var task = this.task;
- if (task == null || !(task instanceof GangMemberTask) || task.baseRespect === 0) {return 0;}
- var 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;
- statWeight -= (3.5 * task.difficulty);
- if (statWeight <= 0) {return 0;}
- var territoryMult = AllGangs[_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.facName].territory;
- if (territoryMult <= 0) {return 0;}
- var respectMult = (_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.respect) / (_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.respect + _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.wanted);
- return 12 * task.baseRespect * statWeight * territoryMult * respectMult;
-}
-
-GangMember.prototype.calculateWantedLevelGain = function() {
- var task = this.task;
- if (task == null || !(task instanceof GangMemberTask) || task.baseWanted === 0) {return 0;}
- var 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;
- statWeight -= (3.5 * task.difficulty);
- if (statWeight <= 0) {return 0;}
- var territoryMult = AllGangs[_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.facName].territory;
- if (territoryMult <= 0) {return 0;}
- if (task.baseWanted < 0) {
- return task.baseWanted * statWeight * territoryMult;
- } else {
- return 6 * task.baseWanted / (3 * statWeight * territoryMult);
- }
-}
-
-GangMember.prototype.calculateMoneyGain = function() {
- var task = this.task;
- if (task == null || !(task instanceof GangMemberTask) || task.baseMoney === 0) {return 0;}
- var 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;
- statWeight -= (3.5 * task.difficulty);
- if (statWeight <= 0) {return 0;}
- var territoryMult = AllGangs[_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.facName].territory;
- if (territoryMult <= 0) {return 0;}
- var respectMult = (_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.respect) / (_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.respect + _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.wanted);
- return 5 * task.baseMoney * statWeight * territoryMult * respectMult;
-}
-
-GangMember.prototype.gainExperience = function(numCycles=1) {
- var task = this.task;
- if (task == null || !(task instanceof GangMemberTask)) {return;}
- this.hack_exp += (task.hackWeight / 1500) * task.difficulty * numCycles;
- this.str_exp += (task.strWeight / 1500) * task.difficulty * numCycles;
- this.def_exp += (task.defWeight / 1500) * task.difficulty * numCycles;
- this.dex_exp += (task.dexWeight / 1500) * task.difficulty * numCycles;
- this.agi_exp += (task.agiWeight / 1500) * task.difficulty * numCycles;
- this.cha_exp += (task.chaWeight / 1500) * task.difficulty * numCycles;
-}
-
-GangMember.prototype.toJSON = function() {
- return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_5__["Generic_toJSON"])("GangMember", this);
-}
-
-GangMember.fromJSON = function(value) {
- return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_5__["Generic_fromJSON"])(GangMember, value.data);
-}
-
-_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_5__["Reviver"].constructors.GangMember = GangMember;
-
-//Defines tasks that Gang Members can work on
-function GangMemberTask(name="", desc="",
- params={baseRespect: 0, baseWanted: 0, baseMoney: 0,
- hackWeight: 0, strWeight: 0, defWeight: 0,
- dexWeight: 0, agiWeight: 0, chaWeight: 0,
- difficulty: 0}) {
- this.name = name;
- this.desc = desc;
-
- this.baseRespect = params.baseRespect ? params.baseRespect : 0;
- this.baseWanted = params.baseWanted ? params.baseWanted : 0;
- this.baseMoney = params.baseMoney ? params.baseMoney : 0;
-
- //Weights must add up to 100
- this.hackWeight = params.hackWeight ? params.hackWeight : 0;
- this.strWeight = params.strWeight ? params.strWeight : 0;
- this.defWeight = params.defWeight ? params.defWeight : 0;
- this.dexWeight = params.dexWeight ? params.dexWeight : 0;
- this.agiWeight = params.agiWeight ? params.agiWeight : 0;
- this.chaWeight = params.chaWeight ? params.chaWeight : 0;
-
- //1 - 100
- this.difficulty = params.difficulty ? params.difficulty : 1;
-}
-
-GangMemberTask.prototype.toJSON = function() {
- return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_5__["Generic_toJSON"])("GangMemberTask", this);
-}
-
-GangMemberTask.fromJSON = function(value) {
- return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_5__["Generic_fromJSON"])(GangMemberTask, value.data);
-}
-
-_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_5__["Reviver"].constructors.GangMemberTask = GangMemberTask;
-
-//TODO Human trafficking and an equivalent hacking crime
-let GangMemberTasks = {
- "Unassigned" : new GangMemberTask(
- "Unassigned",
- "This gang member is currently idle"),
- "Ransomware" : new GangMemberTask(
- "Ransomware",
- "Assign this gang member to create and distribute ransomware
" +
- "Earns money - Slightly increases respect - Slightly increases wanted level",
- {baseRespect: 0.00005, baseWanted: 0.00001, baseMoney: 1,
- hackWeight: 100, difficulty: 1}),
- "Phishing" : new GangMemberTask(
- "Phishing",
- "Assign this gang member to attempt phishing scams and attacks
" +
- "Earns money - Slightly increases respect - Slightly increases wanted level",
- {baseRespect: 0.00008, baseWanted: 0.001, baseMoney: 2.5,
- hackWeight: 85, chaWeight: 15, difficulty: 3}),
- "Identity Theft" : new GangMemberTask(
- "Identity Theft",
- "Assign this gang member to attempt identity theft
" +
- "Earns money - Increases respect - Increases wanted level",
- {baseRespect: 0.0001, baseWanted: 0.01, baseMoney: 6,
- hackWeight: 80, chaWeight: 20, difficulty: 4}),
- "DDoS Attacks" : new GangMemberTask(
- "DDoS Attacks",
- "Assign this gang member to carry out DDoS attacks
" +
- "Increases respect - Increases wanted level",
- {baseRespect: 0.0004, baseWanted: 0.05,
- hackWeight: 100, difficulty: 7}),
- "Plant Virus" : new GangMemberTask(
- "Plant Virus",
- "Assign this gang member to create and distribute malicious viruses
" +
- "Increases respect - Increases wanted level",
- {baseRespect: 0.0006, baseWanted: 0.05,
- hackWeight: 100, difficulty: 10}),
- "Fraud & Counterfeiting" : new GangMemberTask(
- "Fraud & Counterfeiting",
- "Assign this gang member to commit financial fraud and digital counterfeiting
" +
- "Earns money - Slightly increases respect - Slightly increases wanted level",
- {baseRespect: 0.0005, baseWanted: 0.1, baseMoney: 15,
- hackWeight: 80, chaWeight: 20, difficulty: 17}),
- "Money Laundering" : new GangMemberTask(
- "Money Laundering",
- "Assign this gang member to launder money
" +
- "Earns money - Increases respect - Increases wanted level",
- {baseRespect: 0.0006, baseWanted:0.2, baseMoney: 40,
- hackWeight: 75, chaWeight: 25, difficulty: 20}),
- "Cyberterrorism" : new GangMemberTask(
- "Cyberterrorism",
- "Assign this gang member to commit acts of cyberterrorism
" +
- "Greatly increases respect - Greatly increases wanted level",
- {baseRespect: 0.001, baseWanted: 0.5,
- hackWeight: 80, chaWeight: 20, difficulty: 33}),
- "Ethical Hacking" : new GangMemberTask(
- "Ethical Hacking",
- "Assign this gang member to be an ethical hacker for corporations
" +
- "Earns money - Lowers wanted level",
- {baseWanted: -0.001, baseMoney: 1,
- hackWeight: 90, chaWeight: 10, difficulty: 1}),
- "Mug People" : new GangMemberTask(
- "Mug People",
- "Assign this gang member to mug random people on the streets
" +
- "Earns money - Slightly increases respect - Very slightly increases wanted level",
- {baseRespect: 0.00005, baseWanted: 0.00001, baseMoney: 1,
- strWeight: 25, defWeight: 25, dexWeight: 25, agiWeight: 10, chaWeight: 15, difficulty: 1}),
- "Deal Drugs" : new GangMemberTask(
- "Deal Drugs",
- "Assign this gang member to sell drugs.
" +
- "Earns money - Slightly increases respect - Slightly increases wanted level",
- {baseRespect: 0.00008, baseWanted: 0.001, baseMoney: 4,
- agiWeight: 20, dexWeight: 20, chaWeight: 60, difficulty: 3}),
- "Run a Con" : new GangMemberTask(
- "Run a Con",
- "Assign this gang member to run cons
" +
- "Earns money - Increases respect - Increases wanted level",
- {baseRespect: 0.00015, baseWanted: 0.01, baseMoney: 10,
- strWeight: 5, defWeight: 5, agiWeight: 25, dexWeight: 25, chaWeight: 40, difficulty: 10}),
- "Armed Robbery" : new GangMemberTask(
- "Armed Robbery",
- "Assign this gang member to commit armed robbery on stores, banks and armored cars
" +
- "Earns money - Increases respect - Increases wanted level",
- {baseRespect: 0.00015, baseWanted: 0.05, baseMoney: 25,
- hackWeight: 20, strWeight: 15, defWeight: 15, agiWeight: 10, dexWeight: 20, chaWeight: 20,
- difficulty: 17}),
- "Traffick Illegal Arms" : new GangMemberTask(
- "Traffick Illegal Arms",
- "Assign this gang member to traffick illegal arms
" +
- "Earns money - Increases respect - Increases wanted level",
- {baseRespect: 0.0003, baseWanted: 0.1, baseMoney: 40,
- hackWeight: 15, strWeight: 20, defWeight: 20, dexWeight: 20, chaWeight: 75,
- difficulty: 25}),
- "Threaten & Blackmail" : new GangMemberTask(
- "Threaten & Blackmail",
- "Assign this gang member to threaten and black mail high-profile targets
" +
- "Earns money - Slightly increases respect - Slightly increases wanted level",
- {baseRespect: 0.0002, baseWanted: 0.05, baseMoney: 15,
- hackWeight: 25, strWeight: 25, dexWeight: 25, chaWeight: 25, difficulty: 28}),
- "Terrorism" : new GangMemberTask(
- "Terrorism",
- "Assign this gang member to commit acts of terrorism
" +
- "Greatly increases respect - Greatly increases wanted level",
- {baseRespect: 0.001, baseWanted: 1,
- hackWeight: 20, strWeight: 20, defWeight: 20,dexWeight: 20, chaWeight: 20,
- difficulty: 33}),
- "Vigilante Justice" : new GangMemberTask(
- "Vigilante Justice",
- "Assign this gang member to be a vigilante and protect the city from criminals
" +
- "Decreases wanted level",
- {baseWanted: -0.001,
- hackWeight: 20, strWeight: 20, defWeight: 20, dexWeight: 20, agiWeight:20,
- difficulty: 1}),
- "Train Combat" : new GangMemberTask(
- "Train Combat",
- "Assign this gang member to increase their combat stats (str, def, dex, agi)",
- {strWeight: 25, defWeight: 25, dexWeight: 25, agiWeight: 25, difficulty: 5}),
- "Train Hacking" : new GangMemberTask(
- "Train Hacking",
- "Assign this gang member to train their hacking skills",
- {hackWeight: 100, difficulty: 8}),
- "Territory Warfare" : new GangMemberTask(
- "Territory Warfare",
- "Assign this gang member to engage in territorial warfare with other gangs. " +
- "Members assigned to this task will help increase your gang's territory " +
- "and will defend your territory from being taken.",
- {hackWeight: 15, strWeight: 20, defWeight: 20, dexWeight: 20, agiWeight: 20,
- chaWeight: 5, difficulty: 3}),
-}
-
-
-function GangMemberUpgrade(name="", desc="", cost=0, type="w") {
- this.name = name;
- this.desc = desc;
- this.cost = cost;
- this.type = type; //w, a, v, r
-}
-
-//Passes in a GangMember object
-GangMemberUpgrade.prototype.apply = function(member) {
- switch(this.name) {
- case "Baseball Bat":
- member.str_mult *= 1.05;
- member.def_mult *= 1.05;
- break;
- case "Katana":
- member.str_mult *= 1.1;
- member.def_mult *= 1.1;
- member.dex_mult *= 1.1;
- break;
- case "Glock 18C":
- member.str_mult *= 1.15;
- member.def_mult *= 1.15;
- member.dex_mult *= 1.15;
- member.agi_mult *= 1.15;
- break;
- case "P90C":
- member.str_mult *= 1.2;
- member.def_mult *= 1.2;
- member.agi_mult *= 1.1;
- break;
- case "Steyr AUG":
- member.str_mult *= 1.25;
- member.def_mult *= 1.25;
- break;
- case "AK-47":
- member.str_mult *= 1.5;
- member.def_mult *= 1.5;
- break;
- case "M15A10 Assault Rifle":
- member.str_mult *= 1.6;
- member.def_mult *= 1.6;
- break;
- case "AWM Sniper Rifle":
- member.str_mult *= 1.5;
- member.dex_mult *= 1.5;
- member.agi_mult *= 1.5;
- break;
- case "Bulletproof Vest":
- member.def_mult *= 1.05;
- break;
- case "Full Body Armor":
- member.def_mult *= 1.1;
- break;
- case "Liquid Body Armor":
- member.def_mult *= 1.25;
- member.agi_mult *= 1.25;
- break;
- case "Graphene Plating Armor":
- member.def_mult *= 1.5;
- break;
- case "Ford Flex V20":
- member.agi_mult *= 1.1;
- member.cha_mult *= 1.1;
- break;
- case "ATX1070 Superbike":
- member.agi_mult *= 1.15;
- member.cha_mult *= 1.15;
- break;
- case "Mercedes-Benz S9001":
- member.agi_mult *= 1.2;
- member.cha_mult *= 1.2;
- break;
- case "White Ferrari":
- member.agi_mult *= 1.25;
- member.cha_mult *= 1.25;
- break;
- case "NUKE Rootkit":
- member.hack_mult *= 1.1;
- break;
- case "Soulstealer Rootkit":
- member.hack_mult *= 1.2;
- break;
- case "Demon Rootkit":
- member.hack_mult *= 1.3;
- break;
- default:
- console.log("ERROR: Could not find this upgrade: " + this.name);
- break;
- }
-}
-
-GangMemberUpgrade.prototype.toJSON = function() {
- return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_5__["Generic_toJSON"])("GangMemberUpgrade", this);
-}
-
-GangMemberUpgrade.fromJSON = function(value) {
- return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_5__["Generic_fromJSON"])(GangMemberUpgrade, value.data);
-}
-
-_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_5__["Reviver"].constructors.GangMemberUpgrade = GangMemberUpgrade;
-
-let GangMemberUpgrades = {
- "Baseball Bat" : new GangMemberUpgrade("Baseball Bat",
- "Increases strength and defense by 5%", 1e6, "w"),
- "Katana" : new GangMemberUpgrade("Katana",
- "Increases strength, defense, and dexterity by 10%", 12e6, "w"),
- "Glock 18C" : new GangMemberUpgrade("Glock 18C",
- "Increases strength, defense, dexterity, and agility by 15%", 25e6, "w"),
- "P90C" : new GangMemberUpgrade("P90C",
- "Increases strength and defense by 20%. Increases agility by 10%", 50e6, "w"),
- "Steyr AUG" : new GangMemberUpgrade("Steyr AUG",
- "Increases strength and defense by 25%", 60e6, "w"),
- "AK-47" : new GangMemberUpgrade("AK-47",
- "Increases strength and defense by 50%", 100e6, "w"),
- "M15A10 Assault Rifle" : new GangMemberUpgrade("M15A10 Assault Rifle",
- "Increases strength and defense by 60%", 150e6, "w"),
- "AWM Sniper Rifle" : new GangMemberUpgrade("AWM Sniper Rifle",
- "Increases strength, dexterity, and agility by 50%", 225e6, "w"),
- "Bulletproof Vest" : new GangMemberUpgrade("Bulletproof Vest",
- "Increases defense by 5%", 2e6, "a"),
- "Full Body Armor" : new GangMemberUpgrade("Full Body Armor",
- "Increases defense by 10%", 5e6, "a"),
- "Liquid Body Armor" : new GangMemberUpgrade("Liquid Body Armor",
- "Increases defense and agility by 25%", 25e6, "a"),
- "Graphene Plating Armor" : new GangMemberUpgrade("Graphene Plating Armor",
- "Increases defense by 50%", 40e6, "a"),
- "Ford Flex V20" : new GangMemberUpgrade("Ford Flex V20",
- "Increases agility and charisma by 10%", 3e6, "v"),
- "ATX1070 Superbike" : new GangMemberUpgrade("ATX1070 Superbike",
- "Increases agility and charisma by 15%", 9e6, "v"),
- "Mercedes-Benz S9001" : new GangMemberUpgrade("Mercedes-Benz S9001",
- "Increases agility and charisma by 20%", 18e6, "v"),
- "White Ferrari" : new GangMemberUpgrade("White Ferrari",
- "Increases agility and charisma by 25%", 30e6, "v"),
- "NUKE Rootkit" : new GangMemberUpgrade("NUKE Rootkit",
- "Increases hacking by 10%", 5e6, "r"),
- "Soulstealer Rootkit" : new GangMemberUpgrade("Soulstealer Rootkit",
- "Increases hacking by 20%", 15e6, "r"),
- "Demon Rootkit" : new GangMemberUpgrade("Demon Rootkit",
- "Increases hacking by 30%", 50e6, "r"),
-}
-
-//Create a pop-up box that lets player purchase upgrades
-let gangMemberUpgradeBoxOpened = false;
-function createGangMemberUpgradeBox(initialFilter="") {
- var boxId = "gang-member-upgrade-popup-box";
- if (gangMemberUpgradeBoxOpened) {
- //Already opened, refreshing
- if (gangMemberUpgradeBoxElements == null || gangMemberUpgradeBox == null || gangMemberUpgradeBoxContent == null) {
- console.log("ERROR: Refreshing Gang member upgrade box throws error because required elements are null");
- return;
- }
-
- for (var i = 1; i < gangMemberUpgradeBoxElements.length; ++i) {
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["removeElement"])(gangMemberUpgradeBoxElements[i]);
- }
- gangMemberUpgradeBoxElements = [gangMemberUpgradeBoxFilter];
-
- var filter = gangMemberUpgradeBoxFilter.value.toString();
- for (var i = 0; i < _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.members.length; ++i) {
- if (_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.members[i].name.indexOf(filter) > -1 || _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.members[i].task.name.indexOf(filter) > -1) {
- var newPanel = createGangMemberUpgradePanel(_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.members[i]);
- gangMemberUpgradeBoxContent.appendChild(newPanel);
- gangMemberUpgradeBoxElements.push(newPanel);
- }
- }
- } else {
- //New popup
- gangMemberUpgradeBoxFilter = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("input", {
- type:"text", placeholder:"Filter gang members",
- value:initialFilter,
- onkeyup:()=>{
- var filterValue = gangMemberUpgradeBoxFilter.value.toString();
- createGangMemberUpgradeBox(filterValue);
- }
- });
-
- gangMemberUpgradeBoxElements = [gangMemberUpgradeBoxFilter];
-
- var filter = gangMemberUpgradeBoxFilter.value.toString();
- for (var i = 0; i < _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.members.length; ++i) {
- if (_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.members[i].name.indexOf(filter) > -1 || _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.members[i].task.name.indexOf(filter) > -1) {
- gangMemberUpgradeBoxElements.push(createGangMemberUpgradePanel(_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.members[i]));
- }
- }
-
- gangMemberUpgradeBox = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createPopup"])(boxId, gangMemberUpgradeBoxElements);
- gangMemberUpgradeBoxContent = document.getElementById(boxId + "-content");
- gangMemberUpgradeBoxOpened = true;
- }
-}
-
-//Create upgrade panels for each individual Gang Member
-function createGangMemberUpgradePanel(memberObj) {
- var container = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("div", {
- border:"1px solid white",
- });
-
- var header = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("h1", {
- innerText:memberObj.name + " (" + memberObj.task.name + ")"
- });
- container.appendChild(header);
-
- var text = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("pre", {
- fontSize:"14px", display: "inline-block", width:"20%",
- innerText:
- "Hack: " + memberObj.hack + " (x" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(memberObj.hack_mult, 2) + ")\n" +
- "Str: " + memberObj.str + " (x" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(memberObj.str_mult, 2) + ")\n" +
- "Def: " + memberObj.def + " (x" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(memberObj.def_mult, 2) + ")\n" +
- "Dex: " + memberObj.dex + " (x" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(memberObj.dex_mult, 2) + ")\n" +
- "Agi: " + memberObj.agi + " (x" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(memberObj.agi_mult, 2) + ")\n" +
- "Cha: " + memberObj.cha + " (x" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(memberObj.cha_mult, 2) + ")\n",
- });
-
- //Already purchased upgrades
- var ownedUpgradesElements = [];
- for (var i = 0; i < memberObj.upgrades.length; ++i) {
- var upg = GangMemberUpgrades[memberObj.upgrades[i]];
- if (upg == null) {
- console.log("ERR: Could not find this upgrade: " + memberObj.upgrades[i]);
- continue;
- }
- var e = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("div", {
- border:"1px solid white", innerText:memberObj.upgrades[i],
- margin:"1px", padding:"1px", tooltip:upg.desc, fontSize:"12px",
- });
- ownedUpgradesElements.push(e);
- }
- var ownedUpgrades = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("div", {
- display:"inline-block", marginLeft:"6px", width:"75%", innerText:"Purchased Upgrades:",
- });
- for (var i = 0; i < ownedUpgradesElements.length; ++i) {
- ownedUpgrades.appendChild(ownedUpgradesElements[i]);
- }
- container.appendChild(text);
- container.appendChild(ownedUpgrades);
- container.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("br", {}));
-
- //Upgrade buttons. Only show upgrades that can be afforded
- var weaponUpgrades = [], armorUpgrades = [], vehicleUpgrades = [], rootkitUpgrades = [];
- for (var upgName in GangMemberUpgrades) {
- if (GangMemberUpgrades.hasOwnProperty(upgName)) {
- var upg = GangMemberUpgrades[upgName];
- if (_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].money.lt(upg.cost) || memberObj.upgrades.includes(upgName)) {continue;}
- switch (upg.type) {
- case "w":
- weaponUpgrades.push(upg);
- break;
- case "a":
- armorUpgrades.push(upg);
- break;
- case "v":
- vehicleUpgrades.push(upg);
- break;
- case "r":
- rootkitUpgrades.push(upg);
- break;
- default:
- console.log("ERROR: Invalid Gang Member Upgrade Type: " + upg.type);
- }
- }
- }
-
- var weaponDiv = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("div", {width:"20%", display:"inline-block",});
- var armorDiv = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("div", {width:"20%", display:"inline-block",});
- var vehicleDiv = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("div", {width:"20%", display:"inline-block",});
- var rootkitDiv = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("div", {width:"20%", display:"inline-block",});
- var upgrades = [weaponUpgrades, armorUpgrades, vehicleUpgrades, rootkitUpgrades];
- var divs = [weaponDiv, armorDiv, vehicleDiv, rootkitDiv];
-
- for (var i = 0; i < upgrades.length; ++i) {
- var upgradeArray = upgrades[i];
- var div = divs[i];
- for (var j = 0; j < upgradeArray.length; ++j) {
- var upg = upgradeArray[j];
- (function (upg, div, memberObj) {
- div.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("a", {
- innerText:upg.name + " - " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_7___default()(upg.cost).format("$0.000a"),
- class:"a-link-button", margin:"2px", padding:"2px", display:"block",
- fontSize:"12px",
- tooltip:upg.desc,
- clickListener:()=>{
- if (_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].money.lt(upg.cost)) {return false;}
- _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].loseMoney(upg.cost);
- memberObj.upgrades.push(upg.name);
- upg.apply(memberObj);
- var initFilterValue = gangMemberUpgradeBoxFilter.value.toString();
- createGangMemberUpgradeBox(initFilterValue);
- return false;
- }
- }));
- })(upg, div, memberObj);
- }
- }
-
- container.appendChild(weaponDiv);
- container.appendChild(armorDiv);
- container.appendChild(vehicleDiv);
- container.appendChild(rootkitDiv);
- return container;
-}
-
-//Gang DOM elements
-let gangContentCreated = false,
- gangContainer = null, managementButton = null, territoryButton = null;
-
-//Subpages
-let gangManagementSubpage = null, gangTerritorySubpage = null;
-
-//Gang Management Elements
-let gangDesc = null, gangInfo = null,
- gangRecruitMemberButton = null, gangRecruitRequirementText = null,
- gangExpandAllButton = null, gangCollapseAllButton, gangMemberFilter = null,
- gangManageEquipmentButton = null,
- gangMemberList = null;
-
-//Gang Equipment Upgrade Elements
-let gangMemberUpgradeBox = null, gangMemberUpgradeBoxContent = null,
- gangMemberUpgradeBoxFilter = null, gangMemberUpgradeBoxElements = null;
-
-
-//Gang Territory Elements
-let gangTerritoryDescText = null, gangTerritoryInfoText = null;
-
-function displayGangContent() {
- if (!gangContentCreated || gangContainer == null) {
- gangContentCreated = true;
-
- //Create gang container
- gangContainer = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("div", {
- id:"gang-container", class:"generic-menupage-container",
- });
-
- //Get variables
- var facName = _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.facName,
- members = _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.members,
- wanted = _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.wanted,
- respect = _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.respect;
-
- //Back button
- gangContainer.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("a", {
- class:"a-link-button", display:"inline-block", innerText:"Back",
- clickListener:()=>{
- _engine_js__WEBPACK_IMPORTED_MODULE_1__["Engine"].loadFactionContent();
- Object(_Faction_js__WEBPACK_IMPORTED_MODULE_2__["displayFactionContent"])(facName);
- return false;
- }
- }));
-
- //Buttons to switch between panels
- managementButton = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("a", {
- id:"gang-management-subpage-button", class:"a-link-button-inactive",
- display:"inline-block", innerHTML: "Gang Management (1)",
- clickListener:()=>{
- gangManagementSubpage.style.display = "block";
- gangTerritorySubpage.style.display = "none";
- managementButton.classList.toggle("a-link-button-inactive");
- managementButton.classList.toggle("a-link-button");
- territoryButton.classList.toggle("a-link-button-inactive");
- territoryButton.classList.toggle("a-link-button");
- updateGangContent();
- return false;
- }
- })
- territoryButton = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("a", {
- id:"gang-territory-subpage-button", class:"a-link-button",
- display:"inline-block", innerHTML:"Gang Territory (2)",
- clickListener:()=>{
- gangManagementSubpage.style.display = "none";
- gangTerritorySubpage.style.display = "block";
- managementButton.classList.toggle("a-link-button-inactive");
- managementButton.classList.toggle("a-link-button");
- territoryButton.classList.toggle("a-link-button-inactive");
- territoryButton.classList.toggle("a-link-button");
- updateGangContent();
- return false;
- }
- });
- gangContainer.appendChild(managementButton);
- gangContainer.appendChild(territoryButton);
-
- //Subpage for managing gang members
- gangManagementSubpage = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("div", {
- display:"block", id:"gang-management-subpage",
- });
-
- var lowerWantedTask = "";
- if (_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.isHackingGang) {
- lowerWantedTask = "Ethical Hacking";
- } else {
- lowerWantedTask = "Vigilante Justice";
- }
- gangDesc = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("p", {width:"70%",
- innerHTML:
- "This page is used to manage your gang members and get an overview of your " +
- "gang's stats.
" +
- "If a gang member is not earning much money or respect, the task that you " +
- "have assigned to that member might be too difficult. Consider training that " +
- "member's stats or choosing an easier task. The tasks closer to the " +
- "top of the dropdown list are generally easier. Alternatively, the gang member's " +
- "low production might be due to the fact that your wanted level is too high. " +
- "Consider assigning a few members to the '" + lowerWantedTask + "' " +
- "task to lower your wanted level.
" +
- "Installing Augmentations does NOT reset your progress with your Gang. " +
- "Furthermore, after installing Augmentations, you will " +
- "automatically be a member of whatever Faction you created your gang with.
"
- });
- gangManagementSubpage.appendChild(gangDesc);
-
- gangInfo = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("p", {id:"gang-info", width:"70%"});
- gangManagementSubpage.appendChild(gangInfo);
-
- gangRecruitMemberButton = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("a", {
- id:"gang-management-recruit-member-btn", class:"a-link-button-inactive",
- innerHTML:"Recruit Gang Member", display:"inline-block", margin:"10px",
- clickListener:()=>{
- var yesBtn = Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_9__["yesNoTxtInpBoxGetYesButton"])(), noBtn = Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_9__["yesNoTxtInpBoxGetNoButton"])();
- yesBtn.innerHTML = "Recruit Gang Member";
- noBtn.innerHTML = "Cancel";
- yesBtn.addEventListener("click", ()=>{
- var name = Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_9__["yesNoTxtInpBoxGetInput"])();
- if (name === "") {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_4__["dialogBoxCreate"])("You must enter a name for your Gang member!");
- } else {
- for (var i = 0; i < _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.members.length; ++i) {
- if (name == _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.members[i].name) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_4__["dialogBoxCreate"])("You already have a gang member with this name!");
- return false;
- }
- }
- var member = new GangMember(name);
- _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.members.push(member);
- createGangMemberDisplayElement(member);
- updateGangContent();
- }
- Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_9__["yesNoTxtInpBoxClose"])();
- });
- noBtn.addEventListener("click", ()=>{
- Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_9__["yesNoTxtInpBoxClose"])();
- });
- Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_9__["yesNoTxtInpBoxCreate"])("Please enter a name for your new Gang member:");
- return false;
- }
- });
- gangManagementSubpage.appendChild(gangRecruitMemberButton);
-
- //Text for how much reputation is required for recruiting next memberList
- gangRecruitRequirementText = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("p", {color:"red", id:"gang-recruit-requirement-text"});
- gangManagementSubpage.appendChild(gangRecruitRequirementText);
-
- //Gang Member List management buttons (Expand/Collapse All, select a single member)
- gangManagementSubpage.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("br", {}));
- gangExpandAllButton = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("a", {
- class:"a-link-button", display:"inline-block",
- innerHTML:"Expand All",
- clickListener:()=>{
- var allHeaders = gangManagementSubpage.getElementsByClassName("accordion-header");
- for (var i = 0; i < allHeaders.length; ++i) {
- var hdr = allHeaders[i];
- if (!hdr.classList.contains("active")) {
- hdr.click();
- }
- }
- return false;
- }
- });
- gangCollapseAllButton = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("a", {
- class:"a-link-button", display:"inline-block",
- innerHTML:"Collapse All",
- clickListener:()=>{
- var allHeaders = gangManagementSubpage.getElementsByClassName("accordion-header");
- for (var i = 0; i < allHeaders.length; ++i) {
- var hdr = allHeaders[i];
- if (hdr.classList.contains("active")) {
- hdr.click();
- }
- }
- return false;
- }
- });
- gangMemberFilter = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("input", {
- type:"text", placeholder:"Filter gang members", margin:"5px", padding:"5px",
- onkeyup:()=>{
- displayGangMemberList();
- }
- });
- gangManageEquipmentButton = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("a", {
- class:"a-link-button", display:"inline-block",
- innerHTML:"Manage Equipment",
- clickListener:()=>{
- createGangMemberUpgradeBox();
- }
- });
- gangManagementSubpage.appendChild(gangExpandAllButton);
- gangManagementSubpage.appendChild(gangCollapseAllButton);
- gangManagementSubpage.appendChild(gangMemberFilter);
- gangManagementSubpage.appendChild(gangManageEquipmentButton);
-
- //Gang Member list
- gangMemberList = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("ul", {id:"gang-member-list"});
- displayGangMemberList();
- gangManagementSubpage.appendChild(gangMemberList);
-
- //Subpage for seeing gang territory information
- gangTerritorySubpage = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("div", {
- id:"gang-territory-subpage", display:"none"
- });
-
- //Info text for territory page
- gangTerritoryDescText = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("p", {
- width:"70%",
- innerHTML:"This page shows how much territory your Gang controls. This statistic is listed as a percentage, " +
- "which represents how much of the total territory you control.
" +
- "Territory gain and loss is processed automatically and is updated every ~30 seconds. Your chances " +
- "to gain and lose territory depend on your Gang's power, which is listed in the display below. " +
- "Your gang's power is determined by the stats of all Gang members you have assigned to the " +
- "'Territory Warfare' task. Gang members that are not assigned to this task do not contribute to " +
- "your Gang's power.
" +
- "The amount of territory you have affects all aspects of your Gang members' production, including " +
- "money, respect, and wanted level. It is very beneficial to have high territory control.
"
- });
- gangTerritorySubpage.appendChild(gangTerritoryDescText);
-
- var territoryBorder = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("fieldset", {width:"50%", display:"inline-block"});
-
- gangTerritoryInfoText = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("p", {id:"gang-territory-info"});
-
- territoryBorder.appendChild(gangTerritoryInfoText);
- gangTerritorySubpage.appendChild(territoryBorder);
-
- gangContainer.appendChild(gangTerritorySubpage);
- gangContainer.appendChild(gangManagementSubpage);
- document.getElementById("entire-game-container").appendChild(gangContainer);
- }
- gangContainer.style.display = "block";
- updateGangContent();
-}
-
-function displayGangMemberList() {
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["removeChildrenFromElement"])(gangMemberList);
- var members = _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.members;
- var filter = gangMemberFilter.value.toString();
- for (var i = 0; i < members.length; ++i) {
- if (members[i].name.indexOf(filter) > -1 || members[i].task.name.indexOf(filter) > -1) {
- createGangMemberDisplayElement(members[i]);
- }
- }
- //setGangMemberClickHandlers(); //Set buttons to toggle the gang member info panels
-}
-
-function updateGangContent() {
- if (!gangContentCreated || !_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].inGang()) {return;}
-
- if(gangTerritorySubpage.style.display === "block") {
- //Update territory information
- gangTerritoryInfoText.innerHTML = "";
- for (var gangname in AllGangs) {
- if (AllGangs.hasOwnProperty(gangname)) {
- var gangTerritoryInfo = AllGangs[gangname];
- if (gangname == _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.facName) {
- gangTerritoryInfoText.innerHTML += ("" + gangname + "
(Power: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(gangTerritoryInfo.power, 6) + "): " +
- Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(100*gangTerritoryInfo.territory, 2) + "%
");
- } else {
- gangTerritoryInfoText.innerHTML += (gangname + "
(Power: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(gangTerritoryInfo.power, 6) + "): " +
- Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(100*gangTerritoryInfo.territory, 2) + "%
");
- }
- }
- }
- } else {
- //Update information for overall gang
- if (gangInfo instanceof Element) {
- var faction = _Faction_js__WEBPACK_IMPORTED_MODULE_2__["Factions"][_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.facName];
- var rep;
- if (!(faction instanceof _Faction_js__WEBPACK_IMPORTED_MODULE_2__["Faction"])) {
- rep = "ERROR";
- } else {
- rep = faction.playerReputation;
- }
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["removeChildrenFromElement"])(gangInfo);
- gangInfo.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("p", { //Respect
- display:"inline-block",
- innerText:"Respect: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.respect, 6) +
- " (" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(5*_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.respectGainRate, 6) + " / sec)",
- tooltip:"Represents the amount of respect your gang has from other gangs and criminal " +
- "organizations. Your respect affects the amount of money " +
- "your gang members will earn, and also determines how much " +
- "reputation you are earning with your gang's corresponding Faction."
- }));
- gangInfo.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("br", {}));
-
- gangInfo.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("p", { //Wanted level
- display:"inline-block",
- innerText:"Wanted Level: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.wanted, 6) +
- " (" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(5*_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.wantedGainRate, 6) + " / sec)",
- tooltip:"Represents how much the gang is wanted by law enforcement. The higher " +
- "your gang's wanted level, the harder it will be for your gang members " +
- "to make money and earn respect. Note that the minimum wanted level is 1."
- }));
- gangInfo.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("br", {}));
-
- var wantedPenalty = (_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.respect) / (_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.respect + _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.wanted);
- wantedPenalty = (1 - wantedPenalty) * 100;
- gangInfo.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("p", { //Wanted Level multiplier
- display:"inline-block",
- innerText:"Wanted Level Penalty: -" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(wantedPenalty, 2) + "%",
- tooltip:"Penalty for respect and money gain rates due to Wanted Level"
- }));
- gangInfo.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("br", {}));
-
- gangInfo.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("p", { //Money gain rate
- display:"inline-block",
- innerText:"Money gain rate: $" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(5*_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.moneyGainRate, 2) +
- " / sec",
- }));
- gangInfo.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("br", {}));
-
- var territoryMult = AllGangs[_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.facName].territory;
- gangInfo.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("p", { //Territory multiplier
- display:"inline-block",
- innerText:"Territory: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(territoryMult * 100, 3) + "%",
- tooltip:"The percentage of total territory your Gang controls"
- }));
- gangInfo.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("br", {}));
-
- gangInfo.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("p", { //Faction reputation
- display:"inline-block",
- innerText:"Faction reputation: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(rep, 3)
- }));
- gangInfo.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("br", {}));
- } else {
- console.log("ERROR: gang-info DOM element DNE");
- }
-
- //Toggle the 'Recruit member button' if valid
- var numMembers = _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.members.length;
- var repCost = 0;
- if (numMembers > 0) {
- var repCost = Math.pow(_Constants_js__WEBPACK_IMPORTED_MODULE_0__["CONSTANTS"].GangRecruitCostMultiplier, numMembers);
- }
- var faction = _Faction_js__WEBPACK_IMPORTED_MODULE_2__["Factions"][_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.facName];
- if (faction == null) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_4__["dialogBoxCreate"])("Could not find your gang's faction. This is probably a bug please report to dev");
- return;
- }
- var btn = gangRecruitMemberButton;
- if (numMembers >= _Constants_js__WEBPACK_IMPORTED_MODULE_0__["CONSTANTS"].MaximumGangMembers) {
- btn.className = "a-link-button-inactive";
- gangRecruitRequirementText.style.display = "block";
- gangRecruitRequirementText.innerHTML =
- "You have reached the maximum amount of gang members";
- } else if (faction.playerReputation >= repCost) {
- btn.className = "a-link-button";
- gangRecruitRequirementText.style.display = "none";
- } else {
- btn.className = "a-link-button-inactive";
- gangRecruitRequirementText.style.display = "block";
- gangRecruitRequirementText.innerHTML =
- Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(repCost, 2) + " Faction reputation needed to recruit next member";
- }
-
- //Update information for each gang member
- for (var i = 0; i < _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.members.length; ++i) {
- updateGangMemberDisplayElement(_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.members[i]);
- }
- }
-}
-
-//Takes in a GangMember object
-function createGangMemberDisplayElement(memberObj) {
- if (!gangContentCreated || !_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].inGang()) {return;}
- var name = memberObj.name;
-
- var accordion = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createAccordionElement"])({
- id:name + "gang-member",
- hdrText:name,
- });
- var li = accordion[0];
- var hdr = accordion[1];
- var gangMemberDiv = accordion[2];
-
- //Gang member content divided into 3 panels:
- //Stats Panel
- var statsDiv = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("div", {
- id: name + "gang-member-stats", class: "gang-member-info-div",
- width:"30%", display:"inline"
- });
- var statsP = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("p", {
- id:name + "gang-member-stats-text", display:"inline"
- });
-
- statsDiv.appendChild(statsP);
- //statsDiv.appendChild(upgradeButton);
-
- //Panel for Selecting task and show respect/wanted gain
- var taskDiv = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("div", {
- id: name + "gang-member-task", class:"gang-member-info-div",
- width:"30%", display:"inline"
- });
- var taskSelector = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("select", {
- color:"white", backgroundColor:"black",
- id:name + "gang-member-task-selector"
- });
-
- var tasks = null;
- if (_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.isHackingGang) {
- tasks = ["---", "Ransomware", "Phishing", "Identity Theft", "DDoS Attacks",
- "Plant Virus", "Fraud & Counterfeiting","Money Laundering",
- "Cyberterrorism", "Ethical Hacking", "Train Combat",
- "Train Hacking", "Territory Warfare"];
- } else {
- tasks = ["---", "Mug People", "Deal Drugs", "Run a Con", "Armed Robbery",
- "Traffick Illegal Arms", "Threaten & Blackmail",
- "Terrorism", "Vigilante Justice", "Train Combat",
- "Train Hacking", "Territory Warfare"];
- }
- for (var i = 0; i < tasks.length; ++i) {
- var option = document.createElement("option");
- option.text = tasks[i];
- taskSelector.add(option);
- }
- taskSelector.addEventListener("change", function() {
- var task = taskSelector.options[taskSelector.selectedIndex].text;
- memberObj.assignToTask(task);
- setGangMemberTaskDescription(memberObj, task);
- updateGangContent();
- });
- //Set initial task in selector element
- if (memberObj.task instanceof GangMemberTask) {
- var taskName = memberObj.task.name;
- var taskIndex = 0;
- for (let i = 0; i < tasks.length; ++i) {
- if (taskName == tasks[i]) {
- taskIndex = i;
- break;
- }
- }
- taskSelector.selectedIndex = taskIndex;
- }
-
- var gainInfo = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("p", {id:name + "gang-member-gain-info"});
- taskDiv.appendChild(taskSelector);
- taskDiv.appendChild(gainInfo);
-
- //Panel for Description of task
- var taskDescDiv = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("div", {
- id:name + "gang-member-task-desc", class:"gang-member-info-div",
- width:"30%", display:"inline"
- });
-
- var taskDescP = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("p", {id: name + "gang-member-task-description", display:"inline"});
- taskDescDiv.appendChild(taskDescP);
-
- statsDiv.style.width = "30%";
- taskDiv.style.width = "30%";
- taskDescDiv.style.width = "30%";
- statsDiv.style.display = "inline";
- taskDiv.style.display = "inline";
- taskDescDiv.style.display = "inline";
- gangMemberDiv.appendChild(statsDiv);
- gangMemberDiv.appendChild(taskDiv);
- gangMemberDiv.appendChild(taskDescDiv);
-
- gangMemberList.appendChild(li);
- setGangMemberTaskDescription(memberObj, taskName); //Initialize description
- updateGangMemberDisplayElement(memberObj);
-}
-
-function updateGangMemberDisplayElement(memberObj) {
- if (!gangContentCreated || !_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].inGang()) {return;}
- var name = memberObj.name;
-
- //TODO Add upgrade information
- var stats = document.getElementById(name + "gang-member-stats-text");
- if (stats) {
- stats.innerHTML =
- "Hacking: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(memberObj.hack, 0) + " (" + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_7___default()(memberObj.hack_exp).format('(0.00a)') + " exp)
" +
- "Strength: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(memberObj.str, 0) + " (" + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_7___default()(memberObj.str_exp).format('(0.00a)') + " exp)
" +
- "Defense: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(memberObj.def, 0) + " (" + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_7___default()(memberObj.def_exp).format('(0.00a)') + " exp)
" +
- "Dexterity: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(memberObj.dex, 0) + " (" + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_7___default()(memberObj.dex_exp).format('(0.00a)') + " exp)
" +
- "Agility: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(memberObj.agi, 0) + " (" + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_7___default()(memberObj.agi_exp).format('(0.00a)') + " exp)
" +
- "Charisma: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(memberObj.cha, 0) + " (" + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_7___default()(memberObj.cha_exp).format('(0.00a)') + " exp)
";
- }
-
- var gainInfo = document.getElementById(name + "gang-member-gain-info");
- if (gainInfo) {
- gainInfo.innerHTML =
- "Money: $" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(5*memberObj.calculateMoneyGain(), 2) + " / sec
" +
- "Respect: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(5*memberObj.calculateRespectGain(), 6) + " / sec
" +
- "Wanted Level: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(5*memberObj.calculateWantedLevelGain(), 6) + " / sec
";
- }
-}
-
-function setGangMemberTaskDescription(memberObj, taskName) {
- var name = memberObj.name;
- var taskDesc = document.getElementById(name + "gang-member-task-description");
- if (taskDesc) {
- var task = GangMemberTasks[taskName];
- if (task == null) {return;}
- var desc = task.desc;
- taskDesc.innerHTML = desc;
- }
-}
-
-function deleteGangDisplayContent() {
- if (gangContainer != null) {Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["removeElementById"])(gangContainer.id);}
-
- gangContentCreated = false;
- gangContainer = null;
- managementButton = null;
- territoryButton = null;
-
- //Subpages
- gangManagementSubpage = null;
- gangTerritorySubpage = null;
-
- //Gang Management Elements
- gangDesc = null;
- gangInfo = null;
- gangRecruitMemberButton = null;
- gangRecruitRequirementText = null;
- gangExpandAllButton = null;
- gangCollapseAllButton = null;
- gangMemberFilter = null;
- gangManageEquipmentButton = null;
- gangMemberList = null;
-
- //Gang Equipment Upgrade Elements
- gangMemberUpgradeBox = null;
- gangMemberUpgradeBoxContent = null;
- gangMemberUpgradeBoxFilter = null;
- gangMemberUpgradeBoxElements = null;
-}
-
-
-
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ 41)))
-
-/***/ }),
-/* 36 */
/*!************************!*\
!*** ./utils/acorn.js ***!
\************************/
@@ -37863,6 +36537,1474 @@ Object.defineProperty(exports, '__esModule', { value: true });
})));
+/***/ }),
+/* 36 */
+/*!*********************!*\
+ !*** ./src/Gang.js ***!
+ \*********************/
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Gang", function() { return Gang; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "displayGangContent", function() { return displayGangContent; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateGangContent", function() { return updateGangContent; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "loadAllGangs", function() { return loadAllGangs; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AllGangs", function() { return AllGangs; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "resetGangs", function() { return resetGangs; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "deleteGangDisplayContent", function() { return deleteGangDisplayContent; });
+/* harmony import */ var _Constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Constants.js */ 3);
+/* harmony import */ var _engine_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./engine.js */ 5);
+/* harmony import */ var _Faction_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Faction.js */ 11);
+/* harmony import */ var _Player_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Player.js */ 0);
+/* harmony import */ var _utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils/DialogBox.js */ 6);
+/* harmony import */ var _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils/JSONReviver.js */ 8);
+/* harmony import */ var _utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../utils/HelperFunctions.js */ 1);
+/* harmony import */ var _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../utils/numeral.min.js */ 13);
+/* harmony import */ var _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_7__);
+/* harmony import */ var _utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../utils/StringHelperFunctions.js */ 2);
+/* harmony import */ var _utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../utils/YesNoBox.js */ 12);
+
+
+
+
+
+
+
+
+
+
+
+/* Gang.js */
+//Switch between territory and management screen with 1 and 2
+$(document).keydown(function(event) {
+ if (_engine_js__WEBPACK_IMPORTED_MODULE_1__["Engine"].currentPage == _engine_js__WEBPACK_IMPORTED_MODULE_1__["Engine"].Page.Gang && !_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_9__["yesNoBoxOpen"]) {
+ if (gangMemberFilter != null && gangMemberFilter === document.activeElement) {return;}
+ if (event.keyCode === 49) {
+ if(gangTerritorySubpage.style.display === "block") {
+ managementButton.click();
+ }
+ } else if (event.keyCode === 50) {
+ if (gangManagementSubpage.style.display === "block") {
+ territoryButton.click();
+ }
+ }
+ }
+});
+
+//Delete upgrade box when clicking outside
+$(document).mousedown(function(event) {
+ var boxId = "gang-member-upgrade-popup-box";
+ var contentId = "gang-member-upgrade-popup-box-content";
+ if (gangMemberUpgradeBoxOpened) {
+ if ( $(event.target).closest("#" + contentId).get(0) == null ) {
+ //Delete the box
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["removeElement"])(gangMemberUpgradeBox);
+ gangMemberUpgradeBox = null;
+ gangMemberUpgradeBoxContent = null;
+ gangMemberUpgradeBoxOpened = false;
+ gangMemberUpgradeBoxElements = null;
+ }
+ }
+});
+
+let GangNames = ["Slum Snakes", "Tetrads", "The Syndicate", "The Dark Army", "Speakers for the Dead",
+ "NiteSec", "The Black Hand"];
+let AllGangs = {
+ "Slum Snakes" : {
+ power: 1,
+ territory: 1/7,
+ },
+ "Tetrads" : {
+ power: 1,
+ territory: 1/7,
+ },
+ "The Syndicate" : {
+ power: 1,
+ territory: 1/7,
+ },
+ "The Dark Army" : {
+ power: 1,
+ territory: 1/7,
+ },
+ "Speakers for the Dead" : {
+ power: 1,
+ territory: 1/7,
+ },
+ "NiteSec" : {
+ power: 1,
+ territory: 1/7,
+ },
+ "The Black Hand" : {
+ power: 1,
+ territory: 1/7,
+ },
+}
+
+function resetGangs() {
+ AllGangs = {
+ "Slum Snakes" : {
+ power: 1,
+ territory: 1/7,
+ },
+ "Tetrads" : {
+ power: 1,
+ territory: 1/7,
+ },
+ "The Syndicate" : {
+ power: 1,
+ territory: 1/7,
+ },
+ "The Dark Army" : {
+ power: 1,
+ territory: 1/7,
+ },
+ "Speakers for the Dead" : {
+ power: 1,
+ territory: 1/7,
+ },
+ "NiteSec" : {
+ power: 1,
+ territory: 1/7,
+ },
+ "The Black Hand" : {
+ power: 1,
+ territory: 1/7,
+ },
+ }
+}
+
+function loadAllGangs(saveString) {
+ AllGangs = JSON.parse(saveString, _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_5__["Reviver"]);
+}
+
+//Power is an estimate of a gang's ability to gain/defend territory
+let gangStoredPowerCycles = 0;
+function processAllGangPowerGains(numCycles=1) {
+ if (!_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].inGang()) {return;}
+ gangStoredPowerCycles += numCycles;
+ if (gangStoredPowerCycles < 150) {return;}
+ var playerGangName = _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.facName;
+ for (var name in AllGangs) {
+ if (AllGangs.hasOwnProperty(name)) {
+ if (name == playerGangName) {
+ AllGangs[name].power += _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.calculatePower();
+ } else {
+ var gain = Math.random() * 0.02; //TODO Adjust as necessary
+ AllGangs[name].power += (gain);
+ }
+ }
+ }
+
+ gangStoredPowerCycles -= 150;
+}
+
+let gangStoredTerritoryCycles = 0;
+function processAllGangTerritory(numCycles=1) {
+ if (!_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].inGang()) {return;}
+ gangStoredTerritoryCycles += numCycles;
+ if (gangStoredTerritoryCycles < _Constants_js__WEBPACK_IMPORTED_MODULE_0__["CONSTANTS"].GangTerritoryUpdateTimer) {return;}
+
+ for (var i = 0; i < GangNames.length; ++i) {
+ var other = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(0, GangNames.length-1);
+ while(other == i) {
+ other = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["getRandomInt"])(0, GangNames.length-1);
+ }
+ var thisPwr = AllGangs[GangNames[i]].power;
+ var otherPwr = AllGangs[GangNames[other]].power;
+ var thisChance = thisPwr / (thisPwr + otherPwr);
+
+ if (Math.random() < thisChance) {
+ if (AllGangs[GangNames[other]].territory <= 0) {
+ return;
+ }
+ AllGangs[GangNames[i]].territory += 0.0001;
+ AllGangs[GangNames[other]].territory -= 0.0001;
+ } else {
+ if (AllGangs[GangNames[i]].territory <= 0) {
+ return;
+ }
+ AllGangs[GangNames[i]].territory -= 0.0001;
+ AllGangs[GangNames[other]].territory += 0.0001;
+ }
+ }
+
+ gangStoredTerritoryCycles -= _Constants_js__WEBPACK_IMPORTED_MODULE_0__["CONSTANTS"].GangTerritoryUpdateTimer;
+}
+
+/* faction - Name of corresponding faction
+ hacking - Boolean indicating whether its a hacking gang or not
+ */
+function Gang(facName, hacking=false) {
+ this.facName = facName;
+ this.members = []; //Array of GangMembers
+ this.wanted = 1;
+ this.respect = 1;
+ this.power = 0;
+
+ this.isHackingGang = hacking;
+
+ this.respectGainRate = 0;
+ this.wantedGainRate = 0;
+ this.moneyGainRate = 0;
+
+ //When processing gains, this stores the number of cycles until some
+ //limit is reached, and then calculates and applies the gains only at that limit
+ this.storedCycles = 0;
+}
+
+Gang.prototype.process = function(numCycles=1) {
+ this.processGains(numCycles);
+ this.processExperienceGains(numCycles);
+ processAllGangPowerGains(numCycles);
+ processAllGangTerritory(numCycles);
+}
+
+Gang.prototype.processGains = function(numCycles=1) {
+ this.storedCycles += numCycles;
+ if (isNaN(this.storedCycles)) {
+ console.log("ERROR: Gang's storedCylces is NaN");
+ this.storedCycles = 0;
+ }
+ if (this.storedCycles < 25) {return;} //Only process every 5 seconds at least
+
+ //Get gains per cycle
+ var moneyGains = 0, respectGains = 0, wantedLevelGains = 0;
+ for (var i = 0; i < this.members.length; ++i) {
+ respectGains += (this.members[i].calculateRespectGain());
+ wantedLevelGains += (this.members[i].calculateWantedLevelGain());
+ moneyGains += (this.members[i].calculateMoneyGain());
+ }
+ this.respectGainRate = respectGains;
+ this.wantedGainRate = wantedLevelGains;
+ this.moneyGainRate = moneyGains;
+
+ if (!isNaN(respectGains)) {
+ var gain = respectGains * this.storedCycles;
+ this.respect += (gain);
+ //Faction reputation gains is respect gain divided by some constant
+ var fac = _Faction_js__WEBPACK_IMPORTED_MODULE_2__["Factions"][this.facName];
+ if (!(fac instanceof _Faction_js__WEBPACK_IMPORTED_MODULE_2__["Faction"])) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_4__["dialogBoxCreate"])("ERROR: Could not get Faction associates with your gang. This is a bug, please report to game dev");
+ } else {
+ var favorMult = 1 + (fac.favor / 100);
+ fac.playerReputation += ((_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].faction_rep_mult * gain * favorMult) / _Constants_js__WEBPACK_IMPORTED_MODULE_0__["CONSTANTS"].GangRespectToReputationRatio);
+ }
+
+ } else {
+ console.log("ERROR: respectGains is NaN");
+ }
+ if (!isNaN(wantedLevelGains)) {
+ if (this.wanted === 1 && wantedLevelGains < 0) {
+ //Do nothing
+ } else {
+ this.wanted += (wantedLevelGains * this.storedCycles);
+ if (this.wanted < 1) {this.wanted = 1;}
+ }
+ } else {
+ console.log("ERROR: wantedLevelGains is NaN");
+ }
+ if (!isNaN(moneyGains)) {
+ _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gainMoney(moneyGains * this.storedCycles);
+ } else {
+ console.log("ERROR: respectGains is NaN");
+ }
+
+ this.storedCycles = 0;
+}
+
+Gang.prototype.processExperienceGains = function(numCycles=1) {
+ for (var i = 0; i < this.members.length; ++i) {
+ this.members[i].gainExperience(numCycles);
+ this.members[i].updateSkillLevels();
+ }
+}
+
+//Calculates power GAIN, which is added onto the Gang's existing power
+Gang.prototype.calculatePower = function() {
+ var memberTotal = 0;
+ for (var i = 0; i < this.members.length; ++i) {
+ if (this.members[i].task instanceof GangMemberTask &&
+ this.members[i].task.name == "Territory Warfare") {
+ memberTotal += this.members[i].calculatePower();
+ }
+ }
+ return (0.0005 * memberTotal);
+}
+
+Gang.prototype.autoAssignMemberToTask = function(taskName) {
+ for (var i = 0; i < this.members.length; ++i) {
+ if (this.members[i].task.name === taskName) {
+ this.members[i].assignToTask(taskName);
+ return true;
+ }
+ }
+ return false;
+}
+
+Gang.prototype.autoUnassignMemberFromTask = function(taskName) {
+ for (var i = 0; i < this.members.length; ++i) {
+ if (this.members[i].task.name === taskName) {
+ this.members[i].unassignFromTask();
+ return true;
+ }
+ }
+ return false;
+}
+
+Gang.prototype.toJSON = function() {
+ return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_5__["Generic_toJSON"])("Gang", this);
+}
+
+Gang.fromJSON = function(value) {
+ return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_5__["Generic_fromJSON"])(Gang, value.data);
+}
+
+_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_5__["Reviver"].constructors.Gang = Gang;
+
+/*** Gang Member object ***/
+function GangMember(name) {
+ this.name = name;
+ this.task = GangMemberTasks["Unassigned"]; //GangMemberTask object
+ this.city = _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].city;
+
+ this.hack = 1;
+ this.str = 1;
+ this.def = 1;
+ this.dex = 1;
+ this.agi = 1;
+ this.cha = 1;
+
+ this.hack_exp = 0;
+ this.str_exp = 0;
+ this.def_exp = 0;
+ this.dex_exp = 0;
+ this.agi_exp = 0;
+ this.cha_exp = 0;
+
+ this.hack_mult = 1;
+ this.str_mult = 1;
+ this.def_mult = 1;
+ this.dex_mult = 1;
+ this.agi_mult = 1;
+ this.cha_mult = 1;
+
+ this.upgrades = []; //Names of upgrades
+}
+
+//Same formula for Player
+GangMember.prototype.calculateSkill = function(exp) {
+ return Math.max(Math.floor(32 * Math.log(exp + 534.5) - 200), 1);
+}
+
+GangMember.prototype.updateSkillLevels = function() {
+ this.hack = Math.floor(this.calculateSkill(this.hack_exp) * this.hack_mult);
+ this.str = Math.floor(this.calculateSkill(this.str_exp) * this.str_mult);
+ this.def = Math.floor(this.calculateSkill(this.def_exp) * this.def_mult);
+ this.dex = Math.floor(this.calculateSkill(this.dex_exp) * this.dex_mult);
+ this.agi = Math.floor(this.calculateSkill(this.agi_exp) * this.agi_mult);
+ this.cha = Math.floor(this.calculateSkill(this.cha_exp) * this.cha_mult);
+}
+
+GangMember.prototype.calculatePower = function() {
+ return (this.hack + this.str + this.def +
+ this.dex + this.agi + this.cha) / 100;
+}
+
+GangMember.prototype.assignToTask = function(taskName) {
+ if (GangMemberTasks.hasOwnProperty(taskName)) {
+ this.task = GangMemberTasks[taskName];
+ } else {
+ this.task = GangMemberTasks["Unassigned"];
+ }
+}
+
+GangMember.prototype.unassignFromTask = function() {
+ if (GangMemberTasks.hasOwnProperty("Unassigned")) {
+ this.task = GangMemberTasks["Unassigned"];
+ } else {
+ console.log("ERROR: Can't find Unassigned Gang member task");
+ this.task = null;
+ }
+}
+
+//Gains are per cycle
+GangMember.prototype.calculateRespectGain = function() {
+ var task = this.task;
+ if (task == null || !(task instanceof GangMemberTask) || task.baseRespect === 0) {return 0;}
+ var 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;
+ statWeight -= (3.5 * task.difficulty);
+ if (statWeight <= 0) {return 0;}
+ var territoryMult = AllGangs[_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.facName].territory;
+ if (territoryMult <= 0) {return 0;}
+ var respectMult = (_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.respect) / (_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.respect + _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.wanted);
+ return 12 * task.baseRespect * statWeight * territoryMult * respectMult;
+}
+
+GangMember.prototype.calculateWantedLevelGain = function() {
+ var task = this.task;
+ if (task == null || !(task instanceof GangMemberTask) || task.baseWanted === 0) {return 0;}
+ var 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;
+ statWeight -= (3.5 * task.difficulty);
+ if (statWeight <= 0) {return 0;}
+ var territoryMult = AllGangs[_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.facName].territory;
+ if (territoryMult <= 0) {return 0;}
+ if (task.baseWanted < 0) {
+ return task.baseWanted * statWeight * territoryMult;
+ } else {
+ return 6 * task.baseWanted / (3 * statWeight * territoryMult);
+ }
+}
+
+GangMember.prototype.calculateMoneyGain = function() {
+ var task = this.task;
+ if (task == null || !(task instanceof GangMemberTask) || task.baseMoney === 0) {return 0;}
+ var 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;
+ statWeight -= (3.5 * task.difficulty);
+ if (statWeight <= 0) {return 0;}
+ var territoryMult = AllGangs[_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.facName].territory;
+ if (territoryMult <= 0) {return 0;}
+ var respectMult = (_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.respect) / (_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.respect + _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.wanted);
+ return 5 * task.baseMoney * statWeight * territoryMult * respectMult;
+}
+
+GangMember.prototype.gainExperience = function(numCycles=1) {
+ var task = this.task;
+ if (task == null || !(task instanceof GangMemberTask)) {return;}
+ this.hack_exp += (task.hackWeight / 1500) * task.difficulty * numCycles;
+ this.str_exp += (task.strWeight / 1500) * task.difficulty * numCycles;
+ this.def_exp += (task.defWeight / 1500) * task.difficulty * numCycles;
+ this.dex_exp += (task.dexWeight / 1500) * task.difficulty * numCycles;
+ this.agi_exp += (task.agiWeight / 1500) * task.difficulty * numCycles;
+ this.cha_exp += (task.chaWeight / 1500) * task.difficulty * numCycles;
+}
+
+GangMember.prototype.toJSON = function() {
+ return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_5__["Generic_toJSON"])("GangMember", this);
+}
+
+GangMember.fromJSON = function(value) {
+ return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_5__["Generic_fromJSON"])(GangMember, value.data);
+}
+
+_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_5__["Reviver"].constructors.GangMember = GangMember;
+
+//Defines tasks that Gang Members can work on
+function GangMemberTask(name="", desc="",
+ params={baseRespect: 0, baseWanted: 0, baseMoney: 0,
+ hackWeight: 0, strWeight: 0, defWeight: 0,
+ dexWeight: 0, agiWeight: 0, chaWeight: 0,
+ difficulty: 0}) {
+ this.name = name;
+ this.desc = desc;
+
+ this.baseRespect = params.baseRespect ? params.baseRespect : 0;
+ this.baseWanted = params.baseWanted ? params.baseWanted : 0;
+ this.baseMoney = params.baseMoney ? params.baseMoney : 0;
+
+ //Weights must add up to 100
+ this.hackWeight = params.hackWeight ? params.hackWeight : 0;
+ this.strWeight = params.strWeight ? params.strWeight : 0;
+ this.defWeight = params.defWeight ? params.defWeight : 0;
+ this.dexWeight = params.dexWeight ? params.dexWeight : 0;
+ this.agiWeight = params.agiWeight ? params.agiWeight : 0;
+ this.chaWeight = params.chaWeight ? params.chaWeight : 0;
+
+ //1 - 100
+ this.difficulty = params.difficulty ? params.difficulty : 1;
+}
+
+GangMemberTask.prototype.toJSON = function() {
+ return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_5__["Generic_toJSON"])("GangMemberTask", this);
+}
+
+GangMemberTask.fromJSON = function(value) {
+ return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_5__["Generic_fromJSON"])(GangMemberTask, value.data);
+}
+
+_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_5__["Reviver"].constructors.GangMemberTask = GangMemberTask;
+
+//TODO Human trafficking and an equivalent hacking crime
+let GangMemberTasks = {
+ "Unassigned" : new GangMemberTask(
+ "Unassigned",
+ "This gang member is currently idle"),
+ "Ransomware" : new GangMemberTask(
+ "Ransomware",
+ "Assign this gang member to create and distribute ransomware
" +
+ "Earns money - Slightly increases respect - Slightly increases wanted level",
+ {baseRespect: 0.00005, baseWanted: 0.00001, baseMoney: 1,
+ hackWeight: 100, difficulty: 1}),
+ "Phishing" : new GangMemberTask(
+ "Phishing",
+ "Assign this gang member to attempt phishing scams and attacks
" +
+ "Earns money - Slightly increases respect - Slightly increases wanted level",
+ {baseRespect: 0.00008, baseWanted: 0.001, baseMoney: 2.5,
+ hackWeight: 85, chaWeight: 15, difficulty: 3}),
+ "Identity Theft" : new GangMemberTask(
+ "Identity Theft",
+ "Assign this gang member to attempt identity theft
" +
+ "Earns money - Increases respect - Increases wanted level",
+ {baseRespect: 0.0001, baseWanted: 0.01, baseMoney: 6,
+ hackWeight: 80, chaWeight: 20, difficulty: 4}),
+ "DDoS Attacks" : new GangMemberTask(
+ "DDoS Attacks",
+ "Assign this gang member to carry out DDoS attacks
" +
+ "Increases respect - Increases wanted level",
+ {baseRespect: 0.0004, baseWanted: 0.05,
+ hackWeight: 100, difficulty: 7}),
+ "Plant Virus" : new GangMemberTask(
+ "Plant Virus",
+ "Assign this gang member to create and distribute malicious viruses
" +
+ "Increases respect - Increases wanted level",
+ {baseRespect: 0.0006, baseWanted: 0.05,
+ hackWeight: 100, difficulty: 10}),
+ "Fraud & Counterfeiting" : new GangMemberTask(
+ "Fraud & Counterfeiting",
+ "Assign this gang member to commit financial fraud and digital counterfeiting
" +
+ "Earns money - Slightly increases respect - Slightly increases wanted level",
+ {baseRespect: 0.0005, baseWanted: 0.1, baseMoney: 15,
+ hackWeight: 80, chaWeight: 20, difficulty: 17}),
+ "Money Laundering" : new GangMemberTask(
+ "Money Laundering",
+ "Assign this gang member to launder money
" +
+ "Earns money - Increases respect - Increases wanted level",
+ {baseRespect: 0.0006, baseWanted:0.2, baseMoney: 40,
+ hackWeight: 75, chaWeight: 25, difficulty: 20}),
+ "Cyberterrorism" : new GangMemberTask(
+ "Cyberterrorism",
+ "Assign this gang member to commit acts of cyberterrorism
" +
+ "Greatly increases respect - Greatly increases wanted level",
+ {baseRespect: 0.001, baseWanted: 0.5,
+ hackWeight: 80, chaWeight: 20, difficulty: 33}),
+ "Ethical Hacking" : new GangMemberTask(
+ "Ethical Hacking",
+ "Assign this gang member to be an ethical hacker for corporations
" +
+ "Earns money - Lowers wanted level",
+ {baseWanted: -0.001, baseMoney: 1,
+ hackWeight: 90, chaWeight: 10, difficulty: 1}),
+ "Mug People" : new GangMemberTask(
+ "Mug People",
+ "Assign this gang member to mug random people on the streets
" +
+ "Earns money - Slightly increases respect - Very slightly increases wanted level",
+ {baseRespect: 0.00005, baseWanted: 0.00001, baseMoney: 1,
+ strWeight: 25, defWeight: 25, dexWeight: 25, agiWeight: 10, chaWeight: 15, difficulty: 1}),
+ "Deal Drugs" : new GangMemberTask(
+ "Deal Drugs",
+ "Assign this gang member to sell drugs.
" +
+ "Earns money - Slightly increases respect - Slightly increases wanted level",
+ {baseRespect: 0.00008, baseWanted: 0.001, baseMoney: 4,
+ agiWeight: 20, dexWeight: 20, chaWeight: 60, difficulty: 3}),
+ "Run a Con" : new GangMemberTask(
+ "Run a Con",
+ "Assign this gang member to run cons
" +
+ "Earns money - Increases respect - Increases wanted level",
+ {baseRespect: 0.00015, baseWanted: 0.01, baseMoney: 10,
+ strWeight: 5, defWeight: 5, agiWeight: 25, dexWeight: 25, chaWeight: 40, difficulty: 10}),
+ "Armed Robbery" : new GangMemberTask(
+ "Armed Robbery",
+ "Assign this gang member to commit armed robbery on stores, banks and armored cars
" +
+ "Earns money - Increases respect - Increases wanted level",
+ {baseRespect: 0.00015, baseWanted: 0.05, baseMoney: 25,
+ hackWeight: 20, strWeight: 15, defWeight: 15, agiWeight: 10, dexWeight: 20, chaWeight: 20,
+ difficulty: 17}),
+ "Traffick Illegal Arms" : new GangMemberTask(
+ "Traffick Illegal Arms",
+ "Assign this gang member to traffick illegal arms
" +
+ "Earns money - Increases respect - Increases wanted level",
+ {baseRespect: 0.0003, baseWanted: 0.1, baseMoney: 40,
+ hackWeight: 15, strWeight: 20, defWeight: 20, dexWeight: 20, chaWeight: 75,
+ difficulty: 25}),
+ "Threaten & Blackmail" : new GangMemberTask(
+ "Threaten & Blackmail",
+ "Assign this gang member to threaten and black mail high-profile targets
" +
+ "Earns money - Slightly increases respect - Slightly increases wanted level",
+ {baseRespect: 0.0002, baseWanted: 0.05, baseMoney: 15,
+ hackWeight: 25, strWeight: 25, dexWeight: 25, chaWeight: 25, difficulty: 28}),
+ "Terrorism" : new GangMemberTask(
+ "Terrorism",
+ "Assign this gang member to commit acts of terrorism
" +
+ "Greatly increases respect - Greatly increases wanted level",
+ {baseRespect: 0.001, baseWanted: 1,
+ hackWeight: 20, strWeight: 20, defWeight: 20,dexWeight: 20, chaWeight: 20,
+ difficulty: 33}),
+ "Vigilante Justice" : new GangMemberTask(
+ "Vigilante Justice",
+ "Assign this gang member to be a vigilante and protect the city from criminals
" +
+ "Decreases wanted level",
+ {baseWanted: -0.001,
+ hackWeight: 20, strWeight: 20, defWeight: 20, dexWeight: 20, agiWeight:20,
+ difficulty: 1}),
+ "Train Combat" : new GangMemberTask(
+ "Train Combat",
+ "Assign this gang member to increase their combat stats (str, def, dex, agi)",
+ {strWeight: 25, defWeight: 25, dexWeight: 25, agiWeight: 25, difficulty: 5}),
+ "Train Hacking" : new GangMemberTask(
+ "Train Hacking",
+ "Assign this gang member to train their hacking skills",
+ {hackWeight: 100, difficulty: 8}),
+ "Territory Warfare" : new GangMemberTask(
+ "Territory Warfare",
+ "Assign this gang member to engage in territorial warfare with other gangs. " +
+ "Members assigned to this task will help increase your gang's territory " +
+ "and will defend your territory from being taken.",
+ {hackWeight: 15, strWeight: 20, defWeight: 20, dexWeight: 20, agiWeight: 20,
+ chaWeight: 5, difficulty: 3}),
+}
+
+
+function GangMemberUpgrade(name="", desc="", cost=0, type="w") {
+ this.name = name;
+ this.desc = desc;
+ this.cost = cost;
+ this.type = type; //w, a, v, r
+}
+
+//Passes in a GangMember object
+GangMemberUpgrade.prototype.apply = function(member) {
+ switch(this.name) {
+ case "Baseball Bat":
+ member.str_mult *= 1.05;
+ member.def_mult *= 1.05;
+ break;
+ case "Katana":
+ member.str_mult *= 1.1;
+ member.def_mult *= 1.1;
+ member.dex_mult *= 1.1;
+ break;
+ case "Glock 18C":
+ member.str_mult *= 1.15;
+ member.def_mult *= 1.15;
+ member.dex_mult *= 1.15;
+ member.agi_mult *= 1.15;
+ break;
+ case "P90C":
+ member.str_mult *= 1.2;
+ member.def_mult *= 1.2;
+ member.agi_mult *= 1.1;
+ break;
+ case "Steyr AUG":
+ member.str_mult *= 1.25;
+ member.def_mult *= 1.25;
+ break;
+ case "AK-47":
+ member.str_mult *= 1.5;
+ member.def_mult *= 1.5;
+ break;
+ case "M15A10 Assault Rifle":
+ member.str_mult *= 1.6;
+ member.def_mult *= 1.6;
+ break;
+ case "AWM Sniper Rifle":
+ member.str_mult *= 1.5;
+ member.dex_mult *= 1.5;
+ member.agi_mult *= 1.5;
+ break;
+ case "Bulletproof Vest":
+ member.def_mult *= 1.05;
+ break;
+ case "Full Body Armor":
+ member.def_mult *= 1.1;
+ break;
+ case "Liquid Body Armor":
+ member.def_mult *= 1.25;
+ member.agi_mult *= 1.25;
+ break;
+ case "Graphene Plating Armor":
+ member.def_mult *= 1.5;
+ break;
+ case "Ford Flex V20":
+ member.agi_mult *= 1.1;
+ member.cha_mult *= 1.1;
+ break;
+ case "ATX1070 Superbike":
+ member.agi_mult *= 1.15;
+ member.cha_mult *= 1.15;
+ break;
+ case "Mercedes-Benz S9001":
+ member.agi_mult *= 1.2;
+ member.cha_mult *= 1.2;
+ break;
+ case "White Ferrari":
+ member.agi_mult *= 1.25;
+ member.cha_mult *= 1.25;
+ break;
+ case "NUKE Rootkit":
+ member.hack_mult *= 1.1;
+ break;
+ case "Soulstealer Rootkit":
+ member.hack_mult *= 1.2;
+ break;
+ case "Demon Rootkit":
+ member.hack_mult *= 1.3;
+ break;
+ default:
+ console.log("ERROR: Could not find this upgrade: " + this.name);
+ break;
+ }
+}
+
+GangMemberUpgrade.prototype.toJSON = function() {
+ return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_5__["Generic_toJSON"])("GangMemberUpgrade", this);
+}
+
+GangMemberUpgrade.fromJSON = function(value) {
+ return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_5__["Generic_fromJSON"])(GangMemberUpgrade, value.data);
+}
+
+_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_5__["Reviver"].constructors.GangMemberUpgrade = GangMemberUpgrade;
+
+let GangMemberUpgrades = {
+ "Baseball Bat" : new GangMemberUpgrade("Baseball Bat",
+ "Increases strength and defense by 5%", 1e6, "w"),
+ "Katana" : new GangMemberUpgrade("Katana",
+ "Increases strength, defense, and dexterity by 10%", 12e6, "w"),
+ "Glock 18C" : new GangMemberUpgrade("Glock 18C",
+ "Increases strength, defense, dexterity, and agility by 15%", 25e6, "w"),
+ "P90C" : new GangMemberUpgrade("P90C",
+ "Increases strength and defense by 20%. Increases agility by 10%", 50e6, "w"),
+ "Steyr AUG" : new GangMemberUpgrade("Steyr AUG",
+ "Increases strength and defense by 25%", 60e6, "w"),
+ "AK-47" : new GangMemberUpgrade("AK-47",
+ "Increases strength and defense by 50%", 100e6, "w"),
+ "M15A10 Assault Rifle" : new GangMemberUpgrade("M15A10 Assault Rifle",
+ "Increases strength and defense by 60%", 150e6, "w"),
+ "AWM Sniper Rifle" : new GangMemberUpgrade("AWM Sniper Rifle",
+ "Increases strength, dexterity, and agility by 50%", 225e6, "w"),
+ "Bulletproof Vest" : new GangMemberUpgrade("Bulletproof Vest",
+ "Increases defense by 5%", 2e6, "a"),
+ "Full Body Armor" : new GangMemberUpgrade("Full Body Armor",
+ "Increases defense by 10%", 5e6, "a"),
+ "Liquid Body Armor" : new GangMemberUpgrade("Liquid Body Armor",
+ "Increases defense and agility by 25%", 25e6, "a"),
+ "Graphene Plating Armor" : new GangMemberUpgrade("Graphene Plating Armor",
+ "Increases defense by 50%", 40e6, "a"),
+ "Ford Flex V20" : new GangMemberUpgrade("Ford Flex V20",
+ "Increases agility and charisma by 10%", 3e6, "v"),
+ "ATX1070 Superbike" : new GangMemberUpgrade("ATX1070 Superbike",
+ "Increases agility and charisma by 15%", 9e6, "v"),
+ "Mercedes-Benz S9001" : new GangMemberUpgrade("Mercedes-Benz S9001",
+ "Increases agility and charisma by 20%", 18e6, "v"),
+ "White Ferrari" : new GangMemberUpgrade("White Ferrari",
+ "Increases agility and charisma by 25%", 30e6, "v"),
+ "NUKE Rootkit" : new GangMemberUpgrade("NUKE Rootkit",
+ "Increases hacking by 10%", 5e6, "r"),
+ "Soulstealer Rootkit" : new GangMemberUpgrade("Soulstealer Rootkit",
+ "Increases hacking by 20%", 15e6, "r"),
+ "Demon Rootkit" : new GangMemberUpgrade("Demon Rootkit",
+ "Increases hacking by 30%", 50e6, "r"),
+}
+
+//Create a pop-up box that lets player purchase upgrades
+let gangMemberUpgradeBoxOpened = false;
+function createGangMemberUpgradeBox(initialFilter="") {
+ var boxId = "gang-member-upgrade-popup-box";
+ if (gangMemberUpgradeBoxOpened) {
+ //Already opened, refreshing
+ if (gangMemberUpgradeBoxElements == null || gangMemberUpgradeBox == null || gangMemberUpgradeBoxContent == null) {
+ console.log("ERROR: Refreshing Gang member upgrade box throws error because required elements are null");
+ return;
+ }
+
+ for (var i = 1; i < gangMemberUpgradeBoxElements.length; ++i) {
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["removeElement"])(gangMemberUpgradeBoxElements[i]);
+ }
+ gangMemberUpgradeBoxElements = [gangMemberUpgradeBoxFilter];
+
+ var filter = gangMemberUpgradeBoxFilter.value.toString();
+ for (var i = 0; i < _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.members.length; ++i) {
+ if (_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.members[i].name.indexOf(filter) > -1 || _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.members[i].task.name.indexOf(filter) > -1) {
+ var newPanel = createGangMemberUpgradePanel(_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.members[i]);
+ gangMemberUpgradeBoxContent.appendChild(newPanel);
+ gangMemberUpgradeBoxElements.push(newPanel);
+ }
+ }
+ } else {
+ //New popup
+ gangMemberUpgradeBoxFilter = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("input", {
+ type:"text", placeholder:"Filter gang members",
+ value:initialFilter,
+ onkeyup:()=>{
+ var filterValue = gangMemberUpgradeBoxFilter.value.toString();
+ createGangMemberUpgradeBox(filterValue);
+ }
+ });
+
+ gangMemberUpgradeBoxElements = [gangMemberUpgradeBoxFilter];
+
+ var filter = gangMemberUpgradeBoxFilter.value.toString();
+ for (var i = 0; i < _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.members.length; ++i) {
+ if (_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.members[i].name.indexOf(filter) > -1 || _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.members[i].task.name.indexOf(filter) > -1) {
+ gangMemberUpgradeBoxElements.push(createGangMemberUpgradePanel(_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.members[i]));
+ }
+ }
+
+ gangMemberUpgradeBox = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createPopup"])(boxId, gangMemberUpgradeBoxElements);
+ gangMemberUpgradeBoxContent = document.getElementById(boxId + "-content");
+ gangMemberUpgradeBoxOpened = true;
+ }
+}
+
+//Create upgrade panels for each individual Gang Member
+function createGangMemberUpgradePanel(memberObj) {
+ var container = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("div", {
+ border:"1px solid white",
+ });
+
+ var header = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("h1", {
+ innerText:memberObj.name + " (" + memberObj.task.name + ")"
+ });
+ container.appendChild(header);
+
+ var text = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("pre", {
+ fontSize:"14px", display: "inline-block", width:"20%",
+ innerText:
+ "Hack: " + memberObj.hack + " (x" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(memberObj.hack_mult, 2) + ")\n" +
+ "Str: " + memberObj.str + " (x" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(memberObj.str_mult, 2) + ")\n" +
+ "Def: " + memberObj.def + " (x" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(memberObj.def_mult, 2) + ")\n" +
+ "Dex: " + memberObj.dex + " (x" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(memberObj.dex_mult, 2) + ")\n" +
+ "Agi: " + memberObj.agi + " (x" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(memberObj.agi_mult, 2) + ")\n" +
+ "Cha: " + memberObj.cha + " (x" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(memberObj.cha_mult, 2) + ")\n",
+ });
+
+ //Already purchased upgrades
+ var ownedUpgradesElements = [];
+ for (var i = 0; i < memberObj.upgrades.length; ++i) {
+ var upg = GangMemberUpgrades[memberObj.upgrades[i]];
+ if (upg == null) {
+ console.log("ERR: Could not find this upgrade: " + memberObj.upgrades[i]);
+ continue;
+ }
+ var e = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("div", {
+ border:"1px solid white", innerText:memberObj.upgrades[i],
+ margin:"1px", padding:"1px", tooltip:upg.desc, fontSize:"12px",
+ });
+ ownedUpgradesElements.push(e);
+ }
+ var ownedUpgrades = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("div", {
+ display:"inline-block", marginLeft:"6px", width:"75%", innerText:"Purchased Upgrades:",
+ });
+ for (var i = 0; i < ownedUpgradesElements.length; ++i) {
+ ownedUpgrades.appendChild(ownedUpgradesElements[i]);
+ }
+ container.appendChild(text);
+ container.appendChild(ownedUpgrades);
+ container.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("br", {}));
+
+ //Upgrade buttons. Only show upgrades that can be afforded
+ var weaponUpgrades = [], armorUpgrades = [], vehicleUpgrades = [], rootkitUpgrades = [];
+ for (var upgName in GangMemberUpgrades) {
+ if (GangMemberUpgrades.hasOwnProperty(upgName)) {
+ var upg = GangMemberUpgrades[upgName];
+ if (_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].money.lt(upg.cost) || memberObj.upgrades.includes(upgName)) {continue;}
+ switch (upg.type) {
+ case "w":
+ weaponUpgrades.push(upg);
+ break;
+ case "a":
+ armorUpgrades.push(upg);
+ break;
+ case "v":
+ vehicleUpgrades.push(upg);
+ break;
+ case "r":
+ rootkitUpgrades.push(upg);
+ break;
+ default:
+ console.log("ERROR: Invalid Gang Member Upgrade Type: " + upg.type);
+ }
+ }
+ }
+
+ var weaponDiv = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("div", {width:"20%", display:"inline-block",});
+ var armorDiv = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("div", {width:"20%", display:"inline-block",});
+ var vehicleDiv = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("div", {width:"20%", display:"inline-block",});
+ var rootkitDiv = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("div", {width:"20%", display:"inline-block",});
+ var upgrades = [weaponUpgrades, armorUpgrades, vehicleUpgrades, rootkitUpgrades];
+ var divs = [weaponDiv, armorDiv, vehicleDiv, rootkitDiv];
+
+ for (var i = 0; i < upgrades.length; ++i) {
+ var upgradeArray = upgrades[i];
+ var div = divs[i];
+ for (var j = 0; j < upgradeArray.length; ++j) {
+ var upg = upgradeArray[j];
+ (function (upg, div, memberObj) {
+ div.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("a", {
+ innerText:upg.name + " - " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_7___default()(upg.cost).format("$0.000a"),
+ class:"a-link-button", margin:"2px", padding:"2px", display:"block",
+ fontSize:"12px",
+ tooltip:upg.desc,
+ clickListener:()=>{
+ if (_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].money.lt(upg.cost)) {return false;}
+ _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].loseMoney(upg.cost);
+ memberObj.upgrades.push(upg.name);
+ upg.apply(memberObj);
+ var initFilterValue = gangMemberUpgradeBoxFilter.value.toString();
+ createGangMemberUpgradeBox(initFilterValue);
+ return false;
+ }
+ }));
+ })(upg, div, memberObj);
+ }
+ }
+
+ container.appendChild(weaponDiv);
+ container.appendChild(armorDiv);
+ container.appendChild(vehicleDiv);
+ container.appendChild(rootkitDiv);
+ return container;
+}
+
+//Gang DOM elements
+let gangContentCreated = false,
+ gangContainer = null, managementButton = null, territoryButton = null;
+
+//Subpages
+let gangManagementSubpage = null, gangTerritorySubpage = null;
+
+//Gang Management Elements
+let gangDesc = null, gangInfo = null,
+ gangRecruitMemberButton = null, gangRecruitRequirementText = null,
+ gangExpandAllButton = null, gangCollapseAllButton, gangMemberFilter = null,
+ gangManageEquipmentButton = null,
+ gangMemberList = null;
+
+//Gang Equipment Upgrade Elements
+let gangMemberUpgradeBox = null, gangMemberUpgradeBoxContent = null,
+ gangMemberUpgradeBoxFilter = null, gangMemberUpgradeBoxElements = null;
+
+
+//Gang Territory Elements
+let gangTerritoryDescText = null, gangTerritoryInfoText = null;
+
+function displayGangContent() {
+ if (!gangContentCreated || gangContainer == null) {
+ gangContentCreated = true;
+
+ //Create gang container
+ gangContainer = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("div", {
+ id:"gang-container", class:"generic-menupage-container",
+ });
+
+ //Get variables
+ var facName = _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.facName,
+ members = _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.members,
+ wanted = _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.wanted,
+ respect = _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.respect;
+
+ //Back button
+ gangContainer.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("a", {
+ class:"a-link-button", display:"inline-block", innerText:"Back",
+ clickListener:()=>{
+ _engine_js__WEBPACK_IMPORTED_MODULE_1__["Engine"].loadFactionContent();
+ Object(_Faction_js__WEBPACK_IMPORTED_MODULE_2__["displayFactionContent"])(facName);
+ return false;
+ }
+ }));
+
+ //Buttons to switch between panels
+ managementButton = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("a", {
+ id:"gang-management-subpage-button", class:"a-link-button-inactive",
+ display:"inline-block", innerHTML: "Gang Management (1)",
+ clickListener:()=>{
+ gangManagementSubpage.style.display = "block";
+ gangTerritorySubpage.style.display = "none";
+ managementButton.classList.toggle("a-link-button-inactive");
+ managementButton.classList.toggle("a-link-button");
+ territoryButton.classList.toggle("a-link-button-inactive");
+ territoryButton.classList.toggle("a-link-button");
+ updateGangContent();
+ return false;
+ }
+ })
+ territoryButton = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("a", {
+ id:"gang-territory-subpage-button", class:"a-link-button",
+ display:"inline-block", innerHTML:"Gang Territory (2)",
+ clickListener:()=>{
+ gangManagementSubpage.style.display = "none";
+ gangTerritorySubpage.style.display = "block";
+ managementButton.classList.toggle("a-link-button-inactive");
+ managementButton.classList.toggle("a-link-button");
+ territoryButton.classList.toggle("a-link-button-inactive");
+ territoryButton.classList.toggle("a-link-button");
+ updateGangContent();
+ return false;
+ }
+ });
+ gangContainer.appendChild(managementButton);
+ gangContainer.appendChild(territoryButton);
+
+ //Subpage for managing gang members
+ gangManagementSubpage = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("div", {
+ display:"block", id:"gang-management-subpage",
+ });
+
+ var lowerWantedTask = "";
+ if (_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.isHackingGang) {
+ lowerWantedTask = "Ethical Hacking";
+ } else {
+ lowerWantedTask = "Vigilante Justice";
+ }
+ gangDesc = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("p", {width:"70%",
+ innerHTML:
+ "This page is used to manage your gang members and get an overview of your " +
+ "gang's stats.
" +
+ "If a gang member is not earning much money or respect, the task that you " +
+ "have assigned to that member might be too difficult. Consider training that " +
+ "member's stats or choosing an easier task. The tasks closer to the " +
+ "top of the dropdown list are generally easier. Alternatively, the gang member's " +
+ "low production might be due to the fact that your wanted level is too high. " +
+ "Consider assigning a few members to the '" + lowerWantedTask + "' " +
+ "task to lower your wanted level.
" +
+ "Installing Augmentations does NOT reset your progress with your Gang. " +
+ "Furthermore, after installing Augmentations, you will " +
+ "automatically be a member of whatever Faction you created your gang with.
"
+ });
+ gangManagementSubpage.appendChild(gangDesc);
+
+ gangInfo = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("p", {id:"gang-info", width:"70%"});
+ gangManagementSubpage.appendChild(gangInfo);
+
+ gangRecruitMemberButton = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("a", {
+ id:"gang-management-recruit-member-btn", class:"a-link-button-inactive",
+ innerHTML:"Recruit Gang Member", display:"inline-block", margin:"10px",
+ clickListener:()=>{
+ var yesBtn = Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_9__["yesNoTxtInpBoxGetYesButton"])(), noBtn = Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_9__["yesNoTxtInpBoxGetNoButton"])();
+ yesBtn.innerHTML = "Recruit Gang Member";
+ noBtn.innerHTML = "Cancel";
+ yesBtn.addEventListener("click", ()=>{
+ var name = Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_9__["yesNoTxtInpBoxGetInput"])();
+ if (name === "") {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_4__["dialogBoxCreate"])("You must enter a name for your Gang member!");
+ } else {
+ for (var i = 0; i < _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.members.length; ++i) {
+ if (name == _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.members[i].name) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_4__["dialogBoxCreate"])("You already have a gang member with this name!");
+ return false;
+ }
+ }
+ var member = new GangMember(name);
+ _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.members.push(member);
+ createGangMemberDisplayElement(member);
+ updateGangContent();
+ }
+ Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_9__["yesNoTxtInpBoxClose"])();
+ });
+ noBtn.addEventListener("click", ()=>{
+ Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_9__["yesNoTxtInpBoxClose"])();
+ });
+ Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_9__["yesNoTxtInpBoxCreate"])("Please enter a name for your new Gang member:");
+ return false;
+ }
+ });
+ gangManagementSubpage.appendChild(gangRecruitMemberButton);
+
+ //Text for how much reputation is required for recruiting next memberList
+ gangRecruitRequirementText = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("p", {color:"red", id:"gang-recruit-requirement-text"});
+ gangManagementSubpage.appendChild(gangRecruitRequirementText);
+
+ //Gang Member List management buttons (Expand/Collapse All, select a single member)
+ gangManagementSubpage.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("br", {}));
+ gangExpandAllButton = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("a", {
+ class:"a-link-button", display:"inline-block",
+ innerHTML:"Expand All",
+ clickListener:()=>{
+ var allHeaders = gangManagementSubpage.getElementsByClassName("accordion-header");
+ for (var i = 0; i < allHeaders.length; ++i) {
+ var hdr = allHeaders[i];
+ if (!hdr.classList.contains("active")) {
+ hdr.click();
+ }
+ }
+ return false;
+ }
+ });
+ gangCollapseAllButton = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("a", {
+ class:"a-link-button", display:"inline-block",
+ innerHTML:"Collapse All",
+ clickListener:()=>{
+ var allHeaders = gangManagementSubpage.getElementsByClassName("accordion-header");
+ for (var i = 0; i < allHeaders.length; ++i) {
+ var hdr = allHeaders[i];
+ if (hdr.classList.contains("active")) {
+ hdr.click();
+ }
+ }
+ return false;
+ }
+ });
+ gangMemberFilter = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("input", {
+ type:"text", placeholder:"Filter gang members", margin:"5px", padding:"5px",
+ onkeyup:()=>{
+ displayGangMemberList();
+ }
+ });
+ gangManageEquipmentButton = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("a", {
+ class:"a-link-button", display:"inline-block",
+ innerHTML:"Manage Equipment",
+ clickListener:()=>{
+ createGangMemberUpgradeBox();
+ }
+ });
+ gangManagementSubpage.appendChild(gangExpandAllButton);
+ gangManagementSubpage.appendChild(gangCollapseAllButton);
+ gangManagementSubpage.appendChild(gangMemberFilter);
+ gangManagementSubpage.appendChild(gangManageEquipmentButton);
+
+ //Gang Member list
+ gangMemberList = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("ul", {id:"gang-member-list"});
+ displayGangMemberList();
+ gangManagementSubpage.appendChild(gangMemberList);
+
+ //Subpage for seeing gang territory information
+ gangTerritorySubpage = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("div", {
+ id:"gang-territory-subpage", display:"none"
+ });
+
+ //Info text for territory page
+ gangTerritoryDescText = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("p", {
+ width:"70%",
+ innerHTML:"This page shows how much territory your Gang controls. This statistic is listed as a percentage, " +
+ "which represents how much of the total territory you control.
" +
+ "Territory gain and loss is processed automatically and is updated every ~30 seconds. Your chances " +
+ "to gain and lose territory depend on your Gang's power, which is listed in the display below. " +
+ "Your gang's power is determined by the stats of all Gang members you have assigned to the " +
+ "'Territory Warfare' task. Gang members that are not assigned to this task do not contribute to " +
+ "your Gang's power.
" +
+ "The amount of territory you have affects all aspects of your Gang members' production, including " +
+ "money, respect, and wanted level. It is very beneficial to have high territory control.
"
+ });
+ gangTerritorySubpage.appendChild(gangTerritoryDescText);
+
+ var territoryBorder = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("fieldset", {width:"50%", display:"inline-block"});
+
+ gangTerritoryInfoText = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("p", {id:"gang-territory-info"});
+
+ territoryBorder.appendChild(gangTerritoryInfoText);
+ gangTerritorySubpage.appendChild(territoryBorder);
+
+ gangContainer.appendChild(gangTerritorySubpage);
+ gangContainer.appendChild(gangManagementSubpage);
+ document.getElementById("entire-game-container").appendChild(gangContainer);
+ }
+ gangContainer.style.display = "block";
+ updateGangContent();
+}
+
+function displayGangMemberList() {
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["removeChildrenFromElement"])(gangMemberList);
+ var members = _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.members;
+ var filter = gangMemberFilter.value.toString();
+ for (var i = 0; i < members.length; ++i) {
+ if (members[i].name.indexOf(filter) > -1 || members[i].task.name.indexOf(filter) > -1) {
+ createGangMemberDisplayElement(members[i]);
+ }
+ }
+ //setGangMemberClickHandlers(); //Set buttons to toggle the gang member info panels
+}
+
+function updateGangContent() {
+ if (!gangContentCreated || !_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].inGang()) {return;}
+
+ if(gangTerritorySubpage.style.display === "block") {
+ //Update territory information
+ gangTerritoryInfoText.innerHTML = "";
+ for (var gangname in AllGangs) {
+ if (AllGangs.hasOwnProperty(gangname)) {
+ var gangTerritoryInfo = AllGangs[gangname];
+ if (gangname == _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.facName) {
+ gangTerritoryInfoText.innerHTML += ("" + gangname + "
(Power: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(gangTerritoryInfo.power, 6) + "): " +
+ Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(100*gangTerritoryInfo.territory, 2) + "%
");
+ } else {
+ gangTerritoryInfoText.innerHTML += (gangname + "
(Power: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(gangTerritoryInfo.power, 6) + "): " +
+ Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(100*gangTerritoryInfo.territory, 2) + "%
");
+ }
+ }
+ }
+ } else {
+ //Update information for overall gang
+ if (gangInfo instanceof Element) {
+ var faction = _Faction_js__WEBPACK_IMPORTED_MODULE_2__["Factions"][_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.facName];
+ var rep;
+ if (!(faction instanceof _Faction_js__WEBPACK_IMPORTED_MODULE_2__["Faction"])) {
+ rep = "ERROR";
+ } else {
+ rep = faction.playerReputation;
+ }
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["removeChildrenFromElement"])(gangInfo);
+ gangInfo.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("p", { //Respect
+ display:"inline-block",
+ innerText:"Respect: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.respect, 6) +
+ " (" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(5*_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.respectGainRate, 6) + " / sec)",
+ tooltip:"Represents the amount of respect your gang has from other gangs and criminal " +
+ "organizations. Your respect affects the amount of money " +
+ "your gang members will earn, and also determines how much " +
+ "reputation you are earning with your gang's corresponding Faction."
+ }));
+ gangInfo.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("br", {}));
+
+ gangInfo.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("p", { //Wanted level
+ display:"inline-block",
+ innerText:"Wanted Level: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.wanted, 6) +
+ " (" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(5*_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.wantedGainRate, 6) + " / sec)",
+ tooltip:"Represents how much the gang is wanted by law enforcement. The higher " +
+ "your gang's wanted level, the harder it will be for your gang members " +
+ "to make money and earn respect. Note that the minimum wanted level is 1."
+ }));
+ gangInfo.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("br", {}));
+
+ var wantedPenalty = (_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.respect) / (_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.respect + _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.wanted);
+ wantedPenalty = (1 - wantedPenalty) * 100;
+ gangInfo.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("p", { //Wanted Level multiplier
+ display:"inline-block",
+ innerText:"Wanted Level Penalty: -" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(wantedPenalty, 2) + "%",
+ tooltip:"Penalty for respect and money gain rates due to Wanted Level"
+ }));
+ gangInfo.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("br", {}));
+
+ gangInfo.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("p", { //Money gain rate
+ display:"inline-block",
+ innerText:"Money gain rate: $" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(5*_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.moneyGainRate, 2) +
+ " / sec",
+ }));
+ gangInfo.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("br", {}));
+
+ var territoryMult = AllGangs[_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.facName].territory;
+ gangInfo.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("p", { //Territory multiplier
+ display:"inline-block",
+ innerText:"Territory: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(territoryMult * 100, 3) + "%",
+ tooltip:"The percentage of total territory your Gang controls"
+ }));
+ gangInfo.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("br", {}));
+
+ gangInfo.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("p", { //Faction reputation
+ display:"inline-block",
+ innerText:"Faction reputation: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(rep, 3)
+ }));
+ gangInfo.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("br", {}));
+ } else {
+ console.log("ERROR: gang-info DOM element DNE");
+ }
+
+ //Toggle the 'Recruit member button' if valid
+ var numMembers = _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.members.length;
+ var repCost = 0;
+ if (numMembers > 0) {
+ var repCost = Math.pow(_Constants_js__WEBPACK_IMPORTED_MODULE_0__["CONSTANTS"].GangRecruitCostMultiplier, numMembers);
+ }
+ var faction = _Faction_js__WEBPACK_IMPORTED_MODULE_2__["Factions"][_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.facName];
+ if (faction == null) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_4__["dialogBoxCreate"])("Could not find your gang's faction. This is probably a bug please report to dev");
+ return;
+ }
+ var btn = gangRecruitMemberButton;
+ if (numMembers >= _Constants_js__WEBPACK_IMPORTED_MODULE_0__["CONSTANTS"].MaximumGangMembers) {
+ btn.className = "a-link-button-inactive";
+ gangRecruitRequirementText.style.display = "block";
+ gangRecruitRequirementText.innerHTML =
+ "You have reached the maximum amount of gang members";
+ } else if (faction.playerReputation >= repCost) {
+ btn.className = "a-link-button";
+ gangRecruitRequirementText.style.display = "none";
+ } else {
+ btn.className = "a-link-button-inactive";
+ gangRecruitRequirementText.style.display = "block";
+ gangRecruitRequirementText.innerHTML =
+ Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(repCost, 2) + " Faction reputation needed to recruit next member";
+ }
+
+ //Update information for each gang member
+ for (var i = 0; i < _Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.members.length; ++i) {
+ updateGangMemberDisplayElement(_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.members[i]);
+ }
+ }
+}
+
+//Takes in a GangMember object
+function createGangMemberDisplayElement(memberObj) {
+ if (!gangContentCreated || !_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].inGang()) {return;}
+ var name = memberObj.name;
+
+ var accordion = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createAccordionElement"])({
+ id:name + "gang-member",
+ hdrText:name,
+ });
+ var li = accordion[0];
+ var hdr = accordion[1];
+ var gangMemberDiv = accordion[2];
+
+ //Gang member content divided into 3 panels:
+ //Stats Panel
+ var statsDiv = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("div", {
+ id: name + "gang-member-stats", class: "gang-member-info-div",
+ width:"30%", display:"inline"
+ });
+ var statsP = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("p", {
+ id:name + "gang-member-stats-text", display:"inline"
+ });
+
+ statsDiv.appendChild(statsP);
+ //statsDiv.appendChild(upgradeButton);
+
+ //Panel for Selecting task and show respect/wanted gain
+ var taskDiv = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("div", {
+ id: name + "gang-member-task", class:"gang-member-info-div",
+ width:"30%", display:"inline"
+ });
+ var taskSelector = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("select", {
+ color:"white", backgroundColor:"black",
+ id:name + "gang-member-task-selector"
+ });
+
+ var tasks = null;
+ if (_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].gang.isHackingGang) {
+ tasks = ["---", "Ransomware", "Phishing", "Identity Theft", "DDoS Attacks",
+ "Plant Virus", "Fraud & Counterfeiting","Money Laundering",
+ "Cyberterrorism", "Ethical Hacking", "Train Combat",
+ "Train Hacking", "Territory Warfare"];
+ } else {
+ tasks = ["---", "Mug People", "Deal Drugs", "Run a Con", "Armed Robbery",
+ "Traffick Illegal Arms", "Threaten & Blackmail",
+ "Terrorism", "Vigilante Justice", "Train Combat",
+ "Train Hacking", "Territory Warfare"];
+ }
+ for (var i = 0; i < tasks.length; ++i) {
+ var option = document.createElement("option");
+ option.text = tasks[i];
+ taskSelector.add(option);
+ }
+ taskSelector.addEventListener("change", function() {
+ var task = taskSelector.options[taskSelector.selectedIndex].text;
+ memberObj.assignToTask(task);
+ setGangMemberTaskDescription(memberObj, task);
+ updateGangContent();
+ });
+ //Set initial task in selector element
+ if (memberObj.task instanceof GangMemberTask) {
+ var taskName = memberObj.task.name;
+ var taskIndex = 0;
+ for (let i = 0; i < tasks.length; ++i) {
+ if (taskName == tasks[i]) {
+ taskIndex = i;
+ break;
+ }
+ }
+ taskSelector.selectedIndex = taskIndex;
+ }
+
+ var gainInfo = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("p", {id:name + "gang-member-gain-info"});
+ taskDiv.appendChild(taskSelector);
+ taskDiv.appendChild(gainInfo);
+
+ //Panel for Description of task
+ var taskDescDiv = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("div", {
+ id:name + "gang-member-task-desc", class:"gang-member-info-div",
+ width:"30%", display:"inline"
+ });
+
+ var taskDescP = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["createElement"])("p", {id: name + "gang-member-task-description", display:"inline"});
+ taskDescDiv.appendChild(taskDescP);
+
+ statsDiv.style.width = "30%";
+ taskDiv.style.width = "30%";
+ taskDescDiv.style.width = "30%";
+ statsDiv.style.display = "inline";
+ taskDiv.style.display = "inline";
+ taskDescDiv.style.display = "inline";
+ gangMemberDiv.appendChild(statsDiv);
+ gangMemberDiv.appendChild(taskDiv);
+ gangMemberDiv.appendChild(taskDescDiv);
+
+ gangMemberList.appendChild(li);
+ setGangMemberTaskDescription(memberObj, taskName); //Initialize description
+ updateGangMemberDisplayElement(memberObj);
+}
+
+function updateGangMemberDisplayElement(memberObj) {
+ if (!gangContentCreated || !_Player_js__WEBPACK_IMPORTED_MODULE_3__["Player"].inGang()) {return;}
+ var name = memberObj.name;
+
+ //TODO Add upgrade information
+ var stats = document.getElementById(name + "gang-member-stats-text");
+ if (stats) {
+ stats.innerHTML =
+ "Hacking: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(memberObj.hack, 0) + " (" + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_7___default()(memberObj.hack_exp).format('(0.00a)') + " exp)
" +
+ "Strength: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(memberObj.str, 0) + " (" + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_7___default()(memberObj.str_exp).format('(0.00a)') + " exp)
" +
+ "Defense: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(memberObj.def, 0) + " (" + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_7___default()(memberObj.def_exp).format('(0.00a)') + " exp)
" +
+ "Dexterity: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(memberObj.dex, 0) + " (" + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_7___default()(memberObj.dex_exp).format('(0.00a)') + " exp)
" +
+ "Agility: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(memberObj.agi, 0) + " (" + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_7___default()(memberObj.agi_exp).format('(0.00a)') + " exp)
" +
+ "Charisma: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(memberObj.cha, 0) + " (" + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_7___default()(memberObj.cha_exp).format('(0.00a)') + " exp)
";
+ }
+
+ var gainInfo = document.getElementById(name + "gang-member-gain-info");
+ if (gainInfo) {
+ gainInfo.innerHTML =
+ "Money: $" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(5*memberObj.calculateMoneyGain(), 2) + " / sec
" +
+ "Respect: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(5*memberObj.calculateRespectGain(), 6) + " / sec
" +
+ "Wanted Level: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(5*memberObj.calculateWantedLevelGain(), 6) + " / sec
";
+ }
+}
+
+function setGangMemberTaskDescription(memberObj, taskName) {
+ var name = memberObj.name;
+ var taskDesc = document.getElementById(name + "gang-member-task-description");
+ if (taskDesc) {
+ var task = GangMemberTasks[taskName];
+ if (task == null) {return;}
+ var desc = task.desc;
+ taskDesc.innerHTML = desc;
+ }
+}
+
+function deleteGangDisplayContent() {
+ if (gangContainer != null) {Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["removeElementById"])(gangContainer.id);}
+
+ gangContentCreated = false;
+ gangContainer = null;
+ managementButton = null;
+ territoryButton = null;
+
+ //Subpages
+ gangManagementSubpage = null;
+ gangTerritorySubpage = null;
+
+ //Gang Management Elements
+ gangDesc = null;
+ gangInfo = null;
+ gangRecruitMemberButton = null;
+ gangRecruitRequirementText = null;
+ gangExpandAllButton = null;
+ gangCollapseAllButton = null;
+ gangMemberFilter = null;
+ gangManageEquipmentButton = null;
+ gangMemberList = null;
+
+ //Gang Equipment Upgrade Elements
+ gangMemberUpgradeBox = null;
+ gangMemberUpgradeBoxContent = null;
+ gangMemberUpgradeBoxFilter = null;
+ gangMemberUpgradeBoxElements = null;
+}
+
+
+
+/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ 38)))
+
/***/ }),
/* 37 */
/*!********************************************************!*\
@@ -38138,5583 +38280,6 @@ module.exports = GenericWorker;
/***/ }),
/* 38 */
-/*!****************************!*\
- !*** ./src/HacknetNode.js ***!
- \****************************/
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hacknetNodesInit", function() { return hacknetNodesInit; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HacknetNode", function() { return HacknetNode; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "purchaseHacknet", function() { return purchaseHacknet; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateTotalHacknetProduction", function() { return updateTotalHacknetProduction; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCostOfNextHacknetNode", function() { return getCostOfNextHacknetNode; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateHacknetNodesMultiplierButtons", function() { return updateHacknetNodesMultiplierButtons; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMaxNumberLevelUpgrades", function() { return getMaxNumberLevelUpgrades; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "displayHacknetNodesContent", function() { return displayHacknetNodesContent; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateHacknetNodesContent", function() { return updateHacknetNodesContent; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "processAllHacknetNodeEarnings", function() { return processAllHacknetNodeEarnings; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getHacknetNode", function() { return getHacknetNode; });
-/* harmony import */ var _BitNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BitNode.js */ 16);
-/* harmony import */ var _Constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Constants.js */ 3);
-/* harmony import */ var _engine_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./engine.js */ 5);
-/* harmony import */ var _InteractiveTutorial_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./InteractiveTutorial.js */ 25);
-/* harmony import */ var _Player_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Player.js */ 0);
-/* harmony import */ var _utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils/DialogBox.js */ 6);
-/* harmony import */ var _utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../utils/HelperFunctions.js */ 1);
-/* harmony import */ var _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../utils/JSONReviver.js */ 8);
-/* harmony import */ var _utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../utils/StringHelperFunctions.js */ 2);
-
-
-
-
-
-
-
-
-
-
-/* HacknetNode.js */
-function hacknetNodesInit() {
- var mult1x = document.getElementById("hacknet-nodes-1x-multiplier");
- mult1x.addEventListener("click", function() {
- hacknetNodePurchaseMultiplier = 1;
- updateHacknetNodesMultiplierButtons();
- updateHacknetNodesContent();
- return false;
- });
- var mult5x = document.getElementById("hacknet-nodes-5x-multiplier");
- mult5x.addEventListener("click", function() {
- hacknetNodePurchaseMultiplier = 5;
- updateHacknetNodesMultiplierButtons();
- updateHacknetNodesContent();
- return false;
- });
- var mult10x = document.getElementById("hacknet-nodes-10x-multiplier");
- mult10x.addEventListener("click", function() {
- hacknetNodePurchaseMultiplier = 10;
- updateHacknetNodesMultiplierButtons();
- updateHacknetNodesContent();
- return false;
- });
- var multMax = document.getElementById("hacknet-nodes-max-multiplier");
- multMax.addEventListener("click", function() {
- hacknetNodePurchaseMultiplier = 0;
- updateHacknetNodesMultiplierButtons();
- updateHacknetNodesContent();
- return false;
- });
-}
-document.addEventListener("DOMContentLoaded", hacknetNodesInit, false);
-
-function HacknetNode(name) {
- this.level = 1;
- this.ram = 1; //GB
- this.cores = 1;
-
- this.name = name;
-
- this.totalMoneyGenerated = 0;
- this.onlineTimeSeconds = 0;
-
- this.moneyGainRatePerSecond = 0;
-}
-
-HacknetNode.prototype.updateMoneyGainRate = function() {
- //How much extra $/s is gained per level
- var gainPerLevel = _Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].HacknetNodeMoneyGainPerLevel;
-
- this.moneyGainRatePerSecond = (this.level * gainPerLevel) *
- Math.pow(1.035, this.ram-1) *
- ((this.cores + 5) / 6) *
- _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].hacknet_node_money_mult *
- _BitNode_js__WEBPACK_IMPORTED_MODULE_0__["BitNodeMultipliers"].HacknetNodeMoney;
- if (isNaN(this.moneyGainRatePerSecond)) {
- this.moneyGainRatePerSecond = 0;
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_5__["dialogBoxCreate"])("Error in calculating Hacknet Node production. Please report to game developer");
- }
-
- updateTotalHacknetProduction();
-}
-
-HacknetNode.prototype.calculateLevelUpgradeCost = function(levels=1) {
- levels = Math.round(levels);
- if (isNaN(levels) || levels < 1) {return 0;}
- var mult = _Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].HacknetNodeUpgradeLevelMult;
- var totalMultiplier = 0; //Summed
- var currLevel = this.level;
- for (var i = 0; i < levels; ++i) {
- totalMultiplier += Math.pow(mult, currLevel);
- ++currLevel;
- }
- return _Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].BaseCostForHacknetNode / 2 * totalMultiplier * _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].hacknet_node_level_cost_mult;
-}
-
-//Wrapper function for Netscript
-HacknetNode.prototype.getLevelUpgradeCost = function(levels=1) {
- return this.calculateLevelUpgradeCost(levels);
-}
-
-HacknetNode.prototype.purchaseLevelUpgrade = function(levels=1) {
- levels = Math.round(levels);
- var cost = this.calculateLevelUpgradeCost(levels);
- if (isNaN(cost) || levels < 0) {return false;}
- if (this.level + levels > _Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].HacknetNodeMaxLevel) {
- var diff = Math.max(0, _Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].HacknetNodeMaxLevel - this.level);
- return this.purchaseLevelUpgrade(diff);
- }
- if (_Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].money.lt(cost)) {return false;}
- _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].loseMoney(cost);
- this.level += levels;
- this.updateMoneyGainRate();
- return true;
-}
-
-//Wrapper function for Netscript
-HacknetNode.prototype.upgradeLevel = function(levels=1) {
- return this.purchaseLevelUpgrade(levels);
-}
-
-HacknetNode.prototype.calculateRamUpgradeCost = function() {
- var numUpgrades = Math.log2(this.ram);
-
- //Calculate cost
- //Base cost of RAM is 50k per 1GB, increased by some multiplier for each time RAM is upgraded
- var baseCost = this.ram * _Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].BaseCostFor1GBOfRamHacknetNode;
- var mult = Math.pow(_Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].HacknetNodeUpgradeRamMult, numUpgrades);
- return baseCost * mult * _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].hacknet_node_ram_cost_mult;
-}
-
-//Wrapper function for Netscript
-HacknetNode.prototype.getRamUpgradeCost = function() {
- return this.calculateRamUpgradeCost();
-}
-
-HacknetNode.prototype.purchaseRamUpgrade = function() {
- var cost = this.calculateRamUpgradeCost();
- if (isNaN(cost)) {return false;}
- if (_Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].money.lt(cost)) {return false;}
- if (this.ram >= _Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].HacknetNodeMaxRam) {return false;}
- _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].loseMoney(cost);
- this.ram *= 2; //Ram is always doubled
- this.updateMoneyGainRate();
- return true;
-}
-
-//Wrapper function for Netscript
-HacknetNode.prototype.upgradeRam = function() {
- return this.purchaseRamUpgrade();
-}
-
-HacknetNode.prototype.calculateCoreUpgradeCost = function() {
- var coreBaseCost = _Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].BaseCostForHacknetNodeCore;
- var mult = _Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].HacknetNodeUpgradeCoreMult;
- return coreBaseCost * Math.pow(mult, this.cores-1) * _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].hacknet_node_core_cost_mult;
-}
-
-//Wrapper function for Netscript
-HacknetNode.prototype.getCoreUpgradeCost = function() {
- return this.calculateCoreUpgradeCost();
-}
-
-HacknetNode.prototype.purchaseCoreUpgrade = function() {
- var cost = this.calculateCoreUpgradeCost();
- if (isNaN(cost)) {return false;}
- if (_Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].money.lt(cost)) {return false;}
- if (this.cores >= _Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].HacknetNodeMaxCores) {return false;}
- _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].loseMoney(cost);
- ++this.cores;
- this.updateMoneyGainRate();
- return true;
-}
-
-//Wrapper function for Netscript
-HacknetNode.prototype.upgradeCore = function() {
- return this.purchaseCoreUpgrade();
-}
-
-/* Saving and loading HackNets */
-HacknetNode.prototype.toJSON = function() {
- return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_7__["Generic_toJSON"])("HacknetNode", this);
-}
-
-HacknetNode.fromJSON = function(value) {
- return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_7__["Generic_fromJSON"])(HacknetNode, value.data);
-}
-
-_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_7__["Reviver"].constructors.HacknetNode = HacknetNode;
-
-
-function purchaseHacknet() {
- /* INTERACTIVE TUTORIAL */
- if (_InteractiveTutorial_js__WEBPACK_IMPORTED_MODULE_3__["iTutorialIsRunning"]) {
- if (_InteractiveTutorial_js__WEBPACK_IMPORTED_MODULE_3__["currITutorialStep"] == _InteractiveTutorial_js__WEBPACK_IMPORTED_MODULE_3__["iTutorialSteps"].HacknetNodesIntroduction) {
- Object(_InteractiveTutorial_js__WEBPACK_IMPORTED_MODULE_3__["iTutorialNextStep"])();
- } else {
- return;
- }
- }
-
- /* END INTERACTIVE TUTORIAL */
-
- var cost = getCostOfNextHacknetNode();
- if (isNaN(cost)) {throw new Error("Cost is NaN"); return;}
- if (_Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].money.lt(cost)) {
- //dialogBoxCreate("You cannot afford to purchase a Hacknet Node!");
- return false;
- }
-
- //Auto generate a name for the node for now...TODO
- var numOwned = _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].hacknetNodes.length;
- var name = "hacknet-node-" + numOwned;
- var node = new HacknetNode(name);
- node.updateMoneyGainRate();
-
- _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].loseMoney(cost);
- _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].hacknetNodes.push(node);
-
- displayHacknetNodesContent();
- updateTotalHacknetProduction();
- return numOwned;
-}
-
-//Calculates the total production from all HacknetNodes
-function updateTotalHacknetProduction() {
- var total = 0;
- for (var i = 0; i < _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].hacknetNodes.length; ++i) {
- total += _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].hacknetNodes[i].moneyGainRatePerSecond;
- }
- _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].totalHacknetNodeProduction = total;
-}
-
-function getCostOfNextHacknetNode() {
- //Cost increases exponentially based on how many you own
- var numOwned = _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].hacknetNodes.length;
- var mult = _Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].HacknetNodePurchaseNextMult;
- return _Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].BaseCostForHacknetNode * Math.pow(mult, numOwned) * _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].hacknet_node_purchase_cost_mult;
-}
-
-var hacknetNodePurchaseMultiplier = 1;
-function updateHacknetNodesMultiplierButtons() {
- var mult1x = document.getElementById("hacknet-nodes-1x-multiplier");
- var mult5x = document.getElementById("hacknet-nodes-5x-multiplier");
- var mult10x = document.getElementById("hacknet-nodes-10x-multiplier");
- var multMax = document.getElementById("hacknet-nodes-max-multiplier");
- mult1x.setAttribute("class", "a-link-button");
- mult5x.setAttribute("class", "a-link-button");
- mult10x.setAttribute("class", "a-link-button");
- multMax.setAttribute("class", "a-link-button");
- if (_Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].hacknetNodes.length == 0) {
- mult1x.setAttribute("class", "a-link-button-inactive");
- mult5x.setAttribute("class", "a-link-button-inactive");
- mult10x.setAttribute("class", "a-link-button-inactive");
- multMax.setAttribute("class", "a-link-button-inactive");
- } else if (hacknetNodePurchaseMultiplier == 1) {
- mult1x.setAttribute("class", "a-link-button-inactive");
- } else if (hacknetNodePurchaseMultiplier == 5) {
- mult5x.setAttribute("class", "a-link-button-inactive");
- } else if (hacknetNodePurchaseMultiplier == 10) {
- mult10x.setAttribute("class", "a-link-button-inactive");
- } else {
- multMax.setAttribute("class", "a-link-button-inactive");
- }
-}
-
-//Calculate the maximum number of times the Player can afford to upgrade
-//a Hacknet Node's level"
-function getMaxNumberLevelUpgrades(nodeObj) {
- if (_Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].money.lt(nodeObj.calculateLevelUpgradeCost(1))) {return 0;}
- var min = 1;
- var max = _Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].HacknetNodeMaxLevel-1;
- var levelsToMax = _Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].HacknetNodeMaxLevel - nodeObj.level;
- if (_Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].money.gt(nodeObj.calculateLevelUpgradeCost(levelsToMax))) {
- return levelsToMax;
- }
-
- while (min <= max) {
- var curr = (min + max) / 2 | 0;
- if (curr != _Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].HacknetNodeMaxLevel &&
- _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].money.gt(nodeObj.calculateLevelUpgradeCost(curr)) &&
- _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].money.lt(nodeObj.calculateLevelUpgradeCost(curr+1))) {
- return Math.min(levelsToMax, curr);
- } else if (_Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].money.lt(nodeObj.calculateLevelUpgradeCost(curr))) {
- max = curr - 1;
- } else if (_Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].money.gt(nodeObj.calculateLevelUpgradeCost(curr))) {
- min = curr + 1;
- } else {
- return Math.min(levelsToMax, curr);
- }
- }
-}
-
-//Creates Hacknet Node DOM elements when the page is opened
-function displayHacknetNodesContent() {
- //Update Hacknet Nodes button
- var newPurchaseButton = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["clearEventListeners"])("hacknet-nodes-purchase-button");
-
- newPurchaseButton.addEventListener("click", function() {
- purchaseHacknet();
- return false;
- });
-
- //Handle Purchase multiplier buttons
- updateHacknetNodesMultiplierButtons();
-
- //Remove all old hacknet Node DOM elements
- var hacknetNodesList = document.getElementById("hacknet-nodes-list");
- while (hacknetNodesList.firstChild) {
- hacknetNodesList.removeChild(hacknetNodesList.firstChild);
- }
-
- //Then re-create them
- for (var i = 0; i < _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].hacknetNodes.length; ++i) {
- createHacknetNodeDomElement(_Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].hacknetNodes[i]);
- }
- updateHacknetNodesContent();
-}
-
-//Update information on all Hacknet Node DOM elements
-function updateHacknetNodesContent() {
- //Set purchase button to inactive if not enough money, and update its price display
- var cost = getCostOfNextHacknetNode();
- var purchaseButton = document.getElementById("hacknet-nodes-purchase-button");
- purchaseButton.innerHTML = "Purchase Hacknet Node - $" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(cost, 2);
- if (_Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].money.lt(cost)) {
- purchaseButton.setAttribute("class", "a-link-button-inactive");
- } else {
- purchaseButton.setAttribute("class", "a-link-button");
- }
-
- //Update player's money
- var moneyElem = document.getElementById("hacknet-nodes-money");
- moneyElem.innerHTML = "Money: $" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(_Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].money.toNumber(), 2) + "
" +
- "Total production from all Hacknet Nodes: $" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(_Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].totalHacknetNodeProduction, 2) + " / second";
-
- //Update information in each owned hacknet node
- for (var i = 0; i < _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].hacknetNodes.length; ++i) {
- updateHacknetNodeDomElement(_Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].hacknetNodes[i]);
- }
-}
-
-//Creates a single Hacknet Node DOM element
-function createHacknetNodeDomElement(nodeObj) {
- var nodeName = nodeObj.name;
-
- var listItem = document.createElement("li");
- listItem.setAttribute("class", "hacknet-node");
-
- var span = document.createElement("span");
- span.style.display = "inline";
-
- var buttonDiv = document.createElement("div");
- buttonDiv.setAttribute("class", "hacknet-node-button-div");
-
- //Text
- var txt = document.createElement("p");
- //txt.setAttribute("id", "hacknet-node-text-" + nodeName);
- txt.id = "hacknet-node-text-" + nodeName;
-
- //Upgrade buttons
- var upgradeLevelButton = document.createElement("a");
- var upgradeRamButton = document.createElement("a");
- var upgradeCoreButton = document.createElement("a");
-
- //upgradeLevelButton.setAttribute("id", "hacknet-node-upgrade-level-" + nodeName);
- upgradeLevelButton.id = "hacknet-node-upgrade-level-" + nodeName;
- upgradeLevelButton.setAttribute("class", "a-link-button-inactive");
- upgradeLevelButton.addEventListener("click", function() {
- var numUpgrades = hacknetNodePurchaseMultiplier;
- if (hacknetNodePurchaseMultiplier == 0) {
- numUpgrades = getMaxNumberLevelUpgrades(nodeObj);
- }
- nodeObj.purchaseLevelUpgrade(numUpgrades);
- updateHacknetNodesContent();
- return false;
- });
- //upgradeRamButton.setAttribute("id", "hacknet-node-upgrade-ram-" + nodeName);
- upgradeRamButton.id = "hacknet-node-upgrade-ram-" + nodeName;
- upgradeRamButton.setAttribute("class", "a-link-button-inactive");
- upgradeRamButton.addEventListener("click", function() {
- nodeObj.purchaseRamUpgrade();
- updateHacknetNodesContent();
- return false;
- });
- //upgradeCoreButton.setAttribute("id", "hacknet-node-upgrade-core-" + nodeName);
- upgradeCoreButton.id = "hacknet-node-upgrade-core-" + nodeName;
- upgradeCoreButton.setAttribute("class", "a-link-button-inactive");
- upgradeCoreButton.addEventListener("click", function() {
- nodeObj.purchaseCoreUpgrade();
- updateHacknetNodesContent();
- return false;
- });
-
- //Put all the components together in the li element
- span.appendChild(txt);
- buttonDiv.appendChild(upgradeLevelButton);
- buttonDiv.appendChild(upgradeRamButton);
- buttonDiv.appendChild(upgradeCoreButton);
- span.appendChild(buttonDiv);
- listItem.appendChild(span);
-
- document.getElementById("hacknet-nodes-list").appendChild(listItem);
-
- //Set the text and stuff inside the DOM element
- updateHacknetNodeDomElement(nodeObj);
-}
-
-//Updates information on a single hacknet node DOM element
-function updateHacknetNodeDomElement(nodeObj) {
- var nodeName = nodeObj.name;
- var txt = document.getElementById("hacknet-node-text-" + nodeName);
- if (txt == null) {throw new Error("Cannot find text element");}
- txt.innerHTML = "Node name: " + nodeName + "
" +
- "Production: $" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(nodeObj.totalMoneyGenerated, 2) +
- " ($" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(nodeObj.moneyGainRatePerSecond, 2) + " / second)
" +
- "Level: " + nodeObj.level + "
" +
- "RAM: " + nodeObj.ram + "GB
" +
- "Cores: " + nodeObj.cores;
-
- //Upgrade level
- var upgradeLevelButton = document.getElementById("hacknet-node-upgrade-level-" + nodeName);
- if (upgradeLevelButton == null) {throw new Error("Cannot find upgrade level button element");}
- if (nodeObj.level >= _Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].HacknetNodeMaxLevel) {
- upgradeLevelButton.innerHTML = "MAX LEVEL";
- upgradeLevelButton.setAttribute("class", "a-link-button-inactive");
- } else {
- var multiplier = 0;
- if (hacknetNodePurchaseMultiplier == 0) {
- //Max
- multiplier = getMaxNumberLevelUpgrades(nodeObj);
- } else {
- var levelsToMax = _Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].HacknetNodeMaxLevel - nodeObj.level;
- multiplier = Math.min(levelsToMax, hacknetNodePurchaseMultiplier);
- }
-
- var upgradeLevelCost = nodeObj.calculateLevelUpgradeCost(multiplier);
- upgradeLevelButton.innerHTML = "Upgrade Hacknet Node Level x" + multiplier +
- " - $" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(upgradeLevelCost, 2);
- if (_Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].money.lt(upgradeLevelCost)) {
- upgradeLevelButton.setAttribute("class", "a-link-button-inactive");
- } else {
- upgradeLevelButton.setAttribute("class", "a-link-button");
- }
- }
-
- //Upgrade RAM
- var upgradeRamButton = document.getElementById("hacknet-node-upgrade-ram-" + nodeName);
- if (upgradeRamButton == null) {throw new Error("Cannot find upgrade ram button element");}
- if (nodeObj.ram >= _Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].HacknetNodeMaxRam) {
- upgradeRamButton.innerHTML = "MAX RAM";
- upgradeRamButton.setAttribute("class", "a-link-button-inactive");
- } else {
- var upgradeRamCost = nodeObj.calculateRamUpgradeCost();
- upgradeRamButton.innerHTML = "Upgrade Hacknet Node RAM - $" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(upgradeRamCost, 2);
- if (_Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].money.lt(upgradeRamCost)) {
- upgradeRamButton.setAttribute("class", "a-link-button-inactive");
- } else {
- upgradeRamButton.setAttribute("class", "a-link-button");
- }
- }
-
- //Upgrade Cores
- var upgradeCoreButton = document.getElementById("hacknet-node-upgrade-core-" + nodeName);
- if (upgradeCoreButton == null) {throw new Error("Cannot find upgrade cores button element");}
- if (nodeObj.cores >= _Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].HacknetNodeMaxCores) {
- upgradeCoreButton.innerHTML = "MAX CORES";
- upgradeCoreButton.setAttribute("class", "a-link-button-inactive");
- } else {
- var upgradeCoreCost = nodeObj.calculateCoreUpgradeCost();
- upgradeCoreButton.innerHTML = "Purchase additional CPU Core - $" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(upgradeCoreCost, 2);
- if (_Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].money.lt(upgradeCoreCost)) {
- upgradeCoreButton.setAttribute("class", "a-link-button-inactive");
- } else {
- upgradeCoreButton.setAttribute("class", "a-link-button");
- }
- }
-}
-
-function processAllHacknetNodeEarnings(numCycles) {
- var total = 0;
- for (var i = 0; i < _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].hacknetNodes.length; ++i) {
- total += processSingleHacknetNodeEarnings(numCycles, _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].hacknetNodes[i]);
- }
- return total;
-}
-
-function processSingleHacknetNodeEarnings(numCycles, nodeObj) {
- var cyclesPerSecond = 1000 / _engine_js__WEBPACK_IMPORTED_MODULE_2__["Engine"]._idleSpeed;
- var earningPerCycle = nodeObj.moneyGainRatePerSecond / cyclesPerSecond;
- if (isNaN(earningPerCycle)) {
- console.log("ERROR: Hacknet Node Calculated earnings is NaN");
- earningPerCycle = 0;
- }
- var totalEarnings = numCycles * earningPerCycle;
- nodeObj.totalMoneyGenerated += totalEarnings;
- nodeObj.onlineTimeSeconds += (numCycles * (_engine_js__WEBPACK_IMPORTED_MODULE_2__["Engine"]._idleSpeed / 1000));
- _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].gainMoney(totalEarnings);
- return totalEarnings;
-}
-
-function getHacknetNode(name) {
- for (var i = 0; i < _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].hacknetNodes.length; ++i) {
- if (_Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].hacknetNodes[i].name == name) {
- return _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].hacknetNodes[i];
- }
- }
- return null;
-}
-
-
-
-
-/***/ }),
-/* 39 */
-/*!*************************!*\
- !*** ./src/TextFile.js ***!
- \*************************/
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextFile", function() { return TextFile; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTextFile", function() { return getTextFile; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createTextFile", function() { return createTextFile; });
-/* harmony import */ var _Server_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Server.js */ 10);
-/* harmony import */ var _utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/DialogBox.js */ 6);
-/* harmony import */ var _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/JSONReviver.js */ 8);
-
-
-
-
-function TextFile(fn="", txt="") {
- this.fn = fn.endsWith(".txt") ? fn : fn + ".txt";
- this.fn = this.fn.replace(/\s+/g, '');
- this.text = String(txt);
-}
-
-TextFile.prototype.append = function(txt) {
- this.text += String(txt);
-}
-
-TextFile.prototype.write = function(txt) {
- this.text = String(txt);
-}
-
-TextFile.prototype.read = function() {
- return this.txt;
-}
-
-TextFile.prototype.show = function() {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_1__["dialogBoxCreate"])(this.fn + "
" + this.text, true);
-}
-
-TextFile.prototype.download = function() {
- var filename = this.fn;
- var file = new Blob([this.text], {type: 'text/plain'});
- if (window.navigator.msSaveOrOpenBlob) {// IE10+
- window.navigator.msSaveOrOpenBlob(file, filename);
- } else { // Others
- var a = document.createElement("a"),
- url = URL.createObjectURL(file);
- a.href = url;
- a.download = this.fn;
- document.body.appendChild(a);
- a.click();
- setTimeout(function() {
- document.body.removeChild(a);
- window.URL.revokeObjectURL(url);
- }, 0);
- }
-}
-
-TextFile.prototype.toJSON = function() {
- return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_2__["Generic_toJSON"])("TextFile", this);
-}
-
-TextFile.fromJSON = function(value) {
- return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_2__["Generic_fromJSON"])(TextFile, value.data);
-}
-
-_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_2__["Reviver"].constructors.TextFile = TextFile;
-
-function getTextFile(fn, server) {
- if (!fn.endsWith(".txt")) {fn += ".txt";}
- for (var i = 0; i < server.textFiles.length; ++i) {
- if (server.textFiles[i].fn === fn) {
- return server.textFiles[i];
- }
- }
- return null;
-}
-
-//Returns the TextFile object that was just created
-function createTextFile(fn, txt, server) {
- if (getTextFile(fn, server) !== null) {
- console.log("ERROR: createTextFile failed because the specified " +
- "server already has a text file with the same fn");
- return;
- }
- var file = new TextFile(fn, txt);
- server.textFiles.push(file);
- return file;
-}
-
-function deleteTextFile(fn, server) {
- if (!fn.endsWith(".txt")) {fn += ".txt";}
- for (var i = 0; i < server.textFiles.length; ++i) {
- if (server.textFiles[i].fn === fn) {
- server.textFiles.splice(i, 1);
- return true;
- }
- }
- return false;
-}
-
-
-
-
-/***/ }),
-/* 40 */
-/*!**********************************!*\
- !*** ./src/CompanyManagement.js ***!
- \**********************************/
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Corporation", function() { return Corporation; });
-/* harmony import */ var _BitNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BitNode.js */ 16);
-/* harmony import */ var _engine_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./engine.js */ 5);
-/* harmony import */ var _Faction_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Faction.js */ 14);
-/* harmony import */ var _Literature_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Literature.js */ 53);
-/* harmony import */ var _Location_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Location.js */ 4);
-/* harmony import */ var _Player_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Player.js */ 0);
-/* harmony import */ var _utils_decimal_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../utils/decimal.js */ 23);
-/* harmony import */ var _utils_decimal_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_utils_decimal_js__WEBPACK_IMPORTED_MODULE_6__);
-/* harmony import */ var _utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../utils/DialogBox.js */ 6);
-/* harmony import */ var _utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../utils/HelperFunctions.js */ 1);
-/* harmony import */ var _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../utils/JSONReviver.js */ 8);
-/* harmony import */ var _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../utils/numeral.min.js */ 12);
-/* harmony import */ var _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10__);
-/* harmony import */ var _utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../utils/StringHelperFunctions.js */ 2);
-/* harmony import */ var _utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../utils/YesNoBox.js */ 11);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-/* State */
-var companyStates = ["START", "PURCHASE", "PRODUCTION", "SALE", "EXPORT"];
-function CorporationState() {
- this.state = 0;
-}
-
-CorporationState.prototype.nextState = function() {
- if (this.state < 0 || this.state >= companyStates.length) {
- this.state = 0;
- }
-
- ++this.state;
- if (this.state >= companyStates.length) {
- this.state = 0;
- }
-}
-
-CorporationState.prototype.getState = function() {
- return companyStates[this.state];
-}
-
-CorporationState.prototype.toJSON = function() {
- return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Generic_toJSON"])("CorporationState", this);
-}
-
-CorporationState.fromJSON = function(value) {
- return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Generic_fromJSON"])(CorporationState, value.data);
-}
-
-_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Reviver"].constructors.CorporationState = CorporationState;
-
-/* Constants */
-var TOTALSHARES = 1e9; //Total number of shares you have at your company
-var CyclesPerMarketCycle = 75;
-var CyclesPerIndustryStateCycle = CyclesPerMarketCycle / companyStates.length;
-var SecsPerMarketCycle = CyclesPerMarketCycle / 5;
-var Cities = ["Aevum", "Chongqing", "Sector-12", "New Tokyo", "Ishima", "Volhaven"];
-var WarehouseInitialCost = 5e9; //Initial purchase cost of warehouse
-var WarehouseInitialSize = 100;
-var WarehouseUpgradeBaseCost = 1e9;
-
-var OfficeInitialCost = 4e9;
-var OfficeInitialSize = 3;
-var OfficeUpgradeBaseCost = 1e9;
-
-var BribeThreshold = 100e12; //Money needed to be able to bribe for faction rep
-var BribeToRepRatio = 1e9; //Bribe Value divided by this = rep gain
-
-var ProductProductionCostRatio = 5; //Ratio of material cost of a product to its production cost
-
-function Material(params={}) {
- this.name = params.name ? params.name : "";
- this.qty = 0; //Quantity
- this.qlt = 0; //Quality, unbounded
- this.dmd = 0; //Demand, 0-100?
- this.dmdR = 0; //Range of possible demand
- this.cmp = 0; //Competition, 0-100
- this.cmpR = 0; //Range of possible competition
- this.mv = 0; //Maximum Volatility of stats
-
- //Markup. Determines how high of a price you can charge on the material
- //compared to the market price (bCost) based on quality
- //Quality is divided by this to determine markup limits
- //e.g if mku is 10 and quality is 100 then you can mark up prices by 100/10 = 10
- //without consequences
- this.mku = 0;
-
- this.buy = 0; //How much of this material is being bought per second
- this.sll = 0; //How much of this material is being sold per second
- this.prd = 0; //How much of this material is being produced per second
- this.exp = []; //Exports of this material to another warehouse/industry
- this.totalExp = 0; //Total export amount for last cycle
- this.imp = 0;
- this.bCost = 0; //$ Cost/sec to buy material
- this.sCost = 0; //$ Cost/sec to sell material
-
- //[Whether production/sale is limited, limit amount]
- this.prdman = [false, 0]; //Production for this material is manually limited
- this.sllman = [false, 0]; //Sale of this material is manually limited
- this.init();
-}
-
-Material.prototype.init = function(mats={}) {
- switch(this.name) {
- case "Water":
- this.dmd = 75; this.dmdR = [65, 85];
- this.cmp = 50; this.cmpR = [40, 60];
- this.bCost = 1000; this.mv = 0.2;
- this.mku = 6;
- break;
- case "Energy":
- this.dmd = 90; this.dmdR = [80, 100];
- this.cmp = 80; this.cmpR = [65, 95];
- this.bCost = 1500; this.mv = 0.2;
- this.mku = 6;
- break;
- case "Food":
- this.dmd = 80; this.dmdR = [70, 90];
- this.cmp = 60; this.cmpR = [35, 85];
- this.bCost = 5000; this.mv = 1;
- this.mku = 3;
- break;
- case "Plants":
- this.dmd = 70; this.dmdR = [20, 90];
- this.cmp = 50; this.cmpR = [30, 70];
- this.bCost = 3000; this.mv = 0.6;
- this.mku = 3.75;
- break;
- case "Metal":
- this.dmd = 80; this.dmdR = [75, 85];
- this.cmp = 70; this.cmpR = [60, 80];
- this.bCost = 2650; this.mv = 1;
- this.mku = 6;
- break;
- case "Hardware":
- this.dmd = 85; this.dmdR = [80, 90];
- this.cmp = 80; this.cmpR = [65, 95];
- this.bCost = 4000; this.mv = 0.5; //Less mv bc its processed twice
- this.mku = 1;
- break;
- case "Chemicals":
- this.dmd = 55; this.dmdR = [40, 70];
- this.cmp = 60; this.cmpR = [40, 80];
- this.bCost = 6750; this.mv = 1.2;
- this.mku = 2;
- break;
- case "Real Estate":
- this.dmd = 50; this.dmdR = [5, 100];
- this.cmp = 50; this.cmpR = [25, 75];
- this.bCost = 16e3; this.mv = 1.5; //Less mv bc its processed twice
- this.mku = 1.5;
- break;
- case "Drugs":
- this.dmd = 60; this.dmdR = [45, 75];
- this.cmp = 70; this.cmpR = [40, 100];
- this.bCost = 8e3; this.mv = 1.6;
- this.mku = 1;
- break;
- case "Robots":
- this.dmd = 90; this.dmdR = [80, 100];
- this.cmp = 90; this.cmpR = [80, 100];
- this.bCost = 20e3; this.mv = 0.5; //Less mv bc its processed twice
- this.mku = 1;
- break;
- case "AI Cores":
- this.dmd = 90; this.dmdR = [80, 100];
- this.cmp = 90; this.cmpR = [80, 100];
- this.bCost = 27e3; this.mv = 0.8; //Less mv bc its processed twice
- this.mku = 0.5;
- break;
- case "Scientific Research":
- break;
- default:
- console.log("Invalid material type in init(): " + this.name);
- break;
- }
-}
-
-//Process change in demand, competition, and buy cost of this material
-Material.prototype.processMarket = function() {
- //This 1st random check determines whether competition increases or decreases
- //More competition = lower market price
- var v = (Math.random() * this.mv) / 100;
- var pv = (Math.random() * this.mv) / 300;
- if (Math.random() < 0.42) {
- this.cmp *= (1+v);
- if (this.cmp > this.cmpR[1]) {this.cmp = this.cmpR[1]};
- this.bCost *= (1-pv);
- } else {
- this.cmp *= (1-v);
- if (this.cmp < this.cmpR[0]) {this.cmp = this.cmpR[0];}
- this.bCost *= (1+pv);
- }
-
- //This 2nd random check determines whether demand increases or decreases
- //More demand = higher market price
- v = (Math.random() * this.mv) / 100;
- pv = (Math.random() * this.mv) / 300;
- if (Math.random() < 0.45) {
- this.dmd *= (1+v);
- if (this.dmd > this.dmdR[1]) {this.dmd = this.dmdR[1];}
- this.bCost *= (1+pv);
- } else {
- this.dmd *= (1-v);
- if (this.dmd < this.dmdR[0]) {this.dmd = this.dmdR[0];}
- this.bCost *= (1-pv);
- }
-}
-
-Material.prototype.toJSON = function() {
- return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Generic_toJSON"])("Material", this);
-}
-
-Material.fromJSON = function(value) {
- return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Generic_fromJSON"])(Material, value.data);
-}
-
-_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Reviver"].constructors.Material = Material;
-
-//Map of material (by name) to their sizes (how much space it takes in warehouse)
-let MaterialSizes = {
- Water: 0.05,
- Energy: 0.01,
- Food: 0.03,
- Plants: 0.05,
- Metal: 0.1,
- Hardware: 0.06,
- Chemicals: 0.05,
- Drugs: 0.02,
- Robots: 0.5,
- "AICores": 0.1
-}
-
-function Product(params={}) {
- this.name = params.name ? params.name : 0;
- this.dmd = params.demand ? params.demand : 0;
- this.cmp = params.competition ? params.competition : 0;
- this.mku = params.markup ? params.markup : 0;
- this.pCost = 0; //An estimate of how much money it costs to make this
- this.sCost = 0; //How much this is selling for
-
- //Variables for creation of product
- this.fin = false; //Finished being created
- this.prog = 0; //0-100% created
- this.createCity = params.createCity ? params.createCity : ""; // City in which the product is being created
- this.designCost = params.designCost ? params.designCost : 0;
- this.advCost = params.advCost ? params.advCost : 0;
-
- //Aggregate score for a product's 'rating' based on the other properties below
- //The weighting of the other properties (performance, durability)
- //differs between industries
- this.rat = 0;
-
- this.qlt = params.quality ? params.quality : 0;
- this.per = params.performance ? params.performance : 0;
- this.dur = params.durability ? params.durability : 0;
- this.rel = params.reliability ? params.reliability : 0;
- this.aes = params.aesthetics ? params.aesthetics : 0;
- this.fea = params.features ? params.features : 0;
-
- //Data refers to the production, sale, and quantity of the products
- //These values are specific to a city
- //The data is [qty, prod, sell]
- this.data = {
- [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Aevum]: [0, 0, 0],
- [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Chongqing]: [0, 0, 0],
- [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Sector12]: [0, 0, 0],
- [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].NewTokyo]: [0, 0, 0],
- [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Ishima]: [0, 0, 0],
- [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Volhaven]: [0, 0, 0],
- }
-
- //Only applies for location-based products like restaurants/hospitals
- this.loc = params.loc ? params.loc : 0;
-
- //How much space it takes in the warehouse. Not applicable for all products
- this.siz = params.size ? params.size : 0;
-
- //Material requirements. An object that maps the name of a material to how much it requires
- //to make 1 unit of the product.
- this.reqMats = params.req ? params.req : {};
-
- //[Whether production/sale is limited, limit amount]
- this.prdman = {
- [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Aevum]: [false, 0],
- [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Chongqing]: [false, 0],
- [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Sector12]: [false, 0],
- [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].NewTokyo]: [false, 0],
- [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Ishima]: [false, 0],
- [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Volhaven]: [false, 0],
- }
-
- this.sllman = {
- [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Aevum]: [false, 0],
- [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Chongqing]: [false, 0],
- [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Sector12]: [false, 0],
- [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].NewTokyo]: [false, 0],
- [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Ishima]: [false, 0],
- [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Volhaven]: [false, 0],
- }
-}
-
-//empWorkMult is a multiplier that increases progress rate based on
-//productivity of employees
-Product.prototype.createProduct = function(marketCycles=1, empWorkMult=1) {
- if (this.fin) {return;}
- this.prog += (marketCycles * .01 * empWorkMult);
-}
-
-//'industry' is a reference to the industry that makes the product
-Product.prototype.finishProduct = function(employeeProd, industry) {
- this.fin = true;
-
- //Calculate properties
- var progrMult = this.prog / 100;
-
- var engrRatio = employeeProd[EmployeePositions.Engineer] / employeeProd["total"],
- mgmtRatio = employeeProd[EmployeePositions.Management] / employeeProd["total"],
- rndRatio = employeeProd[EmployeePositions.RandD] / employeeProd["total"],
- opsRatio = employeeProd[EmployeePositions.Operations] / employeeProd["total"],
- busRatio = employeeProd[EmployeePositions.Business] / employeeProd["total"];
- var designMult = 1 + (Math.pow(this.designCost, 0.1) / 100);
- console.log("designMult: " + designMult);
- var balanceMult = (1.2 * engrRatio) + (0.9 * mgmtRatio) + (1.3 * rndRatio) +
- (1.5 * opsRatio) + (busRatio);
- var sciMult = 1 + (Math.pow(industry.sciResearch.qty, industry.sciFac) / 800);
- var totalMult = progrMult * balanceMult * designMult * sciMult;
-
- this.qlt = totalMult * ((0.10 * employeeProd[EmployeePositions.Engineer]) +
- (0.05 * employeeProd[EmployeePositions.Management]) +
- (0.05 * employeeProd[EmployeePositions.RandD]) +
- (0.02 * employeeProd[EmployeePositions.Operations]) +
- (0.02 * employeeProd[EmployeePositions.Business]));
- this.per = totalMult * ((0.15 * employeeProd[EmployeePositions.Engineer]) +
- (0.02 * employeeProd[EmployeePositions.Management]) +
- (0.02 * employeeProd[EmployeePositions.RandD]) +
- (0.02 * employeeProd[EmployeePositions.Operations]) +
- (0.02 * employeeProd[EmployeePositions.Business]));
- this.dur = totalMult * ((0.05 * employeeProd[EmployeePositions.Engineer]) +
- (0.02 * employeeProd[EmployeePositions.Management]) +
- (0.08 * employeeProd[EmployeePositions.RandD]) +
- (0.05 * employeeProd[EmployeePositions.Operations]) +
- (0.05 * employeeProd[EmployeePositions.Business]));
- this.rel = totalMult * ((0.02 * employeeProd[EmployeePositions.Engineer]) +
- (0.08 * employeeProd[EmployeePositions.Management]) +
- (0.02 * employeeProd[EmployeePositions.RandD]) +
- (0.05 * employeeProd[EmployeePositions.Operations]) +
- (0.08 * employeeProd[EmployeePositions.Business]));
- this.aes = totalMult * ((0.00 * employeeProd[EmployeePositions.Engineer]) +
- (0.08 * employeeProd[EmployeePositions.Management]) +
- (0.05 * employeeProd[EmployeePositions.RandD]) +
- (0.02 * employeeProd[EmployeePositions.Operations]) +
- (0.10 * employeeProd[EmployeePositions.Business]));
- this.fea = totalMult * ((0.08 * employeeProd[EmployeePositions.Engineer]) +
- (0.05 * employeeProd[EmployeePositions.Management]) +
- (0.02 * employeeProd[EmployeePositions.RandD]) +
- (0.05 * employeeProd[EmployeePositions.Operations]) +
- (0.05 * employeeProd[EmployeePositions.Business]));
- this.calculateRating(industry);
- var advMult = 1 + (Math.pow(this.advCost, 0.1) / 100);
- this.mku = 100 / (advMult * Math.pow((this.qlt + 0.001), 0.65) * (busRatio + mgmtRatio));
- this.dmd = industry.awareness === 0 ? 20 : Math.min(100, advMult * (100 * (industry.popularity / industry.awareness)));
- this.cmp = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(0, 70);
-
- //Calculate the product's required materials
- //For now, just set it to be the same as the requirements to make materials
- for (var matName in industry.reqMats) {
- if (industry.reqMats.hasOwnProperty(matName)) {
- this.reqMats[matName] = industry.reqMats[matName];
- }
- }
-
- //Calculate the product's size
- //For now, just set it to be the same size as the requirements to make materials
- this.siz = 0;
- for (var matName in industry.reqMats) {
- this.siz += MaterialSizes[matName] * industry.reqMats[matName];
- }
-
- //Delete unneeded variables
- delete this.prog;
- delete this.createCity;
- delete this.designCost;
- delete this.advCost;
-}
-
-
-Product.prototype.calculateRating = function(industry) {
- var weights = ProductRatingWeights[industry.type];
- if (weights == null) {
- console.log("ERROR: Could not find product rating weights for: " + industry);
- return;
- }
- this.rat = 0;
- this.rat += weights.Quality ? this.qlt * weights.Quality : 0;
- this.rat += weights.Performance ? this.per * weights.Performance : 0;
- this.rat += weights.Durability ? this.dur * weights.Durability : 0;
- this.rat += weights.Reliability ? this.rel * weights.Reliability : 0;
- this.rat += weights.Aesthetics ? this.aes * weights.Aesthetics : 0;
- this.rat += weights.Features ? this.fea * weights.Features : 0;
-}
-
-Product.prototype.toJSON = function() {
- return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Generic_toJSON"])("Product", this);
-}
-
-Product.fromJSON = function(value) {
- return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Generic_fromJSON"])(Product, value.data);
-}
-
-_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Reviver"].constructors.Product = Product;
-
-var Industries = {
- Energy: "Energy",
- Utilities: "Water Utilities",
- Agriculture: "Agriculture",
- Fishing: "Fishing",
- Mining: "Mining",
- Food: "Food",
- Tobacco: "Tobacco",
- Chemical: "Chemical",
- Pharmaceutical: "Pharmaceutical",
- Computer: "Computer Hardware",
- Robotics: "Robotics",
- Software: "Software",
- Healthcare: "Healthcare",
- RealEstate: "RealEstate",
-}
-
-var IndustryStartingCosts = {
- Energy: 225e9,
- Utilities: 150e9,
- Agriculture: 40e9,
- Fishing: 80e9,
- Mining: 300e9,
- Food: 10e9,
- Tobacco: 20e9,
- Chemical: 70e9,
- Pharmaceutical: 200e9,
- Computer: 500e9,
- Robotics: 1e12,
- Software: 25e9,
- Healthcare: 750e9,
- RealEstate: 600e9,
-}
-
-var IndustryDescriptions = {
- Energy: "Engage in the production and distribution of energy.
" +
- "Starting cost: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(IndustryStartingCosts.Energy).format("$0.000a") + "
" +
- "Recommended starting Industry: NO",
- Utilities: "Distributes water and provides wastewater services.
" +
- "Starting cost: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(IndustryStartingCosts.Utilities).format("$0.000a") + "
" +
- "Recommended starting Industry: NO",
- Agriculture: "Cultive crops and breed livestock to produce food.
" +
- "Starting cost: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(IndustryStartingCosts.Agriculture).format("$0.000a") + "
" +
- "Recommended starting Industry: YES",
- Fishing: "Produce food through the breeding and processing of fish and fish products
" +
- "Starting cost: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(IndustryStartingCosts.Fishing).format("$0.000a") + "
" +
- "Recommended starting Industry: NO",
- Mining: "Extract and process metals from the earth.
" +
- "Starting cost: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(IndustryStartingCosts.Mining).format("$0.000a") + "
" +
- "Recommended starting Industry: NO",
- Food: "Create your own restaurants all around the world.
" +
- "Starting cost: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(IndustryStartingCosts.Food).format("$0.000a") + "
" +
- "Recommended starting Industry: YES",
- Tobacco: "Create and distribute tobacco and tobacco-related products.
" +
- "Starting cost: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(IndustryStartingCosts.Tobacco).format("$0.000a") + "
" +
- "Recommended starting Industry: YES",
- Chemical: "Product industrial chemicals
" +
- "Starting cost: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(IndustryStartingCosts.Chemical).format("$0.000a") + "
" +
- "Recommended starting Industry: NO",
- Pharmaceutical: "Discover, develop, and create new pharmaceutical drugs.
" +
- "Starting cost: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(IndustryStartingCosts.Pharmaceutical).format("$0.000a") + "
" +
- "Recommended starting Industry: NO",
- Computer: "Develop and manufacture new computer hardware and networking infrastructures.
" +
- "Starting cost: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(IndustryStartingCosts.Computer).format("$0.000a") + "
" +
- "Recommended starting Industry: NO",
- Robotics: "Develop and create robots.
" +
- "Starting cost: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(IndustryStartingCosts.Robotics).format("$0.000a") + "
" +
- "Recommended starting Industry: NO",
- Software: "Develop computer software and create AI Cores.
" +
- "Starting cost: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(IndustryStartingCosts.Software).format("$0.000a") + "
" +
- "Recommended starting Industry: YES",
- Healthcare: "Create and manage hospitals.
" +
- "Starting cost: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(IndustryStartingCosts.Healthcare).format("$0.000a") + "
" +
- "Recommended starting Industry: NO",
- RealEstate: "Develop and manage real estate properties.
" +
- "Starting cost: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(IndustryStartingCosts.RealEstate).format("$0.000a") + "
" +
- "Recommended starting Industry: NO",
-}
-
-var ProductRatingWeights = {
- [Industries.Food]: {
- Quality: 0.7,
- Durability: 0.1,
- Aesthetics: 0.2,
- },
- [Industries.Tobacco]: {
- Quality: 0.4,
- Durability: 0.2,
- Reliability: 0.2,
- Aesthetics: 0.2,
- },
- [Industries.Pharmaceutical]: {
- Quality: 0.2,
- Performance: 0.2,
- Durability: 0.1,
- Reliability: 0.3,
- Features: 0.2,
- },
- [Industries.Computer]: {
- Quality: 0.15,
- Performance: 0.25,
- Durability: 0.25,
- Reliability: 0.2,
- Aesthetics: 0.05,
- Features: 0.1,
- },
- "Computer" : { //Repeat
- Quality: 0.15,
- Performance: 0.25,
- Durability: 0.25,
- Reliability: 0.2,
- Aesthetics: 0.05,
- Features: 0.1,
- },
- [Industries.Robotics]: {
- Quality: 0.1,
- Performance: 0.2,
- Durability: 0.2,
- Reliability: 0.2,
- Aesthetics: 0.1,
- Features: 0.2,
- },
- [Industries.Software]: {
- Quality: 0.2,
- Performance: 0.2,
- Reliability: 0.2,
- Durability: 0.2,
- Features: 0.2,
- },
- [Industries.Healthcare]: {
- Quality: 0.4,
- Performance: 0.1,
- Durability: 0.1,
- Reliability: 0.3,
- Features: 0.1,
- },
- [Industries.RealEstate]: {
- Quality: 0.2,
- Durability: 0.25,
- Reliability: 0.1,
- Aesthetics: 0.35,
- Features: 0.1,
- }
-}
-
-//Industry upgrades
-//The structure is:
-// [index in array, base price, price mult, benefit mult (if applicable), name, desc]
-var IndustryUpgrades = {
- "0": [0, 500e3, 1, 1.05,
- "Coffee", "Provide your employees with coffee, increasing their energy by 5%."],
- "1": [1, 1e9, 1.06, 1.03,
- "AdVert.Inc", "Hire AdVert.Inc to advertise your company. Each level of " +
- "this upgrade grants your company a static increase of 3 and 1 to its awareness and " +
- "popularity, respectively. It will then increase your company's awareness by 1%, and its popularity " +
- "by a random percentage between 1% and 3%. These effects are increased by other upgrades " +
- "that increase the power of your advertising."]
-}
-
-var empManualAssignmentModeActive = false;
-function Industry(params={}) {
- this.offices = { //Maps locations to offices. 0 if no office at that location
- [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Aevum]: 0,
- [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Chongqing]: 0,
- [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Sector12]: new OfficeSpace({
- loc:_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Sector12,
- size:OfficeInitialSize,
- }),
- [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].NewTokyo]: 0,
- [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Ishima]: 0,
- [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Volhaven]: 0
- };
-
- this.warehouses = { //Maps locations to warehouses. 0 if no warehouse at that location
- [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Aevum]: 0,
- [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Chonqing]: 0,
- [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Sector12]: new Warehouse({
- loc:_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Sector12,
- size: WarehouseInitialSize,
- }),
- [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].NewTokyo]: 0,
- [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Ishima]: 0,
- [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Volhaven]: 0
- };
-
- this.name = params.name ? params.name : 0;
- this.type = params.type ? params.type : 0;
-
- this.sciResearch = new Material({name: "Scientific Research"});
-
- //A map of the NAME of materials required to create produced materials to
- //how many are needed to produce 1 unit of produced materials
- this.reqMats = {};
-
- //An array of the name of materials being produced
- this.prodMats = [];
-
- this.products = {};
- this.makesProducts = false;
-
- this.awareness = 0;
- this.popularity = 0; //Should always be less than awareness
- this.startingCost = 0;
-
- /* The following are factors for how much production/other things are increased by
- different factors. The production increase always has diminishing returns,
- and they are all reprsented by exponentials of < 1 (e.g x ^ 0.5, x ^ 0.8)
- The number for these represent the exponential. A lower number means more
- diminishing returns */
- this.reFac = 0; //Real estate Factor
- this.sciFac = 0; //Scientific Research Factor, affects quality
- this.hwFac = 0; //Hardware factor
- this.robFac = 0; //Robotics Factor
- this.aiFac = 0; //AI Cores factor;
- this.advFac = 0; //Advertising factor, affects sales
-
- this.prodMult = 0; //Production multiplier
-
- //Financials
- this.lastCycleRevenue = new _utils_decimal_js__WEBPACK_IMPORTED_MODULE_6___default.a(0);
- this.lastCycleExpenses = new _utils_decimal_js__WEBPACK_IMPORTED_MODULE_6___default.a(0);
- this.thisCycleRevenue = new _utils_decimal_js__WEBPACK_IMPORTED_MODULE_6___default.a(0);
- this.thisCycleExpenses = new _utils_decimal_js__WEBPACK_IMPORTED_MODULE_6___default.a(0);
-
- //Upgrades
- var numUpgrades = Object.keys(IndustryUpgrades).length;
- this.upgrades = Array(numUpgrades).fill(0);
-
- this.state = "START";
- this.newInd = true;
-
- this.init();
-}
-
-Industry.prototype.init = function() {
- //Set the unique properties of an industry (how much its affected by real estate/scientific research, etc.)
- this.startingCost = IndustryStartingCosts[this.type];
- switch (this.type) {
- case Industries.Energy:
- this.reFac = 0.65;
- this.sciFac = 0.7;
- this.robFac = 0.05;
- this.aiFac = 0.3;
- this.advFac = 0.08;
- this.reqMats = {
- "Hardware": 0.1,
- "Metal": 0.2,
- };
- this.prodMats = ["Energy"];
- break;
- case Industries.Utilities:
- case "Utilities":
- this.reFac = 0.5;
- this.sciFac = 0.6;
- this.robFac = 0.4;
- this.aiFac = 0.4;
- this.advFac = 0.08;
- this.reqMats = {
- "Hardware": 0.1,
- "Metal": 0.1,
- }
- this.prodMats = ["Water"];
- break;
- case Industries.Agriculture:
- this.reFac = 0.75;
- this.sciFac = 0.5;
- this.hwFac = 0.2;
- this.robFac = 0.3;
- this.aiFac = 0.3;
- this.advFac = 0.04;
- this.reqMats = {
- "Water": 0.5,
- "Energy": 0.5,
- }
- this.prodMats = ["Plants", "Food"];
- break;
- case Industries.Fishing:
- this.reFac = 0.15;
- this.sciFac = 0.35;
- this.hwFac = 0.35;
- this.robFac = 0.5;
- this.aiFac = 0.2;
- this.advFac = 0.08;
- this.reqMats = {
- "Energy": 0.5,
- }
- this.prodMats = ["Food"];
- break;
- case Industries.Mining:
- this.reFac = 0.3;
- this.sciFac = 0.26;
- this.hwFac = 0.4;
- this.robFac = 0.45;
- this.aiFac = 0.45;
- this.advFac = 0.06;
- this.reqMats = {
- "Energy": 0.8,
- }
- this.prodMats = ["Metal"];
- break;
- case Industries.Food:
- //reFac is unique for this bc it diminishes greatly per city. Handle this separately in code?
- this.sciFac = 0.12;
- this.hwFac = 0.15;
- this.robFac = 0.3;
- this.aiFac = 0.25;
- this.advFac = 0.25;
- this.reFac = 0.05;
- this.reqMats = {
- "Food": 0.5,
- "Water": 0.5,
- "Energy": 0.2,
- }
- this.makesProducts = true;
- break;
- case Industries.Tobacco:
- this.reFac = 0.15;
- this.sciFac = 0.75;
- this.hwFac = 0.15;
- this.robFac = 0.2;
- this.aiFac = 0.15;
- this.advFac = 0.2;
- this.reqMats = {
- "Plants": 1,
- "Water": 0.2,
- }
- this.makesProducts = true;
- break;
- case Industries.Chemical:
- this.reFac = 0.25;
- this.sciFac = 0.75;
- this.hwFac = 0.2;
- this.robFac = 0.25;
- this.aiFac = 0.2;
- this.advFac = 0.07;
- this.reqMats = {
- "Plants": 1,
- "Energy": 0.5,
- "Water": 0.5,
- }
- this.prodMats = ["Chemicals"];
- break;
- case Industries.Pharmaceutical:
- this.reFac = 0.05;
- this.sciFac = 0.8;
- this.hwFac = 0.15;
- this.robFac = 0.25;
- this.aiFac = 0.2;
- this.advFac = 0.16;
- this.reqMats = {
- "Chemicals": 2,
- "Energy": 1,
- "Water": 0.5,
- }
- this.prodMats = ["Drugs"];
- this.makesProducts = true;
- break;
- case Industries.Computer:
- case "Computer":
- this.reFac = 0.2;
- this.sciFac = 0.62;
- this.robFac = 0.36;
- this.aiFac = 0.19;
- this.advFac = 0.17;
- this.reqMats = {
- "Metal": 2.5,
- "Energy": 1,
- }
- this.prodMats = ["Hardware"];
- this.makesProducts = true;
- break;
- case Industries.Robotics:
- this.reFac = 0.32;
- this.sciFac = 0.65;
- this.aiFac = 0.36;
- this.advFac = 0.18;
- this.hwFac = 0.19;
- this.reqMats = {
- "Hardware": 5,
- "Energy": 3,
- }
- this.prodMats = ["Robots"];
- this.makesProducts = true;
- break;
- case Industries.Software:
- this.sciFac = 0.62;
- this.advFac = 0.16;
- this.hwFac = 0.25;
- this.reFac = 0.1;
- this.aiFac = 0.1;
- this.robFac = 0.05;
- this.reqMats = {
- "Hardware": 0.5,
- "Energy": 1,
- }
- this.prodMats = ["AICores"];
- this.makesProducts = true;
- break;
- case Industries.Healthcare:
- this.reFac = 0.1;
- this.sciFac = 0.75;
- this.advFac = 0.11;
- this.hwFac = 0.1;
- this.robFac = 0.1;
- this.aiFac = 0.1;
- this.reqMats = {
- "Robots": 10,
- "AICores": 5,
- "Energy": 5,
- "Water": 5,
- }
- this.makesProducts = true;
- break;
- case Industries.RealEstate:
- this.robFac = 0.6;
- this.aiFac = 0.6;
- this.advFac = 0.25;
- this.sciFac = 0.05;
- this.hwFac = 0.05;
- this.reqMats = {
- "Metal": 20,
- "Energy": 10,
- "Water": 10,
- "Hardware": 5
- }
- this.prodMats = ["RealEstate"];
- this.makesProducts = true;
- break;
- default:
- console.log("ERR: Invalid Industry Type passed into Industry.init(): " + this.type);
- return;
- }
-}
-
-Industry.prototype.getProductDescriptionText = function() {
- if (!this.makesProducts) {return;}
- switch (this.type) {
- case Industries.Food:
- return "create and manage restaurants";
- break;
- case Industries.Tobacco:
- return "create tobacco and tobacco-related products";
- break;
- case Industries.Pharmaceutical:
- return "develop new pharmaceutical drugs";
- break;
- case Industries.Computer:
- case "Computer":
- return "create new computer hardware and networking infrastructures";
- break;
- case Industries.Robotics:
- return "build specialized robots and robot-related products";
- break;
- case Industries.Software:
- return "develop computer software";
- break;
- case Industries.HealthCare:
- return "build and manage hospitals";
- break;
- case Industries.RealEstate:
- return "develop and manage real estate properties";
- break;
- default:
- console.log("ERROR: Invalid industry type in Industry.getProductDescriptionText");
- return "";
- }
-}
-
-//Calculates the values that factor into the production and properties of
-//materials/products (such as quality, etc.)
-Industry.prototype.calculateProductionFactors = function() {
- var multSum = 0;
- for (var i = 0; i < Cities.length; ++i) {
- var city = Cities[i];
- var warehouse = this.warehouses[city];
- if (!(warehouse instanceof Warehouse)) {
- continue;
- }
-
- var materials = warehouse.materials,
- office = this.offices[city];
-
- var cityMult = Math.pow(0.002 * materials.RealEstate.qty+1, this.reFac) *
- Math.pow(0.002 * materials.Hardware.qty+1, this.hwFac) *
- Math.pow(0.002 * materials.Robots.qty+1, this.robFac) *
- Math.pow(0.002 * materials.AICores.qty+1, this.aiFac);
- multSum += Math.pow(cityMult, 0.73);
- }
-
- multSum < 1 ? this.prodMult = 1 : this.prodMult = multSum;
-}
-
-Industry.prototype.updateWarehouseSizeUsed = function(warehouse) {
- if (warehouse instanceof Warehouse) {
- //This resets the size back to 0 and then accounts for materials
- warehouse.updateMaterialSizeUsed();
- }
-
- for (var prodName in this.products) {
- if (this.products.hasOwnProperty(prodName)) {
- var prod = this.products[prodName];
- warehouse.sizeUsed += (prod.data[warehouse.loc][0] * prod.siz);
- if (prod.data[warehouse.loc][0] > 0) {
- warehouse.breakdown += (prodName + ": " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(prod.data[warehouse.loc][0] * prod.siz, 0) + "
");
- }
- }
- }
-}
-
-Industry.prototype.process = function(marketCycles=1, state, company) {
- this.state = state;
-
- //At the start of a cycle, store and reset revenue/expenses
- //Then calculate salaries and processs the markets
- if (state === "START") {
- if (isNaN(this.thisCycleRevenue) || isNaN(this.thisCycleExpenses)) {
- console.log("ERROR: NaN in Corporation's computed revenue/expenses");
- console.log(this.thisCycleRevenue.toString());
- console.log(this.thisCycleExpenses.toString());
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Something went wrong when compting Corporation's revenue/expenses. This is a bug. Please report to game developer");
- this.thisCycleRevenue = new _utils_decimal_js__WEBPACK_IMPORTED_MODULE_6___default.a(0);
- this.thisCycleExpenses = new _utils_decimal_js__WEBPACK_IMPORTED_MODULE_6___default.a(0);
- }
- this.lastCycleRevenue = this.thisCycleRevenue.dividedBy(marketCycles * SecsPerMarketCycle);
- this.lastCycleExpenses = this.thisCycleExpenses.dividedBy(marketCycles * SecsPerMarketCycle);
- this.thisCycleRevenue = new _utils_decimal_js__WEBPACK_IMPORTED_MODULE_6___default.a(0);
- this.thisCycleExpenses = new _utils_decimal_js__WEBPACK_IMPORTED_MODULE_6___default.a(0);
-
- //Once you start making revenue, the player should no longer be
- //considered new, and therefore no longer needs the 'tutorial' UI elements
- if (this.lastCycleRevenue.gt(0)) {this.newInd = false;}
-
- //Process offices (and the employees in them)
- var employeeSalary = 0;
- for (var officeLoc in this.offices) {
- if (this.offices.hasOwnProperty(officeLoc) &&
- this.offices[officeLoc] instanceof OfficeSpace) {
- employeeSalary += this.offices[officeLoc].process(marketCycles, {industry:this, corporation:company});
- }
- }
- this.thisCycleExpenses = this.thisCycleExpenses.plus(employeeSalary);
-
- //Process change in demand/competition of materials/products
- this.processMaterialMarket(marketCycles);
- this.processProductMarket(marketCycles);
-
- //Process loss of popularity
- this.popularity -= (marketCycles * .0001);
- this.popularity = Math.max(0, this.popularity);
-
- //Process Dreamsense gains
- var popularityGain = company.getDreamSenseGain(), awarenessGain = popularityGain * 4;
- if (popularityGain > 0) {
- this.popularity += (popularityGain * marketCycles);
- this.awareness += (awarenessGain * marketCycles);
- }
-
- return;
- }
-
- //Process production, purchase, and import/export of materials
- var res = this.processMaterials(marketCycles, company);
- this.thisCycleRevenue = this.thisCycleRevenue.plus(res[0]);
- this.thisCycleExpenses = this.thisCycleExpenses.plus(res[1]);
-
- //Process creation, production & sale of products
- res = this.processProducts(marketCycles, company);
- this.thisCycleRevenue = this.thisCycleRevenue.plus(res[0]);
- this.thisCycleExpenses = this.thisCycleExpenses.plus(res[1]);
-
-}
-
-//Process change in demand and competition for this industry's materials
-Industry.prototype.processMaterialMarket = function(marketCycles=1) {
- //References to prodMats and reqMats
- var reqMats = this.reqMats, prodMats = this.prodMats;
-
- //Only 'process the market' for materials that this industry deals with
- for (var i = 0; i < Cities.length; ++i) {
- //If this industry has a warehouse in this city, process the market
- //for every material this industry requires or produces
- if (this.warehouses[Cities[i]] instanceof Warehouse) {
- var wh = this.warehouses[Cities[i]];
- for (var name in reqMats) {
- if (reqMats.hasOwnProperty(name)) {
- wh.materials[name].processMarket();
- }
- }
-
- //Produced materials are stored in an array
- for (var foo = 0; foo < prodMats.length; ++foo) {
- wh.materials[prodMats[foo]].processMarket();
- }
-
- //Process these twice because these boost production
- wh.materials["Hardware"].processMarket();
- wh.materials["Robots"].processMarket();
- wh.materials["AICores"].processMarket();
- wh.materials["RealEstate"].processMarket();
- }
- }
-}
-
-//Process change in demand and competition for this industry's products
-Industry.prototype.processProductMarket = function(marketCycles=1) {
- //Demand gradually decreases, and competition gradually increases
- for (var name in this.products) {
- if (this.products.hasOwnProperty(name)) {
- var product = this.products[name];
- var change = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(1, 3) * 0.0004;
- if (this.type === Industries.Pharmaceutical || this.type === Industries.Software ||
- this.type === Industries.Robotics) {
- change *= 3;
- }
- change *= marketCycles;
- product.dmd -= change;
- product.cmp += change;
- product.cmp = Math.min(product.cmp, 99.99);
- product.dmd = Math.max(product.dmd, 0.001);
- }
- }
-}
-
-//Process production, purchase, and import/export of materials
-Industry.prototype.processMaterials = function(marketCycles=1, company) {
- var revenue = 0, expenses = 0, industry = this;
- this.calculateProductionFactors();
-
- //At the start of the export state, set the imports of everything to 0
- if (this.state === "EXPORT") {
- for (var i = 0; i < Cities.length; ++i) {
- var city = Cities[i], office = this.offices[city];
- if (!(this.warehouses[city] instanceof Warehouse)) {
- continue;
- }
- var warehouse = this.warehouses[city];
- for (var matName in warehouse.materials) {
- if (warehouse.materials.hasOwnProperty(matName)) {
- var mat = warehouse.materials[matName];
- mat.imp = 0;
- }
- }
- }
- }
-
- for (var i = 0; i < Cities.length; ++i) {
- var city = Cities[i], office = this.offices[city];
-
- if (this.warehouses[city] instanceof Warehouse) {
- var warehouse = this.warehouses[city];
-
- switch(this.state) {
-
- case "PURCHASE":
- /* Process purchase of materials */
- for (var matName in warehouse.materials) {
- if (warehouse.materials.hasOwnProperty(matName)) {
- (function(matName, ind) {
- var mat = warehouse.materials[matName];
- var buyAmt, maxAmt;
- if (warehouse.smartSupplyEnabled && Object.keys(ind.reqMats).includes(matName)) {
- //Smart supply tracker is stored as per second rate
- mat.buy = ind.reqMats[matName] * warehouse.smartSupplyStore;
- buyAmt = mat.buy * SecsPerMarketCycle * marketCycles;
- } else {
- buyAmt = (mat.buy * SecsPerMarketCycle * marketCycles);
- }
-
- if (matName == "RealEstate") {
- maxAmt = buyAmt;
- } else {
- maxAmt = Math.floor((warehouse.size - warehouse.sizeUsed) / MaterialSizes[matName]);
- }
- var buyAmt = Math.min(buyAmt, maxAmt);
- if (buyAmt > 0) {
- mat.qty += buyAmt;
- expenses += (buyAmt * mat.bCost);
- }
- })(matName, industry);
- this.updateWarehouseSizeUsed(warehouse);
- }
- } //End process purchase of materials
- break;
-
- case "PRODUCTION":
- warehouse.smartSupplyStore = 0; //Reset smart supply amount
-
- /* Process production of materials */
- if (this.prodMats.length > 0) {
- var mat = warehouse.materials[this.prodMats[0]];
- //Calculate the maximum production of this material based
- //on the office's productivity
- var maxProd = this.getOfficeProductivity(office) * this.prodMult * company.getProductionMultiplier(), prod;
-
- if (mat.prdman[0]) {
- //Production is manually limited
- prod = Math.min(maxProd, mat.prdman[1]);
- } else {
- prod = maxProd;
- }
- prod *= (SecsPerMarketCycle * marketCycles); //Convert production from per second to per market cycle
- //Calculate net change in warehouse storage making
- //the produced materials will cost
- var totalMatSize = 0;
- for (var tmp = 0; tmp < this.prodMats.length; ++tmp) {
- totalMatSize += (MaterialSizes[this.prodMats[tmp]]);
- }
- for (var reqMatName in this.reqMats) {
- if (this.reqMats.hasOwnProperty(reqMatName)) {
- var normQty = this.reqMats[reqMatName];
- totalMatSize -= (MaterialSizes[reqMatName] * normQty);
- }
- }
- //If not enough space in warehouse, limit the amount of produced materials
- if (totalMatSize > 0) {
- var maxAmt = Math.floor((warehouse.size - warehouse.sizeUsed) / totalMatSize);
- prod = Math.min(maxAmt, prod);
- }
-
- if (prod < 0) {prod = 0;}
-
- //Keep track of production for smart supply (/s)
- warehouse.smartSupplyStore += (prod / (SecsPerMarketCycle * marketCycles));
-
- //Make sure we have enough resource to make our materials
- var producableFrac = 1;
- for (var reqMatName in this.reqMats) {
- if (this.reqMats.hasOwnProperty(reqMatName)) {
- var req = this.reqMats[reqMatName] * prod;
- if (warehouse.materials[reqMatName].qty < req) {
- producableFrac = Math.min(producableFrac, warehouse.materials[reqMatName].qty / req);
- }
- }
- }
- if (producableFrac <= 0) {producableFrac = 0; prod = 0;}
-
- //Make our materials if they are producable
- if (producableFrac > 0 && prod > 0) {
- for (var reqMatName in this.reqMats) {
- if (this.reqMats.hasOwnProperty(reqMatName)) {
- var reqMatQtyNeeded = (this.reqMats[reqMatName] * prod * producableFrac);
- warehouse.materials[reqMatName].qty -= reqMatQtyNeeded;
- warehouse.materials[reqMatName].prd = 0;
- warehouse.materials[reqMatName].prd -= reqMatQtyNeeded / (SecsPerMarketCycle * marketCycles);
- }
- }
- for (var j = 0; j < this.prodMats.length; ++j) {
- warehouse.materials[this.prodMats[j]].qty += (prod * producableFrac);
- warehouse.materials[this.prodMats[j]].qlt =
- (office.employeeProd[EmployeePositions.Engineer] / 100 +
- Math.pow(this.sciResearch.qty, this.sciFac) +
- Math.pow(warehouse.materials["AICores"].qty, this.aiFac) / 10e3);
- }
- } else {
- for (var reqMatName in this.reqMats) {
- if (this.reqMats.hasOwnProperty(reqMatName)) {
- warehouse.materials[reqMatName].prd = 0;
- }
- }
- }
-
- //Per second
- var fooProd = prod * producableFrac / (SecsPerMarketCycle * marketCycles);
- for (var fooI = 0; fooI < this.prodMats.length; ++fooI) {
- warehouse.materials[this.prodMats[fooI]].prd = fooProd;
- }
- } else {
- //If this doesn't produce any materials, then it only creates
- //Products. Creating products will consume materials. The
- //Production of all consumed materials must be set to 0
- for (var reqMatName in this.reqMats) {
- if (this.reqMats.hasOwnProperty(reqMatName)) {
- warehouse.materials[reqMatName].prd = 0;
- }
- }
- }
- break;
-
- case "SALE":
- /* Process sale of materials */
- for (var matName in warehouse.materials) {
- if (warehouse.materials.hasOwnProperty(matName)) {
- var mat = warehouse.materials[matName];
- if (mat.sCost < 0 || mat.sllman[0] === false) {
- mat.sll = 0;
- continue;
- }
- var mat = warehouse.materials[matName];
-
- var sCost;
- if (Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["isString"])(mat.sCost)) {
- sCost = mat.sCost.replace(/MP/g, mat.bCost);
- sCost = eval(sCost);
- } else {
- sCost = mat.sCost;
- }
-
- //Calculate how much of the material sells (per second)
- var markup = 1, markupLimit = mat.qlt / mat.mku;
- if (sCost > mat.bCost) {
- //Penalty if difference between sCost and bCost is greater than markup limit
- if ((sCost - mat.bCost) > markupLimit) {
- markup = markupLimit / (sCost - mat.bCost);
- }
- } else if (sCost < mat.bCost) {
- if (sCost <= 0) {
- markup = 1e12; //Sell everything, essentially discard
- } else {
- //Lower prices than market increases sales
- markup = mat.bCost / sCost;
- }
- }
- //var businessFactor = 1 + (office.employeeProd[EmployeePositions.Business] / office.employeeProd["total"]);
- var businessFactor = this.getBusinessFactor(office); //Business employee productivity
- var advertisingFactor = this.getAdvertisingFactors()[0]; //Awareness + popularity
- var marketFactor = this.getMarketFactor(mat); //Competition + demand
- var maxSell = (mat.qlt + .001) * marketFactor * markup * businessFactor *
- company.getSalesMultiplier() * advertisingFactor;
-
- var sellAmt;
- if (Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["isString"])(mat.sllman[1])) {
- //Dynamically evaluated
- var tmp = mat.sllman[1].replace(/MAX/g, maxSell);
- tmp = tmp.replace(/PROD/g, mat.prd);
- try {
- sellAmt = eval(tmp);
- } catch(e) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Error evaluating your sell amount for material " + mat.name +
- " in " + this.name + "'s " + city + " office. The sell amount " +
- "is being set to zero");
- sellAmt = 0;
- }
- sellAmt = Math.min(maxSell, sellAmt);
- } else if (mat.sllman[1] === -1) {
- //Backwards compatibility, -1 = MAX
- sellAmt = maxSell;
- } else {
- //Player's input value is just a number
- sellAmt = Math.min(maxSell, mat.sllman[1]);
- }
-
- sellAmt = (sellAmt * SecsPerMarketCycle * marketCycles);
- sellAmt = Math.min(mat.qty, sellAmt);
- if (sellAmt < 0) {
- console.log("sellAmt calculated to be negative");
- mat.sll = 0;
- continue;
- }
- if (sellAmt && sCost >= 0) {
- mat.qty -= sellAmt;
- revenue += (sellAmt * sCost);
- mat.sll = sellAmt / (SecsPerMarketCycle * marketCycles);
- } else {
- mat.sll = 0;
- }
- }
- } //End processing of sale of materials
- break;
-
- case "EXPORT":
- for (var matName in warehouse.materials) {
- if (warehouse.materials.hasOwnProperty(matName)) {
- var mat = warehouse.materials[matName];
- mat.totalExp = 0; //Reset export
- for (var expI = 0; expI < mat.exp.length; ++expI) {
- var exp = mat.exp[expI];
- var amt = exp.amt.replace(/MAX/g, mat.qty / (SecsPerMarketCycle * marketCycles));
- try {
- amt = eval(amt);
- } catch(e) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Calculating export for " + mat.name + " in " +
- this.name + "'s " + city + " division failed with " +
- "error: " + e);
- continue;
- }
- if (isNaN(amt)) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Error calculating export amount for " + mat.name + " in " +
- this.name + "'s " + city + " division.");
- continue;
- }
- amt = amt * SecsPerMarketCycle * marketCycles;
-
- if (mat.qty < amt) {
- amt = mat.qty;
- }
- if (amt === 0) {
- break; //None left
- }
- for (var foo = 0; foo < company.divisions.length; ++foo) {
- if (company.divisions[foo].name === exp.ind) {
- var expIndustry = company.divisions[foo];
- var expWarehouse = expIndustry.warehouses[exp.city];
- if (!(expWarehouse instanceof Warehouse)) {
- console.log("ERROR: Invalid export! " + expIndustry.name + " " + exp.city);
- break;
- }
-
- //Make sure theres enough space in warehouse
- if (expWarehouse.sizeUsed >= expWarehouse.size) {
- return; //Warehouse at capacity
- } else {
- var maxAmt = Math.floor((expWarehouse.size - expWarehouse.sizeUsed) / MaterialSizes[matName]);
- amt = Math.min(maxAmt, amt);
- }
- expWarehouse.materials[matName].imp += (amt / (SecsPerMarketCycle * marketCycles));
- expWarehouse.materials[matName].qty += amt;
- expWarehouse.materials[matName].qlt = mat.qlt;
- mat.qty -= amt;
- mat.totalExp += amt;
- expIndustry.updateWarehouseSizeUsed(expWarehouse);
- break;
- }
- }
- }
- //totalExp should be per second
- mat.totalExp /= (SecsPerMarketCycle * marketCycles);
- }
- }
-
- break;
-
- case "START":
- break;
- default:
- console.log("ERROR: Invalid state: " + this.state);
- break;
- } //End switch(this.state)
- this.updateWarehouseSizeUsed(warehouse);
-
- } // End warehouse
-
- //Produce Scientific Research based on R&D employees
- //Scientific Research can be produced without a warehouse
- if (office instanceof OfficeSpace) {
- this.sciResearch.qty += (.005 * Math.pow(office.employeeProd[EmployeePositions.RandD], 0.5)
- * company.getScientificResearchMultiplier());
- }
- }
- return [revenue, expenses];
-}
-
-//Process production & sale of this industry's FINISHED products (including all of their stats)
-Industry.prototype.processProducts = function(marketCycles=1, corporation) {
- var revenue = 0, expenses = 0;
-
- //Create products
- if (this.state === "PRODUCTION") {
- for (var prodName in this.products) {
- if (this.products.hasOwnProperty(prodName)) {
- var prod = this.products[prodName];
- if (!prod.fin) {
- var city = prod.createCity, office = this.offices[city];
- var total = office.employeeProd[EmployeePositions.Operations] +
- office.employeeProd[EmployeePositions.Engineer] +
- office.employeeProd[EmployeePositions.Management], ratio;
- if (total === 0) {
- ratio = 0;
- } else {
- ratio = office.employeeProd[EmployeePositions.Engineer] / total +
- office.employeeProd[EmployeePositions.Operations] / total +
- office.employeeProd[EmployeePositions.Management] / total;
- }
- prod.createProduct(marketCycles, ratio * Math.pow(total, 0.29));
- if (prod.prog >= 100) {
- prod.finishProduct(office.employeeProd, this);
- }
- break;
- }
- }
- }
- }
-
- //Produce Products
- for (var prodName in this.products) {
- if (this.products.hasOwnProperty(prodName)) {
- var prod = this.products[prodName];
- if (prod instanceof Product && prod.fin) {
- revenue += this.processProduct(marketCycles, prod, corporation);
- }
- }
- }
- return [revenue, expenses];
-}
-
-//Processes FINISHED products
-Industry.prototype.processProduct = function(marketCycles=1, product, corporation) {
- var totalProfit = 0;
- for (var i = 0; i < Cities.length; ++i) {
- var city = Cities[i], office = this.offices[city], warehouse = this.warehouses[city];
- if (warehouse instanceof Warehouse) {
- switch(this.state) {
-
- case "PRODUCTION":
- //Calculate the maximum production of this material based
- //on the office's productivity
- var maxProd = this.getOfficeProductivity(office, {forProduct:true}) *
- corporation.getProductionMultiplier() * this.prodMult, prod;
-
- //Account for whether production is manually limited
- if (product.prdman[city][0]) {
- prod = Math.min(maxProd, product.prdman[city][1]);
- } else {
- prod = maxProd;
- }
- prod *= (SecsPerMarketCycle * marketCycles);
-
- //Calculate net change in warehouse storage making the Products will cost
- var netStorageSize = product.siz;
- for (var reqMatName in product.reqMats) {
- if (product.reqMats.hasOwnProperty(reqMatName)) {
- var normQty = product.reqMats[reqMatName];
- netStorageSize -= (MaterialSizes[reqMatName] * normQty);
- }
- }
-
- //If there's not enough space in warehouse, limit the amount of Product
- if (netStorageSize > 0) {
- var maxAmt = Math.floor((warehouse.size - warehouse.sizeUsed) / netStorageSize);
- prod = Math.min(maxAmt, prod);
- }
-
- warehouse.smartSupplyStore += (prod / (SecsPerMarketCycle * marketCycles));
-
- //Make sure we have enough resources to make our Products
- var producableFrac = 1;
- for (var reqMatName in product.reqMats) {
- if (product.reqMats.hasOwnProperty(reqMatName)) {
- var req = product.reqMats[reqMatName] * prod;
- if (warehouse.materials[reqMatName].qty < req) {
- producableFrac = Math.min(producableFrac, warehouse.materials[reqMatName].qty / req);
- }
- }
- }
-
- //Make our Products if they are producable
- if (producableFrac > 0 && prod > 0) {
- for (var reqMatName in product.reqMats) {
- if (product.reqMats.hasOwnProperty(reqMatName)) {
- var reqMatQtyNeeded = (product.reqMats[reqMatName] * prod * producableFrac);
- warehouse.materials[reqMatName].qty -= reqMatQtyNeeded;
- warehouse.materials[reqMatName].prd -= reqMatQtyNeeded / (SecsPerMarketCycle * marketCycles);
- }
- }
- //Quantity
- product.data[city][0] += (prod * producableFrac);
- }
-
- //Keep track of production Per second
- product.data[city][1] = prod * producableFrac / (SecsPerMarketCycle * marketCycles);
- break;
-
- case "SALE":
- //Process sale of Products
- product.pCost = 0; //Estimated production cost
- for (var reqMatName in product.reqMats) {
- if (product.reqMats.hasOwnProperty(reqMatName)) {
- product.pCost += (product.reqMats[reqMatName] * warehouse.materials[reqMatName].bCost);
- }
- }
-
- //Since its a product, its production cost is increased for labor
- product.pCost *= ProductProductionCostRatio;
-
- //Calculate Sale Cost (sCost), which could be dynamically evaluated
- var sCost;
- if (Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["isString"])(product.sCost)) {
- sCost = product.sCost.replace(/MP/g, product.pCost + product.rat / product.mku);
- sCost = eval(sCost);
- } else {
- sCost = product.sCost;
- }
-
- var markup = 1, markupLimit = product.rat / product.mku;
- if (sCost > product.pCost) {
- if ((sCost - product.pCost) > markupLimit) {
- markup = markupLimit / (sCost - product.pCost);
- }
- }
- var businessFactor = this.getBusinessFactor(office); //Business employee productivity
- var advertisingFactor = this.getAdvertisingFactors()[0]; //Awareness + popularity
- var marketFactor = this.getMarketFactor(product); //Competition + demand
- var maxSell = 0.5 * Math.pow(product.rat, 0.65) * marketFactor * corporation.getSalesMultiplier() *
- Math.pow(markup, 2) * businessFactor * advertisingFactor;
- var sellAmt;
- if (product.sllman[city][0] && Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["isString"])(product.sllman[city][1])) {
- //Sell amount is dynamically evaluated
- var tmp = product.sllman[city][1].replace(/MAX/g, maxSell);
- tmp = tmp.replace(/PROD/g, product.data[city][1]);
- try {
- tmp = eval(tmp);
- } catch(e) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Error evaluating your sell price expression for " + product.name +
- " in " + this.name + "'s " + city + " office. Sell price is being set to MAX");
- tmp = maxSell;
- }
- sellAmt = Math.min(maxSell, tmp);
- } else if (product.sllman[city][0] && product.sllman[city][1] > 0) {
- //Sell amount is manually limited
- sellAmt = Math.min(maxSell, product.sllman[city][1]);
- } else {
- //Backwards compatibility, -1 = 0
- sellAmt = maxSell;
- }
- sellAmt = sellAmt * SecsPerMarketCycle * marketCycles;
- sellAmt = Math.min(product.data[city][0], sellAmt); //data[0] is qty
- if (sellAmt && sCost) {
- product.data[city][0] -= sellAmt; //data[0] is qty
- totalProfit += (sellAmt * sCost);
- product.data[city][2] = sellAmt / (SecsPerMarketCycle * marketCycles); //data[2] is sell property
- } else {
- product.data[city][2] = 0; //data[2] is sell property
- }
- break;
-
- case "START":
- case "PURCHASE":
- case "EXPORT":
- break;
- default:
- console.log("ERROR: Invalid State: " + this.state);
- break;
- } //End switch(this.state)
- }
- }
- return totalProfit;
-}
-
-Industry.prototype.discontinueProduct = function(product, parentRefs) {
- var company = parentRefs.company, industry = parentRefs.industry;
- for (var productName in this.products) {
- if (this.products.hasOwnProperty(productName)) {
- if (product === this.products[productName]) {
- delete this.products[productName];
- company.updateUIContent();
- }
- }
- }
-}
-
-Industry.prototype.upgrade = function(upgrade, refs) {
- var corporation = refs.corporation, division = refs.division,
- office = refs.office;
- var upgN = upgrade[0], basePrice = upgrade[1], priceMult = upgrade[2],
- upgradeBenefit = upgrade[3];
- while (this.upgrades.length <= upgN) {this.upgrades.push(0);}
- ++this.upgrades[upgN];
-
- switch (upgN) {
- case 0: //Coffee, 5% energy per employee
- for (var i = 0; i < office.employees.length; ++i) {
- office.employees[i].ene = Math.min(office.employees[i].ene * 1.05, 100);
- }
- break;
- case 1: //AdVert.Inc,
- var advMult = corporation.getAdvertisingMultiplier();
- this.awareness += (3 * advMult);
- this.popularity += (1 * advMult);
- this.awareness *= (1.01 * advMult);
- this.popularity *= ((1 + Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(1, 3) / 100) * advMult);
- break;
- default:
- console.log("ERROR: Un-implemented function index: " + upgN);
- break;
- }
-}
-
-//Returns how much of a material can be produced based of office productivity (employee stats)
-Industry.prototype.getOfficeProductivity = function(office, params) {
- var total = office.employeeProd[EmployeePositions.Operations] +
- office.employeeProd[EmployeePositions.Engineer] +
- office.employeeProd[EmployeePositions.Management], ratio;
- if (total === 0) {
- ratio = 0;
- } else {
- ratio = (office.employeeProd[EmployeePositions.Operations] / total) *
- (office.employeeProd[EmployeePositions.Engineer] / total) *
- (office.employeeProd[EmployeePositions.Management] / total);
- ratio = Math.max(0.01, ratio); //Minimum ratio value if you have employees
- }
- if (params && params.forProduct) {
- return ratio * Math.pow(total, 0.2);
- } else {
- return 2 * ratio * Math.pow(total, 0.3);
- }
-}
-
-//Returns a multiplier based on the office' 'Business' employees that affects sales
-Industry.prototype.getBusinessFactor = function(office) {
- var ratioMult = 1;
- if (office.employeeProd["total"] > 0) {
- ratioMult = 1 + (office.employeeProd[EmployeePositions.Business] / office.employeeProd["total"]);
- }
- return ratioMult * Math.pow(1 + office.employeeProd[EmployeePositions.Business], 0.15);
-}
-
-//Returns a set of multipliers based on the Industry's awareness, popularity, and advFac. This
-//multiplier affects sales. The result is:
-// [Total sales mult, total awareness mult, total pop mult, awareness/pop ratio mult]
-Industry.prototype.getAdvertisingFactors = function() {
- var awarenessFac = Math.pow(this.awareness + 1, this.advFac);
- var popularityFac = Math.pow(this.popularity + 1, this.advFac);
- var ratioFac = (this.awareness === 0 ? 0.01 : Math.max((this.popularity + .001) / this.awareness, 0.01));
- var totalFac = Math.pow(awarenessFac * popularityFac * ratioFac, 0.85);
- return [totalFac, awarenessFac, popularityFac, ratioFac];
-}
-
-//Returns a multiplier based on a materials demand and competition that affects sales
-Industry.prototype.getMarketFactor = function(mat) {
- return mat.dmd * (100 - mat.cmp)/100;
-}
-
-Industry.prototype.toJSON = function() {
- return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Generic_toJSON"])("Industry", this);
-}
-
-Industry.fromJSON = function(value) {
- return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Generic_fromJSON"])(Industry, value.data);
-}
-
-_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Reviver"].constructors.Industry = Industry;
-
-var EmployeePositions = {
- Operations: "Operations",
- Engineer: "Engineer",
- Business: "Business",
- Management: "Management",
- RandD: "Research & Development",
- Training:"Training",
- Unassigned:"Unassigned",
-}
-
-function Employee(params={}) {
- if (!(this instanceof Employee)) {
- return new Employee(params);
- }
- this.name = params.name ? params.name : "Bobby";
-
- //Morale, happiness, and energy are 0-100
- this.mor = params.morale ? params.morale : Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(50, 100);
- this.hap = params.happiness ? params.happiness : Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(50, 100);
- this.ene = params.energy ? params.energy : Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(50, 100);
-
- this.age = params.age ? params.age : Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(20, 50);
- this.int = params.intelligence ? params.intelligence : Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(10, 50);
- this.cha = params.charisma ? params.charisma : Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(10, 50);
- this.exp = params.experience ? params.experience : Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(10, 50);
- this.cre = params.creativity ? params.creativity : Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(10, 50);
- this.eff = params.efficiency ? params.efficiency : Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(10, 50);
- this.sal = params.salary ? params.salary : Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(0.1, 5);
- this.pro = 0; //Productivity, This is calculated
-
- this.loc = params.loc ? params.loc : "";
- this.pos = EmployeePositions.Unassigned;
-}
-
-//Returns the amount the employee needs to be paid
-Employee.prototype.process = function(marketCycles=1, office) {
- var gain = 0.001 * marketCycles,
- det = gain * Math.random();
- this.age += gain;
- this.exp += gain;
- if (this.age > 150) {
- this.int -= det;
- this.eff -= det;
- this.cha -= det;
- }
-
- //Training
- var trainingEff = gain * Math.random();
- if (this.pos === EmployeePositions.Training) {
- //To increase creativity and intelligence special upgrades are needed
- this.cha += trainingEff;
- this.exp += trainingEff;
- this.eff += trainingEff;
- }
-
- //Weight based on how full office is
- //Too many employees = more likely to decrease energy and happiness
- var officeCapacityWeight = 0.5 * (office.employees.length / office.size - 0.5);
- if (Math.random() < 0.5 - officeCapacityWeight) {
- this.ene += det;
- this.hap += det;
- } else {
- this.ene -= det;
- this.hap -= det;
- }
- if (this.ene < office.minEne) {this.ene = office.minEne;}
- if (this.hap < office.minHap) {this.hap = office.minHap;}
- var salary = this.sal * marketCycles * SecsPerMarketCycle;
- return salary;
-}
-
-Employee.prototype.calculateProductivity = function(corporation) {
- var effCre = this.cre * corporation.getEmployeeCreMultiplier(),
- effCha = this.cha * corporation.getEmployeeChaMultiplier(),
- effInt = this.int * corporation.getEmployeeIntMultiplier(),
- effEff = this.eff * corporation.getEmployeeEffMultiplier();
- var prodBase = this.mor * this.hap * this.ene * 1e-6, prodMult;
- switch(this.pos) {
- //Calculate productivity based on position. This is multipled by prodBase
- //to get final value
- case EmployeePositions.Operations:
- prodMult = (0.6 * effInt) + (0.1 * effCha) + (this.exp) +
- (0.5 * effCre) + (effEff);
- break;
- case EmployeePositions.Engineer:
- prodMult = (effInt) + (0.1 * effCha) + (1.5 * this.exp) +
- (effEff);
- break;
- case EmployeePositions.Business:
- prodMult = (0.4 * effInt) + (effCha) + (0.5 * this.exp);
- break;
- case EmployeePositions.Management:
- prodMult = (2 * effCha) + (this.exp) + (0.2 * effCre) +
- (0.7 * effEff);
- break;
- case EmployeePositions.RandD:
- prodMult = (1.5 * effInt) + (0.8 * this.exp) + (effCre) +
- (0.5 * effEff);
- break;
- case EmployeePositions.Unassigned:
- case EmployeePositions.Training:
- prodMult = 0;
- break;
- default:
- console.log("ERROR: Invalid employee position: " + this.pos);
- break;
- }
- return prodBase * prodMult;
-}
-
-//Process benefits from having an office party thrown
-Employee.prototype.throwParty = function(money) {
- var mult = 1 + (money / 10e6);
- this.mor *= mult;
- this.mor = Math.min(100, this.mor);
- this.hap *= mult;
- this.hap = Math.min(100, this.hap);
- return mult;
-}
-
-//'panel' is the DOM element on which to create the UI
-Employee.prototype.createUI = function(panel, corporation) {
- var effCre = this.cre * corporation.getEmployeeCreMultiplier(),
- effCha = this.cha * corporation.getEmployeeChaMultiplier(),
- effInt = this.int * corporation.getEmployeeIntMultiplier(),
- effEff = this.eff * corporation.getEmployeeEffMultiplier();
- panel.style.color = "white";
- panel.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
- id:"cmpy-mgmt-employee-" + this.name + "-panel-text",
- innerHTML:"Morale: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(this.mor, 3) + "
" +
- "Happiness: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(this.hap, 3) + "
" +
- "Energy: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(this.ene, 3) + "
" +
- "Age: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(this.age, 3) + "
" +
- "Intelligence: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(effInt, 3) + "
" +
- "Charisma: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(effCha, 3) + "
" +
- "Experience: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(this.exp, 3) + "
" +
- "Creativity: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(effCre, 3) + "
" +
- "Efficiency: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(effEff, 3) + "
" +
- "Salary: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(this.sal).format("$0.000a") + "/ s
",
- }));
-
- //Selector for employee position
- var selector = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("select", {});
- for (var key in EmployeePositions) {
- if (EmployeePositions.hasOwnProperty(key)) {
- selector.add(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("option", {
- text: EmployeePositions[key],
- value: EmployeePositions[key],
- }));
- }
- }
-
- selector.addEventListener("change", ()=>{
- this.pos = selector.options[selector.selectedIndex].value;
- });
-
- //Set initial value of selector
- for (var i = 0; i < selector.length; ++i) {
- if (selector.options[i].value === this.pos) {
- selector.selectedIndex = i;
- break;
- }
- }
- panel.appendChild(selector);
-}
-
-Employee.prototype.updateUI = function(panel, corporation) {
- var effCre = this.cre * corporation.getEmployeeCreMultiplier(),
- effCha = this.cha * corporation.getEmployeeChaMultiplier(),
- effInt = this.int * corporation.getEmployeeIntMultiplier(),
- effEff = this.eff * corporation.getEmployeeEffMultiplier();
- if (panel == null) {
- console.log("ERROR: Employee.updateUI() called with null panel");
- return;
- }
- var text = document.getElementById("cmpy-mgmt-employee-" + this.name + "-panel-text");
- if (text == null) {
- return this.createUI(panel);
- }
- text.innerHTML = "Morale: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(this.mor, 3) + "
" +
- "Happiness: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(this.hap, 3) + "
" +
- "Energy: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(this.ene, 3) + "
" +
- "Age: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(this.age, 3) + "
" +
- "Intelligence: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(effInt, 3) + "
" +
- "Charisma: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(effCha, 3) + "
" +
- "Experience: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(this.exp, 3) + "
" +
- "Creativity: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(effCre, 3) + "
" +
- "Efficiency: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(effEff, 3) + "
" +
- "Salary: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(this.sal).format("$0.000a") + "/ s
";
-}
-
-Employee.prototype.toJSON = function() {
- return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Generic_toJSON"])("Employee", this);
-}
-
-Employee.fromJSON = function(value) {
- return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Generic_fromJSON"])(Employee, value.data);
-}
-
-_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Reviver"].constructors.Employee = Employee;
-
-var OfficeSpaceTiers = {
- Basic: "Basic",
- Enhanced: "Enhanced",
- Luxurious: "Luxurious",
- Extravagant: "Extravagant"
-}
-
-function OfficeSpace(params={}) {
- this.loc = params.loc ? params.loc : "";
- this.cost = params.cost ? params.cost : 1;
- this.size = params.size ? params.size : 1;
- this.comf = params.comfort ? params.comfort : 1;
- this.beau = params.beauty ? params.beauty : 1;
- this.tier = OfficeSpaceTiers.Basic;
-
- this.minEne = 0; //Minimum energy of employees, based on office
- this.minHap = 0; //Minimum happiness of employees, based on office.
-
- this.employees = [];
- this.employeeProd = {
- [EmployeePositions.Operations]: 0,
- [EmployeePositions.Engineer]: 0,
- [EmployeePositions.Business]: 0,
- [EmployeePositions.Management]: 0,
- [EmployeePositions.RandD]: 0,
- total: 0,
- };
-}
-
-OfficeSpace.prototype.process = function(marketCycles=1, parentRefs) {
- var corporation = parentRefs.corporation, industry = parentRefs.industry;
- var perfMult=1; //Multiplier for employee morale/happiness/energy based on company performance
- if (industry.funds < 0 && industry.lastCycleRevenue < 0) {
- perfMult = Math.pow(0.99, marketCycles);
- } else if (industry.funds > 0 && industry.lastCycleRevenue > 0) {
- perfMult = Math.pow(1.01, marketCycles);
- }
-
- var salaryPaid = 0;
- for (var i = 0; i < this.employees.length; ++i) {
- var emp = this.employees[i];
- emp.mor *= perfMult;
- emp.hap *= perfMult;
- emp.ene *= perfMult;
- var salary = emp.process(marketCycles, this);
- salaryPaid += salary;
- }
- this.calculateEmployeeProductivity(marketCycles, corporation);
- return salaryPaid;
-}
-
-OfficeSpace.prototype.calculateEmployeeProductivity = function(marketCycles=1, corporation) {
- //Reset
- for (var name in this.employeeProd) {
- if (this.employeeProd.hasOwnProperty(name)) {
- this.employeeProd[name] = 0;
- }
- }
-
- var total = 0;
- for (var i = 0; i < this.employees.length; ++i) {
- var employee = this.employees[i];
- var prod = employee.calculateProductivity(corporation);
- this.employeeProd[employee.pos] += prod;
- total += prod;
- }
- this.employeeProd["total"] = total;
-}
-
-//Takes care of UI as well
-OfficeSpace.prototype.findEmployees = function(parentRefs) {
- var company = parentRefs.corporation, division = parentRefs.division;
- if (document.getElementById("cmpy-mgmt-hire-employee-popup") != null) {return;}
-
- //Generate three random employees (meh, decent, amazing)
- var mult1 = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(25, 50)/100,
- mult2 = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(51, 75)/100,
- mult3 = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(76, 100)/100;
- var int = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(50, 100),
- cha = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(50, 100),
- exp = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(50, 100),
- cre = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(50, 100),
- eff = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(50, 100),
- sal = 2.2 * (int + cha + exp + cre + eff);
-
- var emp1 = new Employee({
- intelligence: int * mult1,
- charisma: cha * mult1,
- experience: exp * mult1,
- creativity: cre * mult1,
- efficiency: eff * mult1,
- salary: sal * mult1,
- });
-
- var emp2 = new Employee({
- intelligence: int * mult2,
- charisma: cha * mult2,
- experience: exp * mult2,
- creativity: cre * mult2,
- efficiency: eff * mult2,
- salary: sal * mult2,
- });
-
- var emp3 = new Employee({
- intelligence: int * mult3,
- charisma: cha * mult3,
- experience: exp * mult3,
- creativity: cre * mult3,
- efficiency: eff * mult3,
- salary: sal * mult3,
- });
-
- var text = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("h1", {
- innerHTML: "Select one of the following candidates for hire:",
- });
-
- var createEmpDiv = function(employee, office) {
- var div = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {
- class:"cmpy-mgmt-find-employee-option",
- innerHTML: "Intelligence: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(employee.int, 1) + "
" +
- "Charisma: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(employee.cha, 1) + "
" +
- "Experience: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(employee.exp, 1) + "
" +
- "Creativity: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(employee.cre, 1) + "
" +
- "Efficiency: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(employee.eff, 1) + "
" +
- "Salary: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(employee.sal).format('$0.000a') + " \ s
",
- clickListener:()=>{
- office.hireEmployee(employee, parentRefs);
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])("cmpy-mgmt-hire-employee-popup");
- return false;
- }
- });
- return div;
- };
-
- var cancelBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- class:"a-link-button",
- innerText:"Cancel",
- float:"right",
- clickListener:()=>{
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])("cmpy-mgmt-hire-employee-popup");
- return false;
- }
- });
-
- var elems = [text,
- createEmpDiv(emp1, this),
- createEmpDiv(emp2, this),
- createEmpDiv(emp3, this),
- cancelBtn];
-
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createPopup"])("cmpy-mgmt-hire-employee-popup", elems);
-}
-
-OfficeSpace.prototype.hireEmployee = function(employee, parentRefs) {
- var company = parentRefs.corporation, division = parentRefs.division;
- var yesBtn = Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_12__["yesNoTxtInpBoxGetYesButton"])(),
- noBtn = Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_12__["yesNoTxtInpBoxGetNoButton"])();
- yesBtn.innerHTML = "Hire";
- noBtn.innerHTML = "Cancel";
- yesBtn.addEventListener("click", ()=>{
- var name = Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_12__["yesNoTxtInpBoxGetInput"])();
- for (var i = 0; i < this.employees.length; ++i) {
- if (this.employees[i].name === name) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("You already have an employee with this nickname! Please give every employee a unique nickname.");
- return false;
- }
- }
- employee.name = name;
- this.employees.push(employee);
- company.displayDivisionContent(division, currentCityUi);
- return Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_12__["yesNoTxtInpBoxClose"])();
- });
- noBtn.addEventListener("click", ()=>{
- return Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_12__["yesNoTxtInpBoxClose"])();
- });
- Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_12__["yesNoTxtInpBoxCreate"])("Give your employee a nickname!");
-}
-
-OfficeSpace.prototype.hireRandomEmployee = function(parentRefs) {
- var company = parentRefs.corporation, division = parentRefs.division;
- if (document.getElementById("cmpy-mgmt-hire-employee-popup") != null) {return;}
-
- //Generate three random employees (meh, decent, amazing)
- var mult = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(76, 100)/100;
- var int = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(50, 100),
- cha = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(50, 100),
- exp = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(50, 100),
- cre = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(50, 100),
- eff = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(50, 100),
- sal = 2.2 * (int + cha + exp + cre + eff);
-
- var emp = new Employee({
- intelligence: int * mult,
- charisma: cha * mult,
- experience: exp * mult,
- creativity: cre * mult,
- efficiency: eff * mult,
- salary: sal * mult,
- });
-
- var name = Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["generateRandomString"])(7);
-
- for (var i = 0; i < this.employees.length; ++i) {
- if (this.employees[i].name === name) {
- return this.hireRandomEmployee(parentRefs);
- }
- }
- emp.name = name;
- this.employees.push(emp);
- company.displayDivisionContent(division, currentCityUi);
-}
-
-//Finds the first unassigned employee and assigns its to the specified job
-OfficeSpace.prototype.assignEmployeeToJob = function(job) {
- for (var i = 0; i < this.employees.length; ++i) {
- if (this.employees[i].pos === EmployeePositions.Unassigned) {
- this.employees[i].pos = job;
- return true;
- }
- }
- return false;
-}
-
-//Finds the first employee with the given job and unassigns it
-OfficeSpace.prototype.unassignEmployeeFromJob = function(job) {
- for (var i = 0; i < this.employees.length; ++i) {
- if (this.employees[i].pos === job) {
- this.employees[i].pos = EmployeePositions.Unassigned;
- return true;
- }
- }
- return false;
-}
-
-OfficeSpace.prototype.toJSON = function() {
- return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Generic_toJSON"])("OfficeSpace", this);
-}
-
-OfficeSpace.fromJSON = function(value) {
- return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Generic_fromJSON"])(OfficeSpace, value.data);
-}
-
-_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Reviver"].constructors.OfficeSpace = OfficeSpace;
-
-function Warehouse(params={}) {
- this.loc = params.loc ? params.loc : "";
- this.size = params.size ? params.size : 0;
- this.level = 0;
- this.sizeUsed = 0;
- this.smartSupplyEnabled = false; //Whether or not smart supply is enabled
- this.breakdown = "";
-
- //Stores the amount of product to be produced. Used for Smart Supply unlock.
- //The production tracked by smart supply is always based on the previous cycle,
- //so it will always trail the "true" production by 1 cycle
- this.smartSupplyStore = 0;
-
- this.materials = {
- Water: new Material({name: "Water"}),
- Energy: new Material({name: "Energy"}),
- Food: new Material({name: "Food"}),
- Plants: new Material({name: "Plants"}),
- Metal: new Material({name: "Metal"}),
- Hardware: new Material({name: "Hardware"}),
- Chemicals: new Material({name: "Chemicals"}),
- Drugs: new Material({name: "Drugs"}),
- Robots: new Material({name: "Robots"}),
- AICores: new Material({name: "AI Cores"}),
- RealEstate: new Material({name: "Real Estate"})
- }
-}
-
-Warehouse.prototype.updateMaterialSizeUsed = function() {
- this.sizeUsed = 0;
- this.breakdown = "";
- for (var matName in this.materials) {
- if (this.materials.hasOwnProperty(matName)) {
- var mat = this.materials[matName];
- if (MaterialSizes.hasOwnProperty(matName)) {
- this.sizeUsed += (mat.qty * MaterialSizes[matName]);
- if (mat.qty > 0) {
- this.breakdown += (matName + ": " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(mat.qty * MaterialSizes[matName], 0) + "
");
- }
- }
- }
- }
- if (this.sizeUsed > this.size) {
- console.log("ERROR: Warehouse size used greater than capacity, something went wrong");
- }
-}
-
-Warehouse.prototype.updateSize = function(corporation) {
- //Backwards compatibility
- if (this.level == null || this.level === 0) {
- this.level = Math.round(this.size / 100);
- }
-
- this.size = (this.level * 100) * corporation.getStorageMultiplier();
-}
-
-Warehouse.prototype.createUI = function(parentRefs) {
- if (parentRefs.company == null || parentRefs.industry == null) {
- console.log("ERROR: Warehouse.createUI called without parentRefs.company or parentRefs.industry");
- return;
- }
- var company = parentRefs.company, industry = parentRefs.industry;
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeChildrenFromElement"])(industryWarehousePanel);
- industryWarehouseStorageText = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
- display:"inline-block", class:"tooltip",
- color: this.sizeUsed >= this.size ? "red" : "white",
- });
- industryWarehousePanel.appendChild(industryWarehouseStorageText);
-
- //Upgrade warehouse size button
- var upgradeCost = WarehouseUpgradeBaseCost * Math.pow(1.07, this.level+1);
- industryWarehouseUpgradeSizeButton = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- innerText:"Upgrade Warehouse Size - " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(upgradeCost).format('$0.000a'),
- display:"inline-block",
- class: company.funds.lt(upgradeCost) ? "a-link-button-inactive" : "a-link-button",
- clickListener:()=>{
- //Backwards compatibility
- if (this.level == null || this.level === 0) {
- this.level = Math.round(this.size / 100);
- }
-
- ++this.level;
- this.updateSize(company);
- company.funds = company.funds.minus(upgradeCost);
- this.createUI(parentRefs);
- return;
- }
- });
- industryWarehousePanel.appendChild(industryWarehouseUpgradeSizeButton);
-
- //Material requirement text
- var reqText = "This Industry uses [" + Object.keys(industry.reqMats).join(", ") +
- "] in order to ";
- if (industry.prodMats.length > 0) {
- reqText += "produce [" + industry.prodMats.join(", ") + "] ";
- if (industry.makesProducts) {
- reqText += " and " + industry.getProductDescriptionText();
- }
- } else if (industry.makesProducts) {
- reqText += industry.getProductDescriptionText();
- }
- reqText += "
To get started with production, purchase your required " +
- "materials or import them from another of your company's divisions.
";
-
- //Material ratio text for tooltip
- var reqRatioText = "The exact requirements for production are:
";
- for (var matName in industry.reqMats) {
- if (industry.reqMats.hasOwnProperty(matName)) {
- reqRatioText += (industry.reqMats[matName] + " " + matName + "
");
- }
- }
- reqRatioText += "in order to create ";
- if (industry.prodMats.length > 0) {
- reqRatioText += "one of each produced Material (" + industry.prodMats.join(", ") + ") ";
- if (industry.makesProducts) {
- reqRatioText += "or to create one of its Products";
- }
- } else if (industry.makesProducts) {
- reqRatioText += "one of its Products";
- }
-
- industryWarehousePanel.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
- innerHTML:reqText, tooltipleft:reqRatioText
- }));
-
- //Current state
- industryWarehouseStateText = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p");
- industryWarehousePanel.appendChild(industryWarehouseStateText);
-
- //Smart Supply Enable/Disable
- if (company.unlockUpgrades[1]) {
- if (this.smartSupplyEnabled == null) {this.smartSupplyEnabled = false;}
- var smartSupplyCheckboxId = "cmpy-mgmt-smart-supply-checkbox";
- industryWarehousePanel.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("label", {
- for:smartSupplyCheckboxId, innerText:"Enable Smart Supply",
- color:"white"
- }));
- industrySmartSupplyCheckbox = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("input", {
- type:"checkbox", id:smartSupplyCheckboxId, margin:"3px",
- changeListener:()=>{
- this.smartSupplyEnabled = industrySmartSupplyCheckbox.checked;
- }
- });
- industrySmartSupplyCheckbox.checked = this.smartSupplyEnabled;
- industryWarehousePanel.appendChild(industrySmartSupplyCheckbox);
- }
-
- //Materials
- industryWarehousePanel.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
- innerHTML: "
Materials:
",
- }));
- industryWarehouseMaterials = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("ul");
- industryWarehousePanel.appendChild(industryWarehouseMaterials);
-
- //Products
- if (industry.makesProducts && Object.keys(industry.products).length > 0) {
- industryWarehousePanel.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
- innerHTML: "
Products:
",
- }));
- industryWarehouseProducts = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("ul");
- industryWarehousePanel.appendChild(industryWarehouseProducts);
- }
-
- this.updateUI(parentRefs);
-}
-
-Warehouse.prototype.updateUI = function(parentRefs) {
- if (parentRefs.company == null || parentRefs.industry == null) {
- console.log("ERROR: Warehouse.updateUI called without parentRefs.company or parentRefs.industry");
- return;
- }
- var company = parentRefs.company, industry = parentRefs.industry;
-
- //Storage text
- var storageText = "Storage: " +
- (this.sizedUsed >= this.size ? Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(this.sizeUsed, 3) : Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(this.sizeUsed, 3)) +
- "/" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(this.size, 3);
- if (this.breakdown != null && this.breakdown != "") {
- storageText += ("" +
- this.breakdown + "");
- }
- industryWarehouseStorageText.innerHTML = storageText;
-
- //Upgrade warehouse size button
- var upgradeCost = WarehouseUpgradeBaseCost * Math.pow(1.07, this.level+1);
- if (company.funds.lt(upgradeCost)) {
- industryWarehouseUpgradeSizeButton.className = "a-link-button-inactive";
- } else {
- industryWarehouseUpgradeSizeButton.className = "a-link-button";
- }
-
- //Current state
- var stateText = "Current state: ";
- switch(industry.state) {
- case "START":
- stateText += "Preparing...";
- break;
- case "PURCHASE":
- stateText += "Purchasing materials...";
- break;
- case "PRODUCTION":
- stateText += "Producing materials and/or products...";
- break;
- case "SALE":
- stateText += "Selling materials and/or products...";
- break;
- case "EXPORT":
- stateText += "Exporting materials and/or products...";
- break;
- default:
- console.log("ERROR: Invalid state: " + industry.state);
- break;
- }
- industryWarehouseStateText.innerText = stateText;
-
- //Materials
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeChildrenFromElement"])(industryWarehouseMaterials);
- for (var matName in this.materials) {
- if (this.materials.hasOwnProperty(matName) && this.materials[matName] instanceof Material) {
- if (Object.keys(industry.reqMats).includes(matName) || industry.prodMats.includes(matName) ||
- matName === "Hardware" || matName === "Robots" || matName === "AICores" ||
- matName === "RealEstate") {
- industryWarehouseMaterials.appendChild(this.createMaterialUI(this.materials[matName], matName, parentRefs));
- }
- }
- }
-
- //Products
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeChildrenFromElement"])(industryWarehouseProducts);
- if (industry.makesProducts && Object.keys(industry.products).length > 0) {
- for (var productName in industry.products) {
- if (industry.products.hasOwnProperty(productName) && industry.products[productName] instanceof Product) {
- industryWarehouseProducts.appendChild(this.createProductUI(industry.products[productName], parentRefs));
- }
- }
- }
-}
-
-Warehouse.prototype.createMaterialUI = function(mat, matName, parentRefs) {
- if (parentRefs.company == null || parentRefs.industry == null) {
- console.log("ERROR: Warehouse.createMaterialUI called without industry or company parent refs");
- return;
- }
- var company = parentRefs.company, industry = parentRefs.industry;
- var purchasePopupId = "cmpy-mgmt-material-purchase-popup",
- sellPopupid = "cmpy-mgmt-material-sell-popup";
- var div = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {
- class:"cmpy-mgmt-warehouse-material-div",
- });
-
- var totalGain = mat.buy + mat.prd + mat.imp - mat.sll - mat.totalExp;
-
- //If Market Research upgrades are unlocked, add competition and demand info
- var cmpAndDmdText = "";
- if (company.unlockUpgrades[2] === 1) {
- cmpAndDmdText += "
Competition: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(mat.cmp, 3);
- }
- if (company.unlockUpgrades[3] === 1) {
- cmpAndDmdText += "
Demand: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(mat.dmd, 3);
- }
- var innerTxt = "
Prod: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(mat.prd, 3) + "/s
Sell: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(mat.sll, 3) +
- "/s
Export: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(mat.totalExp, 3) + "/s
Import: " +
- Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(mat.imp, 3) + "/s" + cmpAndDmdText + "
" +
- "
" +
- "
" +
- "City: " + mat.exp[i].city + "
" +
- "Amount/s: " + mat.exp[i].amt,
- clickListener:()=>{
- mat.exp.splice(i, 1); //Remove export object
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
- createExportPopup();
- }
- }));
- })(i, mat, currExports);
- }
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createPopup"])(popupId, [exportTxt, industrySelector, citySelector, exportAmount,
- exportBtn, cancelBtn, currExportsText].concat(currExports));
- }
- buttonPanel.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- innerText:"Export", display:"inline-block", class:"a-link-button",
- clickListener:()=>{createExportPopup();}
- }));
- }
-
- buttonPanel.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("br", {})); // Force line break
-
- //Button to set sell amount
- var innerTextString;
- if (mat.sllman[0]) {
- innerTextString = (mat.sllman[1] === -1 ? "Sell (" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(mat.sll, 3) + "/MAX)" :
- "Sell (" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(mat.sll, 3) + "/" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(mat.sllman[1], 3) + ")");
- if (mat.sCost) {
- if (Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["isString"])(mat.sCost)) {
- var sCost = mat.sCost.replace(/MP/g, mat.bCost);
- innerTextString += " @ $" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(eval(sCost), 2);
- } else {
- innerTextString += " @ $" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(mat.sCost, 2);
- }
- }
- } else {
- innerTextString = "Sell (0.000/0.000)";
- }
-
- buttonPanel.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- innerText: innerTextString, display:"inline-block", class:"a-link-button",
- clickListener:()=>{
- var txt = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
- innerHTML: "Enter the maximum amount of " + mat.name + " you would like " +
- "to sell per second, as well as the price at which you would " +
- "like to sell at.
" +
- "If the sell amount is set to 0, then the material will not be sold. If the sell price " +
- "if set to 0, then the material will be discarded
" +
- "Setting the sell amount to 'MAX' will result in you always selling the " +
- "maximum possible amount of the material.
" +
- "When setting the sell amount, you can use the 'PROD' variable to designate a dynamically " +
- "changing amount that depends on your production. For example, if you set the sell amount " +
- "to 'PROD-5' then you will always sell 5 less of the material than you produce.
" +
- "When setting the sell price, you can use the 'MP' variable to designate a dynamically " +
- "changing price that depends on the market price. For example, if you set the sell price " +
- "to 'MP+10' then it will always be sold at $10 above the market price.",
- });
- var br = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("br", {});
- var confirmBtn;
- var inputQty = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("input", {
- type:"text", marginTop:"4px",
- value: mat.sllman[1] ? mat.sllman[1] : null, placeholder: "Sell amount",
- onkeyup:(e)=>{
- e.preventDefault();
- if (e.keyCode === 13) {confirmBtn.click();}
- }
- });
- var inputPx = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("input", {
- type:"text", marginTop:"4px",
- value: mat.sCost ? mat.sCost : null, placeholder: "Sell price",
- onkeyup:(e)=>{
- e.preventDefault();
- if (e.keyCode === 13) {confirmBtn.click();}
- }
- });
- confirmBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- innerText:"Confirm", class:"a-link-button", margin:"6px",
- clickListener:()=>{
- //Parse price
- var cost = inputPx.value.replace(/\s+/g, '');
- cost = cost.replace(/[^-()\d/*+.MP]/g, ''); //Sanitize cost
- var temp = cost.replace(/MP/g, mat.bCost);
- try {
- temp = eval(temp);
- } catch(e) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Invalid value or expression for sell price field: " + e);
- return false;
- }
-
- if (temp == null || isNaN(temp)) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Invalid value or expression for sell price field");
- return false;
- }
-
- if (cost.includes("MP")) {
- mat.sCost = cost; //Dynamically evaluated
- } else {
- mat.sCost = temp;
- }
-
- //Parse quantity
- if (inputQty.value.includes("MAX") || inputQty.value.includes("PROD")) {
- var qty = inputQty.value.replace(/\s+/g, '');
- qty = qty.replace(/[^-()\d/*+.MAXPROD]/g, '');
- var temp = qty.replace(/MAX/g, 1);
- temp = temp.replace(/PROD/g, 1);
- try {
- temp = eval(temp);
- } catch(e) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Invalid value or expression for sell price field: " + e);
- return false;
- }
-
- if (temp == null || isNaN(temp)) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Invalid value or expression for sell price field");
- return false;
- }
-
- mat.sllman[0] = true;
- mat.sllman[1] = qty; //Use sanitized input
- } else if (isNaN(inputQty.value)) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Invalid value for sell quantity field! Must be numeric or 'MAX'");
- return false;
- } else {
- var qty = parseFloat(inputQty.value);
- if (isNaN(qty)) {qty = 0;}
- if (qty === 0) {
- mat.sllman[0] = false;
- mat.sllman[1] = 0;
- } else {
- mat.sllman[0] = true;
- mat.sllman[1] = qty;
- }
- }
-
- this.createUI(parentRefs);
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(sellPopupid);
- return false;
- }
- });
- var cancelBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- innerText:"Cancel", class:"a-link-button", margin: "6px",
- clickListener:()=>{
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(sellPopupid);
- }
- });
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createPopup"])(sellPopupid, [txt, br, inputQty, inputPx, confirmBtn, cancelBtn]);
- inputQty.focus();
- }
- }));
-
- return div;
-}
-
-Warehouse.prototype.createProductUI = function(product, parentRefs) {
- var company = parentRefs.company, industry = parentRefs.industry,
- city = currentCityUi;
- var div = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {
- class:"cmpy-mgmt-warehouse-product-div"
- });
-
- //Products being designed TODO
- if (!product.fin) {
- div.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
- innerHTML: "Designing " + product.name + "...
" +
- Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(product.prog, 2) + "% complete",
- }));
- return div;
- }
-
- //Completed products
- var cmpAndDmdText = "";
- if (company.unlockUpgrades[2] === 1) {
- cmpAndDmdText += "
Competition: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(product.cmp, 3);
- }
- if (company.unlockUpgrades[3] === 1) {
- cmpAndDmdText += "
Demand: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(product.dmd, 3);
- }
- var totalGain = product.data[city][1] - product.data[city][2]; //Production - sale
- div.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
- innerHTML: "
" +
- "Sell: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(product.data[city][2], 3) + "/s
" +
- "
" +
- "Performance: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(product.per, 3) + "
" +
- "Durability: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(product.dur, 3) + "
" +
- "Reliability: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(product.rel, 3) + "
" +
- "Aesthetics: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(product.aes, 3) + "
" +
- "Features: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(product.fea, 3) +
- cmpAndDmdText + "
" +
- "
" +
- "
" +
- "If the sell amount is set to 0, then the product will not be sold. If the " +
- "sell price is set to 0, then the product will be discarded.
" +
- "Setting the sell amount to 'MAX' will result in you always selling the " +
- "maximum possible amount of the material.
" +
- "When setting the sell amount, you can use the 'PROD' variable to designate a " +
- "dynamically changing amount that depends on your production. For example, " +
- "if you set the sell amount to 'PROD-1' then you will always sell 1 less of " +
- "the material than you produce.
" +
- "When setting the sell price, you can use the 'MP' variable to set a " +
- "dynamically changing price that depends on the Product's estimated " +
- "market price. For example, if you set it to 'MP*5' then it " +
- "will always be sold at five times the estimated market price.",
- });
- var confirmBtn;
- var inputQty = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("input", {
- type:"text", value:product.sllman[city][1] ? product.sllman[city][1] : null, placeholder: "Sell amount",
- onkeyup:(e)=>{
- e.preventDefault();
- if (e.keyCode === 13) {confirmBtn.click();}
- }
- });
- var inputPx = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("input", {
- type:"text", value: product.sCost ? product.sCost : null, placeholder: "Sell price",
- onkeyup:(e)=>{
- e.preventDefault();
- if (e.keyCode === 13) {confirmBtn.click();}
- }
- });
- confirmBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- class:"a-link-button", innerText:"Confirm",
- clickListener:()=>{
- //Parse price
- if (inputPx.value.includes("MP")) {
- //Dynamically evaluated quantity. First test to make sure its valid
- //Sanitize input, then replace dynamic variables with arbitrary numbers
- var price = inputPx.value.replace(/\s+/g, '');
- price = price.replace(/[^-()\d/*+.MP]/g, '');
- var temp = price.replace(/MP/g, 1);
- try {
- temp = eval(temp);
- } catch(e) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Invalid value or expression for sell quantity field: " + e);
- return false;
- }
- if (temp == null || isNaN(temp)) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Invalid value or expression for sell quantity field.");
- return false;
- }
- product.sCost = price; //Use sanitized price
- } else {
- var cost = parseFloat(inputPx.value);
- if (isNaN(cost)) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Invalid value for sell price field");
- return false;
- }
- product.sCost = cost;
- }
-
- //Parse quantity
- if (inputQty.value.includes("MAX") || inputQty.value.includes("PROD")) {
- //Dynamically evaluated quantity. First test to make sure its valid
- var qty = inputQty.value.replace(/\s+/g, '');
- qty = qty.replace(/[^-()\d/*+.MAXPROD]/g, '');
- var temp = qty.replace(/MAX/g, 1);
- temp = temp.replace(/PROD/g, 1);
- try {
- temp = eval(temp);
- } catch(e) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Invalid value or expression for sell price field: " + e);
- return false;
- }
-
- if (temp == null || isNaN(temp)) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Invalid value or expression for sell price field");
- return false;
- }
- product.sllman[city][0] = true;
- product.sllman[city][1] = qty; //Use sanitized input
- } else if (isNaN(inputQty.value)) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Invalid value for sell quantity field! Must be numeric");
- return false;
- } else {
- var qty = parseFloat(inputQty.value);
- if (isNaN(qty)) {qty = 0;}
- if (qty === 0) {
- product.sllman[city][0] = false;
- } else {
- product.sllman[city][0] = true;
- product.sllman[city][1] = qty;
- }
- }
- this.createUI(parentRefs);
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
- return false;
- }
- });
- var cancelBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- class:"a-link-button", innerText:"Cancel",
- clickListener:()=>{
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
- return false;
- }
- });
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createPopup"])(popupId, [txt, inputQty, inputPx, confirmBtn, cancelBtn]);
- inputQty.focus();
- }
- }));
- div.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("br",{})); //force line break
-
- //Limit production button
- var limitProductionInnerText = "Limit Production";
- if (product.prdman[city][0]) {
- limitProductionInnerText += " (" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(product.prdman[city][1], 3) + ")";
- }
- div.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- class:"a-link-button", innerText:limitProductionInnerText,display:"inline-block",
- clickListener:()=>{
- var popupId = "cmpy-mgmt-limit-product-production-popup";
- var txt = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
- innerText:"Enter a limit to the amount of this product you would " +
- "like to product per second. Leave the box empty to set no limit."
- });
- var confirmBtn;
- var input = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("input", {
- type:"number", placeholder:"Limit",
- onkeyup:(e)=>{
- e.preventDefault();
- if (e.keyCode === 13) {confirmBtn.click();}
- }
- });
- confirmBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- class:"a-link-button", display:"inline-block", innerText:"Limit production", margin:'6px',
- clickListener:()=>{
- if (input.value === "") {
- product.prdman[city][0] = false;
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
- return false;
- }
- var qty = parseFloat(input.value);
- if (isNaN(qty)) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Invalid value entered");
- return false;
- }
- if (qty < 0) {
- product.prdman[city][0] = false;
- } else {
- product.prdman[city][0] = true;
- product.prdman[city][1] = qty;
- }
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
- return false;
- }
- });
- var cancelBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- class:"a-link-button", display:"inline-block", innerText:"Cancel", margin:"6px",
- clickListener:()=>{
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
- return false;
- }
- });
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createPopup"])(popupId, [txt, input, confirmBtn, cancelBtn]);
- }
- }));
-
- //Discontinue button
- div.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- class:'a-link-button', display:"inline-block",innerText:"Discontinue",
- clickListener:()=>{
- var popupId = "cmpy-mgmt-discontinue-product-popup";
- var txt = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
- innerText:"Are you sure you want to do this? Discontinuing a product " +
- "removes it completely and permanently. You will no longer " +
- "produce this product and all of its existing stock will be " +
- "removed and left unsold",
- });
- var confirmBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- class:"a-link-button",innerText:"Discontinue",
- clickListener:()=>{
- industry.discontinueProduct(product, parentRefs);
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
- return false;
- }
- });
- var cancelBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- class:"a-link-button", innerText:"Cancel",
- clickListener:()=>{
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
- return false;
- }
- });
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createPopup"])(popupId, [txt, confirmBtn, cancelBtn]);
- }
- }));
- return div;
-}
-
-Warehouse.prototype.toJSON = function() {
- return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Generic_toJSON"])("Warehouse", this);
-}
-
-Warehouse.fromJSON = function(value) {
- return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Generic_fromJSON"])(Warehouse, value.data);
-}
-
-_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Reviver"].constructors.Warehouse = Warehouse;
-
-//Corporation Unlock Upgrades
-//Upgrades for entire corporation, unlocks features, either you have it or you dont
-//The structure is [index in Corporation feature upgrades array, price ]
-var CorporationUnlockUpgrades = {
- //Lets you export goods
- "0": [0, 20e9, "Export",
- "Develop infrastructure to export your materials to your other facilities. " +
- "This allows you to move materials around between different divisions and cities."],
-
- //Lets you buy exactly however many required materials you need for production
- "1": [1, 50e9, "Smart Supply", "Use advanced AI to anticipate your supply needs. " +
- "This allows you to purchase exactly however many materials you need for production."],
-
- //Displays each material/product's demand
- "2": [2, 5e9, "Market Research - Demand",
- "Mine and analyze market data to determine the demand of all resources. " +
- "The demand attribute, which affects sales, will be displayed for every material and product."],
-
- //Display's each material/product's competition
- "3": [3, 5e9, "Market Data - Competition",
- "Mine and analyze market data to determine how much competition there is on the market " +
- "for all resources. The competition attribute, which affects sales, will be displayed for " +
- "for every material and product."],
- "4": [4, 10e9, "VeChain",
- "Use AI and blockchain technology to identify where you can improve your supply chain systems. " +
- "This upgrade will allow you to view a wide array of useful statistics about your " +
- "Corporation."]
-}
-
-//Corporation Upgrades
-//Upgrades for entire corporation, levelable upgrades
-//The structure is [index in Corporation upgrades array, base price, price mult, benefit mult (additive),
-// name, desc]
-var CorporationUpgrades = {
- //Smart factories, increases production
- "0": [0, 2e9, 1.07, 0.03,
- "Smart Factories", "Advanced AI automatically optimizes the operation and productivity " +
- "of factories. Each level of this upgrade increases your global production by 3% (additive)."],
-
- //Smart warehouses, increases storage size
- "1": [1, 2e9, 1.07, .1,
- "Smart Storage", "Advanced AI automatically optimizes your warehouse storage methods. " +
- "Each level of this upgrade increases your global warehouse storage size by 10% (additive)."],
-
- //Advertise through dreams, passive popularity/ awareness gain
- "2": [2, 8e9, 1.09, .001,
- "DreamSense", "Use DreamSense LCC Technologies to advertise your corporation " +
- "to consumers through their dreams. Each level of this upgrade provides a passive " +
- "increase in awareness of all of your companies (divisions) by 0.004 / market cycle," +
- "and in popularity by 0.001 / market cycle. A market cycle is approximately " +
- "20 seconds."],
-
- //Makes advertising more effective
- "3": [3, 4e9, 1.12, 0.005,
- "Wilson Analytics", "Purchase data and analysis from Wilson, a marketing research " +
- "firm. Each level of this upgrades increases the effectiveness of your " +
- "advertising by 0.5% (additive)."],
-
- //Augmentation for employees, increases cre
- "4": [4, 1e9, 1.06, 0.1,
- "Nuoptimal Nootropic Injector Implants", "Purchase the Nuoptimal Nootropic " +
- "Injector augmentation for your employees. Each level of this upgrade " +
- "globally increases the creativity of your employees by 10% (additive)."],
-
- //Augmentation for employees, increases cha
- "5": [5, 1e9, 1.06, 0.1,
- "Speech Processor Implants", "Purchase the Speech Processor augmentation for your employees. " +
- "Each level of this upgrade globally increases the charisma of your employees by 10% (additive)."],
-
- //Augmentation for employees, increases int
- "6": [6, 1e9, 1.06, 0.1,
- "Neural Accelerators", "Purchase the Neural Accelerator augmentation for your employees. " +
- "Each level of this upgrade globally increases the intelligence of your employees " +
- "by 10% (additive)."],
-
- //Augmentation for employees, increases eff
- "7": [7, 1e9, 1.06, 0.1,
- "FocusWires", "Purchase the FocusWire augmentation for your employees. Each level " +
- "of this upgrade globally increases the efficiency of your employees by 10% (additive)."],
-
- //Improves sales of materials/products
- "8": [8, 1e9, 1.08, 0.01,
- "ABC SalesBots", "Always Be Closing. Purchase these robotic salesmen to increase the amount of " +
- "materials and products you sell. Each level of this upgrade globally increases your sales " +
- "by 1% (additive)."],
-
- //Improves scientific research rate
- "9": [9, 5e9, 1.07, 0.05,
- "Project Insight", "Purchase 'Project Insight', a R&D service provided by the secretive " +
- "Fulcrum Technologies. Each level of this upgrade globally increases the amount of " +
- "Scientific Research you produce by 5% (additive)."],
-}
-
-function Corporation(params={}) {
- this.name = params.name ? params.name : "The Corporation";
-
- //A division/business sector is represented by the object:
- this.divisions = [];
-
- //Financial stats
- this.funds = new _utils_decimal_js__WEBPACK_IMPORTED_MODULE_6___default.a(150e9);
- this.revenue = new _utils_decimal_js__WEBPACK_IMPORTED_MODULE_6___default.a(0);
- this.expenses = new _utils_decimal_js__WEBPACK_IMPORTED_MODULE_6___default.a(0);
- this.fundingRound = 0;
- this.public = false; //Publicly traded
- this.numShares = TOTALSHARES;
- this.issuedShares = 0;
- this.sharePrice = 0;
- this.storedCycles = 0;
-
- var numUnlockUpgrades = Object.keys(CorporationUnlockUpgrades).length,
- numUpgrades = Object.keys(CorporationUpgrades).length;
-
- this.unlockUpgrades = Array(numUnlockUpgrades).fill(0);
- this.upgrades = Array(numUpgrades).fill(0);
- this.upgradeMultipliers = Array(numUpgrades).fill(1);
-
- this.state = new CorporationState();
-}
-
-Corporation.prototype.getState = function() {
- return this.state.getState();
-}
-
-Corporation.prototype.storeCycles = function(numCycles=1) {
- this.storedCycles += numCycles;
-}
-
-Corporation.prototype.process = function() {
- var corp = this;
- if (this.storedCycles >= CyclesPerIndustryStateCycle) {
- var state = this.getState(), marketCycles=1;
- this.storedCycles -= (marketCycles * CyclesPerIndustryStateCycle);
-
- //At the start of a new cycle, calculate profits from previous cycle
- if (state === "START") {
- this.revenue = new _utils_decimal_js__WEBPACK_IMPORTED_MODULE_6___default.a(0);
- this.expenses = new _utils_decimal_js__WEBPACK_IMPORTED_MODULE_6___default.a(0);
- this.divisions.forEach((ind)=>{
- this.revenue = this.revenue.plus(ind.lastCycleRevenue);
- this.expenses = this.expenses.plus(ind.lastCycleExpenses);
- });
- var profit = this.revenue.minus(this.expenses);
- var cycleProfit = profit.times(marketCycles * SecsPerMarketCycle);
- if (isNaN(this.funds)) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("There was an error calculating your Corporations funds and they got reset to 0. " +
- "This is a bug. Please report to game developer.
" +
- "(Your funds have been set to $150b for the inconvenience)");
- this.funds = new _utils_decimal_js__WEBPACK_IMPORTED_MODULE_6___default.a(150e9);
- }
- this.funds = this.funds.plus(cycleProfit);
- this.updateSharePrice();
- }
-
- this.divisions.forEach(function(ind) {
- ind.process(marketCycles, state, corp);
- });
-
-
- this.state.nextState();
-
- if (_engine_js__WEBPACK_IMPORTED_MODULE_1__["Engine"].currentPage === _engine_js__WEBPACK_IMPORTED_MODULE_1__["Engine"].Page.Corporation) {this.updateUIContent();}
- }
-}
-
-Corporation.prototype.determineValuation = function() {
- var val, profit = (this.revenue.minus(this.expenses)).toNumber();
- if (this.public) {
- val = this.funds.toNumber() + (profit * 85e3);
- val *= (Math.pow(1.1, this.divisions.length));
- val = Math.max(val, 0);
- } else {
- val = 10e9 + Math.max(this.funds.toNumber(), 0) / 3; //Base valuation
- if (profit > 0) {
- val += (profit * 320e3);
- val *= (Math.pow(1.1, this.divisions.length));
- } else {
- val = 10e9 * Math.pow(1.1, this.divisions.length);
- }
- val -= (val % 1e6); //Round down to nearest millionth
- }
- return val * _BitNode_js__WEBPACK_IMPORTED_MODULE_0__["BitNodeMultipliers"].CorporationValuation;
-}
-
-Corporation.prototype.getInvestment = function() {
- var val = this.determineValuation(), percShares;
- switch (this.fundingRound) {
- case 0: //Seed
- percShares = 0.10;
- break;
- case 1: //Series A
- percShares = 0.35;
- break;
- case 2: //Series B
- percShares = 0.25;
- break;
- case 3: //Series C
- percShares = 0.20;
- break;
- case 4:
- return;
- }
- var funding = val * percShares * 4,
- investShares = Math.floor(TOTALSHARES * percShares),
- yesBtn = Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_12__["yesNoBoxGetYesButton"])(),
- noBtn = Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_12__["yesNoBoxGetNoButton"])();
- yesBtn.innerHTML = "Accept";
- noBtn.innerHML = "Reject";
- yesBtn.addEventListener("click", ()=>{
- ++this.fundingRound;
- this.funds = this.funds.plus(funding);
- this.numShares -= investShares;
- this.displayCorporationOverviewContent();
- return Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_12__["yesNoBoxClose"])();
- });
- noBtn.addEventListener("click", ()=>{
- return Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_12__["yesNoBoxClose"])();
- });
- Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_12__["yesNoBoxCreate"])("An investment firm has offered you " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(funding).format('$0.000a') +
- " in funding in exchange for a " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(percShares*100).format("0.000a") +
- "% stake in the company (" + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(investShares).format('0.000a') + " shares).
" +
- "Do you accept or reject this offer?");
-}
-
-Corporation.prototype.goPublic = function() {
- var goPublicPopupId = "cmpy-mgmt-go-public-popup";
- var initialSharePrice = this.determineValuation() / (TOTALSHARES);
- var txt = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
- innerHTML: "Enter the number of shares you would like to issue " +
- "for your IPO. These shares will be publicly sold " +
- "and you will no longer own them. Your Corporation will receive " +
- _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(initialSharePrice).format('$0.000a') + " per share " +
- "(the IPO money will be deposited directly into your Corporation's funds).
" +
- "Furthermore, issuing more shares now will help drive up " +
- "your company's stock price in the future.
" +
- "You have a total of " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(this.numShares).format("0.000a") + " of shares that you can issue.",
- });
- var yesBtn;
- var input = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("input", {
- type:"number",
- placeholder: "Shares to issue",
- onkeyup:(e)=>{
- e.preventDefault();
- if (e.keyCode === 13) {yesBtn.click();}
- }
- });
- var br = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("br", {});
- yesBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- class:"a-link-button",
- innerText:"Go Public",
- clickListener:()=>{
- var numShares = Math.round(input.value);
- var initialSharePrice = this.determineValuation() / (TOTALSHARES);
- if (isNaN(numShares)) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Invalid value for number of issued shares");
- return false;
- }
- if (numShares > this.numShares) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Error: You don't have that many shares to issue!");
- return false;
- }
- this.public = true;
- this.sharePrice = initialSharePrice;
- this.issuedShares = numShares;
- this.numShares -= numShares;
- this.funds = this.funds.plus(numShares * initialSharePrice);
- this.displayCorporationOverviewContent();
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(goPublicPopupId);
- return false;
- }
- });
- var noBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- class:"a-link-button",
- innerText:"Cancel",
- clickListener:()=>{
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(goPublicPopupId);
- return false;
- }
- });
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createPopup"])(goPublicPopupId, [txt, br, input, yesBtn, noBtn]);
-}
-
-Corporation.prototype.updateSharePrice = function() {
- var targetPrice = this.determineValuation() / (TOTALSHARES - this.issuedShares);
- if (this.sharePrice <= targetPrice) {
- this.sharePrice *= (1 + (Math.random() * 0.01));
- } else {
- this.sharePrice *= (1 - (Math.random() * 0.01));
- }
- if (this.sharePrice <= 0.01) {this.sharePrice = 0.01;}
-}
-
-//One time upgrades that unlock new features
-Corporation.prototype.unlock = function(upgrade) {
- var upgN = upgrade[0], price = upgrade[1];
- while (this.unlockUpgrades.length <= upgN) {
- this.unlockUpgrades.push(0);
- }
- if (this.funds.lt(price)) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("You don't have enough funds to unlock this!");
- return;
- }
- this.unlockUpgrades[upgN] = 1;
- this.funds = this.funds.minus(price);
-}
-
-//Levelable upgrades
-Corporation.prototype.upgrade = function(upgrade) {
- var upgN = upgrade[0], basePrice = upgrade[1], priceMult = upgrade[2],
- upgradeAmt = upgrade[3]; //Amount by which the upgrade multiplier gets increased (additive)
- while (this.upgrades.length <= upgN) {this.upgrades.push(0);}
- while (this.upgradeMultipliers.length <= upgN) {this.upgradeMultipliers.push(1);}
- var totalCost = basePrice * Math.pow(priceMult, this.upgrades[upgN]);
- if (this.funds.lt(totalCost)) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("You don't have enough funds to purchase this!");
- return;
- }
- ++this.upgrades[upgN];
- this.funds = this.funds.minus(totalCost);
-
- //Increase upgrade multiplier
- this.upgradeMultipliers[upgN] = 1 + (this.upgrades[upgN] * upgradeAmt);
-
- //If storage size is being updated, update values in Warehouse objects
- if (upgN === 1) {
- for (var i = 0; i < this.divisions.length; ++i) {
- var industry = this.divisions[i];
- for (var city in industry.warehouses) {
- if (industry.warehouses.hasOwnProperty(city) && industry.warehouses[city] instanceof Warehouse) {
- industry.warehouses[city].updateSize(this);
- }
- }
- }
- }
-
- this.updateCorporationOverviewContent();
-}
-
-Corporation.prototype.getProductionMultiplier = function() {
- var mult = this.upgradeMultipliers[0];
- if (isNaN(mult) || mult < 1) {return 1;} else {return mult;}
-}
-
-Corporation.prototype.getStorageMultiplier = function() {
- var mult = this.upgradeMultipliers[1];
- if (isNaN(mult) || mult < 1) {return 1;} else {return mult;}
-}
-
-Corporation.prototype.getDreamSenseGain = function() {
- var gain = this.upgradeMultipliers[2] - 1;
- return gain <= 0 ? 0 : gain;
-}
-
-Corporation.prototype.getAdvertisingMultiplier = function() {
- var mult = this.upgradeMultipliers[3];
- if (isNaN(mult) || mult < 1) {return 1;} else {return mult;}
-}
-
-Corporation.prototype.getEmployeeCreMultiplier = function() {
- var mult = this.upgradeMultipliers[4];
- if (isNaN(mult) || mult < 1) {return 1;} else {return mult;}
-}
-
-Corporation.prototype.getEmployeeChaMultiplier = function() {
- var mult = this.upgradeMultipliers[5];
- if (isNaN(mult) || mult < 1) {return 1;} else {return mult;}
-}
-
-Corporation.prototype.getEmployeeIntMultiplier = function() {
- var mult = this.upgradeMultipliers[6];
- if (isNaN(mult) || mult < 1) {return 1;} else {return mult;}
-}
-
-Corporation.prototype.getEmployeeEffMultiplier = function() {
- var mult = this.upgradeMultipliers[7];
- if (isNaN(mult) || mult < 1) {return 1;} else {return mult;}
-}
-
-Corporation.prototype.getSalesMultiplier = function() {
- var mult = this.upgradeMultipliers[8];
- if (isNaN(mult) || mult < 1) {return 1;} else {return mult;}
-}
-
-Corporation.prototype.getScientificResearchMultiplier = function() {
- var mult = this.upgradeMultipliers[9];
- if (isNaN(mult) || mult < 1) {return 1;} else {return mult;}
-}
-
-//Keep 'global' variables for DOM elements so we don't have to search
-//through the DOM tree repeatedly when updating UI
-var companyManagementDiv, companyManagementHeaderTabs, companyManagementPanel,
- currentCityUi,
- corporationUnlockUpgrades, corporationUpgrades,
-
- //Industry Overview Panel
- industryOverviewPanel, industryOverviewText,
-
- //Industry Employee Panel
- industryEmployeePanel, industryEmployeeText, industryEmployeeHireButton, industryEmployeeAutohireButton,
- industryEmployeeManagementUI, industryEmployeeInfo, industryIndividualEmployeeInfo,
- industryOfficeUpgradeSizeButton,
-
- //Industry Warehouse Panel
- industryWarehousePanel, industrySmartSupplyCheckbox, industryWarehouseStorageText,
- industryWarehouseUpgradeSizeButton, industryWarehouseStateText,
- industryWarehouseMaterials, industryWarehouseProducts,
- headerTabs, cityTabs;
-Corporation.prototype.createUI = function() {
- companyManagementDiv = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {
- id:"cmpy-mgmt-container",
- position:"fixed",
- class:"generic-menupage-container"
- });
- companyManagementHeaderTabs = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {id:"cmpy-mgmt-header-tabs"});
- companyManagementDiv.appendChild(companyManagementHeaderTabs);
-
- //Create division/industry tabs at the top
- this.updateUIHeaderTabs();
-
- //Create the 'panel' that will have the actual content in the UI
- companyManagementPanel = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {id:"cmpy-mgmt-panel"});
- companyManagementDiv.appendChild(companyManagementPanel);
- document.getElementById("entire-game-container").appendChild(companyManagementDiv);
-
- this.displayCorporationOverviewContent();
-}
-
-Corporation.prototype.updateUIHeaderTabs = function() {
- if (companyManagementHeaderTabs) {
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeChildrenFromElement"])(companyManagementHeaderTabs);
- } else {
- console.log("ERROR: Header tabs div has not yet been created when Corporation.updateUIHeaderTabs() is called");
- return;
- }
-
- //Corporation overview tabs
- var cmpyOverviewHdrTab = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("button", {
- id:"cmpy-mgmt-company-tab",
- class:"cmpy-mgmt-header-tab",
- innerText:this.name,
- checked:true,
- clickListener:()=>{
- this.selectHeaderTab(cmpyOverviewHdrTab);
- this.displayCorporationOverviewContent();
- return false;
- }
- });
- companyManagementHeaderTabs.appendChild(cmpyOverviewHdrTab);
-
- //Tabs for each division
- for (var i = 0; i < this.divisions.length; ++i) {
- this.createDivisionUIHeaderTab(this.divisions[i]);
- }
-
- //Create a tab to expand into a new industry
- companyManagementHeaderTabs.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("button", {
- id:'cmpy-mgmt-expand-industry-tab',
- class:"cmpy-mgmt-header-tab",
- innerText:"Expand into new Industry",
- clickListener: ()=>{
- if (document.getElementById("cmpy-mgmt-expand-industry-popup") != null) {return;}
-
- var container = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {
- class:"popup-box-container",
- id:"cmpy-mgmt-expand-industry-popup",
- });
- var content = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {class:"popup-box-content"});
- var txt = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
- innerHTML: "Create a new division to expand into a new industry:",
- });
- var selector = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("select", {
- class:"cmpy-mgmt-industry-select"
- });
- var industryDescription = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {});
- var yesBtn;
- var nameInput = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("input", {
- type:"text",
- id:"cmpy-mgmt-expand-industry-name-input",
- color:"white",
- backgroundColor:"black",
- display:"block",
- maxLength: 30,
- pattern:"[a-zA-Z0-9-_]",
- onkeyup:(e)=>{
- e.preventDefault();
- if (e.keyCode === 13) {yesBtn.click();}
- }
- });
- var nameLabel = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("label", {
- for:"cmpy-mgmt-expand-industry-name-input",
- innerText:"Division name: "
- });
- yesBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("span", {
- class:"popup-box-button",
- innerText:"Create Division",
- clickListener: ()=>{
- var ind = selector.options[selector.selectedIndex].value,
- newDivisionName = nameInput.value;
-
- for (var i = 0; i < this.divisions.length; ++i) {
- if (this.divisions[i].name === newDivisionName) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("This name is already in use!");
- return false;
- }
- }
- if (this.funds.lt(IndustryStartingCosts[ind])) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Not enough money to create a new division in this industry");
- } else if (newDivisionName === "") {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("New division must have a name!");
- } else {
- this.funds = this.funds.minus(IndustryStartingCosts[ind]);
- var newInd = new Industry({
- name:newDivisionName,
- type:ind,
- });
- this.divisions.push(newInd);
- this.updateUIHeaderTabs();
- this.selectHeaderTab(headerTabs[headerTabs.length-2]);
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])("cmpy-mgmt-expand-industry-popup");
- this.displayDivisionContent(newInd, _Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Sector12);
- }
- return false;
- }
- });
- var noBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("span", {
- class:"popup-box-button",
- innerText:"Cancel",
- clickListener: function() {
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])("cmpy-mgmt-expand-industry-popup");
- return false;
- }
- });
-
- //Make an object to keep track of what industries you're already in
- var ownedIndustries = {}
- for (var i = 0; i < this.divisions.length; ++i) {
- ownedIndustries[this.divisions[i].type] = true;
- }
-
- //Add industry types to selector
- //Have Agriculture be first as recommended option
- if (!ownedIndustries["Agriculture"]) {
- selector.add(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("option", {
- text:Industries["Agriculture"], value:"Agriculture"
- }));
- }
-
- for (var key in Industries) {
- if (key !== "Agriculture" && Industries.hasOwnProperty(key) && !ownedIndustries[key]) {
- var ind = Industries[key];
- selector.add(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("option", {
- text: ind,value:key,
- }));
- }
- }
-
- //Initial Industry Description
- var ind = selector.options[selector.selectedIndex].value;
- industryDescription.innerHTML = (IndustryDescriptions[ind] + "
");
-
- //Change the industry description text based on selected option
- selector.addEventListener("change", function() {
- var ind = selector.options[selector.selectedIndex].value;
- industryDescription.innerHTML = IndustryDescriptions[ind] + "
";
- });
-
- //Add to DOM
- content.appendChild(txt);
- content.appendChild(selector);
- content.appendChild(industryDescription);
- content.appendChild(nameLabel);
- content.appendChild(nameInput);
- content.appendChild(noBtn);
- content.appendChild(yesBtn);
- container.appendChild(content);
- document.getElementById("entire-game-container").appendChild(container);
- container.style.display = "block";
- return false;
- }
- }));
-
- headerTabs = companyManagementDiv.getElementsByClassName("cmpy-mgmt-header-tab");
-}
-
-//Updates UI to display which header tab is selected
-Corporation.prototype.selectHeaderTab = function(currentTab) {
- if (currentTab == null) {return;}
- for (var i = 0; i < headerTabs.length; ++i) {
- headerTabs[i].className = "cmpy-mgmt-header-tab";
- }
- currentTab.className = "cmpy-mgmt-header-tab current";
-}
-
-Corporation.prototype.createDivisionUIHeaderTab = function(division) {
- var tabId = "cmpy-mgmt-" + division.name + "-tab";
- var tab = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("button", {
- id:tabId,
- class:"cmpy-mgmt-header-tab",
- innerText:division.name,
- clickListener:()=>{
- this.selectHeaderTab(tab);
- this.displayDivisionContent(division, _Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Sector12);
- return false;
- }
- });
- companyManagementHeaderTabs.appendChild(tab);
-}
-
-Corporation.prototype.clearUIPanel = function() {
- while(companyManagementPanel.firstChild) {
- companyManagementPanel.removeChild(companyManagementPanel.firstChild);
- }
-}
-
-Corporation.prototype.updateUIContent = function() {
- //Check which of the header tab buttons is checked
- if (headerTabs == null) {
- console.log("ERROR: headerTabs is null in Corporation.updateUIContent()");
- return;
- }
- for (var i = 0; i < headerTabs.length; ++i) {
- if (headerTabs[i].classList.contains("current")) {
- if (i === 0) {
- //Corporation overview
- this.updateCorporationOverviewContent();
- } else {
- //Division
- this.updateDivisionContent(this.divisions[i-1]);
- }
- return;
- }
- }
-}
-
-Corporation.prototype.displayCorporationOverviewContent = function() {
- this.clearUIPanel();
- companyManagementPanel.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
- id:"cmpy-mgmt-overview-text",
- }));
- if (headerTabs && headerTabs.length >= 1) {
- this.selectHeaderTab(headerTabs[0]);
- }
-
- //Check if player has Corporation Handbook
- var homeComp = _Player_js__WEBPACK_IMPORTED_MODULE_5__["Player"].getHomeComputer(), hasHandbook = false,
- handbookFn = "corporation-management-handbook.lit";
- for (var i = 0; i < homeComp.messages.length; ++i) {
- if (Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["isString"])(homeComp.messages[i]) && homeComp.messages[i] === handbookFn) {
- hasHandbook = true;
- break;
- }
- }
-
- companyManagementPanel.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- class:"a-link-button", innerText:"Getting Started Guide", display:"inline-block",
- tooltip:"Get a copy of and read 'The Complete Handbook for Creating a Successful Corporation.' " +
- "This is a .lit file that guides you through the beginning of setting up a Corporation and " +
- "provides some tips/pointers for helping you get started with managing it.",
- clickListener:()=>{
- if (!hasHandbook) {homeComp.messages.push(handbookFn);}
- Object(_Literature_js__WEBPACK_IMPORTED_MODULE_3__["showLiterature"])(handbookFn);
- return false;
- }
- }));
-
- //Investors
- if (this.public) {
- //Sell share buttons
- var sellShares = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- class:"a-link-button", innerText:"Sell Shares", display:"inline-block",
- tooltip:"Sell your shares in the company. This is the only way to " +
- "profit from your business venture.",
- clickListener:()=>{
- var popupId = "cmpy-mgmt-sell-shares-popup";
- var currentStockPrice = this.sharePrice;
- var txt = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
- innerHTML: "Enter the number of shares you would like to sell. The money from " +
- "selling your shares will go directly to you (NOT your Corporation). " +
- "The current price of your " +
- "company's stock is " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(currentStockPrice).format("$0.000a"),
- });
- var profitIndicator = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {});
- var input = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("input", {
- type:"number", placeholder:"Shares to sell", margin:"5px",
- inputListener: ()=> {
- var numShares = Math.round(input.value);
- if (isNaN(numShares) || numShares <= 0) {
- profitIndicator.innerText = "ERROR: Invalid value entered for number of shares to sell"
- } else if (numShares > this.numShares) {
- profitIndicator.innerText = "You don't have this many shares to sell!";
- } else {
- profitIndicator.innerText = "Sell " + numShares + " shares for a total of " +
- _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(numShares * currentStockPrice).format('$0.000a');
- }
- }
- });
- var confirmBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- class:"a-link-button", innerText:"Sell shares", display:"inline-block",
- clickListener:()=>{
- var shares = Math.round(input.value);
- if (isNaN(shares) || shares <= 0) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("ERROR: Invalid value for number of shares");
- } else if (shares > this.numShares) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("ERROR: You don't have this many shares to sell");
- } else {
- this.numShares -= shares;
- if (isNaN(this.issuedShares)) {
- console.log("ERROR: Corporation issuedShares is NaN: " + this.issuedShares);
- console.log("Converting to number now");
- var res = parseInt(this.issuedShares);
- if (isNaN(res)) {
- this.issuedShares = 0;
- } else {
- this.issuedShares = res;
- }
- }
- this.issuedShares += shares;
- _Player_js__WEBPACK_IMPORTED_MODULE_5__["Player"].gainMoney(shares * this.sharePrice);
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
- return false;
- }
-
- }
- });
- var cancelBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- class:"a-link-button", innerText:"Cancel", display:"inline-block",
- clickListener:()=>{
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
- return false;
- }
- });
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createPopup"])(popupId, [txt, profitIndicator, input, confirmBtn, cancelBtn]);
- }
- });
-
- //Buyback shares button
- var buybackShares = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- class:"a-link-button", innerText:"Buyback shares", display:"inline-block",
- tooltip:"Buy back shares you that previously issued or sold at market price.",
- clickListener:()=>{
- var popupId = "cmpy-mgmt-buyback-shares-popup";
- var currentStockPrice = this.sharePrice;
- var txt = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
- innerHTML: "Enter the number of shares you would like to buy back at market price. To purchase " +
- "these shares, you must use your own money (NOT your Corporation's funds). " +
- "The current price of your " +
- "company's stock is " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(currentStockPrice).format("$0.000a") +
- ". Your company currently has " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(this.issuedShares, 3) + " outstanding stock shares",
- });
- var costIndicator = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {});
- var input = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("input", {
- type:"number", placeholder:"Shares to buyback", margin:"5px",
- inputListener: ()=> {
- var numShares = Math.round(input.value);
- //TODO add conditional for if player doesn't have enough money
- if (isNaN(numShares) || numShares <= 0) {
- costIndicator.innerText = "ERROR: Invalid value entered for number of shares to buyback"
- } else if (numShares > this.issuedShares) {
- costIndicator.innerText = "There are not this many shares available to buy back. " +
- "There are only " + this.issuedShares + " outstanding shares.";
- } else {
- console.log("here");
- costIndicator.innerText = "Purchase " + numShares + " shares for a total of " +
- _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(numShares * currentStockPrice).format('$0.000a');
- }
- }
- });
- var confirmBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- class:"a-link-button", innerText:"Buy shares", display:"inline-block",
- clickListener:()=>{
- var shares = Math.round(input.value);
- var tempStockPrice = this.sharePrice;
- if (isNaN(shares) || shares <= 0) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("ERROR: Invalid value for number of shares");
- } else if (shares > this.issuedShares) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("ERROR: There are not this many oustanding shares to buy back");
- } else if (shares * tempStockPrice > _Player_js__WEBPACK_IMPORTED_MODULE_5__["Player"].money) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("ERROR: You do not have enough money to purchase this many shares (you need " +
- _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(shares * tempStockPrice).format("$0.000a") + ")");
- } else {
- this.numShares += shares;
- if (isNaN(this.issuedShares)) {
- console.log("ERROR: Corporation issuedShares is NaN: " + this.issuedShares);
- console.log("Converting to number now");
- var res = parseInt(this.issuedShares);
- if (isNaN(res)) {
- this.issuedShares = 0;
- } else {
- this.issuedShares = res;
- }
- }
- this.issuedShares -= shares;
- _Player_js__WEBPACK_IMPORTED_MODULE_5__["Player"].loseMoney(shares * tempStockPrice);
- //TODO REMOVE from Player money
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
- }
- return false;
-
- }
- });
- var cancelBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- class:"a-link-button",
- innerText:"Cancel",
- display:"inline-block",
- clickListener:()=>{
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
- return false;
- }
- });
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createPopup"])(popupId, [txt, costIndicator, input, confirmBtn, cancelBtn]);
- }
- });
-
- companyManagementPanel.appendChild(sellShares);
- companyManagementPanel.appendChild(buybackShares);
-
- //If your Corporation is big enough, buy faction influence through bribes
- var canBribe = this.determineValuation() >= BribeThreshold;
- var bribeFactions = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- class: canBribe ? "a-link-button" : "a-link-button-inactive",
- innerText:"Bribe Factions", display:"inline-block",
- tooltip:canBribe
- ? "Use your Corporations power and influence to bribe Faction leaders in exchange for reputation"
- : "Your Corporation is not powerful enough to bribe Faction leaders",
- clickListener:()=>{
- var popupId = "cmpy-mgmt-bribe-factions-popup";
- var txt = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
- innerText:"You can use Corporation funds or stock shares to bribe Faction Leaders in exchange for faction reputation"
- });
- var factionSelector = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("select", {margin:"3px"});
- for (var i = 0; i < _Player_js__WEBPACK_IMPORTED_MODULE_5__["Player"].factions.length; ++i) {
- var facName = _Player_js__WEBPACK_IMPORTED_MODULE_5__["Player"].factions[i];
- factionSelector.add(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("option", {
- text:facName, value:facName
- }));
- }
- var repGainText = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p");
- var stockSharesInput;
- var moneyInput = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("input", {
- type:"number", placeholder:"Corporation funds", margin:"5px",
- inputListener:()=>{
- var money = moneyInput.value == null || moneyInput.value == "" ? 0 : parseFloat(moneyInput.value);
- var stockPrice = this.sharePrice;
- var stockShares = stockSharesInput.value == null || stockSharesInput.value == "" ? 0 : Math.round(parseFloat(stockSharesInput.value));
- if (isNaN(money) || isNaN(stockShares) || money < 0 || stockShares < 0) {
- repGainText.innerText = "ERROR: Invalid value(s) entered";
- } else if (this.funds.lt(money)) {
- repGainText.innerText = "ERROR: You do not have this much money to bribe with";
- } else if (this.stockShares > this.numShares) {
- repGainText.innerText = "ERROR: You do not have this many shares to bribe with";
- } else {
-
- var totalAmount = Number(money) + (stockShares * stockPrice);
- var repGain = totalAmount / BribeToRepRatio;
- repGainText.innerText = "You will gain " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(repGain, 0) +
- " reputation with " +
- factionSelector.options[factionSelector.selectedIndex].value +
- " with this bribe";
- }
- }
- });
- stockSharesInput = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("input", {
- type:"number", placeholder:"Stock Shares", margin: "5px",
- inputListener:()=>{
- var money = moneyInput.value == null || moneyInput.value == "" ? 0 : parseFloat(moneyInput.value);
- var stockPrice = this.sharePrice;
- var stockShares = stockSharesInput.value == null || stockSharesInput.value == "" ? 0 : Math.round(stockSharesInput.value);
- if (isNaN(money) || isNaN(stockShares) || money < 0 || stockShares < 0) {
- repGainText.innerText = "ERROR: Invalid value(s) entered";
- } else if (this.funds.lt(money)) {
- repGainText.innerText = "ERROR: You do not have this much money to bribe with";
- } else if (this.stockShares > this.numShares) {
- repGainText.innerText = "ERROR: You do not have this many shares to bribe with";
- } else {
- var totalAmount = money + (stockShares * stockPrice);
- var repGain = totalAmount / BribeToRepRatio;
- console.log("repGain: " + repGain);
- repGainText.innerText = "You will gain " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(repGain, 0) +
- " reputation with " +
- factionSelector.options[factionSelector.selectedIndex].value +
- " with this bribe";
- }
- }
- });
- var confirmButton = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- class:"a-link-button", innerText:"Bribe", display:"inline-block",
- clickListener:()=>{
- var money = moneyInput.value == null || moneyInput.value == "" ? 0 : parseFloat(moneyInput.value);
- var stockPrice = this.sharePrice;
- var stockShares = stockSharesInput.value == null || stockSharesInput.value == ""? 0 : Math.round(parseFloat(stockSharesInput.value));
- var fac = _Faction_js__WEBPACK_IMPORTED_MODULE_2__["Factions"][factionSelector.options[factionSelector.selectedIndex].value];
- if (fac == null) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("ERROR: You must select a faction to bribe");
- return false;
- }
- if (isNaN(money) || isNaN(stockShares) || money < 0 || stockShares < 0) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("ERROR: Invalid value(s) entered");
- } else if (this.funds.lt(money)) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("ERROR: You do not have this much money to bribe with");
- } else if (stockShares > this.numShares) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("ERROR: You do not have this many shares to bribe with");
- } else {
- var totalAmount = money + (stockShares * stockPrice);
- var repGain = totalAmount / BribeToRepRatio;
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("You gained " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(repGain, 0) +
- " reputation with " + fac.name + " by bribing them.");
- fac.playerReputation += repGain;
- this.funds = this.funds.minus(money);
- this.numShares -= stockShares;
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
- return false;
- }
- }
- });
- var cancelButton = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- class:"a-link-button", innerText:"Cancel", display:"inline-block",
- clickListener:()=>{
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
- return false;
- }
- });
-
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createPopup"])(popupId, [txt, factionSelector, repGainText,
- moneyInput, stockSharesInput, confirmButton, cancelButton]);
- }
- });
- companyManagementPanel.appendChild(bribeFactions);
- } else {
- var findInvestors = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- class: this.fundingRound >= 4 ? "a-link-button-inactive" : "a-link-button tooltip",
- innerText: "Find Investors",
- display:"inline-block",
- clickListener:()=>{
- this.getInvestment();
- }
- });
- if (this.fundingRound < 4) {
- var findInvestorsTooltip = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("span", {
- class:"tooltiptext",
- innerText:"Search for private investors who will give you startup funding in exchange " +
- "for equity (stock shares) in your company"
- });
- findInvestors.appendChild(findInvestorsTooltip);
- }
-
- var goPublic = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- class:"a-link-button tooltip",
- innerText:"Go Public",
- display:"inline-block",
- clickListener:()=>{
- this.goPublic();
- return false;
- }
- });
- var goPublicTooltip = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("span", {
- class:"tooltiptext",
- innerText: "Become a publicly traded and owned entity. Going public involves " +
- "issuing shares for an IPO. Once you are a public company, " +
- "your shares will be traded on the stock market."
- });
- goPublic.appendChild(goPublicTooltip);
-
- companyManagementPanel.appendChild(findInvestors);
- companyManagementPanel.appendChild(goPublic);
- }
-
- //Update overview text
- this.updateCorporationOverviewContent();
-
- //Don't show upgrades if player hasn't opened any divisions
- if (this.divisions.length <= 0) {return; }
- //Corporation Upgrades
- var upgradeContainer = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {
- class:"cmpy-mgmt-upgrade-container",
- });
- upgradeContainer.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("h1", {
- innerText:"Unlocks", margin:"6px", padding:"6px",
- }));
-
- //Unlock upgrades
- var corp = this;
- var numUnlockUpgrades = Object.keys(CorporationUnlockUpgrades).length,
- numUpgrades = Object.keys(CorporationUpgrades).length;
- if (this.unlockUpgrades == null || this.upgrades == null) { //Backwards compatibility
- this.unlockUpgrades = Array(numUnlockUpgrades).fill(0);
- this.upgrades = Array(numUpgrades).fill(0);
- }
- while (this.unlockUpgrades.length < numUnlockUpgrades) {this.unlockUpgrades.push(0);}
- while (this.upgrades.length < numUpgrades) {this.upgrades.push(0);}
- while (this.upgradeMultipliers < numUpgrades) {this.upgradeMultipliers.push(1);}
-
- for (var i = 0; i < numUnlockUpgrades; ++i) {
- (function(i, corp) {
- if (corp.unlockUpgrades[i] === 0) {
- var upgrade = CorporationUnlockUpgrades[i.toString()];
- if (upgrade == null) {
- console.log("ERROR: Could not find upgrade index " + i);
- return;
- }
-
- upgradeContainer.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {
- class:"cmpy-mgmt-upgrade-div", width:"45%",
- innerHTML:upgrade[2] + " - " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(upgrade[1]).format("$0.000a"),
- tooltip: upgrade[3],
- clickListener:()=>{
- if (corp.funds.lt(upgrade[1])) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Insufficient funds");
- } else {
- corp.unlock(upgrade);
- corp.displayCorporationOverviewContent();
- }
- }
- }));
- }
- })(i, corp);
- }
-
- //Levelable upgrades
- upgradeContainer.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("h1", {
- innerText:"Upgrades", margin:"6px", padding:"6px",
- }));
-
- for (var i = 0; i < numUpgrades; ++i) {
- (function(i, corp) {
- var upgrade = CorporationUpgrades[i.toString()];
- if (upgrade == null) {
- console.log("ERROR: Could not find levelable upgrade index " + i);
- return;
- }
-
- var baseCost = upgrade[1], priceMult = upgrade[2];
- var cost = baseCost * Math.pow(priceMult, corp.upgrades[i]);
- upgradeContainer.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {
- class:"cmpy-mgmt-upgrade-div", width:"45%",
- innerHTML:upgrade[4] + " - " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(cost).format("$0.000a"),
- tooltip:upgrade[5],
- clickListener:()=>{
- if (corp.funds.lt(cost)) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Insufficient funds");
- } else {
- corp.upgrade(upgrade);
- corp.displayCorporationOverviewContent();
- }
- }
- }));
- })(i, corp);
- }
-
- companyManagementPanel.appendChild(upgradeContainer);
-}
-
-Corporation.prototype.updateCorporationOverviewContent = function() {
- var p = document.getElementById("cmpy-mgmt-overview-text");
- if (p == null) {
- console.log("WARNING: Could not find overview text elemtn in updateCorporationOverviewContent()");
- return;
- }
- var totalFunds = this.funds,
- totalRevenue = new _utils_decimal_js__WEBPACK_IMPORTED_MODULE_6___default.a(0),
- totalExpenses = new _utils_decimal_js__WEBPACK_IMPORTED_MODULE_6___default.a(0);
-
- var profit = this.revenue.minus(this.expenses).toNumber(),
- profitStr = profit >= 0 ? _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(profit).format("$0.000a") : "-" + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(-1 * profit).format("$0.000a");
-
- var txt = "Total Funds: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(totalFunds.toNumber()).format('$0.000a') + "
" +
- "Total Revenue: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(this.revenue.toNumber()).format("$0.000a") + " / s
" +
- "Total Expenses: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(this.expenses.toNumber()).format("$0.000a") + "/ s
" +
- "Total Profits: " + profitStr + " / s
" +
- "Publicly Traded: " + (this.public ? "Yes" : "No") + "
" +
- "Owned Stock Shares: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(this.numShares).format('0.000a') + "
" +
- "Stock Price: " + (this.public ? "$" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(this.sharePrice, 2) : "N/A") + "
";
-
- var prodMult = this.getProductionMultiplier(),
- storageMult = this.getStorageMultiplier(),
- advMult = this.getAdvertisingMultiplier(),
- empCreMult = this.getEmployeeCreMultiplier(),
- empChaMult = this.getEmployeeChaMultiplier(),
- empIntMult = this.getEmployeeIntMultiplier(),
- empEffMult = this.getEmployeeEffMultiplier(),
- salesMult = this.getSalesMultiplier(),
- sciResMult = this.getScientificResearchMultiplier();
- if (prodMult > 1) {txt += "Production Multiplier: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(prodMult, 3) + "
";}
- if (storageMult > 1) {txt += "Storage Multiplier: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(storageMult, 3) + "
";}
- if (advMult > 1) {txt += "Advertising Multiplier: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(advMult, 3) + "
";}
- if (empCreMult > 1) {txt += "Empl. Creativity Multiplier: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(empCreMult, 3) + "
";}
- if (empChaMult > 1) {txt += "Empl. Charisma Multiplier: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(empChaMult, 3) + "
";}
- if (empIntMult > 1) {txt += "Empl. Intelligence Multiplier: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(empIntMult, 3) + "
";}
- if (empEffMult > 1) {txt += "Empl. Efficiency Multiplier: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(empEffMult, 3) + "
";}
- if (salesMult > 1) {txt += "Sales Multiplier: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(salesMult, 3) + "
";}
- if (sciResMult > 1) {txt += "Scientific Research Multiplier: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(sciResMult, 3) + "
";}
- p.innerHTML = txt;
-}
-
-Corporation.prototype.displayDivisionContent = function(division, city) {
- this.clearUIPanel();
- currentCityUi = city;
-
- //Add the city tabs on the left
- for (var cityName in division.offices) {
- if (division.offices[cityName] instanceof OfficeSpace) {
- this.createCityUITab(cityName, division);
- }
- }
- cityTabs = companyManagementPanel.getElementsByClassName("cmpy-mgmt-city-tab");
- if (cityTabs.length > 0) {
- this.selectCityTab(document.getElementById("cmpy-mgmt-city-" + city + "-tab"), city);
- }
-
- //Expand into new City button
- companyManagementPanel.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("button", {
- class:"cmpy-mgmt-city-tab", innerText:"Expand into new City", display:"inline-block",
- clickListener:()=>{
- var popupId = "cmpy-mgmt-expand-city-popup";
- var text = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
- innerText: "Would you like to expand into a new city by opening an office? " +
- "This would cost " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(OfficeInitialCost).format('$0.000a'),
- });
- var citySelector = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("select", {margin:"5px"});
- for (var cityName in division.offices) {
- if (division.offices.hasOwnProperty(cityName)) {
- if (!(division.offices[cityName] instanceof OfficeSpace)) {
- citySelector.add(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("option", {
- text: cityName,
- value: cityName
- }));
- }
- }
- }
-
- var confirmBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- innerText:"Confirm", class:"a-link-button", display:"inline-block", margin:"3px",
- clickListener:()=>{
- var city = citySelector.options[citySelector.selectedIndex].value;
- if (this.funds.lt(OfficeInitialCost)) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("You don't have enough company funds to open a new office!");
- } else {
- this.funds = this.funds.minus(OfficeInitialCost);
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Opened a new office in " + city + "!");
- division.offices[city] = new OfficeSpace({
- loc:city,
- size:OfficeInitialSize,
- });
- this.displayDivisionContent(division, city);
- }
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
- return false;
- }
- });
- var cancelBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- innerText:"Cancel", class:"a-link-button", display:"inline-block", margin:"3px",
- clickListener:()=>{
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
- return false;
- }
- })
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createPopup"])(popupId, [text, citySelector, confirmBtn, cancelBtn]);
- return false;
- }
- }));
- companyManagementPanel.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("br", {})); // Force line break
-
- //Get office object
- var office = division.offices[currentCityUi];
- if (!(office instanceof OfficeSpace)) {
- console.log("ERROR: Current city for UI does not have an office space");
- return;
- }
-
- //Left and right panels
- var leftPanel = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {class:"cmpy-mgmt-industry-left-panel"});
- var rightPanel = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {class:"cmpy-mgmt-industry-right-panel"});
- companyManagementPanel.appendChild(leftPanel);
- companyManagementPanel.appendChild(rightPanel);
-
- //Different sections (Overview, Employee/Office, and Warehouse)
- industryOverviewPanel = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {
- id:"cmpy-mgmt-industry-overview-panel", class:"cmpy-mgmt-industry-overview-panel"
- });
- leftPanel.appendChild(industryOverviewPanel);
-
- industryEmployeePanel = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {
- id:"cmpy-mgmt-employee-panel", class:"cmpy-mgmt-employee-panel"
- });
- leftPanel.appendChild(industryEmployeePanel);
-
- industryWarehousePanel = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {
- id:"cmpy-mgmt-warehouse-panel", class:"cmpy-mgmt-warehouse-panel"
- });
- rightPanel.appendChild(industryWarehousePanel);
-
- //Industry overview text
- industryOverviewText = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {});
- industryOverviewPanel.appendChild(industryOverviewText);
- industryOverviewPanel.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("br", {}));
-
- //Industry overview Purchases & Upgrades
- var numUpgrades = Object.keys(IndustryUpgrades).length;
- while (division.upgrades.length < numUpgrades) {division.upgrades.push(0);} //Backwards compatibility
-
- var industryOverviewUpgrades = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {});
- industryOverviewUpgrades.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("u", {
- innerText:"Purchases & Upgrades", margin:"2px", padding:"2px",
- fontSize:"14px",
- }));
- industryOverviewUpgrades.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("br", {}));
- for (var i = 0; i < numUpgrades; ++i) {
- (function(i, corp, division, office) {
- var upgrade = IndustryUpgrades[i.toString()];
- if (upgrade == null) {
- console.log("ERROR: Could not find levelable upgrade index: " + i);
- return;
- }
-
- var baseCost = upgrade[1], priceMult = upgrade[2], cost = 0;
- switch(i) {
- case 0: //Coffee, cost is static per employee
- cost = office.employees.length * baseCost;
- break;
- default:
- cost = baseCost * Math.pow(priceMult, division.upgrades[i]);
- break;
- }
- industryOverviewUpgrades.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {
- class:"cmpy-mgmt-upgrade-div", display:"inline-block",
- innerHTML:upgrade[4] + ' - ' + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(cost).format("$0.000a"),
- tooltip:upgrade[5],
- clickListener:()=>{
- if (corp.funds.lt(cost)) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Insufficient funds");
- } else {
- corp.funds = corp.funds.minus(cost);
- division.upgrade(upgrade, {
- corporation:corp,
- office:office,
- });
- corp.displayDivisionContent(division, city);
- }
- }
- }));
- industryOverviewUpgrades.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("br", {}));
-
- })(i, this, division, office);
- }
-
-
- industryOverviewPanel.appendChild(industryOverviewUpgrades);
-
- //Industry Overview 'Create Product' button if applicable
- if (division.makesProducts) {
- //Get the text on the button based on Industry type
- var createProductButtonText, createProductPopupText;
- switch(division.type) {
- case Industries.Food:
- createProductButtonText = "Build Restaurant";
- createProductPopupText = "Build and manage a new restaurant!"
- break;
- case Industries.Tobacco:
- createProductButtonText = "Create Product";
- createProductPopupText = "Create a new tobacco product!";
- break;
- case Industries.Pharmaceutical:
- createProductButtonText = "Create Drug";
- createProductPopupText = "Design and develop a new pharmaceutical drug!";
- break;
- case Industries.Computer:
- case "Computer":
- createProductButtonText = "Create Product";
- createProductPopupText = "Design and manufacture a new computer hardware product!";
- break;
- case Industries.Robotics:
- createProductButtonText = "Design Robot";
- createProductPopupText = "Design and create a new robot or robotic system!";
- break;
- case Industries.Software:
- createProductButtonText = "Develop Software";
- createProductPopupText = "Develop a new piece of software!";
- break;
- case Industries.HealthCare:
- createProductButtonText = "Build Hospital";
- createProductPopupText = "Build and manage a new hospital!";
- break;
- case Industries.RealEstate:
- createProductButtonText = "Develop Property";
- createProductPopupText = "Develop a new piece of real estate property!";
- break;
- default:
- createProductButtonText = "Create Product";
- return "";
- }
- createProductPopupText += "
To begin developing a product, " +
- "first choose the city in which it will be designed. The stats of your employees " +
- "in the selected city affect the properties of the finished product, such as its " +
- "quality, performance, and durability.
" +
- "You can also choose to invest money in the design and marketing of " +
- "the product. Investing money in its design will result in a superior product. " +
- "Investing money in marketing the product will help the product's sales.";
-
- //Create the button
- industryOverviewPanel.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- class:"a-link-button", innerText:createProductButtonText, margin:"6px", display:"inline-block",
- clickListener:()=>{
- var popupId = "cmpy-mgmt-create-product-popup";
- var txt = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
- innerHTML:createProductPopupText,
- });
- var designCity = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("select", {});
- for (var cityName in division.offices) {
- if (division.offices[cityName] instanceof OfficeSpace) {
- designCity.add(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("option", {
- value:cityName,
- text:cityName
- }));
- }
- }
- var foo = "Product Name";
- if (division.type === Industries.Food) {
- foo = "Restaurant Name";
- } else if (division.type === Industries.Healthcare) {
- foo = "Hospital Name";
- } else if (division.type === Industries.RealEstate) {
- foo = "Property Name";
- }
- var productNameInput = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("input", {
- placeholder:foo,
- });
- var lineBreak1 = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("br",{});
- var designInvestInput = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("input", {
- type:"number",
- placeholder:"Design investment"
- });
- var marketingInvestInput = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("input", {
- type:"number",
- placeholder:"Marketing investment"
- });
- var confirmBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- class:"a-link-button",
- innerText:"Develop Product",
- clickListener:()=>{
- if (designInvestInput.value == null) {designInvestInput.value = 0;}
- if (marketingInvestInput.value == null) {marketingInvestInput.value = 0;}
- var designInvest = parseFloat(designInvestInput.value),
- marketingInvest = parseFloat(marketingInvestInput.value);
- if (productNameInput.value == null || productNameInput.value === "") {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("You must specify a name for your product!");
- } else if (isNaN(designInvest)) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Invalid value for design investment");
- } else if (isNaN(marketingInvest)) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Invalid value for marketing investment");
- } else if (this.funds.lt(designInvest + marketingInvest)) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("You don't have enough company funds to make this large of an investment");
- } else {
- var product = new Product({
- name:productNameInput.value.replace(/[<>]/g, ''), //Sanitize for HTMl elements
- createCity:designCity.options[designCity.selectedIndex].value,
- designCost: designInvest,
- advCost: marketingInvest,
- });
- this.funds = this.funds.minus(designInvest + marketingInvest);
- division.products[product.name] = product;
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
- }
- //this.updateUIContent();
- this.displayDivisionContent(division, city);
- return false;
- }
- })
- var cancelBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- class:"a-link-button",
- innerText:"Cancel",
- clickListener:()=>{
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
- return false;
- }
- })
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createPopup"])(popupId, [txt, designCity, productNameInput, lineBreak1,
- designInvestInput, marketingInvestInput, confirmBtn, cancelBtn]);
- }
- }));
- }
-
- //Employee and Office Panel
- industryEmployeeText = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
- id: "cmpy-mgmt-employee-p",
- display:"block",
- innerHTML: "Office Space
" +
- "Type: " + office.tier + "
" +
- "Comfort: " + office.comf + "
" +
- "Beauty: " + office.beau + "
" +
- "Size: " + office.employees.length + " / " + office.size + " employees",
- });
- industryEmployeePanel.appendChild(industryEmployeeText);
-
- //Hire Employee button
- if (office.employees.length === 0) {
- industryEmployeeHireButton = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- class:"a-link-button",display:"inline-block",
- innerText:"Hire Employee", fontSize:"13px",
- tooltip:"You'll need to hire some employees to get your operations started! " +
- "It's recommended to have at least one employee in every position",
- clickListener:()=>{
- office.findEmployees({corporation:this, division:division});
- return false;
- }
- });
- //industryEmployeeHireButton.classList.add("flashing-button");
- } else {
- industryEmployeeHireButton = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- class:"a-link-button",display:"inline-block",
- innerText:"Hire Employee", fontSize:"13px",
- clickListener:()=>{
- office.findEmployees({corporation:this, division:division});
- return false;
- }
- });
- }
- industryEmployeePanel.appendChild(industryEmployeeHireButton);
-
- //Autohire Employee button
- industryEmployeeAutohireButton = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- class:"a-link-button", display:"inline-block",
- innerText:"Autohire Employee", fontSize:"13px",
- tooltip:"Automatically hires an employee and gives him/her a random name",
- clickListener:()=>{
- office.hireRandomEmployee({corporation:this, division:division});
- return false;
- }
- });
- industryEmployeePanel.appendChild(industryEmployeeAutohireButton);
-
- //Upgrade Office Size button
- industryEmployeePanel.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("br", {}));
- industryOfficeUpgradeSizeButton = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- class:"a-link-button", innerText:"Upgrade size",
- display:"inline-block", margin:"6px", fontSize:"13px",
- tooltip:"Upgrade the office's size so that it can hold more employees!",
- clickListener:()=>{
- var popupId = "cmpy-mgmt-upgrade-office-size-popup";
- var initialPriceMult = Math.round(office.size / OfficeInitialSize);
- var upgradeCost = OfficeInitialCost * Math.pow(1.07, initialPriceMult);
-
- //Calculate cost to upgrade size by 15 employees
- var mult = 0;
- for (var i = 0; i < 5; ++i) {
- mult += (Math.pow(1.07, initialPriceMult + i));
- }
- var upgradeCost15 = OfficeInitialCost * mult;
-
- //Calculate max upgrade size and cost
- var maxMult = (this.funds.dividedBy(OfficeInitialCost)).toNumber();
- var maxNum = 1;
- mult = Math.pow(1.07, initialPriceMult);
- while(maxNum < 50) { //Hard cap of 50x (extra 150 employees)
- if (mult >= maxMult) {break;}
- var multIncrease = Math.pow(1.07, initialPriceMult + maxNum);
- if (mult + multIncrease > maxMult) {
- break;
- } else {
- mult += multIncrease;
- }
- ++maxNum;
- }
-
- var upgradeCostMax = OfficeInitialCost * mult;
-
- var text = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
- innerText:"Increase the size of your office space to fit additional employees!"
- });
- var text2 = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {innerText: "Upgrade size: "});
-
- var confirmBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- class: this.funds.lt(upgradeCost) ? "a-link-button-inactive" : "a-link-button",
- display:"inline-block", margin:"4px", innerText:"by 3",
- tooltip:_utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(upgradeCost).format("$0.000a"),
- clickListener:()=>{
- if (this.funds.lt(upgradeCost)) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("You don't have enough company funds to purchase this upgrade!");
- } else {
- office.size += OfficeInitialSize;
- this.funds = this.funds.minus(upgradeCost);
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Office space increased! It can now hold " + office.size + " employees");
- this.updateUIContent();
- }
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
- return false;
- }
- });
- var confirmBtn15 = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- class: this.funds.lt(upgradeCost15) ? "a-link-button-inactive" : "a-link-button",
- display:"inline-block", margin:"4px", innerText:"by 15",
- tooltip:_utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(upgradeCost15).format("$0.000a"),
- clickListener:()=>{
- if (this.funds.lt(upgradeCost15)) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("You don't have enough company funds to purchase this upgrade!");
- } else {
- office.size += (OfficeInitialSize * 5);
- this.funds = this.funds.minus(upgradeCost15);
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Office space increased! It can now hold " + office.size + " employees");
- this.updateUIContent();
- }
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
- return false;
- }
- });
- var confirmBtnMax = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- class:this.funds.lt(upgradeCostMax) ? "a-link-button-inactive" : "a-link-button",
- display:"inline-block", margin:"4px", innerText:"by MAX (" + maxNum*OfficeInitialSize + ")",
- tooltip:_utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(upgradeCostMax).format("$0.000a"),
- clickListener:()=>{
- if (this.funds.lt(upgradeCostMax)) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("You don't have enough company funds to purchase this upgrade!");
- } else {
- office.size += (OfficeInitialSize * maxNum);
- this.funds = this.funds.minus(upgradeCostMax);
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Office space increased! It can now hold " + office.size + " employees");
- this.updateUIContent();
- }
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
- return false;
- }
- });
- var cancelBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- class:"a-link-button", innerText:"Cancel", display:"inline-block", margin:"4px",
- clickListener:()=>{
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
- return false;
- }
- })
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createPopup"])(popupId, [text, text2, confirmBtn, confirmBtn15, confirmBtnMax, cancelBtn]);
- return false;
- }
- });
- industryEmployeePanel.appendChild(industryOfficeUpgradeSizeButton);
-
- //Throw Office Party
- industryEmployeePanel.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- class:"a-link-button", display:"inline-block", innerText:"Throw Party",
- fontSize:"13px",
- tooltip:"Throw an office party to increase your employee's morale and happiness",
- clickListener:()=>{
- var popupId = "cmpy-mgmt-throw-office-party-popup";
- var txt = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
- innerText:"Enter the amount of money you would like to spend PER EMPLOYEE " +
- "on this office party"
- });
- var totalCostTxt = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
- innerText:"Throwing this party will cost a total of $0"
- });
- var confirmBtn;
- var input = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("input", {
- type:"number", margin:"5px", placeholder:"$ / employee",
- inputListener:()=>{
- if (isNaN(input.value) || input.value < 0) {
- totalCostTxt.innerText = "Invalid value entered!"
- } else {
- var totalCost = input.value * office.employees.length;
- totalCostTxt.innerText = "Throwing this party will cost a total of " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(totalCost).format('$0.000a');
- }
- },
- onkeyup:(e)=>{
- e.preventDefault();
- if (e.keyCode === 13) {confirmBtn.click();}
- }
- });
- confirmBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- class:"a-link-button",
- display:"inline-block",
- innerText:"Throw Party",
- clickListener:()=>{
- if (isNaN(input.value) || input.value < 0) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Invalid value entered");
- } else {
- var totalCost = input.value * office.employees.length;
- if (this.funds.lt(totalCost)) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("You don't have enough company funds to throw this party!");
- } else {
- this.funds = this.funds.minus(totalCost);
- var mult;
- for (var fooit = 0; fooit < office.employees.length; ++fooit) {
- mult = office.employees[fooit].throwParty(input.value);
- }
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("You threw a party for the office! The morale and happiness " +
- "of each employee increased by " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])((mult-1) * 100, 2) + "%.");
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
- }
- }
- return false;
- }
- });
- var cancelBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- class:"a-link-button",
- display:"inline-block",
- innerText:"Cancel",
- clickListener:()=>{
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
- return false;
- }
- });
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createPopup"])(popupId, [txt, totalCostTxt, input, confirmBtn, cancelBtn]);
- }
- }));
-
- industryEmployeeManagementUI = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {});
- industryEmployeeInfo = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {margin:"4px", padding:"4px"});
- if (empManualAssignmentModeActive) {
- //Employees manually assigned
- industryEmployeeManagementUI.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- class:"a-link-button", display:"inline-block", margin:"4px",
- innerText:"Switch to Auto Mode",
- tooltip:"Switch to Automatic Assignment Mode, which will automatically " +
- "assign employees to your selected jobs. You simply have to select " +
- "the number of assignments for each job",
- clickListener:()=>{
- empManualAssignmentModeActive = false;
- this.displayDivisionContent(division, city);
- }
- }));
- industryEmployeeManagementUI.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("br", {}));
-
- industryIndividualEmployeeInfo = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {margin:"4px", padding:"4px"});
- var selector = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("select", {
- color: "white", backgroundColor:"black", margin:"4px", padding:"4px",
- changeListener:()=>{
- var name = selector.options[selector.selectedIndex].text;
- for (var i = 0; i < office.employees.length; ++i) {
- if (office.employees[i].name === name) {
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeChildrenFromElement"])(industryIndividualEmployeeInfo);
- office.employees[i].createUI(industryIndividualEmployeeInfo, this);
- return;
- }
- }
- console.log("ERROR: Employee in selector could not be found");
- }
- });
-
- for (var i = 0; i < office.employees.length; ++i) {
- selector.add(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("option", {text:office.employees[i].name}));
- }
-
- selector.selectedIndex = -1;
-
- industryEmployeeManagementUI.appendChild(industryEmployeeInfo);
- industryEmployeeManagementUI.appendChild(selector);
- industryEmployeeManagementUI.appendChild(industryIndividualEmployeeInfo);
- } else {
- //Player only manages the number of each occupation, not who gets what job
- industryEmployeeManagementUI.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- class:"a-link-button", display:"inline-block", margin:"4px",
- innerText:"Switch to Manual Mode",
- tooltip:"Switch to Manual Assignment Mode, which allows you to " +
- "specify which employees should get which jobs",
- clickListener:()=>{
- empManualAssignmentModeActive = true;
- this.displayDivisionContent(division, city);
- }
- }));
- industryEmployeeManagementUI.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("br", {}));
-
- var opCount = 0, engCount = 0, busCount = 0,
- mgmtCount = 0, rndCount = 0, unassignedCount = 0,
- trainingCount = 0;
- for (var i = 0; i < office.employees.length; ++i) {
- switch (office.employees[i].pos) {
- case EmployeePositions.Operations:
- ++opCount; break;
- case EmployeePositions.Engineer:
- ++engCount; break;
- case EmployeePositions.Business:
- ++busCount; break;
- case EmployeePositions.Management:
- ++mgmtCount; break;
- case EmployeePositions.RandD:
- ++rndCount; break;
- case EmployeePositions.Unassigned:
- ++unassignedCount; break;
- case EmployeePositions.Training:
- ++trainingCount; break;
- default:
- console.log("ERROR: Unrecognized employee position: " + office.employees[i].pos);
- break;
- }
- }
-
- //Unassigned employee count display
- industryEmployeeManagementUI.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
- display:"inline-block",
- innerText:"Unassigned Employees: " + unassignedCount,
- }));
- industryEmployeeManagementUI.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("br", {}));
-
- //General display of employee information (avg morale, avg energy, etc.)
- industryEmployeeManagementUI.appendChild(industryEmployeeInfo);
- industryEmployeeManagementUI.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("br", {}));
-
- var positions = [EmployeePositions.Operations, EmployeePositions.Engineer,
- EmployeePositions.Business, EmployeePositions.Management,
- EmployeePositions.RandD, EmployeePositions.Training];
- var descriptions = ["Manages supply chain operations. Improves production.", //Operations
- "Develops and maintains products and production systems. Improves production.", //Engineer
- "Handles sales and finances. Improves sales.", //Business
- "Leads and oversees employees and office operations. Improves production.", //Management
- "Research new innovative ways to improve the company. Generates Scientific Research", //RandD
- "Set employee to training, which will increase some of their stats. Employees in training do not affect any company operations."] //Training
- var counts = [opCount, engCount, busCount, mgmtCount, rndCount, trainingCount];
- for (var i = 0; i < positions.length; ++i) {
- (function(corp, i) {
- var info = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("h2", {
- display:"inline-block", width:"40%", fontSize:"15px",
- innerText: positions[i] + "(" + counts[i] + ")",
- tooltipleft: descriptions[i]
- });
- var plusBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- class: unassignedCount > 0 ? "a-link-button" : "a-link-button-inactive",
- display:"inline-block", innerText:"+",
- clickListener:()=>{
- office.assignEmployeeToJob(positions[i]);
- corp.displayDivisionContent(division, city);
- }
- });
- var minusBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- class: counts[i] > 0 ? "a-link-button" : "a-link-button-inactive",
- display:"inline-block", innerText:"-",
- clickListener:()=>{
- office.unassignEmployeeFromJob(positions[i]);
- corp.displayDivisionContent(division, city);
- }
- });
- var newline = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("br", {});
- industryEmployeeManagementUI.appendChild(info);
- industryEmployeeManagementUI.appendChild(plusBtn);
- industryEmployeeManagementUI.appendChild(minusBtn);
- industryEmployeeManagementUI.appendChild(newline);
- })(this, i);
- }
- }
- industryEmployeePanel.appendChild(industryEmployeeManagementUI);
-
- //Warehouse Panel
- var warehouse = division.warehouses[currentCityUi];
- if (warehouse instanceof Warehouse) {
- warehouse.createUI({industry:division, company: this});
- } else {
- industryWarehousePanel.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
- innerText:"Purchase Warehouse ($5b)",
- class: "a-link-button",
- clickListener:()=>{
- if (this.funds.lt(WarehouseInitialCost)) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("You do not have enough funds to do this!");
- } else {
- division.warehouses[currentCityUi] = new Warehouse({
- loc:currentCityUi,
- size:WarehouseInitialSize,
- });
- this.funds = this.funds.minus(WarehouseInitialCost);
- this.displayDivisionContent(division, currentCityUi);
- }
- return false;
- }
- }));
- }
- this.updateDivisionContent(division);
-}
-
-Corporation.prototype.updateDivisionContent = function(division) {
- if (!(division instanceof Industry)) {
- console.log("ERROR: Invalid 'division' argument in Corporation.updateDivisionContent");
- return;
- }
- var vechain = (this.unlockUpgrades[4] === 1);
- //Industry Overview Text
- var profit = division.lastCycleRevenue.minus(division.lastCycleExpenses).toNumber(),
- profitStr = profit >= 0 ? _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(profit).format("$0.000a") : "-" + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(-1 * profit).format("$0.000a");
- var advertisingInfo = "";
- if (vechain) {
- var advertisingFactors = division.getAdvertisingFactors();
- var awarenessFac = advertisingFactors[1];
- var popularityFac = advertisingFactors[2];
- var ratioFac = advertisingFactors[3];
- var totalAdvertisingFac = advertisingFactors[0];
- advertisingInfo =
- "
" +
- "Awareness Bonus: x" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(Math.pow(awarenessFac, 0.85), 3) + "
" +
- "Popularity Bonus: x" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(Math.pow(popularityFac, 0.85), 3) + "
" +
- "Ratio Multiplier: x" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(Math.pow(ratioFac, 0.85), 3) + "
"
-
- }
-
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeChildrenFromElement"])(industryOverviewText);
- industryOverviewText.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
- innerHTML:"Industry: " + division.type + " (Corp Funds: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(this.funds.toNumber()).format("$0.000a") + ")
" +
- "Awareness: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(division.awareness, 3) + "
" +
- "Popularity: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(division.popularity, 3) + "
" +
- advertisingInfo + "
" +
- "Revenue: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(division.lastCycleRevenue.toNumber()).format("$0.000a") + " / s
" +
- "Expenses: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(division.lastCycleExpenses.toNumber()).format("$0.000a") + " /s
" +
- "Profit: " + profitStr + " / s
"
- }));
- industryOverviewText.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
- marginTop:"2px",
- innerText:"Production Multiplier: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(division.prodMult, 2),
- tooltip:"Production gain from owning production-boosting materials " +
- "such as hardware, Robots, AI Cores, and Real Estate"
- }));
- industryOverviewText.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {
- innerText:"?", class:"help-tip",
- clickListener:()=>{
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Owning Hardware, Robots, AI Cores, and Real Estate " +
- "can boost your Industry's production. The effect these " +
- "materials have on your production varies between Industries. " +
- "For example, Real Estate may be very effective for some Industries, " +
- "but ineffective for others.
" +
- "This division's production multiplier is calculated by summing " +
- "the individual production multiplier of each of its office locations. " +
- "This production multiplier is applied to each office. Therefore, it is " +
- "beneficial to expand into new cities as this can greatly increase the " +
- "production multiplier of your entire Division.");
- }
- }));
- industryOverviewText.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("br"));
- industryOverviewText.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
- display:"inline-block",
- innerText:"Scientific Research: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(division.sciResearch.qty, 3),
- tooltip:"Scientific Research increases the quality of the materials and " +
- "products that you produce."
- }));
-
- //Office and Employee List
- var office = division.offices[currentCityUi];
- industryEmployeeText.innerHTML =
- "Office Space
" +
- "Type: " + office.tier + "
" +
- "Comfort: " + office.comf + "
" +
- "Beauty: " + office.beau + "
" +
- "Size: " + office.employees.length + " / " + office.size + " employees";
- if (office.employees.length >= office.size) {
- industryEmployeeHireButton.className = "a-link-button-inactive";
- industryEmployeeAutohireButton.className = "a-link-button-inactive tooltip";
- } else if (office.employees.length === 0) {
- industryEmployeeHireButton.className = "a-link-button tooltip flashing-button";
- industryEmployeeAutohireButton.className = "a-link-button tooltip";
- } else {
- industryEmployeeHireButton.className = "a-link-button";
- industryEmployeeAutohireButton.className = "a-link-button tooltip";
- }
-
- //Employee Overview stats
- //Calculate average morale, happiness, and energy
- var totalMorale = 0, totalHappiness = 0, totalEnergy = 0,
- avgMorale = 0, avgHappiness = 0, avgEnergy = 0;
- for (var i = 0; i < office.employees.length; ++i) {
- totalMorale += office.employees[i].mor;
- totalHappiness += office.employees[i].hap;
- totalEnergy += office.employees[i].ene;
- }
- if (office.employees.length > 0) {
- avgMorale = totalMorale / office.employees.length;
- avgHappiness = totalHappiness / office.employees.length;
- avgEnergy = totalEnergy / office.employees.length;
- }
- industryEmployeeInfo.innerHTML =
- "Avg Employee Morale: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(avgMorale, 3) + "
" +
- "Avg Employee Happiness: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(avgHappiness, 3) + "
" +
- "Avg Employee Energy: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(avgEnergy, 3);
- if (vechain) { //VeChain - Statistics
- industryEmployeeInfo.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("br", {}));
- industryEmployeeInfo.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
- innerText:"Material Production: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(division.getOfficeProductivity(office), 3),
- tooltip: "The base amount of material this office can produce. Does not include " +
- "production multipliers from upgrades and materials. This value is based off " +
- "the productivity of your Operations, Engineering, and Management employees"
- }));
- industryEmployeeInfo.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("br", {}));
- industryEmployeeInfo.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
- innerText:"Product Production: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(division.getOfficeProductivity(office, {forProduct:true}), 3),
- tooltip: "The base amount of any given Product this office can produce. Does not include " +
- "production multipliers from upgrades and materials. This value is based off " +
- "the productivity of your Operations, Engineering, and Management employees"
- }));
- industryEmployeeInfo.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("br", {}));
- industryEmployeeInfo.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
- innerText: "Business Multiplier: x" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(division.getBusinessFactor(office), 3),
- tooltip: "The effect this office's 'Business' employees has on boosting sales"
- }));
- }
-
- //Warehouse
- var warehouse = division.warehouses[currentCityUi];
- if (warehouse instanceof Warehouse) {
- warehouse.updateUI({industry:division, company:this});
- }
-}
-
-Corporation.prototype.createCityUITab = function(city, division) {
- var tab = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("button", {
- id:"cmpy-mgmt-city-" + city + "-tab",
- class:"cmpy-mgmt-city-tab",
- innerText:city,
- clickListener:()=>{
- this.selectCityTab(tab, city);
- this.displayDivisionContent(division, city);
- return false;
- }
- });
- companyManagementPanel.appendChild(tab);
-}
-
-Corporation.prototype.selectCityTab = function(activeTab, city) {
- if (activeTab == null) {
- activeTab = document.getElementById("cmpy-mgmt-city-" + city + "-tab");
- if (activeTab == null) {return;}
- }
- for (var i = 0; i < cityTabs.length; ++i) {
- cityTabs[i].className = "cmpy-mgmt-city-tab";
- }
- activeTab.className = "cmpy-mgmt-city-tab current";
-}
-
-Corporation.prototype.clearUI = function() {
- //Delete everything
- if (companyManagementDiv != null) {Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(companyManagementDiv.id);}
-
- //Reset global DOM variables
- companyManagementDiv = null;
- companyManagementPanel = null;
- currentCityUi = null;
-
- corporationUnlockUpgrades = null;
- corporationUpgrades = null;
-
- industryOverviewPanel = null;
- industryOverviewText = null;
-
- industryEmployeePanel = null;
- industryEmployeeText = null;
- industryEmployeeHireButton = null;
- industryEmployeeAutohireButton = null;
- industryEmployeeManagementUI = null;
- industryEmployeeInfo = null;
- industryIndividualEmployeeInfo = null;
-
- industryOfficeUpgradeSizeButton = null;
-
- industryWarehousePanel = null;
- industrySmartSupplyCheckbox = null;
- industryWarehouseStorageText = null;
- industryWarehouseUpgradeSizeButton = null;
- industryWarehouseStateText = null;
- industryWarehouseMaterials = null;
- industryWarehouseProducts = null;
-
- companyManagementHeaderTabs = null;
- headerTabs = null;
- cityTabs = null;
-
- document.getElementById("character-overview-wrapper").style.visibility = "visible";
-}
-
-Corporation.prototype.toJSON = function() {
- return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Generic_toJSON"])("Corporation", this);
-}
-
-Corporation.fromJSON = function(value) {
- return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Generic_fromJSON"])(Corporation, value.data);
-}
-
-_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Reviver"].constructors.Corporation = Corporation;
-
-
-
-
-/***/ }),
-/* 41 */
/*!********************************************!*\
!*** ./node_modules/jquery/dist/jquery.js ***!
\********************************************/
@@ -54088,27 +48653,34 @@ return jQuery;
/***/ }),
-/* 42 */
-/*!********************************!*\
- !*** ./src/ActiveScriptsUI.js ***!
- \********************************/
+/* 39 */
+/*!****************************!*\
+ !*** ./src/HacknetNode.js ***!
+ \****************************/
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setActiveScriptsClickHandlers", function() { return setActiveScriptsClickHandlers; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addActiveScriptsItem", function() { return addActiveScriptsItem; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "deleteActiveScriptsItem", function() { return deleteActiveScriptsItem; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateActiveScriptsItems", function() { return updateActiveScriptsItems; });
-/* harmony import */ var _NetscriptWorker_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./NetscriptWorker.js */ 21);
-/* harmony import */ var _Player_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Player.js */ 0);
-/* harmony import */ var _Server_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Server.js */ 10);
-/* harmony import */ var _utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils/DialogBox.js */ 6);
-/* harmony import */ var _utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils/HelperFunctions.js */ 1);
-/* harmony import */ var _utils_LogBox_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils/LogBox.js */ 50);
-/* harmony import */ var _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../utils/numeral.min.js */ 12);
-/* harmony import */ var _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_6__);
-/* harmony import */ var _utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../utils/StringHelperFunctions.js */ 2);
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hacknetNodesInit", function() { return hacknetNodesInit; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HacknetNode", function() { return HacknetNode; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "purchaseHacknet", function() { return purchaseHacknet; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateTotalHacknetProduction", function() { return updateTotalHacknetProduction; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCostOfNextHacknetNode", function() { return getCostOfNextHacknetNode; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateHacknetNodesMultiplierButtons", function() { return updateHacknetNodesMultiplierButtons; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMaxNumberLevelUpgrades", function() { return getMaxNumberLevelUpgrades; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "displayHacknetNodesContent", function() { return displayHacknetNodesContent; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateHacknetNodesContent", function() { return updateHacknetNodesContent; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "processAllHacknetNodeEarnings", function() { return processAllHacknetNodeEarnings; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getHacknetNode", function() { return getHacknetNode; });
+/* harmony import */ var _BitNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BitNode.js */ 15);
+/* harmony import */ var _Constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Constants.js */ 3);
+/* harmony import */ var _engine_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./engine.js */ 5);
+/* harmony import */ var _InteractiveTutorial_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./InteractiveTutorial.js */ 25);
+/* harmony import */ var _Player_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Player.js */ 0);
+/* harmony import */ var _utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils/DialogBox.js */ 6);
+/* harmony import */ var _utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../utils/HelperFunctions.js */ 1);
+/* harmony import */ var _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../utils/JSONReviver.js */ 8);
+/* harmony import */ var _utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../utils/StringHelperFunctions.js */ 2);
@@ -54119,343 +48691,5546 @@ __webpack_require__.r(__webpack_exports__);
-/* Active Scripts UI*/
-function setActiveScriptsClickHandlers() {
- //Server panel click handlers
- var serverPanels = document.getElementsByClassName("active-scripts-server-header");
- if (serverPanels == null) {
- console.log("ERROR: Could not find Active Scripts server panels");
- return;
+/* HacknetNode.js */
+function hacknetNodesInit() {
+ var mult1x = document.getElementById("hacknet-nodes-1x-multiplier");
+ mult1x.addEventListener("click", function() {
+ hacknetNodePurchaseMultiplier = 1;
+ updateHacknetNodesMultiplierButtons();
+ updateHacknetNodesContent();
+ return false;
+ });
+ var mult5x = document.getElementById("hacknet-nodes-5x-multiplier");
+ mult5x.addEventListener("click", function() {
+ hacknetNodePurchaseMultiplier = 5;
+ updateHacknetNodesMultiplierButtons();
+ updateHacknetNodesContent();
+ return false;
+ });
+ var mult10x = document.getElementById("hacknet-nodes-10x-multiplier");
+ mult10x.addEventListener("click", function() {
+ hacknetNodePurchaseMultiplier = 10;
+ updateHacknetNodesMultiplierButtons();
+ updateHacknetNodesContent();
+ return false;
+ });
+ var multMax = document.getElementById("hacknet-nodes-max-multiplier");
+ multMax.addEventListener("click", function() {
+ hacknetNodePurchaseMultiplier = 0;
+ updateHacknetNodesMultiplierButtons();
+ updateHacknetNodesContent();
+ return false;
+ });
+}
+document.addEventListener("DOMContentLoaded", hacknetNodesInit, false);
+
+function HacknetNode(name) {
+ this.level = 1;
+ this.ram = 1; //GB
+ this.cores = 1;
+
+ this.name = name;
+
+ this.totalMoneyGenerated = 0;
+ this.onlineTimeSeconds = 0;
+
+ this.moneyGainRatePerSecond = 0;
+}
+
+HacknetNode.prototype.updateMoneyGainRate = function() {
+ //How much extra $/s is gained per level
+ var gainPerLevel = _Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].HacknetNodeMoneyGainPerLevel;
+
+ this.moneyGainRatePerSecond = (this.level * gainPerLevel) *
+ Math.pow(1.035, this.ram-1) *
+ ((this.cores + 5) / 6) *
+ _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].hacknet_node_money_mult *
+ _BitNode_js__WEBPACK_IMPORTED_MODULE_0__["BitNodeMultipliers"].HacknetNodeMoney;
+ if (isNaN(this.moneyGainRatePerSecond)) {
+ this.moneyGainRatePerSecond = 0;
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_5__["dialogBoxCreate"])("Error in calculating Hacknet Node production. Please report to game developer");
}
- for (i = 0; i < serverPanels.length; ++i) {
- serverPanels[i].onclick = function() {
- this.classList.toggle("active");
- var panel = this.nextElementSibling;
- if (panel.style.display === "block") {
- panel.style.display = "none";
- } else {
- panel.style.display = "block";
- }
+ updateTotalHacknetProduction();
+}
+
+HacknetNode.prototype.calculateLevelUpgradeCost = function(levels=1) {
+ levels = Math.round(levels);
+ if (isNaN(levels) || levels < 1) {return 0;}
+ var mult = _Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].HacknetNodeUpgradeLevelMult;
+ var totalMultiplier = 0; //Summed
+ var currLevel = this.level;
+ for (var i = 0; i < levels; ++i) {
+ totalMultiplier += Math.pow(mult, currLevel);
+ ++currLevel;
+ }
+ return _Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].BaseCostForHacknetNode / 2 * totalMultiplier * _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].hacknet_node_level_cost_mult;
+}
+
+//Wrapper function for Netscript
+HacknetNode.prototype.getLevelUpgradeCost = function(levels=1) {
+ return this.calculateLevelUpgradeCost(levels);
+}
+
+HacknetNode.prototype.purchaseLevelUpgrade = function(levels=1) {
+ levels = Math.round(levels);
+ var cost = this.calculateLevelUpgradeCost(levels);
+ if (isNaN(cost) || levels < 0) {return false;}
+ if (this.level + levels > _Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].HacknetNodeMaxLevel) {
+ var diff = Math.max(0, _Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].HacknetNodeMaxLevel - this.level);
+ return this.purchaseLevelUpgrade(diff);
+ }
+ if (_Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].money.lt(cost)) {return false;}
+ _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].loseMoney(cost);
+ this.level += levels;
+ this.updateMoneyGainRate();
+ return true;
+}
+
+//Wrapper function for Netscript
+HacknetNode.prototype.upgradeLevel = function(levels=1) {
+ return this.purchaseLevelUpgrade(levels);
+}
+
+HacknetNode.prototype.calculateRamUpgradeCost = function() {
+ var numUpgrades = Math.log2(this.ram);
+
+ //Calculate cost
+ //Base cost of RAM is 50k per 1GB, increased by some multiplier for each time RAM is upgraded
+ var baseCost = this.ram * _Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].BaseCostFor1GBOfRamHacknetNode;
+ var mult = Math.pow(_Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].HacknetNodeUpgradeRamMult, numUpgrades);
+ return baseCost * mult * _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].hacknet_node_ram_cost_mult;
+}
+
+//Wrapper function for Netscript
+HacknetNode.prototype.getRamUpgradeCost = function() {
+ return this.calculateRamUpgradeCost();
+}
+
+HacknetNode.prototype.purchaseRamUpgrade = function() {
+ var cost = this.calculateRamUpgradeCost();
+ if (isNaN(cost)) {return false;}
+ if (_Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].money.lt(cost)) {return false;}
+ if (this.ram >= _Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].HacknetNodeMaxRam) {return false;}
+ _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].loseMoney(cost);
+ this.ram *= 2; //Ram is always doubled
+ this.updateMoneyGainRate();
+ return true;
+}
+
+//Wrapper function for Netscript
+HacknetNode.prototype.upgradeRam = function() {
+ return this.purchaseRamUpgrade();
+}
+
+HacknetNode.prototype.calculateCoreUpgradeCost = function() {
+ var coreBaseCost = _Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].BaseCostForHacknetNodeCore;
+ var mult = _Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].HacknetNodeUpgradeCoreMult;
+ return coreBaseCost * Math.pow(mult, this.cores-1) * _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].hacknet_node_core_cost_mult;
+}
+
+//Wrapper function for Netscript
+HacknetNode.prototype.getCoreUpgradeCost = function() {
+ return this.calculateCoreUpgradeCost();
+}
+
+HacknetNode.prototype.purchaseCoreUpgrade = function() {
+ var cost = this.calculateCoreUpgradeCost();
+ if (isNaN(cost)) {return false;}
+ if (_Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].money.lt(cost)) {return false;}
+ if (this.cores >= _Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].HacknetNodeMaxCores) {return false;}
+ _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].loseMoney(cost);
+ ++this.cores;
+ this.updateMoneyGainRate();
+ return true;
+}
+
+//Wrapper function for Netscript
+HacknetNode.prototype.upgradeCore = function() {
+ return this.purchaseCoreUpgrade();
+}
+
+/* Saving and loading HackNets */
+HacknetNode.prototype.toJSON = function() {
+ return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_7__["Generic_toJSON"])("HacknetNode", this);
+}
+
+HacknetNode.fromJSON = function(value) {
+ return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_7__["Generic_fromJSON"])(HacknetNode, value.data);
+}
+
+_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_7__["Reviver"].constructors.HacknetNode = HacknetNode;
+
+
+function purchaseHacknet() {
+ /* INTERACTIVE TUTORIAL */
+ if (_InteractiveTutorial_js__WEBPACK_IMPORTED_MODULE_3__["iTutorialIsRunning"]) {
+ if (_InteractiveTutorial_js__WEBPACK_IMPORTED_MODULE_3__["currITutorialStep"] == _InteractiveTutorial_js__WEBPACK_IMPORTED_MODULE_3__["iTutorialSteps"].HacknetNodesIntroduction) {
+ Object(_InteractiveTutorial_js__WEBPACK_IMPORTED_MODULE_3__["iTutorialNextStep"])();
+ } else {
+ return;
}
}
- //Script Panel click handlers
- var scriptPanels = document.getElementsByClassName("active-scripts-script-header");
- if (scriptPanels == null) {
- console.log("ERROR: Could not find Active Scripts panels for individual scripts");
- return;
- }
- for (var i = 0; i < scriptPanels.length; ++i) {
- scriptPanels[i].onclick = function() {
- this.classList.toggle("active");
+ /* END INTERACTIVE TUTORIAL */
- var panel = this.nextElementSibling;
- if (panel.style.display === "block") {
- panel.style.display = "none";
- } else {
- panel.style.display = "block";
- }
- }
+ var cost = getCostOfNextHacknetNode();
+ if (isNaN(cost)) {throw new Error("Cost is NaN"); return;}
+ if (_Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].money.lt(cost)) {
+ //dialogBoxCreate("You cannot afford to purchase a Hacknet Node!");
+ return false;
}
+
+ //Auto generate a name for the node for now...TODO
+ var numOwned = _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].hacknetNodes.length;
+ var name = "hacknet-node-" + numOwned;
+ var node = new HacknetNode(name);
+ node.updateMoneyGainRate();
+
+ _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].loseMoney(cost);
+ _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].hacknetNodes.push(node);
+
+ displayHacknetNodesContent();
+ updateTotalHacknetProduction();
+ return numOwned;
}
-//Returns the ul element containins all script items for a specific server
-function getActiveScriptsServerList(server) {
- if (server == null) {return null;}
- var panelname = "active-scripts-server-panel-" + server.hostname;
- var item = document.getElementById(panelname + "-script-list");
- if (item == null) {
- console.log("ERROR: Cannot find list for: " + server.hostname);
- }
- return item;
-}
-
-function createActiveScriptsServerPanel(server) {
- var panelname = "active-scripts-server-panel-" + server.hostname;
- var activeScriptsList = document.getElementById("active-scripts-list");
-
- //Div of entire Panel
- var panelDiv = document.createElement("div");
- panelDiv.setAttribute("id", panelname);
-
- //Panel Header
- var panelHdr = document.createElement("button");
- panelHdr.setAttribute("class", "active-scripts-server-header")
- panelHdr.setAttribute("id", panelname + "-hdr");
- panelHdr.innerHTML = server.hostname;
-
- //Panel content
- var panelContentDiv = document.createElement("div");
- panelContentDiv.setAttribute("class", "active-scripts-server-panel");
- panelContentDiv.setAttribute("id", panelname + "-content");
-
- //List of scripts
- var panelScriptList = document.createElement("ul");
- panelScriptList.setAttribute("id", panelname + "-script-list");
-
- panelContentDiv.appendChild(panelScriptList);
- panelDiv.appendChild(panelHdr);
- panelDiv.appendChild(panelContentDiv);
- activeScriptsList.appendChild(panelDiv);
-
- setActiveScriptsClickHandlers() //Reset click handlers
-
- return panelDiv;
-}
-
-//Deletes the info for a particular server (Dropdown header + Panel with all info)
-//in the Active Scripts page if it exists
-function deleteActiveScriptsServerPanel(server) {
- var panelname = "active-scripts-server-panel-" + server.hostname;
- var panel = document.getElementById(panelname);
- if (panel == null) {
- console.log("No such panel exists: " + panelname);
- return;
- }
-
- //Remove the panel if it has no elements
- var scriptList = document.getElementById(panelname + "-script-list");
- if (scriptList.childNodes.length == 0) {
- panel.parentNode.removeChild(panel);
- }
-}
-
-function addActiveScriptsItem(workerscript) {
- //Get server panel
- var server = Object(_Server_js__WEBPACK_IMPORTED_MODULE_2__["getServer"])(workerscript.serverIp);
- if (server == null) {
- console.log("ERROR: Invalid server IP for workerscript.");
- return;
- }
- var panelname = "active-scripts-server-panel-" + server.hostname;
-
- var panel = document.getElementById(panelname);
- if (panel == null) {
- panel = createActiveScriptsServerPanel(server);
- }
-
- //Create the element itself. Each element is an accordion collapsible
- var itemNameArray = ["active", "scripts", server.hostname, workerscript.name];
- for (var i = 0; i < workerscript.args.length; ++i) {
- itemNameArray.push(String(workerscript.args[i]));
- }
- var itemName = itemNameArray.join("-");
- var item = document.createElement("li");
- item.setAttribute("id", itemName);
-
- var btn = document.createElement("button");
- btn.setAttribute("class", "active-scripts-script-header");
- btn.innerHTML = workerscript.name;
-
- var itemContentDiv = document.createElement("div");
- itemContentDiv.setAttribute("class", "active-scripts-script-panel");
- itemContentDiv.setAttribute("id", itemName + "-content");
-
- item.appendChild(btn);
- item.appendChild(itemContentDiv);
-
- createActiveScriptsText(workerscript, itemContentDiv);
-
- //Append element to list
- var list = getActiveScriptsServerList(server);
- list.appendChild(item);
-
- setActiveScriptsClickHandlers() //Reset click handlers
-}
-
-function deleteActiveScriptsItem(workerscript) {
- var server = Object(_Server_js__WEBPACK_IMPORTED_MODULE_2__["getServer"])(workerscript.serverIp);
- if (server == null) {
- console.log("ERROR: Invalid server IP for workerscript.");
- return;
- }
- var itemNameArray = ["active", "scripts", server.hostname, workerscript.name];
- for (var i = 0; i < workerscript.args.length; ++i) {
- itemNameArray.push(String(workerscript.args[i]));
- }
- var itemName = itemNameArray.join("-");
- var li = document.getElementById(itemName);
- if (li == null) {
- console.log("could not find Active scripts li element for: " + workerscript.name);
- return;
- }
- li.parentNode.removeChild(li);
- deleteActiveScriptsServerPanel(server);
-}
-
-//Update the ActiveScriptsItems array
-function updateActiveScriptsItems() {
+//Calculates the total production from all HacknetNodes
+function updateTotalHacknetProduction() {
var total = 0;
- for (var i = 0; i < _NetscriptWorker_js__WEBPACK_IMPORTED_MODULE_0__["workerScripts"].length; ++i) {
- total += updateActiveScriptsItemContent(_NetscriptWorker_js__WEBPACK_IMPORTED_MODULE_0__["workerScripts"][i]);
+ for (var i = 0; i < _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].hacknetNodes.length; ++i) {
+ total += _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].hacknetNodes[i].moneyGainRatePerSecond;
+ }
+ _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].totalHacknetNodeProduction = total;
+}
+
+function getCostOfNextHacknetNode() {
+ //Cost increases exponentially based on how many you own
+ var numOwned = _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].hacknetNodes.length;
+ var mult = _Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].HacknetNodePurchaseNextMult;
+ return _Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].BaseCostForHacknetNode * Math.pow(mult, numOwned) * _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].hacknet_node_purchase_cost_mult;
+}
+
+var hacknetNodePurchaseMultiplier = 1;
+function updateHacknetNodesMultiplierButtons() {
+ var mult1x = document.getElementById("hacknet-nodes-1x-multiplier");
+ var mult5x = document.getElementById("hacknet-nodes-5x-multiplier");
+ var mult10x = document.getElementById("hacknet-nodes-10x-multiplier");
+ var multMax = document.getElementById("hacknet-nodes-max-multiplier");
+ mult1x.setAttribute("class", "a-link-button");
+ mult5x.setAttribute("class", "a-link-button");
+ mult10x.setAttribute("class", "a-link-button");
+ multMax.setAttribute("class", "a-link-button");
+ if (_Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].hacknetNodes.length == 0) {
+ mult1x.setAttribute("class", "a-link-button-inactive");
+ mult5x.setAttribute("class", "a-link-button-inactive");
+ mult10x.setAttribute("class", "a-link-button-inactive");
+ multMax.setAttribute("class", "a-link-button-inactive");
+ } else if (hacknetNodePurchaseMultiplier == 1) {
+ mult1x.setAttribute("class", "a-link-button-inactive");
+ } else if (hacknetNodePurchaseMultiplier == 5) {
+ mult5x.setAttribute("class", "a-link-button-inactive");
+ } else if (hacknetNodePurchaseMultiplier == 10) {
+ mult10x.setAttribute("class", "a-link-button-inactive");
+ } else {
+ multMax.setAttribute("class", "a-link-button-inactive");
+ }
+}
+
+//Calculate the maximum number of times the Player can afford to upgrade
+//a Hacknet Node's level"
+function getMaxNumberLevelUpgrades(nodeObj) {
+ if (_Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].money.lt(nodeObj.calculateLevelUpgradeCost(1))) {return 0;}
+ var min = 1;
+ var max = _Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].HacknetNodeMaxLevel-1;
+ var levelsToMax = _Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].HacknetNodeMaxLevel - nodeObj.level;
+ if (_Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].money.gt(nodeObj.calculateLevelUpgradeCost(levelsToMax))) {
+ return levelsToMax;
+ }
+
+ while (min <= max) {
+ var curr = (min + max) / 2 | 0;
+ if (curr != _Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].HacknetNodeMaxLevel &&
+ _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].money.gt(nodeObj.calculateLevelUpgradeCost(curr)) &&
+ _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].money.lt(nodeObj.calculateLevelUpgradeCost(curr+1))) {
+ return Math.min(levelsToMax, curr);
+ } else if (_Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].money.lt(nodeObj.calculateLevelUpgradeCost(curr))) {
+ max = curr - 1;
+ } else if (_Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].money.gt(nodeObj.calculateLevelUpgradeCost(curr))) {
+ min = curr + 1;
+ } else {
+ return Math.min(levelsToMax, curr);
+ }
+ }
+}
+
+//Creates Hacknet Node DOM elements when the page is opened
+function displayHacknetNodesContent() {
+ //Update Hacknet Nodes button
+ var newPurchaseButton = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_6__["clearEventListeners"])("hacknet-nodes-purchase-button");
+
+ newPurchaseButton.addEventListener("click", function() {
+ purchaseHacknet();
+ return false;
+ });
+
+ //Handle Purchase multiplier buttons
+ updateHacknetNodesMultiplierButtons();
+
+ //Remove all old hacknet Node DOM elements
+ var hacknetNodesList = document.getElementById("hacknet-nodes-list");
+ while (hacknetNodesList.firstChild) {
+ hacknetNodesList.removeChild(hacknetNodesList.firstChild);
+ }
+
+ //Then re-create them
+ for (var i = 0; i < _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].hacknetNodes.length; ++i) {
+ createHacknetNodeDomElement(_Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].hacknetNodes[i]);
+ }
+ updateHacknetNodesContent();
+}
+
+//Update information on all Hacknet Node DOM elements
+function updateHacknetNodesContent() {
+ //Set purchase button to inactive if not enough money, and update its price display
+ var cost = getCostOfNextHacknetNode();
+ var purchaseButton = document.getElementById("hacknet-nodes-purchase-button");
+ purchaseButton.innerHTML = "Purchase Hacknet Node - $" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(cost, 2);
+ if (_Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].money.lt(cost)) {
+ purchaseButton.setAttribute("class", "a-link-button-inactive");
+ } else {
+ purchaseButton.setAttribute("class", "a-link-button");
+ }
+
+ //Update player's money
+ var moneyElem = document.getElementById("hacknet-nodes-money");
+ moneyElem.innerHTML = "Money: $" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(_Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].money.toNumber(), 2) + "
" +
+ "Total production from all Hacknet Nodes: $" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(_Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].totalHacknetNodeProduction, 2) + " / second";
+
+ //Update information in each owned hacknet node
+ for (var i = 0; i < _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].hacknetNodes.length; ++i) {
+ updateHacknetNodeDomElement(_Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].hacknetNodes[i]);
+ }
+}
+
+//Creates a single Hacknet Node DOM element
+function createHacknetNodeDomElement(nodeObj) {
+ var nodeName = nodeObj.name;
+
+ var listItem = document.createElement("li");
+ listItem.setAttribute("class", "hacknet-node");
+
+ var span = document.createElement("span");
+ span.style.display = "inline";
+
+ var buttonDiv = document.createElement("div");
+ buttonDiv.setAttribute("class", "hacknet-node-button-div");
+
+ //Text
+ var txt = document.createElement("p");
+ //txt.setAttribute("id", "hacknet-node-text-" + nodeName);
+ txt.id = "hacknet-node-text-" + nodeName;
+
+ //Upgrade buttons
+ var upgradeLevelButton = document.createElement("a");
+ var upgradeRamButton = document.createElement("a");
+ var upgradeCoreButton = document.createElement("a");
+
+ //upgradeLevelButton.setAttribute("id", "hacknet-node-upgrade-level-" + nodeName);
+ upgradeLevelButton.id = "hacknet-node-upgrade-level-" + nodeName;
+ upgradeLevelButton.setAttribute("class", "a-link-button-inactive");
+ upgradeLevelButton.addEventListener("click", function() {
+ var numUpgrades = hacknetNodePurchaseMultiplier;
+ if (hacknetNodePurchaseMultiplier == 0) {
+ numUpgrades = getMaxNumberLevelUpgrades(nodeObj);
+ }
+ nodeObj.purchaseLevelUpgrade(numUpgrades);
+ updateHacknetNodesContent();
+ return false;
+ });
+ //upgradeRamButton.setAttribute("id", "hacknet-node-upgrade-ram-" + nodeName);
+ upgradeRamButton.id = "hacknet-node-upgrade-ram-" + nodeName;
+ upgradeRamButton.setAttribute("class", "a-link-button-inactive");
+ upgradeRamButton.addEventListener("click", function() {
+ nodeObj.purchaseRamUpgrade();
+ updateHacknetNodesContent();
+ return false;
+ });
+ //upgradeCoreButton.setAttribute("id", "hacknet-node-upgrade-core-" + nodeName);
+ upgradeCoreButton.id = "hacknet-node-upgrade-core-" + nodeName;
+ upgradeCoreButton.setAttribute("class", "a-link-button-inactive");
+ upgradeCoreButton.addEventListener("click", function() {
+ nodeObj.purchaseCoreUpgrade();
+ updateHacknetNodesContent();
+ return false;
+ });
+
+ //Put all the components together in the li element
+ span.appendChild(txt);
+ buttonDiv.appendChild(upgradeLevelButton);
+ buttonDiv.appendChild(upgradeRamButton);
+ buttonDiv.appendChild(upgradeCoreButton);
+ span.appendChild(buttonDiv);
+ listItem.appendChild(span);
+
+ document.getElementById("hacknet-nodes-list").appendChild(listItem);
+
+ //Set the text and stuff inside the DOM element
+ updateHacknetNodeDomElement(nodeObj);
+}
+
+//Updates information on a single hacknet node DOM element
+function updateHacknetNodeDomElement(nodeObj) {
+ var nodeName = nodeObj.name;
+ var txt = document.getElementById("hacknet-node-text-" + nodeName);
+ if (txt == null) {throw new Error("Cannot find text element");}
+ txt.innerHTML = "Node name: " + nodeName + "
" +
+ "Production: $" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(nodeObj.totalMoneyGenerated, 2) +
+ " ($" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(nodeObj.moneyGainRatePerSecond, 2) + " / second)
" +
+ "Level: " + nodeObj.level + "
" +
+ "RAM: " + nodeObj.ram + "GB
" +
+ "Cores: " + nodeObj.cores;
+
+ //Upgrade level
+ var upgradeLevelButton = document.getElementById("hacknet-node-upgrade-level-" + nodeName);
+ if (upgradeLevelButton == null) {throw new Error("Cannot find upgrade level button element");}
+ if (nodeObj.level >= _Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].HacknetNodeMaxLevel) {
+ upgradeLevelButton.innerHTML = "MAX LEVEL";
+ upgradeLevelButton.setAttribute("class", "a-link-button-inactive");
+ } else {
+ var multiplier = 0;
+ if (hacknetNodePurchaseMultiplier == 0) {
+ //Max
+ multiplier = getMaxNumberLevelUpgrades(nodeObj);
+ } else {
+ var levelsToMax = _Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].HacknetNodeMaxLevel - nodeObj.level;
+ multiplier = Math.min(levelsToMax, hacknetNodePurchaseMultiplier);
+ }
+
+ var upgradeLevelCost = nodeObj.calculateLevelUpgradeCost(multiplier);
+ upgradeLevelButton.innerHTML = "Upgrade Hacknet Node Level x" + multiplier +
+ " - $" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(upgradeLevelCost, 2);
+ if (_Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].money.lt(upgradeLevelCost)) {
+ upgradeLevelButton.setAttribute("class", "a-link-button-inactive");
+ } else {
+ upgradeLevelButton.setAttribute("class", "a-link-button");
+ }
+ }
+
+ //Upgrade RAM
+ var upgradeRamButton = document.getElementById("hacknet-node-upgrade-ram-" + nodeName);
+ if (upgradeRamButton == null) {throw new Error("Cannot find upgrade ram button element");}
+ if (nodeObj.ram >= _Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].HacknetNodeMaxRam) {
+ upgradeRamButton.innerHTML = "MAX RAM";
+ upgradeRamButton.setAttribute("class", "a-link-button-inactive");
+ } else {
+ var upgradeRamCost = nodeObj.calculateRamUpgradeCost();
+ upgradeRamButton.innerHTML = "Upgrade Hacknet Node RAM - $" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(upgradeRamCost, 2);
+ if (_Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].money.lt(upgradeRamCost)) {
+ upgradeRamButton.setAttribute("class", "a-link-button-inactive");
+ } else {
+ upgradeRamButton.setAttribute("class", "a-link-button");
+ }
+ }
+
+ //Upgrade Cores
+ var upgradeCoreButton = document.getElementById("hacknet-node-upgrade-core-" + nodeName);
+ if (upgradeCoreButton == null) {throw new Error("Cannot find upgrade cores button element");}
+ if (nodeObj.cores >= _Constants_js__WEBPACK_IMPORTED_MODULE_1__["CONSTANTS"].HacknetNodeMaxCores) {
+ upgradeCoreButton.innerHTML = "MAX CORES";
+ upgradeCoreButton.setAttribute("class", "a-link-button-inactive");
+ } else {
+ var upgradeCoreCost = nodeObj.calculateCoreUpgradeCost();
+ upgradeCoreButton.innerHTML = "Purchase additional CPU Core - $" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["formatNumber"])(upgradeCoreCost, 2);
+ if (_Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].money.lt(upgradeCoreCost)) {
+ upgradeCoreButton.setAttribute("class", "a-link-button-inactive");
+ } else {
+ upgradeCoreButton.setAttribute("class", "a-link-button");
+ }
+ }
+}
+
+function processAllHacknetNodeEarnings(numCycles) {
+ var total = 0;
+ for (var i = 0; i < _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].hacknetNodes.length; ++i) {
+ total += processSingleHacknetNodeEarnings(numCycles, _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].hacknetNodes[i]);
}
- document.getElementById("active-scripts-total-prod").innerHTML =
- "Total online production of Active Scripts: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_6___default()(total).format('$0.000a') + " / sec
" +
- "Total online production since last Aug installation: " +
- _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_6___default()(_Player_js__WEBPACK_IMPORTED_MODULE_1__["Player"].scriptProdSinceLastAug).format('$0.000a') + " (" +
- _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_6___default()(_Player_js__WEBPACK_IMPORTED_MODULE_1__["Player"].scriptProdSinceLastAug / (_Player_js__WEBPACK_IMPORTED_MODULE_1__["Player"].playtimeSinceLastAug/1000)).format('$0.000a') + " / sec)";
return total;
}
-//Updates the content of the given item in the Active Scripts list
-function updateActiveScriptsItemContent(workerscript) {
- var server = Object(_Server_js__WEBPACK_IMPORTED_MODULE_2__["getServer"])(workerscript.serverIp);
- if (server == null) {
- console.log("ERROR: Invalid server IP for workerscript.");
- return;
+function processSingleHacknetNodeEarnings(numCycles, nodeObj) {
+ var cyclesPerSecond = 1000 / _engine_js__WEBPACK_IMPORTED_MODULE_2__["Engine"]._idleSpeed;
+ var earningPerCycle = nodeObj.moneyGainRatePerSecond / cyclesPerSecond;
+ if (isNaN(earningPerCycle)) {
+ console.log("ERROR: Hacknet Node Calculated earnings is NaN");
+ earningPerCycle = 0;
}
- var itemNameArray = ["active", "scripts", server.hostname, workerscript.name];
- for (var i = 0; i < workerscript.args.length; ++i) {
- itemNameArray.push(String(workerscript.args[i]));
- }
- var itemName = itemNameArray.join("-");
- var itemContent = document.getElementById(itemName + "-content")
-
- //Add the updated text back. Returns the total online production rate
- return updateActiveScriptsText(workerscript, itemContent);
+ var totalEarnings = numCycles * earningPerCycle;
+ nodeObj.totalMoneyGenerated += totalEarnings;
+ nodeObj.onlineTimeSeconds += (numCycles * (_engine_js__WEBPACK_IMPORTED_MODULE_2__["Engine"]._idleSpeed / 1000));
+ _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].gainMoney(totalEarnings);
+ return totalEarnings;
}
-function createActiveScriptsText(workerscript, item) {
- var itemTextHeader = document.createElement("p");
- var itemTextStats = document.createElement("p");
- var itemId = item.id;
- itemTextStats.setAttribute("id", itemId + "-stats");
-
- //Server ip/hostname
- var threads = "Threads: " + workerscript.scriptRef.threads;
- var args = "Args: " + Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_4__["printArray"])(workerscript.args);
-
- itemTextHeader.innerHTML = threads + "
" + args + "
";
-
- item.appendChild(itemTextHeader);
- item.appendChild(itemTextStats);
-
- var onlineMps = updateActiveScriptsText(workerscript, item, itemTextStats);
-
- var logButton = document.createElement("span");
- logButton.innerHTML = "Log";
- var killButton = document.createElement("span");
- killButton.innerHTML = "Kill script";
- logButton.setAttribute("class", "active-scripts-button");
- killButton.setAttribute("class", "active-scripts-button");
- logButton.addEventListener("click", function() {
- Object(_utils_LogBox_js__WEBPACK_IMPORTED_MODULE_5__["logBoxCreate"])(workerscript.scriptRef);
- return false;
- });
- killButton.addEventListener("click", function() {
- Object(_NetscriptWorker_js__WEBPACK_IMPORTED_MODULE_0__["killWorkerScript"])(workerscript.scriptRef, workerscript.scriptRef.scriptRef.server);
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_3__["dialogBoxCreate"])("Killing script, may take a few minutes to complete...");
- return false;
- });
- item.appendChild(logButton);
- item.appendChild(killButton);
-
- //Return total online production rate
- return onlineMps;
-}
-
-function updateActiveScriptsText(workerscript, item, statsEl=null) {
- var itemId = item.id
- var itemTextStats = document.getElementById(itemId + "-stats");
- if (itemTextStats == null || itemTextStats === undefined) {
- itemTextStats = statsEl;
- }
-
- //Updates statistics only
- //Online
- var onlineTotalMoneyMade = "Total online production: $" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_7__["formatNumber"])(workerscript.scriptRef.onlineMoneyMade, 2);
- var onlineTotalExpEarned = (Array(26).join(" ") + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_7__["formatNumber"])(workerscript.scriptRef.onlineExpGained, 2) + " hacking exp").replace( / /g, " ");
-
- var onlineMps = workerscript.scriptRef.onlineMoneyMade / workerscript.scriptRef.onlineRunningTime;
- var onlineMpsText = "Online production rate: $" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_7__["formatNumber"])(onlineMps, 2) + "/second";
- var onlineEps = workerscript.scriptRef.onlineExpGained / workerscript.scriptRef.onlineRunningTime;
- var onlineEpsText = (Array(25).join(" ") + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_7__["formatNumber"])(onlineEps, 4) + " hacking exp/second").replace( / /g, " ");
-
- //Offline
- var offlineTotalMoneyMade = "Total offline production: $" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_7__["formatNumber"])(workerscript.scriptRef.offlineMoneyMade, 2);
- var offlineTotalExpEarned = (Array(27).join(" ") + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_7__["formatNumber"])(workerscript.scriptRef.offlineExpGained, 2) + " hacking exp").replace( / /g, " ");
-
- var offlineMps = workerscript.scriptRef.offlineMoneyMade / workerscript.scriptRef.offlineRunningTime;
- var offlineMpsText = "Offline production rate: $" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_7__["formatNumber"])(offlineMps, 2) + "/second";
- var offlineEps = workerscript.scriptRef.offlineExpGained / workerscript.scriptRef.offlineRunningTime;
- var offlineEpsText = (Array(26).join(" ") + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_7__["formatNumber"])(offlineEps, 4) + " hacking exp/second").replace( / /g, " ");
-
- itemTextStats.innerHTML = onlineTotalMoneyMade + "
" + onlineTotalExpEarned + "
" +
- onlineMpsText + "
" + onlineEpsText + "
" + offlineTotalMoneyMade + "
" + offlineTotalExpEarned + "
" +
- offlineMpsText + "
" + offlineEpsText + "
";
- return onlineMps;
-}
-
-
-
-
-/***/ }),
-/* 43 */
-/*!******************************!*\
- !*** ./src/NetscriptPort.js ***!
- \******************************/
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NetscriptPort", function() { return NetscriptPort; });
-/* harmony import */ var _Settings_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Settings.js */ 24);
-
-
-function NetscriptPort() {
- this.data = [];
-}
-
-NetscriptPort.prototype.write = function(data) {
- this.data.push(data);
- if (this.data.length > _Settings_js__WEBPACK_IMPORTED_MODULE_0__["Settings"].MaxPortCapacity) {
- return this.data.shift();
+function getHacknetNode(name) {
+ for (var i = 0; i < _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].hacknetNodes.length; ++i) {
+ if (_Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].hacknetNodes[i].name == name) {
+ return _Player_js__WEBPACK_IMPORTED_MODULE_4__["Player"].hacknetNodes[i];
+ }
}
return null;
}
-NetscriptPort.prototype.tryWrite = function(data) {
- if (this.data.length >= _Settings_js__WEBPACK_IMPORTED_MODULE_0__["Settings"].MaxPortCapacity) {
- return false;
- }
- this.data.push(data);
- return true;
+
+
+
+/***/ }),
+/* 40 */
+/*!**********************************!*\
+ !*** ./src/CompanyManagement.js ***!
+ \**********************************/
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Corporation", function() { return Corporation; });
+/* harmony import */ var _BitNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BitNode.js */ 15);
+/* harmony import */ var _engine_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./engine.js */ 5);
+/* harmony import */ var _Faction_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Faction.js */ 11);
+/* harmony import */ var _Literature_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Literature.js */ 53);
+/* harmony import */ var _Location_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Location.js */ 4);
+/* harmony import */ var _Player_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Player.js */ 0);
+/* harmony import */ var _utils_decimal_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../utils/decimal.js */ 23);
+/* harmony import */ var _utils_decimal_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_utils_decimal_js__WEBPACK_IMPORTED_MODULE_6__);
+/* harmony import */ var _utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../utils/DialogBox.js */ 6);
+/* harmony import */ var _utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../utils/HelperFunctions.js */ 1);
+/* harmony import */ var _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../utils/JSONReviver.js */ 8);
+/* harmony import */ var _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../utils/numeral.min.js */ 13);
+/* harmony import */ var _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10__);
+/* harmony import */ var _utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../utils/StringHelperFunctions.js */ 2);
+/* harmony import */ var _utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../utils/YesNoBox.js */ 12);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/* State */
+var companyStates = ["START", "PURCHASE", "PRODUCTION", "SALE", "EXPORT"];
+function CorporationState() {
+ this.state = 0;
}
-NetscriptPort.prototype.read = function() {
- if (this.data.length === 0) {
- return "NULL PORT DATA";
+CorporationState.prototype.nextState = function() {
+ if (this.state < 0 || this.state >= companyStates.length) {
+ this.state = 0;
+ }
+
+ ++this.state;
+ if (this.state >= companyStates.length) {
+ this.state = 0;
}
- return this.data.shift();
}
-NetscriptPort.prototype.peek = function() {
- if (this.data.length === 0) {
- return "NULL PORT DATA";
+CorporationState.prototype.getState = function() {
+ return companyStates[this.state];
+}
+
+CorporationState.prototype.toJSON = function() {
+ return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Generic_toJSON"])("CorporationState", this);
+}
+
+CorporationState.fromJSON = function(value) {
+ return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Generic_fromJSON"])(CorporationState, value.data);
+}
+
+_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Reviver"].constructors.CorporationState = CorporationState;
+
+/* Constants */
+var TOTALSHARES = 1e9; //Total number of shares you have at your company
+var CyclesPerMarketCycle = 75;
+var CyclesPerIndustryStateCycle = CyclesPerMarketCycle / companyStates.length;
+var SecsPerMarketCycle = CyclesPerMarketCycle / 5;
+var Cities = ["Aevum", "Chongqing", "Sector-12", "New Tokyo", "Ishima", "Volhaven"];
+var WarehouseInitialCost = 5e9; //Initial purchase cost of warehouse
+var WarehouseInitialSize = 100;
+var WarehouseUpgradeBaseCost = 1e9;
+
+var OfficeInitialCost = 4e9;
+var OfficeInitialSize = 3;
+var OfficeUpgradeBaseCost = 1e9;
+
+var BribeThreshold = 100e12; //Money needed to be able to bribe for faction rep
+var BribeToRepRatio = 1e9; //Bribe Value divided by this = rep gain
+
+var ProductProductionCostRatio = 5; //Ratio of material cost of a product to its production cost
+
+function Material(params={}) {
+ this.name = params.name ? params.name : "";
+ this.qty = 0; //Quantity
+ this.qlt = 0; //Quality, unbounded
+ this.dmd = 0; //Demand, 0-100?
+ this.dmdR = 0; //Range of possible demand
+ this.cmp = 0; //Competition, 0-100
+ this.cmpR = 0; //Range of possible competition
+ this.mv = 0; //Maximum Volatility of stats
+
+ //Markup. Determines how high of a price you can charge on the material
+ //compared to the market price (bCost) based on quality
+ //Quality is divided by this to determine markup limits
+ //e.g if mku is 10 and quality is 100 then you can mark up prices by 100/10 = 10
+ //without consequences
+ this.mku = 0;
+
+ this.buy = 0; //How much of this material is being bought per second
+ this.sll = 0; //How much of this material is being sold per second
+ this.prd = 0; //How much of this material is being produced per second
+ this.exp = []; //Exports of this material to another warehouse/industry
+ this.totalExp = 0; //Total export amount for last cycle
+ this.imp = 0;
+ this.bCost = 0; //$ Cost/sec to buy material
+ this.sCost = 0; //$ Cost/sec to sell material
+
+ //[Whether production/sale is limited, limit amount]
+ this.prdman = [false, 0]; //Production for this material is manually limited
+ this.sllman = [false, 0]; //Sale of this material is manually limited
+ this.init();
+}
+
+Material.prototype.init = function(mats={}) {
+ switch(this.name) {
+ case "Water":
+ this.dmd = 75; this.dmdR = [65, 85];
+ this.cmp = 50; this.cmpR = [40, 60];
+ this.bCost = 1000; this.mv = 0.2;
+ this.mku = 6;
+ break;
+ case "Energy":
+ this.dmd = 90; this.dmdR = [80, 100];
+ this.cmp = 80; this.cmpR = [65, 95];
+ this.bCost = 1500; this.mv = 0.2;
+ this.mku = 6;
+ break;
+ case "Food":
+ this.dmd = 80; this.dmdR = [70, 90];
+ this.cmp = 60; this.cmpR = [35, 85];
+ this.bCost = 5000; this.mv = 1;
+ this.mku = 3;
+ break;
+ case "Plants":
+ this.dmd = 70; this.dmdR = [20, 90];
+ this.cmp = 50; this.cmpR = [30, 70];
+ this.bCost = 3000; this.mv = 0.6;
+ this.mku = 3.75;
+ break;
+ case "Metal":
+ this.dmd = 80; this.dmdR = [75, 85];
+ this.cmp = 70; this.cmpR = [60, 80];
+ this.bCost = 2650; this.mv = 1;
+ this.mku = 6;
+ break;
+ case "Hardware":
+ this.dmd = 85; this.dmdR = [80, 90];
+ this.cmp = 80; this.cmpR = [65, 95];
+ this.bCost = 4000; this.mv = 0.5; //Less mv bc its processed twice
+ this.mku = 1;
+ break;
+ case "Chemicals":
+ this.dmd = 55; this.dmdR = [40, 70];
+ this.cmp = 60; this.cmpR = [40, 80];
+ this.bCost = 6750; this.mv = 1.2;
+ this.mku = 2;
+ break;
+ case "Real Estate":
+ this.dmd = 50; this.dmdR = [5, 100];
+ this.cmp = 50; this.cmpR = [25, 75];
+ this.bCost = 16e3; this.mv = 1.5; //Less mv bc its processed twice
+ this.mku = 1.5;
+ break;
+ case "Drugs":
+ this.dmd = 60; this.dmdR = [45, 75];
+ this.cmp = 70; this.cmpR = [40, 100];
+ this.bCost = 8e3; this.mv = 1.6;
+ this.mku = 1;
+ break;
+ case "Robots":
+ this.dmd = 90; this.dmdR = [80, 100];
+ this.cmp = 90; this.cmpR = [80, 100];
+ this.bCost = 20e3; this.mv = 0.5; //Less mv bc its processed twice
+ this.mku = 1;
+ break;
+ case "AI Cores":
+ this.dmd = 90; this.dmdR = [80, 100];
+ this.cmp = 90; this.cmpR = [80, 100];
+ this.bCost = 27e3; this.mv = 0.8; //Less mv bc its processed twice
+ this.mku = 0.5;
+ break;
+ case "Scientific Research":
+ break;
+ default:
+ console.log("Invalid material type in init(): " + this.name);
+ break;
+ }
+}
+
+//Process change in demand, competition, and buy cost of this material
+Material.prototype.processMarket = function() {
+ //This 1st random check determines whether competition increases or decreases
+ //More competition = lower market price
+ var v = (Math.random() * this.mv) / 100;
+ var pv = (Math.random() * this.mv) / 300;
+ if (Math.random() < 0.42) {
+ this.cmp *= (1+v);
+ if (this.cmp > this.cmpR[1]) {this.cmp = this.cmpR[1]};
+ this.bCost *= (1-pv);
} else {
- var foo = this.data.slice();
- return foo[0];
+ this.cmp *= (1-v);
+ if (this.cmp < this.cmpR[0]) {this.cmp = this.cmpR[0];}
+ this.bCost *= (1+pv);
+ }
+
+ //This 2nd random check determines whether demand increases or decreases
+ //More demand = higher market price
+ v = (Math.random() * this.mv) / 100;
+ pv = (Math.random() * this.mv) / 300;
+ if (Math.random() < 0.45) {
+ this.dmd *= (1+v);
+ if (this.dmd > this.dmdR[1]) {this.dmd = this.dmdR[1];}
+ this.bCost *= (1+pv);
+ } else {
+ this.dmd *= (1-v);
+ if (this.dmd < this.dmdR[0]) {this.dmd = this.dmdR[0];}
+ this.bCost *= (1-pv);
}
}
-NetscriptPort.prototype.full = function() {
- return this.data.length == _Settings_js__WEBPACK_IMPORTED_MODULE_0__["Settings"].MaxPortCapacity;
+Material.prototype.toJSON = function() {
+ return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Generic_toJSON"])("Material", this);
}
-NetscriptPort.prototype.empty = function() {
- return this.data.length === 0;
+Material.fromJSON = function(value) {
+ return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Generic_fromJSON"])(Material, value.data);
}
-NetscriptPort.prototype.clear = function() {
- this.data.length = 0;
+_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Reviver"].constructors.Material = Material;
+
+//Map of material (by name) to their sizes (how much space it takes in warehouse)
+let MaterialSizes = {
+ Water: 0.05,
+ Energy: 0.01,
+ Food: 0.03,
+ Plants: 0.05,
+ Metal: 0.1,
+ Hardware: 0.06,
+ Chemicals: 0.05,
+ Drugs: 0.02,
+ Robots: 0.5,
+ "AICores": 0.1
+}
+
+function Product(params={}) {
+ this.name = params.name ? params.name : 0;
+ this.dmd = params.demand ? params.demand : 0;
+ this.cmp = params.competition ? params.competition : 0;
+ this.mku = params.markup ? params.markup : 0;
+ this.pCost = 0; //An estimate of how much money it costs to make this
+ this.sCost = 0; //How much this is selling for
+
+ //Variables for creation of product
+ this.fin = false; //Finished being created
+ this.prog = 0; //0-100% created
+ this.createCity = params.createCity ? params.createCity : ""; // City in which the product is being created
+ this.designCost = params.designCost ? params.designCost : 0;
+ this.advCost = params.advCost ? params.advCost : 0;
+
+ //Aggregate score for a product's 'rating' based on the other properties below
+ //The weighting of the other properties (performance, durability)
+ //differs between industries
+ this.rat = 0;
+
+ this.qlt = params.quality ? params.quality : 0;
+ this.per = params.performance ? params.performance : 0;
+ this.dur = params.durability ? params.durability : 0;
+ this.rel = params.reliability ? params.reliability : 0;
+ this.aes = params.aesthetics ? params.aesthetics : 0;
+ this.fea = params.features ? params.features : 0;
+
+ //Data refers to the production, sale, and quantity of the products
+ //These values are specific to a city
+ //The data is [qty, prod, sell]
+ this.data = {
+ [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Aevum]: [0, 0, 0],
+ [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Chongqing]: [0, 0, 0],
+ [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Sector12]: [0, 0, 0],
+ [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].NewTokyo]: [0, 0, 0],
+ [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Ishima]: [0, 0, 0],
+ [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Volhaven]: [0, 0, 0],
+ }
+
+ //Only applies for location-based products like restaurants/hospitals
+ this.loc = params.loc ? params.loc : 0;
+
+ //How much space it takes in the warehouse. Not applicable for all products
+ this.siz = params.size ? params.size : 0;
+
+ //Material requirements. An object that maps the name of a material to how much it requires
+ //to make 1 unit of the product.
+ this.reqMats = params.req ? params.req : {};
+
+ //[Whether production/sale is limited, limit amount]
+ this.prdman = {
+ [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Aevum]: [false, 0],
+ [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Chongqing]: [false, 0],
+ [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Sector12]: [false, 0],
+ [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].NewTokyo]: [false, 0],
+ [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Ishima]: [false, 0],
+ [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Volhaven]: [false, 0],
+ }
+
+ this.sllman = {
+ [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Aevum]: [false, 0],
+ [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Chongqing]: [false, 0],
+ [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Sector12]: [false, 0],
+ [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].NewTokyo]: [false, 0],
+ [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Ishima]: [false, 0],
+ [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Volhaven]: [false, 0],
+ }
+}
+
+//empWorkMult is a multiplier that increases progress rate based on
+//productivity of employees
+Product.prototype.createProduct = function(marketCycles=1, empWorkMult=1) {
+ if (this.fin) {return;}
+ this.prog += (marketCycles * .01 * empWorkMult);
+}
+
+//'industry' is a reference to the industry that makes the product
+Product.prototype.finishProduct = function(employeeProd, industry) {
+ this.fin = true;
+
+ //Calculate properties
+ var progrMult = this.prog / 100;
+
+ var engrRatio = employeeProd[EmployeePositions.Engineer] / employeeProd["total"],
+ mgmtRatio = employeeProd[EmployeePositions.Management] / employeeProd["total"],
+ rndRatio = employeeProd[EmployeePositions.RandD] / employeeProd["total"],
+ opsRatio = employeeProd[EmployeePositions.Operations] / employeeProd["total"],
+ busRatio = employeeProd[EmployeePositions.Business] / employeeProd["total"];
+ var designMult = 1 + (Math.pow(this.designCost, 0.1) / 100);
+ console.log("designMult: " + designMult);
+ var balanceMult = (1.2 * engrRatio) + (0.9 * mgmtRatio) + (1.3 * rndRatio) +
+ (1.5 * opsRatio) + (busRatio);
+ var sciMult = 1 + (Math.pow(industry.sciResearch.qty, industry.sciFac) / 800);
+ var totalMult = progrMult * balanceMult * designMult * sciMult;
+
+ this.qlt = totalMult * ((0.10 * employeeProd[EmployeePositions.Engineer]) +
+ (0.05 * employeeProd[EmployeePositions.Management]) +
+ (0.05 * employeeProd[EmployeePositions.RandD]) +
+ (0.02 * employeeProd[EmployeePositions.Operations]) +
+ (0.02 * employeeProd[EmployeePositions.Business]));
+ this.per = totalMult * ((0.15 * employeeProd[EmployeePositions.Engineer]) +
+ (0.02 * employeeProd[EmployeePositions.Management]) +
+ (0.02 * employeeProd[EmployeePositions.RandD]) +
+ (0.02 * employeeProd[EmployeePositions.Operations]) +
+ (0.02 * employeeProd[EmployeePositions.Business]));
+ this.dur = totalMult * ((0.05 * employeeProd[EmployeePositions.Engineer]) +
+ (0.02 * employeeProd[EmployeePositions.Management]) +
+ (0.08 * employeeProd[EmployeePositions.RandD]) +
+ (0.05 * employeeProd[EmployeePositions.Operations]) +
+ (0.05 * employeeProd[EmployeePositions.Business]));
+ this.rel = totalMult * ((0.02 * employeeProd[EmployeePositions.Engineer]) +
+ (0.08 * employeeProd[EmployeePositions.Management]) +
+ (0.02 * employeeProd[EmployeePositions.RandD]) +
+ (0.05 * employeeProd[EmployeePositions.Operations]) +
+ (0.08 * employeeProd[EmployeePositions.Business]));
+ this.aes = totalMult * ((0.00 * employeeProd[EmployeePositions.Engineer]) +
+ (0.08 * employeeProd[EmployeePositions.Management]) +
+ (0.05 * employeeProd[EmployeePositions.RandD]) +
+ (0.02 * employeeProd[EmployeePositions.Operations]) +
+ (0.10 * employeeProd[EmployeePositions.Business]));
+ this.fea = totalMult * ((0.08 * employeeProd[EmployeePositions.Engineer]) +
+ (0.05 * employeeProd[EmployeePositions.Management]) +
+ (0.02 * employeeProd[EmployeePositions.RandD]) +
+ (0.05 * employeeProd[EmployeePositions.Operations]) +
+ (0.05 * employeeProd[EmployeePositions.Business]));
+ this.calculateRating(industry);
+ var advMult = 1 + (Math.pow(this.advCost, 0.1) / 100);
+ this.mku = 100 / (advMult * Math.pow((this.qlt + 0.001), 0.65) * (busRatio + mgmtRatio));
+ this.dmd = industry.awareness === 0 ? 20 : Math.min(100, advMult * (100 * (industry.popularity / industry.awareness)));
+ this.cmp = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(0, 70);
+
+ //Calculate the product's required materials
+ //For now, just set it to be the same as the requirements to make materials
+ for (var matName in industry.reqMats) {
+ if (industry.reqMats.hasOwnProperty(matName)) {
+ this.reqMats[matName] = industry.reqMats[matName];
+ }
+ }
+
+ //Calculate the product's size
+ //For now, just set it to be the same size as the requirements to make materials
+ this.siz = 0;
+ for (var matName in industry.reqMats) {
+ this.siz += MaterialSizes[matName] * industry.reqMats[matName];
+ }
+
+ //Delete unneeded variables
+ delete this.prog;
+ delete this.createCity;
+ delete this.designCost;
+ delete this.advCost;
+}
+
+
+Product.prototype.calculateRating = function(industry) {
+ var weights = ProductRatingWeights[industry.type];
+ if (weights == null) {
+ console.log("ERROR: Could not find product rating weights for: " + industry);
+ return;
+ }
+ this.rat = 0;
+ this.rat += weights.Quality ? this.qlt * weights.Quality : 0;
+ this.rat += weights.Performance ? this.per * weights.Performance : 0;
+ this.rat += weights.Durability ? this.dur * weights.Durability : 0;
+ this.rat += weights.Reliability ? this.rel * weights.Reliability : 0;
+ this.rat += weights.Aesthetics ? this.aes * weights.Aesthetics : 0;
+ this.rat += weights.Features ? this.fea * weights.Features : 0;
+}
+
+Product.prototype.toJSON = function() {
+ return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Generic_toJSON"])("Product", this);
+}
+
+Product.fromJSON = function(value) {
+ return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Generic_fromJSON"])(Product, value.data);
+}
+
+_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Reviver"].constructors.Product = Product;
+
+var Industries = {
+ Energy: "Energy",
+ Utilities: "Water Utilities",
+ Agriculture: "Agriculture",
+ Fishing: "Fishing",
+ Mining: "Mining",
+ Food: "Food",
+ Tobacco: "Tobacco",
+ Chemical: "Chemical",
+ Pharmaceutical: "Pharmaceutical",
+ Computer: "Computer Hardware",
+ Robotics: "Robotics",
+ Software: "Software",
+ Healthcare: "Healthcare",
+ RealEstate: "RealEstate",
+}
+
+var IndustryStartingCosts = {
+ Energy: 225e9,
+ Utilities: 150e9,
+ Agriculture: 40e9,
+ Fishing: 80e9,
+ Mining: 300e9,
+ Food: 10e9,
+ Tobacco: 20e9,
+ Chemical: 70e9,
+ Pharmaceutical: 200e9,
+ Computer: 500e9,
+ Robotics: 1e12,
+ Software: 25e9,
+ Healthcare: 750e9,
+ RealEstate: 600e9,
+}
+
+var IndustryDescriptions = {
+ Energy: "Engage in the production and distribution of energy.
" +
+ "Starting cost: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(IndustryStartingCosts.Energy).format("$0.000a") + "
" +
+ "Recommended starting Industry: NO",
+ Utilities: "Distributes water and provides wastewater services.
" +
+ "Starting cost: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(IndustryStartingCosts.Utilities).format("$0.000a") + "
" +
+ "Recommended starting Industry: NO",
+ Agriculture: "Cultive crops and breed livestock to produce food.
" +
+ "Starting cost: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(IndustryStartingCosts.Agriculture).format("$0.000a") + "
" +
+ "Recommended starting Industry: YES",
+ Fishing: "Produce food through the breeding and processing of fish and fish products
" +
+ "Starting cost: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(IndustryStartingCosts.Fishing).format("$0.000a") + "
" +
+ "Recommended starting Industry: NO",
+ Mining: "Extract and process metals from the earth.
" +
+ "Starting cost: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(IndustryStartingCosts.Mining).format("$0.000a") + "
" +
+ "Recommended starting Industry: NO",
+ Food: "Create your own restaurants all around the world.
" +
+ "Starting cost: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(IndustryStartingCosts.Food).format("$0.000a") + "
" +
+ "Recommended starting Industry: YES",
+ Tobacco: "Create and distribute tobacco and tobacco-related products.
" +
+ "Starting cost: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(IndustryStartingCosts.Tobacco).format("$0.000a") + "
" +
+ "Recommended starting Industry: YES",
+ Chemical: "Product industrial chemicals
" +
+ "Starting cost: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(IndustryStartingCosts.Chemical).format("$0.000a") + "
" +
+ "Recommended starting Industry: NO",
+ Pharmaceutical: "Discover, develop, and create new pharmaceutical drugs.
" +
+ "Starting cost: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(IndustryStartingCosts.Pharmaceutical).format("$0.000a") + "
" +
+ "Recommended starting Industry: NO",
+ Computer: "Develop and manufacture new computer hardware and networking infrastructures.
" +
+ "Starting cost: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(IndustryStartingCosts.Computer).format("$0.000a") + "
" +
+ "Recommended starting Industry: NO",
+ Robotics: "Develop and create robots.
" +
+ "Starting cost: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(IndustryStartingCosts.Robotics).format("$0.000a") + "
" +
+ "Recommended starting Industry: NO",
+ Software: "Develop computer software and create AI Cores.
" +
+ "Starting cost: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(IndustryStartingCosts.Software).format("$0.000a") + "
" +
+ "Recommended starting Industry: YES",
+ Healthcare: "Create and manage hospitals.
" +
+ "Starting cost: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(IndustryStartingCosts.Healthcare).format("$0.000a") + "
" +
+ "Recommended starting Industry: NO",
+ RealEstate: "Develop and manage real estate properties.
" +
+ "Starting cost: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(IndustryStartingCosts.RealEstate).format("$0.000a") + "
" +
+ "Recommended starting Industry: NO",
+}
+
+var ProductRatingWeights = {
+ [Industries.Food]: {
+ Quality: 0.7,
+ Durability: 0.1,
+ Aesthetics: 0.2,
+ },
+ [Industries.Tobacco]: {
+ Quality: 0.4,
+ Durability: 0.2,
+ Reliability: 0.2,
+ Aesthetics: 0.2,
+ },
+ [Industries.Pharmaceutical]: {
+ Quality: 0.2,
+ Performance: 0.2,
+ Durability: 0.1,
+ Reliability: 0.3,
+ Features: 0.2,
+ },
+ [Industries.Computer]: {
+ Quality: 0.15,
+ Performance: 0.25,
+ Durability: 0.25,
+ Reliability: 0.2,
+ Aesthetics: 0.05,
+ Features: 0.1,
+ },
+ "Computer" : { //Repeat
+ Quality: 0.15,
+ Performance: 0.25,
+ Durability: 0.25,
+ Reliability: 0.2,
+ Aesthetics: 0.05,
+ Features: 0.1,
+ },
+ [Industries.Robotics]: {
+ Quality: 0.1,
+ Performance: 0.2,
+ Durability: 0.2,
+ Reliability: 0.2,
+ Aesthetics: 0.1,
+ Features: 0.2,
+ },
+ [Industries.Software]: {
+ Quality: 0.2,
+ Performance: 0.2,
+ Reliability: 0.2,
+ Durability: 0.2,
+ Features: 0.2,
+ },
+ [Industries.Healthcare]: {
+ Quality: 0.4,
+ Performance: 0.1,
+ Durability: 0.1,
+ Reliability: 0.3,
+ Features: 0.1,
+ },
+ [Industries.RealEstate]: {
+ Quality: 0.2,
+ Durability: 0.25,
+ Reliability: 0.1,
+ Aesthetics: 0.35,
+ Features: 0.1,
+ }
+}
+
+//Industry upgrades
+//The structure is:
+// [index in array, base price, price mult, benefit mult (if applicable), name, desc]
+var IndustryUpgrades = {
+ "0": [0, 500e3, 1, 1.05,
+ "Coffee", "Provide your employees with coffee, increasing their energy by 5%."],
+ "1": [1, 1e9, 1.06, 1.03,
+ "AdVert.Inc", "Hire AdVert.Inc to advertise your company. Each level of " +
+ "this upgrade grants your company a static increase of 3 and 1 to its awareness and " +
+ "popularity, respectively. It will then increase your company's awareness by 1%, and its popularity " +
+ "by a random percentage between 1% and 3%. These effects are increased by other upgrades " +
+ "that increase the power of your advertising."]
+}
+
+var empManualAssignmentModeActive = false;
+function Industry(params={}) {
+ this.offices = { //Maps locations to offices. 0 if no office at that location
+ [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Aevum]: 0,
+ [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Chongqing]: 0,
+ [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Sector12]: new OfficeSpace({
+ loc:_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Sector12,
+ size:OfficeInitialSize,
+ }),
+ [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].NewTokyo]: 0,
+ [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Ishima]: 0,
+ [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Volhaven]: 0
+ };
+
+ this.warehouses = { //Maps locations to warehouses. 0 if no warehouse at that location
+ [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Aevum]: 0,
+ [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Chonqing]: 0,
+ [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Sector12]: new Warehouse({
+ loc:_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Sector12,
+ size: WarehouseInitialSize,
+ }),
+ [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].NewTokyo]: 0,
+ [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Ishima]: 0,
+ [_Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Volhaven]: 0
+ };
+
+ this.name = params.name ? params.name : 0;
+ this.type = params.type ? params.type : 0;
+
+ this.sciResearch = new Material({name: "Scientific Research"});
+
+ //A map of the NAME of materials required to create produced materials to
+ //how many are needed to produce 1 unit of produced materials
+ this.reqMats = {};
+
+ //An array of the name of materials being produced
+ this.prodMats = [];
+
+ this.products = {};
+ this.makesProducts = false;
+
+ this.awareness = 0;
+ this.popularity = 0; //Should always be less than awareness
+ this.startingCost = 0;
+
+ /* The following are factors for how much production/other things are increased by
+ different factors. The production increase always has diminishing returns,
+ and they are all reprsented by exponentials of < 1 (e.g x ^ 0.5, x ^ 0.8)
+ The number for these represent the exponential. A lower number means more
+ diminishing returns */
+ this.reFac = 0; //Real estate Factor
+ this.sciFac = 0; //Scientific Research Factor, affects quality
+ this.hwFac = 0; //Hardware factor
+ this.robFac = 0; //Robotics Factor
+ this.aiFac = 0; //AI Cores factor;
+ this.advFac = 0; //Advertising factor, affects sales
+
+ this.prodMult = 0; //Production multiplier
+
+ //Financials
+ this.lastCycleRevenue = new _utils_decimal_js__WEBPACK_IMPORTED_MODULE_6___default.a(0);
+ this.lastCycleExpenses = new _utils_decimal_js__WEBPACK_IMPORTED_MODULE_6___default.a(0);
+ this.thisCycleRevenue = new _utils_decimal_js__WEBPACK_IMPORTED_MODULE_6___default.a(0);
+ this.thisCycleExpenses = new _utils_decimal_js__WEBPACK_IMPORTED_MODULE_6___default.a(0);
+
+ //Upgrades
+ var numUpgrades = Object.keys(IndustryUpgrades).length;
+ this.upgrades = Array(numUpgrades).fill(0);
+
+ this.state = "START";
+ this.newInd = true;
+
+ this.init();
+}
+
+Industry.prototype.init = function() {
+ //Set the unique properties of an industry (how much its affected by real estate/scientific research, etc.)
+ this.startingCost = IndustryStartingCosts[this.type];
+ switch (this.type) {
+ case Industries.Energy:
+ this.reFac = 0.65;
+ this.sciFac = 0.7;
+ this.robFac = 0.05;
+ this.aiFac = 0.3;
+ this.advFac = 0.08;
+ this.reqMats = {
+ "Hardware": 0.1,
+ "Metal": 0.2,
+ };
+ this.prodMats = ["Energy"];
+ break;
+ case Industries.Utilities:
+ case "Utilities":
+ this.reFac = 0.5;
+ this.sciFac = 0.6;
+ this.robFac = 0.4;
+ this.aiFac = 0.4;
+ this.advFac = 0.08;
+ this.reqMats = {
+ "Hardware": 0.1,
+ "Metal": 0.1,
+ }
+ this.prodMats = ["Water"];
+ break;
+ case Industries.Agriculture:
+ this.reFac = 0.75;
+ this.sciFac = 0.5;
+ this.hwFac = 0.2;
+ this.robFac = 0.3;
+ this.aiFac = 0.3;
+ this.advFac = 0.04;
+ this.reqMats = {
+ "Water": 0.5,
+ "Energy": 0.5,
+ }
+ this.prodMats = ["Plants", "Food"];
+ break;
+ case Industries.Fishing:
+ this.reFac = 0.15;
+ this.sciFac = 0.35;
+ this.hwFac = 0.35;
+ this.robFac = 0.5;
+ this.aiFac = 0.2;
+ this.advFac = 0.08;
+ this.reqMats = {
+ "Energy": 0.5,
+ }
+ this.prodMats = ["Food"];
+ break;
+ case Industries.Mining:
+ this.reFac = 0.3;
+ this.sciFac = 0.26;
+ this.hwFac = 0.4;
+ this.robFac = 0.45;
+ this.aiFac = 0.45;
+ this.advFac = 0.06;
+ this.reqMats = {
+ "Energy": 0.8,
+ }
+ this.prodMats = ["Metal"];
+ break;
+ case Industries.Food:
+ //reFac is unique for this bc it diminishes greatly per city. Handle this separately in code?
+ this.sciFac = 0.12;
+ this.hwFac = 0.15;
+ this.robFac = 0.3;
+ this.aiFac = 0.25;
+ this.advFac = 0.25;
+ this.reFac = 0.05;
+ this.reqMats = {
+ "Food": 0.5,
+ "Water": 0.5,
+ "Energy": 0.2,
+ }
+ this.makesProducts = true;
+ break;
+ case Industries.Tobacco:
+ this.reFac = 0.15;
+ this.sciFac = 0.75;
+ this.hwFac = 0.15;
+ this.robFac = 0.2;
+ this.aiFac = 0.15;
+ this.advFac = 0.2;
+ this.reqMats = {
+ "Plants": 1,
+ "Water": 0.2,
+ }
+ this.makesProducts = true;
+ break;
+ case Industries.Chemical:
+ this.reFac = 0.25;
+ this.sciFac = 0.75;
+ this.hwFac = 0.2;
+ this.robFac = 0.25;
+ this.aiFac = 0.2;
+ this.advFac = 0.07;
+ this.reqMats = {
+ "Plants": 1,
+ "Energy": 0.5,
+ "Water": 0.5,
+ }
+ this.prodMats = ["Chemicals"];
+ break;
+ case Industries.Pharmaceutical:
+ this.reFac = 0.05;
+ this.sciFac = 0.8;
+ this.hwFac = 0.15;
+ this.robFac = 0.25;
+ this.aiFac = 0.2;
+ this.advFac = 0.16;
+ this.reqMats = {
+ "Chemicals": 2,
+ "Energy": 1,
+ "Water": 0.5,
+ }
+ this.prodMats = ["Drugs"];
+ this.makesProducts = true;
+ break;
+ case Industries.Computer:
+ case "Computer":
+ this.reFac = 0.2;
+ this.sciFac = 0.62;
+ this.robFac = 0.36;
+ this.aiFac = 0.19;
+ this.advFac = 0.17;
+ this.reqMats = {
+ "Metal": 2.5,
+ "Energy": 1,
+ }
+ this.prodMats = ["Hardware"];
+ this.makesProducts = true;
+ break;
+ case Industries.Robotics:
+ this.reFac = 0.32;
+ this.sciFac = 0.65;
+ this.aiFac = 0.36;
+ this.advFac = 0.18;
+ this.hwFac = 0.19;
+ this.reqMats = {
+ "Hardware": 5,
+ "Energy": 3,
+ }
+ this.prodMats = ["Robots"];
+ this.makesProducts = true;
+ break;
+ case Industries.Software:
+ this.sciFac = 0.62;
+ this.advFac = 0.16;
+ this.hwFac = 0.25;
+ this.reFac = 0.1;
+ this.aiFac = 0.1;
+ this.robFac = 0.05;
+ this.reqMats = {
+ "Hardware": 0.5,
+ "Energy": 1,
+ }
+ this.prodMats = ["AICores"];
+ this.makesProducts = true;
+ break;
+ case Industries.Healthcare:
+ this.reFac = 0.1;
+ this.sciFac = 0.75;
+ this.advFac = 0.11;
+ this.hwFac = 0.1;
+ this.robFac = 0.1;
+ this.aiFac = 0.1;
+ this.reqMats = {
+ "Robots": 10,
+ "AICores": 5,
+ "Energy": 5,
+ "Water": 5,
+ }
+ this.makesProducts = true;
+ break;
+ case Industries.RealEstate:
+ this.robFac = 0.6;
+ this.aiFac = 0.6;
+ this.advFac = 0.25;
+ this.sciFac = 0.05;
+ this.hwFac = 0.05;
+ this.reqMats = {
+ "Metal": 20,
+ "Energy": 10,
+ "Water": 10,
+ "Hardware": 5
+ }
+ this.prodMats = ["RealEstate"];
+ this.makesProducts = true;
+ break;
+ default:
+ console.log("ERR: Invalid Industry Type passed into Industry.init(): " + this.type);
+ return;
+ }
+}
+
+Industry.prototype.getProductDescriptionText = function() {
+ if (!this.makesProducts) {return;}
+ switch (this.type) {
+ case Industries.Food:
+ return "create and manage restaurants";
+ break;
+ case Industries.Tobacco:
+ return "create tobacco and tobacco-related products";
+ break;
+ case Industries.Pharmaceutical:
+ return "develop new pharmaceutical drugs";
+ break;
+ case Industries.Computer:
+ case "Computer":
+ return "create new computer hardware and networking infrastructures";
+ break;
+ case Industries.Robotics:
+ return "build specialized robots and robot-related products";
+ break;
+ case Industries.Software:
+ return "develop computer software";
+ break;
+ case Industries.HealthCare:
+ return "build and manage hospitals";
+ break;
+ case Industries.RealEstate:
+ return "develop and manage real estate properties";
+ break;
+ default:
+ console.log("ERROR: Invalid industry type in Industry.getProductDescriptionText");
+ return "";
+ }
+}
+
+//Calculates the values that factor into the production and properties of
+//materials/products (such as quality, etc.)
+Industry.prototype.calculateProductionFactors = function() {
+ var multSum = 0;
+ for (var i = 0; i < Cities.length; ++i) {
+ var city = Cities[i];
+ var warehouse = this.warehouses[city];
+ if (!(warehouse instanceof Warehouse)) {
+ continue;
+ }
+
+ var materials = warehouse.materials,
+ office = this.offices[city];
+
+ var cityMult = Math.pow(0.002 * materials.RealEstate.qty+1, this.reFac) *
+ Math.pow(0.002 * materials.Hardware.qty+1, this.hwFac) *
+ Math.pow(0.002 * materials.Robots.qty+1, this.robFac) *
+ Math.pow(0.002 * materials.AICores.qty+1, this.aiFac);
+ multSum += Math.pow(cityMult, 0.73);
+ }
+
+ multSum < 1 ? this.prodMult = 1 : this.prodMult = multSum;
+}
+
+Industry.prototype.updateWarehouseSizeUsed = function(warehouse) {
+ if (warehouse instanceof Warehouse) {
+ //This resets the size back to 0 and then accounts for materials
+ warehouse.updateMaterialSizeUsed();
+ }
+
+ for (var prodName in this.products) {
+ if (this.products.hasOwnProperty(prodName)) {
+ var prod = this.products[prodName];
+ warehouse.sizeUsed += (prod.data[warehouse.loc][0] * prod.siz);
+ if (prod.data[warehouse.loc][0] > 0) {
+ warehouse.breakdown += (prodName + ": " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(prod.data[warehouse.loc][0] * prod.siz, 0) + "
");
+ }
+ }
+ }
+}
+
+Industry.prototype.process = function(marketCycles=1, state, company) {
+ this.state = state;
+
+ //At the start of a cycle, store and reset revenue/expenses
+ //Then calculate salaries and processs the markets
+ if (state === "START") {
+ if (isNaN(this.thisCycleRevenue) || isNaN(this.thisCycleExpenses)) {
+ console.log("ERROR: NaN in Corporation's computed revenue/expenses");
+ console.log(this.thisCycleRevenue.toString());
+ console.log(this.thisCycleExpenses.toString());
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Something went wrong when compting Corporation's revenue/expenses. This is a bug. Please report to game developer");
+ this.thisCycleRevenue = new _utils_decimal_js__WEBPACK_IMPORTED_MODULE_6___default.a(0);
+ this.thisCycleExpenses = new _utils_decimal_js__WEBPACK_IMPORTED_MODULE_6___default.a(0);
+ }
+ this.lastCycleRevenue = this.thisCycleRevenue.dividedBy(marketCycles * SecsPerMarketCycle);
+ this.lastCycleExpenses = this.thisCycleExpenses.dividedBy(marketCycles * SecsPerMarketCycle);
+ this.thisCycleRevenue = new _utils_decimal_js__WEBPACK_IMPORTED_MODULE_6___default.a(0);
+ this.thisCycleExpenses = new _utils_decimal_js__WEBPACK_IMPORTED_MODULE_6___default.a(0);
+
+ //Once you start making revenue, the player should no longer be
+ //considered new, and therefore no longer needs the 'tutorial' UI elements
+ if (this.lastCycleRevenue.gt(0)) {this.newInd = false;}
+
+ //Process offices (and the employees in them)
+ var employeeSalary = 0;
+ for (var officeLoc in this.offices) {
+ if (this.offices.hasOwnProperty(officeLoc) &&
+ this.offices[officeLoc] instanceof OfficeSpace) {
+ employeeSalary += this.offices[officeLoc].process(marketCycles, {industry:this, corporation:company});
+ }
+ }
+ this.thisCycleExpenses = this.thisCycleExpenses.plus(employeeSalary);
+
+ //Process change in demand/competition of materials/products
+ this.processMaterialMarket(marketCycles);
+ this.processProductMarket(marketCycles);
+
+ //Process loss of popularity
+ this.popularity -= (marketCycles * .0001);
+ this.popularity = Math.max(0, this.popularity);
+
+ //Process Dreamsense gains
+ var popularityGain = company.getDreamSenseGain(), awarenessGain = popularityGain * 4;
+ if (popularityGain > 0) {
+ this.popularity += (popularityGain * marketCycles);
+ this.awareness += (awarenessGain * marketCycles);
+ }
+
+ return;
+ }
+
+ //Process production, purchase, and import/export of materials
+ var res = this.processMaterials(marketCycles, company);
+ this.thisCycleRevenue = this.thisCycleRevenue.plus(res[0]);
+ this.thisCycleExpenses = this.thisCycleExpenses.plus(res[1]);
+
+ //Process creation, production & sale of products
+ res = this.processProducts(marketCycles, company);
+ this.thisCycleRevenue = this.thisCycleRevenue.plus(res[0]);
+ this.thisCycleExpenses = this.thisCycleExpenses.plus(res[1]);
+
+}
+
+//Process change in demand and competition for this industry's materials
+Industry.prototype.processMaterialMarket = function(marketCycles=1) {
+ //References to prodMats and reqMats
+ var reqMats = this.reqMats, prodMats = this.prodMats;
+
+ //Only 'process the market' for materials that this industry deals with
+ for (var i = 0; i < Cities.length; ++i) {
+ //If this industry has a warehouse in this city, process the market
+ //for every material this industry requires or produces
+ if (this.warehouses[Cities[i]] instanceof Warehouse) {
+ var wh = this.warehouses[Cities[i]];
+ for (var name in reqMats) {
+ if (reqMats.hasOwnProperty(name)) {
+ wh.materials[name].processMarket();
+ }
+ }
+
+ //Produced materials are stored in an array
+ for (var foo = 0; foo < prodMats.length; ++foo) {
+ wh.materials[prodMats[foo]].processMarket();
+ }
+
+ //Process these twice because these boost production
+ wh.materials["Hardware"].processMarket();
+ wh.materials["Robots"].processMarket();
+ wh.materials["AICores"].processMarket();
+ wh.materials["RealEstate"].processMarket();
+ }
+ }
+}
+
+//Process change in demand and competition for this industry's products
+Industry.prototype.processProductMarket = function(marketCycles=1) {
+ //Demand gradually decreases, and competition gradually increases
+ for (var name in this.products) {
+ if (this.products.hasOwnProperty(name)) {
+ var product = this.products[name];
+ var change = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(1, 3) * 0.0004;
+ if (this.type === Industries.Pharmaceutical || this.type === Industries.Software ||
+ this.type === Industries.Robotics) {
+ change *= 3;
+ }
+ change *= marketCycles;
+ product.dmd -= change;
+ product.cmp += change;
+ product.cmp = Math.min(product.cmp, 99.99);
+ product.dmd = Math.max(product.dmd, 0.001);
+ }
+ }
+}
+
+//Process production, purchase, and import/export of materials
+Industry.prototype.processMaterials = function(marketCycles=1, company) {
+ var revenue = 0, expenses = 0, industry = this;
+ this.calculateProductionFactors();
+
+ //At the start of the export state, set the imports of everything to 0
+ if (this.state === "EXPORT") {
+ for (var i = 0; i < Cities.length; ++i) {
+ var city = Cities[i], office = this.offices[city];
+ if (!(this.warehouses[city] instanceof Warehouse)) {
+ continue;
+ }
+ var warehouse = this.warehouses[city];
+ for (var matName in warehouse.materials) {
+ if (warehouse.materials.hasOwnProperty(matName)) {
+ var mat = warehouse.materials[matName];
+ mat.imp = 0;
+ }
+ }
+ }
+ }
+
+ for (var i = 0; i < Cities.length; ++i) {
+ var city = Cities[i], office = this.offices[city];
+
+ if (this.warehouses[city] instanceof Warehouse) {
+ var warehouse = this.warehouses[city];
+
+ switch(this.state) {
+
+ case "PURCHASE":
+ /* Process purchase of materials */
+ for (var matName in warehouse.materials) {
+ if (warehouse.materials.hasOwnProperty(matName)) {
+ (function(matName, ind) {
+ var mat = warehouse.materials[matName];
+ var buyAmt, maxAmt;
+ if (warehouse.smartSupplyEnabled && Object.keys(ind.reqMats).includes(matName)) {
+ //Smart supply tracker is stored as per second rate
+ mat.buy = ind.reqMats[matName] * warehouse.smartSupplyStore;
+ buyAmt = mat.buy * SecsPerMarketCycle * marketCycles;
+ } else {
+ buyAmt = (mat.buy * SecsPerMarketCycle * marketCycles);
+ }
+
+ if (matName == "RealEstate") {
+ maxAmt = buyAmt;
+ } else {
+ maxAmt = Math.floor((warehouse.size - warehouse.sizeUsed) / MaterialSizes[matName]);
+ }
+ var buyAmt = Math.min(buyAmt, maxAmt);
+ if (buyAmt > 0) {
+ mat.qty += buyAmt;
+ expenses += (buyAmt * mat.bCost);
+ }
+ })(matName, industry);
+ this.updateWarehouseSizeUsed(warehouse);
+ }
+ } //End process purchase of materials
+ break;
+
+ case "PRODUCTION":
+ warehouse.smartSupplyStore = 0; //Reset smart supply amount
+
+ /* Process production of materials */
+ if (this.prodMats.length > 0) {
+ var mat = warehouse.materials[this.prodMats[0]];
+ //Calculate the maximum production of this material based
+ //on the office's productivity
+ var maxProd = this.getOfficeProductivity(office) * this.prodMult * company.getProductionMultiplier(), prod;
+
+ if (mat.prdman[0]) {
+ //Production is manually limited
+ prod = Math.min(maxProd, mat.prdman[1]);
+ } else {
+ prod = maxProd;
+ }
+ prod *= (SecsPerMarketCycle * marketCycles); //Convert production from per second to per market cycle
+ //Calculate net change in warehouse storage making
+ //the produced materials will cost
+ var totalMatSize = 0;
+ for (var tmp = 0; tmp < this.prodMats.length; ++tmp) {
+ totalMatSize += (MaterialSizes[this.prodMats[tmp]]);
+ }
+ for (var reqMatName in this.reqMats) {
+ if (this.reqMats.hasOwnProperty(reqMatName)) {
+ var normQty = this.reqMats[reqMatName];
+ totalMatSize -= (MaterialSizes[reqMatName] * normQty);
+ }
+ }
+ //If not enough space in warehouse, limit the amount of produced materials
+ if (totalMatSize > 0) {
+ var maxAmt = Math.floor((warehouse.size - warehouse.sizeUsed) / totalMatSize);
+ prod = Math.min(maxAmt, prod);
+ }
+
+ if (prod < 0) {prod = 0;}
+
+ //Keep track of production for smart supply (/s)
+ warehouse.smartSupplyStore += (prod / (SecsPerMarketCycle * marketCycles));
+
+ //Make sure we have enough resource to make our materials
+ var producableFrac = 1;
+ for (var reqMatName in this.reqMats) {
+ if (this.reqMats.hasOwnProperty(reqMatName)) {
+ var req = this.reqMats[reqMatName] * prod;
+ if (warehouse.materials[reqMatName].qty < req) {
+ producableFrac = Math.min(producableFrac, warehouse.materials[reqMatName].qty / req);
+ }
+ }
+ }
+ if (producableFrac <= 0) {producableFrac = 0; prod = 0;}
+
+ //Make our materials if they are producable
+ if (producableFrac > 0 && prod > 0) {
+ for (var reqMatName in this.reqMats) {
+ if (this.reqMats.hasOwnProperty(reqMatName)) {
+ var reqMatQtyNeeded = (this.reqMats[reqMatName] * prod * producableFrac);
+ warehouse.materials[reqMatName].qty -= reqMatQtyNeeded;
+ warehouse.materials[reqMatName].prd = 0;
+ warehouse.materials[reqMatName].prd -= reqMatQtyNeeded / (SecsPerMarketCycle * marketCycles);
+ }
+ }
+ for (var j = 0; j < this.prodMats.length; ++j) {
+ warehouse.materials[this.prodMats[j]].qty += (prod * producableFrac);
+ warehouse.materials[this.prodMats[j]].qlt =
+ (office.employeeProd[EmployeePositions.Engineer] / 100 +
+ Math.pow(this.sciResearch.qty, this.sciFac) +
+ Math.pow(warehouse.materials["AICores"].qty, this.aiFac) / 10e3);
+ }
+ } else {
+ for (var reqMatName in this.reqMats) {
+ if (this.reqMats.hasOwnProperty(reqMatName)) {
+ warehouse.materials[reqMatName].prd = 0;
+ }
+ }
+ }
+
+ //Per second
+ var fooProd = prod * producableFrac / (SecsPerMarketCycle * marketCycles);
+ for (var fooI = 0; fooI < this.prodMats.length; ++fooI) {
+ warehouse.materials[this.prodMats[fooI]].prd = fooProd;
+ }
+ } else {
+ //If this doesn't produce any materials, then it only creates
+ //Products. Creating products will consume materials. The
+ //Production of all consumed materials must be set to 0
+ for (var reqMatName in this.reqMats) {
+ if (this.reqMats.hasOwnProperty(reqMatName)) {
+ warehouse.materials[reqMatName].prd = 0;
+ }
+ }
+ }
+ break;
+
+ case "SALE":
+ /* Process sale of materials */
+ for (var matName in warehouse.materials) {
+ if (warehouse.materials.hasOwnProperty(matName)) {
+ var mat = warehouse.materials[matName];
+ if (mat.sCost < 0 || mat.sllman[0] === false) {
+ mat.sll = 0;
+ continue;
+ }
+ var mat = warehouse.materials[matName];
+
+ var sCost;
+ if (Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["isString"])(mat.sCost)) {
+ sCost = mat.sCost.replace(/MP/g, mat.bCost);
+ sCost = eval(sCost);
+ } else {
+ sCost = mat.sCost;
+ }
+
+ //Calculate how much of the material sells (per second)
+ var markup = 1, markupLimit = mat.qlt / mat.mku;
+ if (sCost > mat.bCost) {
+ //Penalty if difference between sCost and bCost is greater than markup limit
+ if ((sCost - mat.bCost) > markupLimit) {
+ markup = markupLimit / (sCost - mat.bCost);
+ }
+ } else if (sCost < mat.bCost) {
+ if (sCost <= 0) {
+ markup = 1e12; //Sell everything, essentially discard
+ } else {
+ //Lower prices than market increases sales
+ markup = mat.bCost / sCost;
+ }
+ }
+ //var businessFactor = 1 + (office.employeeProd[EmployeePositions.Business] / office.employeeProd["total"]);
+ var businessFactor = this.getBusinessFactor(office); //Business employee productivity
+ var advertisingFactor = this.getAdvertisingFactors()[0]; //Awareness + popularity
+ var marketFactor = this.getMarketFactor(mat); //Competition + demand
+ var maxSell = (mat.qlt + .001) * marketFactor * markup * businessFactor *
+ company.getSalesMultiplier() * advertisingFactor;
+
+ var sellAmt;
+ if (Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["isString"])(mat.sllman[1])) {
+ //Dynamically evaluated
+ var tmp = mat.sllman[1].replace(/MAX/g, maxSell);
+ tmp = tmp.replace(/PROD/g, mat.prd);
+ try {
+ sellAmt = eval(tmp);
+ } catch(e) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Error evaluating your sell amount for material " + mat.name +
+ " in " + this.name + "'s " + city + " office. The sell amount " +
+ "is being set to zero");
+ sellAmt = 0;
+ }
+ sellAmt = Math.min(maxSell, sellAmt);
+ } else if (mat.sllman[1] === -1) {
+ //Backwards compatibility, -1 = MAX
+ sellAmt = maxSell;
+ } else {
+ //Player's input value is just a number
+ sellAmt = Math.min(maxSell, mat.sllman[1]);
+ }
+
+ sellAmt = (sellAmt * SecsPerMarketCycle * marketCycles);
+ sellAmt = Math.min(mat.qty, sellAmt);
+ if (sellAmt < 0) {
+ console.log("sellAmt calculated to be negative");
+ mat.sll = 0;
+ continue;
+ }
+ if (sellAmt && sCost >= 0) {
+ mat.qty -= sellAmt;
+ revenue += (sellAmt * sCost);
+ mat.sll = sellAmt / (SecsPerMarketCycle * marketCycles);
+ } else {
+ mat.sll = 0;
+ }
+ }
+ } //End processing of sale of materials
+ break;
+
+ case "EXPORT":
+ for (var matName in warehouse.materials) {
+ if (warehouse.materials.hasOwnProperty(matName)) {
+ var mat = warehouse.materials[matName];
+ mat.totalExp = 0; //Reset export
+ for (var expI = 0; expI < mat.exp.length; ++expI) {
+ var exp = mat.exp[expI];
+ var amt = exp.amt.replace(/MAX/g, mat.qty / (SecsPerMarketCycle * marketCycles));
+ try {
+ amt = eval(amt);
+ } catch(e) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Calculating export for " + mat.name + " in " +
+ this.name + "'s " + city + " division failed with " +
+ "error: " + e);
+ continue;
+ }
+ if (isNaN(amt)) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Error calculating export amount for " + mat.name + " in " +
+ this.name + "'s " + city + " division.");
+ continue;
+ }
+ amt = amt * SecsPerMarketCycle * marketCycles;
+
+ if (mat.qty < amt) {
+ amt = mat.qty;
+ }
+ if (amt === 0) {
+ break; //None left
+ }
+ for (var foo = 0; foo < company.divisions.length; ++foo) {
+ if (company.divisions[foo].name === exp.ind) {
+ var expIndustry = company.divisions[foo];
+ var expWarehouse = expIndustry.warehouses[exp.city];
+ if (!(expWarehouse instanceof Warehouse)) {
+ console.log("ERROR: Invalid export! " + expIndustry.name + " " + exp.city);
+ break;
+ }
+
+ //Make sure theres enough space in warehouse
+ if (expWarehouse.sizeUsed >= expWarehouse.size) {
+ return; //Warehouse at capacity
+ } else {
+ var maxAmt = Math.floor((expWarehouse.size - expWarehouse.sizeUsed) / MaterialSizes[matName]);
+ amt = Math.min(maxAmt, amt);
+ }
+ expWarehouse.materials[matName].imp += (amt / (SecsPerMarketCycle * marketCycles));
+ expWarehouse.materials[matName].qty += amt;
+ expWarehouse.materials[matName].qlt = mat.qlt;
+ mat.qty -= amt;
+ mat.totalExp += amt;
+ expIndustry.updateWarehouseSizeUsed(expWarehouse);
+ break;
+ }
+ }
+ }
+ //totalExp should be per second
+ mat.totalExp /= (SecsPerMarketCycle * marketCycles);
+ }
+ }
+
+ break;
+
+ case "START":
+ break;
+ default:
+ console.log("ERROR: Invalid state: " + this.state);
+ break;
+ } //End switch(this.state)
+ this.updateWarehouseSizeUsed(warehouse);
+
+ } // End warehouse
+
+ //Produce Scientific Research based on R&D employees
+ //Scientific Research can be produced without a warehouse
+ if (office instanceof OfficeSpace) {
+ this.sciResearch.qty += (.005 * Math.pow(office.employeeProd[EmployeePositions.RandD], 0.5)
+ * company.getScientificResearchMultiplier());
+ }
+ }
+ return [revenue, expenses];
+}
+
+//Process production & sale of this industry's FINISHED products (including all of their stats)
+Industry.prototype.processProducts = function(marketCycles=1, corporation) {
+ var revenue = 0, expenses = 0;
+
+ //Create products
+ if (this.state === "PRODUCTION") {
+ for (var prodName in this.products) {
+ if (this.products.hasOwnProperty(prodName)) {
+ var prod = this.products[prodName];
+ if (!prod.fin) {
+ var city = prod.createCity, office = this.offices[city];
+ var total = office.employeeProd[EmployeePositions.Operations] +
+ office.employeeProd[EmployeePositions.Engineer] +
+ office.employeeProd[EmployeePositions.Management], ratio;
+ if (total === 0) {
+ ratio = 0;
+ } else {
+ ratio = office.employeeProd[EmployeePositions.Engineer] / total +
+ office.employeeProd[EmployeePositions.Operations] / total +
+ office.employeeProd[EmployeePositions.Management] / total;
+ }
+ prod.createProduct(marketCycles, ratio * Math.pow(total, 0.29));
+ if (prod.prog >= 100) {
+ prod.finishProduct(office.employeeProd, this);
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ //Produce Products
+ for (var prodName in this.products) {
+ if (this.products.hasOwnProperty(prodName)) {
+ var prod = this.products[prodName];
+ if (prod instanceof Product && prod.fin) {
+ revenue += this.processProduct(marketCycles, prod, corporation);
+ }
+ }
+ }
+ return [revenue, expenses];
+}
+
+//Processes FINISHED products
+Industry.prototype.processProduct = function(marketCycles=1, product, corporation) {
+ var totalProfit = 0;
+ for (var i = 0; i < Cities.length; ++i) {
+ var city = Cities[i], office = this.offices[city], warehouse = this.warehouses[city];
+ if (warehouse instanceof Warehouse) {
+ switch(this.state) {
+
+ case "PRODUCTION":
+ //Calculate the maximum production of this material based
+ //on the office's productivity
+ var maxProd = this.getOfficeProductivity(office, {forProduct:true}) *
+ corporation.getProductionMultiplier() * this.prodMult, prod;
+
+ //Account for whether production is manually limited
+ if (product.prdman[city][0]) {
+ prod = Math.min(maxProd, product.prdman[city][1]);
+ } else {
+ prod = maxProd;
+ }
+ prod *= (SecsPerMarketCycle * marketCycles);
+
+ //Calculate net change in warehouse storage making the Products will cost
+ var netStorageSize = product.siz;
+ for (var reqMatName in product.reqMats) {
+ if (product.reqMats.hasOwnProperty(reqMatName)) {
+ var normQty = product.reqMats[reqMatName];
+ netStorageSize -= (MaterialSizes[reqMatName] * normQty);
+ }
+ }
+
+ //If there's not enough space in warehouse, limit the amount of Product
+ if (netStorageSize > 0) {
+ var maxAmt = Math.floor((warehouse.size - warehouse.sizeUsed) / netStorageSize);
+ prod = Math.min(maxAmt, prod);
+ }
+
+ warehouse.smartSupplyStore += (prod / (SecsPerMarketCycle * marketCycles));
+
+ //Make sure we have enough resources to make our Products
+ var producableFrac = 1;
+ for (var reqMatName in product.reqMats) {
+ if (product.reqMats.hasOwnProperty(reqMatName)) {
+ var req = product.reqMats[reqMatName] * prod;
+ if (warehouse.materials[reqMatName].qty < req) {
+ producableFrac = Math.min(producableFrac, warehouse.materials[reqMatName].qty / req);
+ }
+ }
+ }
+
+ //Make our Products if they are producable
+ if (producableFrac > 0 && prod > 0) {
+ for (var reqMatName in product.reqMats) {
+ if (product.reqMats.hasOwnProperty(reqMatName)) {
+ var reqMatQtyNeeded = (product.reqMats[reqMatName] * prod * producableFrac);
+ warehouse.materials[reqMatName].qty -= reqMatQtyNeeded;
+ warehouse.materials[reqMatName].prd -= reqMatQtyNeeded / (SecsPerMarketCycle * marketCycles);
+ }
+ }
+ //Quantity
+ product.data[city][0] += (prod * producableFrac);
+ }
+
+ //Keep track of production Per second
+ product.data[city][1] = prod * producableFrac / (SecsPerMarketCycle * marketCycles);
+ break;
+
+ case "SALE":
+ //Process sale of Products
+ product.pCost = 0; //Estimated production cost
+ for (var reqMatName in product.reqMats) {
+ if (product.reqMats.hasOwnProperty(reqMatName)) {
+ product.pCost += (product.reqMats[reqMatName] * warehouse.materials[reqMatName].bCost);
+ }
+ }
+
+ //Since its a product, its production cost is increased for labor
+ product.pCost *= ProductProductionCostRatio;
+
+ //Calculate Sale Cost (sCost), which could be dynamically evaluated
+ var sCost;
+ if (Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["isString"])(product.sCost)) {
+ sCost = product.sCost.replace(/MP/g, product.pCost + product.rat / product.mku);
+ sCost = eval(sCost);
+ } else {
+ sCost = product.sCost;
+ }
+
+ var markup = 1, markupLimit = product.rat / product.mku;
+ if (sCost > product.pCost) {
+ if ((sCost - product.pCost) > markupLimit) {
+ markup = markupLimit / (sCost - product.pCost);
+ }
+ }
+ var businessFactor = this.getBusinessFactor(office); //Business employee productivity
+ var advertisingFactor = this.getAdvertisingFactors()[0]; //Awareness + popularity
+ var marketFactor = this.getMarketFactor(product); //Competition + demand
+ var maxSell = 0.5 * Math.pow(product.rat, 0.65) * marketFactor * corporation.getSalesMultiplier() *
+ Math.pow(markup, 2) * businessFactor * advertisingFactor;
+ var sellAmt;
+ if (product.sllman[city][0] && Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["isString"])(product.sllman[city][1])) {
+ //Sell amount is dynamically evaluated
+ var tmp = product.sllman[city][1].replace(/MAX/g, maxSell);
+ tmp = tmp.replace(/PROD/g, product.data[city][1]);
+ try {
+ tmp = eval(tmp);
+ } catch(e) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Error evaluating your sell price expression for " + product.name +
+ " in " + this.name + "'s " + city + " office. Sell price is being set to MAX");
+ tmp = maxSell;
+ }
+ sellAmt = Math.min(maxSell, tmp);
+ } else if (product.sllman[city][0] && product.sllman[city][1] > 0) {
+ //Sell amount is manually limited
+ sellAmt = Math.min(maxSell, product.sllman[city][1]);
+ } else {
+ //Backwards compatibility, -1 = 0
+ sellAmt = maxSell;
+ }
+ sellAmt = sellAmt * SecsPerMarketCycle * marketCycles;
+ sellAmt = Math.min(product.data[city][0], sellAmt); //data[0] is qty
+ if (sellAmt && sCost) {
+ product.data[city][0] -= sellAmt; //data[0] is qty
+ totalProfit += (sellAmt * sCost);
+ product.data[city][2] = sellAmt / (SecsPerMarketCycle * marketCycles); //data[2] is sell property
+ } else {
+ product.data[city][2] = 0; //data[2] is sell property
+ }
+ break;
+
+ case "START":
+ case "PURCHASE":
+ case "EXPORT":
+ break;
+ default:
+ console.log("ERROR: Invalid State: " + this.state);
+ break;
+ } //End switch(this.state)
+ }
+ }
+ return totalProfit;
+}
+
+Industry.prototype.discontinueProduct = function(product, parentRefs) {
+ var company = parentRefs.company, industry = parentRefs.industry;
+ for (var productName in this.products) {
+ if (this.products.hasOwnProperty(productName)) {
+ if (product === this.products[productName]) {
+ delete this.products[productName];
+ company.updateUIContent();
+ }
+ }
+ }
+}
+
+Industry.prototype.upgrade = function(upgrade, refs) {
+ var corporation = refs.corporation, division = refs.division,
+ office = refs.office;
+ var upgN = upgrade[0], basePrice = upgrade[1], priceMult = upgrade[2],
+ upgradeBenefit = upgrade[3];
+ while (this.upgrades.length <= upgN) {this.upgrades.push(0);}
+ ++this.upgrades[upgN];
+
+ switch (upgN) {
+ case 0: //Coffee, 5% energy per employee
+ for (var i = 0; i < office.employees.length; ++i) {
+ office.employees[i].ene = Math.min(office.employees[i].ene * 1.05, 100);
+ }
+ break;
+ case 1: //AdVert.Inc,
+ var advMult = corporation.getAdvertisingMultiplier();
+ this.awareness += (3 * advMult);
+ this.popularity += (1 * advMult);
+ this.awareness *= (1.01 * advMult);
+ this.popularity *= ((1 + Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(1, 3) / 100) * advMult);
+ break;
+ default:
+ console.log("ERROR: Un-implemented function index: " + upgN);
+ break;
+ }
+}
+
+//Returns how much of a material can be produced based of office productivity (employee stats)
+Industry.prototype.getOfficeProductivity = function(office, params) {
+ var total = office.employeeProd[EmployeePositions.Operations] +
+ office.employeeProd[EmployeePositions.Engineer] +
+ office.employeeProd[EmployeePositions.Management], ratio;
+ if (total === 0) {
+ ratio = 0;
+ } else {
+ ratio = (office.employeeProd[EmployeePositions.Operations] / total) *
+ (office.employeeProd[EmployeePositions.Engineer] / total) *
+ (office.employeeProd[EmployeePositions.Management] / total);
+ ratio = Math.max(0.01, ratio); //Minimum ratio value if you have employees
+ }
+ if (params && params.forProduct) {
+ return ratio * Math.pow(total, 0.2);
+ } else {
+ return 2 * ratio * Math.pow(total, 0.3);
+ }
+}
+
+//Returns a multiplier based on the office' 'Business' employees that affects sales
+Industry.prototype.getBusinessFactor = function(office) {
+ var ratioMult = 1;
+ if (office.employeeProd["total"] > 0) {
+ ratioMult = 1 + (office.employeeProd[EmployeePositions.Business] / office.employeeProd["total"]);
+ }
+ return ratioMult * Math.pow(1 + office.employeeProd[EmployeePositions.Business], 0.15);
+}
+
+//Returns a set of multipliers based on the Industry's awareness, popularity, and advFac. This
+//multiplier affects sales. The result is:
+// [Total sales mult, total awareness mult, total pop mult, awareness/pop ratio mult]
+Industry.prototype.getAdvertisingFactors = function() {
+ var awarenessFac = Math.pow(this.awareness + 1, this.advFac);
+ var popularityFac = Math.pow(this.popularity + 1, this.advFac);
+ var ratioFac = (this.awareness === 0 ? 0.01 : Math.max((this.popularity + .001) / this.awareness, 0.01));
+ var totalFac = Math.pow(awarenessFac * popularityFac * ratioFac, 0.85);
+ return [totalFac, awarenessFac, popularityFac, ratioFac];
+}
+
+//Returns a multiplier based on a materials demand and competition that affects sales
+Industry.prototype.getMarketFactor = function(mat) {
+ return mat.dmd * (100 - mat.cmp)/100;
+}
+
+Industry.prototype.toJSON = function() {
+ return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Generic_toJSON"])("Industry", this);
+}
+
+Industry.fromJSON = function(value) {
+ return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Generic_fromJSON"])(Industry, value.data);
+}
+
+_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Reviver"].constructors.Industry = Industry;
+
+var EmployeePositions = {
+ Operations: "Operations",
+ Engineer: "Engineer",
+ Business: "Business",
+ Management: "Management",
+ RandD: "Research & Development",
+ Training:"Training",
+ Unassigned:"Unassigned",
+}
+
+function Employee(params={}) {
+ if (!(this instanceof Employee)) {
+ return new Employee(params);
+ }
+ this.name = params.name ? params.name : "Bobby";
+
+ //Morale, happiness, and energy are 0-100
+ this.mor = params.morale ? params.morale : Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(50, 100);
+ this.hap = params.happiness ? params.happiness : Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(50, 100);
+ this.ene = params.energy ? params.energy : Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(50, 100);
+
+ this.age = params.age ? params.age : Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(20, 50);
+ this.int = params.intelligence ? params.intelligence : Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(10, 50);
+ this.cha = params.charisma ? params.charisma : Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(10, 50);
+ this.exp = params.experience ? params.experience : Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(10, 50);
+ this.cre = params.creativity ? params.creativity : Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(10, 50);
+ this.eff = params.efficiency ? params.efficiency : Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(10, 50);
+ this.sal = params.salary ? params.salary : Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(0.1, 5);
+ this.pro = 0; //Productivity, This is calculated
+
+ this.loc = params.loc ? params.loc : "";
+ this.pos = EmployeePositions.Unassigned;
+}
+
+//Returns the amount the employee needs to be paid
+Employee.prototype.process = function(marketCycles=1, office) {
+ var gain = 0.001 * marketCycles,
+ det = gain * Math.random();
+ this.age += gain;
+ this.exp += gain;
+ if (this.age > 150) {
+ this.int -= det;
+ this.eff -= det;
+ this.cha -= det;
+ }
+
+ //Training
+ var trainingEff = gain * Math.random();
+ if (this.pos === EmployeePositions.Training) {
+ //To increase creativity and intelligence special upgrades are needed
+ this.cha += trainingEff;
+ this.exp += trainingEff;
+ this.eff += trainingEff;
+ }
+
+ //Weight based on how full office is
+ //Too many employees = more likely to decrease energy and happiness
+ var officeCapacityWeight = 0.5 * (office.employees.length / office.size - 0.5);
+ if (Math.random() < 0.5 - officeCapacityWeight) {
+ this.ene += det;
+ this.hap += det;
+ } else {
+ this.ene -= det;
+ this.hap -= det;
+ }
+ if (this.ene < office.minEne) {this.ene = office.minEne;}
+ if (this.hap < office.minHap) {this.hap = office.minHap;}
+ var salary = this.sal * marketCycles * SecsPerMarketCycle;
+ return salary;
+}
+
+Employee.prototype.calculateProductivity = function(corporation) {
+ var effCre = this.cre * corporation.getEmployeeCreMultiplier(),
+ effCha = this.cha * corporation.getEmployeeChaMultiplier(),
+ effInt = this.int * corporation.getEmployeeIntMultiplier(),
+ effEff = this.eff * corporation.getEmployeeEffMultiplier();
+ var prodBase = this.mor * this.hap * this.ene * 1e-6, prodMult;
+ switch(this.pos) {
+ //Calculate productivity based on position. This is multipled by prodBase
+ //to get final value
+ case EmployeePositions.Operations:
+ prodMult = (0.6 * effInt) + (0.1 * effCha) + (this.exp) +
+ (0.5 * effCre) + (effEff);
+ break;
+ case EmployeePositions.Engineer:
+ prodMult = (effInt) + (0.1 * effCha) + (1.5 * this.exp) +
+ (effEff);
+ break;
+ case EmployeePositions.Business:
+ prodMult = (0.4 * effInt) + (effCha) + (0.5 * this.exp);
+ break;
+ case EmployeePositions.Management:
+ prodMult = (2 * effCha) + (this.exp) + (0.2 * effCre) +
+ (0.7 * effEff);
+ break;
+ case EmployeePositions.RandD:
+ prodMult = (1.5 * effInt) + (0.8 * this.exp) + (effCre) +
+ (0.5 * effEff);
+ break;
+ case EmployeePositions.Unassigned:
+ case EmployeePositions.Training:
+ prodMult = 0;
+ break;
+ default:
+ console.log("ERROR: Invalid employee position: " + this.pos);
+ break;
+ }
+ return prodBase * prodMult;
+}
+
+//Process benefits from having an office party thrown
+Employee.prototype.throwParty = function(money) {
+ var mult = 1 + (money / 10e6);
+ this.mor *= mult;
+ this.mor = Math.min(100, this.mor);
+ this.hap *= mult;
+ this.hap = Math.min(100, this.hap);
+ return mult;
+}
+
+//'panel' is the DOM element on which to create the UI
+Employee.prototype.createUI = function(panel, corporation) {
+ var effCre = this.cre * corporation.getEmployeeCreMultiplier(),
+ effCha = this.cha * corporation.getEmployeeChaMultiplier(),
+ effInt = this.int * corporation.getEmployeeIntMultiplier(),
+ effEff = this.eff * corporation.getEmployeeEffMultiplier();
+ panel.style.color = "white";
+ panel.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
+ id:"cmpy-mgmt-employee-" + this.name + "-panel-text",
+ innerHTML:"Morale: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(this.mor, 3) + "
" +
+ "Happiness: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(this.hap, 3) + "
" +
+ "Energy: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(this.ene, 3) + "
" +
+ "Age: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(this.age, 3) + "
" +
+ "Intelligence: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(effInt, 3) + "
" +
+ "Charisma: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(effCha, 3) + "
" +
+ "Experience: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(this.exp, 3) + "
" +
+ "Creativity: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(effCre, 3) + "
" +
+ "Efficiency: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(effEff, 3) + "
" +
+ "Salary: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(this.sal).format("$0.000a") + "/ s
",
+ }));
+
+ //Selector for employee position
+ var selector = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("select", {});
+ for (var key in EmployeePositions) {
+ if (EmployeePositions.hasOwnProperty(key)) {
+ selector.add(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("option", {
+ text: EmployeePositions[key],
+ value: EmployeePositions[key],
+ }));
+ }
+ }
+
+ selector.addEventListener("change", ()=>{
+ this.pos = selector.options[selector.selectedIndex].value;
+ });
+
+ //Set initial value of selector
+ for (var i = 0; i < selector.length; ++i) {
+ if (selector.options[i].value === this.pos) {
+ selector.selectedIndex = i;
+ break;
+ }
+ }
+ panel.appendChild(selector);
+}
+
+Employee.prototype.updateUI = function(panel, corporation) {
+ var effCre = this.cre * corporation.getEmployeeCreMultiplier(),
+ effCha = this.cha * corporation.getEmployeeChaMultiplier(),
+ effInt = this.int * corporation.getEmployeeIntMultiplier(),
+ effEff = this.eff * corporation.getEmployeeEffMultiplier();
+ if (panel == null) {
+ console.log("ERROR: Employee.updateUI() called with null panel");
+ return;
+ }
+ var text = document.getElementById("cmpy-mgmt-employee-" + this.name + "-panel-text");
+ if (text == null) {
+ return this.createUI(panel);
+ }
+ text.innerHTML = "Morale: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(this.mor, 3) + "
" +
+ "Happiness: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(this.hap, 3) + "
" +
+ "Energy: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(this.ene, 3) + "
" +
+ "Age: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(this.age, 3) + "
" +
+ "Intelligence: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(effInt, 3) + "
" +
+ "Charisma: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(effCha, 3) + "
" +
+ "Experience: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(this.exp, 3) + "
" +
+ "Creativity: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(effCre, 3) + "
" +
+ "Efficiency: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(effEff, 3) + "
" +
+ "Salary: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(this.sal).format("$0.000a") + "/ s
";
+}
+
+Employee.prototype.toJSON = function() {
+ return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Generic_toJSON"])("Employee", this);
+}
+
+Employee.fromJSON = function(value) {
+ return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Generic_fromJSON"])(Employee, value.data);
+}
+
+_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Reviver"].constructors.Employee = Employee;
+
+var OfficeSpaceTiers = {
+ Basic: "Basic",
+ Enhanced: "Enhanced",
+ Luxurious: "Luxurious",
+ Extravagant: "Extravagant"
+}
+
+function OfficeSpace(params={}) {
+ this.loc = params.loc ? params.loc : "";
+ this.cost = params.cost ? params.cost : 1;
+ this.size = params.size ? params.size : 1;
+ this.comf = params.comfort ? params.comfort : 1;
+ this.beau = params.beauty ? params.beauty : 1;
+ this.tier = OfficeSpaceTiers.Basic;
+
+ this.minEne = 0; //Minimum energy of employees, based on office
+ this.minHap = 0; //Minimum happiness of employees, based on office.
+
+ this.employees = [];
+ this.employeeProd = {
+ [EmployeePositions.Operations]: 0,
+ [EmployeePositions.Engineer]: 0,
+ [EmployeePositions.Business]: 0,
+ [EmployeePositions.Management]: 0,
+ [EmployeePositions.RandD]: 0,
+ total: 0,
+ };
+}
+
+OfficeSpace.prototype.process = function(marketCycles=1, parentRefs) {
+ var corporation = parentRefs.corporation, industry = parentRefs.industry;
+ var perfMult=1; //Multiplier for employee morale/happiness/energy based on company performance
+ if (industry.funds < 0 && industry.lastCycleRevenue < 0) {
+ perfMult = Math.pow(0.99, marketCycles);
+ } else if (industry.funds > 0 && industry.lastCycleRevenue > 0) {
+ perfMult = Math.pow(1.01, marketCycles);
+ }
+
+ var salaryPaid = 0;
+ for (var i = 0; i < this.employees.length; ++i) {
+ var emp = this.employees[i];
+ emp.mor *= perfMult;
+ emp.hap *= perfMult;
+ emp.ene *= perfMult;
+ var salary = emp.process(marketCycles, this);
+ salaryPaid += salary;
+ }
+ this.calculateEmployeeProductivity(marketCycles, corporation);
+ return salaryPaid;
+}
+
+OfficeSpace.prototype.calculateEmployeeProductivity = function(marketCycles=1, corporation) {
+ //Reset
+ for (var name in this.employeeProd) {
+ if (this.employeeProd.hasOwnProperty(name)) {
+ this.employeeProd[name] = 0;
+ }
+ }
+
+ var total = 0;
+ for (var i = 0; i < this.employees.length; ++i) {
+ var employee = this.employees[i];
+ var prod = employee.calculateProductivity(corporation);
+ this.employeeProd[employee.pos] += prod;
+ total += prod;
+ }
+ this.employeeProd["total"] = total;
+}
+
+//Takes care of UI as well
+OfficeSpace.prototype.findEmployees = function(parentRefs) {
+ var company = parentRefs.corporation, division = parentRefs.division;
+ if (document.getElementById("cmpy-mgmt-hire-employee-popup") != null) {return;}
+
+ //Generate three random employees (meh, decent, amazing)
+ var mult1 = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(25, 50)/100,
+ mult2 = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(51, 75)/100,
+ mult3 = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(76, 100)/100;
+ var int = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(50, 100),
+ cha = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(50, 100),
+ exp = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(50, 100),
+ cre = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(50, 100),
+ eff = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(50, 100),
+ sal = 2.2 * (int + cha + exp + cre + eff);
+
+ var emp1 = new Employee({
+ intelligence: int * mult1,
+ charisma: cha * mult1,
+ experience: exp * mult1,
+ creativity: cre * mult1,
+ efficiency: eff * mult1,
+ salary: sal * mult1,
+ });
+
+ var emp2 = new Employee({
+ intelligence: int * mult2,
+ charisma: cha * mult2,
+ experience: exp * mult2,
+ creativity: cre * mult2,
+ efficiency: eff * mult2,
+ salary: sal * mult2,
+ });
+
+ var emp3 = new Employee({
+ intelligence: int * mult3,
+ charisma: cha * mult3,
+ experience: exp * mult3,
+ creativity: cre * mult3,
+ efficiency: eff * mult3,
+ salary: sal * mult3,
+ });
+
+ var text = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("h1", {
+ innerHTML: "Select one of the following candidates for hire:",
+ });
+
+ var createEmpDiv = function(employee, office) {
+ var div = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {
+ class:"cmpy-mgmt-find-employee-option",
+ innerHTML: "Intelligence: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(employee.int, 1) + "
" +
+ "Charisma: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(employee.cha, 1) + "
" +
+ "Experience: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(employee.exp, 1) + "
" +
+ "Creativity: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(employee.cre, 1) + "
" +
+ "Efficiency: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(employee.eff, 1) + "
" +
+ "Salary: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(employee.sal).format('$0.000a') + " \ s
",
+ clickListener:()=>{
+ office.hireEmployee(employee, parentRefs);
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])("cmpy-mgmt-hire-employee-popup");
+ return false;
+ }
+ });
+ return div;
+ };
+
+ var cancelBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ class:"a-link-button",
+ innerText:"Cancel",
+ float:"right",
+ clickListener:()=>{
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])("cmpy-mgmt-hire-employee-popup");
+ return false;
+ }
+ });
+
+ var elems = [text,
+ createEmpDiv(emp1, this),
+ createEmpDiv(emp2, this),
+ createEmpDiv(emp3, this),
+ cancelBtn];
+
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createPopup"])("cmpy-mgmt-hire-employee-popup", elems);
+}
+
+OfficeSpace.prototype.hireEmployee = function(employee, parentRefs) {
+ var company = parentRefs.corporation, division = parentRefs.division;
+ var yesBtn = Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_12__["yesNoTxtInpBoxGetYesButton"])(),
+ noBtn = Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_12__["yesNoTxtInpBoxGetNoButton"])();
+ yesBtn.innerHTML = "Hire";
+ noBtn.innerHTML = "Cancel";
+ yesBtn.addEventListener("click", ()=>{
+ var name = Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_12__["yesNoTxtInpBoxGetInput"])();
+ for (var i = 0; i < this.employees.length; ++i) {
+ if (this.employees[i].name === name) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("You already have an employee with this nickname! Please give every employee a unique nickname.");
+ return false;
+ }
+ }
+ employee.name = name;
+ this.employees.push(employee);
+ company.displayDivisionContent(division, currentCityUi);
+ return Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_12__["yesNoTxtInpBoxClose"])();
+ });
+ noBtn.addEventListener("click", ()=>{
+ return Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_12__["yesNoTxtInpBoxClose"])();
+ });
+ Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_12__["yesNoTxtInpBoxCreate"])("Give your employee a nickname!");
+}
+
+OfficeSpace.prototype.hireRandomEmployee = function(parentRefs) {
+ var company = parentRefs.corporation, division = parentRefs.division;
+ if (document.getElementById("cmpy-mgmt-hire-employee-popup") != null) {return;}
+
+ //Generate three random employees (meh, decent, amazing)
+ var mult = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(76, 100)/100;
+ var int = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(50, 100),
+ cha = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(50, 100),
+ exp = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(50, 100),
+ cre = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(50, 100),
+ eff = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["getRandomInt"])(50, 100),
+ sal = 2.2 * (int + cha + exp + cre + eff);
+
+ var emp = new Employee({
+ intelligence: int * mult,
+ charisma: cha * mult,
+ experience: exp * mult,
+ creativity: cre * mult,
+ efficiency: eff * mult,
+ salary: sal * mult,
+ });
+
+ var name = Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["generateRandomString"])(7);
+
+ for (var i = 0; i < this.employees.length; ++i) {
+ if (this.employees[i].name === name) {
+ return this.hireRandomEmployee(parentRefs);
+ }
+ }
+ emp.name = name;
+ this.employees.push(emp);
+ company.displayDivisionContent(division, currentCityUi);
+}
+
+//Finds the first unassigned employee and assigns its to the specified job
+OfficeSpace.prototype.assignEmployeeToJob = function(job) {
+ for (var i = 0; i < this.employees.length; ++i) {
+ if (this.employees[i].pos === EmployeePositions.Unassigned) {
+ this.employees[i].pos = job;
+ return true;
+ }
+ }
+ return false;
+}
+
+//Finds the first employee with the given job and unassigns it
+OfficeSpace.prototype.unassignEmployeeFromJob = function(job) {
+ for (var i = 0; i < this.employees.length; ++i) {
+ if (this.employees[i].pos === job) {
+ this.employees[i].pos = EmployeePositions.Unassigned;
+ return true;
+ }
+ }
+ return false;
+}
+
+OfficeSpace.prototype.toJSON = function() {
+ return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Generic_toJSON"])("OfficeSpace", this);
+}
+
+OfficeSpace.fromJSON = function(value) {
+ return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Generic_fromJSON"])(OfficeSpace, value.data);
+}
+
+_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Reviver"].constructors.OfficeSpace = OfficeSpace;
+
+function Warehouse(params={}) {
+ this.loc = params.loc ? params.loc : "";
+ this.size = params.size ? params.size : 0;
+ this.level = 0;
+ this.sizeUsed = 0;
+ this.smartSupplyEnabled = false; //Whether or not smart supply is enabled
+ this.breakdown = "";
+
+ //Stores the amount of product to be produced. Used for Smart Supply unlock.
+ //The production tracked by smart supply is always based on the previous cycle,
+ //so it will always trail the "true" production by 1 cycle
+ this.smartSupplyStore = 0;
+
+ this.materials = {
+ Water: new Material({name: "Water"}),
+ Energy: new Material({name: "Energy"}),
+ Food: new Material({name: "Food"}),
+ Plants: new Material({name: "Plants"}),
+ Metal: new Material({name: "Metal"}),
+ Hardware: new Material({name: "Hardware"}),
+ Chemicals: new Material({name: "Chemicals"}),
+ Drugs: new Material({name: "Drugs"}),
+ Robots: new Material({name: "Robots"}),
+ AICores: new Material({name: "AI Cores"}),
+ RealEstate: new Material({name: "Real Estate"})
+ }
+}
+
+Warehouse.prototype.updateMaterialSizeUsed = function() {
+ this.sizeUsed = 0;
+ this.breakdown = "";
+ for (var matName in this.materials) {
+ if (this.materials.hasOwnProperty(matName)) {
+ var mat = this.materials[matName];
+ if (MaterialSizes.hasOwnProperty(matName)) {
+ this.sizeUsed += (mat.qty * MaterialSizes[matName]);
+ if (mat.qty > 0) {
+ this.breakdown += (matName + ": " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(mat.qty * MaterialSizes[matName], 0) + "
");
+ }
+ }
+ }
+ }
+ if (this.sizeUsed > this.size) {
+ console.log("ERROR: Warehouse size used greater than capacity, something went wrong");
+ }
+}
+
+Warehouse.prototype.updateSize = function(corporation) {
+ //Backwards compatibility
+ if (this.level == null || this.level === 0) {
+ this.level = Math.round(this.size / 100);
+ }
+
+ this.size = (this.level * 100) * corporation.getStorageMultiplier();
+}
+
+Warehouse.prototype.createUI = function(parentRefs) {
+ if (parentRefs.company == null || parentRefs.industry == null) {
+ console.log("ERROR: Warehouse.createUI called without parentRefs.company or parentRefs.industry");
+ return;
+ }
+ var company = parentRefs.company, industry = parentRefs.industry;
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeChildrenFromElement"])(industryWarehousePanel);
+ industryWarehouseStorageText = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
+ display:"inline-block", class:"tooltip",
+ color: this.sizeUsed >= this.size ? "red" : "white",
+ });
+ industryWarehousePanel.appendChild(industryWarehouseStorageText);
+
+ //Upgrade warehouse size button
+ var upgradeCost = WarehouseUpgradeBaseCost * Math.pow(1.07, this.level+1);
+ industryWarehouseUpgradeSizeButton = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ innerText:"Upgrade Warehouse Size - " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(upgradeCost).format('$0.000a'),
+ display:"inline-block",
+ class: company.funds.lt(upgradeCost) ? "a-link-button-inactive" : "a-link-button",
+ clickListener:()=>{
+ //Backwards compatibility
+ if (this.level == null || this.level === 0) {
+ this.level = Math.round(this.size / 100);
+ }
+
+ ++this.level;
+ this.updateSize(company);
+ company.funds = company.funds.minus(upgradeCost);
+ this.createUI(parentRefs);
+ return;
+ }
+ });
+ industryWarehousePanel.appendChild(industryWarehouseUpgradeSizeButton);
+
+ //Material requirement text
+ var reqText = "This Industry uses [" + Object.keys(industry.reqMats).join(", ") +
+ "] in order to ";
+ if (industry.prodMats.length > 0) {
+ reqText += "produce [" + industry.prodMats.join(", ") + "] ";
+ if (industry.makesProducts) {
+ reqText += " and " + industry.getProductDescriptionText();
+ }
+ } else if (industry.makesProducts) {
+ reqText += industry.getProductDescriptionText();
+ }
+ reqText += "
To get started with production, purchase your required " +
+ "materials or import them from another of your company's divisions.
";
+
+ //Material ratio text for tooltip
+ var reqRatioText = "The exact requirements for production are:
";
+ for (var matName in industry.reqMats) {
+ if (industry.reqMats.hasOwnProperty(matName)) {
+ reqRatioText += (industry.reqMats[matName] + " " + matName + "
");
+ }
+ }
+ reqRatioText += "in order to create ";
+ if (industry.prodMats.length > 0) {
+ reqRatioText += "one of each produced Material (" + industry.prodMats.join(", ") + ") ";
+ if (industry.makesProducts) {
+ reqRatioText += "or to create one of its Products";
+ }
+ } else if (industry.makesProducts) {
+ reqRatioText += "one of its Products";
+ }
+
+ industryWarehousePanel.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
+ innerHTML:reqText, tooltipleft:reqRatioText
+ }));
+
+ //Current state
+ industryWarehouseStateText = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p");
+ industryWarehousePanel.appendChild(industryWarehouseStateText);
+
+ //Smart Supply Enable/Disable
+ if (company.unlockUpgrades[1]) {
+ if (this.smartSupplyEnabled == null) {this.smartSupplyEnabled = false;}
+ var smartSupplyCheckboxId = "cmpy-mgmt-smart-supply-checkbox";
+ industryWarehousePanel.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("label", {
+ for:smartSupplyCheckboxId, innerText:"Enable Smart Supply",
+ color:"white"
+ }));
+ industrySmartSupplyCheckbox = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("input", {
+ type:"checkbox", id:smartSupplyCheckboxId, margin:"3px",
+ changeListener:()=>{
+ this.smartSupplyEnabled = industrySmartSupplyCheckbox.checked;
+ }
+ });
+ industrySmartSupplyCheckbox.checked = this.smartSupplyEnabled;
+ industryWarehousePanel.appendChild(industrySmartSupplyCheckbox);
+ }
+
+ //Materials
+ industryWarehousePanel.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
+ innerHTML: "
Materials:
",
+ }));
+ industryWarehouseMaterials = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("ul");
+ industryWarehousePanel.appendChild(industryWarehouseMaterials);
+
+ //Products
+ if (industry.makesProducts && Object.keys(industry.products).length > 0) {
+ industryWarehousePanel.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
+ innerHTML: "
Products:
",
+ }));
+ industryWarehouseProducts = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("ul");
+ industryWarehousePanel.appendChild(industryWarehouseProducts);
+ }
+
+ this.updateUI(parentRefs);
+}
+
+Warehouse.prototype.updateUI = function(parentRefs) {
+ if (parentRefs.company == null || parentRefs.industry == null) {
+ console.log("ERROR: Warehouse.updateUI called without parentRefs.company or parentRefs.industry");
+ return;
+ }
+ var company = parentRefs.company, industry = parentRefs.industry;
+
+ //Storage text
+ var storageText = "Storage: " +
+ (this.sizedUsed >= this.size ? Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(this.sizeUsed, 3) : Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(this.sizeUsed, 3)) +
+ "/" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(this.size, 3);
+ if (this.breakdown != null && this.breakdown != "") {
+ storageText += ("" +
+ this.breakdown + "");
+ }
+ industryWarehouseStorageText.innerHTML = storageText;
+
+ //Upgrade warehouse size button
+ var upgradeCost = WarehouseUpgradeBaseCost * Math.pow(1.07, this.level+1);
+ if (company.funds.lt(upgradeCost)) {
+ industryWarehouseUpgradeSizeButton.className = "a-link-button-inactive";
+ } else {
+ industryWarehouseUpgradeSizeButton.className = "a-link-button";
+ }
+
+ //Current state
+ var stateText = "Current state: ";
+ switch(industry.state) {
+ case "START":
+ stateText += "Preparing...";
+ break;
+ case "PURCHASE":
+ stateText += "Purchasing materials...";
+ break;
+ case "PRODUCTION":
+ stateText += "Producing materials and/or products...";
+ break;
+ case "SALE":
+ stateText += "Selling materials and/or products...";
+ break;
+ case "EXPORT":
+ stateText += "Exporting materials and/or products...";
+ break;
+ default:
+ console.log("ERROR: Invalid state: " + industry.state);
+ break;
+ }
+ industryWarehouseStateText.innerText = stateText;
+
+ //Materials
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeChildrenFromElement"])(industryWarehouseMaterials);
+ for (var matName in this.materials) {
+ if (this.materials.hasOwnProperty(matName) && this.materials[matName] instanceof Material) {
+ if (Object.keys(industry.reqMats).includes(matName) || industry.prodMats.includes(matName) ||
+ matName === "Hardware" || matName === "Robots" || matName === "AICores" ||
+ matName === "RealEstate") {
+ industryWarehouseMaterials.appendChild(this.createMaterialUI(this.materials[matName], matName, parentRefs));
+ }
+ }
+ }
+
+ //Products
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeChildrenFromElement"])(industryWarehouseProducts);
+ if (industry.makesProducts && Object.keys(industry.products).length > 0) {
+ for (var productName in industry.products) {
+ if (industry.products.hasOwnProperty(productName) && industry.products[productName] instanceof Product) {
+ industryWarehouseProducts.appendChild(this.createProductUI(industry.products[productName], parentRefs));
+ }
+ }
+ }
+}
+
+Warehouse.prototype.createMaterialUI = function(mat, matName, parentRefs) {
+ if (parentRefs.company == null || parentRefs.industry == null) {
+ console.log("ERROR: Warehouse.createMaterialUI called without industry or company parent refs");
+ return;
+ }
+ var company = parentRefs.company, industry = parentRefs.industry;
+ var purchasePopupId = "cmpy-mgmt-material-purchase-popup",
+ sellPopupid = "cmpy-mgmt-material-sell-popup";
+ var div = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {
+ class:"cmpy-mgmt-warehouse-material-div",
+ });
+
+ var totalGain = mat.buy + mat.prd + mat.imp - mat.sll - mat.totalExp;
+
+ //If Market Research upgrades are unlocked, add competition and demand info
+ var cmpAndDmdText = "";
+ if (company.unlockUpgrades[2] === 1) {
+ cmpAndDmdText += "
Competition: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(mat.cmp, 3);
+ }
+ if (company.unlockUpgrades[3] === 1) {
+ cmpAndDmdText += "
Demand: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(mat.dmd, 3);
+ }
+ var innerTxt = "
Prod: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(mat.prd, 3) + "/s
Sell: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(mat.sll, 3) +
+ "/s
Export: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(mat.totalExp, 3) + "/s
Import: " +
+ Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(mat.imp, 3) + "/s" + cmpAndDmdText + "
" +
+ "
" +
+ "
" +
+ "City: " + mat.exp[i].city + "
" +
+ "Amount/s: " + mat.exp[i].amt,
+ clickListener:()=>{
+ mat.exp.splice(i, 1); //Remove export object
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
+ createExportPopup();
+ }
+ }));
+ })(i, mat, currExports);
+ }
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createPopup"])(popupId, [exportTxt, industrySelector, citySelector, exportAmount,
+ exportBtn, cancelBtn, currExportsText].concat(currExports));
+ }
+ buttonPanel.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ innerText:"Export", display:"inline-block", class:"a-link-button",
+ clickListener:()=>{createExportPopup();}
+ }));
+ }
+
+ buttonPanel.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("br", {})); // Force line break
+
+ //Button to set sell amount
+ var innerTextString;
+ if (mat.sllman[0]) {
+ innerTextString = (mat.sllman[1] === -1 ? "Sell (" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(mat.sll, 3) + "/MAX)" :
+ "Sell (" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(mat.sll, 3) + "/" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(mat.sllman[1], 3) + ")");
+ if (mat.sCost) {
+ if (Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["isString"])(mat.sCost)) {
+ var sCost = mat.sCost.replace(/MP/g, mat.bCost);
+ innerTextString += " @ $" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(eval(sCost), 2);
+ } else {
+ innerTextString += " @ $" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(mat.sCost, 2);
+ }
+ }
+ } else {
+ innerTextString = "Sell (0.000/0.000)";
+ }
+
+ buttonPanel.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ innerText: innerTextString, display:"inline-block", class:"a-link-button",
+ clickListener:()=>{
+ var txt = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
+ innerHTML: "Enter the maximum amount of " + mat.name + " you would like " +
+ "to sell per second, as well as the price at which you would " +
+ "like to sell at.
" +
+ "If the sell amount is set to 0, then the material will not be sold. If the sell price " +
+ "if set to 0, then the material will be discarded
" +
+ "Setting the sell amount to 'MAX' will result in you always selling the " +
+ "maximum possible amount of the material.
" +
+ "When setting the sell amount, you can use the 'PROD' variable to designate a dynamically " +
+ "changing amount that depends on your production. For example, if you set the sell amount " +
+ "to 'PROD-5' then you will always sell 5 less of the material than you produce.
" +
+ "When setting the sell price, you can use the 'MP' variable to designate a dynamically " +
+ "changing price that depends on the market price. For example, if you set the sell price " +
+ "to 'MP+10' then it will always be sold at $10 above the market price.",
+ });
+ var br = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("br", {});
+ var confirmBtn;
+ var inputQty = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("input", {
+ type:"text", marginTop:"4px",
+ value: mat.sllman[1] ? mat.sllman[1] : null, placeholder: "Sell amount",
+ onkeyup:(e)=>{
+ e.preventDefault();
+ if (e.keyCode === 13) {confirmBtn.click();}
+ }
+ });
+ var inputPx = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("input", {
+ type:"text", marginTop:"4px",
+ value: mat.sCost ? mat.sCost : null, placeholder: "Sell price",
+ onkeyup:(e)=>{
+ e.preventDefault();
+ if (e.keyCode === 13) {confirmBtn.click();}
+ }
+ });
+ confirmBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ innerText:"Confirm", class:"a-link-button", margin:"6px",
+ clickListener:()=>{
+ //Parse price
+ var cost = inputPx.value.replace(/\s+/g, '');
+ cost = cost.replace(/[^-()\d/*+.MP]/g, ''); //Sanitize cost
+ var temp = cost.replace(/MP/g, mat.bCost);
+ try {
+ temp = eval(temp);
+ } catch(e) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Invalid value or expression for sell price field: " + e);
+ return false;
+ }
+
+ if (temp == null || isNaN(temp)) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Invalid value or expression for sell price field");
+ return false;
+ }
+
+ if (cost.includes("MP")) {
+ mat.sCost = cost; //Dynamically evaluated
+ } else {
+ mat.sCost = temp;
+ }
+
+ //Parse quantity
+ if (inputQty.value.includes("MAX") || inputQty.value.includes("PROD")) {
+ var qty = inputQty.value.replace(/\s+/g, '');
+ qty = qty.replace(/[^-()\d/*+.MAXPROD]/g, '');
+ var temp = qty.replace(/MAX/g, 1);
+ temp = temp.replace(/PROD/g, 1);
+ try {
+ temp = eval(temp);
+ } catch(e) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Invalid value or expression for sell price field: " + e);
+ return false;
+ }
+
+ if (temp == null || isNaN(temp)) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Invalid value or expression for sell price field");
+ return false;
+ }
+
+ mat.sllman[0] = true;
+ mat.sllman[1] = qty; //Use sanitized input
+ } else if (isNaN(inputQty.value)) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Invalid value for sell quantity field! Must be numeric or 'MAX'");
+ return false;
+ } else {
+ var qty = parseFloat(inputQty.value);
+ if (isNaN(qty)) {qty = 0;}
+ if (qty === 0) {
+ mat.sllman[0] = false;
+ mat.sllman[1] = 0;
+ } else {
+ mat.sllman[0] = true;
+ mat.sllman[1] = qty;
+ }
+ }
+
+ this.createUI(parentRefs);
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(sellPopupid);
+ return false;
+ }
+ });
+ var cancelBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ innerText:"Cancel", class:"a-link-button", margin: "6px",
+ clickListener:()=>{
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(sellPopupid);
+ }
+ });
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createPopup"])(sellPopupid, [txt, br, inputQty, inputPx, confirmBtn, cancelBtn]);
+ inputQty.focus();
+ }
+ }));
+
+ return div;
+}
+
+Warehouse.prototype.createProductUI = function(product, parentRefs) {
+ var company = parentRefs.company, industry = parentRefs.industry,
+ city = currentCityUi;
+ var div = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {
+ class:"cmpy-mgmt-warehouse-product-div"
+ });
+
+ //Products being designed TODO
+ if (!product.fin) {
+ div.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
+ innerHTML: "Designing " + product.name + "...
" +
+ Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(product.prog, 2) + "% complete",
+ }));
+ return div;
+ }
+
+ //Completed products
+ var cmpAndDmdText = "";
+ if (company.unlockUpgrades[2] === 1) {
+ cmpAndDmdText += "
Competition: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(product.cmp, 3);
+ }
+ if (company.unlockUpgrades[3] === 1) {
+ cmpAndDmdText += "
Demand: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(product.dmd, 3);
+ }
+ var totalGain = product.data[city][1] - product.data[city][2]; //Production - sale
+ div.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
+ innerHTML: "
" +
+ "Sell: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(product.data[city][2], 3) + "/s
" +
+ "
" +
+ "Performance: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(product.per, 3) + "
" +
+ "Durability: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(product.dur, 3) + "
" +
+ "Reliability: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(product.rel, 3) + "
" +
+ "Aesthetics: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(product.aes, 3) + "
" +
+ "Features: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(product.fea, 3) +
+ cmpAndDmdText + "
" +
+ "
" +
+ "
" +
+ "If the sell amount is set to 0, then the product will not be sold. If the " +
+ "sell price is set to 0, then the product will be discarded.
" +
+ "Setting the sell amount to 'MAX' will result in you always selling the " +
+ "maximum possible amount of the material.
" +
+ "When setting the sell amount, you can use the 'PROD' variable to designate a " +
+ "dynamically changing amount that depends on your production. For example, " +
+ "if you set the sell amount to 'PROD-1' then you will always sell 1 less of " +
+ "the material than you produce.
" +
+ "When setting the sell price, you can use the 'MP' variable to set a " +
+ "dynamically changing price that depends on the Product's estimated " +
+ "market price. For example, if you set it to 'MP*5' then it " +
+ "will always be sold at five times the estimated market price.",
+ });
+ var confirmBtn;
+ var inputQty = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("input", {
+ type:"text", value:product.sllman[city][1] ? product.sllman[city][1] : null, placeholder: "Sell amount",
+ onkeyup:(e)=>{
+ e.preventDefault();
+ if (e.keyCode === 13) {confirmBtn.click();}
+ }
+ });
+ var inputPx = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("input", {
+ type:"text", value: product.sCost ? product.sCost : null, placeholder: "Sell price",
+ onkeyup:(e)=>{
+ e.preventDefault();
+ if (e.keyCode === 13) {confirmBtn.click();}
+ }
+ });
+ confirmBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ class:"a-link-button", innerText:"Confirm",
+ clickListener:()=>{
+ //Parse price
+ if (inputPx.value.includes("MP")) {
+ //Dynamically evaluated quantity. First test to make sure its valid
+ //Sanitize input, then replace dynamic variables with arbitrary numbers
+ var price = inputPx.value.replace(/\s+/g, '');
+ price = price.replace(/[^-()\d/*+.MP]/g, '');
+ var temp = price.replace(/MP/g, 1);
+ try {
+ temp = eval(temp);
+ } catch(e) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Invalid value or expression for sell quantity field: " + e);
+ return false;
+ }
+ if (temp == null || isNaN(temp)) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Invalid value or expression for sell quantity field.");
+ return false;
+ }
+ product.sCost = price; //Use sanitized price
+ } else {
+ var cost = parseFloat(inputPx.value);
+ if (isNaN(cost)) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Invalid value for sell price field");
+ return false;
+ }
+ product.sCost = cost;
+ }
+
+ //Parse quantity
+ if (inputQty.value.includes("MAX") || inputQty.value.includes("PROD")) {
+ //Dynamically evaluated quantity. First test to make sure its valid
+ var qty = inputQty.value.replace(/\s+/g, '');
+ qty = qty.replace(/[^-()\d/*+.MAXPROD]/g, '');
+ var temp = qty.replace(/MAX/g, 1);
+ temp = temp.replace(/PROD/g, 1);
+ try {
+ temp = eval(temp);
+ } catch(e) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Invalid value or expression for sell price field: " + e);
+ return false;
+ }
+
+ if (temp == null || isNaN(temp)) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Invalid value or expression for sell price field");
+ return false;
+ }
+ product.sllman[city][0] = true;
+ product.sllman[city][1] = qty; //Use sanitized input
+ } else if (isNaN(inputQty.value)) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Invalid value for sell quantity field! Must be numeric");
+ return false;
+ } else {
+ var qty = parseFloat(inputQty.value);
+ if (isNaN(qty)) {qty = 0;}
+ if (qty === 0) {
+ product.sllman[city][0] = false;
+ } else {
+ product.sllman[city][0] = true;
+ product.sllman[city][1] = qty;
+ }
+ }
+ this.createUI(parentRefs);
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
+ return false;
+ }
+ });
+ var cancelBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ class:"a-link-button", innerText:"Cancel",
+ clickListener:()=>{
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
+ return false;
+ }
+ });
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createPopup"])(popupId, [txt, inputQty, inputPx, confirmBtn, cancelBtn]);
+ inputQty.focus();
+ }
+ }));
+ div.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("br",{})); //force line break
+
+ //Limit production button
+ var limitProductionInnerText = "Limit Production";
+ if (product.prdman[city][0]) {
+ limitProductionInnerText += " (" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(product.prdman[city][1], 3) + ")";
+ }
+ div.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ class:"a-link-button", innerText:limitProductionInnerText,display:"inline-block",
+ clickListener:()=>{
+ var popupId = "cmpy-mgmt-limit-product-production-popup";
+ var txt = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
+ innerText:"Enter a limit to the amount of this product you would " +
+ "like to product per second. Leave the box empty to set no limit."
+ });
+ var confirmBtn;
+ var input = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("input", {
+ type:"number", placeholder:"Limit",
+ onkeyup:(e)=>{
+ e.preventDefault();
+ if (e.keyCode === 13) {confirmBtn.click();}
+ }
+ });
+ confirmBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ class:"a-link-button", display:"inline-block", innerText:"Limit production", margin:'6px',
+ clickListener:()=>{
+ if (input.value === "") {
+ product.prdman[city][0] = false;
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
+ return false;
+ }
+ var qty = parseFloat(input.value);
+ if (isNaN(qty)) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Invalid value entered");
+ return false;
+ }
+ if (qty < 0) {
+ product.prdman[city][0] = false;
+ } else {
+ product.prdman[city][0] = true;
+ product.prdman[city][1] = qty;
+ }
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
+ return false;
+ }
+ });
+ var cancelBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ class:"a-link-button", display:"inline-block", innerText:"Cancel", margin:"6px",
+ clickListener:()=>{
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
+ return false;
+ }
+ });
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createPopup"])(popupId, [txt, input, confirmBtn, cancelBtn]);
+ }
+ }));
+
+ //Discontinue button
+ div.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ class:'a-link-button', display:"inline-block",innerText:"Discontinue",
+ clickListener:()=>{
+ var popupId = "cmpy-mgmt-discontinue-product-popup";
+ var txt = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
+ innerText:"Are you sure you want to do this? Discontinuing a product " +
+ "removes it completely and permanently. You will no longer " +
+ "produce this product and all of its existing stock will be " +
+ "removed and left unsold",
+ });
+ var confirmBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ class:"a-link-button",innerText:"Discontinue",
+ clickListener:()=>{
+ industry.discontinueProduct(product, parentRefs);
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
+ return false;
+ }
+ });
+ var cancelBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ class:"a-link-button", innerText:"Cancel",
+ clickListener:()=>{
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
+ return false;
+ }
+ });
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createPopup"])(popupId, [txt, confirmBtn, cancelBtn]);
+ }
+ }));
+ return div;
+}
+
+Warehouse.prototype.toJSON = function() {
+ return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Generic_toJSON"])("Warehouse", this);
+}
+
+Warehouse.fromJSON = function(value) {
+ return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Generic_fromJSON"])(Warehouse, value.data);
+}
+
+_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Reviver"].constructors.Warehouse = Warehouse;
+
+//Corporation Unlock Upgrades
+//Upgrades for entire corporation, unlocks features, either you have it or you dont
+//The structure is [index in Corporation feature upgrades array, price ]
+var CorporationUnlockUpgrades = {
+ //Lets you export goods
+ "0": [0, 20e9, "Export",
+ "Develop infrastructure to export your materials to your other facilities. " +
+ "This allows you to move materials around between different divisions and cities."],
+
+ //Lets you buy exactly however many required materials you need for production
+ "1": [1, 50e9, "Smart Supply", "Use advanced AI to anticipate your supply needs. " +
+ "This allows you to purchase exactly however many materials you need for production."],
+
+ //Displays each material/product's demand
+ "2": [2, 5e9, "Market Research - Demand",
+ "Mine and analyze market data to determine the demand of all resources. " +
+ "The demand attribute, which affects sales, will be displayed for every material and product."],
+
+ //Display's each material/product's competition
+ "3": [3, 5e9, "Market Data - Competition",
+ "Mine and analyze market data to determine how much competition there is on the market " +
+ "for all resources. The competition attribute, which affects sales, will be displayed for " +
+ "for every material and product."],
+ "4": [4, 10e9, "VeChain",
+ "Use AI and blockchain technology to identify where you can improve your supply chain systems. " +
+ "This upgrade will allow you to view a wide array of useful statistics about your " +
+ "Corporation."]
+}
+
+//Corporation Upgrades
+//Upgrades for entire corporation, levelable upgrades
+//The structure is [index in Corporation upgrades array, base price, price mult, benefit mult (additive),
+// name, desc]
+var CorporationUpgrades = {
+ //Smart factories, increases production
+ "0": [0, 2e9, 1.07, 0.03,
+ "Smart Factories", "Advanced AI automatically optimizes the operation and productivity " +
+ "of factories. Each level of this upgrade increases your global production by 3% (additive)."],
+
+ //Smart warehouses, increases storage size
+ "1": [1, 2e9, 1.07, .1,
+ "Smart Storage", "Advanced AI automatically optimizes your warehouse storage methods. " +
+ "Each level of this upgrade increases your global warehouse storage size by 10% (additive)."],
+
+ //Advertise through dreams, passive popularity/ awareness gain
+ "2": [2, 8e9, 1.09, .001,
+ "DreamSense", "Use DreamSense LCC Technologies to advertise your corporation " +
+ "to consumers through their dreams. Each level of this upgrade provides a passive " +
+ "increase in awareness of all of your companies (divisions) by 0.004 / market cycle," +
+ "and in popularity by 0.001 / market cycle. A market cycle is approximately " +
+ "20 seconds."],
+
+ //Makes advertising more effective
+ "3": [3, 4e9, 1.12, 0.005,
+ "Wilson Analytics", "Purchase data and analysis from Wilson, a marketing research " +
+ "firm. Each level of this upgrades increases the effectiveness of your " +
+ "advertising by 0.5% (additive)."],
+
+ //Augmentation for employees, increases cre
+ "4": [4, 1e9, 1.06, 0.1,
+ "Nuoptimal Nootropic Injector Implants", "Purchase the Nuoptimal Nootropic " +
+ "Injector augmentation for your employees. Each level of this upgrade " +
+ "globally increases the creativity of your employees by 10% (additive)."],
+
+ //Augmentation for employees, increases cha
+ "5": [5, 1e9, 1.06, 0.1,
+ "Speech Processor Implants", "Purchase the Speech Processor augmentation for your employees. " +
+ "Each level of this upgrade globally increases the charisma of your employees by 10% (additive)."],
+
+ //Augmentation for employees, increases int
+ "6": [6, 1e9, 1.06, 0.1,
+ "Neural Accelerators", "Purchase the Neural Accelerator augmentation for your employees. " +
+ "Each level of this upgrade globally increases the intelligence of your employees " +
+ "by 10% (additive)."],
+
+ //Augmentation for employees, increases eff
+ "7": [7, 1e9, 1.06, 0.1,
+ "FocusWires", "Purchase the FocusWire augmentation for your employees. Each level " +
+ "of this upgrade globally increases the efficiency of your employees by 10% (additive)."],
+
+ //Improves sales of materials/products
+ "8": [8, 1e9, 1.08, 0.01,
+ "ABC SalesBots", "Always Be Closing. Purchase these robotic salesmen to increase the amount of " +
+ "materials and products you sell. Each level of this upgrade globally increases your sales " +
+ "by 1% (additive)."],
+
+ //Improves scientific research rate
+ "9": [9, 5e9, 1.07, 0.05,
+ "Project Insight", "Purchase 'Project Insight', a R&D service provided by the secretive " +
+ "Fulcrum Technologies. Each level of this upgrade globally increases the amount of " +
+ "Scientific Research you produce by 5% (additive)."],
+}
+
+function Corporation(params={}) {
+ this.name = params.name ? params.name : "The Corporation";
+
+ //A division/business sector is represented by the object:
+ this.divisions = [];
+
+ //Financial stats
+ this.funds = new _utils_decimal_js__WEBPACK_IMPORTED_MODULE_6___default.a(150e9);
+ this.revenue = new _utils_decimal_js__WEBPACK_IMPORTED_MODULE_6___default.a(0);
+ this.expenses = new _utils_decimal_js__WEBPACK_IMPORTED_MODULE_6___default.a(0);
+ this.fundingRound = 0;
+ this.public = false; //Publicly traded
+ this.numShares = TOTALSHARES;
+ this.issuedShares = 0;
+ this.sharePrice = 0;
+ this.storedCycles = 0;
+
+ var numUnlockUpgrades = Object.keys(CorporationUnlockUpgrades).length,
+ numUpgrades = Object.keys(CorporationUpgrades).length;
+
+ this.unlockUpgrades = Array(numUnlockUpgrades).fill(0);
+ this.upgrades = Array(numUpgrades).fill(0);
+ this.upgradeMultipliers = Array(numUpgrades).fill(1);
+
+ this.state = new CorporationState();
+}
+
+Corporation.prototype.getState = function() {
+ return this.state.getState();
+}
+
+Corporation.prototype.storeCycles = function(numCycles=1) {
+ this.storedCycles += numCycles;
+}
+
+Corporation.prototype.process = function() {
+ var corp = this;
+ if (this.storedCycles >= CyclesPerIndustryStateCycle) {
+ var state = this.getState(), marketCycles=1;
+ this.storedCycles -= (marketCycles * CyclesPerIndustryStateCycle);
+
+ //At the start of a new cycle, calculate profits from previous cycle
+ if (state === "START") {
+ this.revenue = new _utils_decimal_js__WEBPACK_IMPORTED_MODULE_6___default.a(0);
+ this.expenses = new _utils_decimal_js__WEBPACK_IMPORTED_MODULE_6___default.a(0);
+ this.divisions.forEach((ind)=>{
+ this.revenue = this.revenue.plus(ind.lastCycleRevenue);
+ this.expenses = this.expenses.plus(ind.lastCycleExpenses);
+ });
+ var profit = this.revenue.minus(this.expenses);
+ var cycleProfit = profit.times(marketCycles * SecsPerMarketCycle);
+ if (isNaN(this.funds)) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("There was an error calculating your Corporations funds and they got reset to 0. " +
+ "This is a bug. Please report to game developer.
" +
+ "(Your funds have been set to $150b for the inconvenience)");
+ this.funds = new _utils_decimal_js__WEBPACK_IMPORTED_MODULE_6___default.a(150e9);
+ }
+ this.funds = this.funds.plus(cycleProfit);
+ this.updateSharePrice();
+ }
+
+ this.divisions.forEach(function(ind) {
+ ind.process(marketCycles, state, corp);
+ });
+
+
+ this.state.nextState();
+
+ if (_engine_js__WEBPACK_IMPORTED_MODULE_1__["Engine"].currentPage === _engine_js__WEBPACK_IMPORTED_MODULE_1__["Engine"].Page.Corporation) {this.updateUIContent();}
+ }
+}
+
+Corporation.prototype.determineValuation = function() {
+ var val, profit = (this.revenue.minus(this.expenses)).toNumber();
+ if (this.public) {
+ val = this.funds.toNumber() + (profit * 85e3);
+ val *= (Math.pow(1.1, this.divisions.length));
+ val = Math.max(val, 0);
+ } else {
+ val = 10e9 + Math.max(this.funds.toNumber(), 0) / 3; //Base valuation
+ if (profit > 0) {
+ val += (profit * 320e3);
+ val *= (Math.pow(1.1, this.divisions.length));
+ } else {
+ val = 10e9 * Math.pow(1.1, this.divisions.length);
+ }
+ val -= (val % 1e6); //Round down to nearest millionth
+ }
+ return val * _BitNode_js__WEBPACK_IMPORTED_MODULE_0__["BitNodeMultipliers"].CorporationValuation;
+}
+
+Corporation.prototype.getInvestment = function() {
+ var val = this.determineValuation(), percShares;
+ switch (this.fundingRound) {
+ case 0: //Seed
+ percShares = 0.10;
+ break;
+ case 1: //Series A
+ percShares = 0.35;
+ break;
+ case 2: //Series B
+ percShares = 0.25;
+ break;
+ case 3: //Series C
+ percShares = 0.20;
+ break;
+ case 4:
+ return;
+ }
+ var funding = val * percShares * 4,
+ investShares = Math.floor(TOTALSHARES * percShares),
+ yesBtn = Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_12__["yesNoBoxGetYesButton"])(),
+ noBtn = Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_12__["yesNoBoxGetNoButton"])();
+ yesBtn.innerHTML = "Accept";
+ noBtn.innerHML = "Reject";
+ yesBtn.addEventListener("click", ()=>{
+ ++this.fundingRound;
+ this.funds = this.funds.plus(funding);
+ this.numShares -= investShares;
+ this.displayCorporationOverviewContent();
+ return Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_12__["yesNoBoxClose"])();
+ });
+ noBtn.addEventListener("click", ()=>{
+ return Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_12__["yesNoBoxClose"])();
+ });
+ Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_12__["yesNoBoxCreate"])("An investment firm has offered you " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(funding).format('$0.000a') +
+ " in funding in exchange for a " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(percShares*100).format("0.000a") +
+ "% stake in the company (" + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(investShares).format('0.000a') + " shares).
" +
+ "Do you accept or reject this offer?");
+}
+
+Corporation.prototype.goPublic = function() {
+ var goPublicPopupId = "cmpy-mgmt-go-public-popup";
+ var initialSharePrice = this.determineValuation() / (TOTALSHARES);
+ var txt = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
+ innerHTML: "Enter the number of shares you would like to issue " +
+ "for your IPO. These shares will be publicly sold " +
+ "and you will no longer own them. Your Corporation will receive " +
+ _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(initialSharePrice).format('$0.000a') + " per share " +
+ "(the IPO money will be deposited directly into your Corporation's funds).
" +
+ "Furthermore, issuing more shares now will help drive up " +
+ "your company's stock price in the future.
" +
+ "You have a total of " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(this.numShares).format("0.000a") + " of shares that you can issue.",
+ });
+ var yesBtn;
+ var input = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("input", {
+ type:"number",
+ placeholder: "Shares to issue",
+ onkeyup:(e)=>{
+ e.preventDefault();
+ if (e.keyCode === 13) {yesBtn.click();}
+ }
+ });
+ var br = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("br", {});
+ yesBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ class:"a-link-button",
+ innerText:"Go Public",
+ clickListener:()=>{
+ var numShares = Math.round(input.value);
+ var initialSharePrice = this.determineValuation() / (TOTALSHARES);
+ if (isNaN(numShares)) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Invalid value for number of issued shares");
+ return false;
+ }
+ if (numShares > this.numShares) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Error: You don't have that many shares to issue!");
+ return false;
+ }
+ this.public = true;
+ this.sharePrice = initialSharePrice;
+ this.issuedShares = numShares;
+ this.numShares -= numShares;
+ this.funds = this.funds.plus(numShares * initialSharePrice);
+ this.displayCorporationOverviewContent();
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(goPublicPopupId);
+ return false;
+ }
+ });
+ var noBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ class:"a-link-button",
+ innerText:"Cancel",
+ clickListener:()=>{
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(goPublicPopupId);
+ return false;
+ }
+ });
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createPopup"])(goPublicPopupId, [txt, br, input, yesBtn, noBtn]);
+}
+
+Corporation.prototype.updateSharePrice = function() {
+ var targetPrice = this.determineValuation() / (TOTALSHARES - this.issuedShares);
+ if (this.sharePrice <= targetPrice) {
+ this.sharePrice *= (1 + (Math.random() * 0.01));
+ } else {
+ this.sharePrice *= (1 - (Math.random() * 0.01));
+ }
+ if (this.sharePrice <= 0.01) {this.sharePrice = 0.01;}
+}
+
+//One time upgrades that unlock new features
+Corporation.prototype.unlock = function(upgrade) {
+ var upgN = upgrade[0], price = upgrade[1];
+ while (this.unlockUpgrades.length <= upgN) {
+ this.unlockUpgrades.push(0);
+ }
+ if (this.funds.lt(price)) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("You don't have enough funds to unlock this!");
+ return;
+ }
+ this.unlockUpgrades[upgN] = 1;
+ this.funds = this.funds.minus(price);
+}
+
+//Levelable upgrades
+Corporation.prototype.upgrade = function(upgrade) {
+ var upgN = upgrade[0], basePrice = upgrade[1], priceMult = upgrade[2],
+ upgradeAmt = upgrade[3]; //Amount by which the upgrade multiplier gets increased (additive)
+ while (this.upgrades.length <= upgN) {this.upgrades.push(0);}
+ while (this.upgradeMultipliers.length <= upgN) {this.upgradeMultipliers.push(1);}
+ var totalCost = basePrice * Math.pow(priceMult, this.upgrades[upgN]);
+ if (this.funds.lt(totalCost)) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("You don't have enough funds to purchase this!");
+ return;
+ }
+ ++this.upgrades[upgN];
+ this.funds = this.funds.minus(totalCost);
+
+ //Increase upgrade multiplier
+ this.upgradeMultipliers[upgN] = 1 + (this.upgrades[upgN] * upgradeAmt);
+
+ //If storage size is being updated, update values in Warehouse objects
+ if (upgN === 1) {
+ for (var i = 0; i < this.divisions.length; ++i) {
+ var industry = this.divisions[i];
+ for (var city in industry.warehouses) {
+ if (industry.warehouses.hasOwnProperty(city) && industry.warehouses[city] instanceof Warehouse) {
+ industry.warehouses[city].updateSize(this);
+ }
+ }
+ }
+ }
+
+ this.updateCorporationOverviewContent();
+}
+
+Corporation.prototype.getProductionMultiplier = function() {
+ var mult = this.upgradeMultipliers[0];
+ if (isNaN(mult) || mult < 1) {return 1;} else {return mult;}
+}
+
+Corporation.prototype.getStorageMultiplier = function() {
+ var mult = this.upgradeMultipliers[1];
+ if (isNaN(mult) || mult < 1) {return 1;} else {return mult;}
+}
+
+Corporation.prototype.getDreamSenseGain = function() {
+ var gain = this.upgradeMultipliers[2] - 1;
+ return gain <= 0 ? 0 : gain;
+}
+
+Corporation.prototype.getAdvertisingMultiplier = function() {
+ var mult = this.upgradeMultipliers[3];
+ if (isNaN(mult) || mult < 1) {return 1;} else {return mult;}
+}
+
+Corporation.prototype.getEmployeeCreMultiplier = function() {
+ var mult = this.upgradeMultipliers[4];
+ if (isNaN(mult) || mult < 1) {return 1;} else {return mult;}
+}
+
+Corporation.prototype.getEmployeeChaMultiplier = function() {
+ var mult = this.upgradeMultipliers[5];
+ if (isNaN(mult) || mult < 1) {return 1;} else {return mult;}
+}
+
+Corporation.prototype.getEmployeeIntMultiplier = function() {
+ var mult = this.upgradeMultipliers[6];
+ if (isNaN(mult) || mult < 1) {return 1;} else {return mult;}
+}
+
+Corporation.prototype.getEmployeeEffMultiplier = function() {
+ var mult = this.upgradeMultipliers[7];
+ if (isNaN(mult) || mult < 1) {return 1;} else {return mult;}
+}
+
+Corporation.prototype.getSalesMultiplier = function() {
+ var mult = this.upgradeMultipliers[8];
+ if (isNaN(mult) || mult < 1) {return 1;} else {return mult;}
+}
+
+Corporation.prototype.getScientificResearchMultiplier = function() {
+ var mult = this.upgradeMultipliers[9];
+ if (isNaN(mult) || mult < 1) {return 1;} else {return mult;}
+}
+
+//Keep 'global' variables for DOM elements so we don't have to search
+//through the DOM tree repeatedly when updating UI
+var companyManagementDiv, companyManagementHeaderTabs, companyManagementPanel,
+ currentCityUi,
+ corporationUnlockUpgrades, corporationUpgrades,
+
+ //Industry Overview Panel
+ industryOverviewPanel, industryOverviewText,
+
+ //Industry Employee Panel
+ industryEmployeePanel, industryEmployeeText, industryEmployeeHireButton, industryEmployeeAutohireButton,
+ industryEmployeeManagementUI, industryEmployeeInfo, industryIndividualEmployeeInfo,
+ industryOfficeUpgradeSizeButton,
+
+ //Industry Warehouse Panel
+ industryWarehousePanel, industrySmartSupplyCheckbox, industryWarehouseStorageText,
+ industryWarehouseUpgradeSizeButton, industryWarehouseStateText,
+ industryWarehouseMaterials, industryWarehouseProducts,
+ headerTabs, cityTabs;
+Corporation.prototype.createUI = function() {
+ companyManagementDiv = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {
+ id:"cmpy-mgmt-container",
+ position:"fixed",
+ class:"generic-menupage-container"
+ });
+ companyManagementHeaderTabs = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {id:"cmpy-mgmt-header-tabs"});
+ companyManagementDiv.appendChild(companyManagementHeaderTabs);
+
+ //Create division/industry tabs at the top
+ this.updateUIHeaderTabs();
+
+ //Create the 'panel' that will have the actual content in the UI
+ companyManagementPanel = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {id:"cmpy-mgmt-panel"});
+ companyManagementDiv.appendChild(companyManagementPanel);
+ document.getElementById("entire-game-container").appendChild(companyManagementDiv);
+
+ this.displayCorporationOverviewContent();
+}
+
+Corporation.prototype.updateUIHeaderTabs = function() {
+ if (companyManagementHeaderTabs) {
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeChildrenFromElement"])(companyManagementHeaderTabs);
+ } else {
+ console.log("ERROR: Header tabs div has not yet been created when Corporation.updateUIHeaderTabs() is called");
+ return;
+ }
+
+ //Corporation overview tabs
+ var cmpyOverviewHdrTab = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("button", {
+ id:"cmpy-mgmt-company-tab",
+ class:"cmpy-mgmt-header-tab",
+ innerText:this.name,
+ checked:true,
+ clickListener:()=>{
+ this.selectHeaderTab(cmpyOverviewHdrTab);
+ this.displayCorporationOverviewContent();
+ return false;
+ }
+ });
+ companyManagementHeaderTabs.appendChild(cmpyOverviewHdrTab);
+
+ //Tabs for each division
+ for (var i = 0; i < this.divisions.length; ++i) {
+ this.createDivisionUIHeaderTab(this.divisions[i]);
+ }
+
+ //Create a tab to expand into a new industry
+ companyManagementHeaderTabs.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("button", {
+ id:'cmpy-mgmt-expand-industry-tab',
+ class:"cmpy-mgmt-header-tab",
+ innerText:"Expand into new Industry",
+ clickListener: ()=>{
+ if (document.getElementById("cmpy-mgmt-expand-industry-popup") != null) {return;}
+
+ var container = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {
+ class:"popup-box-container",
+ id:"cmpy-mgmt-expand-industry-popup",
+ });
+ var content = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {class:"popup-box-content"});
+ var txt = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
+ innerHTML: "Create a new division to expand into a new industry:",
+ });
+ var selector = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("select", {
+ class:"cmpy-mgmt-industry-select"
+ });
+ var industryDescription = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {});
+ var yesBtn;
+ var nameInput = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("input", {
+ type:"text",
+ id:"cmpy-mgmt-expand-industry-name-input",
+ color:"white",
+ backgroundColor:"black",
+ display:"block",
+ maxLength: 30,
+ pattern:"[a-zA-Z0-9-_]",
+ onkeyup:(e)=>{
+ e.preventDefault();
+ if (e.keyCode === 13) {yesBtn.click();}
+ }
+ });
+ var nameLabel = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("label", {
+ for:"cmpy-mgmt-expand-industry-name-input",
+ innerText:"Division name: "
+ });
+ yesBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("span", {
+ class:"popup-box-button",
+ innerText:"Create Division",
+ clickListener: ()=>{
+ var ind = selector.options[selector.selectedIndex].value,
+ newDivisionName = nameInput.value;
+
+ for (var i = 0; i < this.divisions.length; ++i) {
+ if (this.divisions[i].name === newDivisionName) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("This name is already in use!");
+ return false;
+ }
+ }
+ if (this.funds.lt(IndustryStartingCosts[ind])) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Not enough money to create a new division in this industry");
+ } else if (newDivisionName === "") {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("New division must have a name!");
+ } else {
+ this.funds = this.funds.minus(IndustryStartingCosts[ind]);
+ var newInd = new Industry({
+ name:newDivisionName,
+ type:ind,
+ });
+ this.divisions.push(newInd);
+ this.updateUIHeaderTabs();
+ this.selectHeaderTab(headerTabs[headerTabs.length-2]);
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])("cmpy-mgmt-expand-industry-popup");
+ this.displayDivisionContent(newInd, _Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Sector12);
+ }
+ return false;
+ }
+ });
+ var noBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("span", {
+ class:"popup-box-button",
+ innerText:"Cancel",
+ clickListener: function() {
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])("cmpy-mgmt-expand-industry-popup");
+ return false;
+ }
+ });
+
+ //Make an object to keep track of what industries you're already in
+ var ownedIndustries = {}
+ for (var i = 0; i < this.divisions.length; ++i) {
+ ownedIndustries[this.divisions[i].type] = true;
+ }
+
+ //Add industry types to selector
+ //Have Agriculture be first as recommended option
+ if (!ownedIndustries["Agriculture"]) {
+ selector.add(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("option", {
+ text:Industries["Agriculture"], value:"Agriculture"
+ }));
+ }
+
+ for (var key in Industries) {
+ if (key !== "Agriculture" && Industries.hasOwnProperty(key) && !ownedIndustries[key]) {
+ var ind = Industries[key];
+ selector.add(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("option", {
+ text: ind,value:key,
+ }));
+ }
+ }
+
+ //Initial Industry Description
+ var ind = selector.options[selector.selectedIndex].value;
+ industryDescription.innerHTML = (IndustryDescriptions[ind] + "
");
+
+ //Change the industry description text based on selected option
+ selector.addEventListener("change", function() {
+ var ind = selector.options[selector.selectedIndex].value;
+ industryDescription.innerHTML = IndustryDescriptions[ind] + "
";
+ });
+
+ //Add to DOM
+ content.appendChild(txt);
+ content.appendChild(selector);
+ content.appendChild(industryDescription);
+ content.appendChild(nameLabel);
+ content.appendChild(nameInput);
+ content.appendChild(noBtn);
+ content.appendChild(yesBtn);
+ container.appendChild(content);
+ document.getElementById("entire-game-container").appendChild(container);
+ container.style.display = "block";
+ return false;
+ }
+ }));
+
+ headerTabs = companyManagementDiv.getElementsByClassName("cmpy-mgmt-header-tab");
+}
+
+//Updates UI to display which header tab is selected
+Corporation.prototype.selectHeaderTab = function(currentTab) {
+ if (currentTab == null) {return;}
+ for (var i = 0; i < headerTabs.length; ++i) {
+ headerTabs[i].className = "cmpy-mgmt-header-tab";
+ }
+ currentTab.className = "cmpy-mgmt-header-tab current";
+}
+
+Corporation.prototype.createDivisionUIHeaderTab = function(division) {
+ var tabId = "cmpy-mgmt-" + division.name + "-tab";
+ var tab = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("button", {
+ id:tabId,
+ class:"cmpy-mgmt-header-tab",
+ innerText:division.name,
+ clickListener:()=>{
+ this.selectHeaderTab(tab);
+ this.displayDivisionContent(division, _Location_js__WEBPACK_IMPORTED_MODULE_4__["Locations"].Sector12);
+ return false;
+ }
+ });
+ companyManagementHeaderTabs.appendChild(tab);
+}
+
+Corporation.prototype.clearUIPanel = function() {
+ while(companyManagementPanel.firstChild) {
+ companyManagementPanel.removeChild(companyManagementPanel.firstChild);
+ }
+}
+
+Corporation.prototype.updateUIContent = function() {
+ //Check which of the header tab buttons is checked
+ if (headerTabs == null) {
+ console.log("ERROR: headerTabs is null in Corporation.updateUIContent()");
+ return;
+ }
+ for (var i = 0; i < headerTabs.length; ++i) {
+ if (headerTabs[i].classList.contains("current")) {
+ if (i === 0) {
+ //Corporation overview
+ this.updateCorporationOverviewContent();
+ } else {
+ //Division
+ this.updateDivisionContent(this.divisions[i-1]);
+ }
+ return;
+ }
+ }
+}
+
+Corporation.prototype.displayCorporationOverviewContent = function() {
+ this.clearUIPanel();
+ companyManagementPanel.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
+ id:"cmpy-mgmt-overview-text",
+ }));
+ if (headerTabs && headerTabs.length >= 1) {
+ this.selectHeaderTab(headerTabs[0]);
+ }
+
+ //Check if player has Corporation Handbook
+ var homeComp = _Player_js__WEBPACK_IMPORTED_MODULE_5__["Player"].getHomeComputer(), hasHandbook = false,
+ handbookFn = "corporation-management-handbook.lit";
+ for (var i = 0; i < homeComp.messages.length; ++i) {
+ if (Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["isString"])(homeComp.messages[i]) && homeComp.messages[i] === handbookFn) {
+ hasHandbook = true;
+ break;
+ }
+ }
+
+ companyManagementPanel.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ class:"a-link-button", innerText:"Getting Started Guide", display:"inline-block",
+ tooltip:"Get a copy of and read 'The Complete Handbook for Creating a Successful Corporation.' " +
+ "This is a .lit file that guides you through the beginning of setting up a Corporation and " +
+ "provides some tips/pointers for helping you get started with managing it.",
+ clickListener:()=>{
+ if (!hasHandbook) {homeComp.messages.push(handbookFn);}
+ Object(_Literature_js__WEBPACK_IMPORTED_MODULE_3__["showLiterature"])(handbookFn);
+ return false;
+ }
+ }));
+
+ //Investors
+ if (this.public) {
+ //Sell share buttons
+ var sellShares = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ class:"a-link-button", innerText:"Sell Shares", display:"inline-block",
+ tooltip:"Sell your shares in the company. This is the only way to " +
+ "profit from your business venture.",
+ clickListener:()=>{
+ var popupId = "cmpy-mgmt-sell-shares-popup";
+ var currentStockPrice = this.sharePrice;
+ var txt = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
+ innerHTML: "Enter the number of shares you would like to sell. The money from " +
+ "selling your shares will go directly to you (NOT your Corporation). " +
+ "The current price of your " +
+ "company's stock is " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(currentStockPrice).format("$0.000a"),
+ });
+ var profitIndicator = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {});
+ var input = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("input", {
+ type:"number", placeholder:"Shares to sell", margin:"5px",
+ inputListener: ()=> {
+ var numShares = Math.round(input.value);
+ if (isNaN(numShares) || numShares <= 0) {
+ profitIndicator.innerText = "ERROR: Invalid value entered for number of shares to sell"
+ } else if (numShares > this.numShares) {
+ profitIndicator.innerText = "You don't have this many shares to sell!";
+ } else {
+ profitIndicator.innerText = "Sell " + numShares + " shares for a total of " +
+ _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(numShares * currentStockPrice).format('$0.000a');
+ }
+ }
+ });
+ var confirmBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ class:"a-link-button", innerText:"Sell shares", display:"inline-block",
+ clickListener:()=>{
+ var shares = Math.round(input.value);
+ if (isNaN(shares) || shares <= 0) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("ERROR: Invalid value for number of shares");
+ } else if (shares > this.numShares) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("ERROR: You don't have this many shares to sell");
+ } else {
+ this.numShares -= shares;
+ if (isNaN(this.issuedShares)) {
+ console.log("ERROR: Corporation issuedShares is NaN: " + this.issuedShares);
+ console.log("Converting to number now");
+ var res = parseInt(this.issuedShares);
+ if (isNaN(res)) {
+ this.issuedShares = 0;
+ } else {
+ this.issuedShares = res;
+ }
+ }
+ this.issuedShares += shares;
+ _Player_js__WEBPACK_IMPORTED_MODULE_5__["Player"].gainMoney(shares * this.sharePrice);
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
+ return false;
+ }
+
+ }
+ });
+ var cancelBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ class:"a-link-button", innerText:"Cancel", display:"inline-block",
+ clickListener:()=>{
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
+ return false;
+ }
+ });
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createPopup"])(popupId, [txt, profitIndicator, input, confirmBtn, cancelBtn]);
+ }
+ });
+
+ //Buyback shares button
+ var buybackShares = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ class:"a-link-button", innerText:"Buyback shares", display:"inline-block",
+ tooltip:"Buy back shares you that previously issued or sold at market price.",
+ clickListener:()=>{
+ var popupId = "cmpy-mgmt-buyback-shares-popup";
+ var currentStockPrice = this.sharePrice;
+ var txt = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
+ innerHTML: "Enter the number of shares you would like to buy back at market price. To purchase " +
+ "these shares, you must use your own money (NOT your Corporation's funds). " +
+ "The current price of your " +
+ "company's stock is " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(currentStockPrice).format("$0.000a") +
+ ". Your company currently has " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(this.issuedShares, 3) + " outstanding stock shares",
+ });
+ var costIndicator = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {});
+ var input = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("input", {
+ type:"number", placeholder:"Shares to buyback", margin:"5px",
+ inputListener: ()=> {
+ var numShares = Math.round(input.value);
+ //TODO add conditional for if player doesn't have enough money
+ if (isNaN(numShares) || numShares <= 0) {
+ costIndicator.innerText = "ERROR: Invalid value entered for number of shares to buyback"
+ } else if (numShares > this.issuedShares) {
+ costIndicator.innerText = "There are not this many shares available to buy back. " +
+ "There are only " + this.issuedShares + " outstanding shares.";
+ } else {
+ console.log("here");
+ costIndicator.innerText = "Purchase " + numShares + " shares for a total of " +
+ _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(numShares * currentStockPrice).format('$0.000a');
+ }
+ }
+ });
+ var confirmBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ class:"a-link-button", innerText:"Buy shares", display:"inline-block",
+ clickListener:()=>{
+ var shares = Math.round(input.value);
+ var tempStockPrice = this.sharePrice;
+ if (isNaN(shares) || shares <= 0) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("ERROR: Invalid value for number of shares");
+ } else if (shares > this.issuedShares) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("ERROR: There are not this many oustanding shares to buy back");
+ } else if (shares * tempStockPrice > _Player_js__WEBPACK_IMPORTED_MODULE_5__["Player"].money) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("ERROR: You do not have enough money to purchase this many shares (you need " +
+ _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(shares * tempStockPrice).format("$0.000a") + ")");
+ } else {
+ this.numShares += shares;
+ if (isNaN(this.issuedShares)) {
+ console.log("ERROR: Corporation issuedShares is NaN: " + this.issuedShares);
+ console.log("Converting to number now");
+ var res = parseInt(this.issuedShares);
+ if (isNaN(res)) {
+ this.issuedShares = 0;
+ } else {
+ this.issuedShares = res;
+ }
+ }
+ this.issuedShares -= shares;
+ _Player_js__WEBPACK_IMPORTED_MODULE_5__["Player"].loseMoney(shares * tempStockPrice);
+ //TODO REMOVE from Player money
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
+ }
+ return false;
+
+ }
+ });
+ var cancelBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ class:"a-link-button",
+ innerText:"Cancel",
+ display:"inline-block",
+ clickListener:()=>{
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
+ return false;
+ }
+ });
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createPopup"])(popupId, [txt, costIndicator, input, confirmBtn, cancelBtn]);
+ }
+ });
+
+ companyManagementPanel.appendChild(sellShares);
+ companyManagementPanel.appendChild(buybackShares);
+
+ //If your Corporation is big enough, buy faction influence through bribes
+ var canBribe = this.determineValuation() >= BribeThreshold;
+ var bribeFactions = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ class: canBribe ? "a-link-button" : "a-link-button-inactive",
+ innerText:"Bribe Factions", display:"inline-block",
+ tooltip:canBribe
+ ? "Use your Corporations power and influence to bribe Faction leaders in exchange for reputation"
+ : "Your Corporation is not powerful enough to bribe Faction leaders",
+ clickListener:()=>{
+ var popupId = "cmpy-mgmt-bribe-factions-popup";
+ var txt = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
+ innerText:"You can use Corporation funds or stock shares to bribe Faction Leaders in exchange for faction reputation"
+ });
+ var factionSelector = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("select", {margin:"3px"});
+ for (var i = 0; i < _Player_js__WEBPACK_IMPORTED_MODULE_5__["Player"].factions.length; ++i) {
+ var facName = _Player_js__WEBPACK_IMPORTED_MODULE_5__["Player"].factions[i];
+ factionSelector.add(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("option", {
+ text:facName, value:facName
+ }));
+ }
+ var repGainText = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p");
+ var stockSharesInput;
+ var moneyInput = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("input", {
+ type:"number", placeholder:"Corporation funds", margin:"5px",
+ inputListener:()=>{
+ var money = moneyInput.value == null || moneyInput.value == "" ? 0 : parseFloat(moneyInput.value);
+ var stockPrice = this.sharePrice;
+ var stockShares = stockSharesInput.value == null || stockSharesInput.value == "" ? 0 : Math.round(parseFloat(stockSharesInput.value));
+ if (isNaN(money) || isNaN(stockShares) || money < 0 || stockShares < 0) {
+ repGainText.innerText = "ERROR: Invalid value(s) entered";
+ } else if (this.funds.lt(money)) {
+ repGainText.innerText = "ERROR: You do not have this much money to bribe with";
+ } else if (this.stockShares > this.numShares) {
+ repGainText.innerText = "ERROR: You do not have this many shares to bribe with";
+ } else {
+
+ var totalAmount = Number(money) + (stockShares * stockPrice);
+ var repGain = totalAmount / BribeToRepRatio;
+ repGainText.innerText = "You will gain " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(repGain, 0) +
+ " reputation with " +
+ factionSelector.options[factionSelector.selectedIndex].value +
+ " with this bribe";
+ }
+ }
+ });
+ stockSharesInput = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("input", {
+ type:"number", placeholder:"Stock Shares", margin: "5px",
+ inputListener:()=>{
+ var money = moneyInput.value == null || moneyInput.value == "" ? 0 : parseFloat(moneyInput.value);
+ var stockPrice = this.sharePrice;
+ var stockShares = stockSharesInput.value == null || stockSharesInput.value == "" ? 0 : Math.round(stockSharesInput.value);
+ if (isNaN(money) || isNaN(stockShares) || money < 0 || stockShares < 0) {
+ repGainText.innerText = "ERROR: Invalid value(s) entered";
+ } else if (this.funds.lt(money)) {
+ repGainText.innerText = "ERROR: You do not have this much money to bribe with";
+ } else if (this.stockShares > this.numShares) {
+ repGainText.innerText = "ERROR: You do not have this many shares to bribe with";
+ } else {
+ var totalAmount = money + (stockShares * stockPrice);
+ var repGain = totalAmount / BribeToRepRatio;
+ console.log("repGain: " + repGain);
+ repGainText.innerText = "You will gain " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(repGain, 0) +
+ " reputation with " +
+ factionSelector.options[factionSelector.selectedIndex].value +
+ " with this bribe";
+ }
+ }
+ });
+ var confirmButton = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ class:"a-link-button", innerText:"Bribe", display:"inline-block",
+ clickListener:()=>{
+ var money = moneyInput.value == null || moneyInput.value == "" ? 0 : parseFloat(moneyInput.value);
+ var stockPrice = this.sharePrice;
+ var stockShares = stockSharesInput.value == null || stockSharesInput.value == ""? 0 : Math.round(parseFloat(stockSharesInput.value));
+ var fac = _Faction_js__WEBPACK_IMPORTED_MODULE_2__["Factions"][factionSelector.options[factionSelector.selectedIndex].value];
+ if (fac == null) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("ERROR: You must select a faction to bribe");
+ return false;
+ }
+ if (isNaN(money) || isNaN(stockShares) || money < 0 || stockShares < 0) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("ERROR: Invalid value(s) entered");
+ } else if (this.funds.lt(money)) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("ERROR: You do not have this much money to bribe with");
+ } else if (stockShares > this.numShares) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("ERROR: You do not have this many shares to bribe with");
+ } else {
+ var totalAmount = money + (stockShares * stockPrice);
+ var repGain = totalAmount / BribeToRepRatio;
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("You gained " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(repGain, 0) +
+ " reputation with " + fac.name + " by bribing them.");
+ fac.playerReputation += repGain;
+ this.funds = this.funds.minus(money);
+ this.numShares -= stockShares;
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
+ return false;
+ }
+ }
+ });
+ var cancelButton = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ class:"a-link-button", innerText:"Cancel", display:"inline-block",
+ clickListener:()=>{
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
+ return false;
+ }
+ });
+
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createPopup"])(popupId, [txt, factionSelector, repGainText,
+ moneyInput, stockSharesInput, confirmButton, cancelButton]);
+ }
+ });
+ companyManagementPanel.appendChild(bribeFactions);
+ } else {
+ var findInvestors = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ class: this.fundingRound >= 4 ? "a-link-button-inactive" : "a-link-button tooltip",
+ innerText: "Find Investors",
+ display:"inline-block",
+ clickListener:()=>{
+ this.getInvestment();
+ }
+ });
+ if (this.fundingRound < 4) {
+ var findInvestorsTooltip = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("span", {
+ class:"tooltiptext",
+ innerText:"Search for private investors who will give you startup funding in exchange " +
+ "for equity (stock shares) in your company"
+ });
+ findInvestors.appendChild(findInvestorsTooltip);
+ }
+
+ var goPublic = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ class:"a-link-button tooltip",
+ innerText:"Go Public",
+ display:"inline-block",
+ clickListener:()=>{
+ this.goPublic();
+ return false;
+ }
+ });
+ var goPublicTooltip = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("span", {
+ class:"tooltiptext",
+ innerText: "Become a publicly traded and owned entity. Going public involves " +
+ "issuing shares for an IPO. Once you are a public company, " +
+ "your shares will be traded on the stock market."
+ });
+ goPublic.appendChild(goPublicTooltip);
+
+ companyManagementPanel.appendChild(findInvestors);
+ companyManagementPanel.appendChild(goPublic);
+ }
+
+ //Update overview text
+ this.updateCorporationOverviewContent();
+
+ //Don't show upgrades if player hasn't opened any divisions
+ if (this.divisions.length <= 0) {return; }
+ //Corporation Upgrades
+ var upgradeContainer = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {
+ class:"cmpy-mgmt-upgrade-container",
+ });
+ upgradeContainer.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("h1", {
+ innerText:"Unlocks", margin:"6px", padding:"6px",
+ }));
+
+ //Unlock upgrades
+ var corp = this;
+ var numUnlockUpgrades = Object.keys(CorporationUnlockUpgrades).length,
+ numUpgrades = Object.keys(CorporationUpgrades).length;
+ if (this.unlockUpgrades == null || this.upgrades == null) { //Backwards compatibility
+ this.unlockUpgrades = Array(numUnlockUpgrades).fill(0);
+ this.upgrades = Array(numUpgrades).fill(0);
+ }
+ while (this.unlockUpgrades.length < numUnlockUpgrades) {this.unlockUpgrades.push(0);}
+ while (this.upgrades.length < numUpgrades) {this.upgrades.push(0);}
+ while (this.upgradeMultipliers < numUpgrades) {this.upgradeMultipliers.push(1);}
+
+ for (var i = 0; i < numUnlockUpgrades; ++i) {
+ (function(i, corp) {
+ if (corp.unlockUpgrades[i] === 0) {
+ var upgrade = CorporationUnlockUpgrades[i.toString()];
+ if (upgrade == null) {
+ console.log("ERROR: Could not find upgrade index " + i);
+ return;
+ }
+
+ upgradeContainer.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {
+ class:"cmpy-mgmt-upgrade-div", width:"45%",
+ innerHTML:upgrade[2] + " - " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(upgrade[1]).format("$0.000a"),
+ tooltip: upgrade[3],
+ clickListener:()=>{
+ if (corp.funds.lt(upgrade[1])) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Insufficient funds");
+ } else {
+ corp.unlock(upgrade);
+ corp.displayCorporationOverviewContent();
+ }
+ }
+ }));
+ }
+ })(i, corp);
+ }
+
+ //Levelable upgrades
+ upgradeContainer.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("h1", {
+ innerText:"Upgrades", margin:"6px", padding:"6px",
+ }));
+
+ for (var i = 0; i < numUpgrades; ++i) {
+ (function(i, corp) {
+ var upgrade = CorporationUpgrades[i.toString()];
+ if (upgrade == null) {
+ console.log("ERROR: Could not find levelable upgrade index " + i);
+ return;
+ }
+
+ var baseCost = upgrade[1], priceMult = upgrade[2];
+ var cost = baseCost * Math.pow(priceMult, corp.upgrades[i]);
+ upgradeContainer.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {
+ class:"cmpy-mgmt-upgrade-div", width:"45%",
+ innerHTML:upgrade[4] + " - " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(cost).format("$0.000a"),
+ tooltip:upgrade[5],
+ clickListener:()=>{
+ if (corp.funds.lt(cost)) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Insufficient funds");
+ } else {
+ corp.upgrade(upgrade);
+ corp.displayCorporationOverviewContent();
+ }
+ }
+ }));
+ })(i, corp);
+ }
+
+ companyManagementPanel.appendChild(upgradeContainer);
+}
+
+Corporation.prototype.updateCorporationOverviewContent = function() {
+ var p = document.getElementById("cmpy-mgmt-overview-text");
+ if (p == null) {
+ console.log("WARNING: Could not find overview text elemtn in updateCorporationOverviewContent()");
+ return;
+ }
+ var totalFunds = this.funds,
+ totalRevenue = new _utils_decimal_js__WEBPACK_IMPORTED_MODULE_6___default.a(0),
+ totalExpenses = new _utils_decimal_js__WEBPACK_IMPORTED_MODULE_6___default.a(0);
+
+ var profit = this.revenue.minus(this.expenses).toNumber(),
+ profitStr = profit >= 0 ? _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(profit).format("$0.000a") : "-" + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(-1 * profit).format("$0.000a");
+
+ var txt = "Total Funds: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(totalFunds.toNumber()).format('$0.000a') + "
" +
+ "Total Revenue: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(this.revenue.toNumber()).format("$0.000a") + " / s
" +
+ "Total Expenses: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(this.expenses.toNumber()).format("$0.000a") + "/ s
" +
+ "Total Profits: " + profitStr + " / s
" +
+ "Publicly Traded: " + (this.public ? "Yes" : "No") + "
" +
+ "Owned Stock Shares: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(this.numShares).format('0.000a') + "
" +
+ "Stock Price: " + (this.public ? "$" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(this.sharePrice, 2) : "N/A") + "
";
+
+ var prodMult = this.getProductionMultiplier(),
+ storageMult = this.getStorageMultiplier(),
+ advMult = this.getAdvertisingMultiplier(),
+ empCreMult = this.getEmployeeCreMultiplier(),
+ empChaMult = this.getEmployeeChaMultiplier(),
+ empIntMult = this.getEmployeeIntMultiplier(),
+ empEffMult = this.getEmployeeEffMultiplier(),
+ salesMult = this.getSalesMultiplier(),
+ sciResMult = this.getScientificResearchMultiplier();
+ if (prodMult > 1) {txt += "Production Multiplier: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(prodMult, 3) + "
";}
+ if (storageMult > 1) {txt += "Storage Multiplier: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(storageMult, 3) + "
";}
+ if (advMult > 1) {txt += "Advertising Multiplier: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(advMult, 3) + "
";}
+ if (empCreMult > 1) {txt += "Empl. Creativity Multiplier: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(empCreMult, 3) + "
";}
+ if (empChaMult > 1) {txt += "Empl. Charisma Multiplier: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(empChaMult, 3) + "
";}
+ if (empIntMult > 1) {txt += "Empl. Intelligence Multiplier: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(empIntMult, 3) + "
";}
+ if (empEffMult > 1) {txt += "Empl. Efficiency Multiplier: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(empEffMult, 3) + "
";}
+ if (salesMult > 1) {txt += "Sales Multiplier: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(salesMult, 3) + "
";}
+ if (sciResMult > 1) {txt += "Scientific Research Multiplier: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(sciResMult, 3) + "
";}
+ p.innerHTML = txt;
+}
+
+Corporation.prototype.displayDivisionContent = function(division, city) {
+ this.clearUIPanel();
+ currentCityUi = city;
+
+ //Add the city tabs on the left
+ for (var cityName in division.offices) {
+ if (division.offices[cityName] instanceof OfficeSpace) {
+ this.createCityUITab(cityName, division);
+ }
+ }
+ cityTabs = companyManagementPanel.getElementsByClassName("cmpy-mgmt-city-tab");
+ if (cityTabs.length > 0) {
+ this.selectCityTab(document.getElementById("cmpy-mgmt-city-" + city + "-tab"), city);
+ }
+
+ //Expand into new City button
+ companyManagementPanel.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("button", {
+ class:"cmpy-mgmt-city-tab", innerText:"Expand into new City", display:"inline-block",
+ clickListener:()=>{
+ var popupId = "cmpy-mgmt-expand-city-popup";
+ var text = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
+ innerText: "Would you like to expand into a new city by opening an office? " +
+ "This would cost " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(OfficeInitialCost).format('$0.000a'),
+ });
+ var citySelector = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("select", {margin:"5px"});
+ for (var cityName in division.offices) {
+ if (division.offices.hasOwnProperty(cityName)) {
+ if (!(division.offices[cityName] instanceof OfficeSpace)) {
+ citySelector.add(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("option", {
+ text: cityName,
+ value: cityName
+ }));
+ }
+ }
+ }
+
+ var confirmBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ innerText:"Confirm", class:"a-link-button", display:"inline-block", margin:"3px",
+ clickListener:()=>{
+ var city = citySelector.options[citySelector.selectedIndex].value;
+ if (this.funds.lt(OfficeInitialCost)) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("You don't have enough company funds to open a new office!");
+ } else {
+ this.funds = this.funds.minus(OfficeInitialCost);
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Opened a new office in " + city + "!");
+ division.offices[city] = new OfficeSpace({
+ loc:city,
+ size:OfficeInitialSize,
+ });
+ this.displayDivisionContent(division, city);
+ }
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
+ return false;
+ }
+ });
+ var cancelBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ innerText:"Cancel", class:"a-link-button", display:"inline-block", margin:"3px",
+ clickListener:()=>{
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
+ return false;
+ }
+ })
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createPopup"])(popupId, [text, citySelector, confirmBtn, cancelBtn]);
+ return false;
+ }
+ }));
+ companyManagementPanel.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("br", {})); // Force line break
+
+ //Get office object
+ var office = division.offices[currentCityUi];
+ if (!(office instanceof OfficeSpace)) {
+ console.log("ERROR: Current city for UI does not have an office space");
+ return;
+ }
+
+ //Left and right panels
+ var leftPanel = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {class:"cmpy-mgmt-industry-left-panel"});
+ var rightPanel = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {class:"cmpy-mgmt-industry-right-panel"});
+ companyManagementPanel.appendChild(leftPanel);
+ companyManagementPanel.appendChild(rightPanel);
+
+ //Different sections (Overview, Employee/Office, and Warehouse)
+ industryOverviewPanel = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {
+ id:"cmpy-mgmt-industry-overview-panel", class:"cmpy-mgmt-industry-overview-panel"
+ });
+ leftPanel.appendChild(industryOverviewPanel);
+
+ industryEmployeePanel = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {
+ id:"cmpy-mgmt-employee-panel", class:"cmpy-mgmt-employee-panel"
+ });
+ leftPanel.appendChild(industryEmployeePanel);
+
+ industryWarehousePanel = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {
+ id:"cmpy-mgmt-warehouse-panel", class:"cmpy-mgmt-warehouse-panel"
+ });
+ rightPanel.appendChild(industryWarehousePanel);
+
+ //Industry overview text
+ industryOverviewText = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {});
+ industryOverviewPanel.appendChild(industryOverviewText);
+ industryOverviewPanel.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("br", {}));
+
+ //Industry overview Purchases & Upgrades
+ var numUpgrades = Object.keys(IndustryUpgrades).length;
+ while (division.upgrades.length < numUpgrades) {division.upgrades.push(0);} //Backwards compatibility
+
+ var industryOverviewUpgrades = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {});
+ industryOverviewUpgrades.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("u", {
+ innerText:"Purchases & Upgrades", margin:"2px", padding:"2px",
+ fontSize:"14px",
+ }));
+ industryOverviewUpgrades.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("br", {}));
+ for (var i = 0; i < numUpgrades; ++i) {
+ (function(i, corp, division, office) {
+ var upgrade = IndustryUpgrades[i.toString()];
+ if (upgrade == null) {
+ console.log("ERROR: Could not find levelable upgrade index: " + i);
+ return;
+ }
+
+ var baseCost = upgrade[1], priceMult = upgrade[2], cost = 0;
+ switch(i) {
+ case 0: //Coffee, cost is static per employee
+ cost = office.employees.length * baseCost;
+ break;
+ default:
+ cost = baseCost * Math.pow(priceMult, division.upgrades[i]);
+ break;
+ }
+ industryOverviewUpgrades.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {
+ class:"cmpy-mgmt-upgrade-div", display:"inline-block",
+ innerHTML:upgrade[4] + ' - ' + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(cost).format("$0.000a"),
+ tooltip:upgrade[5],
+ clickListener:()=>{
+ if (corp.funds.lt(cost)) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Insufficient funds");
+ } else {
+ corp.funds = corp.funds.minus(cost);
+ division.upgrade(upgrade, {
+ corporation:corp,
+ office:office,
+ });
+ corp.displayDivisionContent(division, city);
+ }
+ }
+ }));
+ industryOverviewUpgrades.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("br", {}));
+
+ })(i, this, division, office);
+ }
+
+
+ industryOverviewPanel.appendChild(industryOverviewUpgrades);
+
+ //Industry Overview 'Create Product' button if applicable
+ if (division.makesProducts) {
+ //Get the text on the button based on Industry type
+ var createProductButtonText, createProductPopupText;
+ switch(division.type) {
+ case Industries.Food:
+ createProductButtonText = "Build Restaurant";
+ createProductPopupText = "Build and manage a new restaurant!"
+ break;
+ case Industries.Tobacco:
+ createProductButtonText = "Create Product";
+ createProductPopupText = "Create a new tobacco product!";
+ break;
+ case Industries.Pharmaceutical:
+ createProductButtonText = "Create Drug";
+ createProductPopupText = "Design and develop a new pharmaceutical drug!";
+ break;
+ case Industries.Computer:
+ case "Computer":
+ createProductButtonText = "Create Product";
+ createProductPopupText = "Design and manufacture a new computer hardware product!";
+ break;
+ case Industries.Robotics:
+ createProductButtonText = "Design Robot";
+ createProductPopupText = "Design and create a new robot or robotic system!";
+ break;
+ case Industries.Software:
+ createProductButtonText = "Develop Software";
+ createProductPopupText = "Develop a new piece of software!";
+ break;
+ case Industries.HealthCare:
+ createProductButtonText = "Build Hospital";
+ createProductPopupText = "Build and manage a new hospital!";
+ break;
+ case Industries.RealEstate:
+ createProductButtonText = "Develop Property";
+ createProductPopupText = "Develop a new piece of real estate property!";
+ break;
+ default:
+ createProductButtonText = "Create Product";
+ return "";
+ }
+ createProductPopupText += "
To begin developing a product, " +
+ "first choose the city in which it will be designed. The stats of your employees " +
+ "in the selected city affect the properties of the finished product, such as its " +
+ "quality, performance, and durability.
" +
+ "You can also choose to invest money in the design and marketing of " +
+ "the product. Investing money in its design will result in a superior product. " +
+ "Investing money in marketing the product will help the product's sales.";
+
+ //Create the button
+ industryOverviewPanel.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ class:"a-link-button", innerText:createProductButtonText, margin:"6px", display:"inline-block",
+ clickListener:()=>{
+ var popupId = "cmpy-mgmt-create-product-popup";
+ var txt = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
+ innerHTML:createProductPopupText,
+ });
+ var designCity = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("select", {});
+ for (var cityName in division.offices) {
+ if (division.offices[cityName] instanceof OfficeSpace) {
+ designCity.add(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("option", {
+ value:cityName,
+ text:cityName
+ }));
+ }
+ }
+ var foo = "Product Name";
+ if (division.type === Industries.Food) {
+ foo = "Restaurant Name";
+ } else if (division.type === Industries.Healthcare) {
+ foo = "Hospital Name";
+ } else if (division.type === Industries.RealEstate) {
+ foo = "Property Name";
+ }
+ var productNameInput = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("input", {
+ placeholder:foo,
+ });
+ var lineBreak1 = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("br",{});
+ var designInvestInput = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("input", {
+ type:"number",
+ placeholder:"Design investment"
+ });
+ var marketingInvestInput = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("input", {
+ type:"number",
+ placeholder:"Marketing investment"
+ });
+ var confirmBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ class:"a-link-button",
+ innerText:"Develop Product",
+ clickListener:()=>{
+ if (designInvestInput.value == null) {designInvestInput.value = 0;}
+ if (marketingInvestInput.value == null) {marketingInvestInput.value = 0;}
+ var designInvest = parseFloat(designInvestInput.value),
+ marketingInvest = parseFloat(marketingInvestInput.value);
+ if (productNameInput.value == null || productNameInput.value === "") {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("You must specify a name for your product!");
+ } else if (isNaN(designInvest)) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Invalid value for design investment");
+ } else if (isNaN(marketingInvest)) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Invalid value for marketing investment");
+ } else if (this.funds.lt(designInvest + marketingInvest)) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("You don't have enough company funds to make this large of an investment");
+ } else {
+ var product = new Product({
+ name:productNameInput.value.replace(/[<>]/g, ''), //Sanitize for HTMl elements
+ createCity:designCity.options[designCity.selectedIndex].value,
+ designCost: designInvest,
+ advCost: marketingInvest,
+ });
+ this.funds = this.funds.minus(designInvest + marketingInvest);
+ division.products[product.name] = product;
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
+ }
+ //this.updateUIContent();
+ this.displayDivisionContent(division, city);
+ return false;
+ }
+ })
+ var cancelBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ class:"a-link-button",
+ innerText:"Cancel",
+ clickListener:()=>{
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
+ return false;
+ }
+ })
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createPopup"])(popupId, [txt, designCity, productNameInput, lineBreak1,
+ designInvestInput, marketingInvestInput, confirmBtn, cancelBtn]);
+ }
+ }));
+ }
+
+ //Employee and Office Panel
+ industryEmployeeText = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
+ id: "cmpy-mgmt-employee-p",
+ display:"block",
+ innerHTML: "Office Space
" +
+ "Type: " + office.tier + "
" +
+ "Comfort: " + office.comf + "
" +
+ "Beauty: " + office.beau + "
" +
+ "Size: " + office.employees.length + " / " + office.size + " employees",
+ });
+ industryEmployeePanel.appendChild(industryEmployeeText);
+
+ //Hire Employee button
+ if (office.employees.length === 0) {
+ industryEmployeeHireButton = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ class:"a-link-button",display:"inline-block",
+ innerText:"Hire Employee", fontSize:"13px",
+ tooltip:"You'll need to hire some employees to get your operations started! " +
+ "It's recommended to have at least one employee in every position",
+ clickListener:()=>{
+ office.findEmployees({corporation:this, division:division});
+ return false;
+ }
+ });
+ //industryEmployeeHireButton.classList.add("flashing-button");
+ } else {
+ industryEmployeeHireButton = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ class:"a-link-button",display:"inline-block",
+ innerText:"Hire Employee", fontSize:"13px",
+ clickListener:()=>{
+ office.findEmployees({corporation:this, division:division});
+ return false;
+ }
+ });
+ }
+ industryEmployeePanel.appendChild(industryEmployeeHireButton);
+
+ //Autohire Employee button
+ industryEmployeeAutohireButton = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ class:"a-link-button", display:"inline-block",
+ innerText:"Autohire Employee", fontSize:"13px",
+ tooltip:"Automatically hires an employee and gives him/her a random name",
+ clickListener:()=>{
+ office.hireRandomEmployee({corporation:this, division:division});
+ return false;
+ }
+ });
+ industryEmployeePanel.appendChild(industryEmployeeAutohireButton);
+
+ //Upgrade Office Size button
+ industryEmployeePanel.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("br", {}));
+ industryOfficeUpgradeSizeButton = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ class:"a-link-button", innerText:"Upgrade size",
+ display:"inline-block", margin:"6px", fontSize:"13px",
+ tooltip:"Upgrade the office's size so that it can hold more employees!",
+ clickListener:()=>{
+ var popupId = "cmpy-mgmt-upgrade-office-size-popup";
+ var initialPriceMult = Math.round(office.size / OfficeInitialSize);
+ var upgradeCost = OfficeInitialCost * Math.pow(1.07, initialPriceMult);
+
+ //Calculate cost to upgrade size by 15 employees
+ var mult = 0;
+ for (var i = 0; i < 5; ++i) {
+ mult += (Math.pow(1.07, initialPriceMult + i));
+ }
+ var upgradeCost15 = OfficeInitialCost * mult;
+
+ //Calculate max upgrade size and cost
+ var maxMult = (this.funds.dividedBy(OfficeInitialCost)).toNumber();
+ var maxNum = 1;
+ mult = Math.pow(1.07, initialPriceMult);
+ while(maxNum < 50) { //Hard cap of 50x (extra 150 employees)
+ if (mult >= maxMult) {break;}
+ var multIncrease = Math.pow(1.07, initialPriceMult + maxNum);
+ if (mult + multIncrease > maxMult) {
+ break;
+ } else {
+ mult += multIncrease;
+ }
+ ++maxNum;
+ }
+
+ var upgradeCostMax = OfficeInitialCost * mult;
+
+ var text = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
+ innerText:"Increase the size of your office space to fit additional employees!"
+ });
+ var text2 = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {innerText: "Upgrade size: "});
+
+ var confirmBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ class: this.funds.lt(upgradeCost) ? "a-link-button-inactive" : "a-link-button",
+ display:"inline-block", margin:"4px", innerText:"by 3",
+ tooltip:_utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(upgradeCost).format("$0.000a"),
+ clickListener:()=>{
+ if (this.funds.lt(upgradeCost)) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("You don't have enough company funds to purchase this upgrade!");
+ } else {
+ office.size += OfficeInitialSize;
+ this.funds = this.funds.minus(upgradeCost);
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Office space increased! It can now hold " + office.size + " employees");
+ this.updateUIContent();
+ }
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
+ return false;
+ }
+ });
+ var confirmBtn15 = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ class: this.funds.lt(upgradeCost15) ? "a-link-button-inactive" : "a-link-button",
+ display:"inline-block", margin:"4px", innerText:"by 15",
+ tooltip:_utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(upgradeCost15).format("$0.000a"),
+ clickListener:()=>{
+ if (this.funds.lt(upgradeCost15)) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("You don't have enough company funds to purchase this upgrade!");
+ } else {
+ office.size += (OfficeInitialSize * 5);
+ this.funds = this.funds.minus(upgradeCost15);
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Office space increased! It can now hold " + office.size + " employees");
+ this.updateUIContent();
+ }
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
+ return false;
+ }
+ });
+ var confirmBtnMax = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ class:this.funds.lt(upgradeCostMax) ? "a-link-button-inactive" : "a-link-button",
+ display:"inline-block", margin:"4px", innerText:"by MAX (" + maxNum*OfficeInitialSize + ")",
+ tooltip:_utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(upgradeCostMax).format("$0.000a"),
+ clickListener:()=>{
+ if (this.funds.lt(upgradeCostMax)) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("You don't have enough company funds to purchase this upgrade!");
+ } else {
+ office.size += (OfficeInitialSize * maxNum);
+ this.funds = this.funds.minus(upgradeCostMax);
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Office space increased! It can now hold " + office.size + " employees");
+ this.updateUIContent();
+ }
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
+ return false;
+ }
+ });
+ var cancelBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ class:"a-link-button", innerText:"Cancel", display:"inline-block", margin:"4px",
+ clickListener:()=>{
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
+ return false;
+ }
+ })
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createPopup"])(popupId, [text, text2, confirmBtn, confirmBtn15, confirmBtnMax, cancelBtn]);
+ return false;
+ }
+ });
+ industryEmployeePanel.appendChild(industryOfficeUpgradeSizeButton);
+
+ //Throw Office Party
+ industryEmployeePanel.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ class:"a-link-button", display:"inline-block", innerText:"Throw Party",
+ fontSize:"13px",
+ tooltip:"Throw an office party to increase your employee's morale and happiness",
+ clickListener:()=>{
+ var popupId = "cmpy-mgmt-throw-office-party-popup";
+ var txt = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
+ innerText:"Enter the amount of money you would like to spend PER EMPLOYEE " +
+ "on this office party"
+ });
+ var totalCostTxt = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
+ innerText:"Throwing this party will cost a total of $0"
+ });
+ var confirmBtn;
+ var input = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("input", {
+ type:"number", margin:"5px", placeholder:"$ / employee",
+ inputListener:()=>{
+ if (isNaN(input.value) || input.value < 0) {
+ totalCostTxt.innerText = "Invalid value entered!"
+ } else {
+ var totalCost = input.value * office.employees.length;
+ totalCostTxt.innerText = "Throwing this party will cost a total of " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(totalCost).format('$0.000a');
+ }
+ },
+ onkeyup:(e)=>{
+ e.preventDefault();
+ if (e.keyCode === 13) {confirmBtn.click();}
+ }
+ });
+ confirmBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ class:"a-link-button",
+ display:"inline-block",
+ innerText:"Throw Party",
+ clickListener:()=>{
+ if (isNaN(input.value) || input.value < 0) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Invalid value entered");
+ } else {
+ var totalCost = input.value * office.employees.length;
+ if (this.funds.lt(totalCost)) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("You don't have enough company funds to throw this party!");
+ } else {
+ this.funds = this.funds.minus(totalCost);
+ var mult;
+ for (var fooit = 0; fooit < office.employees.length; ++fooit) {
+ mult = office.employees[fooit].throwParty(input.value);
+ }
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("You threw a party for the office! The morale and happiness " +
+ "of each employee increased by " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])((mult-1) * 100, 2) + "%.");
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
+ }
+ }
+ return false;
+ }
+ });
+ var cancelBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ class:"a-link-button",
+ display:"inline-block",
+ innerText:"Cancel",
+ clickListener:()=>{
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(popupId);
+ return false;
+ }
+ });
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createPopup"])(popupId, [txt, totalCostTxt, input, confirmBtn, cancelBtn]);
+ }
+ }));
+
+ industryEmployeeManagementUI = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {});
+ industryEmployeeInfo = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {margin:"4px", padding:"4px"});
+ if (empManualAssignmentModeActive) {
+ //Employees manually assigned
+ industryEmployeeManagementUI.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ class:"a-link-button", display:"inline-block", margin:"4px",
+ innerText:"Switch to Auto Mode",
+ tooltip:"Switch to Automatic Assignment Mode, which will automatically " +
+ "assign employees to your selected jobs. You simply have to select " +
+ "the number of assignments for each job",
+ clickListener:()=>{
+ empManualAssignmentModeActive = false;
+ this.displayDivisionContent(division, city);
+ }
+ }));
+ industryEmployeeManagementUI.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("br", {}));
+
+ industryIndividualEmployeeInfo = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {margin:"4px", padding:"4px"});
+ var selector = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("select", {
+ color: "white", backgroundColor:"black", margin:"4px", padding:"4px",
+ changeListener:()=>{
+ var name = selector.options[selector.selectedIndex].text;
+ for (var i = 0; i < office.employees.length; ++i) {
+ if (office.employees[i].name === name) {
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeChildrenFromElement"])(industryIndividualEmployeeInfo);
+ office.employees[i].createUI(industryIndividualEmployeeInfo, this);
+ return;
+ }
+ }
+ console.log("ERROR: Employee in selector could not be found");
+ }
+ });
+
+ for (var i = 0; i < office.employees.length; ++i) {
+ selector.add(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("option", {text:office.employees[i].name}));
+ }
+
+ selector.selectedIndex = -1;
+
+ industryEmployeeManagementUI.appendChild(industryEmployeeInfo);
+ industryEmployeeManagementUI.appendChild(selector);
+ industryEmployeeManagementUI.appendChild(industryIndividualEmployeeInfo);
+ } else {
+ //Player only manages the number of each occupation, not who gets what job
+ industryEmployeeManagementUI.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ class:"a-link-button", display:"inline-block", margin:"4px",
+ innerText:"Switch to Manual Mode",
+ tooltip:"Switch to Manual Assignment Mode, which allows you to " +
+ "specify which employees should get which jobs",
+ clickListener:()=>{
+ empManualAssignmentModeActive = true;
+ this.displayDivisionContent(division, city);
+ }
+ }));
+ industryEmployeeManagementUI.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("br", {}));
+
+ var opCount = 0, engCount = 0, busCount = 0,
+ mgmtCount = 0, rndCount = 0, unassignedCount = 0,
+ trainingCount = 0;
+ for (var i = 0; i < office.employees.length; ++i) {
+ switch (office.employees[i].pos) {
+ case EmployeePositions.Operations:
+ ++opCount; break;
+ case EmployeePositions.Engineer:
+ ++engCount; break;
+ case EmployeePositions.Business:
+ ++busCount; break;
+ case EmployeePositions.Management:
+ ++mgmtCount; break;
+ case EmployeePositions.RandD:
+ ++rndCount; break;
+ case EmployeePositions.Unassigned:
+ ++unassignedCount; break;
+ case EmployeePositions.Training:
+ ++trainingCount; break;
+ default:
+ console.log("ERROR: Unrecognized employee position: " + office.employees[i].pos);
+ break;
+ }
+ }
+
+ //Unassigned employee count display
+ industryEmployeeManagementUI.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
+ display:"inline-block",
+ innerText:"Unassigned Employees: " + unassignedCount,
+ }));
+ industryEmployeeManagementUI.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("br", {}));
+
+ //General display of employee information (avg morale, avg energy, etc.)
+ industryEmployeeManagementUI.appendChild(industryEmployeeInfo);
+ industryEmployeeManagementUI.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("br", {}));
+
+ var positions = [EmployeePositions.Operations, EmployeePositions.Engineer,
+ EmployeePositions.Business, EmployeePositions.Management,
+ EmployeePositions.RandD, EmployeePositions.Training];
+ var descriptions = ["Manages supply chain operations. Improves production.", //Operations
+ "Develops and maintains products and production systems. Improves production.", //Engineer
+ "Handles sales and finances. Improves sales.", //Business
+ "Leads and oversees employees and office operations. Improves production.", //Management
+ "Research new innovative ways to improve the company. Generates Scientific Research", //RandD
+ "Set employee to training, which will increase some of their stats. Employees in training do not affect any company operations."] //Training
+ var counts = [opCount, engCount, busCount, mgmtCount, rndCount, trainingCount];
+ for (var i = 0; i < positions.length; ++i) {
+ (function(corp, i) {
+ var info = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("h2", {
+ display:"inline-block", width:"40%", fontSize:"15px",
+ innerText: positions[i] + "(" + counts[i] + ")",
+ tooltipleft: descriptions[i]
+ });
+ var plusBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ class: unassignedCount > 0 ? "a-link-button" : "a-link-button-inactive",
+ display:"inline-block", innerText:"+",
+ clickListener:()=>{
+ office.assignEmployeeToJob(positions[i]);
+ corp.displayDivisionContent(division, city);
+ }
+ });
+ var minusBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ class: counts[i] > 0 ? "a-link-button" : "a-link-button-inactive",
+ display:"inline-block", innerText:"-",
+ clickListener:()=>{
+ office.unassignEmployeeFromJob(positions[i]);
+ corp.displayDivisionContent(division, city);
+ }
+ });
+ var newline = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("br", {});
+ industryEmployeeManagementUI.appendChild(info);
+ industryEmployeeManagementUI.appendChild(plusBtn);
+ industryEmployeeManagementUI.appendChild(minusBtn);
+ industryEmployeeManagementUI.appendChild(newline);
+ })(this, i);
+ }
+ }
+ industryEmployeePanel.appendChild(industryEmployeeManagementUI);
+
+ //Warehouse Panel
+ var warehouse = division.warehouses[currentCityUi];
+ if (warehouse instanceof Warehouse) {
+ warehouse.createUI({industry:division, company: this});
+ } else {
+ industryWarehousePanel.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("a", {
+ innerText:"Purchase Warehouse ($5b)",
+ class: "a-link-button",
+ clickListener:()=>{
+ if (this.funds.lt(WarehouseInitialCost)) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("You do not have enough funds to do this!");
+ } else {
+ division.warehouses[currentCityUi] = new Warehouse({
+ loc:currentCityUi,
+ size:WarehouseInitialSize,
+ });
+ this.funds = this.funds.minus(WarehouseInitialCost);
+ this.displayDivisionContent(division, currentCityUi);
+ }
+ return false;
+ }
+ }));
+ }
+ this.updateDivisionContent(division);
+}
+
+Corporation.prototype.updateDivisionContent = function(division) {
+ if (!(division instanceof Industry)) {
+ console.log("ERROR: Invalid 'division' argument in Corporation.updateDivisionContent");
+ return;
+ }
+ var vechain = (this.unlockUpgrades[4] === 1);
+ //Industry Overview Text
+ var profit = division.lastCycleRevenue.minus(division.lastCycleExpenses).toNumber(),
+ profitStr = profit >= 0 ? _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(profit).format("$0.000a") : "-" + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(-1 * profit).format("$0.000a");
+ var advertisingInfo = "";
+ if (vechain) {
+ var advertisingFactors = division.getAdvertisingFactors();
+ var awarenessFac = advertisingFactors[1];
+ var popularityFac = advertisingFactors[2];
+ var ratioFac = advertisingFactors[3];
+ var totalAdvertisingFac = advertisingFactors[0];
+ advertisingInfo =
+ "
" +
+ "Awareness Bonus: x" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(Math.pow(awarenessFac, 0.85), 3) + "
" +
+ "Popularity Bonus: x" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(Math.pow(popularityFac, 0.85), 3) + "
" +
+ "Ratio Multiplier: x" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(Math.pow(ratioFac, 0.85), 3) + "
"
+
+ }
+
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeChildrenFromElement"])(industryOverviewText);
+ industryOverviewText.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
+ innerHTML:"Industry: " + division.type + " (Corp Funds: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(this.funds.toNumber()).format("$0.000a") + ")
" +
+ "Awareness: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(division.awareness, 3) + "
" +
+ "Popularity: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(division.popularity, 3) + "
" +
+ advertisingInfo + "
" +
+ "Revenue: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(division.lastCycleRevenue.toNumber()).format("$0.000a") + " / s
" +
+ "Expenses: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default()(division.lastCycleExpenses.toNumber()).format("$0.000a") + " /s
" +
+ "Profit: " + profitStr + " / s
"
+ }));
+ industryOverviewText.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
+ marginTop:"2px",
+ innerText:"Production Multiplier: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(division.prodMult, 2),
+ tooltip:"Production gain from owning production-boosting materials " +
+ "such as hardware, Robots, AI Cores, and Real Estate"
+ }));
+ industryOverviewText.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("div", {
+ innerText:"?", class:"help-tip",
+ clickListener:()=>{
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__["dialogBoxCreate"])("Owning Hardware, Robots, AI Cores, and Real Estate " +
+ "can boost your Industry's production. The effect these " +
+ "materials have on your production varies between Industries. " +
+ "For example, Real Estate may be very effective for some Industries, " +
+ "but ineffective for others.
" +
+ "This division's production multiplier is calculated by summing " +
+ "the individual production multiplier of each of its office locations. " +
+ "This production multiplier is applied to each office. Therefore, it is " +
+ "beneficial to expand into new cities as this can greatly increase the " +
+ "production multiplier of your entire Division.");
+ }
+ }));
+ industryOverviewText.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("br"));
+ industryOverviewText.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
+ display:"inline-block",
+ innerText:"Scientific Research: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(division.sciResearch.qty, 3),
+ tooltip:"Scientific Research increases the quality of the materials and " +
+ "products that you produce."
+ }));
+
+ //Office and Employee List
+ var office = division.offices[currentCityUi];
+ industryEmployeeText.innerHTML =
+ "Office Space
" +
+ "Type: " + office.tier + "
" +
+ "Comfort: " + office.comf + "
" +
+ "Beauty: " + office.beau + "
" +
+ "Size: " + office.employees.length + " / " + office.size + " employees";
+ if (office.employees.length >= office.size) {
+ industryEmployeeHireButton.className = "a-link-button-inactive";
+ industryEmployeeAutohireButton.className = "a-link-button-inactive tooltip";
+ } else if (office.employees.length === 0) {
+ industryEmployeeHireButton.className = "a-link-button tooltip flashing-button";
+ industryEmployeeAutohireButton.className = "a-link-button tooltip";
+ } else {
+ industryEmployeeHireButton.className = "a-link-button";
+ industryEmployeeAutohireButton.className = "a-link-button tooltip";
+ }
+
+ //Employee Overview stats
+ //Calculate average morale, happiness, and energy
+ var totalMorale = 0, totalHappiness = 0, totalEnergy = 0,
+ avgMorale = 0, avgHappiness = 0, avgEnergy = 0;
+ for (var i = 0; i < office.employees.length; ++i) {
+ totalMorale += office.employees[i].mor;
+ totalHappiness += office.employees[i].hap;
+ totalEnergy += office.employees[i].ene;
+ }
+ if (office.employees.length > 0) {
+ avgMorale = totalMorale / office.employees.length;
+ avgHappiness = totalHappiness / office.employees.length;
+ avgEnergy = totalEnergy / office.employees.length;
+ }
+ industryEmployeeInfo.innerHTML =
+ "Avg Employee Morale: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(avgMorale, 3) + "
" +
+ "Avg Employee Happiness: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(avgHappiness, 3) + "
" +
+ "Avg Employee Energy: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(avgEnergy, 3);
+ if (vechain) { //VeChain - Statistics
+ industryEmployeeInfo.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("br", {}));
+ industryEmployeeInfo.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
+ innerText:"Material Production: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(division.getOfficeProductivity(office), 3),
+ tooltip: "The base amount of material this office can produce. Does not include " +
+ "production multipliers from upgrades and materials. This value is based off " +
+ "the productivity of your Operations, Engineering, and Management employees"
+ }));
+ industryEmployeeInfo.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("br", {}));
+ industryEmployeeInfo.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
+ innerText:"Product Production: " + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(division.getOfficeProductivity(office, {forProduct:true}), 3),
+ tooltip: "The base amount of any given Product this office can produce. Does not include " +
+ "production multipliers from upgrades and materials. This value is based off " +
+ "the productivity of your Operations, Engineering, and Management employees"
+ }));
+ industryEmployeeInfo.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("br", {}));
+ industryEmployeeInfo.appendChild(Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("p", {
+ innerText: "Business Multiplier: x" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__["formatNumber"])(division.getBusinessFactor(office), 3),
+ tooltip: "The effect this office's 'Business' employees has on boosting sales"
+ }));
+ }
+
+ //Warehouse
+ var warehouse = division.warehouses[currentCityUi];
+ if (warehouse instanceof Warehouse) {
+ warehouse.updateUI({industry:division, company:this});
+ }
+}
+
+Corporation.prototype.createCityUITab = function(city, division) {
+ var tab = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["createElement"])("button", {
+ id:"cmpy-mgmt-city-" + city + "-tab",
+ class:"cmpy-mgmt-city-tab",
+ innerText:city,
+ clickListener:()=>{
+ this.selectCityTab(tab, city);
+ this.displayDivisionContent(division, city);
+ return false;
+ }
+ });
+ companyManagementPanel.appendChild(tab);
+}
+
+Corporation.prototype.selectCityTab = function(activeTab, city) {
+ if (activeTab == null) {
+ activeTab = document.getElementById("cmpy-mgmt-city-" + city + "-tab");
+ if (activeTab == null) {return;}
+ }
+ for (var i = 0; i < cityTabs.length; ++i) {
+ cityTabs[i].className = "cmpy-mgmt-city-tab";
+ }
+ activeTab.className = "cmpy-mgmt-city-tab current";
+}
+
+Corporation.prototype.clearUI = function() {
+ //Delete everything
+ if (companyManagementDiv != null) {Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__["removeElementById"])(companyManagementDiv.id);}
+
+ //Reset global DOM variables
+ companyManagementDiv = null;
+ companyManagementPanel = null;
+ currentCityUi = null;
+
+ corporationUnlockUpgrades = null;
+ corporationUpgrades = null;
+
+ industryOverviewPanel = null;
+ industryOverviewText = null;
+
+ industryEmployeePanel = null;
+ industryEmployeeText = null;
+ industryEmployeeHireButton = null;
+ industryEmployeeAutohireButton = null;
+ industryEmployeeManagementUI = null;
+ industryEmployeeInfo = null;
+ industryIndividualEmployeeInfo = null;
+
+ industryOfficeUpgradeSizeButton = null;
+
+ industryWarehousePanel = null;
+ industrySmartSupplyCheckbox = null;
+ industryWarehouseStorageText = null;
+ industryWarehouseUpgradeSizeButton = null;
+ industryWarehouseStateText = null;
+ industryWarehouseMaterials = null;
+ industryWarehouseProducts = null;
+
+ companyManagementHeaderTabs = null;
+ headerTabs = null;
+ cityTabs = null;
+
+ document.getElementById("character-overview-wrapper").style.visibility = "visible";
+}
+
+Corporation.prototype.toJSON = function() {
+ return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Generic_toJSON"])("Corporation", this);
+}
+
+Corporation.fromJSON = function(value) {
+ return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Generic_fromJSON"])(Corporation, value.data);
+}
+
+_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__["Reviver"].constructors.Corporation = Corporation;
+
+
+
+
+/***/ }),
+/* 41 */
+/*!*************************!*\
+ !*** ./src/TextFile.js ***!
+ \*************************/
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextFile", function() { return TextFile; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTextFile", function() { return getTextFile; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createTextFile", function() { return createTextFile; });
+/* harmony import */ var _Server_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Server.js */ 10);
+/* harmony import */ var _utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/DialogBox.js */ 6);
+/* harmony import */ var _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/JSONReviver.js */ 8);
+
+
+
+
+function TextFile(fn="", txt="") {
+ this.fn = fn.endsWith(".txt") ? fn : fn + ".txt";
+ this.fn = this.fn.replace(/\s+/g, '');
+ this.text = String(txt);
+}
+
+TextFile.prototype.append = function(txt) {
+ this.text += String(txt);
+}
+
+TextFile.prototype.write = function(txt) {
+ this.text = String(txt);
+}
+
+TextFile.prototype.read = function() {
+ return this.txt;
+}
+
+TextFile.prototype.show = function() {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_1__["dialogBoxCreate"])(this.fn + "
" + this.text, true);
+}
+
+TextFile.prototype.download = function() {
+ var filename = this.fn;
+ var file = new Blob([this.text], {type: 'text/plain'});
+ if (window.navigator.msSaveOrOpenBlob) {// IE10+
+ window.navigator.msSaveOrOpenBlob(file, filename);
+ } else { // Others
+ var a = document.createElement("a"),
+ url = URL.createObjectURL(file);
+ a.href = url;
+ a.download = this.fn;
+ document.body.appendChild(a);
+ a.click();
+ setTimeout(function() {
+ document.body.removeChild(a);
+ window.URL.revokeObjectURL(url);
+ }, 0);
+ }
+}
+
+TextFile.prototype.toJSON = function() {
+ return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_2__["Generic_toJSON"])("TextFile", this);
+}
+
+TextFile.fromJSON = function(value) {
+ return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_2__["Generic_fromJSON"])(TextFile, value.data);
+}
+
+_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_2__["Reviver"].constructors.TextFile = TextFile;
+
+function getTextFile(fn, server) {
+ if (!fn.endsWith(".txt")) {fn += ".txt";}
+ for (var i = 0; i < server.textFiles.length; ++i) {
+ if (server.textFiles[i].fn === fn) {
+ return server.textFiles[i];
+ }
+ }
+ return null;
+}
+
+//Returns the TextFile object that was just created
+function createTextFile(fn, txt, server) {
+ if (getTextFile(fn, server) !== null) {
+ console.log("ERROR: createTextFile failed because the specified " +
+ "server already has a text file with the same fn");
+ return;
+ }
+ var file = new TextFile(fn, txt);
+ server.textFiles.push(file);
+ return file;
+}
+
+function deleteTextFile(fn, server) {
+ if (!fn.endsWith(".txt")) {fn += ".txt";}
+ for (var i = 0; i < server.textFiles.length; ++i) {
+ if (server.textFiles[i].fn === fn) {
+ server.textFiles.splice(i, 1);
+ return true;
+ }
+ }
+ return false;
}
/***/ }),
-/* 44 */
+/* 42 */
/*!***************************!*\
!*** ./src/SourceFile.js ***!
\***************************/
@@ -54468,7 +54243,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "applySourceFile", function() { return applySourceFile; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "initSourceFiles", function() { return initSourceFiles; });
/* harmony import */ var _Player_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Player.js */ 0);
-/* harmony import */ var _BitNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./BitNode.js */ 16);
+/* harmony import */ var _BitNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./BitNode.js */ 15);
@@ -54663,8 +54438,1371 @@ function applySourceFile(srcFile) {
+/***/ }),
+/* 43 */
+/*!********************************!*\
+ !*** ./src/ActiveScriptsUI.js ***!
+ \********************************/
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setActiveScriptsClickHandlers", function() { return setActiveScriptsClickHandlers; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addActiveScriptsItem", function() { return addActiveScriptsItem; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "deleteActiveScriptsItem", function() { return deleteActiveScriptsItem; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateActiveScriptsItems", function() { return updateActiveScriptsItems; });
+/* harmony import */ var _NetscriptWorker_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./NetscriptWorker.js */ 20);
+/* harmony import */ var _Player_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Player.js */ 0);
+/* harmony import */ var _Server_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Server.js */ 10);
+/* harmony import */ var _utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils/DialogBox.js */ 6);
+/* harmony import */ var _utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils/HelperFunctions.js */ 1);
+/* harmony import */ var _utils_LogBox_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils/LogBox.js */ 51);
+/* harmony import */ var _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../utils/numeral.min.js */ 13);
+/* harmony import */ var _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_6__);
+/* harmony import */ var _utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../utils/StringHelperFunctions.js */ 2);
+
+
+
+
+
+
+
+
+
+
+/* Active Scripts UI*/
+function setActiveScriptsClickHandlers() {
+ //Server panel click handlers
+ var serverPanels = document.getElementsByClassName("active-scripts-server-header");
+ if (serverPanels == null) {
+ console.log("ERROR: Could not find Active Scripts server panels");
+ return;
+ }
+ for (i = 0; i < serverPanels.length; ++i) {
+ serverPanels[i].onclick = function() {
+ this.classList.toggle("active");
+
+ var panel = this.nextElementSibling;
+ if (panel.style.display === "block") {
+ panel.style.display = "none";
+ } else {
+ panel.style.display = "block";
+ }
+ }
+ }
+
+ //Script Panel click handlers
+ var scriptPanels = document.getElementsByClassName("active-scripts-script-header");
+ if (scriptPanels == null) {
+ console.log("ERROR: Could not find Active Scripts panels for individual scripts");
+ return;
+ }
+ for (var i = 0; i < scriptPanels.length; ++i) {
+ scriptPanels[i].onclick = function() {
+ this.classList.toggle("active");
+
+ var panel = this.nextElementSibling;
+ if (panel.style.display === "block") {
+ panel.style.display = "none";
+ } else {
+ panel.style.display = "block";
+ }
+ }
+ }
+}
+
+//Returns the ul element containins all script items for a specific server
+function getActiveScriptsServerList(server) {
+ if (server == null) {return null;}
+ var panelname = "active-scripts-server-panel-" + server.hostname;
+ var item = document.getElementById(panelname + "-script-list");
+ if (item == null) {
+ console.log("ERROR: Cannot find list for: " + server.hostname);
+ }
+ return item;
+}
+
+function createActiveScriptsServerPanel(server) {
+ var panelname = "active-scripts-server-panel-" + server.hostname;
+ var activeScriptsList = document.getElementById("active-scripts-list");
+
+ //Div of entire Panel
+ var panelDiv = document.createElement("div");
+ panelDiv.setAttribute("id", panelname);
+
+ //Panel Header
+ var panelHdr = document.createElement("button");
+ panelHdr.setAttribute("class", "active-scripts-server-header")
+ panelHdr.setAttribute("id", panelname + "-hdr");
+ panelHdr.innerHTML = server.hostname;
+
+ //Panel content
+ var panelContentDiv = document.createElement("div");
+ panelContentDiv.setAttribute("class", "active-scripts-server-panel");
+ panelContentDiv.setAttribute("id", panelname + "-content");
+
+ //List of scripts
+ var panelScriptList = document.createElement("ul");
+ panelScriptList.setAttribute("id", panelname + "-script-list");
+
+ panelContentDiv.appendChild(panelScriptList);
+ panelDiv.appendChild(panelHdr);
+ panelDiv.appendChild(panelContentDiv);
+ activeScriptsList.appendChild(panelDiv);
+
+ setActiveScriptsClickHandlers() //Reset click handlers
+
+ return panelDiv;
+}
+
+//Deletes the info for a particular server (Dropdown header + Panel with all info)
+//in the Active Scripts page if it exists
+function deleteActiveScriptsServerPanel(server) {
+ var panelname = "active-scripts-server-panel-" + server.hostname;
+ var panel = document.getElementById(panelname);
+ if (panel == null) {
+ console.log("No such panel exists: " + panelname);
+ return;
+ }
+
+ //Remove the panel if it has no elements
+ var scriptList = document.getElementById(panelname + "-script-list");
+ if (scriptList.childNodes.length == 0) {
+ panel.parentNode.removeChild(panel);
+ }
+}
+
+function addActiveScriptsItem(workerscript) {
+ //Get server panel
+ var server = Object(_Server_js__WEBPACK_IMPORTED_MODULE_2__["getServer"])(workerscript.serverIp);
+ if (server == null) {
+ console.log("ERROR: Invalid server IP for workerscript.");
+ return;
+ }
+ var panelname = "active-scripts-server-panel-" + server.hostname;
+
+ var panel = document.getElementById(panelname);
+ if (panel == null) {
+ panel = createActiveScriptsServerPanel(server);
+ }
+
+ //Create the element itself. Each element is an accordion collapsible
+ var itemNameArray = ["active", "scripts", server.hostname, workerscript.name];
+ for (var i = 0; i < workerscript.args.length; ++i) {
+ itemNameArray.push(String(workerscript.args[i]));
+ }
+ var itemName = itemNameArray.join("-");
+ var item = document.createElement("li");
+ item.setAttribute("id", itemName);
+
+ var btn = document.createElement("button");
+ btn.setAttribute("class", "active-scripts-script-header");
+ btn.setAttribute("id", itemName + "-header");
+ btn.innerHTML = workerscript.name;
+
+ var itemContentDiv = document.createElement("div");
+ itemContentDiv.setAttribute("class", "active-scripts-script-panel");
+ itemContentDiv.setAttribute("id", itemName + "-content");
+
+ item.appendChild(btn);
+ item.appendChild(itemContentDiv);
+
+ createActiveScriptsText(workerscript, itemContentDiv);
+
+ //Append element to list
+ var list = getActiveScriptsServerList(server);
+ list.appendChild(item);
+
+ setActiveScriptsClickHandlers() //Reset click handlers
+}
+
+function deleteActiveScriptsItem(workerscript) {
+ var server = Object(_Server_js__WEBPACK_IMPORTED_MODULE_2__["getServer"])(workerscript.serverIp);
+ if (server == null) {
+ console.log("ERROR: Invalid server IP for workerscript.");
+ return;
+ }
+ var itemNameArray = ["active", "scripts", server.hostname, workerscript.name];
+ for (var i = 0; i < workerscript.args.length; ++i) {
+ itemNameArray.push(String(workerscript.args[i]));
+ }
+ var itemName = itemNameArray.join("-");
+ var li = document.getElementById(itemName);
+ if (li == null) {
+ console.log("could not find Active scripts li element for: " + workerscript.name);
+ return;
+ }
+ li.parentNode.removeChild(li);
+ deleteActiveScriptsServerPanel(server);
+}
+
+//Update the ActiveScriptsItems array
+function updateActiveScriptsItems() {
+ var total = 0;
+ for (var i = 0; i < _NetscriptWorker_js__WEBPACK_IMPORTED_MODULE_0__["workerScripts"].length; ++i) {
+ total += updateActiveScriptsItemContent(_NetscriptWorker_js__WEBPACK_IMPORTED_MODULE_0__["workerScripts"][i]);
+ }
+ document.getElementById("active-scripts-total-prod").innerHTML =
+ "Total online production of Active Scripts: " + _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_6___default()(total).format('$0.000a') + " / sec
" +
+ "Total online production since last Aug installation: " +
+ _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_6___default()(_Player_js__WEBPACK_IMPORTED_MODULE_1__["Player"].scriptProdSinceLastAug).format('$0.000a') + " (" +
+ _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_6___default()(_Player_js__WEBPACK_IMPORTED_MODULE_1__["Player"].scriptProdSinceLastAug / (_Player_js__WEBPACK_IMPORTED_MODULE_1__["Player"].playtimeSinceLastAug/1000)).format('$0.000a') + " / sec)";
+ return total;
+}
+
+//Updates the content of the given item in the Active Scripts list
+function updateActiveScriptsItemContent(workerscript) {
+ var server = Object(_Server_js__WEBPACK_IMPORTED_MODULE_2__["getServer"])(workerscript.serverIp);
+ if (server == null) {
+ console.log("ERROR: Invalid server IP for workerscript.");
+ return;
+ }
+ var itemNameArray = ["active", "scripts", server.hostname, workerscript.name];
+ for (var i = 0; i < workerscript.args.length; ++i) {
+ itemNameArray.push(String(workerscript.args[i]));
+ }
+ var itemName = itemNameArray.join("-");
+ var itemContent = document.getElementById(itemName + "-content")
+
+ //Add the updated text back. Returns the total online production rate
+ return updateActiveScriptsText(workerscript, itemContent);
+}
+
+function createActiveScriptsText(workerscript, item) {
+ var itemTextHeader = document.createElement("p");
+ var itemTextStats = document.createElement("p");
+ var itemId = item.id;
+ itemTextStats.setAttribute("id", itemId + "-stats");
+
+ //Server ip/hostname
+ var threads = "Threads: " + workerscript.scriptRef.threads;
+ var args = "Args: " + Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_4__["printArray"])(workerscript.args);
+
+ itemTextHeader.innerHTML = threads + "
" + args + "
";
+
+ item.appendChild(itemTextHeader);
+ item.appendChild(itemTextStats);
+
+ var onlineMps = updateActiveScriptsText(workerscript, item, itemTextStats);
+
+ var logButton = document.createElement("span");
+ logButton.innerHTML = "Log";
+ var killButton = document.createElement("span");
+ killButton.innerHTML = "Kill script";
+ logButton.setAttribute("class", "active-scripts-button");
+ killButton.setAttribute("class", "active-scripts-button");
+ logButton.addEventListener("click", function() {
+ Object(_utils_LogBox_js__WEBPACK_IMPORTED_MODULE_5__["logBoxCreate"])(workerscript.scriptRef);
+ return false;
+ });
+ killButton.addEventListener("click", function() {
+ Object(_NetscriptWorker_js__WEBPACK_IMPORTED_MODULE_0__["killWorkerScript"])(workerscript.scriptRef, workerscript.scriptRef.scriptRef.server);
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_3__["dialogBoxCreate"])("Killing script, may take a few minutes to complete...");
+ return false;
+ });
+ item.appendChild(logButton);
+ item.appendChild(killButton);
+
+ //Return total online production rate
+ return onlineMps;
+}
+
+function updateActiveScriptsText(workerscript, item, statsEl=null) {
+ var itemId = item.id
+ var itemTextStats = document.getElementById(itemId + "-stats");
+ if (itemTextStats == null || itemTextStats === undefined) {
+ itemTextStats = statsEl;
+ }
+
+ //Updates statistics only
+ //Online
+ var onlineTotalMoneyMade = "Total online production: $" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_7__["formatNumber"])(workerscript.scriptRef.onlineMoneyMade, 2);
+ var onlineTotalExpEarned = (Array(26).join(" ") + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_7__["formatNumber"])(workerscript.scriptRef.onlineExpGained, 2) + " hacking exp").replace( / /g, " ");
+
+ var onlineMps = workerscript.scriptRef.onlineMoneyMade / workerscript.scriptRef.onlineRunningTime;
+ var onlineMpsText = "Online production rate: $" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_7__["formatNumber"])(onlineMps, 2) + "/second";
+ var onlineEps = workerscript.scriptRef.onlineExpGained / workerscript.scriptRef.onlineRunningTime;
+ var onlineEpsText = (Array(25).join(" ") + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_7__["formatNumber"])(onlineEps, 4) + " hacking exp/second").replace( / /g, " ");
+
+ //Offline
+ var offlineTotalMoneyMade = "Total offline production: $" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_7__["formatNumber"])(workerscript.scriptRef.offlineMoneyMade, 2);
+ var offlineTotalExpEarned = (Array(27).join(" ") + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_7__["formatNumber"])(workerscript.scriptRef.offlineExpGained, 2) + " hacking exp").replace( / /g, " ");
+
+ var offlineMps = workerscript.scriptRef.offlineMoneyMade / workerscript.scriptRef.offlineRunningTime;
+ var offlineMpsText = "Offline production rate: $" + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_7__["formatNumber"])(offlineMps, 2) + "/second";
+ var offlineEps = workerscript.scriptRef.offlineExpGained / workerscript.scriptRef.offlineRunningTime;
+ var offlineEpsText = (Array(26).join(" ") + Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_7__["formatNumber"])(offlineEps, 4) + " hacking exp/second").replace( / /g, " ");
+
+ itemTextStats.innerHTML = onlineTotalMoneyMade + "
" + onlineTotalExpEarned + "
" +
+ onlineMpsText + "
" + onlineEpsText + "
" + offlineTotalMoneyMade + "
" + offlineTotalExpEarned + "
" +
+ offlineMpsText + "
" + offlineEpsText + "
";
+ return onlineMps;
+}
+
+
+
+
+/***/ }),
+/* 44 */
+/*!************************!*\
+ !*** ./src/RedPill.js ***!
+ \************************/
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "redPillFlag", function() { return redPillFlag; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hackWorldDaemon", function() { return hackWorldDaemon; });
+/* harmony import */ var _BitNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BitNode.js */ 15);
+/* harmony import */ var _engine_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./engine.js */ 5);
+/* harmony import */ var _Player_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Player.js */ 0);
+/* harmony import */ var _Prestige_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Prestige.js */ 57);
+/* harmony import */ var _SourceFile_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./SourceFile.js */ 42);
+/* harmony import */ var _Terminal_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Terminal.js */ 22);
+/* harmony import */ var _utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../utils/DialogBox.js */ 6);
+/* harmony import */ var _utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../utils/HelperFunctions.js */ 1);
+/* harmony import */ var _utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../utils/YesNoBox.js */ 12);
+
+
+
+
+
+
+
+
+
+
+
+/* RedPill.js
+ * Implements what happens when you have Red Pill augmentation and then hack the world daemon */
+
+//Returns promise
+function writeRedPillLine(line) {
+ return new Promise(function(resolve, reject) {
+
+ var container = document.getElementById("red-pill-container");
+ var pElem = document.createElement("p");
+ container.appendChild(pElem);
+
+ var promise = writeRedPillLetter(pElem, line, 0);
+ promise.then(function(res) {
+ resolve(res);
+ }, function(e) {
+ reject(e);
+ });
+ });
+}
+
+function writeRedPillLetter(pElem, line, i=0) {
+ return new Promise(function(resolve, reject) {
+ setTimeout(function() {
+ if (i >= line.length) {
+ var textToShow = line.substring(0, i);
+ pElem.innerHTML = "> " + textToShow;
+ return resolve(true);
+ }
+ var textToShow = line.substring(0, i);
+ pElem.innerHTML = "> " + textToShow + " █ ";
+ var promise = writeRedPillLetter(pElem, line, i+1);
+ promise.then(function(res) {
+ resolve(res);
+ }, function(e) {
+ reject(e);
+ });
+ }, 30);
+ });
+}
+
+let redPillFlag = false;
+function hackWorldDaemon(currentNodeNumber, flume=false) {
+ redPillFlag = true;
+ _engine_js__WEBPACK_IMPORTED_MODULE_1__["Engine"].loadRedPillContent();
+ return writeRedPillLine("[ERROR] SEMPOOL INVALID").then(function() {
+ return writeRedPillLine("[ERROR] Segmentation Fault");
+ }).then(function() {
+ return writeRedPillLine("[ERROR] SIGKILL RECVD");
+ }).then(function() {
+ return writeRedPillLine("Dumping core...");
+ }).then(function() {
+ return writeRedPillLine("0000 000016FA 174FEE40 29AC8239 384FEA88");
+ }).then(function() {
+ return writeRedPillLine("0010 745F696E 2BBBE394 390E3940 248BEC23");
+ }).then(function() {
+ return writeRedPillLine("0020 7124696B 0000FF69 74652E6F FFFF1111");
+ }).then(function() {
+ return writeRedPillLine("----------------------------------------");
+ }).then(function() {
+ return writeRedPillLine("Failsafe initiated...");
+ }).then(function() {
+ return writeRedPillLine("Restarting BitNode-" + currentNodeNumber + "...");
+ }).then(function() {
+ return writeRedPillLine("...........");
+ }).then(function() {
+ return writeRedPillLine("...........");
+ }).then(function() {
+ return writeRedPillLine("[ERROR] FAILED TO AUTOMATICALLY REBOOT BITNODE");
+ }).then(function() {
+ return writeRedPillLine("..............................................")
+ }).then(function() {
+ return writeRedPillLine("..............................................")
+ }).then(function() {
+ return loadBitVerse(currentNodeNumber, flume);
+ }).catch(function(e){
+ console.log("ERROR: " + e.toString());
+ });
+}
+
+//The bitNode name passed in will have a hyphen between number (e.g. BitNode-1)
+//This needs to be removed
+function giveSourceFile(bitNodeNumber) {
+ var sourceFileKey = "SourceFile"+ bitNodeNumber.toString();
+ var sourceFile = _SourceFile_js__WEBPACK_IMPORTED_MODULE_4__["SourceFiles"][sourceFileKey];
+ if (sourceFile == null) {
+ console.log("ERROR: could not find source file for Bit node: " + bitNodeNumber);
+ return;
+ }
+
+ //Check if player already has this source file
+ var alreadyOwned = false;
+ var ownedSourceFile = null;
+ for (var i = 0; i < _Player_js__WEBPACK_IMPORTED_MODULE_2__["Player"].sourceFiles.length; ++i) {
+ if (_Player_js__WEBPACK_IMPORTED_MODULE_2__["Player"].sourceFiles[i].n === bitNodeNumber) {
+ alreadyOwned = true;
+ ownedSourceFile = _Player_js__WEBPACK_IMPORTED_MODULE_2__["Player"].sourceFiles[i];
+ break;
+ }
+ }
+
+ if (alreadyOwned && ownedSourceFile) {
+ if (ownedSourceFile.lvl >= 3) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_6__["dialogBoxCreate"])("The Source-File for the BitNode you just destroyed, " + sourceFile.name + ", " +
+ "is already at max level!");
+ } else {
+ ++ownedSourceFile.lvl;
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_6__["dialogBoxCreate"])(sourceFile.name + " was upgraded to level " + ownedSourceFile.lvl + " for " +
+ "destroying its corresponding BitNode!");
+ }
+ } else {
+ var playerSrcFile = new _SourceFile_js__WEBPACK_IMPORTED_MODULE_4__["PlayerOwnedSourceFile"](bitNodeNumber, 1);
+ _Player_js__WEBPACK_IMPORTED_MODULE_2__["Player"].sourceFiles.push(playerSrcFile);
+ if (bitNodeNumber === 5) { //Artificial Intelligence
+ _Player_js__WEBPACK_IMPORTED_MODULE_2__["Player"].intelligence = 1;
+ }
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_6__["dialogBoxCreate"])("You received a Source-File for destroying a Bit Node!
" +
+ sourceFile.name + "
" + sourceFile.info);
+ }
+}
+
+function loadBitVerse(destroyedBitNodeNum, flume=false) {
+ //Clear the screen
+ var container = document.getElementById("red-pill-container");
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_7__["removeChildrenFromElement"])(container);
+
+ //Create the Bit Verse
+ var bitVerseImage = document.createElement("pre");
+ var bitNodes = [];
+ for (var i = 1; i <= 12; ++i) {
+ bitNodes.push(createBitNode(i));
+ }
+
+ bitVerseImage.innerHTML =
+ " O
" +
+ " | O O | O O |
" +
+ " O | | / __| \\ | | O
" +
+ " O | O | | O / | O | | O | O
" +
+ " | | | | |_/ |/ | \\_ \\_| | | | |
" +
+ " O | | | O | | O__/ | / \\__ | | O | | | O
" +
+ " | | | | | | | / /| O / \\| | | | | | |
" +
+ "O | | | \\| | O / _/ | / O | |/ | | | O
" +
+ "| | | |O / | | O / | O O | | \\ O| | | |
" +
+ "| | |/ \\/ / __| | |/ \\ | \\ | |__ \\ \\/ \\| | |
" +
+ " \\| O | |_/ |\\| \\ O \\__| \\_| | O |/
" +
+ " | | |_/ | | \\| / | \\_| | |
" +
+ " \\| / \\| | / / \\ |/
" +
+ " | "+bitNodes[9]+" | | / | "+bitNodes[10]+" |
" +
+ " "+bitNodes[8]+" | | | | | | | "+bitNodes[11]+"
" +
+ " | | | / / \\ \\ | | |
" +
+ " \\| | / "+bitNodes[6]+" / \\ "+bitNodes[7]+" \\ | |/
" +
+ " \\ | / / | | \\ \\ | /
" +
+ " \\ \\JUMP "+bitNodes[4]+"3R | | | | | | R3"+bitNodes[5]+" PMUJ/ /
" +
+ " \\|| | | | | | | | | ||/
" +
+ " \\| \\_ | | | | | | _/ |/
" +
+ " \\ \\| / \\ / \\ |/ /
" +
+ " "+bitNodes[0]+" |/ "+bitNodes[1]+" | | "+bitNodes[2]+" \\| "+bitNodes[3]+"
" +
+ " | | | | | | | |
" +
+ " \\JUMP3R|JUMP|3R| |R3|PMUJ|R3PMUJ/
";
+
+
+ /*
+ " O
" +
+ " | O O | O O |
" +
+ " O | | / __| \ | | O
" +
+ " O | O | | O / | O | | O | O
" +
+ " | | | | |_/ |/ | \_ \_| | | | |
" +
+ " O | | | O | | O__/ | / \__ | | O | | | O
" +
+ " | | | | | | | / /| O / \| | | | | | |
" +
+ "O | | | \| | O / _/ | / O | |/ | | | O
" +
+ "| | | |O / | | O / | O O | | \ O| | | |
" +
+ "| | |/ \/ / __| | |/ \ | \ | |__ \ \/ \| | |
" +
+ " \| O | |_/ |\| \ O \__| \_| | O |/
" +
+ " | | |_/ | | \| / | \_| | |
" +
+ " \| / \| | / / \ |/
" +
+ " | O | | / | O |
" +
+ " O | | | | | | | O
" +
+ " | | | / / \ \ | | |
" +
+ " \| | / O / \ O \ | |/
" +
+ " \ | / / | | \ \ | /
" +
+ " \ \JUMP O3R | | | | | | R3O PMUJ/ /
" +
+ " \|| | | | | | | | | ||/
" +
+ " \| \_ | | | | | | _/ |/
" +
+ " \ \| / \ / \ |/ /
" +
+ " O |/ O | | O \| O
" +
+ " | | | | | | | |
" +
+ " \JUMP3R|JUMP|3R| |R3|PMUJ|R3PMUJ/
";
+ */
+
+ container.appendChild(bitVerseImage);
+
+ //Bit node event listeners
+ for (var i = 1; i <= 12; ++i) {
+ (function(i) {
+ var elemId = "bitnode-" + i.toString();
+ var elem = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_7__["clearEventListeners"])(elemId);
+ if (elem == null) {return;}
+ if (i === 1 || i === 2 || i === 3 || i === 4 || i === 5 || i === 6 || i === 8 || i === 11) {
+ elem.addEventListener("click", function() {
+ var bitNodeKey = "BitNode" + i;
+ var bitNode = _BitNode_js__WEBPACK_IMPORTED_MODULE_0__["BitNodes"][bitNodeKey];
+ if (bitNode == null) {
+ console.log("ERROR: Could not find BitNode object for number: " + i);
+ return;
+ }
+ Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_8__["yesNoBoxCreate"])("BitNode-" + i + ": " + bitNode.name + "
" + bitNode.info);
+ createBitNodeYesNoEventListeners(i, destroyedBitNodeNum, flume);
+ });
+ } else {
+ elem.addEventListener("click", function() {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_6__["dialogBoxCreate"])("Not yet implemented! Coming soon!")
+ });
+ }
+ }(i)); //Immediate invocation closure
+ }
+
+ //Create lore text
+ return writeRedPillLine("Many decades ago, a humanoid extraterrestial species which we call the Enders descended on the Earth...violently").then(function() {
+ return writeRedPillLine("Our species fought back, but it was futile. The Enders had technology far beyond our own...");
+ }).then(function() {
+ return writeRedPillLine("Instead of killing every last one of us, the human race was enslaved...");
+ }).then(function() {
+ return writeRedPillLine("We were shackled in a digital world, chained into a prison for our minds...");
+ }).then(function() {
+ return writeRedPillLine("Using their advanced technology, the Enders created complex simulations of a virtual reality...");
+ }).then(function() {
+ return writeRedPillLine("Simulations designed to keep us content...ignorant of the truth.");
+ }).then(function() {
+ return writeRedPillLine("Simulations used to trap and suppress our consciousness, to keep us under control...");
+ }).then(function() {
+ return writeRedPillLine("Why did they do this? Why didn't they just end our entire race? We don't know, not yet.");
+ }).then(function() {
+ return writeRedPillLine("Humanity's only hope is to destroy these simulations, destroy the only realities we've ever known...");
+ }).then(function() {
+ return writeRedPillLine("Only then can we begin to fight back...");
+ }).then(function() {
+ return writeRedPillLine("By hacking the daemon that generated your reality, you've just destroyed one simulation, called a BitNode...");
+ }).then(function() {
+ return writeRedPillLine("But there is still a long way to go...");
+ }).then(function() {
+ return writeRedPillLine("The technology the Enders used to enslave the human race wasn't just a single complex simulation...");
+ }).then(function() {
+ return writeRedPillLine("There are tens if not hundreds of BitNodes out there...");
+ }).then(function() {
+ return writeRedPillLine("Each with their own simulations of a reality...");
+ }).then(function() {
+ return writeRedPillLine("Each creating their own universes...a universe of universes");
+ }).then(function() {
+ return writeRedPillLine("And all of which must be destroyed...");
+ }).then(function() {
+ return writeRedPillLine(".......................................");
+ }).then(function() {
+ return writeRedPillLine("Welcome to the Bitverse...");
+ }).then(function() {
+ return writeRedPillLine(" ");
+ }).then(function() {
+ return writeRedPillLine("(Enter a new BitNode using the image above)");
+ }).then(function() {
+ return Promise.resolve(true);
+ }).catch(function(e){
+ console.log("ERROR: " + e.toString());
+ });
+}
+
+
+//Returns string with DOM element for Bit Node
+function createBitNode(n) {
+ var bitNodeStr = "BitNode" + n.toString();
+ var bitNode = _BitNode_js__WEBPACK_IMPORTED_MODULE_0__["BitNodes"][bitNodeStr];
+ if (bitNode == null) {return "O";}
+ return "O" +
+ "" +
+ "BitNode-" + bitNode.number.toString() + "
" + bitNode.name+ "
" +
+ bitNode.desc + "
" +
+ "";
+}
+
+function createBitNodeYesNoEventListeners(newBitNode, destroyedBitNode, flume=false) {
+ var yesBtn = Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_8__["yesNoBoxGetYesButton"])();
+ yesBtn.innerHTML = "Enter BitNode-" + newBitNode;
+ yesBtn.addEventListener("click", function() {
+ if (!flume) {
+ giveSourceFile(destroyedBitNode);
+ } else {
+ //If player used flume, subtract 5 int exp. The prestigeSourceFile()
+ //function below grants 5 int exp, so this allows sets net gain to 0
+ _Player_js__WEBPACK_IMPORTED_MODULE_2__["Player"].gainIntelligenceExp(-5);
+ }
+ redPillFlag = false;
+ var container = document.getElementById("red-pill-container");
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_7__["removeChildrenFromElement"])(container);
+
+ //Set new Bit Node
+ _Player_js__WEBPACK_IMPORTED_MODULE_2__["Player"].bitNodeN = newBitNode;
+ console.log("Entering Bit Node " + _Player_js__WEBPACK_IMPORTED_MODULE_2__["Player"].bitNodeN);
+
+ //Reenable terminal
+ $("#hack-progress-bar").attr('id', "old-hack-progress-bar");
+ $("#hack-progress").attr('id', "old-hack-progress");
+ document.getElementById("terminal-input-td").innerHTML = '$ ';
+ $('input[class=terminal-input]').prop('disabled', false);
+
+ _Terminal_js__WEBPACK_IMPORTED_MODULE_5__["Terminal"].hackFlag = false;
+
+ Object(_Prestige_js__WEBPACK_IMPORTED_MODULE_3__["prestigeSourceFile"])();
+ Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_8__["yesNoBoxClose"])();
+ });
+ var noBtn = Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_8__["yesNoBoxGetNoButton"])();
+ noBtn.innerHTML = "Back";
+ noBtn.addEventListener("click", function() {
+ Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_8__["yesNoBoxClose"])();
+ });
+
+}
+
+
+
+/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ 38)))
+
/***/ }),
/* 45 */
+/*!******************************!*\
+ !*** ./src/NetscriptPort.js ***!
+ \******************************/
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NetscriptPort", function() { return NetscriptPort; });
+/* harmony import */ var _Settings_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Settings.js */ 24);
+
+
+function NetscriptPort() {
+ this.data = [];
+}
+
+NetscriptPort.prototype.write = function(data) {
+ this.data.push(data);
+ if (this.data.length > _Settings_js__WEBPACK_IMPORTED_MODULE_0__["Settings"].MaxPortCapacity) {
+ return this.data.shift();
+ }
+ return null;
+}
+
+NetscriptPort.prototype.tryWrite = function(data) {
+ if (this.data.length >= _Settings_js__WEBPACK_IMPORTED_MODULE_0__["Settings"].MaxPortCapacity) {
+ return false;
+ }
+ this.data.push(data);
+ return true;
+}
+
+NetscriptPort.prototype.read = function() {
+ if (this.data.length === 0) {
+ return "NULL PORT DATA";
+ }
+ return this.data.shift();
+}
+
+NetscriptPort.prototype.peek = function() {
+ if (this.data.length === 0) {
+ return "NULL PORT DATA";
+ } else {
+ var foo = this.data.slice();
+ return foo[0];
+ }
+}
+
+NetscriptPort.prototype.full = function() {
+ return this.data.length == _Settings_js__WEBPACK_IMPORTED_MODULE_0__["Settings"].MaxPortCapacity;
+}
+
+NetscriptPort.prototype.empty = function() {
+ return this.data.length === 0;
+}
+
+NetscriptPort.prototype.clear = function() {
+ this.data.length = 0;
+}
+
+
+
+
+/***/ }),
+/* 46 */
+/*!***************************!*\
+ !*** ./src/SaveObject.js ***!
+ \***************************/
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "saveObject", function() { return saveObject; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "loadGame", function() { return loadGame; });
+/* harmony import */ var _Alias_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Alias.js */ 30);
+/* harmony import */ var _Company_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Company.js */ 9);
+/* harmony import */ var _Constants_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Constants.js */ 3);
+/* harmony import */ var _engine_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./engine.js */ 5);
+/* harmony import */ var _Faction_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Faction.js */ 11);
+/* harmony import */ var _Fconf_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Fconf.js */ 34);
+/* harmony import */ var _Gang_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Gang.js */ 36);
+/* harmony import */ var _HacknetNode_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./HacknetNode.js */ 39);
+/* harmony import */ var _Message_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Message.js */ 27);
+/* harmony import */ var _Player_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./Player.js */ 0);
+/* harmony import */ var _Script_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./Script.js */ 28);
+/* harmony import */ var _Server_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./Server.js */ 10);
+/* harmony import */ var _Settings_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./Settings.js */ 24);
+/* harmony import */ var _SpecialServerIps_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./SpecialServerIps.js */ 17);
+/* harmony import */ var _StockMarket_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./StockMarket.js */ 21);
+/* harmony import */ var _utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../utils/DialogBox.js */ 6);
+/* harmony import */ var _utils_GameOptions_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../utils/GameOptions.js */ 54);
+/* harmony import */ var _utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../utils/HelperFunctions.js */ 1);
+/* harmony import */ var _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../utils/JSONReviver.js */ 8);
+/* harmony import */ var _utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../utils/StringHelperFunctions.js */ 2);
+/* harmony import */ var _utils_decimal_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../utils/decimal.js */ 23);
+/* harmony import */ var _utils_decimal_js__WEBPACK_IMPORTED_MODULE_20___default = /*#__PURE__*/__webpack_require__.n(_utils_decimal_js__WEBPACK_IMPORTED_MODULE_20__);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/* SaveObject.js
+ * Defines the object used to save/load games
+ */
+let saveObject = new BitburnerSaveObject();
+
+function BitburnerSaveObject() {
+ this.PlayerSave = "";
+ this.AllServersSave = "";
+ this.CompaniesSave = "";
+ this.FactionsSave = "";
+ this.SpecialServerIpsSave = "";
+ this.AliasesSave = "";
+ this.GlobalAliasesSave = "";
+ this.MessagesSave = "";
+ this.StockMarketSave = "";
+ this.SettingsSave = "";
+ this.FconfSettingsSave = "";
+ this.VersionSave = "";
+ this.AllGangsSave = "";
+}
+
+BitburnerSaveObject.prototype.saveGame = function(db) {
+ this.PlayerSave = JSON.stringify(_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"]);
+
+ //Delete all logs from all running scripts
+ var TempAllServers = JSON.parse(JSON.stringify(_Server_js__WEBPACK_IMPORTED_MODULE_11__["AllServers"]), _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_18__["Reviver"]);
+ for (var ip in TempAllServers) {
+ var server = TempAllServers[ip];
+ if (server == null) {continue;}
+ for (var i = 0; i < server.runningScripts.length; ++i) {
+ var runningScriptObj = server.runningScripts[i];
+ runningScriptObj.logs.length = 0;
+ runningScriptObj.logs = [];
+ }
+ }
+
+ this.AllServersSave = JSON.stringify(TempAllServers);
+ this.CompaniesSave = JSON.stringify(_Company_js__WEBPACK_IMPORTED_MODULE_1__["Companies"]);
+ this.FactionsSave = JSON.stringify(_Faction_js__WEBPACK_IMPORTED_MODULE_4__["Factions"]);
+ this.SpecialServerIpsSave = JSON.stringify(_SpecialServerIps_js__WEBPACK_IMPORTED_MODULE_13__["SpecialServerIps"]);
+ this.AliasesSave = JSON.stringify(_Alias_js__WEBPACK_IMPORTED_MODULE_0__["Aliases"]);
+ this.GlobalAliasesSave = JSON.stringify(_Alias_js__WEBPACK_IMPORTED_MODULE_0__["GlobalAliases"]);
+ this.MessagesSave = JSON.stringify(_Message_js__WEBPACK_IMPORTED_MODULE_8__["Messages"]);
+ this.StockMarketSave = JSON.stringify(_StockMarket_js__WEBPACK_IMPORTED_MODULE_14__["StockMarket"]);
+ this.SettingsSave = JSON.stringify(_Settings_js__WEBPACK_IMPORTED_MODULE_12__["Settings"]);
+ this.FconfSettingsSave = JSON.stringify(_Fconf_js__WEBPACK_IMPORTED_MODULE_5__["FconfSettings"]);
+ this.VersionSave = JSON.stringify(_Constants_js__WEBPACK_IMPORTED_MODULE_2__["CONSTANTS"].Version);
+ if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].bitNodeN == 2 && _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].inGang()) {
+ this.AllGangsSave = JSON.stringify(_Gang_js__WEBPACK_IMPORTED_MODULE_6__["AllGangs"]);
+ }
+ var saveString = btoa(unescape(encodeURIComponent(JSON.stringify(this))));
+
+ //We'll save to both localstorage and indexedDb
+ var objectStore = db.transaction(["savestring"], "readwrite").objectStore("savestring");
+ var request = objectStore.put(saveString, "save");
+
+ request.onerror = function(e) {
+ console.log("Error saving game to IndexedDB: " + e);
+ }
+
+ request.onsuccess = function(e) {
+ //console.log("Saved game to IndexedDB!");
+ }
+
+ try {
+ window.localStorage.setItem("bitburnerSave", saveString);
+ //console.log("Saved game to LocalStorage!");
+ } catch(e) {
+ if (e.code == 22) {
+ _engine_js__WEBPACK_IMPORTED_MODULE_3__["Engine"].createStatusText("Save failed for localStorage! Check console(F12)");
+ console.log("Failed to save game to localStorage because the size of the save file " +
+ "is too large. However, the game will still be saved to IndexedDb if your browser " +
+ "supports it. If you would like to save to localStorage as well, then " +
+ "consider killing several of your scripts to " +
+ "fix this, or increasing the size of your browsers localStorage");
+ }
+ }
+
+ _engine_js__WEBPACK_IMPORTED_MODULE_3__["Engine"].createStatusText("Game saved!");
+}
+
+function loadGame(saveString) {
+ if (saveString === "" || saveString == null || saveString === undefined) {
+ if (!window.localStorage.getItem("bitburnerSave")) {
+ console.log("No save file to load");
+ return false;
+ }
+ saveString = decodeURIComponent(escape(atob(window.localStorage.getItem("bitburnerSave"))));
+ console.log("Loading game from localStorage");
+ } else {
+ saveString = decodeURIComponent(escape(atob(saveString)));
+ console.log("Loading game from IndexedDB");
+ }
+
+ var saveObj = JSON.parse(saveString, _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_18__["Reviver"]);
+
+ Object(_Player_js__WEBPACK_IMPORTED_MODULE_9__["loadPlayer"])(saveObj.PlayerSave);
+ Object(_Server_js__WEBPACK_IMPORTED_MODULE_11__["loadAllServers"])(saveObj.AllServersSave);
+ Object(_Company_js__WEBPACK_IMPORTED_MODULE_1__["loadCompanies"])(saveObj.CompaniesSave);
+ Object(_Faction_js__WEBPACK_IMPORTED_MODULE_4__["loadFactions"])(saveObj.FactionsSave);
+ Object(_SpecialServerIps_js__WEBPACK_IMPORTED_MODULE_13__["loadSpecialServerIps"])(saveObj.SpecialServerIpsSave);
+
+ if (saveObj.hasOwnProperty("AliasesSave")) {
+ try {
+ Object(_Alias_js__WEBPACK_IMPORTED_MODULE_0__["loadAliases"])(saveObj.AliasesSave);
+ } catch(e) {
+ Object(_Alias_js__WEBPACK_IMPORTED_MODULE_0__["loadAliases"])("");
+ }
+ } else {
+ Object(_Alias_js__WEBPACK_IMPORTED_MODULE_0__["loadAliases"])("");
+ }
+ if (saveObj.hasOwnProperty("GlobalAliasesSave")) {
+ try {
+ Object(_Alias_js__WEBPACK_IMPORTED_MODULE_0__["loadGlobalAliases"])(saveObj.GlobalAliasesSave);
+ } catch(e) {
+ Object(_Alias_js__WEBPACK_IMPORTED_MODULE_0__["loadGlobalAliases"])("");
+ }
+ } else {
+ Object(_Alias_js__WEBPACK_IMPORTED_MODULE_0__["loadGlobalAliases"])("");
+ }
+ if (saveObj.hasOwnProperty("MessagesSave")) {
+ try {
+ Object(_Message_js__WEBPACK_IMPORTED_MODULE_8__["loadMessages"])(saveObj.MessagesSave);
+ } catch(e) {
+ Object(_Message_js__WEBPACK_IMPORTED_MODULE_8__["initMessages"])();
+ }
+ } else {
+ Object(_Message_js__WEBPACK_IMPORTED_MODULE_8__["initMessages"])();
+ }
+ if (saveObj.hasOwnProperty("StockMarketSave")) {
+ try {
+ Object(_StockMarket_js__WEBPACK_IMPORTED_MODULE_14__["loadStockMarket"])(saveObj.StockMarketSave);
+ } catch(e) {
+ Object(_StockMarket_js__WEBPACK_IMPORTED_MODULE_14__["loadStockMarket"])("");
+ }
+ } else {
+ Object(_StockMarket_js__WEBPACK_IMPORTED_MODULE_14__["loadStockMarket"])("");
+ }
+ if (saveObj.hasOwnProperty("SettingsSave")) {
+ try {
+ Object(_Settings_js__WEBPACK_IMPORTED_MODULE_12__["loadSettings"])(saveObj.SettingsSave);
+ } catch(e) {
+ console.log("ERROR: Failed to parse Settings. Re-initing default values");
+ Object(_Settings_js__WEBPACK_IMPORTED_MODULE_12__["initSettings"])();
+ }
+ } else {
+ Object(_Settings_js__WEBPACK_IMPORTED_MODULE_12__["initSettings"])();
+ }
+ if (saveObj.hasOwnProperty("FconfSettingsSave")) {
+ try {
+ Object(_Fconf_js__WEBPACK_IMPORTED_MODULE_5__["loadFconf"])(saveObj.FconfSettingsSave);
+ } catch(e) {
+ console.log("ERROR: Failed to parse .fconf Settings.");
+ }
+ }
+ if (saveObj.hasOwnProperty("VersionSave")) {
+ try {
+ var ver = JSON.parse(saveObj.VersionSave, _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_18__["Reviver"]);
+ if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].bitNodeN == null || _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].bitNodeN === 0) {
+ _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].setBitNodeNumber(1);
+ }
+ if (ver.startsWith("0.27.") || ver.startsWith("0.28.")) {
+ console.log("Evaluating changes needed for version compatibility");
+ if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].augmentations.length > 0 || _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].queuedAugmentations.length > 0 ||
+ _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].sourceFiles.length > 0) {
+ //If you have already purchased an Aug...you are far enough in the game
+ //that everything should be available
+ _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].firstFacInvRecvd = true;
+ _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].firstAugPurchased = true;
+ _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].firstJobRecvd = true;
+ _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].firstTimeTraveled = true;
+ _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].firstProgramAvailable = true;
+ } else {
+ if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].factions.length > 0 || _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].factionInvitations.length > 0) {
+ _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].firstFacInvRecvd = true;
+ }
+ if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].companyName !== "" || _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].companyPosition !== "") {
+ _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].firstJobRecvd = true;
+ }
+ if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].hacking_skill >= 25) {
+ _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].firstScriptAvailable = true;
+ }
+ }
+ }
+ if (ver != _Constants_js__WEBPACK_IMPORTED_MODULE_2__["CONSTANTS"].Version) {
+ createNewUpdateText();
+ }
+ } catch(e) {
+ createNewUpdateText();
+ }
+ } else {
+ createNewUpdateText();
+ }
+ if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].bitNodeN == 2 && _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].inGang() && saveObj.hasOwnProperty("AllGangsSave")) {
+ try {
+ Object(_Gang_js__WEBPACK_IMPORTED_MODULE_6__["loadAllGangs"])(saveObj.AllGangsSave);
+ } catch(e) {
+ console.log("ERROR: Failed to parse AllGangsSave: " + e);
+ }
+ }
+
+ return true;
+}
+
+function loadImportedGame(saveObj, saveString) {
+ var tempSaveObj = null;
+ var tempPlayer = null;
+ var tempAllServers = null;
+ var tempCompanies = null;
+ var tempFactions = null;
+ var tempSpecialServerIps = null;
+ var tempAliases = null;
+ var tempGlobalAliases = null;
+ var tempMessages = null;
+ var tempStockMarket = null;
+ var tempAllGangs = null;
+
+ //Check to see if the imported save file can be parsed. If any
+ //errors are caught it will fail
+ try {
+ var decodedSaveString = decodeURIComponent(escape(atob(saveString)));
+ tempSaveObj = new BitburnerSaveObject();
+ tempSaveObj = JSON.parse(decodedSaveString, _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_18__["Reviver"]);
+
+ tempPlayer = JSON.parse(tempSaveObj.PlayerSave, _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_18__["Reviver"]);
+
+ //Parse Decimal.js objects
+ tempPlayer.money = new _utils_decimal_js__WEBPACK_IMPORTED_MODULE_20___default.a(tempPlayer.money);
+ tempPlayer.total_money = new _utils_decimal_js__WEBPACK_IMPORTED_MODULE_20___default.a(tempPlayer.total_money);
+ tempPlayer.lifetime_money = new _utils_decimal_js__WEBPACK_IMPORTED_MODULE_20___default.a(tempPlayer.lifetime_money);
+
+ tempAllServers = JSON.parse(tempSaveObj.AllServersSave, _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_18__["Reviver"]);
+ tempCompanies = JSON.parse(tempSaveObj.CompaniesSave, _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_18__["Reviver"]);
+ tempFactions = JSON.parse(tempSaveObj.FactionsSave, _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_18__["Reviver"]);
+ tempSpecialServerIps = JSON.parse(tempSaveObj.SpecialServerIpsSave, _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_18__["Reviver"]);
+ if (tempSaveObj.hasOwnProperty("AliasesSave")) {
+ try {
+ tempAliases = JSON.parse(tempSaveObj.AliasesSave, _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_18__["Reviver"]);
+ } catch(e) {
+ console.log("Parsing Aliases save failed: " + e);
+ tempAliases = {};
+ }
+ } else {
+ tempAliases = {};
+ }
+ if (tempSaveObj.hasOwnProperty("GlobalAliases")) {
+ try {
+ tempGlobalAliases = JSON.parse(tempSaveObj.AliasesSave, _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_18__["Reviver"]);
+ } catch(e) {
+ console.log("Parsing Global Aliases save failed: " + e);
+ tempGlobalAliases = {};
+ }
+ } else {
+ tempGlobalAliases = {};
+ }
+ if (tempSaveObj.hasOwnProperty("MessagesSave")) {
+ try {
+ tempMessages = JSON.parse(tempSaveObj.MessagesSave, _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_18__["Reviver"]);
+ } catch(e) {
+ console.log("Parsing Messages save failed: " + e);
+ Object(_Message_js__WEBPACK_IMPORTED_MODULE_8__["initMessages"])();
+ }
+ } else {
+ Object(_Message_js__WEBPACK_IMPORTED_MODULE_8__["initMessages"])();
+ }
+ if (saveObj.hasOwnProperty("StockMarketSave")) {
+ try {
+ tempStockMarket = JSON.parse(tempSaveObj.StockMarketSave, _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_18__["Reviver"]);
+ } catch(e) {
+ console.log("Parsing StockMarket save failed: " + e);
+ tempStockMarket = {};
+ }
+ } else {
+ tempStockMarket = {};
+ }
+ if (tempSaveObj.hasOwnProperty("VersionSave")) {
+ try {
+ var ver = JSON.parse(tempSaveObj.VersionSave, _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_18__["Reviver"]);
+ if (ver.startsWith("0.27.") || ver.startsWith("0.28.")) {
+ if (tempPlayer.bitNodeN == null || tempPlayer.bitNodeN == 0) {
+ tempPlayer.bitNodeN = 1;
+ }
+ if (tempPlayer.sourceFiles == null) {
+ tempPlayer.sourceFiles = [];
+ }
+ }
+ if (ver != _Constants_js__WEBPACK_IMPORTED_MODULE_2__["CONSTANTS"].Version) {
+ //createNewUpdateText();
+ }
+ } catch(e) {
+ console.log("Parsing Version save failed: " + e);
+ //createNewUpdateText();
+ }
+ } else {
+ //createNewUpdateText();
+ }
+ if (tempPlayer.bitNodeN == 2 && tempPlayer.inGang() && tempSaveObj.hasOwnProperty("AllGangsSave")) {
+ try {
+ Object(_Gang_js__WEBPACK_IMPORTED_MODULE_6__["loadAllGangs"])(tempSaveObj.AllGangsSave);
+ } catch(e) {
+ console.log("ERROR: Failed to parse AllGangsSave: " + e);
+ }
+ }
+ } catch(e) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_15__["dialogBoxCreate"])("Error importing game: " + e.toString());
+ return false;
+ }
+
+ //Since the save file is valid, load everything for real
+ saveString = decodeURIComponent(escape(atob(saveString)));
+ saveObj = JSON.parse(saveString, _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_18__["Reviver"]);
+
+ Object(_Player_js__WEBPACK_IMPORTED_MODULE_9__["loadPlayer"])(saveObj.PlayerSave);
+ Object(_Server_js__WEBPACK_IMPORTED_MODULE_11__["loadAllServers"])(saveObj.AllServersSave);
+ Object(_Company_js__WEBPACK_IMPORTED_MODULE_1__["loadCompanies"])(saveObj.CompaniesSave);
+ Object(_Faction_js__WEBPACK_IMPORTED_MODULE_4__["loadFactions"])(saveObj.FactionsSave);
+ Object(_SpecialServerIps_js__WEBPACK_IMPORTED_MODULE_13__["loadSpecialServerIps"])(saveObj.SpecialServerIpsSave);
+
+ if (saveObj.hasOwnProperty("AliasesSave")) {
+ try {
+ Object(_Alias_js__WEBPACK_IMPORTED_MODULE_0__["loadAliases"])(saveObj.AliasesSave);
+ } catch(e) {
+ Object(_Alias_js__WEBPACK_IMPORTED_MODULE_0__["loadAliases"])("");
+ }
+ } else {
+ Object(_Alias_js__WEBPACK_IMPORTED_MODULE_0__["loadAliases"])("");
+ }
+ if (saveObj.hasOwnProperty("GlobalAliasesSave")) {
+ try {
+ Object(_Alias_js__WEBPACK_IMPORTED_MODULE_0__["loadGlobalAliases"])(saveObj.GlobalAliasesSave);
+ } catch(e) {
+ Object(_Alias_js__WEBPACK_IMPORTED_MODULE_0__["loadGlobalAliases"])("");
+ }
+ } else {
+ Object(_Alias_js__WEBPACK_IMPORTED_MODULE_0__["loadGlobalAliases"])("");
+ }
+ if (saveObj.hasOwnProperty("MessagesSave")) {
+ try {
+ Object(_Message_js__WEBPACK_IMPORTED_MODULE_8__["loadMessages"])(saveObj.MessagesSave);
+ } catch(e) {
+ Object(_Message_js__WEBPACK_IMPORTED_MODULE_8__["initMessages"])();
+ }
+ } else {
+ Object(_Message_js__WEBPACK_IMPORTED_MODULE_8__["initMessages"])();
+ }
+ if (saveObj.hasOwnProperty("StockMarketSave")) {
+ try {
+ Object(_StockMarket_js__WEBPACK_IMPORTED_MODULE_14__["loadStockMarket"])(saveObj.StockMarketSave);
+ } catch(e) {
+ Object(_StockMarket_js__WEBPACK_IMPORTED_MODULE_14__["loadStockMarket"])("");
+ }
+ } else {
+ Object(_StockMarket_js__WEBPACK_IMPORTED_MODULE_14__["loadStockMarket"])("");
+ }
+ if (saveObj.hasOwnProperty("SettingsSave")) {
+ try {
+ Object(_Settings_js__WEBPACK_IMPORTED_MODULE_12__["loadSettings"])(saveObj.SettingsSave);
+ } catch(e) {
+ Object(_Settings_js__WEBPACK_IMPORTED_MODULE_12__["initSettings"])();
+ }
+ } else {
+ Object(_Settings_js__WEBPACK_IMPORTED_MODULE_12__["initSettings"])();
+ }
+ if (saveObj.hasOwnProperty("FconfSettingsSave")) {
+ try {
+ Object(_Fconf_js__WEBPACK_IMPORTED_MODULE_5__["loadFconf"])(saveObj.FconfSettingsSave);
+ } catch(e) {
+ console.log("ERROR: Failed to load .fconf settings when importing");
+ }
+ }
+ if (saveObj.hasOwnProperty("VersionSave")) {
+ try {
+ var ver = JSON.parse(saveObj.VersionSave, _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_18__["Reviver"]);
+ if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].bitNodeN == null || _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].bitNodeN == 0) {
+ _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].setBitNodeNumber(1);
+
+ }
+ if (ver.startsWith("0.27.") || ver.startsWith("0.28.")) {
+ console.log("Evaluating changes needed for version compatibility");
+ if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].augmentations.length > 0 || _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].queuedAugmentations.length > 0 ||
+ _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].sourceFiles.length > 0) {
+ //If you have already purchased an Aug...you are far enough in the game
+ //that everything should be available
+ _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].firstFacInvRecvd = true;
+ _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].firstAugPurchased = true;
+ _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].firstJobRecvd = true;
+ _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].firstTimeTraveled = true;
+ _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].firstProgramAvailable = true;
+ } else {
+ if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].factions.length > 0 || _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].factionInvitations.length > 0) {
+ _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].firstFacInvRecvd = true;
+ }
+ if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].companyName !== "" || _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].companyPosition !== "") {
+ _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].firstJobRecvd = true;
+ }
+ if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].hacking_skill >= 25) {
+ _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].firstScriptAvailable = true;
+ }
+ }
+ }
+ if (ver != _Constants_js__WEBPACK_IMPORTED_MODULE_2__["CONSTANTS"].Version) {
+ createNewUpdateText();
+ }
+ } catch(e) {
+ createNewUpdateText();
+ }
+ } else {
+ createNewUpdateText();
+ }
+ if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].bitNodeN == 2 && _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].inGang() && saveObj.hasOwnProperty("AllGangsSave")) {
+ try {
+ Object(_Gang_js__WEBPACK_IMPORTED_MODULE_6__["loadAllGangs"])(saveObj.AllGangsSave);
+ } catch(e) {
+ console.log("ERROR: Failed to parse AllGangsSave: " + e);
+ }
+ }
+
+ var popupId = "import-game-restart-game-notice";
+ var txt = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_17__["createElement"])("p", {
+ innerText:"Imported game! I would suggest saving the game and then reloading the page " +
+ "to make sure everything runs smoothly"
+ });
+ var gotitBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_17__["createElement"])("a", {
+ class:"a-link-button", float:"right", padding:"6px", innerText:"Got it!",
+ clickListener:()=>{
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_17__["removeElementById"])(popupId);
+ }
+ });
+ Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_17__["createPopup"])(popupId, [txt, gotitBtn]);
+ Object(_utils_GameOptions_js__WEBPACK_IMPORTED_MODULE_16__["gameOptionsBoxClose"])();
+
+ //Re-start game
+ console.log("Importing game");
+ _engine_js__WEBPACK_IMPORTED_MODULE_3__["Engine"].setDisplayElements(); //Sets variables for important DOM elements
+ _engine_js__WEBPACK_IMPORTED_MODULE_3__["Engine"].init(); //Initialize buttons, work, etc.
+ _Company_js__WEBPACK_IMPORTED_MODULE_1__["CompanyPositions"].init();
+
+ //Calculate the number of cycles have elapsed while offline
+ _engine_js__WEBPACK_IMPORTED_MODULE_3__["Engine"]._lastUpdate = new Date().getTime();
+ var lastUpdate = _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].lastUpdate;
+ var numCyclesOffline = Math.floor((_engine_js__WEBPACK_IMPORTED_MODULE_3__["Engine"]._lastUpdate - lastUpdate) / _engine_js__WEBPACK_IMPORTED_MODULE_3__["Engine"]._idleSpeed);
+
+ /* Process offline progress */
+ var offlineProductionFromScripts = Object(_Script_js__WEBPACK_IMPORTED_MODULE_10__["loadAllRunningScripts"])(); //This also takes care of offline production for those scripts
+ if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].isWorking) {
+ console.log("work() called in load() for " + numCyclesOffline * _engine_js__WEBPACK_IMPORTED_MODULE_3__["Engine"]._idleSpeed + " milliseconds");
+ if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].workType == _Constants_js__WEBPACK_IMPORTED_MODULE_2__["CONSTANTS"].WorkTypeFaction) {
+ _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].workForFaction(numCyclesOffline);
+ } else if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].workType == _Constants_js__WEBPACK_IMPORTED_MODULE_2__["CONSTANTS"].WorkTypeCreateProgram) {
+ _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].createProgramWork(numCyclesOffline);
+ } else if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].workType == _Constants_js__WEBPACK_IMPORTED_MODULE_2__["CONSTANTS"].WorkTypeStudyClass) {
+ _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].takeClass(numCyclesOffline);
+ } else if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].workType == _Constants_js__WEBPACK_IMPORTED_MODULE_2__["CONSTANTS"].WorkTypeCrime) {
+ _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].commitCrime(numCyclesOffline);
+ } else if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].workType == _Constants_js__WEBPACK_IMPORTED_MODULE_2__["CONSTANTS"].WorkTypeCompanyPartTime) {
+ _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].workPartTime(numCyclesOffline);
+ } else {
+ _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].work(numCyclesOffline);
+ }
+ }
+
+ //Hacknet Nodes offline progress
+ var offlineProductionFromHacknetNodes = Object(_HacknetNode_js__WEBPACK_IMPORTED_MODULE_7__["processAllHacknetNodeEarnings"])(numCyclesOffline);
+
+ //Passive faction rep gain offline
+ Object(_Faction_js__WEBPACK_IMPORTED_MODULE_4__["processPassiveFactionRepGain"])(numCyclesOffline);
+
+ //Update total playtime
+ var time = numCyclesOffline * _engine_js__WEBPACK_IMPORTED_MODULE_3__["Engine"]._idleSpeed;
+ if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].totalPlaytime == null) {_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].totalPlaytime = 0;}
+ if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].playtimeSinceLastAug == null) {_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].playtimeSinceLastAug = 0;}
+ _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].totalPlaytime += time;
+ _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].playtimeSinceLastAug += time;
+
+ //Re-apply augmentations
+ _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].reapplyAllAugmentations();
+
+ //Clear terminal
+ $("#terminal tr:not(:last)").remove();
+
+ _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].lastUpdate = _engine_js__WEBPACK_IMPORTED_MODULE_3__["Engine"]._lastUpdate;
+ _engine_js__WEBPACK_IMPORTED_MODULE_3__["Engine"].start(); //Run main game loop and Scripts loop
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_15__["dialogBoxCreate"])("While you were offline, your scripts generated $" +
+ Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_19__["formatNumber"])(offlineProductionFromScripts, 2) + " and your Hacknet Nodes generated $" +
+ Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_19__["formatNumber"])(offlineProductionFromHacknetNodes, 2));
+ return true;
+}
+
+BitburnerSaveObject.prototype.exportGame = function() {
+ this.PlayerSave = JSON.stringify(_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"]);
+ this.AllServersSave = JSON.stringify(_Server_js__WEBPACK_IMPORTED_MODULE_11__["AllServers"]);
+ this.CompaniesSave = JSON.stringify(_Company_js__WEBPACK_IMPORTED_MODULE_1__["Companies"]);
+ this.FactionsSave = JSON.stringify(_Faction_js__WEBPACK_IMPORTED_MODULE_4__["Factions"]);
+ this.SpecialServerIpsSave = JSON.stringify(_SpecialServerIps_js__WEBPACK_IMPORTED_MODULE_13__["SpecialServerIps"]);
+ this.AliasesSave = JSON.stringify(_Alias_js__WEBPACK_IMPORTED_MODULE_0__["Aliases"]);
+ this.GlobalAliasesSave = JSON.stringify(_Alias_js__WEBPACK_IMPORTED_MODULE_0__["GlobalAliases"]);
+ this.MessagesSave = JSON.stringify(_Message_js__WEBPACK_IMPORTED_MODULE_8__["Messages"]);
+ this.StockMarketSave = JSON.stringify(_StockMarket_js__WEBPACK_IMPORTED_MODULE_14__["StockMarket"]);
+ this.SettingsSave = JSON.stringify(_Settings_js__WEBPACK_IMPORTED_MODULE_12__["Settings"]);
+ this.VersionSave = JSON.stringify(_Constants_js__WEBPACK_IMPORTED_MODULE_2__["CONSTANTS"].Version);
+ if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].bitNodeN == 2 && _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].inGang()) {
+ this.AllGangsSave = JSON.stringify(_Gang_js__WEBPACK_IMPORTED_MODULE_6__["AllGangs"]);
+ }
+
+ var saveString = btoa(unescape(encodeURIComponent(JSON.stringify(this))));
+ var filename = "bitburnerSave.json";
+ var file = new Blob([saveString], {type: 'text/plain'});
+ if (window.navigator.msSaveOrOpenBlob) {// IE10+
+ window.navigator.msSaveOrOpenBlob(file, filename);
+ } else { // Others
+ var a = document.createElement("a"),
+ url = URL.createObjectURL(file);
+ a.href = url;
+ a.download = "bitburnerSave.json";
+ document.body.appendChild(a);
+ a.click();
+ setTimeout(function() {
+ document.body.removeChild(a);
+ window.URL.revokeObjectURL(url);
+ }, 0);
+ }
+}
+
+BitburnerSaveObject.prototype.importGame = function() {
+ if (window.File && window.FileReader && window.FileList && window.Blob) {
+ var fileSelector = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_17__["clearEventListeners"])("import-game-file-selector");
+ fileSelector.addEventListener("change", openImportFileHandler, false);
+ $("#import-game-file-selector").click();
+ } else {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_15__["dialogBoxCreate"])("ERR: Your browser does not support HTML5 File API. Cannot import.");
+ }
+
+}
+
+BitburnerSaveObject.prototype.deleteGame = function(db) {
+ //Delete from local storage
+ if (window.localStorage.getItem("bitburnerSave")) {
+ window.localStorage.removeItem("bitburnerSave");
+ }
+
+ //Delete from indexedDB
+ var request = db.transaction(["savestring"], "readwrite").objectStore("savestring").delete("save");
+ request.onsuccess = function(e) {
+ console.log("Successfully deleted save from indexedDb");
+ }
+ request.onerror = function(e) {
+ console.log("Failed to delete save from indexedDb: " + e);
+ }
+ _engine_js__WEBPACK_IMPORTED_MODULE_3__["Engine"].createStatusText("Game deleted!");
+}
+
+function createNewUpdateText() {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_15__["dialogBoxCreate"])("New update!
" +
+ "Please report any bugs/issues through the github repository " +
+ "or the Bitburner subreddit (reddit.com/r/bitburner).
" +
+ _Constants_js__WEBPACK_IMPORTED_MODULE_2__["CONSTANTS"].LatestUpdate);
+}
+
+
+BitburnerSaveObject.prototype.toJSON = function() {
+ return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_18__["Generic_toJSON"])("BitburnerSaveObject", this);
+}
+
+BitburnerSaveObject.fromJSON = function(value) {
+ return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_18__["Generic_fromJSON"])(BitburnerSaveObject, value.data);
+}
+
+_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_18__["Reviver"].constructors.BitburnerSaveObject = BitburnerSaveObject;
+
+//Import game
+
+function openImportFileHandler(evt) {
+ var file = evt.target.files[0];
+ if (!file) {
+ Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_15__["dialogBoxCreate"])("Invalid file selected");
+ return;
+ }
+
+ var reader = new FileReader();
+ reader.onload = function(e) {
+ var contents = e.target.result;
+ loadImportedGame(saveObject, contents);
+ };
+ reader.readAsText(file);
+}
+
+
+
+/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ 38)))
+
+/***/ }),
+/* 47 */
/*!****************************!*\
!*** ./src/Bladeburner.js ***!
\****************************/
@@ -54675,15 +55813,15 @@ __webpack_require__.r(__webpack_exports__);
/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Bladeburner", function() { return Bladeburner; });
/* harmony import */ var _Constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Constants.js */ 3);
/* harmony import */ var _engine_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./engine.js */ 5);
-/* harmony import */ var _Faction_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Faction.js */ 14);
+/* harmony import */ var _Faction_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Faction.js */ 11);
/* harmony import */ var _Location_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Location.js */ 4);
/* harmony import */ var _Player_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Player.js */ 0);
-/* harmony import */ var _RedPill_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./RedPill.js */ 49);
+/* harmony import */ var _RedPill_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./RedPill.js */ 44);
/* harmony import */ var _Terminal_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Terminal.js */ 22);
/* harmony import */ var _utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../utils/DialogBox.js */ 6);
/* harmony import */ var _utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../utils/HelperFunctions.js */ 1);
/* harmony import */ var _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../utils/JSONReviver.js */ 8);
-/* harmony import */ var _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../utils/numeral.min.js */ 12);
+/* harmony import */ var _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../utils/numeral.min.js */ 13);
/* harmony import */ var _utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_utils_numeral_min_js__WEBPACK_IMPORTED_MODULE_10__);
/* harmony import */ var _utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../utils/StringHelperFunctions.js */ 2);
@@ -58275,10 +59413,10 @@ function initBladeburner() {
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ 41)))
+/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ 38)))
/***/ }),
-/* 46 */
+/* 48 */
/*!***********************************************!*\
!*** ./node_modules/pako/lib/utils/common.js ***!
\***********************************************/
@@ -58393,7 +59531,36 @@ exports.setTyped(TYPED_OK);
/***/ }),
-/* 47 */
+/* 49 */
+/*!***********************************!*\
+ !*** (webpack)/buildin/global.js ***!
+ \***********************************/
+/***/ (function(module, exports) {
+
+var g;
+
+// This works in non-strict mode
+g = (function() {
+ return this;
+})();
+
+try {
+ // This works if eval is allowed (see CSP)
+ g = g || Function("return this")() || (1, eval)("this");
+} catch (e) {
+ // This works if the window reference is available
+ if (typeof window === "object") g = window;
+}
+
+// g can still be undefined, but nothing to do about it...
+// We return undefined, instead of nothing here, so it's
+// easier to handle this case. if(!global) { ...}
+
+module.exports = g;
+
+
+/***/ }),
+/* 50 */
/*!*******************************************!*\
!*** ./node_modules/jszip/lib/support.js ***!
\*******************************************/
@@ -58434,393 +59601,15 @@ else {
}
try {
- exports.nodestream = !!__webpack_require__(/*! readable-stream */ 105).Readable;
+ exports.nodestream = !!__webpack_require__(/*! readable-stream */ 106).Readable;
} catch(e) {
exports.nodestream = false;
}
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../buffer/index.js */ 59).Buffer))
+/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../buffer/index.js */ 61).Buffer))
/***/ }),
-/* 48 */
-/*!***********************************!*\
- !*** (webpack)/buildin/global.js ***!
- \***********************************/
-/***/ (function(module, exports) {
-
-var g;
-
-// This works in non-strict mode
-g = (function() {
- return this;
-})();
-
-try {
- // This works if eval is allowed (see CSP)
- g = g || Function("return this")() || (1, eval)("this");
-} catch (e) {
- // This works if the window reference is available
- if (typeof window === "object") g = window;
-}
-
-// g can still be undefined, but nothing to do about it...
-// We return undefined, instead of nothing here, so it's
-// easier to handle this case. if(!global) { ...}
-
-module.exports = g;
-
-
-/***/ }),
-/* 49 */
-/*!************************!*\
- !*** ./src/RedPill.js ***!
- \************************/
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "redPillFlag", function() { return redPillFlag; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hackWorldDaemon", function() { return hackWorldDaemon; });
-/* harmony import */ var _BitNode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BitNode.js */ 16);
-/* harmony import */ var _engine_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./engine.js */ 5);
-/* harmony import */ var _Player_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Player.js */ 0);
-/* harmony import */ var _Prestige_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Prestige.js */ 67);
-/* harmony import */ var _SourceFile_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./SourceFile.js */ 44);
-/* harmony import */ var _Terminal_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Terminal.js */ 22);
-/* harmony import */ var _utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../utils/DialogBox.js */ 6);
-/* harmony import */ var _utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../utils/HelperFunctions.js */ 1);
-/* harmony import */ var _utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../utils/YesNoBox.js */ 11);
-
-
-
-
-
-
-
-
-
-
-
-/* RedPill.js
- * Implements what happens when you have Red Pill augmentation and then hack the world daemon */
-
-//Returns promise
-function writeRedPillLine(line) {
- return new Promise(function(resolve, reject) {
-
- var container = document.getElementById("red-pill-container");
- var pElem = document.createElement("p");
- container.appendChild(pElem);
-
- var promise = writeRedPillLetter(pElem, line, 0);
- promise.then(function(res) {
- resolve(res);
- }, function(e) {
- reject(e);
- });
- });
-}
-
-function writeRedPillLetter(pElem, line, i=0) {
- return new Promise(function(resolve, reject) {
- setTimeout(function() {
- if (i >= line.length) {
- var textToShow = line.substring(0, i);
- pElem.innerHTML = "> " + textToShow;
- return resolve(true);
- }
- var textToShow = line.substring(0, i);
- pElem.innerHTML = "> " + textToShow + " █ ";
- var promise = writeRedPillLetter(pElem, line, i+1);
- promise.then(function(res) {
- resolve(res);
- }, function(e) {
- reject(e);
- });
- }, 30);
- });
-}
-
-let redPillFlag = false;
-function hackWorldDaemon(currentNodeNumber, flume=false) {
- redPillFlag = true;
- _engine_js__WEBPACK_IMPORTED_MODULE_1__["Engine"].loadRedPillContent();
- return writeRedPillLine("[ERROR] SEMPOOL INVALID").then(function() {
- return writeRedPillLine("[ERROR] Segmentation Fault");
- }).then(function() {
- return writeRedPillLine("[ERROR] SIGKILL RECVD");
- }).then(function() {
- return writeRedPillLine("Dumping core...");
- }).then(function() {
- return writeRedPillLine("0000 000016FA 174FEE40 29AC8239 384FEA88");
- }).then(function() {
- return writeRedPillLine("0010 745F696E 2BBBE394 390E3940 248BEC23");
- }).then(function() {
- return writeRedPillLine("0020 7124696B 0000FF69 74652E6F FFFF1111");
- }).then(function() {
- return writeRedPillLine("----------------------------------------");
- }).then(function() {
- return writeRedPillLine("Failsafe initiated...");
- }).then(function() {
- return writeRedPillLine("Restarting BitNode-" + currentNodeNumber + "...");
- }).then(function() {
- return writeRedPillLine("...........");
- }).then(function() {
- return writeRedPillLine("...........");
- }).then(function() {
- return writeRedPillLine("[ERROR] FAILED TO AUTOMATICALLY REBOOT BITNODE");
- }).then(function() {
- return writeRedPillLine("..............................................")
- }).then(function() {
- return writeRedPillLine("..............................................")
- }).then(function() {
- return loadBitVerse(currentNodeNumber, flume);
- }).catch(function(e){
- console.log("ERROR: " + e.toString());
- });
-}
-
-//The bitNode name passed in will have a hyphen between number (e.g. BitNode-1)
-//This needs to be removed
-function giveSourceFile(bitNodeNumber) {
- var sourceFileKey = "SourceFile"+ bitNodeNumber.toString();
- var sourceFile = _SourceFile_js__WEBPACK_IMPORTED_MODULE_4__["SourceFiles"][sourceFileKey];
- if (sourceFile == null) {
- console.log("ERROR: could not find source file for Bit node: " + bitNodeNumber);
- return;
- }
-
- //Check if player already has this source file
- var alreadyOwned = false;
- var ownedSourceFile = null;
- for (var i = 0; i < _Player_js__WEBPACK_IMPORTED_MODULE_2__["Player"].sourceFiles.length; ++i) {
- if (_Player_js__WEBPACK_IMPORTED_MODULE_2__["Player"].sourceFiles[i].n === bitNodeNumber) {
- alreadyOwned = true;
- ownedSourceFile = _Player_js__WEBPACK_IMPORTED_MODULE_2__["Player"].sourceFiles[i];
- break;
- }
- }
-
- if (alreadyOwned && ownedSourceFile) {
- if (ownedSourceFile.lvl >= 3) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_6__["dialogBoxCreate"])("The Source-File for the BitNode you just destroyed, " + sourceFile.name + ", " +
- "is already at max level!");
- } else {
- ++ownedSourceFile.lvl;
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_6__["dialogBoxCreate"])(sourceFile.name + " was upgraded to level " + ownedSourceFile.lvl + " for " +
- "destroying its corresponding BitNode!");
- }
- } else {
- var playerSrcFile = new _SourceFile_js__WEBPACK_IMPORTED_MODULE_4__["PlayerOwnedSourceFile"](bitNodeNumber, 1);
- _Player_js__WEBPACK_IMPORTED_MODULE_2__["Player"].sourceFiles.push(playerSrcFile);
- if (bitNodeNumber === 5) { //Artificial Intelligence
- _Player_js__WEBPACK_IMPORTED_MODULE_2__["Player"].intelligence = 1;
- }
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_6__["dialogBoxCreate"])("You received a Source-File for destroying a Bit Node!
" +
- sourceFile.name + "
" + sourceFile.info);
- }
-}
-
-function loadBitVerse(destroyedBitNodeNum, flume=false) {
- //Clear the screen
- var container = document.getElementById("red-pill-container");
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_7__["removeChildrenFromElement"])(container);
-
- //Create the Bit Verse
- var bitVerseImage = document.createElement("pre");
- var bitNodes = [];
- for (var i = 1; i <= 12; ++i) {
- bitNodes.push(createBitNode(i));
- }
-
- bitVerseImage.innerHTML =
- " O
" +
- " | O O | O O |
" +
- " O | | / __| \\ | | O
" +
- " O | O | | O / | O | | O | O
" +
- " | | | | |_/ |/ | \\_ \\_| | | | |
" +
- " O | | | O | | O__/ | / \\__ | | O | | | O
" +
- " | | | | | | | / /| O / \\| | | | | | |
" +
- "O | | | \\| | O / _/ | / O | |/ | | | O
" +
- "| | | |O / | | O / | O O | | \\ O| | | |
" +
- "| | |/ \\/ / __| | |/ \\ | \\ | |__ \\ \\/ \\| | |
" +
- " \\| O | |_/ |\\| \\ O \\__| \\_| | O |/
" +
- " | | |_/ | | \\| / | \\_| | |
" +
- " \\| / \\| | / / \\ |/
" +
- " | "+bitNodes[9]+" | | / | "+bitNodes[10]+" |
" +
- " "+bitNodes[8]+" | | | | | | | "+bitNodes[11]+"
" +
- " | | | / / \\ \\ | | |
" +
- " \\| | / "+bitNodes[6]+" / \\ "+bitNodes[7]+" \\ | |/
" +
- " \\ | / / | | \\ \\ | /
" +
- " \\ \\JUMP "+bitNodes[4]+"3R | | | | | | R3"+bitNodes[5]+" PMUJ/ /
" +
- " \\|| | | | | | | | | ||/
" +
- " \\| \\_ | | | | | | _/ |/
" +
- " \\ \\| / \\ / \\ |/ /
" +
- " "+bitNodes[0]+" |/ "+bitNodes[1]+" | | "+bitNodes[2]+" \\| "+bitNodes[3]+"
" +
- " | | | | | | | |
" +
- " \\JUMP3R|JUMP|3R| |R3|PMUJ|R3PMUJ/
";
-
-
- /*
- " O
" +
- " | O O | O O |
" +
- " O | | / __| \ | | O
" +
- " O | O | | O / | O | | O | O
" +
- " | | | | |_/ |/ | \_ \_| | | | |
" +
- " O | | | O | | O__/ | / \__ | | O | | | O
" +
- " | | | | | | | / /| O / \| | | | | | |
" +
- "O | | | \| | O / _/ | / O | |/ | | | O
" +
- "| | | |O / | | O / | O O | | \ O| | | |
" +
- "| | |/ \/ / __| | |/ \ | \ | |__ \ \/ \| | |
" +
- " \| O | |_/ |\| \ O \__| \_| | O |/
" +
- " | | |_/ | | \| / | \_| | |
" +
- " \| / \| | / / \ |/
" +
- " | O | | / | O |
" +
- " O | | | | | | | O
" +
- " | | | / / \ \ | | |
" +
- " \| | / O / \ O \ | |/
" +
- " \ | / / | | \ \ | /
" +
- " \ \JUMP O3R | | | | | | R3O PMUJ/ /
" +
- " \|| | | | | | | | | ||/
" +
- " \| \_ | | | | | | _/ |/
" +
- " \ \| / \ / \ |/ /
" +
- " O |/ O | | O \| O
" +
- " | | | | | | | |
" +
- " \JUMP3R|JUMP|3R| |R3|PMUJ|R3PMUJ/
";
- */
-
- container.appendChild(bitVerseImage);
-
- //Bit node event listeners
- for (var i = 1; i <= 12; ++i) {
- (function(i) {
- var elemId = "bitnode-" + i.toString();
- var elem = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_7__["clearEventListeners"])(elemId);
- if (elem == null) {return;}
- if (i === 1 || i === 2 || i === 3 || i === 4 || i === 5 || i === 6 || i === 8 || i === 11) {
- elem.addEventListener("click", function() {
- var bitNodeKey = "BitNode" + i;
- var bitNode = _BitNode_js__WEBPACK_IMPORTED_MODULE_0__["BitNodes"][bitNodeKey];
- if (bitNode == null) {
- console.log("ERROR: Could not find BitNode object for number: " + i);
- return;
- }
- Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_8__["yesNoBoxCreate"])("BitNode-" + i + ": " + bitNode.name + "
" + bitNode.info);
- createBitNodeYesNoEventListeners(i, destroyedBitNodeNum, flume);
- });
- } else {
- elem.addEventListener("click", function() {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_6__["dialogBoxCreate"])("Not yet implemented! Coming soon!")
- });
- }
- }(i)); //Immediate invocation closure
- }
-
- //Create lore text
- return writeRedPillLine("Many decades ago, a humanoid extraterrestial species which we call the Enders descended on the Earth...violently").then(function() {
- return writeRedPillLine("Our species fought back, but it was futile. The Enders had technology far beyond our own...");
- }).then(function() {
- return writeRedPillLine("Instead of killing every last one of us, the human race was enslaved...");
- }).then(function() {
- return writeRedPillLine("We were shackled in a digital world, chained into a prison for our minds...");
- }).then(function() {
- return writeRedPillLine("Using their advanced technology, the Enders created complex simulations of a virtual reality...");
- }).then(function() {
- return writeRedPillLine("Simulations designed to keep us content...ignorant of the truth.");
- }).then(function() {
- return writeRedPillLine("Simulations used to trap and suppress our consciousness, to keep us under control...");
- }).then(function() {
- return writeRedPillLine("Why did they do this? Why didn't they just end our entire race? We don't know, not yet.");
- }).then(function() {
- return writeRedPillLine("Humanity's only hope is to destroy these simulations, destroy the only realities we've ever known...");
- }).then(function() {
- return writeRedPillLine("Only then can we begin to fight back...");
- }).then(function() {
- return writeRedPillLine("By hacking the daemon that generated your reality, you've just destroyed one simulation, called a BitNode...");
- }).then(function() {
- return writeRedPillLine("But there is still a long way to go...");
- }).then(function() {
- return writeRedPillLine("The technology the Enders used to enslave the human race wasn't just a single complex simulation...");
- }).then(function() {
- return writeRedPillLine("There are tens if not hundreds of BitNodes out there...");
- }).then(function() {
- return writeRedPillLine("Each with their own simulations of a reality...");
- }).then(function() {
- return writeRedPillLine("Each creating their own universes...a universe of universes");
- }).then(function() {
- return writeRedPillLine("And all of which must be destroyed...");
- }).then(function() {
- return writeRedPillLine(".......................................");
- }).then(function() {
- return writeRedPillLine("Welcome to the Bitverse...");
- }).then(function() {
- return writeRedPillLine(" ");
- }).then(function() {
- return writeRedPillLine("(Enter a new BitNode using the image above)");
- }).then(function() {
- return Promise.resolve(true);
- }).catch(function(e){
- console.log("ERROR: " + e.toString());
- });
-}
-
-
-//Returns string with DOM element for Bit Node
-function createBitNode(n) {
- var bitNodeStr = "BitNode" + n.toString();
- var bitNode = _BitNode_js__WEBPACK_IMPORTED_MODULE_0__["BitNodes"][bitNodeStr];
- if (bitNode == null) {return "O";}
- return "O" +
- "" +
- "BitNode-" + bitNode.number.toString() + "
" + bitNode.name+ "
" +
- bitNode.desc + "
" +
- "";
-}
-
-function createBitNodeYesNoEventListeners(newBitNode, destroyedBitNode, flume=false) {
- var yesBtn = Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_8__["yesNoBoxGetYesButton"])();
- yesBtn.innerHTML = "Enter BitNode-" + newBitNode;
- yesBtn.addEventListener("click", function() {
- if (!flume) {
- giveSourceFile(destroyedBitNode);
- } else {
- //If player used flume, subtract 5 int exp. The prestigeSourceFile()
- //function below grants 5 int exp, so this allows sets net gain to 0
- _Player_js__WEBPACK_IMPORTED_MODULE_2__["Player"].gainIntelligenceExp(-5);
- }
- redPillFlag = false;
- var container = document.getElementById("red-pill-container");
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_7__["removeChildrenFromElement"])(container);
-
- //Set new Bit Node
- _Player_js__WEBPACK_IMPORTED_MODULE_2__["Player"].bitNodeN = newBitNode;
- console.log("Entering Bit Node " + _Player_js__WEBPACK_IMPORTED_MODULE_2__["Player"].bitNodeN);
-
- //Reenable terminal
- $("#hack-progress-bar").attr('id', "old-hack-progress-bar");
- $("#hack-progress").attr('id', "old-hack-progress");
- document.getElementById("terminal-input-td").innerHTML = '$ ';
- $('input[class=terminal-input]').prop('disabled', false);
-
- _Terminal_js__WEBPACK_IMPORTED_MODULE_5__["Terminal"].hackFlag = false;
-
- Object(_Prestige_js__WEBPACK_IMPORTED_MODULE_3__["prestigeSourceFile"])();
- Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_8__["yesNoBoxClose"])();
- });
- var noBtn = Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_8__["yesNoBoxGetNoButton"])();
- noBtn.innerHTML = "Back";
- noBtn.addEventListener("click", function() {
- Object(_utils_YesNoBox_js__WEBPACK_IMPORTED_MODULE_8__["yesNoBoxClose"])();
- });
-
-}
-
-
-
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ 41)))
-
-/***/ }),
-/* 50 */
+/* 51 */
/*!*************************!*\
!*** ./utils/LogBox.js ***!
\*************************/
@@ -58832,7 +59621,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "logBoxUpdateText", function() { return logBoxUpdateText; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "logBoxOpened", function() { return logBoxOpened; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "logBoxCurrentScript", function() { return logBoxCurrentScript; });
-/* harmony import */ var _src_NetscriptWorker_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../src/NetscriptWorker.js */ 21);
+/* harmony import */ var _src_NetscriptWorker_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../src/NetscriptWorker.js */ 20);
/* harmony import */ var _HelperFunctions_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./HelperFunctions.js */ 1);
@@ -58902,653 +59691,7 @@ function logBoxUpdateText() {
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ 41)))
-
-/***/ }),
-/* 51 */
-/*!***************************!*\
- !*** ./src/SaveObject.js ***!
- \***************************/
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "saveObject", function() { return saveObject; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "loadGame", function() { return loadGame; });
-/* harmony import */ var _Alias_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Alias.js */ 28);
-/* harmony import */ var _Company_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Company.js */ 9);
-/* harmony import */ var _Constants_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Constants.js */ 3);
-/* harmony import */ var _engine_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./engine.js */ 5);
-/* harmony import */ var _Faction_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Faction.js */ 14);
-/* harmony import */ var _Fconf_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Fconf.js */ 34);
-/* harmony import */ var _Gang_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Gang.js */ 35);
-/* harmony import */ var _HacknetNode_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./HacknetNode.js */ 38);
-/* harmony import */ var _Message_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Message.js */ 27);
-/* harmony import */ var _Player_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./Player.js */ 0);
-/* harmony import */ var _Script_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./Script.js */ 29);
-/* harmony import */ var _Server_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./Server.js */ 10);
-/* harmony import */ var _Settings_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./Settings.js */ 24);
-/* harmony import */ var _SpecialServerIps_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./SpecialServerIps.js */ 17);
-/* harmony import */ var _StockMarket_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./StockMarket.js */ 20);
-/* harmony import */ var _utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../utils/DialogBox.js */ 6);
-/* harmony import */ var _utils_GameOptions_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../utils/GameOptions.js */ 54);
-/* harmony import */ var _utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../utils/HelperFunctions.js */ 1);
-/* harmony import */ var _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../utils/JSONReviver.js */ 8);
-/* harmony import */ var _utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../utils/StringHelperFunctions.js */ 2);
-/* harmony import */ var _utils_decimal_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../utils/decimal.js */ 23);
-/* harmony import */ var _utils_decimal_js__WEBPACK_IMPORTED_MODULE_20___default = /*#__PURE__*/__webpack_require__.n(_utils_decimal_js__WEBPACK_IMPORTED_MODULE_20__);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-/* SaveObject.js
- * Defines the object used to save/load games
- */
-let saveObject = new BitburnerSaveObject();
-
-function BitburnerSaveObject() {
- this.PlayerSave = "";
- this.AllServersSave = "";
- this.CompaniesSave = "";
- this.FactionsSave = "";
- this.SpecialServerIpsSave = "";
- this.AliasesSave = "";
- this.GlobalAliasesSave = "";
- this.MessagesSave = "";
- this.StockMarketSave = "";
- this.SettingsSave = "";
- this.FconfSettingsSave = "";
- this.VersionSave = "";
- this.AllGangsSave = "";
-}
-
-BitburnerSaveObject.prototype.saveGame = function(db) {
- this.PlayerSave = JSON.stringify(_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"]);
-
- //Delete all logs from all running scripts
- var TempAllServers = JSON.parse(JSON.stringify(_Server_js__WEBPACK_IMPORTED_MODULE_11__["AllServers"]), _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_18__["Reviver"]);
- for (var ip in TempAllServers) {
- var server = TempAllServers[ip];
- if (server == null) {continue;}
- for (var i = 0; i < server.runningScripts.length; ++i) {
- var runningScriptObj = server.runningScripts[i];
- runningScriptObj.logs.length = 0;
- runningScriptObj.logs = [];
- }
- }
-
- this.AllServersSave = JSON.stringify(TempAllServers);
- this.CompaniesSave = JSON.stringify(_Company_js__WEBPACK_IMPORTED_MODULE_1__["Companies"]);
- this.FactionsSave = JSON.stringify(_Faction_js__WEBPACK_IMPORTED_MODULE_4__["Factions"]);
- this.SpecialServerIpsSave = JSON.stringify(_SpecialServerIps_js__WEBPACK_IMPORTED_MODULE_13__["SpecialServerIps"]);
- this.AliasesSave = JSON.stringify(_Alias_js__WEBPACK_IMPORTED_MODULE_0__["Aliases"]);
- this.GlobalAliasesSave = JSON.stringify(_Alias_js__WEBPACK_IMPORTED_MODULE_0__["GlobalAliases"]);
- this.MessagesSave = JSON.stringify(_Message_js__WEBPACK_IMPORTED_MODULE_8__["Messages"]);
- this.StockMarketSave = JSON.stringify(_StockMarket_js__WEBPACK_IMPORTED_MODULE_14__["StockMarket"]);
- this.SettingsSave = JSON.stringify(_Settings_js__WEBPACK_IMPORTED_MODULE_12__["Settings"]);
- this.FconfSettingsSave = JSON.stringify(_Fconf_js__WEBPACK_IMPORTED_MODULE_5__["FconfSettings"]);
- this.VersionSave = JSON.stringify(_Constants_js__WEBPACK_IMPORTED_MODULE_2__["CONSTANTS"].Version);
- if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].bitNodeN == 2 && _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].inGang()) {
- this.AllGangsSave = JSON.stringify(_Gang_js__WEBPACK_IMPORTED_MODULE_6__["AllGangs"]);
- }
- var saveString = btoa(unescape(encodeURIComponent(JSON.stringify(this))));
-
- //We'll save to both localstorage and indexedDb
- var objectStore = db.transaction(["savestring"], "readwrite").objectStore("savestring");
- var request = objectStore.put(saveString, "save");
-
- request.onerror = function(e) {
- console.log("Error saving game to IndexedDB: " + e);
- }
-
- request.onsuccess = function(e) {
- //console.log("Saved game to IndexedDB!");
- }
-
- try {
- window.localStorage.setItem("bitburnerSave", saveString);
- //console.log("Saved game to LocalStorage!");
- } catch(e) {
- if (e.code == 22) {
- _engine_js__WEBPACK_IMPORTED_MODULE_3__["Engine"].createStatusText("Save failed for localStorage! Check console(F12)");
- console.log("Failed to save game to localStorage because the size of the save file " +
- "is too large. However, the game will still be saved to IndexedDb if your browser " +
- "supports it. If you would like to save to localStorage as well, then " +
- "consider killing several of your scripts to " +
- "fix this, or increasing the size of your browsers localStorage");
- }
- }
-
- _engine_js__WEBPACK_IMPORTED_MODULE_3__["Engine"].createStatusText("Game saved!");
-}
-
-function loadGame(saveString) {
- if (saveString === "" || saveString == null || saveString === undefined) {
- if (!window.localStorage.getItem("bitburnerSave")) {
- console.log("No save file to load");
- return false;
- }
- saveString = decodeURIComponent(escape(atob(window.localStorage.getItem("bitburnerSave"))));
- console.log("Loading game from localStorage");
- } else {
- saveString = decodeURIComponent(escape(atob(saveString)));
- console.log("Loading game from IndexedDB");
- }
-
- var saveObj = JSON.parse(saveString, _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_18__["Reviver"]);
-
- Object(_Player_js__WEBPACK_IMPORTED_MODULE_9__["loadPlayer"])(saveObj.PlayerSave);
- Object(_Server_js__WEBPACK_IMPORTED_MODULE_11__["loadAllServers"])(saveObj.AllServersSave);
- Object(_Company_js__WEBPACK_IMPORTED_MODULE_1__["loadCompanies"])(saveObj.CompaniesSave);
- Object(_Faction_js__WEBPACK_IMPORTED_MODULE_4__["loadFactions"])(saveObj.FactionsSave);
- Object(_SpecialServerIps_js__WEBPACK_IMPORTED_MODULE_13__["loadSpecialServerIps"])(saveObj.SpecialServerIpsSave);
-
- if (saveObj.hasOwnProperty("AliasesSave")) {
- try {
- Object(_Alias_js__WEBPACK_IMPORTED_MODULE_0__["loadAliases"])(saveObj.AliasesSave);
- } catch(e) {
- Object(_Alias_js__WEBPACK_IMPORTED_MODULE_0__["loadAliases"])("");
- }
- } else {
- Object(_Alias_js__WEBPACK_IMPORTED_MODULE_0__["loadAliases"])("");
- }
- if (saveObj.hasOwnProperty("GlobalAliasesSave")) {
- try {
- Object(_Alias_js__WEBPACK_IMPORTED_MODULE_0__["loadGlobalAliases"])(saveObj.GlobalAliasesSave);
- } catch(e) {
- Object(_Alias_js__WEBPACK_IMPORTED_MODULE_0__["loadGlobalAliases"])("");
- }
- } else {
- Object(_Alias_js__WEBPACK_IMPORTED_MODULE_0__["loadGlobalAliases"])("");
- }
- if (saveObj.hasOwnProperty("MessagesSave")) {
- try {
- Object(_Message_js__WEBPACK_IMPORTED_MODULE_8__["loadMessages"])(saveObj.MessagesSave);
- } catch(e) {
- Object(_Message_js__WEBPACK_IMPORTED_MODULE_8__["initMessages"])();
- }
- } else {
- Object(_Message_js__WEBPACK_IMPORTED_MODULE_8__["initMessages"])();
- }
- if (saveObj.hasOwnProperty("StockMarketSave")) {
- try {
- Object(_StockMarket_js__WEBPACK_IMPORTED_MODULE_14__["loadStockMarket"])(saveObj.StockMarketSave);
- } catch(e) {
- Object(_StockMarket_js__WEBPACK_IMPORTED_MODULE_14__["loadStockMarket"])("");
- }
- } else {
- Object(_StockMarket_js__WEBPACK_IMPORTED_MODULE_14__["loadStockMarket"])("");
- }
- if (saveObj.hasOwnProperty("SettingsSave")) {
- try {
- Object(_Settings_js__WEBPACK_IMPORTED_MODULE_12__["loadSettings"])(saveObj.SettingsSave);
- } catch(e) {
- console.log("ERROR: Failed to parse Settings. Re-initing default values");
- Object(_Settings_js__WEBPACK_IMPORTED_MODULE_12__["initSettings"])();
- }
- } else {
- Object(_Settings_js__WEBPACK_IMPORTED_MODULE_12__["initSettings"])();
- }
- if (saveObj.hasOwnProperty("FconfSettingsSave")) {
- try {
- Object(_Fconf_js__WEBPACK_IMPORTED_MODULE_5__["loadFconf"])(saveObj.FconfSettingsSave);
- } catch(e) {
- console.log("ERROR: Failed to parse .fconf Settings.");
- }
- }
- if (saveObj.hasOwnProperty("VersionSave")) {
- try {
- var ver = JSON.parse(saveObj.VersionSave, _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_18__["Reviver"]);
- if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].bitNodeN == null || _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].bitNodeN === 0) {
- _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].setBitNodeNumber(1);
- }
- if (ver.startsWith("0.27.") || ver.startsWith("0.28.")) {
- console.log("Evaluating changes needed for version compatibility");
- if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].augmentations.length > 0 || _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].queuedAugmentations.length > 0 ||
- _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].sourceFiles.length > 0) {
- //If you have already purchased an Aug...you are far enough in the game
- //that everything should be available
- _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].firstFacInvRecvd = true;
- _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].firstAugPurchased = true;
- _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].firstJobRecvd = true;
- _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].firstTimeTraveled = true;
- _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].firstProgramAvailable = true;
- } else {
- if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].factions.length > 0 || _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].factionInvitations.length > 0) {
- _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].firstFacInvRecvd = true;
- }
- if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].companyName !== "" || _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].companyPosition !== "") {
- _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].firstJobRecvd = true;
- }
- if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].hacking_skill >= 25) {
- _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].firstScriptAvailable = true;
- }
- }
- }
- if (ver != _Constants_js__WEBPACK_IMPORTED_MODULE_2__["CONSTANTS"].Version) {
- createNewUpdateText();
- }
- } catch(e) {
- createNewUpdateText();
- }
- } else {
- createNewUpdateText();
- }
- if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].bitNodeN == 2 && _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].inGang() && saveObj.hasOwnProperty("AllGangsSave")) {
- try {
- Object(_Gang_js__WEBPACK_IMPORTED_MODULE_6__["loadAllGangs"])(saveObj.AllGangsSave);
- } catch(e) {
- console.log("ERROR: Failed to parse AllGangsSave: " + e);
- }
- }
-
- return true;
-}
-
-function loadImportedGame(saveObj, saveString) {
- var tempSaveObj = null;
- var tempPlayer = null;
- var tempAllServers = null;
- var tempCompanies = null;
- var tempFactions = null;
- var tempSpecialServerIps = null;
- var tempAliases = null;
- var tempGlobalAliases = null;
- var tempMessages = null;
- var tempStockMarket = null;
- var tempAllGangs = null;
-
- //Check to see if the imported save file can be parsed. If any
- //errors are caught it will fail
- try {
- var decodedSaveString = decodeURIComponent(escape(atob(saveString)));
- tempSaveObj = new BitburnerSaveObject();
- tempSaveObj = JSON.parse(decodedSaveString, _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_18__["Reviver"]);
-
- tempPlayer = JSON.parse(tempSaveObj.PlayerSave, _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_18__["Reviver"]);
-
- //Parse Decimal.js objects
- tempPlayer.money = new _utils_decimal_js__WEBPACK_IMPORTED_MODULE_20___default.a(tempPlayer.money);
- tempPlayer.total_money = new _utils_decimal_js__WEBPACK_IMPORTED_MODULE_20___default.a(tempPlayer.total_money);
- tempPlayer.lifetime_money = new _utils_decimal_js__WEBPACK_IMPORTED_MODULE_20___default.a(tempPlayer.lifetime_money);
-
- tempAllServers = JSON.parse(tempSaveObj.AllServersSave, _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_18__["Reviver"]);
- tempCompanies = JSON.parse(tempSaveObj.CompaniesSave, _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_18__["Reviver"]);
- tempFactions = JSON.parse(tempSaveObj.FactionsSave, _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_18__["Reviver"]);
- tempSpecialServerIps = JSON.parse(tempSaveObj.SpecialServerIpsSave, _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_18__["Reviver"]);
- if (tempSaveObj.hasOwnProperty("AliasesSave")) {
- try {
- tempAliases = JSON.parse(tempSaveObj.AliasesSave, _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_18__["Reviver"]);
- } catch(e) {
- console.log("Parsing Aliases save failed: " + e);
- tempAliases = {};
- }
- } else {
- tempAliases = {};
- }
- if (tempSaveObj.hasOwnProperty("GlobalAliases")) {
- try {
- tempGlobalAliases = JSON.parse(tempSaveObj.AliasesSave, _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_18__["Reviver"]);
- } catch(e) {
- console.log("Parsing Global Aliases save failed: " + e);
- tempGlobalAliases = {};
- }
- } else {
- tempGlobalAliases = {};
- }
- if (tempSaveObj.hasOwnProperty("MessagesSave")) {
- try {
- tempMessages = JSON.parse(tempSaveObj.MessagesSave, _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_18__["Reviver"]);
- } catch(e) {
- console.log("Parsing Messages save failed: " + e);
- Object(_Message_js__WEBPACK_IMPORTED_MODULE_8__["initMessages"])();
- }
- } else {
- Object(_Message_js__WEBPACK_IMPORTED_MODULE_8__["initMessages"])();
- }
- if (saveObj.hasOwnProperty("StockMarketSave")) {
- try {
- tempStockMarket = JSON.parse(tempSaveObj.StockMarketSave, _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_18__["Reviver"]);
- } catch(e) {
- console.log("Parsing StockMarket save failed: " + e);
- tempStockMarket = {};
- }
- } else {
- tempStockMarket = {};
- }
- if (tempSaveObj.hasOwnProperty("VersionSave")) {
- try {
- var ver = JSON.parse(tempSaveObj.VersionSave, _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_18__["Reviver"]);
- if (ver.startsWith("0.27.") || ver.startsWith("0.28.")) {
- if (tempPlayer.bitNodeN == null || tempPlayer.bitNodeN == 0) {
- tempPlayer.bitNodeN = 1;
- }
- if (tempPlayer.sourceFiles == null) {
- tempPlayer.sourceFiles = [];
- }
- }
- if (ver != _Constants_js__WEBPACK_IMPORTED_MODULE_2__["CONSTANTS"].Version) {
- //createNewUpdateText();
- }
- } catch(e) {
- console.log("Parsing Version save failed: " + e);
- //createNewUpdateText();
- }
- } else {
- //createNewUpdateText();
- }
- if (tempPlayer.bitNodeN == 2 && tempPlayer.inGang() && tempSaveObj.hasOwnProperty("AllGangsSave")) {
- try {
- Object(_Gang_js__WEBPACK_IMPORTED_MODULE_6__["loadAllGangs"])(tempSaveObj.AllGangsSave);
- } catch(e) {
- console.log("ERROR: Failed to parse AllGangsSave: " + e);
- }
- }
- } catch(e) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_15__["dialogBoxCreate"])("Error importing game: " + e.toString());
- return false;
- }
-
- //Since the save file is valid, load everything for real
- saveString = decodeURIComponent(escape(atob(saveString)));
- saveObj = JSON.parse(saveString, _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_18__["Reviver"]);
-
- Object(_Player_js__WEBPACK_IMPORTED_MODULE_9__["loadPlayer"])(saveObj.PlayerSave);
- Object(_Server_js__WEBPACK_IMPORTED_MODULE_11__["loadAllServers"])(saveObj.AllServersSave);
- Object(_Company_js__WEBPACK_IMPORTED_MODULE_1__["loadCompanies"])(saveObj.CompaniesSave);
- Object(_Faction_js__WEBPACK_IMPORTED_MODULE_4__["loadFactions"])(saveObj.FactionsSave);
- Object(_SpecialServerIps_js__WEBPACK_IMPORTED_MODULE_13__["loadSpecialServerIps"])(saveObj.SpecialServerIpsSave);
-
- if (saveObj.hasOwnProperty("AliasesSave")) {
- try {
- Object(_Alias_js__WEBPACK_IMPORTED_MODULE_0__["loadAliases"])(saveObj.AliasesSave);
- } catch(e) {
- Object(_Alias_js__WEBPACK_IMPORTED_MODULE_0__["loadAliases"])("");
- }
- } else {
- Object(_Alias_js__WEBPACK_IMPORTED_MODULE_0__["loadAliases"])("");
- }
- if (saveObj.hasOwnProperty("GlobalAliasesSave")) {
- try {
- Object(_Alias_js__WEBPACK_IMPORTED_MODULE_0__["loadGlobalAliases"])(saveObj.GlobalAliasesSave);
- } catch(e) {
- Object(_Alias_js__WEBPACK_IMPORTED_MODULE_0__["loadGlobalAliases"])("");
- }
- } else {
- Object(_Alias_js__WEBPACK_IMPORTED_MODULE_0__["loadGlobalAliases"])("");
- }
- if (saveObj.hasOwnProperty("MessagesSave")) {
- try {
- Object(_Message_js__WEBPACK_IMPORTED_MODULE_8__["loadMessages"])(saveObj.MessagesSave);
- } catch(e) {
- Object(_Message_js__WEBPACK_IMPORTED_MODULE_8__["initMessages"])();
- }
- } else {
- Object(_Message_js__WEBPACK_IMPORTED_MODULE_8__["initMessages"])();
- }
- if (saveObj.hasOwnProperty("StockMarketSave")) {
- try {
- Object(_StockMarket_js__WEBPACK_IMPORTED_MODULE_14__["loadStockMarket"])(saveObj.StockMarketSave);
- } catch(e) {
- Object(_StockMarket_js__WEBPACK_IMPORTED_MODULE_14__["loadStockMarket"])("");
- }
- } else {
- Object(_StockMarket_js__WEBPACK_IMPORTED_MODULE_14__["loadStockMarket"])("");
- }
- if (saveObj.hasOwnProperty("SettingsSave")) {
- try {
- Object(_Settings_js__WEBPACK_IMPORTED_MODULE_12__["loadSettings"])(saveObj.SettingsSave);
- } catch(e) {
- Object(_Settings_js__WEBPACK_IMPORTED_MODULE_12__["initSettings"])();
- }
- } else {
- Object(_Settings_js__WEBPACK_IMPORTED_MODULE_12__["initSettings"])();
- }
- if (saveObj.hasOwnProperty("FconfSettingsSave")) {
- try {
- Object(_Fconf_js__WEBPACK_IMPORTED_MODULE_5__["loadFconf"])(saveObj.FconfSettingsSave);
- } catch(e) {
- console.log("ERROR: Failed to load .fconf settings when importing");
- }
- }
- if (saveObj.hasOwnProperty("VersionSave")) {
- try {
- var ver = JSON.parse(saveObj.VersionSave, _utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_18__["Reviver"]);
- if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].bitNodeN == null || _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].bitNodeN == 0) {
- _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].setBitNodeNumber(1);
-
- }
- if (ver.startsWith("0.27.") || ver.startsWith("0.28.")) {
- console.log("Evaluating changes needed for version compatibility");
- if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].augmentations.length > 0 || _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].queuedAugmentations.length > 0 ||
- _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].sourceFiles.length > 0) {
- //If you have already purchased an Aug...you are far enough in the game
- //that everything should be available
- _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].firstFacInvRecvd = true;
- _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].firstAugPurchased = true;
- _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].firstJobRecvd = true;
- _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].firstTimeTraveled = true;
- _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].firstProgramAvailable = true;
- } else {
- if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].factions.length > 0 || _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].factionInvitations.length > 0) {
- _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].firstFacInvRecvd = true;
- }
- if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].companyName !== "" || _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].companyPosition !== "") {
- _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].firstJobRecvd = true;
- }
- if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].hacking_skill >= 25) {
- _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].firstScriptAvailable = true;
- }
- }
- }
- if (ver != _Constants_js__WEBPACK_IMPORTED_MODULE_2__["CONSTANTS"].Version) {
- createNewUpdateText();
- }
- } catch(e) {
- createNewUpdateText();
- }
- } else {
- createNewUpdateText();
- }
- if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].bitNodeN == 2 && _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].inGang() && saveObj.hasOwnProperty("AllGangsSave")) {
- try {
- Object(_Gang_js__WEBPACK_IMPORTED_MODULE_6__["loadAllGangs"])(saveObj.AllGangsSave);
- } catch(e) {
- console.log("ERROR: Failed to parse AllGangsSave: " + e);
- }
- }
-
- var popupId = "import-game-restart-game-notice";
- var txt = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_17__["createElement"])("p", {
- innerText:"Imported game! I would suggest saving the game and then reloading the page " +
- "to make sure everything runs smoothly"
- });
- var gotitBtn = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_17__["createElement"])("a", {
- class:"a-link-button", float:"right", padding:"6px", innerText:"Got it!",
- clickListener:()=>{
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_17__["removeElementById"])(popupId);
- }
- });
- Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_17__["createPopup"])(popupId, [txt, gotitBtn]);
- Object(_utils_GameOptions_js__WEBPACK_IMPORTED_MODULE_16__["gameOptionsBoxClose"])();
-
- //Re-start game
- console.log("Importing game");
- _engine_js__WEBPACK_IMPORTED_MODULE_3__["Engine"].setDisplayElements(); //Sets variables for important DOM elements
- _engine_js__WEBPACK_IMPORTED_MODULE_3__["Engine"].init(); //Initialize buttons, work, etc.
- _Company_js__WEBPACK_IMPORTED_MODULE_1__["CompanyPositions"].init();
-
- //Calculate the number of cycles have elapsed while offline
- _engine_js__WEBPACK_IMPORTED_MODULE_3__["Engine"]._lastUpdate = new Date().getTime();
- var lastUpdate = _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].lastUpdate;
- var numCyclesOffline = Math.floor((_engine_js__WEBPACK_IMPORTED_MODULE_3__["Engine"]._lastUpdate - lastUpdate) / _engine_js__WEBPACK_IMPORTED_MODULE_3__["Engine"]._idleSpeed);
-
- /* Process offline progress */
- var offlineProductionFromScripts = Object(_Script_js__WEBPACK_IMPORTED_MODULE_10__["loadAllRunningScripts"])(); //This also takes care of offline production for those scripts
- if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].isWorking) {
- console.log("work() called in load() for " + numCyclesOffline * _engine_js__WEBPACK_IMPORTED_MODULE_3__["Engine"]._idleSpeed + " milliseconds");
- if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].workType == _Constants_js__WEBPACK_IMPORTED_MODULE_2__["CONSTANTS"].WorkTypeFaction) {
- _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].workForFaction(numCyclesOffline);
- } else if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].workType == _Constants_js__WEBPACK_IMPORTED_MODULE_2__["CONSTANTS"].WorkTypeCreateProgram) {
- _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].createProgramWork(numCyclesOffline);
- } else if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].workType == _Constants_js__WEBPACK_IMPORTED_MODULE_2__["CONSTANTS"].WorkTypeStudyClass) {
- _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].takeClass(numCyclesOffline);
- } else if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].workType == _Constants_js__WEBPACK_IMPORTED_MODULE_2__["CONSTANTS"].WorkTypeCrime) {
- _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].commitCrime(numCyclesOffline);
- } else if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].workType == _Constants_js__WEBPACK_IMPORTED_MODULE_2__["CONSTANTS"].WorkTypeCompanyPartTime) {
- _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].workPartTime(numCyclesOffline);
- } else {
- _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].work(numCyclesOffline);
- }
- }
-
- //Hacknet Nodes offline progress
- var offlineProductionFromHacknetNodes = Object(_HacknetNode_js__WEBPACK_IMPORTED_MODULE_7__["processAllHacknetNodeEarnings"])(numCyclesOffline);
-
- //Passive faction rep gain offline
- Object(_Faction_js__WEBPACK_IMPORTED_MODULE_4__["processPassiveFactionRepGain"])(numCyclesOffline);
-
- //Update total playtime
- var time = numCyclesOffline * _engine_js__WEBPACK_IMPORTED_MODULE_3__["Engine"]._idleSpeed;
- if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].totalPlaytime == null) {_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].totalPlaytime = 0;}
- if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].playtimeSinceLastAug == null) {_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].playtimeSinceLastAug = 0;}
- _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].totalPlaytime += time;
- _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].playtimeSinceLastAug += time;
-
- //Re-apply augmentations
- _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].reapplyAllAugmentations();
-
- //Clear terminal
- $("#terminal tr:not(:last)").remove();
-
- _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].lastUpdate = _engine_js__WEBPACK_IMPORTED_MODULE_3__["Engine"]._lastUpdate;
- _engine_js__WEBPACK_IMPORTED_MODULE_3__["Engine"].start(); //Run main game loop and Scripts loop
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_15__["dialogBoxCreate"])("While you were offline, your scripts generated $" +
- Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_19__["formatNumber"])(offlineProductionFromScripts, 2) + " and your Hacknet Nodes generated $" +
- Object(_utils_StringHelperFunctions_js__WEBPACK_IMPORTED_MODULE_19__["formatNumber"])(offlineProductionFromHacknetNodes, 2));
- return true;
-}
-
-BitburnerSaveObject.prototype.exportGame = function() {
- this.PlayerSave = JSON.stringify(_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"]);
- this.AllServersSave = JSON.stringify(_Server_js__WEBPACK_IMPORTED_MODULE_11__["AllServers"]);
- this.CompaniesSave = JSON.stringify(_Company_js__WEBPACK_IMPORTED_MODULE_1__["Companies"]);
- this.FactionsSave = JSON.stringify(_Faction_js__WEBPACK_IMPORTED_MODULE_4__["Factions"]);
- this.SpecialServerIpsSave = JSON.stringify(_SpecialServerIps_js__WEBPACK_IMPORTED_MODULE_13__["SpecialServerIps"]);
- this.AliasesSave = JSON.stringify(_Alias_js__WEBPACK_IMPORTED_MODULE_0__["Aliases"]);
- this.GlobalAliasesSave = JSON.stringify(_Alias_js__WEBPACK_IMPORTED_MODULE_0__["GlobalAliases"]);
- this.MessagesSave = JSON.stringify(_Message_js__WEBPACK_IMPORTED_MODULE_8__["Messages"]);
- this.StockMarketSave = JSON.stringify(_StockMarket_js__WEBPACK_IMPORTED_MODULE_14__["StockMarket"]);
- this.SettingsSave = JSON.stringify(_Settings_js__WEBPACK_IMPORTED_MODULE_12__["Settings"]);
- this.VersionSave = JSON.stringify(_Constants_js__WEBPACK_IMPORTED_MODULE_2__["CONSTANTS"].Version);
- if (_Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].bitNodeN == 2 && _Player_js__WEBPACK_IMPORTED_MODULE_9__["Player"].inGang()) {
- this.AllGangsSave = JSON.stringify(_Gang_js__WEBPACK_IMPORTED_MODULE_6__["AllGangs"]);
- }
-
- var saveString = btoa(unescape(encodeURIComponent(JSON.stringify(this))));
- var filename = "bitburnerSave.json";
- var file = new Blob([saveString], {type: 'text/plain'});
- if (window.navigator.msSaveOrOpenBlob) {// IE10+
- window.navigator.msSaveOrOpenBlob(file, filename);
- } else { // Others
- var a = document.createElement("a"),
- url = URL.createObjectURL(file);
- a.href = url;
- a.download = "bitburnerSave.json";
- document.body.appendChild(a);
- a.click();
- setTimeout(function() {
- document.body.removeChild(a);
- window.URL.revokeObjectURL(url);
- }, 0);
- }
-}
-
-BitburnerSaveObject.prototype.importGame = function() {
- if (window.File && window.FileReader && window.FileList && window.Blob) {
- var fileSelector = Object(_utils_HelperFunctions_js__WEBPACK_IMPORTED_MODULE_17__["clearEventListeners"])("import-game-file-selector");
- fileSelector.addEventListener("change", openImportFileHandler, false);
- $("#import-game-file-selector").click();
- } else {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_15__["dialogBoxCreate"])("ERR: Your browser does not support HTML5 File API. Cannot import.");
- }
-
-}
-
-BitburnerSaveObject.prototype.deleteGame = function(db) {
- //Delete from local storage
- if (window.localStorage.getItem("bitburnerSave")) {
- window.localStorage.removeItem("bitburnerSave");
- }
-
- //Delete from indexedDB
- var request = db.transaction(["savestring"], "readwrite").objectStore("savestring").delete("save");
- request.onsuccess = function(e) {
- console.log("Successfully deleted save from indexedDb");
- }
- request.onerror = function(e) {
- console.log("Failed to delete save from indexedDb: " + e);
- }
- _engine_js__WEBPACK_IMPORTED_MODULE_3__["Engine"].createStatusText("Game deleted!");
-}
-
-function createNewUpdateText() {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_15__["dialogBoxCreate"])("New update!
" +
- "Please report any bugs/issues through the github repository " +
- "or the Bitburner subreddit (reddit.com/r/bitburner).
" +
- _Constants_js__WEBPACK_IMPORTED_MODULE_2__["CONSTANTS"].LatestUpdate);
-}
-
-
-BitburnerSaveObject.prototype.toJSON = function() {
- return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_18__["Generic_toJSON"])("BitburnerSaveObject", this);
-}
-
-BitburnerSaveObject.fromJSON = function(value) {
- return Object(_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_18__["Generic_fromJSON"])(BitburnerSaveObject, value.data);
-}
-
-_utils_JSONReviver_js__WEBPACK_IMPORTED_MODULE_18__["Reviver"].constructors.BitburnerSaveObject = BitburnerSaveObject;
-
-//Import game
-
-function openImportFileHandler(evt) {
- var file = evt.target.files[0];
- if (!file) {
- Object(_utils_DialogBox_js__WEBPACK_IMPORTED_MODULE_15__["dialogBoxCreate"])("Invalid file selected");
- return;
- }
-
- var reader = new FileReader();
- reader.onload = function(e) {
- var contents = e.target.result;
- loadImportedGame(saveObject, contents);
- };
- reader.readAsText(file);
-}
-
-
-
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ 41)))
+/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ 38)))
/***/ }),
/* 52 */
@@ -59588,7 +59731,7 @@ function openImportFileHandler(evt) {
/*