diff --git a/css/companymanagement.css b/css/companymanagement.css
new file mode 100644
index 000000000..9e2b08c1f
--- /dev/null
+++ b/css/companymanagement.css
@@ -0,0 +1,100 @@
+#cmpy-mgmt-container p,
+#cmpy-mgmt-container a {
+ font-size: 14px;
+}
+
+
+/* Header tabs */
+.cmpy-mgmt-header-tab {
+ display: inline-block;
+ color: white;
+ background-color:#555;
+ border:1px solid white;
+ padding: 4px;
+}
+
+.cmpy-mgmt-header-tab:hover {
+ background-color: #666;
+}
+
+.cmpy-mgmt-header-tab.current {
+ background-color: #777;
+}
+
+/* Select industry type when creating a new division */
+.cmpy-mgmt-industry-select {
+ color:white;
+ background-color:black;
+}
+
+/* Switch between Cities */
+.cmpy-mgmt-city-tab {
+ display:inline-block;
+ color: white;
+ background-color: #555;
+ border: 1px solid white;
+ padding: 4px;
+}
+
+.cmpy-mgmt-city-tab:hover {
+ background-color: #666;
+}
+
+.cmpy-mgmt-city-tab.current {
+ background-color: #777;
+}
+
+/* Panels */
+#cmpy-mgmt-panel {
+ height: 90%;
+}
+
+.cmpy-mgmt-industry-left-panel,
+.cmpy-mgmt-industry-right-panel {
+ display:inline-block;
+ width: 45%;
+ height: 100%;
+ top: 10px;
+ overflow-y: auto;
+ overflow-x: auto;
+}
+
+.cmpy-mgmt-industry-overview-panel {
+ border: 1px solid white;
+ color: var(--my-font-color);
+ display:inline-block;
+ width: 100%;
+}
+
+.cmpy-mgmt-employee-panel {
+ border: 1px solid white;
+ display:block;
+ width:100%;
+}
+
+.cmpy-mgmt-warehouse-panel {
+ border: 1px solid white;
+ display:inline-block;
+ width:100%;
+}
+
+/* Hiring new employees*/
+.cmpy-mgmt-find-employee-option {
+ border:1px solid white;
+ margin: 6px;
+}
+
+.cmpy-mgmt-find-employee-option:hover {
+ background-color:#3d4044;
+}
+
+/* Warehouse */
+.cmpy-mgmt-warehouse-material-div {
+ padding:2px;
+ border:1px solid white;
+}
+
+.cmpy-mgmt-warehouse-product-div {
+ padding:2px;
+ border:1px solid white;
+}
diff --git a/dist/bundle.js b/dist/bundle.js
index 8dcfe37c5..8f995bce6 100644
--- a/dist/bundle.js
+++ b/dist/bundle.js
@@ -71,28 +71,30 @@
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Player; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return loadPlayer; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__ = __webpack_require__(20);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__BitNode_js__ = __webpack_require__(7);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__BitNode_js__ = __webpack_require__(8);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Company_js__ = __webpack_require__(21);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Constants_js__ = __webpack_require__(3);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__ = __webpack_require__(15);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Crimes_js__ = __webpack_require__(32);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__engine_js__ = __webpack_require__(5);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Faction_js__ = __webpack_require__(10);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Gang_js__ = __webpack_require__(34);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__Location_js__ = __webpack_require__(13);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__NetscriptFunctions_js__ = __webpack_require__(19);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__Server_js__ = __webpack_require__(6);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__SpecialServerIps_js__ = __webpack_require__(12);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__SourceFile_js__ = __webpack_require__(35);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__utils_decimal_js__ = __webpack_require__(28);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__utils_decimal_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_14__utils_decimal_js__);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__utils_DialogBox_js__ = __webpack_require__(1);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__utils_HelperFunctions_js__ = __webpack_require__(2);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__utils_IPAddress_js__ = __webpack_require__(17);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__utils_JSONReviver_js__ = __webpack_require__(8);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__utils_numeral_min_js__ = __webpack_require__(18);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__utils_numeral_min_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_19__utils_numeral_min_js__);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__ = __webpack_require__(4);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__CompanyManagement_js__ = __webpack_require__(31);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__ = __webpack_require__(15);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Crimes_js__ = __webpack_require__(32);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__engine_js__ = __webpack_require__(5);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Faction_js__ = __webpack_require__(11);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__Gang_js__ = __webpack_require__(40);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__Location_js__ = __webpack_require__(12);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__NetscriptFunctions_js__ = __webpack_require__(22);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__Server_js__ = __webpack_require__(6);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__ = __webpack_require__(13);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__SourceFile_js__ = __webpack_require__(36);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__utils_decimal_js__ = __webpack_require__(24);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__utils_decimal_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_15__utils_decimal_js__);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__utils_DialogBox_js__ = __webpack_require__(1);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__utils_HelperFunctions_js__ = __webpack_require__(2);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__utils_IPAddress_js__ = __webpack_require__(19);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__utils_JSONReviver_js__ = __webpack_require__(7);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__utils_numeral_min_js__ = __webpack_require__(17);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__utils_numeral_min_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_20__utils_numeral_min_js__);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__ = __webpack_require__(4);
+
@@ -167,15 +169,15 @@ function PlayerObject() {
this.faction_rep_mult = 1;
//Money
- this.money = new __WEBPACK_IMPORTED_MODULE_14__utils_decimal_js___default.a(1000);
- this.total_money = new __WEBPACK_IMPORTED_MODULE_14__utils_decimal_js___default.a(0); //Total money ever earned in this "simulation"
- this.lifetime_money = new __WEBPACK_IMPORTED_MODULE_14__utils_decimal_js___default.a(0); //Total money ever earned
+ this.money = new __WEBPACK_IMPORTED_MODULE_15__utils_decimal_js___default.a(1000);
+ this.total_money = new __WEBPACK_IMPORTED_MODULE_15__utils_decimal_js___default.a(0); //Total money ever earned in this "simulation"
+ this.lifetime_money = new __WEBPACK_IMPORTED_MODULE_15__utils_decimal_js___default.a(0); //Total money ever earned
//IP Address of Starting (home) computer
this.homeComputer = "";
//Location information
- this.city = __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Sector12;
+ this.city = __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Sector12;
this.location = "";
//Company Information
@@ -263,6 +265,9 @@ function PlayerObject() {
//Gang
this.gang = 0;
+ //Corporation
+ this.corporation = 0;
+
//bitnode
this.bitNodeN = 1;
@@ -287,12 +292,12 @@ function PlayerObject() {
PlayerObject.prototype.init = function() {
/* Initialize Player's home computer */
- var t_homeComp = new __WEBPACK_IMPORTED_MODULE_11__Server_js__["d" /* Server */](Object(__WEBPACK_IMPORTED_MODULE_17__utils_IPAddress_js__["a" /* createRandomIp */])(), "home", "Home PC", true, true, true, 8);
+ var t_homeComp = new __WEBPACK_IMPORTED_MODULE_12__Server_js__["d" /* Server */](Object(__WEBPACK_IMPORTED_MODULE_18__utils_IPAddress_js__["a" /* createRandomIp */])(), "home", "Home PC", true, true, true, 8);
this.homeComputer = t_homeComp.ip;
this.currentServer = t_homeComp.ip;
- Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["a" /* AddToAllServers */])(t_homeComp);
+ Object(__WEBPACK_IMPORTED_MODULE_12__Server_js__["a" /* AddToAllServers */])(t_homeComp);
- this.getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].NukeProgram);
+ this.getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_5__CreateProgram_js__["a" /* Programs */].NukeProgram);
}
PlayerObject.prototype.prestigeAugmentation = function() {
@@ -320,9 +325,9 @@ PlayerObject.prototype.prestigeAugmentation = function() {
this.agility_exp = 0;
this.charisma_exp = 0;
- this.money = new __WEBPACK_IMPORTED_MODULE_14__utils_decimal_js___default.a(1000);
+ this.money = new __WEBPACK_IMPORTED_MODULE_15__utils_decimal_js___default.a(1000);
- this.city = __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Sector12;
+ this.city = __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Sector12;
this.location = "";
this.companyName = "";
@@ -399,9 +404,9 @@ PlayerObject.prototype.prestigeSourceFile = function() {
this.agility_exp = 0;
this.charisma_exp = 0;
- this.money = new __WEBPACK_IMPORTED_MODULE_14__utils_decimal_js___default.a(1000);
+ this.money = new __WEBPACK_IMPORTED_MODULE_15__utils_decimal_js___default.a(1000);
- this.city = __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Sector12;
+ this.city = __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Sector12;
this.location = "";
this.companyName = "";
@@ -452,15 +457,18 @@ PlayerObject.prototype.prestigeSourceFile = function() {
//Gang
this.gang = null;
- Object(__WEBPACK_IMPORTED_MODULE_8__Gang_js__["e" /* resetGangs */])();
+ Object(__WEBPACK_IMPORTED_MODULE_9__Gang_js__["e" /* resetGangs */])();
//Reset Stock market
this.hasWseAccount = false;
this.hasTixApiAccess = false;
+ //BitNode 3: Corporatocracy
+ if (this.bitNodeN === 3) {this.money = new __WEBPACK_IMPORTED_MODULE_15__utils_decimal_js___default.a(150e9);}
+
//BitNode 8: Ghost of Wall Street
- if (this.bitNodeN === 8) {this.money = new __WEBPACK_IMPORTED_MODULE_14__utils_decimal_js___default.a(100000000);}
- if (this.bitNodeN === 8 || __WEBPACK_IMPORTED_MODULE_10__NetscriptFunctions_js__["d" /* hasWallStreetSF */]) {
+ if (this.bitNodeN === 8) {this.money = new __WEBPACK_IMPORTED_MODULE_15__utils_decimal_js___default.a(100000000);}
+ if (this.bitNodeN === 8 || __WEBPACK_IMPORTED_MODULE_11__NetscriptFunctions_js__["d" /* hasWallStreetSF */]) {
this.hasWseAccount = true;
this.hasTixApiAccess = true;
}
@@ -470,11 +478,11 @@ PlayerObject.prototype.prestigeSourceFile = function() {
}
PlayerObject.prototype.getCurrentServer = function() {
- return __WEBPACK_IMPORTED_MODULE_11__Server_js__["b" /* AllServers */][this.currentServer];
+ return __WEBPACK_IMPORTED_MODULE_12__Server_js__["b" /* AllServers */][this.currentServer];
}
PlayerObject.prototype.getHomeComputer = function() {
- return __WEBPACK_IMPORTED_MODULE_11__Server_js__["b" /* AllServers */][this.homeComputer];
+ return __WEBPACK_IMPORTED_MODULE_12__Server_js__["b" /* AllServers */][this.homeComputer];
}
//Calculates skill level based on experience. The same formula will be used for every skill
@@ -752,39 +760,39 @@ PlayerObject.prototype.finishWork = function(cancelled, sing=false) {
this.updateSkillLevels();
var txt = "You earned a total of:
" +
- "$" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workMoneyGained, 2) + "
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workRepGained, 4) + " reputation for the company
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workHackExpGained, 4) + " hacking exp
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workStrExpGained, 4) + " strength exp
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDefExpGained, 4) + " defense exp
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDexExpGained, 4) + " dexterity exp
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workAgiExpGained, 4) + " agility exp
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workChaExpGained, 4) + " charisma exp
";
+ "$" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workMoneyGained, 2) + "
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workRepGained, 4) + " reputation for the company
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workHackExpGained, 4) + " hacking exp
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workStrExpGained, 4) + " strength exp
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDefExpGained, 4) + " defense exp
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDexExpGained, 4) + " dexterity exp
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workAgiExpGained, 4) + " agility exp
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workChaExpGained, 4) + " charisma exp
";
if (cancelled) {
- txt = "You worked a short shift of " + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(this.timeWorked) + "
" +
+ txt = "You worked a short shift of " + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(this.timeWorked) + "
" +
"Since you cancelled your work early, you only gained half of the reputation you earned.
" + txt;
} else {
txt = "You worked a full shift of 8 hours!
" + txt;
}
- if (!sing) {Object(__WEBPACK_IMPORTED_MODULE_15__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);}
+ if (!sing) {Object(__WEBPACK_IMPORTED_MODULE_16__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);}
var mainMenu = document.getElementById("mainmenu-container");
mainMenu.style.visibility = "visible";
this.isWorking = false;
//Engine.loadTerminalContent();
- __WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_7__engine_js__["Engine"].loadLocationContent();
if (sing) {
- return "You worked a short shift of " + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(this.timeWorked) + " and " +
- "earned $" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workMoneyGained, 2) + ", " +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workRepGained, 4) + " reputation, " +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workHackExpGained, 4) + " hacking exp, " +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workStrExpGained, 4) + " strength exp, " +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDefExpGained, 4) + " defense exp, " +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDexExpGained, 4) + " dexterity exp, " +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workAgiExpGained, 4) + " agility exp, and " +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workChaExpGained, 4) + " charisma exp.";
+ return "You worked a short shift of " + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(this.timeWorked) + " and " +
+ "earned $" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workMoneyGained, 2) + ", " +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workRepGained, 4) + " reputation, " +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workHackExpGained, 4) + " hacking exp, " +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workStrExpGained, 4) + " strength exp, " +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDefExpGained, 4) + " defense exp, " +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDexExpGained, 4) + " dexterity exp, " +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workAgiExpGained, 4) + " agility exp, and " +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workChaExpGained, 4) + " charisma exp.";
}
}
@@ -805,7 +813,7 @@ PlayerObject.prototype.startWork = function() {
this.timeNeededToCompleteWork = __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].MillisecondsPer8Hours;
//Remove all old event listeners from Cancel button
- var newCancelButton = Object(__WEBPACK_IMPORTED_MODULE_16__utils_HelperFunctions_js__["b" /* clearEventListeners */])("work-in-progress-cancel-button");
+ var newCancelButton = Object(__WEBPACK_IMPORTED_MODULE_17__utils_HelperFunctions_js__["b" /* clearEventListeners */])("work-in-progress-cancel-button");
newCancelButton.innerHTML = "Cancel Work";
newCancelButton.addEventListener("click", function() {
Player.finishWork(true);
@@ -813,7 +821,7 @@ PlayerObject.prototype.startWork = function() {
});
//Display Work In Progress Screen
- __WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"].loadWorkInProgressContent();
+ __WEBPACK_IMPORTED_MODULE_7__engine_js__["Engine"].loadWorkInProgressContent();
}
PlayerObject.prototype.work = function(numCycles) {
@@ -828,9 +836,9 @@ PlayerObject.prototype.work = function(numCycles) {
this.workRepGained += this.workRepGainRate * numCycles;
this.workMoneyGained += this.workMoneyGainRate * numCycles;
- var cyclesPerSec = 1000 / __WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"]._idleSpeed;
+ var cyclesPerSec = 1000 / __WEBPACK_IMPORTED_MODULE_7__engine_js__["Engine"]._idleSpeed;
- this.timeWorked += __WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"]._idleSpeed * numCycles;
+ this.timeWorked += __WEBPACK_IMPORTED_MODULE_7__engine_js__["Engine"]._idleSpeed * numCycles;
//If timeWorked == 8 hours, then finish. You can only gain 8 hours worth of exp and money
if (this.timeWorked >= __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].MillisecondsPer8Hours) {
@@ -850,16 +858,16 @@ PlayerObject.prototype.work = function(numCycles) {
var txt = document.getElementById("work-in-progress-text");
txt.innerHTML = "You are currently working as a " + this.companyPosition.positionName +
" at " + this.companyName + "
" +
- "You have been working for " + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(this.timeWorked) + "
" +
+ "You have been working for " + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(this.timeWorked) + "
" +
"You have earned:
" +
- "$" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workMoneyGained, 2) + " ($" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workMoneyGainRate * cyclesPerSec, 2) + " / sec)
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workRepGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workRepGainRate * cyclesPerSec, 4) + " / sec) reputation for this company
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workHackExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workHackExpGainRate * cyclesPerSec, 4) + " / sec) hacking exp
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workStrExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workStrExpGainRate * cyclesPerSec, 4) + " / sec) strength exp
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDefExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDefExpGainRate * cyclesPerSec, 4) + " / sec) defense exp
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDexExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDexExpGainRate * cyclesPerSec, 4) + " / sec) dexterity exp
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workAgiExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workAgiExpGainRate * cyclesPerSec, 4) + " / sec) agility exp
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workChaExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workChaExpGainRate * cyclesPerSec, 4) + " / sec) charisma exp
" +
+ "$" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workMoneyGained, 2) + " ($" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workMoneyGainRate * cyclesPerSec, 2) + " / sec)
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workRepGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workRepGainRate * cyclesPerSec, 4) + " / sec) reputation for this company
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workHackExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workHackExpGainRate * cyclesPerSec, 4) + " / sec) hacking exp
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workStrExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workStrExpGainRate * cyclesPerSec, 4) + " / sec) strength exp
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDefExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDefExpGainRate * cyclesPerSec, 4) + " / sec) defense exp
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDexExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDexExpGainRate * cyclesPerSec, 4) + " / sec) dexterity exp
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workAgiExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workAgiExpGainRate * cyclesPerSec, 4) + " / sec) agility exp
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workChaExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workChaExpGainRate * cyclesPerSec, 4) + " / sec) charisma exp
" +
"You will automatically finish after working for 8 hours. You can cancel earlier if you wish, " +
"but you will only gain half of the reputation you've earned so far."
@@ -881,7 +889,7 @@ PlayerObject.prototype.startWorkPartTime = function() {
this.timeNeededToCompleteWork = __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].MillisecondsPer8Hours;
- var newCancelButton = Object(__WEBPACK_IMPORTED_MODULE_16__utils_HelperFunctions_js__["b" /* clearEventListeners */])("work-in-progress-cancel-button");
+ var newCancelButton = Object(__WEBPACK_IMPORTED_MODULE_17__utils_HelperFunctions_js__["b" /* clearEventListeners */])("work-in-progress-cancel-button");
newCancelButton.innerHTML = "Stop Working";
newCancelButton.addEventListener("click", function() {
Player.finishWorkPartTime();
@@ -889,7 +897,7 @@ PlayerObject.prototype.startWorkPartTime = function() {
});
//Display Work In Progress Screen
- __WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"].loadWorkInProgressContent();
+ __WEBPACK_IMPORTED_MODULE_7__engine_js__["Engine"].loadWorkInProgressContent();
}
PlayerObject.prototype.workPartTime = function(numCycles) {
@@ -904,9 +912,9 @@ PlayerObject.prototype.workPartTime = function(numCycles) {
this.workRepGained += this.workRepGainRate * numCycles;
this.workMoneyGained += this.workMoneyGainRate * numCycles;
- var cyclesPerSec = 1000 / __WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"]._idleSpeed;
+ var cyclesPerSec = 1000 / __WEBPACK_IMPORTED_MODULE_7__engine_js__["Engine"]._idleSpeed;
- this.timeWorked += __WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"]._idleSpeed * numCycles;
+ this.timeWorked += __WEBPACK_IMPORTED_MODULE_7__engine_js__["Engine"]._idleSpeed * numCycles;
//If timeWorked == 8 hours, then finish. You can only gain 8 hours worth of exp and money
if (this.timeWorked >= __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].MillisecondsPer8Hours) {
@@ -926,16 +934,16 @@ PlayerObject.prototype.workPartTime = function(numCycles) {
var txt = document.getElementById("work-in-progress-text");
txt.innerHTML = "You are currently working as a " + this.companyPosition.positionName +
" at " + Player.companyName + "
" +
- "You have been working for " + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(this.timeWorked) + "
" +
+ "You have been working for " + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(this.timeWorked) + "
" +
"You have earned:
" +
- "$" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workMoneyGained, 2) + " ($" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workMoneyGainRate * cyclesPerSec, 2) + " / sec)
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workRepGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workRepGainRate * cyclesPerSec, 4) + " / sec) reputation for this company
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workHackExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workHackExpGainRate * cyclesPerSec, 4) + " / sec) hacking exp
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workStrExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workStrExpGainRate * cyclesPerSec, 4) + " / sec) strength exp
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDefExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDefExpGainRate * cyclesPerSec, 4) + " / sec) defense exp
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDexExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDexExpGainRate * cyclesPerSec, 4) + " / sec) dexterity exp
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workAgiExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workAgiExpGainRate * cyclesPerSec, 4) + " / sec) agility exp
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workChaExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workChaExpGainRate * cyclesPerSec, 4) + " / sec) charisma exp
" +
+ "$" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workMoneyGained, 2) + " ($" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workMoneyGainRate * cyclesPerSec, 2) + " / sec)
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workRepGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workRepGainRate * cyclesPerSec, 4) + " / sec) reputation for this company
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workHackExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workHackExpGainRate * cyclesPerSec, 4) + " / sec) hacking exp
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workStrExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workStrExpGainRate * cyclesPerSec, 4) + " / sec) strength exp
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDefExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDefExpGainRate * cyclesPerSec, 4) + " / sec) defense exp
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDexExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDexExpGainRate * cyclesPerSec, 4) + " / sec) dexterity exp
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workAgiExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workAgiExpGainRate * cyclesPerSec, 4) + " / sec) agility exp
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workChaExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workChaExpGainRate * cyclesPerSec, 4) + " / sec) charisma exp
" +
"You will automatically finish after working for 8 hours. You can cancel earlier if you wish,
" +
"and there will be no penalty because this is a part-time job.";
@@ -952,33 +960,33 @@ PlayerObject.prototype.finishWorkPartTime = function(sing=false) {
this.updateSkillLevels();
var txt = "You earned a total of:
" +
- "$" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workMoneyGained, 2) + "
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workRepGained, 4) + " reputation for the company
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workHackExpGained, 4) + " hacking exp
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workStrExpGained, 4) + " strength exp
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDefExpGained, 4) + " defense exp
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDexExpGained, 4) + " dexterity exp
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workAgiExpGained, 4) + " agility exp
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workChaExpGained, 4) + " charisma exp
";
- txt = "You worked for " + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(this.timeWorked) + "
" + txt;
- if (!sing) {Object(__WEBPACK_IMPORTED_MODULE_15__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);}
+ "$" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workMoneyGained, 2) + "
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workRepGained, 4) + " reputation for the company
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workHackExpGained, 4) + " hacking exp
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workStrExpGained, 4) + " strength exp
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDefExpGained, 4) + " defense exp
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDexExpGained, 4) + " dexterity exp
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workAgiExpGained, 4) + " agility exp
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workChaExpGained, 4) + " charisma exp
";
+ txt = "You worked for " + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(this.timeWorked) + "
" + txt;
+ if (!sing) {Object(__WEBPACK_IMPORTED_MODULE_16__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);}
var mainMenu = document.getElementById("mainmenu-container");
mainMenu.style.visibility = "visible";
this.isWorking = false;
//Engine.loadTerminalContent();
- __WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_7__engine_js__["Engine"].loadLocationContent();
if (sing) {
- return "You worked for " + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(this.timeWorked) + " and " +
+ return "You worked for " + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(this.timeWorked) + " and " +
"earned a total of " +
- "$" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workMoneyGained, 2) + ", " +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workRepGained, 4) + " reputation, " +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workHackExpGained, 4) + " hacking exp, " +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workStrExpGained, 4) + " strength exp, " +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDefExpGained, 4) + " defense exp, " +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDexExpGained, 4) + " dexterity exp, " +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workAgiExpGained, 4) + " agility exp, and " +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workChaExpGained, 4) + " charisma exp";
+ "$" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workMoneyGained, 2) + ", " +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workRepGained, 4) + " reputation, " +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workHackExpGained, 4) + " hacking exp, " +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workStrExpGained, 4) + " strength exp, " +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDefExpGained, 4) + " defense exp, " +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDexExpGained, 4) + " dexterity exp, " +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workAgiExpGained, 4) + " agility exp, and " +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workChaExpGained, 4) + " charisma exp";
}
}
@@ -986,24 +994,24 @@ PlayerObject.prototype.finishWorkPartTime = function(sing=false) {
PlayerObject.prototype.finishFactionWork = function(cancelled, sing=false) {
this.gainWorkExp();
- var faction = __WEBPACK_IMPORTED_MODULE_7__Faction_js__["b" /* Factions */][this.currentWorkFactionName];
+ var faction = __WEBPACK_IMPORTED_MODULE_8__Faction_js__["b" /* Factions */][this.currentWorkFactionName];
faction.playerReputation += (this.workRepGained);
this.gainMoney(this.workMoneyGained);
this.updateSkillLevels();
- var txt = "You worked for your faction " + faction.name + " for a total of " + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(this.timeWorked) + "
" +
+ var txt = "You worked for your faction " + faction.name + " for a total of " + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(this.timeWorked) + "
" +
"You earned a total of:
" +
- "$" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workMoneyGained, 2) + "
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workRepGained, 4) + " reputation for the faction
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workHackExpGained, 4) + " hacking exp
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workStrExpGained, 4) + " strength exp
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDefExpGained, 4) + " defense exp
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDexExpGained, 4) + " dexterity exp
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workAgiExpGained, 4) + " agility exp
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workChaExpGained, 4) + " charisma exp
";
- if (!sing) {Object(__WEBPACK_IMPORTED_MODULE_15__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);}
+ "$" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workMoneyGained, 2) + "
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workRepGained, 4) + " reputation for the faction
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workHackExpGained, 4) + " hacking exp
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workStrExpGained, 4) + " strength exp
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDefExpGained, 4) + " defense exp
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDexExpGained, 4) + " dexterity exp
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workAgiExpGained, 4) + " agility exp
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workChaExpGained, 4) + " charisma exp
";
+ if (!sing) {Object(__WEBPACK_IMPORTED_MODULE_16__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);}
var mainMenu = document.getElementById("mainmenu-container");
mainMenu.style.visibility = "visible";
@@ -1011,18 +1019,18 @@ PlayerObject.prototype.finishFactionWork = function(cancelled, sing=false) {
this.isWorking = false;
//Engine.loadTerminalContent();
- __WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"].loadFactionContent();
- Object(__WEBPACK_IMPORTED_MODULE_7__Faction_js__["c" /* displayFactionContent */])(faction.name);
+ __WEBPACK_IMPORTED_MODULE_7__engine_js__["Engine"].loadFactionContent();
+ Object(__WEBPACK_IMPORTED_MODULE_8__Faction_js__["c" /* displayFactionContent */])(faction.name);
if (sing) {
- return "You worked for your faction " + faction.name + " for a total of " + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(this.timeWorked) + ". " +
+ return "You worked for your faction " + faction.name + " for a total of " + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(this.timeWorked) + ". " +
"You earned " +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workRepGained, 4) + " rep, " +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workHackExpGained, 4) + " hacking exp, " +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workStrExpGained, 4) + " str exp, " +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDefExpGained, 4) + " def exp, " +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDexExpGained, 4) + " dex exp, " +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workAgiExpGained, 4) + " agi exp, and " +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workChaExpGained, 4) + " cha exp.";
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workRepGained, 4) + " rep, " +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workHackExpGained, 4) + " hacking exp, " +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workStrExpGained, 4) + " str exp, " +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDefExpGained, 4) + " def exp, " +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDexExpGained, 4) + " dex exp, " +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workAgiExpGained, 4) + " agi exp, and " +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workChaExpGained, 4) + " cha exp.";
}
}
@@ -1039,7 +1047,7 @@ PlayerObject.prototype.startFactionWork = function(faction) {
this.timeNeededToCompleteWork = __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].MillisecondsPer20Hours;
- var cancelButton = Object(__WEBPACK_IMPORTED_MODULE_16__utils_HelperFunctions_js__["b" /* clearEventListeners */])("work-in-progress-cancel-button");
+ var cancelButton = Object(__WEBPACK_IMPORTED_MODULE_17__utils_HelperFunctions_js__["b" /* clearEventListeners */])("work-in-progress-cancel-button");
cancelButton.innerHTML = "Stop Faction Work";
cancelButton.addEventListener("click", function() {
Player.finishFactionWork(true);
@@ -1047,7 +1055,7 @@ PlayerObject.prototype.startFactionWork = function(faction) {
});
//Display Work In Progress Screen
- __WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"].loadWorkInProgressContent();
+ __WEBPACK_IMPORTED_MODULE_7__engine_js__["Engine"].loadWorkInProgressContent();
}
PlayerObject.prototype.startFactionHackWork = function(faction) {
@@ -1097,7 +1105,7 @@ PlayerObject.prototype.startFactionSecurityWork = function(faction) {
}
PlayerObject.prototype.workForFaction = function(numCycles) {
- var faction = __WEBPACK_IMPORTED_MODULE_7__Faction_js__["b" /* Factions */][this.currentWorkFactionName];
+ var faction = __WEBPACK_IMPORTED_MODULE_8__Faction_js__["b" /* Factions */][this.currentWorkFactionName];
//Constantly update the rep gain rate
switch (this.factionWorkType) {
@@ -1129,9 +1137,9 @@ PlayerObject.prototype.workForFaction = function(numCycles) {
this.workRepGained += this.workRepGainRate * numCycles;
this.workMoneyGained += this.workMoneyGainRate * numCycles;
- var cyclesPerSec = 1000 / __WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"]._idleSpeed;
+ var cyclesPerSec = 1000 / __WEBPACK_IMPORTED_MODULE_7__engine_js__["Engine"]._idleSpeed;
- this.timeWorked += __WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"]._idleSpeed * numCycles;
+ this.timeWorked += __WEBPACK_IMPORTED_MODULE_7__engine_js__["Engine"]._idleSpeed * numCycles;
//If timeWorked == 20 hours, then finish. You can only work for the faction for 20 hours
if (this.timeWorked >= __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].MillisecondsPer20Hours) {
@@ -1150,16 +1158,16 @@ PlayerObject.prototype.workForFaction = function(numCycles) {
var txt = document.getElementById("work-in-progress-text");
txt.innerHTML = "You are currently " + this.currentWorkFactionDescription + " for your faction " + faction.name + "." +
- " You have been doing this for " + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(this.timeWorked) + "
" +
+ " You have been doing this for " + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(this.timeWorked) + "
" +
"You have earned:
" +
- "$" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workMoneyGained, 2) + " (" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workMoneyGainRate * cyclesPerSec, 2) + " / sec)
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workRepGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workRepGainRate * cyclesPerSec, 4) + " / sec) reputation for this faction
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workHackExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workHackExpGainRate * cyclesPerSec, 4) + " / sec) hacking exp
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workStrExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workStrExpGainRate * cyclesPerSec, 4) + " / sec) strength exp
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDefExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDefExpGainRate * cyclesPerSec, 4) + " / sec) defense exp
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDexExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDexExpGainRate * cyclesPerSec, 4) + " / sec) dexterity exp
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workAgiExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workAgiExpGainRate * cyclesPerSec, 4) + " / sec) agility exp
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workChaExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workChaExpGainRate * cyclesPerSec, 4) + " / sec) charisma exp
" +
+ "$" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workMoneyGained, 2) + " (" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workMoneyGainRate * cyclesPerSec, 2) + " / sec)
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workRepGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workRepGainRate * cyclesPerSec, 4) + " / sec) reputation for this faction
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workHackExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workHackExpGainRate * cyclesPerSec, 4) + " / sec) hacking exp
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workStrExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workStrExpGainRate * cyclesPerSec, 4) + " / sec) strength exp
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDefExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDefExpGainRate * cyclesPerSec, 4) + " / sec) defense exp
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDexExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDexExpGainRate * cyclesPerSec, 4) + " / sec) dexterity exp
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workAgiExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workAgiExpGainRate * cyclesPerSec, 4) + " / sec) agility exp
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workChaExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workChaExpGainRate * cyclesPerSec, 4) + " / sec) charisma exp
" +
"You will automatically finish after working for 20 hours. You can cancel earlier if you wish.
" +
"There is no penalty for cancelling earlier.";
@@ -1170,7 +1178,7 @@ PlayerObject.prototype.workForFaction = function(numCycles) {
PlayerObject.prototype.getWorkMoneyGain = function() {
var bn11Mult = 1;
var company = __WEBPACK_IMPORTED_MODULE_2__Company_js__["a" /* Companies */][this.companyName];
- if (__WEBPACK_IMPORTED_MODULE_10__NetscriptFunctions_js__["b" /* hasBn11SF */]) {
+ if (__WEBPACK_IMPORTED_MODULE_11__NetscriptFunctions_js__["b" /* hasBn11SF */]) {
bn11Mult = 1 + (company.favor / 100);
}
return this.companyPosition.baseSalary * company.salaryMultiplier *
@@ -1284,7 +1292,7 @@ PlayerObject.prototype.startCreateProgramWork = function(programName, time, reqL
this.createProgramName = programName;
- var cancelButton = Object(__WEBPACK_IMPORTED_MODULE_16__utils_HelperFunctions_js__["b" /* clearEventListeners */])("work-in-progress-cancel-button");
+ var cancelButton = Object(__WEBPACK_IMPORTED_MODULE_17__utils_HelperFunctions_js__["b" /* clearEventListeners */])("work-in-progress-cancel-button");
cancelButton.innerHTML = "Cancel work on creating program";
cancelButton.addEventListener("click", function() {
Player.finishCreateProgramWork(true);
@@ -1292,7 +1300,7 @@ PlayerObject.prototype.startCreateProgramWork = function(programName, time, reqL
});
//Display Work In Progress Screen
- __WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"].loadWorkInProgressContent();
+ __WEBPACK_IMPORTED_MODULE_7__engine_js__["Engine"].loadWorkInProgressContent();
}
PlayerObject.prototype.createProgramWork = function(numCycles) {
@@ -1302,8 +1310,8 @@ PlayerObject.prototype.createProgramWork = function(numCycles) {
skillMult = 1 + ((skillMult - 1) / 5); //The divider constant can be adjusted as necessary
//Skill multiplier directly applied to "time worked"
- this.timeWorked += (__WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"]._idleSpeed * numCycles);
- this.timeWorkedCreateProgram += (__WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"]._idleSpeed * numCycles * skillMult);
+ this.timeWorked += (__WEBPACK_IMPORTED_MODULE_7__engine_js__["Engine"]._idleSpeed * numCycles);
+ this.timeWorkedCreateProgram += (__WEBPACK_IMPORTED_MODULE_7__engine_js__["Engine"]._idleSpeed * numCycles * skillMult);
var programName = this.createProgramName;
if (this.timeWorkedCreateProgram >= this.timeNeededToCompleteWork) {
@@ -1312,7 +1320,7 @@ PlayerObject.prototype.createProgramWork = function(numCycles) {
var txt = document.getElementById("work-in-progress-text");
txt.innerHTML = "You are currently working on coding " + programName + ".
" +
- "You have been working for " + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(this.timeWorked) + "
" +
+ "You have been working for " + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(this.timeWorked) + "
" +
"The program is " + (this.timeWorkedCreateProgram / this.timeNeededToCompleteWork * 100).toFixed(2) + "% complete.
" +
"If you cancel, your work will be saved and you can come back to complete the program later.";
}
@@ -1320,7 +1328,7 @@ PlayerObject.prototype.createProgramWork = function(numCycles) {
PlayerObject.prototype.finishCreateProgramWork = function(cancelled, sing=false) {
var programName = this.createProgramName;
if (cancelled === false) {
- Object(__WEBPACK_IMPORTED_MODULE_15__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You've finished creating " + programName + "!
" +
+ Object(__WEBPACK_IMPORTED_MODULE_16__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You've finished creating " + programName + "!
" +
"The new program can be found on your home computer.");
this.getHomeComputer().programs.push(programName);
@@ -1339,7 +1347,7 @@ PlayerObject.prototype.finishCreateProgramWork = function(cancelled, sing=false)
this.isWorking = false;
- __WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"].loadTerminalContent();
+ __WEBPACK_IMPORTED_MODULE_7__engine_js__["Engine"].loadTerminalContent();
}
/* Studying/Taking Classes */
@@ -1350,7 +1358,7 @@ PlayerObject.prototype.startClass = function(costMult, expMult, className) {
this.className = className;
- var gameCPS = 1000 / __WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"]._idleSpeed;
+ var gameCPS = 1000 / __WEBPACK_IMPORTED_MODULE_7__engine_js__["Engine"]._idleSpeed;
//Base exp gains per second
var baseStudyComputerScienceExp = 0.5;
@@ -1417,7 +1425,7 @@ PlayerObject.prototype.startClass = function(costMult, expMult, className) {
this.workAgiExpGainRate = agiExp * this.agility_exp_mult * __WEBPACK_IMPORTED_MODULE_1__BitNode_js__["a" /* BitNodeMultipliers */].ClassGymExpGain;;
this.workChaExpGainRate = chaExp * this.charisma_exp_mult * __WEBPACK_IMPORTED_MODULE_1__BitNode_js__["a" /* BitNodeMultipliers */].ClassGymExpGain;;
- var cancelButton = Object(__WEBPACK_IMPORTED_MODULE_16__utils_HelperFunctions_js__["b" /* clearEventListeners */])("work-in-progress-cancel-button");
+ var cancelButton = Object(__WEBPACK_IMPORTED_MODULE_17__utils_HelperFunctions_js__["b" /* clearEventListeners */])("work-in-progress-cancel-button");
if (className == __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].ClassGymStrength ||
className == __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].ClassGymDefense ||
className == __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].ClassGymDexterity ||
@@ -1432,11 +1440,11 @@ PlayerObject.prototype.startClass = function(costMult, expMult, className) {
});
//Display Work In Progress Screen
- __WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"].loadWorkInProgressContent();
+ __WEBPACK_IMPORTED_MODULE_7__engine_js__["Engine"].loadWorkInProgressContent();
}
PlayerObject.prototype.takeClass = function(numCycles) {
- this.timeWorked += __WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"]._idleSpeed * numCycles;
+ this.timeWorked += __WEBPACK_IMPORTED_MODULE_7__engine_js__["Engine"]._idleSpeed * numCycles;
var className = this.className;
this.workHackExpGained += this.workHackExpGainRate * numCycles;
@@ -1449,19 +1457,19 @@ PlayerObject.prototype.takeClass = function(numCycles) {
this.workMoneyGained += this.workMoneyGainRate * numCycles;
this.workMoneyGained -= this.workMoneyLossRate * numCycles;
- var cyclesPerSec = 1000 / __WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"]._idleSpeed;
+ var cyclesPerSec = 1000 / __WEBPACK_IMPORTED_MODULE_7__engine_js__["Engine"]._idleSpeed;
var txt = document.getElementById("work-in-progress-text");
- txt.innerHTML = "You have been " + className + " for " + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(this.timeWorked) + "
" +
+ txt.innerHTML = "You have been " + className + " for " + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(this.timeWorked) + "
" +
"This has cost you:
" +
- "$" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workMoneyGained, 2) + " ($" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workMoneyLossRate * cyclesPerSec, 2) + " / sec)
" +
+ "$" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workMoneyGained, 2) + " ($" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workMoneyLossRate * cyclesPerSec, 2) + " / sec)
" +
"You have gained:
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workHackExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workHackExpGainRate * cyclesPerSec, 4) + " / sec) hacking exp
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDefExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDefExpGainRate * cyclesPerSec, 4) + " / sec) defense exp
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workStrExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workStrExpGainRate * cyclesPerSec, 4) + " / sec) strength exp
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDexExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDexExpGainRate * cyclesPerSec, 4) + " / sec) dexterity exp
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workAgiExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workAgiExpGainRate * cyclesPerSec, 4) + " / sec) agility exp
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workChaExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workChaExpGainRate * cyclesPerSec, 4) + " / sec) charisma exp
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workHackExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workHackExpGainRate * cyclesPerSec, 4) + " / sec) hacking exp
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDefExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDefExpGainRate * cyclesPerSec, 4) + " / sec) defense exp
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workStrExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workStrExpGainRate * cyclesPerSec, 4) + " / sec) strength exp
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDexExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDexExpGainRate * cyclesPerSec, 4) + " / sec) dexterity exp
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workAgiExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workAgiExpGainRate * cyclesPerSec, 4) + " / sec) agility exp
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workChaExpGained, 4) + " (" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workChaExpGainRate * cyclesPerSec, 4) + " / sec) charisma exp
" +
"You may cancel at any time";
}
@@ -1477,33 +1485,33 @@ PlayerObject.prototype.finishClass = function(sing=false) {
this.loseMoney(this.workMoneyGained * -1);
this.updateSkillLevels();
- var txt = "After " + this.className + " for " + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(this.timeWorked) + ",
" +
- "you spent a total of $" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workMoneyGained * -1, 2) + ".
" +
+ var txt = "After " + this.className + " for " + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(this.timeWorked) + ",
" +
+ "you spent a total of $" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workMoneyGained * -1, 2) + ".
" +
"You earned a total of:
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workHackExpGained, 4) + " hacking exp
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workStrExpGained, 4) + " strength exp
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDefExpGained, 4) + " defense exp
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDexExpGained, 4) + " dexterity exp
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workAgiExpGained, 4) + " agility exp
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workChaExpGained, 4) + " charisma exp
";
- if (!sing) {Object(__WEBPACK_IMPORTED_MODULE_15__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);}
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workHackExpGained, 4) + " hacking exp
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workStrExpGained, 4) + " strength exp
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDefExpGained, 4) + " defense exp
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDexExpGained, 4) + " dexterity exp
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workAgiExpGained, 4) + " agility exp
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workChaExpGained, 4) + " charisma exp
";
+ if (!sing) {Object(__WEBPACK_IMPORTED_MODULE_16__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);}
var mainMenu = document.getElementById("mainmenu-container");
mainMenu.style.visibility = "visible";
this.isWorking = false;
- __WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_7__engine_js__["Engine"].loadLocationContent();
- if (sing) {return "After " + this.className + " for " + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(this.timeWorked) + ", " +
- "you spent a total of $" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workMoneyGained * -1, 2) + ". " +
+ if (sing) {return "After " + this.className + " for " + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(this.timeWorked) + ", " +
+ "you spent a total of $" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workMoneyGained * -1, 2) + ". " +
"You earned a total of: " +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workHackExpGained, 3) + " hacking exp, " +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workStrExpGained, 3) + " strength exp, " +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDefExpGained, 3) + " defense exp, " +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDexExpGained, 3) + " dexterity exp, " +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workAgiExpGained, 3) + " agility exp, and " +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workChaExpGained, 3) + " charisma exp";}
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workHackExpGained, 3) + " hacking exp, " +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workStrExpGained, 3) + " strength exp, " +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDefExpGained, 3) + " defense exp, " +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDexExpGained, 3) + " dexterity exp, " +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workAgiExpGained, 3) + " agility exp, and " +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workChaExpGained, 3) + " charisma exp";}
}
//The EXP and $ gains are hardcoded. Time is in ms
@@ -1528,7 +1536,7 @@ PlayerObject.prototype.startCrime = function(hackExp, strExp, defExp, dexExp, ag
this.timeNeededToCompleteWork = time;
//Remove all old event listeners from Cancel button
- var newCancelButton = Object(__WEBPACK_IMPORTED_MODULE_16__utils_HelperFunctions_js__["b" /* clearEventListeners */])("work-in-progress-cancel-button")
+ var newCancelButton = Object(__WEBPACK_IMPORTED_MODULE_17__utils_HelperFunctions_js__["b" /* clearEventListeners */])("work-in-progress-cancel-button")
newCancelButton.innerHTML = "Cancel crime"
newCancelButton.addEventListener("click", function() {
Player.finishCrime(true);
@@ -1536,11 +1544,11 @@ PlayerObject.prototype.startCrime = function(hackExp, strExp, defExp, dexExp, ag
});
//Display Work In Progress Screen
- __WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"].loadWorkInProgressContent();
+ __WEBPACK_IMPORTED_MODULE_7__engine_js__["Engine"].loadWorkInProgressContent();
}
PlayerObject.prototype.commitCrime = function (numCycles) {
- this.timeWorked += __WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"]._idleSpeed * numCycles;
+ this.timeWorked += __WEBPACK_IMPORTED_MODULE_7__engine_js__["Engine"]._idleSpeed * numCycles;
if (this.timeWorked >= this.timeNeededToCompleteWork) {this.finishCrime(false); return;}
@@ -1552,7 +1560,7 @@ PlayerObject.prototype.commitCrime = function (numCycles) {
var txt = document.getElementById("work-in-progress-text");
txt.innerHTML = "You are attempting to " + this.crimeType + ".
" +
- "Time remaining: " + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(this.timeNeededToCompleteWork - this.timeWorked) + "
" +
+ "Time remaining: " + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(this.timeNeededToCompleteWork - this.timeWorked) + "
" +
progressBar.replace( / /g, " " );
}
@@ -1560,7 +1568,7 @@ PlayerObject.prototype.finishCrime = function(cancelled) {
//Determine crime success/failure
if (!cancelled) {
var statusText = ""; //TODO, unique message for each crime when you succeed
- if (Object(__WEBPACK_IMPORTED_MODULE_5__Crimes_js__["y" /* determineCrimeSuccess */])(this.crimeType, this.workMoneyGained)) {
+ if (Object(__WEBPACK_IMPORTED_MODULE_6__Crimes_js__["y" /* determineCrimeSuccess */])(this.crimeType, this.workMoneyGained)) {
//Handle Karma and crime statistics
switch(this.crimeType) {
case __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].CrimeShoplift:
@@ -1610,7 +1618,7 @@ PlayerObject.prototype.finishCrime = function(cancelled) {
break;
default:
console.log(this.crimeType);
- Object(__WEBPACK_IMPORTED_MODULE_15__utils_DialogBox_js__["a" /* dialogBoxCreate */])("ERR: Unrecognized crime type. This is probably a bug please contact the developer");
+ Object(__WEBPACK_IMPORTED_MODULE_16__utils_DialogBox_js__["a" /* dialogBoxCreate */])("ERR: Unrecognized crime type. This is probably a bug please contact the developer");
return;
}
@@ -1623,23 +1631,23 @@ PlayerObject.prototype.finishCrime = function(cancelled) {
this.workChaExpGained *= 2;
if (this.committingCrimeThruSingFn) {
this.singFnCrimeWorkerScript.scriptRef.log("Crime successful! Gained " +
- __WEBPACK_IMPORTED_MODULE_19__utils_numeral_min_js___default()(this.workMoneyGained).format("$0.000a") + ", " +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workHackExpGained, 3) + " hack exp, " +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workStrExpGained, 3) + " str exp, " +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDefExpGained, 3) + " def exp, " +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDexExpGained, 3) + " dex exp, " +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workAgiExpGained, 3) + " agi exp, " +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workChaExpGained, 3) + " cha exp.");
+ __WEBPACK_IMPORTED_MODULE_20__utils_numeral_min_js___default()(this.workMoneyGained).format("$0.000a") + ", " +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workHackExpGained, 3) + " hack exp, " +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workStrExpGained, 3) + " str exp, " +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDefExpGained, 3) + " def exp, " +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDexExpGained, 3) + " dex exp, " +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workAgiExpGained, 3) + " agi exp, " +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workChaExpGained, 3) + " cha exp.");
} else {
- Object(__WEBPACK_IMPORTED_MODULE_15__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Crime successful!
" +
+ Object(__WEBPACK_IMPORTED_MODULE_16__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Crime successful!
" +
"You gained:
"+
- "$" + Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workMoneyGained, 2) + "
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workHackExpGained, 4) + " hacking experience
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workStrExpGained, 4) + " strength experience
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDefExpGained, 4) + " defense experience
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDexExpGained, 4) + " dexterity experience
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workAgiExpGained, 4) + " agility experience
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workChaExpGained, 4) + " charisma experience");
+ "$" + Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workMoneyGained, 2) + "
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workHackExpGained, 4) + " hacking experience
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workStrExpGained, 4) + " strength experience
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDefExpGained, 4) + " defense experience
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDexExpGained, 4) + " dexterity experience
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workAgiExpGained, 4) + " agility experience
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workChaExpGained, 4) + " charisma experience");
}
} else {
@@ -1652,21 +1660,21 @@ PlayerObject.prototype.finishCrime = function(cancelled) {
this.workChaExpGained /= 2;
if (this.committingCrimeThruSingFn) {
this.singFnCrimeWorkerScript.scriptRef.log("Crime failed! Gained " +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workHackExpGained, 3) + " hack exp, " +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workStrExpGained, 3) + " str exp, " +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDefExpGained, 3) + " def exp, " +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDexExpGained, 3) + " dex exp, " +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workAgiExpGained, 3) + " agi exp, " +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workChaExpGained, 3) + " chaexp.");
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workHackExpGained, 3) + " hack exp, " +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workStrExpGained, 3) + " str exp, " +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDefExpGained, 3) + " def exp, " +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDexExpGained, 3) + " dex exp, " +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workAgiExpGained, 3) + " agi exp, " +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workChaExpGained, 3) + " chaexp.");
} else {
- Object(__WEBPACK_IMPORTED_MODULE_15__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Crime failed!
" +
+ Object(__WEBPACK_IMPORTED_MODULE_16__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Crime failed!
" +
"You gained:
"+
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workHackExpGained, 4) + " hacking experience
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workStrExpGained, 4) + " strength experience
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDefExpGained, 4) + " defense experience
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDexExpGained, 4) + " dexterity experience
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workAgiExpGained, 4) + " agility experience
" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workChaExpGained, 4) + " charisma experience");
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workHackExpGained, 4) + " hacking experience
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workStrExpGained, 4) + " strength experience
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDefExpGained, 4) + " defense experience
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workDexExpGained, 4) + " dexterity experience
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workAgiExpGained, 4) + " agility experience
" +
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.workChaExpGained, 4) + " charisma experience");
}
}
@@ -1677,7 +1685,7 @@ PlayerObject.prototype.finishCrime = function(cancelled) {
var mainMenu = document.getElementById("mainmenu-container");
mainMenu.style.visibility = "visible";
this.isWorking = false;
- __WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_7__engine_js__["Engine"].loadLocationContent();
}
//Cancels the player's current "work" assignment and gives the proper rewards
@@ -1724,9 +1732,9 @@ PlayerObject.prototype.takeDamage = function(amt) {
}
PlayerObject.prototype.hospitalize = function() {
- Object(__WEBPACK_IMPORTED_MODULE_15__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You were in critical condition! You were taken to the hospital where " +
+ Object(__WEBPACK_IMPORTED_MODULE_16__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You were in critical condition! You were taken to the hospital where " +
"luckily they were able to save your life. You were charged $" +
- Object(__WEBPACK_IMPORTED_MODULE_20__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.max_hp * __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].HospitalCostPerHp, 2));
+ Object(__WEBPACK_IMPORTED_MODULE_21__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.max_hp * __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].HospitalCostPerHp, 2));
this.loseMoney(this.max_hp * __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].HospitalCostPerHp);
this.hp = this.max_hp;
}
@@ -1754,12 +1762,12 @@ PlayerObject.prototype.applyForJob = function(entryPosType, sing=false) {
if (!this.isQualified(company, pos)) {
var reqText = Object(__WEBPACK_IMPORTED_MODULE_2__Company_js__["f" /* getJobRequirementText */])(company, pos);
if (sing) {return false;}
- Object(__WEBPACK_IMPORTED_MODULE_15__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Unforunately, you do not qualify for this position
" + reqText);
+ Object(__WEBPACK_IMPORTED_MODULE_16__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Unforunately, you do not qualify for this position
" + reqText);
return;
}
while (true) {
- if (__WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"].Debug) {console.log("Determining qualification for next Company Position");}
+ if (__WEBPACK_IMPORTED_MODULE_7__engine_js__["Engine"].Debug) {console.log("Determining qualification for next Company Position");}
var newPos = Object(__WEBPACK_IMPORTED_MODULE_2__Company_js__["g" /* getNextCompanyPosition */])(pos);
if (newPos == null) {break;}
@@ -1782,14 +1790,14 @@ PlayerObject.prototype.applyForJob = function(entryPosType, sing=false) {
var nextPos = Object(__WEBPACK_IMPORTED_MODULE_2__Company_js__["g" /* getNextCompanyPosition */])(pos);
if (nextPos == null) {
if (sing) {return false;}
- Object(__WEBPACK_IMPORTED_MODULE_15__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You are already at the highest position for your field! No promotion available");
+ Object(__WEBPACK_IMPORTED_MODULE_16__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You are already at the highest position for your field! No promotion available");
} else if (company.hasPosition(nextPos)) {
if (sing) {return false;}
var reqText = Object(__WEBPACK_IMPORTED_MODULE_2__Company_js__["f" /* getJobRequirementText */])(company, nextPos);
- Object(__WEBPACK_IMPORTED_MODULE_15__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Unfortunately, you do not qualify for a promotion
" + reqText);
+ Object(__WEBPACK_IMPORTED_MODULE_16__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Unfortunately, you do not qualify for a promotion
" + reqText);
} else {
if (sing) {return false;}
- Object(__WEBPACK_IMPORTED_MODULE_15__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You are already at the highest position for your field! No promotion available");
+ Object(__WEBPACK_IMPORTED_MODULE_16__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You are already at the highest position for your field! No promotion available");
}
return; //Same job, do nothing
}
@@ -1820,15 +1828,15 @@ PlayerObject.prototype.applyForJob = function(entryPosType, sing=false) {
if (leaveCompany) {
if (sing) {return true;}
- Object(__WEBPACK_IMPORTED_MODULE_15__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Congratulations! You were offered a new job at " + this.companyName + " as a " +
+ Object(__WEBPACK_IMPORTED_MODULE_16__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Congratulations! You were offered a new job at " + this.companyName + " as a " +
pos.positionName + "!
" +
"You lost 1000 reputation at your old company " + oldCompanyName + " because you left.");
} else {
if (sing) {return true;}
- Object(__WEBPACK_IMPORTED_MODULE_15__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Congratulations! You were offered a new job at " + this.companyName + " as a " + pos.positionName + "!");
+ Object(__WEBPACK_IMPORTED_MODULE_16__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Congratulations! You were offered a new job at " + this.companyName + " as a " + pos.positionName + "!");
}
- __WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_7__engine_js__["Engine"].loadLocationContent();
}
//Returns your next position at a company given the field (software, business, etc.)
@@ -1880,7 +1888,7 @@ PlayerObject.prototype.applyForSecurityEngineerJob = function(sing=false) {
return this.applyForJob(__WEBPACK_IMPORTED_MODULE_2__Company_js__["d" /* CompanyPositions */].SecurityEngineer, sing);
} else {
if (sing) {return false;}
- Object(__WEBPACK_IMPORTED_MODULE_15__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Unforunately, you do not qualify for this position");
+ Object(__WEBPACK_IMPORTED_MODULE_16__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Unforunately, you do not qualify for this position");
}
}
@@ -1890,7 +1898,7 @@ PlayerObject.prototype.applyForNetworkEngineerJob = function(sing=false) {
return this.applyForJob(__WEBPACK_IMPORTED_MODULE_2__Company_js__["d" /* CompanyPositions */].NetworkEngineer, sing);
} else {
if (sing) {return false;}
- Object(__WEBPACK_IMPORTED_MODULE_15__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Unforunately, you do not qualify for this position");
+ Object(__WEBPACK_IMPORTED_MODULE_16__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Unforunately, you do not qualify for this position");
}
}
@@ -1913,7 +1921,7 @@ PlayerObject.prototype.applyForAgentJob = function(sing=false) {
return this.applyForJob(__WEBPACK_IMPORTED_MODULE_2__Company_js__["d" /* CompanyPositions */].FieldAgent, sing);
} else {
if (sing) {return false;}
- Object(__WEBPACK_IMPORTED_MODULE_15__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Unforunately, you do not qualify for this position");
+ Object(__WEBPACK_IMPORTED_MODULE_16__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Unforunately, you do not qualify for this position");
}
}
@@ -1929,11 +1937,11 @@ PlayerObject.prototype.applyForEmployeeJob = function(sing=false) {
this.companyName = company.companyName;
this.companyPosition = __WEBPACK_IMPORTED_MODULE_2__Company_js__["d" /* CompanyPositions */].Employee;
if (sing) {return true;}
- Object(__WEBPACK_IMPORTED_MODULE_15__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Congratulations, you are now employed at " + this.companyName);
- __WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"].loadLocationContent();
+ Object(__WEBPACK_IMPORTED_MODULE_16__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Congratulations, you are now employed at " + this.companyName);
+ __WEBPACK_IMPORTED_MODULE_7__engine_js__["Engine"].loadLocationContent();
} else {
if (sing) {return false;}
- Object(__WEBPACK_IMPORTED_MODULE_15__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Unforunately, you do not qualify for this position");
+ Object(__WEBPACK_IMPORTED_MODULE_16__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Unforunately, you do not qualify for this position");
}
}
@@ -1949,11 +1957,11 @@ PlayerObject.prototype.applyForPartTimeEmployeeJob = function(sing=false) {
this.companyName = company.companyName;
this.companyPosition = __WEBPACK_IMPORTED_MODULE_2__Company_js__["d" /* CompanyPositions */].PartTimeEmployee;
if (sing) {return true;}
- Object(__WEBPACK_IMPORTED_MODULE_15__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Congratulations, you are now employed part-time at " + this.companyName);
- __WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"].loadLocationContent();
+ Object(__WEBPACK_IMPORTED_MODULE_16__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Congratulations, you are now employed part-time at " + this.companyName);
+ __WEBPACK_IMPORTED_MODULE_7__engine_js__["Engine"].loadLocationContent();
} else {
if (sing) {return false;}
- Object(__WEBPACK_IMPORTED_MODULE_15__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Unforunately, you do not qualify for this position");
+ Object(__WEBPACK_IMPORTED_MODULE_16__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Unforunately, you do not qualify for this position");
}
}
@@ -1969,11 +1977,11 @@ PlayerObject.prototype.applyForWaiterJob = function(sing=false) {
this.companyName = company.companyName;
this.companyPosition = __WEBPACK_IMPORTED_MODULE_2__Company_js__["d" /* CompanyPositions */].Waiter;
if (sing) {return true;}
- Object(__WEBPACK_IMPORTED_MODULE_15__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Congratulations, you are now employed as a waiter at " + this.companyName);
- __WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"].loadLocationContent();
+ Object(__WEBPACK_IMPORTED_MODULE_16__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Congratulations, you are now employed as a waiter at " + this.companyName);
+ __WEBPACK_IMPORTED_MODULE_7__engine_js__["Engine"].loadLocationContent();
} else {
if (sing) {return false;}
- Object(__WEBPACK_IMPORTED_MODULE_15__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Unforunately, you do not qualify for this position");
+ Object(__WEBPACK_IMPORTED_MODULE_16__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Unforunately, you do not qualify for this position");
}
}
@@ -1989,11 +1997,11 @@ PlayerObject.prototype.applyForPartTimeWaiterJob = function(sing=false) {
this.companyName = company.companyName;
this.companyPosition = __WEBPACK_IMPORTED_MODULE_2__Company_js__["d" /* CompanyPositions */].PartTimeWaiter;
if (sing) {return true;}
- Object(__WEBPACK_IMPORTED_MODULE_15__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Congratulations, you are now employed as a part-time waiter at " + this.companyName);
- __WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"].loadLocationContent();
+ Object(__WEBPACK_IMPORTED_MODULE_16__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Congratulations, you are now employed as a part-time waiter at " + this.companyName);
+ __WEBPACK_IMPORTED_MODULE_7__engine_js__["Engine"].loadLocationContent();
} else {
if (sing) {return false;}
- Object(__WEBPACK_IMPORTED_MODULE_15__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Unforunately, you do not qualify for this position");
+ Object(__WEBPACK_IMPORTED_MODULE_16__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Unforunately, you do not qualify for this position");
}
}
@@ -2060,12 +2068,12 @@ PlayerObject.prototype.reapplyAllSourceFiles = function() {
for (let i = 0; i < this.sourceFiles.length; ++i) {
var srcFileKey = "SourceFile" + this.sourceFiles[i].n;
- var sourceFileObject = __WEBPACK_IMPORTED_MODULE_13__SourceFile_js__["b" /* SourceFiles */][srcFileKey];
+ var sourceFileObject = __WEBPACK_IMPORTED_MODULE_14__SourceFile_js__["b" /* SourceFiles */][srcFileKey];
if (sourceFileObject == null) {
console.log("ERROR: Invalid source file number: " + this.sourceFiles[i].n);
continue;
}
- Object(__WEBPACK_IMPORTED_MODULE_13__SourceFile_js__["c" /* applySourceFile */])(this.sourceFiles[i]);
+ Object(__WEBPACK_IMPORTED_MODULE_14__SourceFile_js__["c" /* applySourceFile */])(this.sourceFiles[i]);
}
}
@@ -2085,7 +2093,7 @@ PlayerObject.prototype.checkForFactionInvitations = function() {
}
//Illuminati
- var illuminatiFac = __WEBPACK_IMPORTED_MODULE_7__Faction_js__["b" /* Factions */]["Illuminati"];
+ var illuminatiFac = __WEBPACK_IMPORTED_MODULE_8__Faction_js__["b" /* Factions */]["Illuminati"];
if (!illuminatiFac.isBanned && !illuminatiFac.isMember && !illuminatiFac.alreadyInvited &&
numAugmentations >= 30 &&
this.money.gte(150000000000) &&
@@ -2096,7 +2104,7 @@ PlayerObject.prototype.checkForFactionInvitations = function() {
}
//Daedalus
- var daedalusFac = __WEBPACK_IMPORTED_MODULE_7__Faction_js__["b" /* Factions */]["Daedalus"];
+ var daedalusFac = __WEBPACK_IMPORTED_MODULE_8__Faction_js__["b" /* Factions */]["Daedalus"];
if (!daedalusFac.isBanned && !daedalusFac.isMember && !daedalusFac.alreadyInvited &&
numAugmentations >= 30 &&
this.money.gte(100000000000) &&
@@ -2107,7 +2115,7 @@ PlayerObject.prototype.checkForFactionInvitations = function() {
}
//The Covenant
- var covenantFac = __WEBPACK_IMPORTED_MODULE_7__Faction_js__["b" /* Factions */]["The Covenant"];
+ var covenantFac = __WEBPACK_IMPORTED_MODULE_8__Faction_js__["b" /* Factions */]["The Covenant"];
if (!covenantFac.isBanned && !covenantFac.isMember && !covenantFac.alreadyInvited &&
numAugmentations >= 30 &&
this.money.gte(75000000000) &&
@@ -2120,88 +2128,88 @@ PlayerObject.prototype.checkForFactionInvitations = function() {
}
//ECorp
- var ecorpFac = __WEBPACK_IMPORTED_MODULE_7__Faction_js__["b" /* Factions */]["ECorp"];
+ var ecorpFac = __WEBPACK_IMPORTED_MODULE_8__Faction_js__["b" /* Factions */]["ECorp"];
if (!ecorpFac.isBanned && !ecorpFac.isMember && !ecorpFac.alreadyInvited &&
- this.companyName == __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].AevumECorp && companyRep >= __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].CorpFactionRepRequirement) {
+ this.companyName == __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].AevumECorp && companyRep >= __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].CorpFactionRepRequirement) {
invitedFactions.push(ecorpFac);
}
//MegaCorp
- var megacorpFac = __WEBPACK_IMPORTED_MODULE_7__Faction_js__["b" /* Factions */]["MegaCorp"];
+ var megacorpFac = __WEBPACK_IMPORTED_MODULE_8__Faction_js__["b" /* Factions */]["MegaCorp"];
if (!megacorpFac.isBanned && !megacorpFac.isMember && !megacorpFac.alreadyInvited &&
- this.companyName == __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Sector12MegaCorp && companyRep >= __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].CorpFactionRepRequirement) {
+ this.companyName == __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Sector12MegaCorp && companyRep >= __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].CorpFactionRepRequirement) {
invitedFactions.push(megacorpFac);
}
//Bachman & Associates
- var bachmanandassociatesFac = __WEBPACK_IMPORTED_MODULE_7__Faction_js__["b" /* Factions */]["Bachman & Associates"];
+ var bachmanandassociatesFac = __WEBPACK_IMPORTED_MODULE_8__Faction_js__["b" /* Factions */]["Bachman & Associates"];
if (!bachmanandassociatesFac.isBanned && !bachmanandassociatesFac.isMember &&
!bachmanandassociatesFac.alreadyInvited &&
- this.companyName == __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].AevumBachmanAndAssociates && companyRep >= __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].CorpFactionRepRequirement) {
+ this.companyName == __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].AevumBachmanAndAssociates && companyRep >= __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].CorpFactionRepRequirement) {
invitedFactions.push(bachmanandassociatesFac);
}
//Blade Industries
- var bladeindustriesFac = __WEBPACK_IMPORTED_MODULE_7__Faction_js__["b" /* Factions */]["Blade Industries"];
+ var bladeindustriesFac = __WEBPACK_IMPORTED_MODULE_8__Faction_js__["b" /* Factions */]["Blade Industries"];
if (!bladeindustriesFac.isBanned && !bladeindustriesFac.isMember && !bladeindustriesFac.alreadyInvited &&
- this.companyName == __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Sector12BladeIndustries && companyRep >= __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].CorpFactionRepRequirement) {
+ this.companyName == __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Sector12BladeIndustries && companyRep >= __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].CorpFactionRepRequirement) {
invitedFactions.push(bladeindustriesFac);
}
//NWO
- var nwoFac = __WEBPACK_IMPORTED_MODULE_7__Faction_js__["b" /* Factions */]["NWO"];
+ var nwoFac = __WEBPACK_IMPORTED_MODULE_8__Faction_js__["b" /* Factions */]["NWO"];
if (!nwoFac.isBanned && !nwoFac.isMember && !nwoFac.alreadyInvited &&
- this.companyName == __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].VolhavenNWO && companyRep >= __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].CorpFactionRepRequirement) {
+ this.companyName == __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].VolhavenNWO && companyRep >= __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].CorpFactionRepRequirement) {
invitedFactions.push(nwoFac);
}
//Clarke Incorporated
- var clarkeincorporatedFac = __WEBPACK_IMPORTED_MODULE_7__Faction_js__["b" /* Factions */]["Clarke Incorporated"];
+ var clarkeincorporatedFac = __WEBPACK_IMPORTED_MODULE_8__Faction_js__["b" /* Factions */]["Clarke Incorporated"];
if (!clarkeincorporatedFac.isBanned && !clarkeincorporatedFac.isMember && !clarkeincorporatedFac.alreadyInvited &&
- this.companyName == __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].AevumClarkeIncorporated && companyRep >= __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].CorpFactionRepRequirement) {
+ this.companyName == __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].AevumClarkeIncorporated && companyRep >= __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].CorpFactionRepRequirement) {
invitedFactions.push(clarkeincorporatedFac);
}
//OmniTek Incorporated
- var omnitekincorporatedFac = __WEBPACK_IMPORTED_MODULE_7__Faction_js__["b" /* Factions */]["OmniTek Incorporated"];
+ var omnitekincorporatedFac = __WEBPACK_IMPORTED_MODULE_8__Faction_js__["b" /* Factions */]["OmniTek Incorporated"];
if (!omnitekincorporatedFac.isBanned && !omnitekincorporatedFac.isMember && !omnitekincorporatedFac.alreadyInvited &&
- this.companyName == __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].VolhavenOmniTekIncorporated && companyRep >= __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].CorpFactionRepRequirement) {
+ this.companyName == __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].VolhavenOmniTekIncorporated && companyRep >= __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].CorpFactionRepRequirement) {
invitedFactions.push(omnitekincorporatedFac);
}
//Four Sigma
- var foursigmaFac = __WEBPACK_IMPORTED_MODULE_7__Faction_js__["b" /* Factions */]["Four Sigma"];
+ var foursigmaFac = __WEBPACK_IMPORTED_MODULE_8__Faction_js__["b" /* Factions */]["Four Sigma"];
if (!foursigmaFac.isBanned && !foursigmaFac.isMember && !foursigmaFac.alreadyInvited &&
- this.companyName == __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Sector12FourSigma && companyRep >= __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].CorpFactionRepRequirement) {
+ this.companyName == __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Sector12FourSigma && companyRep >= __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].CorpFactionRepRequirement) {
invitedFactions.push(foursigmaFac);
}
//KuaiGong International
- var kuaigonginternationalFac = __WEBPACK_IMPORTED_MODULE_7__Faction_js__["b" /* Factions */]["KuaiGong International"];
+ var kuaigonginternationalFac = __WEBPACK_IMPORTED_MODULE_8__Faction_js__["b" /* Factions */]["KuaiGong International"];
if (!kuaigonginternationalFac.isBanned && !kuaigonginternationalFac.isMember &&
!kuaigonginternationalFac.alreadyInvited &&
- this.companyName == __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].ChongqingKuaiGongInternational && companyRep >= __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].CorpFactionRepRequirement) {
+ this.companyName == __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].ChongqingKuaiGongInternational && companyRep >= __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].CorpFactionRepRequirement) {
invitedFactions.push(kuaigonginternationalFac);
}
//Fulcrum Secret Technologies - If u've unlocked fulcrum secret technolgoies server and have a high rep with the company
- var fulcrumsecrettechonologiesFac = __WEBPACK_IMPORTED_MODULE_7__Faction_js__["b" /* Factions */]["Fulcrum Secret Technologies"];
- var fulcrumSecretServer = __WEBPACK_IMPORTED_MODULE_11__Server_js__["b" /* AllServers */][__WEBPACK_IMPORTED_MODULE_12__SpecialServerIps_js__["a" /* SpecialServerIps */][__WEBPACK_IMPORTED_MODULE_12__SpecialServerIps_js__["b" /* SpecialServerNames */].FulcrumSecretTechnologies]];
+ var fulcrumsecrettechonologiesFac = __WEBPACK_IMPORTED_MODULE_8__Faction_js__["b" /* Factions */]["Fulcrum Secret Technologies"];
+ var fulcrumSecretServer = __WEBPACK_IMPORTED_MODULE_12__Server_js__["b" /* AllServers */][__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["a" /* SpecialServerIps */][__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["b" /* SpecialServerNames */].FulcrumSecretTechnologies]];
if (fulcrumSecretServer == null) {
console.log("ERROR: Could not find Fulcrum Secret Technologies Server");
} else {
if (!fulcrumsecrettechonologiesFac.isBanned && !fulcrumsecrettechonologiesFac.isMember &&
!fulcrumsecrettechonologiesFac.alreadyInvited &&
fulcrumSecretServer.manuallyHacked &&
- this.companyName == __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].AevumFulcrumTechnologies && companyRep >= 250000) {
+ this.companyName == __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].AevumFulcrumTechnologies && companyRep >= 250000) {
invitedFactions.push(fulcrumsecrettechonologiesFac);
}
}
//BitRunners
- var bitrunnersFac = __WEBPACK_IMPORTED_MODULE_7__Faction_js__["b" /* Factions */]["BitRunners"];
+ var bitrunnersFac = __WEBPACK_IMPORTED_MODULE_8__Faction_js__["b" /* Factions */]["BitRunners"];
var homeComp = this.getHomeComputer();
- var bitrunnersServer = __WEBPACK_IMPORTED_MODULE_11__Server_js__["b" /* AllServers */][__WEBPACK_IMPORTED_MODULE_12__SpecialServerIps_js__["a" /* SpecialServerIps */][__WEBPACK_IMPORTED_MODULE_12__SpecialServerIps_js__["b" /* SpecialServerNames */].BitRunnersServer]];
+ var bitrunnersServer = __WEBPACK_IMPORTED_MODULE_12__Server_js__["b" /* AllServers */][__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["a" /* SpecialServerIps */][__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["b" /* SpecialServerNames */].BitRunnersServer]];
if (bitrunnersServer == null) {
console.log("ERROR: Could not find BitRunners Server");
} else if (!bitrunnersFac.isBanned && !bitrunnersFac.isMember && bitrunnersServer.manuallyHacked &&
@@ -2210,8 +2218,8 @@ PlayerObject.prototype.checkForFactionInvitations = function() {
}
//The Black Hand
- var theblackhandFac = __WEBPACK_IMPORTED_MODULE_7__Faction_js__["b" /* Factions */]["The Black Hand"];
- var blackhandServer = __WEBPACK_IMPORTED_MODULE_11__Server_js__["b" /* AllServers */][__WEBPACK_IMPORTED_MODULE_12__SpecialServerIps_js__["a" /* SpecialServerIps */][__WEBPACK_IMPORTED_MODULE_12__SpecialServerIps_js__["b" /* SpecialServerNames */].TheBlackHandServer]];
+ var theblackhandFac = __WEBPACK_IMPORTED_MODULE_8__Faction_js__["b" /* Factions */]["The Black Hand"];
+ var blackhandServer = __WEBPACK_IMPORTED_MODULE_12__Server_js__["b" /* AllServers */][__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["a" /* SpecialServerIps */][__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["b" /* SpecialServerNames */].TheBlackHandServer]];
if (blackhandServer == null) {
console.log("ERROR: Could not find The Black Hand Server");
} else if (!theblackhandFac.isBanned && !theblackhandFac.isMember && blackhandServer.manuallyHacked &&
@@ -2220,8 +2228,8 @@ PlayerObject.prototype.checkForFactionInvitations = function() {
}
//NiteSec
- var nitesecFac = __WEBPACK_IMPORTED_MODULE_7__Faction_js__["b" /* Factions */]["NiteSec"];
- var nitesecServer = __WEBPACK_IMPORTED_MODULE_11__Server_js__["b" /* AllServers */][__WEBPACK_IMPORTED_MODULE_12__SpecialServerIps_js__["a" /* SpecialServerIps */][__WEBPACK_IMPORTED_MODULE_12__SpecialServerIps_js__["b" /* SpecialServerNames */].NiteSecServer]];
+ var nitesecFac = __WEBPACK_IMPORTED_MODULE_8__Faction_js__["b" /* Factions */]["NiteSec"];
+ var nitesecServer = __WEBPACK_IMPORTED_MODULE_12__Server_js__["b" /* AllServers */][__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["a" /* SpecialServerIps */][__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["b" /* SpecialServerNames */].NiteSecServer]];
if (nitesecServer == null) {
console.log("ERROR: Could not find NiteSec Server");
} else if (!nitesecFac.isBanned && !nitesecFac.isMember && nitesecServer.manuallyHacked &&
@@ -2230,80 +2238,80 @@ PlayerObject.prototype.checkForFactionInvitations = function() {
}
//Chongqing
- var chongqingFac = __WEBPACK_IMPORTED_MODULE_7__Faction_js__["b" /* Factions */]["Chongqing"];
+ var chongqingFac = __WEBPACK_IMPORTED_MODULE_8__Faction_js__["b" /* Factions */]["Chongqing"];
if (!chongqingFac.isBanned && !chongqingFac.isMember && !chongqingFac.alreadyInvited &&
- this.money.gte(20000000) && this.city == __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Chongqing) {
+ this.money.gte(20000000) && this.city == __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Chongqing) {
invitedFactions.push(chongqingFac);
}
//Sector-12
- var sector12Fac = __WEBPACK_IMPORTED_MODULE_7__Faction_js__["b" /* Factions */]["Sector-12"];
+ var sector12Fac = __WEBPACK_IMPORTED_MODULE_8__Faction_js__["b" /* Factions */]["Sector-12"];
if (!sector12Fac.isBanned && !sector12Fac.isMember && !sector12Fac.alreadyInvited &&
- this.money.gte(15000000) && this.city == __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Sector12) {
+ this.money.gte(15000000) && this.city == __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Sector12) {
invitedFactions.push(sector12Fac);
}
//New Tokyo
- var newtokyoFac = __WEBPACK_IMPORTED_MODULE_7__Faction_js__["b" /* Factions */]["New Tokyo"];
+ var newtokyoFac = __WEBPACK_IMPORTED_MODULE_8__Faction_js__["b" /* Factions */]["New Tokyo"];
if (!newtokyoFac.isBanned && !newtokyoFac.isMember && !newtokyoFac.alreadyInvited &&
- this.money.gte(20000000) && this.city == __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].NewTokyo) {
+ this.money.gte(20000000) && this.city == __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].NewTokyo) {
invitedFactions.push(newtokyoFac);
}
//Aevum
- var aevumFac = __WEBPACK_IMPORTED_MODULE_7__Faction_js__["b" /* Factions */]["Aevum"];
+ var aevumFac = __WEBPACK_IMPORTED_MODULE_8__Faction_js__["b" /* Factions */]["Aevum"];
if (!aevumFac.isBanned && !aevumFac.isMember && !aevumFac.alreadyInvited &&
- this.money.gte(40000000) && this.city == __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Aevum) {
+ this.money.gte(40000000) && this.city == __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Aevum) {
invitedFactions.push(aevumFac);
}
//Ishima
- var ishimaFac = __WEBPACK_IMPORTED_MODULE_7__Faction_js__["b" /* Factions */]["Ishima"];
+ var ishimaFac = __WEBPACK_IMPORTED_MODULE_8__Faction_js__["b" /* Factions */]["Ishima"];
if (!ishimaFac.isBanned && !ishimaFac.isMember && !ishimaFac.alreadyInvited &&
- this.money.gte(30000000) && this.city == __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Ishima) {
+ this.money.gte(30000000) && this.city == __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Ishima) {
invitedFactions.push(ishimaFac);
}
//Volhaven
- var volhavenFac = __WEBPACK_IMPORTED_MODULE_7__Faction_js__["b" /* Factions */]["Volhaven"];
+ var volhavenFac = __WEBPACK_IMPORTED_MODULE_8__Faction_js__["b" /* Factions */]["Volhaven"];
if (!volhavenFac.isBanned && !volhavenFac.isMember && !volhavenFac.alreadyInvited &&
- this.money.gte(50000000) && this.city == __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Volhaven) {
+ this.money.gte(50000000) && this.city == __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Volhaven) {
invitedFactions.push(volhavenFac);
}
//Speakers for the Dead
- var speakersforthedeadFac = __WEBPACK_IMPORTED_MODULE_7__Faction_js__["b" /* Factions */]["Speakers for the Dead"];
+ var speakersforthedeadFac = __WEBPACK_IMPORTED_MODULE_8__Faction_js__["b" /* Factions */]["Speakers for the Dead"];
if (!speakersforthedeadFac.isBanned && !speakersforthedeadFac.isMember && !speakersforthedeadFac.alreadyInvited &&
this.hacking_skill >= 100 && this.strength >= 300 && this.defense >= 300 &&
this.dexterity >= 300 && this.agility >= 300 && this.numPeopleKilled >= 30 &&
- this.karma <= -45 && this.companyName != __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Sector12CIA &&
- this.companyName != __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Sector12NSA) {
+ this.karma <= -45 && this.companyName != __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Sector12CIA &&
+ this.companyName != __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Sector12NSA) {
invitedFactions.push(speakersforthedeadFac);
}
//The Dark Army
- var thedarkarmyFac = __WEBPACK_IMPORTED_MODULE_7__Faction_js__["b" /* Factions */]["The Dark Army"];
+ var thedarkarmyFac = __WEBPACK_IMPORTED_MODULE_8__Faction_js__["b" /* Factions */]["The Dark Army"];
if (!thedarkarmyFac.isBanned && !thedarkarmyFac.isMember && !thedarkarmyFac.alreadyInvited &&
this.hacking_skill >= 300 && this.strength >= 300 && this.defense >= 300 &&
- this.dexterity >= 300 && this.agility >= 300 && this.city == __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Chongqing &&
- this.numPeopleKilled >= 5 && this.karma <= -45 && this.companyName != __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Sector12CIA &&
- this.companyName != __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Sector12NSA) {
+ this.dexterity >= 300 && this.agility >= 300 && this.city == __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Chongqing &&
+ this.numPeopleKilled >= 5 && this.karma <= -45 && this.companyName != __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Sector12CIA &&
+ this.companyName != __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Sector12NSA) {
invitedFactions.push(thedarkarmyFac);
}
//The Syndicate
- var thesyndicateFac = __WEBPACK_IMPORTED_MODULE_7__Faction_js__["b" /* Factions */]["The Syndicate"];
+ var thesyndicateFac = __WEBPACK_IMPORTED_MODULE_8__Faction_js__["b" /* Factions */]["The Syndicate"];
if (!thesyndicateFac.isBanned && !thesyndicateFac.isMember && !thesyndicateFac.alreadyInvited &&
this.hacking_skill >= 200 && this.strength >= 200 && this.defense >= 200 &&
this.dexterity >= 200 && this.agility >= 200 &&
- (this.city == __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Aevum || this.city == __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Sector12) &&
+ (this.city == __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Aevum || this.city == __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Sector12) &&
this.money.gte(10000000) && this.karma <= -90 &&
- this.companyName != __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Sector12CIA && this.companyName != __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Sector12NSA) {
+ this.companyName != __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Sector12CIA && this.companyName != __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Sector12NSA) {
invitedFactions.push(thesyndicateFac);
}
//Silhouette
- var silhouetteFac = __WEBPACK_IMPORTED_MODULE_7__Faction_js__["b" /* Factions */]["Silhouette"];
+ var silhouetteFac = __WEBPACK_IMPORTED_MODULE_8__Faction_js__["b" /* Factions */]["Silhouette"];
if (!silhouetteFac.isBanned && !silhouetteFac.isMember && !silhouetteFac.alreadyInvited &&
(this.companyPosition.positionName == __WEBPACK_IMPORTED_MODULE_2__Company_js__["d" /* CompanyPositions */].CTO.positionName ||
this.companyPosition.positionName == __WEBPACK_IMPORTED_MODULE_2__Company_js__["d" /* CompanyPositions */].CFO.positionName ||
@@ -2313,16 +2321,16 @@ PlayerObject.prototype.checkForFactionInvitations = function() {
}
//Tetrads
- var tetradsFac = __WEBPACK_IMPORTED_MODULE_7__Faction_js__["b" /* Factions */]["Tetrads"];
+ var tetradsFac = __WEBPACK_IMPORTED_MODULE_8__Faction_js__["b" /* Factions */]["Tetrads"];
if (!tetradsFac.isBanned && !tetradsFac.isMember && !tetradsFac.alreadyInvited &&
- (this.city == __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Chongqing || this.city == __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].NewTokyo ||
- this.city == __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Ishima) && this.strength >= 75 && this.defense >= 75 &&
+ (this.city == __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Chongqing || this.city == __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].NewTokyo ||
+ this.city == __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Ishima) && this.strength >= 75 && this.defense >= 75 &&
this.dexterity >= 75 && this.agility >= 75 && this.karma <= -18) {
invitedFactions.push(tetradsFac);
}
//SlumSnakes
- var slumsnakesFac = __WEBPACK_IMPORTED_MODULE_7__Faction_js__["b" /* Factions */]["Slum Snakes"];
+ var slumsnakesFac = __WEBPACK_IMPORTED_MODULE_8__Faction_js__["b" /* Factions */]["Slum Snakes"];
if (!slumsnakesFac.isBanned && !slumsnakesFac.isMember && !slumsnakesFac.alreadyInvited &&
this.strength >= 30 && this.defense >= 30 && this.dexterity >= 30 &&
this.agility >= 30 && this.karma <= -9 && this.money.gte(1000000)) {
@@ -2330,7 +2338,7 @@ PlayerObject.prototype.checkForFactionInvitations = function() {
}
//Netburners
- var netburnersFac = __WEBPACK_IMPORTED_MODULE_7__Faction_js__["b" /* Factions */]["Netburners"];
+ var netburnersFac = __WEBPACK_IMPORTED_MODULE_8__Faction_js__["b" /* Factions */]["Netburners"];
var totalHacknetRam = 0;
var totalHacknetCores = 0;
var totalHacknetLevels = 0;
@@ -2346,17 +2354,17 @@ PlayerObject.prototype.checkForFactionInvitations = function() {
}
//Tian Di Hui
- var tiandihuiFac = __WEBPACK_IMPORTED_MODULE_7__Faction_js__["b" /* Factions */]["Tian Di Hui"];
+ var tiandihuiFac = __WEBPACK_IMPORTED_MODULE_8__Faction_js__["b" /* Factions */]["Tian Di Hui"];
if (!tiandihuiFac.isBanned && !tiandihuiFac.isMember && !tiandihuiFac.alreadyInvited &&
this.money.gte(1000000) && this.hacking_skill >= 50 &&
- (this.city == __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Chongqing || this.city == __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].NewTokyo ||
- this.city == __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Ishima)) {
+ (this.city == __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Chongqing || this.city == __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].NewTokyo ||
+ this.city == __WEBPACK_IMPORTED_MODULE_10__Location_js__["a" /* Locations */].Ishima)) {
invitedFactions.push(tiandihuiFac);
}
//CyberSec
- var cybersecFac = __WEBPACK_IMPORTED_MODULE_7__Faction_js__["b" /* Factions */]["CyberSec"];
- var cybersecServer = __WEBPACK_IMPORTED_MODULE_11__Server_js__["b" /* AllServers */][__WEBPACK_IMPORTED_MODULE_12__SpecialServerIps_js__["a" /* SpecialServerIps */][__WEBPACK_IMPORTED_MODULE_12__SpecialServerIps_js__["b" /* SpecialServerNames */].CyberSecServer]];
+ var cybersecFac = __WEBPACK_IMPORTED_MODULE_8__Faction_js__["b" /* Factions */]["CyberSec"];
+ var cybersecServer = __WEBPACK_IMPORTED_MODULE_12__Server_js__["b" /* AllServers */][__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["a" /* SpecialServerIps */][__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["b" /* SpecialServerNames */].CyberSecServer]];
if (cybersecServer == null) {
console.log("ERROR: Could not find CyberSec Server");
} else if (!cybersecFac.isBanned && !cybersecFac.isMember && cybersecServer.manuallyHacked &&
@@ -2372,11 +2380,11 @@ PlayerObject.prototype.checkForFactionInvitations = function() {
//Returns true if Player is in a gang and false otherwise
PlayerObject.prototype.inGang = function() {
if (this.gang == null || this.gang == undefined) {return false;}
- return (this.gang instanceof __WEBPACK_IMPORTED_MODULE_8__Gang_js__["b" /* Gang */]);
+ return (this.gang instanceof __WEBPACK_IMPORTED_MODULE_9__Gang_js__["b" /* Gang */]);
}
PlayerObject.prototype.startGang = function(factionName, hacking) {
- this.gang = new __WEBPACK_IMPORTED_MODULE_8__Gang_js__["b" /* Gang */](factionName, hacking);
+ this.gang = new __WEBPACK_IMPORTED_MODULE_9__Gang_js__["b" /* Gang */](factionName, hacking);
}
/************* BitNodes **************/
@@ -2386,23 +2394,37 @@ PlayerObject.prototype.setBitNodeNumber = function(n) {
/* Functions for saving and loading the Player data */
function loadPlayer(saveString) {
- Player = JSON.parse(saveString, __WEBPACK_IMPORTED_MODULE_18__utils_JSONReviver_js__["c" /* Reviver */]);
+ Player = JSON.parse(saveString, __WEBPACK_IMPORTED_MODULE_19__utils_JSONReviver_js__["c" /* Reviver */]);
//Parse Decimal.js objects
- Player.money = new __WEBPACK_IMPORTED_MODULE_14__utils_decimal_js___default.a(Player.money);
- Player.total_money = new __WEBPACK_IMPORTED_MODULE_14__utils_decimal_js___default.a(Player.total_money);
- Player.lifetime_money = new __WEBPACK_IMPORTED_MODULE_14__utils_decimal_js___default.a(Player.lifetime_money);
+ Player.money = new __WEBPACK_IMPORTED_MODULE_15__utils_decimal_js___default.a(Player.money);
+ Player.total_money = new __WEBPACK_IMPORTED_MODULE_15__utils_decimal_js___default.a(Player.total_money);
+ Player.lifetime_money = new __WEBPACK_IMPORTED_MODULE_15__utils_decimal_js___default.a(Player.lifetime_money);
+
+ if (Player.corporation instanceof __WEBPACK_IMPORTED_MODULE_4__CompanyManagement_js__["a" /* Corporation */]) {
+ Player.corporation.funds = new __WEBPACK_IMPORTED_MODULE_15__utils_decimal_js___default.a(Player.corporation.funds);
+ Player.corporation.revenue = new __WEBPACK_IMPORTED_MODULE_15__utils_decimal_js___default.a(Player.corporation.revenue);
+ Player.corporation.expenses = new __WEBPACK_IMPORTED_MODULE_15__utils_decimal_js___default.a(Player.corporation.expenses);
+
+ for (var i = 0; i < Player.corporation.divisions.length; ++i) {
+ var ind = Player.corporation.divisions[i];
+ ind.lastCycleRevenue = new __WEBPACK_IMPORTED_MODULE_15__utils_decimal_js___default.a(ind.lastCycleRevenue);
+ ind.lastCycleExpenses = new __WEBPACK_IMPORTED_MODULE_15__utils_decimal_js___default.a(ind.lastCycleExpenses);
+ ind.thisCycleRevenue = new __WEBPACK_IMPORTED_MODULE_15__utils_decimal_js___default.a(ind.thisCycleRevenue);
+ ind.thisCycleExpenses = new __WEBPACK_IMPORTED_MODULE_15__utils_decimal_js___default.a(ind.thisCycleExpenses);
+ }
+ }
}
PlayerObject.prototype.toJSON = function() {
- return Object(__WEBPACK_IMPORTED_MODULE_18__utils_JSONReviver_js__["b" /* Generic_toJSON */])("PlayerObject", this);
+ return Object(__WEBPACK_IMPORTED_MODULE_19__utils_JSONReviver_js__["b" /* Generic_toJSON */])("PlayerObject", this);
}
PlayerObject.fromJSON = function(value) {
- return Object(__WEBPACK_IMPORTED_MODULE_18__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(PlayerObject, value.data);
+ return Object(__WEBPACK_IMPORTED_MODULE_19__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(PlayerObject, value.data);
}
-__WEBPACK_IMPORTED_MODULE_18__utils_JSONReviver_js__["c" /* Reviver */].constructors.PlayerObject = PlayerObject;
+__WEBPACK_IMPORTED_MODULE_19__utils_JSONReviver_js__["c" /* Reviver */].constructors.PlayerObject = PlayerObject;
let Player = new PlayerObject();
@@ -2490,14 +2512,21 @@ function dialogBoxCreate(txt) {
/* unused harmony export sizeOfObject */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return addOffset; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return clearEventListeners; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return getRandomInt; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return compareArrays; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return printArray; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return powerOfTwo; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return getRandomInt; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return compareArrays; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return printArray; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return powerOfTwo; });
/* unused harmony export clearEventListenersEl */
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return removeElementById; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return removeElementById; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return createElement; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return createAccordionElement; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return removeChildrenFromElement; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return createPopup; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return clearSelector; });
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__StringHelperFunctions_js__ = __webpack_require__(4);
//General helper functions
+
//Returns the size (number of keys) of an object
function sizeOfObject(obj) {
var size = 0, key;
@@ -2544,6 +2573,115 @@ function removeElementById(id) {
elem.parentNode.removeChild(elem);
}
+function removeChildrenFromElement(el) {
+ if (Object(__WEBPACK_IMPORTED_MODULE_0__StringHelperFunctions_js__["f" /* isString */])(el)) {
+ el = document.getElementById(el);
+ }
+ if (el == null) {return;}
+ if (el instanceof Element) {
+ while(el.firstChild) {
+ el.removeChild(el.firstChild);
+ }
+ }
+}
+
+function createElement(type, params) {
+ var el = document.createElement(type);
+ if (params.id) {el.id = params.id;}
+ if (params.class) {el.className = params.class;}
+ if (params.innerHTML) {el.innerHTML = params.innerHTML;}
+ if (params.innerText) {el.innerText = params.innerText;}
+ if (params.value) {el.value = params.value;}
+ if (params.text) {el.text = params.text;}
+ if (params.display) {el.style.display = params.display;}
+ if (params.visibility) {el.style.visibility = params.visibility;}
+ if (params.margin) {el.style.margin = params.margin;}
+ if (params.padding) {el.style.padding = params.padding;}
+ if (params.color) {el.style.color = params.color;}
+ if (params.border) {el.style.border = params.border;}
+ if (params.float) {el.style.cssFloat = params.float;}
+ if (params.backgroundColor) {
+ el.style.backgroundColor = params.backgroundColor
+ }
+ if (params.position) {el.style.position = params.position;}
+ if (params.type) {el.type = params.type;}
+ if (params.checked) {el.checked = params.checked;}
+ if (params.for) {el.htmlFor = params.for;}
+ if (params.pattern) {el.pattern = params.pattern;}
+ if (params.maxLength) {el.maxLength = params.maxLength;}
+ if (params.placeholder) {el.placeholder = params.placeholder;}
+ if (params.tooltip) {
+ el.className += " tooltip";
+ el.appendChild(createElement("span", {
+ class:"tooltiptext",
+ innerHTML:params.tooltip
+ }));
+ }
+ if (params.clickListener) {
+ el.addEventListener("click", params.clickListener);
+ }
+ if (params.inputListener) {
+ el.addEventListener("input", params.inputListener);
+ }
+ if (params.changeListener) {
+ el.addEventListener("change", params.changeListener);
+ }
+ return el;
+}
+
+function createPopup(id, elems) {
+ var container = createElement("div", {
+ class:"popup-box-container",
+ id:id,
+ display:"block"
+ }),
+ content = createElement("div", {
+ class:"popup-box-content",
+ });
+
+ for (var i = 0; i < elems.length; ++i) {
+ content.appendChild(elems[i]);
+ }
+ container.appendChild(content);
+ document.getElementById("entire-game-container").appendChild(container);
+}
+
+//Creates both the header and panel element of an accordion and sets the click handler
+//Returns the 'li' element that contains the hedaer and panel
+function createAccordionElement(params) {
+ var li = document.createElement("li"),
+ hdr = document.createElement("button"),
+ panel = document.createElement("div");
+ hdr.classList.add("accordion-header");
+ panel.classList.add("accordion-panel");
+
+ if (params.id) {
+ hdr.id = params.id + "-hdr";
+ panel.id = params.id + "-panel";
+ }
+ if (params.hdrText) {hdr.innerHTML = params.hdrText;}
+ if (params.panelText) {panel.innerHTML = params.panelText;}
+ li.appendChild(hdr);
+ li.appendChild(panel);
+ //Click handler
+ hdr.onclick = function() {
+ this.classList.toggle("active");
+ var tmpPanel = this.nextElementSibling;
+ if (tmpPanel.style.display === "block") {
+ tmpPanel.style.display = "none";
+ } else {
+ tmpPanel.style.display = "block";
+ }
+ }
+ return li;
+}
+
+function clearSelector(selector) {
+ for (var i = selector.options.length - 1; i >= 0; --i) {
+ selector.remove(i);
+ }
+}
+
function getRandomInt(min, max) {
if (min > max) {return getRandomInt(max, min);}
return Math.floor(Math.random() * (max - min + 1)) + min;
@@ -2582,7 +2720,7 @@ function powerOfTwo(n) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CONSTANTS; });
let CONSTANTS = {
- Version: "0.32.1",
+ Version: "0.33.0",
//Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience
//and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then
@@ -2709,7 +2847,7 @@ let CONSTANTS = {
//Hacking Missions
HackingMissionRepToDiffConversion: 10000, //Faction rep is divided by this to get mission difficulty
HackingMissionRepToRewardConversion: 7, //Faction rep divided byt his to get mission rep reward
- HackingMissionSpamTimeIncrease: 15000, //How much time limit increase is gained when conquering a Spam Node (ms)
+ HackingMissionSpamTimeIncrease: 25000, //How much time limit increase is gained when conquering a Spam Node (ms)
HackingMissionTransferAttackIncrease: 1.05, //Multiplier by which the attack for all Core Nodes is increased when conquering a Transfer Node
HackingMissionMiscDefenseIncrease: 1.05, //The amount by which every misc node's defense is multiplied when one is conquered
HackingMissionDifficultyToHacking: 150, //Difficulty is multiplied by this to determine enemy's "hacking" level (to determine effects of scan/attack, etc)
@@ -3350,28 +3488,28 @@ let CONSTANTS = {
"must be the number of shares to purchase.
" +
"If the player does not have enough money to purchase specified number of shares, then no shares will be purchased (it will not purchase the most you can afford). " +
"Remember that every transaction on the stock exchange costs a certain commission fee.
" +
- "The function will return true if it successfully purchases the specified number of shares of stock, and false otherwise.
" +
+ "If this function successfully purchases the shares, it will return the stock price at which each share was purchased. Otherwise, it will return 0.
" +
"sellStock(sym, shares)
Attempts to sell shares of a stock using a Market Order. The first argument must be a string with the stock's symbol. The second argument " +
"must be the number of shares to sell.
" +
"If the specified number of shares in the function exceeds the amount that the player actually owns, then this function will sell all owned shares. " +
"Remember that every transaction on the stock exchange costs a certain commission fee.
" +
"The net profit made from selling stocks with this function is reflected in the script's statistics. This net profit is calculated as:
" +
"shares * (sell price - average price of purchased shares)
" +
- "This function will return true if the shares of stock are successfully sold and false otherwise.
" +
+ "If the sale is successful, this function will return the stock price at which each share was sold. Otherwise, it will return 0.
" +
"shortStock(sym, shares)
" +
"Attempts to purchase a short position of a stock using a Market Order. The first argument must be a string with the stock's symbol. The second argument " +
"must be the number of shares to purchase.
" +
"In order to use this function the player must be in BitNode-8 or must have Level 2 of Source-File 8.
" +
"If the player does not have enough money to purchase the specified number of shares, then no shares will be purchased. Remember that every " +
"every transaction on the stock exchange costs a certain commission fee.
" +
- "Returns true if it successfully shorts the stock with the specified number of shares, and false otherwise.
" +
+ "If the purchase is successful, this function will return the stock price at which each share was purchased. Otherwise, it will return 0.
" +
"sellShort(sym, shares)
" +
"Attempts to sell a short position of a stock using a Market Order. The first argument must be a string with the stock's symbol. The second argument must be the " +
"number of shares to sell.
" +
"In order to use this function the player must be in BitNode-8 or must have Level 2 of Source-File 8.
" +
"If the specified number of shares exceeds the amount that the player actually owns, then this function will sell all owned shares. " +
"Remember that every transaction on the stock exchange costs a certain commission fee.
" +
- "This function returns true if it successfully sells any number of shares, and false otherwise.
" +
+ "If the sale was successful, this function will return the stock price at which each sale was sold. Otherwise, it will return 0.
" +
"placeOrder(sym, shares, price, type, pos)
" +
"Places an order on the stock market. This function only works for Limit and Stop Orders. Use the buyStock/sellStock/shortStock/sellShort functions " +
"to place Market Orders. In order to use this function the player must be in BitNode-8 or must have Level 3 of Source-File 8.
" +
@@ -3695,18 +3833,18 @@ let CONSTANTS = {
"World Stock Exchange account and TIX API Access
",
LatestUpdate:
- "v0.32.1
" +
- "-Updated Netscript's 'interpreter/engine' to use the Bluebird promise library instead of native promises. " +
- "It should now be faster and more memory-efficient. If this has broken any Netscript features please report it through Github or the subreddit (reddit.com/r/bitburner)
" +
- "-Rebalanced stock market (adjusted parameters such as the volatility/trends/starting price of certain stocks)
" +
- "-Added prompt() Netscript function
" +
- "-Added 'Buy Max' and 'Sell All' functions to Stock Market UI
" +
- "-Added 'Portfolio' Mode to Stock Market UI so you can only view stocks you have a position/order in
" +
- "-Added a button to kill a script from its log display box
" +
- "v0.32.0
" +
- "-Released BitNode-8: Ghost of Wall Street
" +
- "-Re-designed Stock Market UI
" +
- "-Minor bugfixes
"
+ "v0.34.0
" +
+ "-Slightly increased experience gain from Infiltration
" +
+ "-buyStock(), sellStock(), shortStock(), and sellShort() Netscript function now return the stock price at which the transaction occurred, rather than a boolean. " +
+ "If the function fails for some reason, 0 will be returned.
" +
+ "-Hacking Mission Changes:
" +
+ "---Shield and Firewall Nodes can now fortify
" +
+ "---The effects of Fortifying are now ~30% lower
" +
+ "---Conquering a Spam Node now increases your time limit by 25 secs instead of 15
" +
+ "---Damage dealt by Attacking was slightly reduced
" +
+ "---The effect of Scanning was slightly reduced
" +
+ ""
+
}
@@ -3880,39 +4018,41 @@ function isHTML(str) {
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Engine", function() { return Engine; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_DialogBox_js__ = __webpack_require__(1);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils_GameOptions_js__ = __webpack_require__(40);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils_GameOptions_js__ = __webpack_require__(41);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__ = __webpack_require__(2);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js__ = __webpack_require__(18);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js__ = __webpack_require__(17);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_LogBox_js__ = __webpack_require__(30);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__ActiveScriptsUI_js__ = __webpack_require__(25);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__ActiveScriptsUI_js__ = __webpack_require__(26);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Augmentations_js__ = __webpack_require__(20);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__BitNode_js__ = __webpack_require__(7);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__BitNode_js__ = __webpack_require__(8);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__Company_js__ = __webpack_require__(21);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__Constants_js__ = __webpack_require__(3);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__CreateProgram_js__ = __webpack_require__(15);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__Faction_js__ = __webpack_require__(10);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__Location_js__ = __webpack_require__(13);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__Gang_js__ = __webpack_require__(34);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__HacknetNode_js__ = __webpack_require__(39);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__InteractiveTutorial_js__ = __webpack_require__(27);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__Literature_js__ = __webpack_require__(46);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__Message_js__ = __webpack_require__(24);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__Missions_js__ = __webpack_require__(26);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__NetscriptFunctions_js__ = __webpack_require__(19);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__NetscriptWorker_js__ = __webpack_require__(11);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_23__Prestige_js__ = __webpack_require__(36);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_24__RedPill_js__ = __webpack_require__(37);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_25__SaveObject_js__ = __webpack_require__(75);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_26__Script_js__ = __webpack_require__(16);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_27__Server_js__ = __webpack_require__(6);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_28__Settings_js__ = __webpack_require__(14);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_29__SourceFile_js__ = __webpack_require__(35);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_30__SpecialServerIps_js__ = __webpack_require__(12);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_31__StockMarket_js__ = __webpack_require__(29);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_32__Terminal_js__ = __webpack_require__(23);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__CompanyManagement_js__ = __webpack_require__(31);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__Constants_js__ = __webpack_require__(3);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__CreateProgram_js__ = __webpack_require__(15);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__Faction_js__ = __webpack_require__(11);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__Location_js__ = __webpack_require__(12);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__Gang_js__ = __webpack_require__(40);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__HacknetNode_js__ = __webpack_require__(39);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__InteractiveTutorial_js__ = __webpack_require__(27);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__Literature_js__ = __webpack_require__(47);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__Message_js__ = __webpack_require__(25);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__Missions_js__ = __webpack_require__(28);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__NetscriptFunctions_js__ = __webpack_require__(22);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__NetscriptWorker_js__ = __webpack_require__(10);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_23__Player_js__ = __webpack_require__(0);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_24__Prestige_js__ = __webpack_require__(35);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_25__RedPill_js__ = __webpack_require__(34);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_26__SaveObject_js__ = __webpack_require__(76);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_27__Script_js__ = __webpack_require__(18);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_28__Server_js__ = __webpack_require__(6);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_29__Settings_js__ = __webpack_require__(16);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_30__SourceFile_js__ = __webpack_require__(36);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_31__SpecialServerIps_js__ = __webpack_require__(13);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_32__StockMarket_js__ = __webpack_require__(29);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_33__Terminal_js__ = __webpack_require__(23);
+
@@ -3966,7 +4106,7 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
* Alt-o - Options
*/
$(document).keydown(function(e) {
- if (!__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].isWorking && !__WEBPACK_IMPORTED_MODULE_24__RedPill_js__["b" /* redPillFlag */] && !__WEBPACK_IMPORTED_MODULE_19__Missions_js__["c" /* inMission */]) {
+ if (!__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].isWorking && !__WEBPACK_IMPORTED_MODULE_25__RedPill_js__["b" /* redPillFlag */] && !__WEBPACK_IMPORTED_MODULE_20__Missions_js__["c" /* inMission */]) {
if (e.keyCode == 84 && e.altKey) {
e.preventDefault();
Engine.loadTerminalContent();
@@ -4100,6 +4240,7 @@ let Engine = {
StockMarket: "StockMarket",
Gang: "Gang",
Mission: "Mission",
+ Corporation: "Corporation",
},
currentPage: null,
@@ -4134,7 +4275,7 @@ let Engine = {
editor.setValue(code);
}
editor.focus();
- Object(__WEBPACK_IMPORTED_MODULE_26__Script_js__["f" /* updateScriptEditorContent */])();
+ Object(__WEBPACK_IMPORTED_MODULE_27__Script_js__["f" /* updateScriptEditorContent */])();
Engine.currentPage = Engine.Page.ScriptEditor;
document.getElementById("create-script-menu-link").classList.add("active");
},
@@ -4151,7 +4292,7 @@ let Engine = {
loadHacknetNodesContent: function() {
Engine.hideAllContent();
Engine.Display.hacknetNodesContent.style.display = "block";
- Object(__WEBPACK_IMPORTED_MODULE_15__HacknetNode_js__["a" /* displayHacknetNodesContent */])();
+ Object(__WEBPACK_IMPORTED_MODULE_16__HacknetNode_js__["a" /* displayHacknetNodesContent */])();
Engine.currentPage = Engine.Page.HacknetNodes;
document.getElementById("hacknet-nodes-menu-link").classList.add("active");
},
@@ -4167,7 +4308,7 @@ let Engine = {
loadCreateProgramContent: function() {
Engine.hideAllContent();
Engine.Display.createProgramContent.style.display = "block";
- Object(__WEBPACK_IMPORTED_MODULE_11__CreateProgram_js__["b" /* displayCreateProgramContent */])();
+ Object(__WEBPACK_IMPORTED_MODULE_12__CreateProgram_js__["b" /* displayCreateProgramContent */])();
Engine.currentPage = Engine.Page.CreateProgram;
document.getElementById("create-program-menu-link").classList.add("active");
},
@@ -4205,29 +4346,29 @@ let Engine = {
loadLocationContent: function() {
Engine.hideAllContent();
Engine.Display.locationContent.style.display = "block";
- Object(__WEBPACK_IMPORTED_MODULE_13__Location_js__["b" /* displayLocationContent */])();
+ Object(__WEBPACK_IMPORTED_MODULE_14__Location_js__["b" /* displayLocationContent */])();
Engine.currentPage = Engine.Page.Location;
},
loadTravelContent: function() {
- switch(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].city) {
- case __WEBPACK_IMPORTED_MODULE_13__Location_js__["a" /* Locations */].Aevum:
- __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_13__Location_js__["a" /* Locations */].AevumTravelAgency;
+ switch(__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].city) {
+ case __WEBPACK_IMPORTED_MODULE_14__Location_js__["a" /* Locations */].Aevum:
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_14__Location_js__["a" /* Locations */].AevumTravelAgency;
break;
- case __WEBPACK_IMPORTED_MODULE_13__Location_js__["a" /* Locations */].Chongqing:
- __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_13__Location_js__["a" /* Locations */].ChongqingTravelAgency;
+ case __WEBPACK_IMPORTED_MODULE_14__Location_js__["a" /* Locations */].Chongqing:
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_14__Location_js__["a" /* Locations */].ChongqingTravelAgency;
break;
- case __WEBPACK_IMPORTED_MODULE_13__Location_js__["a" /* Locations */].Sector12:
- __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_13__Location_js__["a" /* Locations */].Sector12TravelAgency;
+ case __WEBPACK_IMPORTED_MODULE_14__Location_js__["a" /* Locations */].Sector12:
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_14__Location_js__["a" /* Locations */].Sector12TravelAgency;
break;
- case __WEBPACK_IMPORTED_MODULE_13__Location_js__["a" /* Locations */].NewTokyo:
- __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_13__Location_js__["a" /* Locations */].NewTokyoTravelAgency;
+ case __WEBPACK_IMPORTED_MODULE_14__Location_js__["a" /* Locations */].NewTokyo:
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_14__Location_js__["a" /* Locations */].NewTokyoTravelAgency;
break;
- case __WEBPACK_IMPORTED_MODULE_13__Location_js__["a" /* Locations */].Ishima:
- __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_13__Location_js__["a" /* Locations */].IshimaTravelAgency;
+ case __WEBPACK_IMPORTED_MODULE_14__Location_js__["a" /* Locations */].Ishima:
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_14__Location_js__["a" /* Locations */].IshimaTravelAgency;
break;
- case __WEBPACK_IMPORTED_MODULE_13__Location_js__["a" /* Locations */].Volhaven:
- __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_13__Location_js__["a" /* Locations */].VolhavenTravelAgency;
+ case __WEBPACK_IMPORTED_MODULE_14__Location_js__["a" /* Locations */].Volhaven:
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_14__Location_js__["a" /* Locations */].VolhavenTravelAgency;
break;
default:
Object(__WEBPACK_IMPORTED_MODULE_0__utils_DialogBox_js__["a" /* dialogBoxCreate */])("ERROR: Invalid city. This is a bug please contact game dev");
@@ -4237,12 +4378,12 @@ let Engine = {
},
loadJobContent: function() {
- if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].companyName == "") {
+ if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].companyName == "") {
Object(__WEBPACK_IMPORTED_MODULE_0__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You do not currently have a job! You can visit various companies " +
"in the city and try to find a job.");
return;
}
- __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].companyName;
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].companyName;
Engine.loadLocationContent();
},
@@ -4273,13 +4414,13 @@ let Engine = {
Engine.hideAllContent();
Engine.Display.stockMarketContent.style.display = "block";
Engine.currentPage = Engine.Page.StockMarket;
- Object(__WEBPACK_IMPORTED_MODULE_31__StockMarket_js__["f" /* displayStockMarketContent */])();
+ Object(__WEBPACK_IMPORTED_MODULE_32__StockMarket_js__["f" /* displayStockMarketContent */])();
},
loadGangContent: function() {
Engine.hideAllContent();
- if (document.getElementById("gang-container") || __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].inGang()) {
- Object(__WEBPACK_IMPORTED_MODULE_14__Gang_js__["c" /* displayGangContent */])();
+ if (document.getElementById("gang-container") || __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].inGang()) {
+ Object(__WEBPACK_IMPORTED_MODULE_15__Gang_js__["c" /* displayGangContent */])();
Engine.currentPage = Engine.Page.Gang;
} else {
Engine.loadTerminalContent();
@@ -4295,6 +4436,15 @@ let Engine = {
Engine.currentPage = Engine.Page.Mission;
},
+ loadCorporationContent: function() {
+ if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].corporation instanceof __WEBPACK_IMPORTED_MODULE_10__CompanyManagement_js__["a" /* Corporation */]) {
+ Engine.hideAllContent();
+ document.getElementById("character-overview-wrapper").style.visibility = "hidden";
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].corporation.createUI();
+ Engine.currentPage = Engine.Page.Corporation;
+ }
+ },
+
//Helper function that hides all content
hideAllContent: function() {
Engine.Display.terminalContent.style.display = "none";
@@ -4319,6 +4469,10 @@ let Engine = {
document.getElementById("gang-container").style.display = "none";
}
+ if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].corporation instanceof __WEBPACK_IMPORTED_MODULE_10__CompanyManagement_js__["a" /* Corporation */]) {
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].corporation.clearUI();
+ }
+
//Location lists
Engine.aevumLocationsList.style.display = "none";
Engine.chongqingLocationsList.style.display = "none";
@@ -4342,29 +4496,29 @@ let Engine = {
},
displayCharacterOverviewInfo: function() {
- if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hp == null) {__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hp = __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].max_hp;}
- if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].intelligence >= 1) {
+ if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].hp == null) {__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].hp = __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].max_hp;}
+ if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].intelligence >= 1) {
document.getElementById("character-overview-text").innerHTML =
- ("Hp: " + __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hp + " / " + __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].max_hp + "
" +
- "Money: " + __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].money.toNumber()).format('($0.000a)') + "
" +
- "Hack: " + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hacking_skill).toLocaleString() + "
" +
- "Str: " + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].strength).toLocaleString() + "
" +
- "Def: " + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].defense).toLocaleString() + "
" +
- "Dex: " + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].dexterity).toLocaleString() + "
" +
- "Agi: " + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].agility).toLocaleString() + "
" +
- "Cha: " + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].charisma).toLocaleString() + "
" +
- "Int: " + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].intelligence).toLocaleString()
+ ("Hp: " + __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].hp + " / " + __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].max_hp + "
" +
+ "Money: " + __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].money.toNumber()).format('($0.000a)') + "
" +
+ "Hack: " + (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].hacking_skill).toLocaleString() + "
" +
+ "Str: " + (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].strength).toLocaleString() + "
" +
+ "Def: " + (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].defense).toLocaleString() + "
" +
+ "Dex: " + (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].dexterity).toLocaleString() + "
" +
+ "Agi: " + (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].agility).toLocaleString() + "
" +
+ "Cha: " + (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].charisma).toLocaleString() + "
" +
+ "Int: " + (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].intelligence).toLocaleString()
).replace( / /g, " " );
} else {
document.getElementById("character-overview-text").innerHTML =
- ("Hp: " + __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hp + " / " + __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].max_hp + "
" +
- "Money: " + __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].money.toNumber()).format('($0.000a)') + "
" +
- "Hack: " + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hacking_skill).toLocaleString() + "
" +
- "Str: " + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].strength).toLocaleString() + "
" +
- "Def: " + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].defense).toLocaleString() + "
" +
- "Dex: " + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].dexterity).toLocaleString() + "
" +
- "Agi: " + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].agility).toLocaleString() + "
" +
- "Cha: " + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].charisma).toLocaleString()
+ ("Hp: " + __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].hp + " / " + __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].max_hp + "
" +
+ "Money: " + __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].money.toNumber()).format('($0.000a)') + "
" +
+ "Hack: " + (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].hacking_skill).toLocaleString() + "
" +
+ "Str: " + (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].strength).toLocaleString() + "
" +
+ "Def: " + (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].defense).toLocaleString() + "
" +
+ "Dex: " + (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].dexterity).toLocaleString() + "
" +
+ "Agi: " + (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].agility).toLocaleString() + "
" +
+ "Cha: " + (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].charisma).toLocaleString()
).replace( / /g, " " );
}
},
@@ -4372,72 +4526,72 @@ let Engine = {
/* Display character info */
displayCharacterInfo: function() {
var companyPosition = "";
- if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].companyPosition != "") {
- companyPosition = __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].companyPosition.positionName;
+ if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].companyPosition != "") {
+ companyPosition = __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].companyPosition.positionName;
}
var bnText = "";
- if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].sourceFiles.length !== 0) {
- bnText = "
Current BitNode: " + __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].bitNodeN;
+ if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].sourceFiles.length !== 0) {
+ bnText = "
Current BitNode: " + __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].bitNodeN;
}
var intText = "";
- if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].intelligence > 0) {
- intText = 'Intelligence: ' + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].intelligence).toLocaleString() + "
";
+ if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].intelligence > 0) {
+ intText = 'Intelligence: ' + (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].intelligence).toLocaleString() + "
";
}
Engine.Display.characterInfo.innerHTML =
('General
' +
- 'Current City: ' + __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].city + '
' +
- 'Employer: ' + __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].companyName + '
' +
+ 'Current City: ' + __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].city + '
' +
+ 'Employer: ' + __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].companyName + '
' +
'Job Title: ' + companyPosition + '
' +
- 'Money: $' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].money.toNumber(), 2)+ '
' +
+ 'Money: $' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].money.toNumber(), 2)+ '
' +
'Stats
' +
- 'Hacking Level: ' + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hacking_skill).toLocaleString() +
- " (" + __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hacking_exp).format('(0.000a)') + ' experience)
' +
- 'Strength: ' + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].strength).toLocaleString() +
- " (" + __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].strength_exp).format('(0.000a)') + ' experience)
' +
- 'Defense: ' + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].defense).toLocaleString() +
- " (" + __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].defense_exp).format('(0.000a)')+ ' experience)
' +
- 'Dexterity: ' + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].dexterity).toLocaleString() +
- " (" + __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].dexterity_exp).format('(0.000a)') + ' experience)
' +
- 'Agility: ' + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].agility).toLocaleString() +
- " (" + __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].agility_exp).format('(0.000a)') + ' experience)
' +
- 'Charisma: ' + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].charisma).toLocaleString() +
- " (" + __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].charisma_exp).format('(0.000a)') + ' experience)
' +
+ 'Hacking Level: ' + (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].hacking_skill).toLocaleString() +
+ " (" + __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].hacking_exp).format('(0.000a)') + ' experience)
' +
+ 'Strength: ' + (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].strength).toLocaleString() +
+ " (" + __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].strength_exp).format('(0.000a)') + ' experience)
' +
+ 'Defense: ' + (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].defense).toLocaleString() +
+ " (" + __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].defense_exp).format('(0.000a)')+ ' experience)
' +
+ 'Dexterity: ' + (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].dexterity).toLocaleString() +
+ " (" + __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].dexterity_exp).format('(0.000a)') + ' experience)
' +
+ 'Agility: ' + (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].agility).toLocaleString() +
+ " (" + __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].agility_exp).format('(0.000a)') + ' experience)
' +
+ 'Charisma: ' + (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].charisma).toLocaleString() +
+ " (" + __WEBPACK_IMPORTED_MODULE_3__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].charisma_exp).format('(0.000a)') + ' experience)
' +
intText +
'Multipliers
' +
- 'Hacking Chance multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hacking_chance_mult * 100, 2) + '%
' +
- 'Hacking Speed multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hacking_speed_mult * 100, 2) + '%
' +
- 'Hacking Money multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hacking_money_mult * 100, 2) + '%
' +
- 'Hacking Growth multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hacking_grow_mult * 100, 2) + '%
' +
- 'Hacking Level multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hacking_mult * 100, 2) + '%
' +
- 'Hacking Experience multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hacking_exp_mult * 100, 2) + '%
' +
- 'Strength Level multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].strength_mult * 100, 2) + '%
' +
- 'Strength Experience multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].strength_exp_mult * 100, 2) + '%
' +
- 'Defense Level multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].defense_mult * 100, 2) + '%
' +
- 'Defense Experience multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].defense_exp_mult * 100, 2) + '%
' +
- 'Dexterity Level multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].dexterity_mult * 100, 2) + '%
' +
- 'Dexterity Experience multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].dexterity_exp_mult * 100, 2) + '%
' +
- 'Agility Level multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].agility_mult * 100, 2) + '%
' +
- 'Agility Experience multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].agility_exp_mult * 100, 2) + '%
' +
- 'Charisma Level multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].charisma_mult * 100, 2) + '%
' +
- 'Charisma Experience multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].charisma_exp_mult * 100, 2) + '%
' +
- 'Hacknet Node production multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hacknet_node_money_mult * 100, 2) + '%
' +
- 'Hacknet Node purchase cost multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hacknet_node_purchase_cost_mult * 100, 2) + '%
' +
- 'Hacknet Node RAM upgrade cost multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hacknet_node_ram_cost_mult * 100, 2) + '%
' +
- 'Hacknet Node Core purchase cost multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hacknet_node_core_cost_mult * 100, 2) + '%
' +
- 'Hacknet Node level upgrade cost multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hacknet_node_level_cost_mult * 100, 2) + '%
' +
- 'Company reputation gain multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].company_rep_mult * 100, 2) + '%
' +
- 'Faction reputation gain multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].faction_rep_mult * 100, 2) + '%
' +
- 'Salary multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].work_money_mult * 100, 2) + '%
' +
- 'Crime success multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].crime_success_mult * 100, 2) + '%
' +
- 'Crime money multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].crime_money_mult * 100, 2) + '%
' +
+ 'Hacking Chance multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].hacking_chance_mult * 100, 2) + '%
' +
+ 'Hacking Speed multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].hacking_speed_mult * 100, 2) + '%
' +
+ 'Hacking Money multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].hacking_money_mult * 100, 2) + '%
' +
+ 'Hacking Growth multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].hacking_grow_mult * 100, 2) + '%
' +
+ 'Hacking Level multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].hacking_mult * 100, 2) + '%
' +
+ 'Hacking Experience multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].hacking_exp_mult * 100, 2) + '%
' +
+ 'Strength Level multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].strength_mult * 100, 2) + '%
' +
+ 'Strength Experience multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].strength_exp_mult * 100, 2) + '%
' +
+ 'Defense Level multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].defense_mult * 100, 2) + '%
' +
+ 'Defense Experience multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].defense_exp_mult * 100, 2) + '%
' +
+ 'Dexterity Level multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].dexterity_mult * 100, 2) + '%
' +
+ 'Dexterity Experience multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].dexterity_exp_mult * 100, 2) + '%
' +
+ 'Agility Level multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].agility_mult * 100, 2) + '%
' +
+ 'Agility Experience multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].agility_exp_mult * 100, 2) + '%
' +
+ 'Charisma Level multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].charisma_mult * 100, 2) + '%
' +
+ 'Charisma Experience multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].charisma_exp_mult * 100, 2) + '%
' +
+ 'Hacknet Node production multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].hacknet_node_money_mult * 100, 2) + '%
' +
+ 'Hacknet Node purchase cost multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].hacknet_node_purchase_cost_mult * 100, 2) + '%
' +
+ 'Hacknet Node RAM upgrade cost multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].hacknet_node_ram_cost_mult * 100, 2) + '%
' +
+ 'Hacknet Node Core purchase cost multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].hacknet_node_core_cost_mult * 100, 2) + '%
' +
+ 'Hacknet Node level upgrade cost multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].hacknet_node_level_cost_mult * 100, 2) + '%
' +
+ 'Company reputation gain multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].company_rep_mult * 100, 2) + '%
' +
+ 'Faction reputation gain multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].faction_rep_mult * 100, 2) + '%
' +
+ 'Salary multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].work_money_mult * 100, 2) + '%
' +
+ 'Crime success multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].crime_success_mult * 100, 2) + '%
' +
+ 'Crime money multiplier: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].crime_money_mult * 100, 2) + '%
' +
'Misc
' +
- 'Servers owned: ' + __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].purchasedServers.length + '
' +
- 'Hacknet Nodes owned: ' + __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hacknetNodes.length + '
' +
- 'Augmentations installed: ' + __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].augmentations.length + '
' +
- 'Time played since last Augmentation: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].playtimeSinceLastAug) + '
' +
- 'Time played: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].totalPlaytime) +
+ 'Servers owned: ' + __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].purchasedServers.length + '
' +
+ 'Hacknet Nodes owned: ' + __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].hacknetNodes.length + '
' +
+ 'Augmentations installed: ' + __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].augmentations.length + '
' +
+ 'Time played since last Augmentation: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].playtimeSinceLastAug) + '
' +
+ 'Time played: ' + Object(__WEBPACK_IMPORTED_MODULE_4__utils_StringHelperFunctions_js__["b" /* convertTimeMsToTimeElapsedString */])(__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].totalPlaytime) +
bnText + '
').replace( / /g, " " );
},
@@ -4457,25 +4611,32 @@ let Engine = {
Engine.ishimaLocationsList.style.display = "none";
Engine.volhavenLocationsList.style.display = "none";
- document.getElementById("world-city-name").innerHTML = __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].city;
+ document.getElementById("world-city-name").innerHTML = __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].city;
var cityDesc = document.getElementById("world-city-desc"); //TODO
- switch(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].city) {
- case __WEBPACK_IMPORTED_MODULE_13__Location_js__["a" /* Locations */].Aevum:
+ switch(__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].city) {
+ case __WEBPACK_IMPORTED_MODULE_14__Location_js__["a" /* Locations */].Aevum:
Engine.aevumLocationsList.style.display = "inline";
break;
- case __WEBPACK_IMPORTED_MODULE_13__Location_js__["a" /* Locations */].Chongqing:
+ case __WEBPACK_IMPORTED_MODULE_14__Location_js__["a" /* Locations */].Chongqing:
Engine.chongqingLocationsList.style.display = "inline";
break;
- case __WEBPACK_IMPORTED_MODULE_13__Location_js__["a" /* Locations */].Sector12:
+ case __WEBPACK_IMPORTED_MODULE_14__Location_js__["a" /* Locations */].Sector12:
Engine.sector12LocationsList.style.display = "inline";
+
+ //City hall only in BitNode-3
+ if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].bitNodeN === 3) {
+ document.getElementById("sector12-cityhall-li").style.display = "block";
+ } else {
+ document.getElementById("sector12-cityhall-li").style.display = "none";
+ }
break;
- case __WEBPACK_IMPORTED_MODULE_13__Location_js__["a" /* Locations */].NewTokyo:
+ case __WEBPACK_IMPORTED_MODULE_14__Location_js__["a" /* Locations */].NewTokyo:
Engine.newTokyoLocationsList.style.display = "inline";
break;
- case __WEBPACK_IMPORTED_MODULE_13__Location_js__["a" /* Locations */].Ishima:
+ case __WEBPACK_IMPORTED_MODULE_14__Location_js__["a" /* Locations */].Ishima:
Engine.ishimaLocationsList.style.display = "inline";
break;
- case __WEBPACK_IMPORTED_MODULE_13__Location_js__["a" /* Locations */].Volhaven:
+ case __WEBPACK_IMPORTED_MODULE_14__Location_js__["a" /* Locations */].Volhaven:
Engine.volhavenLocationsList.style.display = "inline";
break;
default:
@@ -4483,7 +4644,20 @@ let Engine = {
break;
}
- document.getElementById("generic-locations-list").style.display = "inline";
+ var genericLocationsList = document.getElementById("generic-locations-list");
+ genericLocationsList.style.display = "inline";
+ if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].corporation instanceof __WEBPACK_IMPORTED_MODULE_10__CompanyManagement_js__["a" /* Corporation */] && document.getElementById("location-corporation-button") == null) {
+ var li = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["f" /* createElement */])("li", {});
+ li.appendChild(Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ innerText:__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].corporation.name, id:"location-corporation-button",
+ class:"a-link-button",
+ clickListener:()=>{
+ Engine.loadCorporationContent();
+ return false;
+ }
+ }));
+ genericLocationsList.appendChild(li);
+ }
},
displayFactionsInfo: function() {
@@ -4494,9 +4668,9 @@ let Engine = {
}
//Re-add a link for each faction you are a member of
- for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].factions.length; ++i) {
+ for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].factions.length; ++i) {
(function () {
- var factionName = __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].factions[i];
+ var factionName = __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].factions[i];
//Add the faction to the Factions page content
var item = document.createElement("li");
@@ -4505,7 +4679,7 @@ let Engine = {
aElem.innerHTML = factionName;
aElem.addEventListener("click", function() {
Engine.loadFactionContent();
- Object(__WEBPACK_IMPORTED_MODULE_12__Faction_js__["c" /* displayFactionContent */])(factionName);
+ Object(__WEBPACK_IMPORTED_MODULE_13__Faction_js__["c" /* displayFactionContent */])(factionName);
return false;
});
item.appendChild(aElem);
@@ -4520,9 +4694,9 @@ let Engine = {
}
//Add a link to accept for each faction you have invitiations for
- for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].factionInvitations.length; ++i) {
+ for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].factionInvitations.length; ++i) {
(function () {
- var factionName = __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].factionInvitations[i];
+ var factionName = __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].factionInvitations[i];
var item = document.createElement("li");
@@ -4539,10 +4713,10 @@ let Engine = {
aElem.style.margin = "4px";
aElem.style.padding = "4px";
aElem.addEventListener("click", function() {
- Object(__WEBPACK_IMPORTED_MODULE_12__Faction_js__["h" /* joinFaction */])(__WEBPACK_IMPORTED_MODULE_12__Faction_js__["b" /* Factions */][factionName]);
- for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].factionInvitations.length; ++i) {
- if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].factionInvitations[i] == factionName) {
- __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].factionInvitations.splice(i, 1);
+ Object(__WEBPACK_IMPORTED_MODULE_13__Faction_js__["h" /* joinFaction */])(__WEBPACK_IMPORTED_MODULE_13__Faction_js__["b" /* Factions */][factionName]);
+ for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].factionInvitations.length; ++i) {
+ if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].factionInvitations[i] == factionName) {
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].factionInvitations.splice(i, 1);
break;
}
}
@@ -4567,8 +4741,8 @@ let Engine = {
queuedAugmentationsList.removeChild(queuedAugmentationsList.firstChild);
}
- for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].queuedAugmentations.length; ++i) {
- var augName = __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].queuedAugmentations[i].name;
+ for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].queuedAugmentations.length; ++i) {
+ var augName = __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].queuedAugmentations[i].name;
var aug = __WEBPACK_IMPORTED_MODULE_7__Augmentations_js__["c" /* Augmentations */][augName];
var item = document.createElement("li");
@@ -4578,7 +4752,7 @@ let Engine = {
item.setAttribute("class", "installed-augmentation");
hElem.innerHTML = augName;
if (augName == __WEBPACK_IMPORTED_MODULE_7__Augmentations_js__["b" /* AugmentationNames */].NeuroFluxGovernor) {
- hElem.innerHTML += " - Level " + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].queuedAugmentations[i].level);
+ hElem.innerHTML += " - Level " + (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].queuedAugmentations[i].level);
}
pElem.innerHTML = aug.info;
@@ -4603,11 +4777,11 @@ let Engine = {
}
//Source Files - Temporary...Will probably put in a separate pane Later
- for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].sourceFiles.length; ++i) {
- var srcFileKey = "SourceFile" + __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].sourceFiles[i].n;
- var sourceFileObject = __WEBPACK_IMPORTED_MODULE_29__SourceFile_js__["b" /* SourceFiles */][srcFileKey];
+ for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].sourceFiles.length; ++i) {
+ var srcFileKey = "SourceFile" + __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].sourceFiles[i].n;
+ var sourceFileObject = __WEBPACK_IMPORTED_MODULE_30__SourceFile_js__["b" /* SourceFiles */][srcFileKey];
if (sourceFileObject == null) {
- console.log("ERROR: Invalid source file number: " + __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].sourceFiles[i].n);
+ console.log("ERROR: Invalid source file number: " + __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].sourceFiles[i].n);
continue;
}
var item = document.createElement("li");
@@ -4616,7 +4790,7 @@ let Engine = {
item.setAttribute("class", "installed-augmentation");
hElem.innerHTML = sourceFileObject.name + "
";
- hElem.innerHTML += "Level " + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].sourceFiles[i].lvl) + " / 3";
+ hElem.innerHTML += "Level " + (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].sourceFiles[i].lvl) + " / 3";
pElem.innerHTML = sourceFileObject.info;
item.appendChild(hElem);
@@ -4625,8 +4799,8 @@ let Engine = {
augmentationsList.appendChild(item);
}
- for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].augmentations.length; ++i) {
- var augName = __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].augmentations[i].name;
+ for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].augmentations.length; ++i) {
+ var augName = __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].augmentations[i].name;
var aug = __WEBPACK_IMPORTED_MODULE_7__Augmentations_js__["c" /* Augmentations */][augName];
var item = document.createElement("li");
@@ -4636,7 +4810,7 @@ let Engine = {
item.setAttribute("class", "installed-augmentation");
hElem.innerHTML = augName;
if (augName == __WEBPACK_IMPORTED_MODULE_7__Augmentations_js__["b" /* AugmentationNames */].NeuroFluxGovernor) {
- hElem.innerHTML += " - Level " + (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].augmentations[i].level);
+ hElem.innerHTML += " - Level " + (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].augmentations[i].level);
}
pElem.innerHTML = aug.info;
@@ -4694,7 +4868,7 @@ let Engine = {
if (diff > 0) {
//Update the game engine by the calculated number of cycles
Engine._lastUpdate = _thisUpdate - offset;
- __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].lastUpdate = _thisUpdate - offset;
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].lastUpdate = _thisUpdate - offset;
Engine.updateGame(diff);
}
@@ -4704,47 +4878,52 @@ let Engine = {
updateGame: function(numCycles = 1) {
//Update total playtime
var time = numCycles * Engine._idleSpeed;
- if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].totalPlaytime == null) {__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].totalPlaytime = 0;}
- if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].playtimeSinceLastAug == null) {__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].playtimeSinceLastAug = 0;}
- __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].totalPlaytime += time;
- __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].playtimeSinceLastAug += time;
+ if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].totalPlaytime == null) {__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].totalPlaytime = 0;}
+ if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].playtimeSinceLastAug == null) {__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].playtimeSinceLastAug = 0;}
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].totalPlaytime += time;
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].playtimeSinceLastAug += time;
//Start Manual hack
- if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].startAction == true) {
- Engine._totalActionTime = __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].actionTime;
- Engine._actionTimeLeft = __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].actionTime;
+ if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].startAction == true) {
+ Engine._totalActionTime = __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].actionTime;
+ Engine._actionTimeLeft = __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].actionTime;
Engine._actionInProgress = true;
Engine._actionProgressBarCount = 1;
Engine._actionProgressStr = "[ ]";
Engine._actionTimeStr = "Time left: ";
- __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].startAction = false;
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].startAction = false;
}
//Working
- if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].isWorking) {
- if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeFaction) {
- __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].workForFaction(numCycles);
- } else if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeCreateProgram) {
- __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].createProgramWork(numCycles);
- } else if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeStudyClass) {
- __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].takeClass(numCycles);
- } else if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeCrime) {
- __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].commitCrime(numCycles);
- } else if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeCompanyPartTime) {
- __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].workPartTime(numCycles);
+ if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].isWorking) {
+ if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_11__Constants_js__["a" /* CONSTANTS */].WorkTypeFaction) {
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].workForFaction(numCycles);
+ } else if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_11__Constants_js__["a" /* CONSTANTS */].WorkTypeCreateProgram) {
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].createProgramWork(numCycles);
+ } else if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_11__Constants_js__["a" /* CONSTANTS */].WorkTypeStudyClass) {
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].takeClass(numCycles);
+ } else if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_11__Constants_js__["a" /* CONSTANTS */].WorkTypeCrime) {
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].commitCrime(numCycles);
+ } else if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_11__Constants_js__["a" /* CONSTANTS */].WorkTypeCompanyPartTime) {
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].workPartTime(numCycles);
} else {
- __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].work(numCycles);
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].work(numCycles);
}
}
//Gang, if applicable
- if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].bitNodeN == 2 && __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].inGang()) {
- __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].gang.process(numCycles);
+ if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].bitNodeN == 2 && __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].inGang()) {
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].gang.process(numCycles);
}
//Mission
- if (__WEBPACK_IMPORTED_MODULE_19__Missions_js__["c" /* inMission */] && __WEBPACK_IMPORTED_MODULE_19__Missions_js__["b" /* currMission */]) {
- __WEBPACK_IMPORTED_MODULE_19__Missions_js__["b" /* currMission */].process(numCycles);
+ if (__WEBPACK_IMPORTED_MODULE_20__Missions_js__["c" /* inMission */] && __WEBPACK_IMPORTED_MODULE_20__Missions_js__["b" /* currMission */]) {
+ __WEBPACK_IMPORTED_MODULE_20__Missions_js__["b" /* currMission */].process(numCycles);
+ }
+
+ //Corporation
+ if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].corporation instanceof __WEBPACK_IMPORTED_MODULE_10__CompanyManagement_js__["a" /* Corporation */]) {
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].corporation.process(numCycles);
}
//Counters
@@ -4757,10 +4936,10 @@ let Engine = {
}
//Update the running time of all active scripts
- Object(__WEBPACK_IMPORTED_MODULE_21__NetscriptWorker_js__["g" /* updateOnlineScriptTimes */])(numCycles);
+ Object(__WEBPACK_IMPORTED_MODULE_22__NetscriptWorker_js__["g" /* updateOnlineScriptTimes */])(numCycles);
//Hacknet Nodes
- Object(__WEBPACK_IMPORTED_MODULE_15__HacknetNode_js__["c" /* processAllHacknetNodeEarnings */])(numCycles);
+ Object(__WEBPACK_IMPORTED_MODULE_16__HacknetNode_js__["c" /* processAllHacknetNodeEarnings */])(numCycles);
},
//Counters for the main event loop. Represent the number of game cycles are required
@@ -4792,12 +4971,12 @@ let Engine = {
//is necessary and then resets the counter
checkCounters: function() {
if (Engine.Counters.autoSaveCounter <= 0) {
- __WEBPACK_IMPORTED_MODULE_25__SaveObject_js__["b" /* saveObject */].saveGame(indexedDb);
+ __WEBPACK_IMPORTED_MODULE_26__SaveObject_js__["b" /* saveObject */].saveGame(indexedDb);
Engine.Counters.autoSaveCounter = 300;
}
if (Engine.Counters.updateSkillLevelsCounter <= 0) {
- __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].updateSkillLevels();
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].updateSkillLevels();
Engine.Counters.updateSkillLevelsCounter = 10;
}
@@ -4806,9 +4985,9 @@ let Engine = {
if (Engine.currentPage == Engine.Page.CharacterInfo) {
Engine.displayCharacterInfo();
} else if (Engine.currentPage == Engine.Page.HacknetNodes) {
- Object(__WEBPACK_IMPORTED_MODULE_15__HacknetNode_js__["e" /* updateHacknetNodesContent */])();
+ Object(__WEBPACK_IMPORTED_MODULE_16__HacknetNode_js__["e" /* updateHacknetNodesContent */])();
} else if (Engine.currentPage == Engine.Page.CreateProgram) {
- Object(__WEBPACK_IMPORTED_MODULE_11__CreateProgram_js__["b" /* displayCreateProgramContent */])();
+ Object(__WEBPACK_IMPORTED_MODULE_12__CreateProgram_js__["b" /* displayCreateProgramContent */])();
}
if (__WEBPACK_IMPORTED_MODULE_5__utils_LogBox_js__["b" /* logBoxOpened */]) {
@@ -4821,19 +5000,21 @@ let Engine = {
if (Engine.Counters.updateDisplaysMed <= 0) {
if (Engine.currentPage == Engine.Page.ActiveScripts) {
Object(__WEBPACK_IMPORTED_MODULE_6__ActiveScriptsUI_js__["d" /* updateActiveScriptsItems */])();
+ } else if (Engine.currentPage === Engine.Page.Corporation) {
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].corporation.updateUIContent();
}
Engine.Counters.updateDisplaysMed = 9;
}
if (Engine.Counters.updateDisplaysLong <= 0) {
if (Engine.currentPage === Engine.Page.Gang) {
- Object(__WEBPACK_IMPORTED_MODULE_14__Gang_js__["f" /* updateGangContent */])();
+ Object(__WEBPACK_IMPORTED_MODULE_15__Gang_js__["f" /* updateGangContent */])();
}
Engine.Counters.updateDisplaysLong = 15;
}
if (Engine.Counters.createProgramNotifications <= 0) {
- var num = Object(__WEBPACK_IMPORTED_MODULE_11__CreateProgram_js__["c" /* getNumAvailableCreateProgram */])();
+ var num = Object(__WEBPACK_IMPORTED_MODULE_12__CreateProgram_js__["c" /* getNumAvailableCreateProgram */])();
var elem = document.getElementById("create-program-notification");
if (num > 0) {
elem.innerHTML = num;
@@ -4846,29 +5027,29 @@ let Engine = {
}
if (Engine.Counters.checkFactionInvitations <= 0) {
- var invitedFactions = __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].checkForFactionInvitations();
+ var invitedFactions = __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].checkForFactionInvitations();
if (invitedFactions.length > 0) {
- if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].firstFacInvRecvd === false) {
- __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].firstFacInvRecvd = true;
+ if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].firstFacInvRecvd === false) {
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].firstFacInvRecvd = true;
document.getElementById("factions-tab").style.display = "list-item";
document.getElementById("character-menu-header").click();
document.getElementById("character-menu-header").click();
}
var randFaction = invitedFactions[Math.floor(Math.random() * invitedFactions.length)];
- Object(__WEBPACK_IMPORTED_MODULE_12__Faction_js__["g" /* inviteToFaction */])(randFaction);
+ Object(__WEBPACK_IMPORTED_MODULE_13__Faction_js__["g" /* inviteToFaction */])(randFaction);
}
Engine.Counters.checkFactionInvitations = 100;
}
if (Engine.Counters.passiveFactionGrowth <= 0) {
var adjustedCycles = Math.floor((600 - Engine.Counters.passiveFactionGrowth));
- Object(__WEBPACK_IMPORTED_MODULE_12__Faction_js__["j" /* processPassiveFactionRepGain */])(adjustedCycles);
+ Object(__WEBPACK_IMPORTED_MODULE_13__Faction_js__["j" /* processPassiveFactionRepGain */])(adjustedCycles);
Engine.Counters.passiveFactionGrowth = 600;
}
if (Engine.Counters.messages <= 0) {
- Object(__WEBPACK_IMPORTED_MODULE_18__Message_js__["c" /* checkForMessagesToSend */])();
+ Object(__WEBPACK_IMPORTED_MODULE_19__Message_js__["c" /* checkForMessagesToSend */])();
if (__WEBPACK_IMPORTED_MODULE_7__Augmentations_js__["c" /* Augmentations */][__WEBPACK_IMPORTED_MODULE_7__Augmentations_js__["b" /* AugmentationNames */].TheRedPill].owned) {
Engine.Counters.messages = 4500; //15 minutes for Red pill message
} else {
@@ -4877,22 +5058,22 @@ let Engine = {
}
if (Engine.Counters.stockTick <= 0) {
- if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hasWseAccount) {
- Object(__WEBPACK_IMPORTED_MODULE_31__StockMarket_js__["q" /* updateStockPrices */])();
+ if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].hasWseAccount) {
+ Object(__WEBPACK_IMPORTED_MODULE_32__StockMarket_js__["q" /* updateStockPrices */])();
}
Engine.Counters.stockTick = 30;
}
if (Engine.Counters.sCr <= 0) {
- if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hasWseAccount) {
- Object(__WEBPACK_IMPORTED_MODULE_31__StockMarket_js__["o" /* stockMarketCycle */])();
+ if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].hasWseAccount) {
+ Object(__WEBPACK_IMPORTED_MODULE_32__StockMarket_js__["o" /* stockMarketCycle */])();
}
Engine.Counters.sCr = 1500;
}
if (Engine.Counters.updateScriptEditorDisplay <= 0) {
if (Engine.currentPage == Engine.Page.ScriptEditor) {
- Object(__WEBPACK_IMPORTED_MODULE_26__Script_js__["f" /* updateScriptEditorContent */])();
+ Object(__WEBPACK_IMPORTED_MODULE_27__Script_js__["f" /* updateScriptEditorContent */])();
}
Engine.Counters.updateScriptEditorDisplay = 5;
}
@@ -4929,7 +5110,7 @@ let Engine = {
//Once percent is 100, the hack is completed
if (percent >= 100) {
Engine._actionInProgress = false;
- __WEBPACK_IMPORTED_MODULE_32__Terminal_js__["a" /* Terminal */].finishAction();
+ __WEBPACK_IMPORTED_MODULE_33__Terminal_js__["a" /* Terminal */].finishAction();
}
},
@@ -5024,68 +5205,68 @@ let Engine = {
var options = document.getElementById("options-tab");
//Load game from save or create new game
- if (Object(__WEBPACK_IMPORTED_MODULE_25__SaveObject_js__["a" /* loadGame */])(saveString)) {
+ if (Object(__WEBPACK_IMPORTED_MODULE_26__SaveObject_js__["a" /* loadGame */])(saveString)) {
console.log("Loaded game from save");
Object(__WEBPACK_IMPORTED_MODULE_8__BitNode_js__["d" /* initBitNodes */])();
Object(__WEBPACK_IMPORTED_MODULE_8__BitNode_js__["c" /* initBitNodeMultipliers */])();
- Object(__WEBPACK_IMPORTED_MODULE_29__SourceFile_js__["d" /* initSourceFiles */])();
+ Object(__WEBPACK_IMPORTED_MODULE_30__SourceFile_js__["d" /* initSourceFiles */])();
Engine.setDisplayElements(); //Sets variables for important DOM elements
Engine.init(); //Initialize buttons, work, etc.
__WEBPACK_IMPORTED_MODULE_9__Company_js__["d" /* CompanyPositions */].init();
Object(__WEBPACK_IMPORTED_MODULE_7__Augmentations_js__["g" /* initAugmentations */])(); //Also calls Player.reapplyAllAugmentations()
- __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].reapplyAllSourceFiles();
- Object(__WEBPACK_IMPORTED_MODULE_31__StockMarket_js__["h" /* initStockSymbols */])();
- if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].hasWseAccount) {
- Object(__WEBPACK_IMPORTED_MODULE_31__StockMarket_js__["i" /* initSymbolToStockMap */])();
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].reapplyAllSourceFiles();
+ Object(__WEBPACK_IMPORTED_MODULE_32__StockMarket_js__["h" /* initStockSymbols */])();
+ if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].hasWseAccount) {
+ Object(__WEBPACK_IMPORTED_MODULE_32__StockMarket_js__["i" /* initSymbolToStockMap */])();
}
- Object(__WEBPACK_IMPORTED_MODULE_17__Literature_js__["a" /* initLiterature */])();
- Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptFunctions_js__["e" /* initSingularitySFFlags */])();
+ Object(__WEBPACK_IMPORTED_MODULE_18__Literature_js__["a" /* initLiterature */])();
+ Object(__WEBPACK_IMPORTED_MODULE_21__NetscriptFunctions_js__["e" /* initSingularitySFFlags */])();
- console.log(__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].intelligence_exp);
+ console.log(__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].intelligence_exp);
//Calculate the number of cycles have elapsed while offline
Engine._lastUpdate = new Date().getTime();
- var lastUpdate = __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].lastUpdate;
+ var lastUpdate = __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].lastUpdate;
var numCyclesOffline = Math.floor((Engine._lastUpdate - lastUpdate) / Engine._idleSpeed);
/* Process offline progress */
- var offlineProductionFromScripts = Object(__WEBPACK_IMPORTED_MODULE_26__Script_js__["e" /* loadAllRunningScripts */])(); //This also takes care of offline production for those scripts
- if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].isWorking) {
+ var offlineProductionFromScripts = Object(__WEBPACK_IMPORTED_MODULE_27__Script_js__["e" /* loadAllRunningScripts */])(); //This also takes care of offline production for those scripts
+ if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].isWorking) {
console.log("work() called in load() for " + numCyclesOffline * Engine._idleSpeed + " milliseconds");
- if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeFaction) {
- __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].workForFaction(numCyclesOffline);
- } else if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeCreateProgram) {
- __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].createProgramWork(numCyclesOffline);
- } else if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeStudyClass) {
- __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].takeClass(numCyclesOffline);
- } else if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeCrime) {
- __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].commitCrime(numCyclesOffline);
- } else if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeCompanyPartTime) {
- __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].workPartTime(numCyclesOffline);
+ if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_11__Constants_js__["a" /* CONSTANTS */].WorkTypeFaction) {
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].workForFaction(numCyclesOffline);
+ } else if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_11__Constants_js__["a" /* CONSTANTS */].WorkTypeCreateProgram) {
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].createProgramWork(numCyclesOffline);
+ } else if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_11__Constants_js__["a" /* CONSTANTS */].WorkTypeStudyClass) {
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].takeClass(numCyclesOffline);
+ } else if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_11__Constants_js__["a" /* CONSTANTS */].WorkTypeCrime) {
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].commitCrime(numCyclesOffline);
+ } else if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_11__Constants_js__["a" /* CONSTANTS */].WorkTypeCompanyPartTime) {
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].workPartTime(numCyclesOffline);
} else {
- __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].work(numCyclesOffline);
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].work(numCyclesOffline);
}
}
//Hacknet Nodes offline progress
- var offlineProductionFromHacknetNodes = Object(__WEBPACK_IMPORTED_MODULE_15__HacknetNode_js__["c" /* processAllHacknetNodeEarnings */])(numCyclesOffline);
+ var offlineProductionFromHacknetNodes = Object(__WEBPACK_IMPORTED_MODULE_16__HacknetNode_js__["c" /* processAllHacknetNodeEarnings */])(numCyclesOffline);
//Passive faction rep gain offline
- Object(__WEBPACK_IMPORTED_MODULE_12__Faction_js__["j" /* processPassiveFactionRepGain */])(numCyclesOffline);
+ Object(__WEBPACK_IMPORTED_MODULE_13__Faction_js__["j" /* processPassiveFactionRepGain */])(numCyclesOffline);
//Gang progress for BitNode 2
- if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].bitNodeN != null && __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].bitNodeN === 2 && __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].inGang()) {
- __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].gang.process(numCyclesOffline);
+ if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].bitNodeN != null && __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].bitNodeN === 2 && __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].inGang()) {
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].gang.process(numCyclesOffline);
}
//Update total playtime
var time = numCyclesOffline * Engine._idleSpeed;
- if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].totalPlaytime == null) {__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].totalPlaytime = 0;}
- if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].playtimeSinceLastAug == null) {__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].playtimeSinceLastAug = 0;}
- __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].totalPlaytime += time;
- __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].playtimeSinceLastAug += time;
+ if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].totalPlaytime == null) {__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].totalPlaytime = 0;}
+ if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].playtimeSinceLastAug == null) {__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].playtimeSinceLastAug = 0;}
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].totalPlaytime += time;
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].playtimeSinceLastAug += time;
- __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].lastUpdate = Engine._lastUpdate;
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].lastUpdate = Engine._lastUpdate;
Engine.start(); //Run main game loop and Scripts loop
Engine.removeLoadingScreen();
Object(__WEBPACK_IMPORTED_MODULE_0__utils_DialogBox_js__["a" /* dialogBoxCreate */])("While you were offline, your scripts generated $" +
@@ -5094,15 +5275,15 @@ let Engine = {
//Close main menu accordions for loaded game
var visibleMenuTabs = [terminal, createScript, activeScripts, stats,
hacknetnodes, city, tutorial, options];
- if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].firstFacInvRecvd) {visibleMenuTabs.push(factions);}
+ if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].firstFacInvRecvd) {visibleMenuTabs.push(factions);}
else {factions.style.display = "none";}
- if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].firstAugPurchased) {visibleMenuTabs.push(augmentations);}
+ if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].firstAugPurchased) {visibleMenuTabs.push(augmentations);}
else {augmentations.style.display = "none";}
- if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].firstJobRecvd) {visibleMenuTabs.push(job);}
+ if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].firstJobRecvd) {visibleMenuTabs.push(job);}
else {job.style.display = "none";}
- if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].firstTimeTraveled) {visibleMenuTabs.push(travel);}
+ if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].firstTimeTraveled) {visibleMenuTabs.push(travel);}
else {travel.style.display = "none";}
- if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].firstProgramAvailable) {visibleMenuTabs.push(createProgram);}
+ if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].firstProgramAvailable) {visibleMenuTabs.push(createProgram);}
else {createProgram.style.display = "none";}
Engine.closeMainMenuHeader(visibleMenuTabs);
@@ -5111,20 +5292,20 @@ let Engine = {
console.log("Initializing new game");
Object(__WEBPACK_IMPORTED_MODULE_8__BitNode_js__["d" /* initBitNodes */])();
Object(__WEBPACK_IMPORTED_MODULE_8__BitNode_js__["c" /* initBitNodeMultipliers */])();
- Object(__WEBPACK_IMPORTED_MODULE_29__SourceFile_js__["d" /* initSourceFiles */])();
- Object(__WEBPACK_IMPORTED_MODULE_30__SpecialServerIps_js__["c" /* initSpecialServerIps */])();
+ Object(__WEBPACK_IMPORTED_MODULE_30__SourceFile_js__["d" /* initSourceFiles */])();
+ Object(__WEBPACK_IMPORTED_MODULE_31__SpecialServerIps_js__["c" /* initSpecialServerIps */])();
Engine.setDisplayElements(); //Sets variables for important DOM elements
Engine.start(); //Run main game loop and Scripts loop
- __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].init();
- Object(__WEBPACK_IMPORTED_MODULE_27__Server_js__["f" /* initForeignServers */])();
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].init();
+ Object(__WEBPACK_IMPORTED_MODULE_28__Server_js__["f" /* initForeignServers */])();
Object(__WEBPACK_IMPORTED_MODULE_9__Company_js__["h" /* initCompanies */])();
- Object(__WEBPACK_IMPORTED_MODULE_12__Faction_js__["f" /* initFactions */])();
+ Object(__WEBPACK_IMPORTED_MODULE_13__Faction_js__["f" /* initFactions */])();
__WEBPACK_IMPORTED_MODULE_9__Company_js__["d" /* CompanyPositions */].init();
Object(__WEBPACK_IMPORTED_MODULE_7__Augmentations_js__["g" /* initAugmentations */])();
- Object(__WEBPACK_IMPORTED_MODULE_18__Message_js__["d" /* initMessages */])();
- Object(__WEBPACK_IMPORTED_MODULE_31__StockMarket_js__["h" /* initStockSymbols */])();
- Object(__WEBPACK_IMPORTED_MODULE_17__Literature_js__["a" /* initLiterature */])();
- Object(__WEBPACK_IMPORTED_MODULE_20__NetscriptFunctions_js__["e" /* initSingularitySFFlags */])();
+ Object(__WEBPACK_IMPORTED_MODULE_19__Message_js__["d" /* initMessages */])();
+ Object(__WEBPACK_IMPORTED_MODULE_32__StockMarket_js__["h" /* initStockSymbols */])();
+ Object(__WEBPACK_IMPORTED_MODULE_18__Literature_js__["a" /* initLiterature */])();
+ Object(__WEBPACK_IMPORTED_MODULE_21__NetscriptFunctions_js__["e" /* initSingularitySFFlags */])();
//Open main menu accordions for new game
//Main menu accordions
@@ -5151,12 +5332,12 @@ let Engine = {
);
//Start interactive tutorial
- Object(__WEBPACK_IMPORTED_MODULE_16__InteractiveTutorial_js__["d" /* iTutorialStart */])();
+ Object(__WEBPACK_IMPORTED_MODULE_17__InteractiveTutorial_js__["d" /* iTutorialStart */])();
Engine.removeLoadingScreen();
}
//Initialize labels on game settings
- Object(__WEBPACK_IMPORTED_MODULE_28__Settings_js__["d" /* setSettingsLabels */])();
- __WEBPACK_IMPORTED_MODULE_32__Terminal_js__["a" /* Terminal */].resetTerminalInput();
+ Object(__WEBPACK_IMPORTED_MODULE_29__Settings_js__["d" /* setSettingsLabels */])();
+ __WEBPACK_IMPORTED_MODULE_33__Terminal_js__["a" /* Terminal */].resetTerminalInput();
},
setDisplayElements: function() {
@@ -5249,52 +5430,52 @@ let Engine = {
Engine.Display.redPillContent.style.display = "none";
//Init Location buttons
- Object(__WEBPACK_IMPORTED_MODULE_13__Location_js__["c" /* initLocationButtons */])();
+ Object(__WEBPACK_IMPORTED_MODULE_14__Location_js__["c" /* initLocationButtons */])();
//Tutorial buttons
Engine.Clickables.tutorialNetworkingButton = document.getElementById("tutorial-networking-link");
Engine.Clickables.tutorialNetworkingButton.addEventListener("click", function() {
- Engine.displayTutorialPage(__WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].TutorialNetworkingText);
+ Engine.displayTutorialPage(__WEBPACK_IMPORTED_MODULE_11__Constants_js__["a" /* CONSTANTS */].TutorialNetworkingText);
});
Engine.Clickables.tutorialHackingButton = document.getElementById("tutorial-hacking-link");
Engine.Clickables.tutorialHackingButton.addEventListener("click", function() {
- Engine.displayTutorialPage(__WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].TutorialHackingText);
+ Engine.displayTutorialPage(__WEBPACK_IMPORTED_MODULE_11__Constants_js__["a" /* CONSTANTS */].TutorialHackingText);
});
Engine.Clickables.tutorialScriptsButton = document.getElementById("tutorial-scripts-link");
Engine.Clickables.tutorialScriptsButton.addEventListener("click", function() {
- Engine.displayTutorialPage(__WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].TutorialScriptsText);
+ Engine.displayTutorialPage(__WEBPACK_IMPORTED_MODULE_11__Constants_js__["a" /* CONSTANTS */].TutorialScriptsText);
});
Engine.Clickables.tutorialNetscriptButton = document.getElementById("tutorial-netscript-link");
Engine.Clickables.tutorialNetscriptButton.addEventListener("click", function() {
- if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].bitNodeN === 4 || __WEBPACK_IMPORTED_MODULE_20__NetscriptFunctions_js__["c" /* hasSingularitySF */]) {
- Engine.displayTutorialPage(__WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].TutorialNetscriptText + __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].TutorialSingularityFunctionsText);
+ if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].bitNodeN === 4 || __WEBPACK_IMPORTED_MODULE_21__NetscriptFunctions_js__["c" /* hasSingularitySF */]) {
+ Engine.displayTutorialPage(__WEBPACK_IMPORTED_MODULE_11__Constants_js__["a" /* CONSTANTS */].TutorialNetscriptText + __WEBPACK_IMPORTED_MODULE_11__Constants_js__["a" /* CONSTANTS */].TutorialSingularityFunctionsText);
} else {
- Engine.displayTutorialPage(__WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].TutorialNetscriptText);
+ Engine.displayTutorialPage(__WEBPACK_IMPORTED_MODULE_11__Constants_js__["a" /* CONSTANTS */].TutorialNetscriptText);
}
});
Engine.Clickables.tutorialTravelingButton = document.getElementById("tutorial-traveling-link");
Engine.Clickables.tutorialTravelingButton.addEventListener("click", function() {
- Engine.displayTutorialPage(__WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].TutorialTravelingText);
+ Engine.displayTutorialPage(__WEBPACK_IMPORTED_MODULE_11__Constants_js__["a" /* CONSTANTS */].TutorialTravelingText);
});
Engine.Clickables.tutorialCompaniesButton = document.getElementById("tutorial-jobs-link");
Engine.Clickables.tutorialCompaniesButton.addEventListener("click", function() {
- Engine.displayTutorialPage(__WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].TutorialCompaniesText);
+ Engine.displayTutorialPage(__WEBPACK_IMPORTED_MODULE_11__Constants_js__["a" /* CONSTANTS */].TutorialCompaniesText);
});
Engine.Clickables.tutorialFactionsButton = document.getElementById("tutorial-factions-link");
Engine.Clickables.tutorialFactionsButton.addEventListener("click", function() {
- Engine.displayTutorialPage(__WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].TutorialFactionsText);
+ Engine.displayTutorialPage(__WEBPACK_IMPORTED_MODULE_11__Constants_js__["a" /* CONSTANTS */].TutorialFactionsText);
});
Engine.Clickables.tutorialAugmentationsButton = document.getElementById("tutorial-augmentations-link");
Engine.Clickables.tutorialAugmentationsButton.addEventListener("click", function() {
- Engine.displayTutorialPage(__WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].TutorialAugmentationsText);
+ Engine.displayTutorialPage(__WEBPACK_IMPORTED_MODULE_11__Constants_js__["a" /* CONSTANTS */].TutorialAugmentationsText);
});
Engine.Clickables.tutorialBackButton = document.getElementById("tutorial-back-button");
@@ -5303,7 +5484,7 @@ let Engine = {
});
//If DarkWeb already purchased, disable the button
- if (__WEBPACK_IMPORTED_MODULE_30__SpecialServerIps_js__["a" /* SpecialServerIps */].hasOwnProperty("Darkweb Server")) {
+ if (__WEBPACK_IMPORTED_MODULE_31__SpecialServerIps_js__["a" /* SpecialServerIps */].hasOwnProperty("Darkweb Server")) {
document.getElementById("location-purchase-tor").setAttribute("class", "a-link-button-inactive");
}
},
@@ -5312,7 +5493,7 @@ let Engine = {
init: function() {
//Import game link
document.getElementById("import-game-link").onclick = function() {
- __WEBPACK_IMPORTED_MODULE_25__SaveObject_js__["b" /* saveObject */].importGame();
+ __WEBPACK_IMPORTED_MODULE_26__SaveObject_js__["b" /* saveObject */].importGame();
};
//Main menu accordions
@@ -5492,24 +5673,24 @@ let Engine = {
//Save, Delete, Import/Export buttons
Engine.Clickables.saveMainMenuButton = document.getElementById("save-game-link");
Engine.Clickables.saveMainMenuButton.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_25__SaveObject_js__["b" /* saveObject */].saveGame(indexedDb);
+ __WEBPACK_IMPORTED_MODULE_26__SaveObject_js__["b" /* saveObject */].saveGame(indexedDb);
return false;
});
Engine.Clickables.deleteMainMenuButton = document.getElementById("delete-game-link");
Engine.Clickables.deleteMainMenuButton.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_25__SaveObject_js__["b" /* saveObject */].deleteGame(indexedDb);
+ __WEBPACK_IMPORTED_MODULE_26__SaveObject_js__["b" /* saveObject */].deleteGame(indexedDb);
return false;
});
document.getElementById("export-game-link").addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_25__SaveObject_js__["b" /* saveObject */].exportGame();
+ __WEBPACK_IMPORTED_MODULE_26__SaveObject_js__["b" /* saveObject */].exportGame();
return false;
});
//Character Overview buttons
document.getElementById("character-overview-save-button").addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_25__SaveObject_js__["b" /* saveObject */].saveGame(indexedDb);
+ __WEBPACK_IMPORTED_MODULE_26__SaveObject_js__["b" /* saveObject */].saveGame(indexedDb);
return false;
});
@@ -5519,28 +5700,28 @@ let Engine = {
});
//Create Program buttons
- Object(__WEBPACK_IMPORTED_MODULE_11__CreateProgram_js__["d" /* initCreateProgramButtons */])();
+ Object(__WEBPACK_IMPORTED_MODULE_12__CreateProgram_js__["d" /* initCreateProgramButtons */])();
//Message at the top of terminal
- Object(__WEBPACK_IMPORTED_MODULE_32__Terminal_js__["c" /* postNetburnerText */])();
+ Object(__WEBPACK_IMPORTED_MODULE_33__Terminal_js__["c" /* postNetburnerText */])();
//Player was working cancel button
- if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].isWorking) {
+ if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].isWorking) {
var cancelButton = document.getElementById("work-in-progress-cancel-button");
cancelButton.addEventListener("click", function() {
- if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeFaction) {
- var fac = __WEBPACK_IMPORTED_MODULE_12__Faction_js__["b" /* Factions */][__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].currentWorkFactionName];
- __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].finishFactionWork(true);
- } else if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeCreateProgram) {
- __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].finishCreateProgramWork(true);
- } else if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeStudyClass) {
- __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].finishClass();
- } else if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeCrime) {
- __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].finishCrime(true);
- } else if (__WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_10__Constants_js__["a" /* CONSTANTS */].WorkTypeCompanyPartTime) {
- __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].finishWorkPartTime();
+ if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_11__Constants_js__["a" /* CONSTANTS */].WorkTypeFaction) {
+ var fac = __WEBPACK_IMPORTED_MODULE_13__Faction_js__["b" /* Factions */][__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].currentWorkFactionName];
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].finishFactionWork(true);
+ } else if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_11__Constants_js__["a" /* CONSTANTS */].WorkTypeCreateProgram) {
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].finishCreateProgramWork(true);
+ } else if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_11__Constants_js__["a" /* CONSTANTS */].WorkTypeStudyClass) {
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].finishClass();
+ } else if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_11__Constants_js__["a" /* CONSTANTS */].WorkTypeCrime) {
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].finishCrime(true);
+ } else if (__WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].workType == __WEBPACK_IMPORTED_MODULE_11__Constants_js__["a" /* CONSTANTS */].WorkTypeCompanyPartTime) {
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].finishWorkPartTime();
} else {
- __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].finishWork(true);
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].finishWork(true);
}
});
Engine.loadWorkInProgressContent();
@@ -5561,7 +5742,7 @@ let Engine = {
//DEBUG Delete active Scripts on home
document.getElementById("debug-delete-scripts-link").addEventListener("click", function() {
console.log("Deleting running scripts on home computer");
- __WEBPACK_IMPORTED_MODULE_22__Player_js__["a" /* Player */].getHomeComputer().runningScripts = [];
+ __WEBPACK_IMPORTED_MODULE_23__Player_js__["a" /* Player */].getHomeComputer().runningScripts = [];
Object(__WEBPACK_IMPORTED_MODULE_0__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Forcefully deleted all running scripts on home computer. Please save and refresh page");
Object(__WEBPACK_IMPORTED_MODULE_1__utils_GameOptions_js__["a" /* gameOptionsBoxClose */])();
return false;
@@ -5570,7 +5751,7 @@ let Engine = {
//DEBUG Soft Reset
document.getElementById("debug-soft-reset").addEventListener("click", function() {
Object(__WEBPACK_IMPORTED_MODULE_0__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Soft Reset!");
- Object(__WEBPACK_IMPORTED_MODULE_23__Prestige_js__["a" /* prestigeAugmentation */])();
+ Object(__WEBPACK_IMPORTED_MODULE_24__Prestige_js__["a" /* prestigeAugmentation */])();
Object(__WEBPACK_IMPORTED_MODULE_1__utils_GameOptions_js__["a" /* gameOptionsBoxClose */])();
return false;
});
@@ -5581,7 +5762,7 @@ let Engine = {
Engine.idleTimer();
//Scripts
- Object(__WEBPACK_IMPORTED_MODULE_21__NetscriptWorker_js__["f" /* runScriptsLoop */])();
+ Object(__WEBPACK_IMPORTED_MODULE_22__NetscriptWorker_js__["f" /* runScriptsLoop */])();
}
};
@@ -5643,15 +5824,15 @@ window.onload = function() {
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return initForeignServers; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return prestigeAllServers; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return prestigeHomeComputer; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__BitNode_js__ = __webpack_require__(7);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__BitNode_js__ = __webpack_require__(8);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Constants_js__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__CreateProgram_js__ = __webpack_require__(15);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Script_js__ = __webpack_require__(16);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__SpecialServerIps_js__ = __webpack_require__(12);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Script_js__ = __webpack_require__(18);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__SpecialServerIps_js__ = __webpack_require__(13);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__ = __webpack_require__(2);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__ = __webpack_require__(17);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__ = __webpack_require__(8);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__ = __webpack_require__(19);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__ = __webpack_require__(7);
@@ -5798,210 +5979,210 @@ __WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__["c" /* Reviver */].construct
function initForeignServers() {
//MegaCorporations
var ECorpServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "ecorp", "ECorp", false, false, false, 0);
- ECorpServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(1150, 1300), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(30000000000, 70000000000), 99, 99);
+ ECorpServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(1150, 1300), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(30000000000, 70000000000), 99, 99);
ECorpServer.setPortProperties(5);
AddToAllServers(ECorpServer);
var MegaCorpServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "megacorp", "MegaCorp", false, false, false, 0);
- MegaCorpServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(1150, 1300), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(40000000000, 60000000000), 99, 99);
+ MegaCorpServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(1150, 1300), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(40000000000, 60000000000), 99, 99);
MegaCorpServer.setPortProperties(5);
AddToAllServers(MegaCorpServer);
var BachmanAndAssociatesServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "b-and-a", "Bachman & Associates", false, false, false, 0);
- BachmanAndAssociatesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(1000, 1050), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(20000000000, 25000000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(75, 85), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(65, 75));
+ BachmanAndAssociatesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(1000, 1050), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(20000000000, 25000000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(75, 85), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(65, 75));
BachmanAndAssociatesServer.setPortProperties(5);
AddToAllServers(BachmanAndAssociatesServer);
var BladeIndustriesServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "blade", "Blade Industries", false, false, false, 2);
- BladeIndustriesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(1000, 1100), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(12000000000, 20000000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(90, 95), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(60, 75));
+ BladeIndustriesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(1000, 1100), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(12000000000, 20000000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(90, 95), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(60, 75));
BladeIndustriesServer.setPortProperties(5);
BladeIndustriesServer.messages.push("beyond-man.lit");
AddToAllServers(BladeIndustriesServer);
var NWOServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "nwo", "New World Order", false, false, false, 2);
- NWOServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(1000, 1200), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(25000000000, 35000000000), 99, Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(75, 85));
+ NWOServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(1000, 1200), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(25000000000, 35000000000), 99, Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(75, 85));
NWOServer.setPortProperties(5);
NWOServer.messages.push("the-hidden-world.lit");
AddToAllServers(NWOServer);
var ClarkeIncorporatedServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "clarkeinc", "Clarke Incorporated", false, false, false, 2);
- ClarkeIncorporatedServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(1000, 1200), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(15000000000, 25000000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(50, 60), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(50, 70));
+ ClarkeIncorporatedServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(1000, 1200), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(15000000000, 25000000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(50, 60), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(50, 70));
ClarkeIncorporatedServer.setPortProperties(5);
ClarkeIncorporatedServer.messages.push("beyond-man.lit");
ClarkeIncorporatedServer.messages.push("cost-of-immortality.lit");
AddToAllServers(ClarkeIncorporatedServer);
var OmniTekIncorporatedServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "omnitek", "OmniTek Incorporated", false, false, false, 2);
- OmniTekIncorporatedServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(900, 1100), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(15000000000, 20000000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(90, 99), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(95, 99));
+ OmniTekIncorporatedServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(900, 1100), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(15000000000, 20000000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(90, 99), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(95, 99));
OmniTekIncorporatedServer.setPortProperties(5);
OmniTekIncorporatedServer.messages.push("coded-intelligence.lit");
AddToAllServers(OmniTekIncorporatedServer);
var FourSigmaServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "4sigma", "FourSigma", false, false, false, 0);
- FourSigmaServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(950, 1200), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(15000000000, 25000000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(60, 70), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(75, 99));
+ FourSigmaServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(950, 1200), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(15000000000, 25000000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(60, 70), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(75, 99));
FourSigmaServer.setPortProperties(5);
AddToAllServers(FourSigmaServer);
var KuaiGongInternationalServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "kuai-gong", "KuaiGong International", false, false, false, 0);
- KuaiGongInternationalServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(1000, 1250), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(20000000000, 30000000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(95, 99), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(90, 99));
+ KuaiGongInternationalServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(1000, 1250), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(20000000000, 30000000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(95, 99), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(90, 99));
KuaiGongInternationalServer.setPortProperties(5);
AddToAllServers(KuaiGongInternationalServer);
//Technology and communications companies (large targets)
var FulcrumTechnologiesServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "fulcrumtech", "Fulcrum Technologies", false, false, false, 64);
- FulcrumTechnologiesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(1000, 1200), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(1400000000, 1800000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(85, 95), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(80, 99));
+ FulcrumTechnologiesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(1000, 1200), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(1400000000, 1800000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(85, 95), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(80, 99));
FulcrumTechnologiesServer.setPortProperties(5);
FulcrumTechnologiesServer.messages.push("simulated-reality.lit");
AddToAllServers(FulcrumTechnologiesServer);
var FulcrumSecretTechnologiesServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "fulcrumassets", "Fulcrum Technologies Assets", false, false, false, 0);
- FulcrumSecretTechnologiesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(1200, 1500), 1000000, 99, 1);
+ FulcrumSecretTechnologiesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(1200, 1500), 1000000, 99, 1);
FulcrumSecretTechnologiesServer.setPortProperties(5);
AddToAllServers(FulcrumSecretTechnologiesServer);
__WEBPACK_IMPORTED_MODULE_5__SpecialServerIps_js__["a" /* SpecialServerIps */].addIp(__WEBPACK_IMPORTED_MODULE_5__SpecialServerIps_js__["b" /* SpecialServerNames */].FulcrumSecretTechnologies, FulcrumSecretTechnologiesServer.ip);
var StormTechnologiesServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "stormtech", "Storm Technologies", false, false, false, 0);
- StormTechnologiesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(900, 1050), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(1000000000, 1200000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(80, 90), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(70, 90));
+ StormTechnologiesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(900, 1050), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(1000000000, 1200000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(80, 90), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(70, 90));
StormTechnologiesServer.setPortProperties(5);
AddToAllServers(StormTechnologiesServer);
var DefCommServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "defcomm", "DefComm", false, false, false, 0);
- DefCommServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(900, 1000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(800000000, 950000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(85, 95), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(50, 70));
+ DefCommServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(900, 1000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(800000000, 950000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(85, 95), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(50, 70));
DefCommServer.setPortProperties(5);
AddToAllServers(DefCommServer);
var InfoCommServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "infocomm", "InfoComm", false, false, false, 0);
- InfoCommServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(875, 950), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(600000000, 900000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(70, 90), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(35, 75));
+ InfoCommServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(875, 950), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(600000000, 900000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(70, 90), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(35, 75));
InfoCommServer.setPortProperties(5);
AddToAllServers(InfoCommServer);
var HeliosLabsServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "helios", "Helios Labs", false, false, false, 2);
- HeliosLabsServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(800, 900), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(550000000, 750000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(85, 95), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(70, 80));
+ HeliosLabsServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(800, 900), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(550000000, 750000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(85, 95), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(70, 80));
HeliosLabsServer.setPortProperties(5);
HeliosLabsServer.messages.push("beyond-man.lit");
AddToAllServers(HeliosLabsServer);
var VitaLifeServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "vitalife", "VitaLife", false, false, false, 32);
- VitaLifeServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(775, 900), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(700000000, 800000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(80, 90), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(60, 80));
+ VitaLifeServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(775, 900), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(700000000, 800000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(80, 90), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(60, 80));
VitaLifeServer.setPortProperties(5);
VitaLifeServer.messages.push("A-Green-Tomorrow.lit");
AddToAllServers(VitaLifeServer);
var IcarusMicrosystemsServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "icarus", "Icarus Microsystems", false, false, false, 0);
- IcarusMicrosystemsServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(850, 925), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(900000000, 1000000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(85, 95), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(85, 95));
+ IcarusMicrosystemsServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(850, 925), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(900000000, 1000000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(85, 95), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(85, 95));
IcarusMicrosystemsServer.setPortProperties(5);
AddToAllServers(IcarusMicrosystemsServer);
var UniversalEnergyServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "univ-energy", "Universal Energy", false, false, false, 32);
- UniversalEnergyServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(800, 900), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(1100000000, 1200000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(80, 90), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(80, 90));
+ UniversalEnergyServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(800, 900), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(1100000000, 1200000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(80, 90), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(80, 90));
UniversalEnergyServer.setPortProperties(4);
AddToAllServers(UniversalEnergyServer);
var TitanLabsServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "titan-labs", "Titan Laboratories", false, false, false, 32);
- TitanLabsServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(800, 875), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(750000000, 900000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(70, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(60, 80));
+ TitanLabsServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(800, 875), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(750000000, 900000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(70, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(60, 80));
TitanLabsServer.setPortProperties(5);
TitanLabsServer.messages.push("coded-intelligence.lit");
AddToAllServers(TitanLabsServer);
var MicrodyneTechnologiesServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "microdyne", "Microdyne Technologies", false, false, false, 16);
- MicrodyneTechnologiesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(800, 875), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(500000000, 700000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(65, 75), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(70, 90));
+ MicrodyneTechnologiesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(800, 875), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(500000000, 700000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(65, 75), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(70, 90));
MicrodyneTechnologiesServer.setPortProperties(5);
MicrodyneTechnologiesServer.messages.push("synthetic-muscles.lit");
AddToAllServers(MicrodyneTechnologiesServer);
var TaiYangDigitalServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "taiyang-digital", "Taiyang Digital", false, false, false, 2);
- TaiYangDigitalServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(850, 950), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(800000000, 900000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(70, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(70, 80));
+ TaiYangDigitalServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(850, 950), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(800000000, 900000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(70, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(70, 80));
TaiYangDigitalServer.setPortProperties(5);
TaiYangDigitalServer.messages.push("A-Green-Tomorrow.lit");
TaiYangDigitalServer.messages.push("brighter-than-the-sun.lit");
AddToAllServers(TaiYangDigitalServer);
var GalacticCyberSystemsServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "galactic-cyber", "Galactic Cybersystems", false, false, false, 0);
- GalacticCyberSystemsServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(825, 875), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(750000000, 850000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(55, 65), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(70, 90));
+ GalacticCyberSystemsServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(825, 875), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(750000000, 850000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(55, 65), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(70, 90));
GalacticCyberSystemsServer.setPortProperties(5);
AddToAllServers(GalacticCyberSystemsServer);
//Defense Companies ("Large" Companies)
var AeroCorpServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "aerocorp", "AeroCorp", false, false, false, 2);
- AeroCorpServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(850, 925), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(1000000000, 1200000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(80, 90), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(55, 65));
+ AeroCorpServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(850, 925), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(1000000000, 1200000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(80, 90), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(55, 65));
AeroCorpServer.setPortProperties(5);
AeroCorpServer.messages.push("man-and-machine.lit");
AddToAllServers(AeroCorpServer);
var OmniaCybersystemsServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "omnia", "Omnia Cybersystems", false, false, false, 0);
- OmniaCybersystemsServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(850, 950), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(900000000, 1000000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(85, 95), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(60, 70));
+ OmniaCybersystemsServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(850, 950), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(900000000, 1000000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(85, 95), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(60, 70));
OmniaCybersystemsServer.setPortProperties(5);
AddToAllServers(OmniaCybersystemsServer);
var ZBDefenseServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "zb-def", "ZB Defense Industries", false, false, false, 2);
- ZBDefenseServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(775, 825), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(900000000, 1100000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(55, 65), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(65, 75));
+ ZBDefenseServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(775, 825), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(900000000, 1100000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(55, 65), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(65, 75));
ZBDefenseServer.setPortProperties(4);
ZBDefenseServer.messages.push("synthetic-muscles.lit");
AddToAllServers(ZBDefenseServer);
var AppliedEnergeticsServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "applied-energetics", "Applied Energetics", false, false, false, 0);
- AppliedEnergeticsServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(775, 850), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(700000000, 1000000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(60, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(70, 75));
+ AppliedEnergeticsServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(775, 850), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(700000000, 1000000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(60, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(70, 75));
AppliedEnergeticsServer.setPortProperties(4);
AddToAllServers(AppliedEnergeticsServer);
var SolarisSpaceSystemsServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "solaris", "Solaris Space Systems", false, false, false, 2);
- SolarisSpaceSystemsServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(750, 850), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(700000000, 900000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(70, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(70, 80));
+ SolarisSpaceSystemsServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(750, 850), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(700000000, 900000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(70, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(70, 80));
SolarisSpaceSystemsServer.setPortProperties(5);
SolarisSpaceSystemsServer.messages.push("A-Green-Tomorrow.lit");
SolarisSpaceSystemsServer.messages.push("the-failed-frontier.lit");
AddToAllServers(SolarisSpaceSystemsServer);
var DeltaOneServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "deltaone", "Delta One", false, false, false, 0);
- DeltaOneServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(800, 900), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(1300000000, 1700000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(75, 85), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(50, 70));
+ DeltaOneServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(800, 900), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(1300000000, 1700000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(75, 85), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(50, 70));
DeltaOneServer.setPortProperties(5);
AddToAllServers(DeltaOneServer);
//Health, medicine, pharmaceutical companies ("Large" targets)
var GlobalPharmaceuticalsServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "global-pharm", "Global Pharmaceuticals", false, false, false, 16);
- GlobalPharmaceuticalsServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(750, 850), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(1500000000, 1750000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(75, 85), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(80, 90));
+ GlobalPharmaceuticalsServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(750, 850), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(1500000000, 1750000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(75, 85), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(80, 90));
GlobalPharmaceuticalsServer.setPortProperties(4);
GlobalPharmaceuticalsServer.messages.push("A-Green-Tomorrow.lit");
AddToAllServers(GlobalPharmaceuticalsServer);
var NovaMedicalServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "nova-med", "Nova Medical", false, false, false, 0);
- NovaMedicalServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(775, 850), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(1100000000, 1250000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(60, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(65, 85));
+ NovaMedicalServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(775, 850), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(1100000000, 1250000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(60, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(65, 85));
NovaMedicalServer.setPortProperties(4);
AddToAllServers(NovaMedicalServer);
var ZeusMedicalServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "zeus-med", "Zeus Medical", false, false, false, 0);
- ZeusMedicalServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(800, 850), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(1300000000, 1500000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(70, 90), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(70, 80));
+ ZeusMedicalServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(800, 850), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(1300000000, 1500000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(70, 90), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(70, 80));
ZeusMedicalServer.setPortProperties(5);
AddToAllServers(ZeusMedicalServer);
var UnitaLifeGroupServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "unitalife", "UnitaLife Group", false, false, false, 32);
- UnitaLifeGroupServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(775, 825), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(1000000000, 1100000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(70, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(70, 80));
+ UnitaLifeGroupServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(775, 825), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(1000000000, 1100000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(70, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(70, 80));
UnitaLifeGroupServer.setPortProperties(4);
AddToAllServers(UnitaLifeGroupServer);
//"Medium level" targets
var LexoCorpServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "lexo-corp", "Lexo Corporation", false, false, false, 16);
- LexoCorpServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(650, 750), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(700000000, 800000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(60, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(55, 65));
+ LexoCorpServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(650, 750), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(700000000, 800000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(60, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(55, 65));
LexoCorpServer.setPortProperties(4);
AddToAllServers(LexoCorpServer);
var RhoConstructionServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "rho-construction", "Rho Construction", false, false, false, 0);
- RhoConstructionServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(475, 525), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(500000000, 700000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(40, 60), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(40, 60));
+ RhoConstructionServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(475, 525), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(500000000, 700000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(40, 60), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(40, 60));
RhoConstructionServer.setPortProperties(3);
AddToAllServers(RhoConstructionServer);
var AlphaEnterprisesServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "alpha-ent", "Alpha Enterprises", false, false, false, 2);
- AlphaEnterprisesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(500, 600), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(600000000, 750000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(50, 70), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(50, 60));
+ AlphaEnterprisesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(500, 600), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(600000000, 750000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(50, 70), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(50, 60));
AlphaEnterprisesServer.setPortProperties(4);
AlphaEnterprisesServer.messages.push("sector-12-crime.lit");
AddToAllServers(AlphaEnterprisesServer);
var AevumPoliceServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "aevum-police", "Aevum Police Network", false, false, false, 0);
- AevumPoliceServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(400, 450), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(200000000, 400000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(70, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(30, 50));
+ AevumPoliceServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(400, 450), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(200000000, 400000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(70, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(30, 50));
AevumPoliceServer.setPortProperties(4);
AddToAllServers(AevumPoliceServer);
var RothmanUniversityServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "rothman-uni", "Rothman University Network", false, false, false, 4);
- RothmanUniversityServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(370, 430), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(175000000, 250000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(45, 55), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(35, 45));
+ RothmanUniversityServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(370, 430), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(175000000, 250000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(45, 55), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(35, 45));
RothmanUniversityServer.setPortProperties(3);
RothmanUniversityServer.messages.push("secret-societies.lit");
RothmanUniversityServer.messages.push("the-failed-frontier.lit");
@@ -6009,12 +6190,12 @@ function initForeignServers() {
AddToAllServers(RothmanUniversityServer);
var ZBInstituteOfTechnologyServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "zb-institute", "ZB Institute of Technology Network", false, false, false, 4);
- ZBInstituteOfTechnologyServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(725, 775), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(800000000, 1100000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(65, 85), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(75, 85));
+ ZBInstituteOfTechnologyServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(725, 775), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(800000000, 1100000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(65, 85), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(75, 85));
ZBInstituteOfTechnologyServer.setPortProperties(5);
AddToAllServers(ZBInstituteOfTechnologyServer);
var SummitUniversityServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "summit-uni", "Summit University Network", false, false, false, 4);
- SummitUniversityServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(425, 475), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(200000000, 350000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(45, 65), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(40, 60));
+ SummitUniversityServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(425, 475), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(200000000, 350000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(45, 65), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(40, 60));
SummitUniversityServer.setPortProperties(3);
SummitUniversityServer.messages.push("secret-societies.lit");
SummitUniversityServer.messages.push("the-failed-frontier.lit");
@@ -6022,35 +6203,35 @@ function initForeignServers() {
AddToAllServers(SummitUniversityServer);
var SysCoreSecuritiesServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "syscore", "SysCore Securities", false, false, false, 0);
- SysCoreSecuritiesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(550, 650), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(400000000, 600000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(60, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(60, 70));
+ SysCoreSecuritiesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(550, 650), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(400000000, 600000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(60, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(60, 70));
SysCoreSecuritiesServer.setPortProperties(4);
AddToAllServers(SysCoreSecuritiesServer);
var CatalystVenturesServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "catalyst", "Catalyst Ventures", false, false, false, 2);
- CatalystVenturesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(400, 450), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(300000000, 550000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(60, 70), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(25, 55));
+ CatalystVenturesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(400, 450), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(300000000, 550000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(60, 70), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(25, 55));
CatalystVenturesServer.setPortProperties(3);
CatalystVenturesServer.messages.push("tensions-in-tech-race.lit");
AddToAllServers(CatalystVenturesServer);
var TheHubServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "the-hub", "The Hub", false, false, false, 0);
- TheHubServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(275, 325), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(150000000, 200000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(35, 45), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(45, 55));
+ TheHubServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(275, 325), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(150000000, 200000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(35, 45), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(45, 55));
TheHubServer.setPortProperties(2);
AddToAllServers(TheHubServer);
var CompuTekServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "comptek", "CompuTek", false, false, false, 8);
- CompuTekServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(300, 400), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(220000000, 250000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(55, 65), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(45, 65));
+ CompuTekServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(300, 400), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(220000000, 250000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(55, 65), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(45, 65));
CompuTekServer.setPortProperties(3);
CompuTekServer.messages.push("man-and-machine.lit");
AddToAllServers(CompuTekServer);
var NetLinkTechnologiesServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "netlink", "NetLink Technologies", false, false, false, 2);
- NetLinkTechnologiesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(375, 425), 275000000, Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(60, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(45, 75));
+ NetLinkTechnologiesServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(375, 425), 275000000, Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(60, 80), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(45, 75));
NetLinkTechnologiesServer.setPortProperties(3);
NetLinkTechnologiesServer.messages.push("simulated-reality.lit");
AddToAllServers(NetLinkTechnologiesServer);
var JohnsonOrthopedicsServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "johnson-ortho", "Johnson Orthopedics", false, false, false, 4);
- JohnsonOrthopedicsServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(250, 300), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(70000000, 85000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(35, 65), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(35, 65));
+ JohnsonOrthopedicsServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(250, 300), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(70000000, 85000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(35, 65), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(35, 65));
JohnsonOrthopedicsServer.setPortProperties(2);
AddToAllServers(JohnsonOrthopedicsServer);
@@ -6115,14 +6296,14 @@ function initForeignServers() {
AddToAllServers(MaxHardwareServer);
var OmegaSoftwareServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "omega-net", "Omega Software", false, false, false, 16);
- OmegaSoftwareServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(180, 220), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(60000000, 70000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(25, 35), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(30, 40));
+ OmegaSoftwareServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(180, 220), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(60000000, 70000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(25, 35), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(30, 40));
OmegaSoftwareServer.setPortProperties(2);
OmegaSoftwareServer.messages.push("the-new-god.lit");
AddToAllServers(OmegaSoftwareServer);
//Gyms
var CrushFitnessGymServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "crush-fitness", "Crush Fitness", false, false, false, 0);
- CrushFitnessGymServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(225, 275), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(40000000, 60000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(35, 45), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(27, 33));
+ CrushFitnessGymServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(225, 275), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(40000000, 60000000), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(35, 45), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(27, 33));
CrushFitnessGymServer.setPortProperties(2);
AddToAllServers(CrushFitnessGymServer);
@@ -6132,23 +6313,23 @@ function initForeignServers() {
AddToAllServers(IronGymServer);
var MilleniumFitnessGymServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "millenium-fitness", "Millenium Fitness Network", false, false, false, 0);
- MilleniumFitnessGymServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(475, 525), 250000000, Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(45, 55), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(25, 45));
+ MilleniumFitnessGymServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(475, 525), 250000000, Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(45, 55), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(25, 45));
MilleniumFitnessGymServer.setPortProperties(3);
AddToAllServers(MilleniumFitnessGymServer);
var PowerhouseGymServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "powerhouse-fitness", "Powerhouse Fitness", false, false, false, 0);
- PowerhouseGymServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(950, 1100), 900000000, Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(55, 65), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(50, 60));
+ PowerhouseGymServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(950, 1100), 900000000, Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(55, 65), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(50, 60));
PowerhouseGymServer.setPortProperties(5);
AddToAllServers(PowerhouseGymServer);
var SnapFitnessGymServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "snap-fitness", "Snap Fitness", false, false, false, 0);
- SnapFitnessGymServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(675, 800), 450000000, Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(40, 60), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(40, 60));
+ SnapFitnessGymServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(675, 800), 450000000, Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(40, 60), Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(40, 60));
SnapFitnessGymServer.setPortProperties(4);
AddToAllServers(SnapFitnessGymServer);
//Faction servers, cannot hack money from these
var BitRunnersServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "run4theh111z", "The Runners", false, false, false, 2);
- BitRunnersServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(505, 550), 0, 0, 0);
+ BitRunnersServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(505, 550), 0, 0, 0);
BitRunnersServer.setPortProperties(4);
BitRunnersServer.messages.push("simulated-reality.lit");
BitRunnersServer.messages.push("the-new-god.lit");
@@ -6156,27 +6337,27 @@ function initForeignServers() {
__WEBPACK_IMPORTED_MODULE_5__SpecialServerIps_js__["a" /* SpecialServerIps */].addIp(__WEBPACK_IMPORTED_MODULE_5__SpecialServerIps_js__["b" /* SpecialServerNames */].BitRunnersServer, BitRunnersServer.ip);
var TheBlackHandServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "I.I.I.I", "I.I.I.I", false, false, false, 2);
- TheBlackHandServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(340, 365), 0, 0, 0);
+ TheBlackHandServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(340, 365), 0, 0, 0);
TheBlackHandServer.setPortProperties(3);
TheBlackHandServer.messages.push("democracy-is-dead.lit");
AddToAllServers(TheBlackHandServer);
__WEBPACK_IMPORTED_MODULE_5__SpecialServerIps_js__["a" /* SpecialServerIps */].addIp(__WEBPACK_IMPORTED_MODULE_5__SpecialServerIps_js__["b" /* SpecialServerNames */].TheBlackHandServer, TheBlackHandServer.ip);
var NiteSecServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "avmnite-02h", "NiteSec", false, false, false, 2);
- NiteSecServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(202, 220), 0, 0, 0);
+ NiteSecServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(202, 220), 0, 0, 0);
NiteSecServer.setPortProperties(2);
NiteSecServer.messages.push("democracy-is-dead.lit");
AddToAllServers(NiteSecServer);
__WEBPACK_IMPORTED_MODULE_5__SpecialServerIps_js__["a" /* SpecialServerIps */].addIp(__WEBPACK_IMPORTED_MODULE_5__SpecialServerIps_js__["b" /* SpecialServerNames */].NiteSecServer, NiteSecServer.ip);
var DarkArmyServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), ".", ".", false, false, false, 0);
- DarkArmyServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(505, 550), 0, 0, 0);
+ DarkArmyServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(505, 550), 0, 0, 0);
DarkArmyServer.setPortProperties(4);
AddToAllServers(DarkArmyServer);
__WEBPACK_IMPORTED_MODULE_5__SpecialServerIps_js__["a" /* SpecialServerIps */].addIp(__WEBPACK_IMPORTED_MODULE_5__SpecialServerIps_js__["b" /* SpecialServerNames */].TheDarkArmyServer, DarkArmyServer.ip);
var CyberSecServer = new Server(Object(__WEBPACK_IMPORTED_MODULE_7__utils_IPAddress_js__["a" /* createRandomIp */])(), "CSEC", "CyberSec", false, false, false, 2);
- CyberSecServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["d" /* getRandomInt */])(51, 60), 0, 0, 0);
+ CyberSecServer.setHackingParameters(Object(__WEBPACK_IMPORTED_MODULE_6__utils_HelperFunctions_js__["h" /* getRandomInt */])(51, 60), 0, 0, 0);
CyberSecServer.setPortProperties(1);
CyberSecServer.messages.push("democracy-is-dead.lit");
AddToAllServers(CyberSecServer);
@@ -6453,6 +6634,87 @@ Directory.prototype.getPath = function(name) {
/* 7 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
+"use strict";
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return Reviver; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return Generic_toJSON; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Generic_fromJSON; });
+/* Generic Reviver, toJSON, and fromJSON functions used for saving and loading objects */
+
+// A generic "smart reviver" function.
+// Looks for object values with a `ctor` property and
+// a `data` property. If it finds them, and finds a matching
+// constructor that has a `fromJSON` property on it, it hands
+// off to that `fromJSON` fuunction, passing in the value.
+function Reviver(key, value) {
+ var ctor;
+ if (value == null) {
+ console.log("Reviver WRONGLY called with key: " + key + ", and value: " + value);
+ return 0;
+ }
+ if (typeof value === "object" &&
+ typeof value.ctor === "string" &&
+ typeof value.data !== "undefined") {
+ ctor = Reviver.constructors[value.ctor] || window[value.ctor];
+ if (typeof ctor === "function" &&
+ typeof ctor.fromJSON === "function") {
+
+ return ctor.fromJSON(value);
+ }
+ }
+ return value;
+}
+Reviver.constructors = {}; // A list of constructors the smart reviver should know about
+
+// A generic "toJSON" function that creates the data expected
+// by Reviver.
+// `ctorName` The name of the constructor to use to revive it
+// `obj` The object being serialized
+// `keys` (Optional) Array of the properties to serialize,
+// if not given then all of the objects "own" properties
+// that don't have function values will be serialized.
+// (Note: If you list a property in `keys`, it will be serialized
+// regardless of whether it's an "own" property.)
+// Returns: The structure (which will then be turned into a string
+// as part of the JSON.stringify algorithm)
+function Generic_toJSON(ctorName, obj, keys) {
+ var data, index, key;
+
+ if (!keys) {
+ keys = Object.keys(obj); // Only "own" properties are included
+ }
+
+ data = {};
+ for (index = 0; index < keys.length; ++index) {
+ key = keys[index];
+ data[key] = obj[key];
+ }
+ return {ctor: ctorName, data: data};
+}
+
+// A generic "fromJSON" function for use with Reviver: Just calls the
+// constructor function with no arguments, then applies all of the
+// key/value pairs from the raw data to the instance. Only useful for
+// constructors that can be reasonably called without arguments!
+// `ctor` The constructor to call
+// `data` The data to apply
+// Returns: The object
+function Generic_fromJSON(ctor, data) {
+ var obj, name;
+
+ obj = new ctor();
+ for (name in data) {
+ obj[name] = data[name];
+ }
+ return obj;
+}
+
+
+
+
+/***/ }),
+/* 8 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return initBitNodes; });
/* unused harmony export BitNode */
@@ -6503,7 +6765,26 @@ function initBitNodes() {
"Level 1: 20%
" +
"Level 2: 30%
" +
"Level 3: 35%");
- BitNodes["BitNode3"] = new BitNode(3, "The Price of Civilization", "COMING SOON"); //Corporate Warfare, Run own company
+ BitNodes["BitNode3"] = new BitNode(3, "Corporatocracy", "The Price of Civilization",
+ "Our greatest illusion is that a healthy society can revolve around a " +
+ "single-minded pursuit of wealth.
" +
+ "Sometime in the early 21st century economic and political globalization turned " +
+ "the world into a corporatocracy, and it never looked back. Now, the privileged " +
+ "elite will happily bankrupt their own countrymen, decimate their own community, " +
+ "and evict their neighbors from houses in their desperate bid to increase their wealth.
" +
+ "In this BitNode you can create and manage your own corporation. Running a successful corporation " +
+ "has the potential of generating massive profits. All other forms of income are reduced by 75%. Furthermore:
" +
+ "The price and reputation cost of all Augmentations is tripled
" +
+ "The starting and maximum amount of money on servers is halved
" +
+ "Server growth rate is reduced by 80%
" +
+ "You will start out with $150b so that you can start your corporation
" +
+ "You now only need 75 reputation with a faction in order to donate to it, rather than 150
" +
+ "Destroying this BitNode will give you Source-File 3, or if you already have this Source-File it will " +
+ "upgrade its level up to a maximum of 3. This Source-File lets you create corporations on other BitNodes (although " +
+ "some BitNodes will disable this mechanic). This Source-File also increases your charisma and company salary multipliers by:
" +
+ "Level 1: 8%
" +
+ "Level 2: 12%
" +
+ "Level 3: 14%");
BitNodes["BitNode4"] = new BitNode(4, "The Singularity", "The Man and the Machine", "The Singularity has arrived. The human race is gone, replaced " +
"by artificially superintelligent beings that are more machine than man.
" +
"In this BitNode, progressing is significantly harder. Experience gain rates " +
@@ -6538,7 +6819,7 @@ function initBitNodes() {
"Level 2: 6%
" +
"Level 3: 7%");
BitNodes["BitNode6"] = new BitNode(6, "Do Androids Dream?", "COMING SOON"); //Build androids for automation
- BitNodes["BitNode7"] = new BitNode(7, "Waste Runner", "COMING SOON"); //Postapocalyptic wasteland + blade runner
+ BitNodes["BitNode7"] = new BitNode(7, "Bladeburners", "COMING SOON"); //Blade burner
BitNodes["BitNode8"] = new BitNode(8, "Ghost of Wall Street", "Money never sleeps",
"You are trying to make a name for yourself as an up-and-coming hedge fund manager on Wall Street.
" +
"In this BitNode:
" +
@@ -6654,6 +6935,18 @@ function initBitNodeMultipliers() {
BitNodeMultipliers.FactionWorkRepGain = 0.5;
BitNodeMultipliers.FactionPassiveRepGain = 0;
break;
+ case 3: //Corporatocracy
+ BitNodeMultipliers.RepToDonateToFaction = 0.5;
+ BitNodeMultipliers.AugmentationRepCost = 3;
+ BitNodeMultipliers.AugmentationMoneyCost = 3;
+ BitNodeMultipliers.ServerMaxMoney = 0.50;
+ BitNodeMultipliers.ServerStartingMoney = 0.50;
+ BitNodeMultipliers.ServerGrowthRate = 0.20;
+ BitNodeMultipliers.ScriptHackMoney = 0.25;
+ BitNodeMultipliers.CompanyWorkMoney = 0.25;
+ BitNodeMultipliers.CrimeMoney = 0.25;
+ BitNodeMultipliers.HacknetNodeMoney = 0.25;
+ break;
case 4: //The Singularity
BitNodeMultipliers.ServerMaxMoney = 0.15;
BitNodeMultipliers.ServerStartingMoney = 0.75;
@@ -6710,87 +7003,6 @@ function initBitNodeMultipliers() {
-/***/ }),
-/* 8 */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return Reviver; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return Generic_toJSON; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Generic_fromJSON; });
-/* Generic Reviver, toJSON, and fromJSON functions used for saving and loading objects */
-
-// A generic "smart reviver" function.
-// Looks for object values with a `ctor` property and
-// a `data` property. If it finds them, and finds a matching
-// constructor that has a `fromJSON` property on it, it hands
-// off to that `fromJSON` fuunction, passing in the value.
-function Reviver(key, value) {
- var ctor;
- if (value == null) {
- console.log("Reviver WRONGLY called with key: " + key + ", and value: " + value);
- return 0;
- }
- if (typeof value === "object" &&
- typeof value.ctor === "string" &&
- typeof value.data !== "undefined") {
- ctor = Reviver.constructors[value.ctor] || window[value.ctor];
- if (typeof ctor === "function" &&
- typeof ctor.fromJSON === "function") {
-
- return ctor.fromJSON(value);
- }
- }
- return value;
-}
-Reviver.constructors = {}; // A list of constructors the smart reviver should know about
-
-// A generic "toJSON" function that creates the data expected
-// by Reviver.
-// `ctorName` The name of the constructor to use to revive it
-// `obj` The object being serialized
-// `keys` (Optional) Array of the properties to serialize,
-// if not given then all of the objects "own" properties
-// that don't have function values will be serialized.
-// (Note: If you list a property in `keys`, it will be serialized
-// regardless of whether it's an "own" property.)
-// Returns: The structure (which will then be turned into a string
-// as part of the JSON.stringify algorithm)
-function Generic_toJSON(ctorName, obj, keys) {
- var data, index, key;
-
- if (!keys) {
- keys = Object.keys(obj); // Only "own" properties are included
- }
-
- data = {};
- for (index = 0; index < keys.length; ++index) {
- key = keys[index];
- data[key] = obj[key];
- }
- return {ctor: ctorName, data: data};
-}
-
-// A generic "fromJSON" function for use with Reviver: Just calls the
-// constructor function with no arguments, then applies all of the
-// key/value pairs from the raw data to the instance. Only useful for
-// constructors that can be reasonably called without arguments!
-// `ctor` The constructor to call
-// `data` The data to apply
-// Returns: The object
-function Generic_fromJSON(ctor, data) {
- var obj, name;
-
- obj = new ctor();
- for (name in data) {
- obj[name] = data[name];
- }
- return obj;
-}
-
-
-
-
/***/ }),
/* 9 */
/***/ (function(module, exports, __webpack_require__) {
@@ -17055,6 +17267,254 @@ return jQuery;
/* 10 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
+"use strict";
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return WorkerScript; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return workerScripts; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NetscriptPorts; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return runScriptsLoop; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return killWorkerScript; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return addWorkerScript; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return updateOnlineScriptTimes; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return prestigeWorkerScripts; });
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ActiveScriptsUI_js__ = __webpack_require__(26);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Constants_js__ = __webpack_require__(3);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__engine_js__ = __webpack_require__(5);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__NetscriptEnvironment_js__ = __webpack_require__(38);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__NetscriptEvaluator_js__ = __webpack_require__(37);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Server_js__ = __webpack_require__(6);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Settings_js__ = __webpack_require__(16);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_acorn_js__ = __webpack_require__(48);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_acorn_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_7__utils_acorn_js__);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__ = __webpack_require__(1);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_HelperFunctions_js__ = __webpack_require__(2);
+
+
+
+
+
+
+
+
+
+
+
+
+function WorkerScript(runningScriptObj) {
+ this.name = runningScriptObj.filename;
+ this.running = false;
+ this.serverIp = null;
+ this.code = runningScriptObj.scriptRef.code;
+ this.env = new __WEBPACK_IMPORTED_MODULE_3__NetscriptEnvironment_js__["a" /* Environment */](this);
+ this.env.set("args", runningScriptObj.args);
+ this.output = "";
+ this.ramUsage = 0;
+ this.scriptRef = runningScriptObj;
+ this.errorMessage = "";
+ this.args = runningScriptObj.args;
+ //this.killTrigger = function() {}; //CB func used to clear any delays (netscriptDelay())
+ this.delay = null;
+ this.fnWorker = null; //Workerscript for a function call
+}
+
+//Returns the server on which the workerScript is running
+WorkerScript.prototype.getServer = function() {
+ return __WEBPACK_IMPORTED_MODULE_5__Server_js__["b" /* AllServers */][this.serverIp];
+}
+
+//Array containing all scripts that are running across all servers, to easily run them all
+let workerScripts = [];
+
+let NetscriptPorts = {
+ Port1: [],
+ Port2: [],
+ Port3: [],
+ Port4: [],
+ Port5: [],
+ Port6: [],
+ Port7: [],
+ Port8: [],
+ Port9: [],
+ Port10: [],
+}
+
+function prestigeWorkerScripts() {
+ for (var i = 0; i < workerScripts.length; ++i) {
+ Object(__WEBPACK_IMPORTED_MODULE_0__ActiveScriptsUI_js__["b" /* 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) {
+ console.log("Deleting script: " + workerScripts[i].name);
+ //Delete script from the runningScripts array on its host serverIp
+ var ip = workerScripts[i].serverIp;
+ var name = workerScripts[i].name;
+
+ for (var j = 0; j < __WEBPACK_IMPORTED_MODULE_5__Server_js__["b" /* AllServers */][ip].runningScripts.length; j++) {
+ if (__WEBPACK_IMPORTED_MODULE_5__Server_js__["b" /* AllServers */][ip].runningScripts[j].filename == name &&
+ Object(__WEBPACK_IMPORTED_MODULE_9__utils_HelperFunctions_js__["d" /* compareArrays */])(__WEBPACK_IMPORTED_MODULE_5__Server_js__["b" /* AllServers */][ip].runningScripts[j].args, workerScripts[i].args)) {
+ __WEBPACK_IMPORTED_MODULE_5__Server_js__["b" /* AllServers */][ip].runningScripts.splice(j, 1);
+ break;
+ }
+ }
+
+ //Free RAM
+ __WEBPACK_IMPORTED_MODULE_5__Server_js__["b" /* AllServers */][ip].ramUsed -= workerScripts[i].ramUsage;
+
+ //Delete script from Active Scripts
+ Object(__WEBPACK_IMPORTED_MODULE_0__ActiveScriptsUI_js__["b" /* deleteActiveScriptsItem */])(workerScripts[i]);
+
+ //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(__WEBPACK_IMPORTED_MODULE_7__utils_acorn_js__["parse"])(workerScripts[i].code);
+ //console.log(ast);
+ } catch (e) {
+ console.log("Error parsing script: " + workerScripts[i].name);
+ Object(__WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Syntax ERROR in " + workerScripts[i].name + ":
" + e);
+ workerScripts[i].env.stopFlag = true;
+ continue;
+ }
+
+ workerScripts[i].running = true;
+ var p = Object(__WEBPACK_IMPORTED_MODULE_4__NetscriptEvaluator_js__["a" /* 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) {
+ console.log(w);
+ if (w instanceof Error) {
+ Object(__WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__["a" /* 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(__WEBPACK_IMPORTED_MODULE_4__NetscriptEvaluator_js__["b" /* 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(__WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Script runtime error:
Server Ip: " + serverIp +
+ "
Script name: " + scriptName +
+ "
Args:" + Object(__WEBPACK_IMPORTED_MODULE_9__utils_HelperFunctions_js__["j" /* 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(__WEBPACK_IMPORTED_MODULE_4__NetscriptEvaluator_js__["b" /* isScriptErrorMessage */])(w)) {
+ Object(__WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__["a" /* 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(__WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__["a" /* 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(__WEBPACK_IMPORTED_MODULE_9__utils_HelperFunctions_js__["d" /* compareArrays */])(workerScripts[i].args, runningScriptObj.args)) {
+ workerScripts[i].env.stopFlag = true;
+ Object(__WEBPACK_IMPORTED_MODULE_4__NetscriptEvaluator_js__["c" /* killNetscriptDelay */])(workerScripts[i]);
+ if (workerScripts[i].fnWorker) {
+ workerScripts[i].fnWorker.env.stopFlag = true;
+ Object(__WEBPACK_IMPORTED_MODULE_4__NetscriptEvaluator_js__["c" /* killNetscriptDelay */])(workerScripts[i].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(__WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].MultithreadingRAMCost, threads-1);
+ var ramAvailable = server.maxRam - server.ramUsed;
+ if (ramUsage > ramAvailable) {
+ Object(__WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Not enough RAM to run script " + runningScriptObj.filename + " with args " +
+ Object(__WEBPACK_IMPORTED_MODULE_9__utils_HelperFunctions_js__["j" /* 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(__WEBPACK_IMPORTED_MODULE_0__ActiveScriptsUI_js__["a" /* 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 * __WEBPACK_IMPORTED_MODULE_2__engine_js__["Engine"]._idleSpeed) / 1000; //seconds
+ for (var i = 0; i < workerScripts.length; ++i) {
+ workerScripts[i].scriptRef.onlineRunningTime += time;
+ }
+}
+
+
+
+
+/***/ }),
+/* 11 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
"use strict";
/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return getNextNeurofluxLevel; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return Factions; });
@@ -17068,20 +17528,20 @@ return jQuery;
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return purchaseAugmentation; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return factionExists; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__ = __webpack_require__(20);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__BitNode_js__ = __webpack_require__(7);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__BitNode_js__ = __webpack_require__(8);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Constants_js__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__engine_js__ = __webpack_require__(5);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__FactionInfo_js__ = __webpack_require__(52);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Location_js__ = __webpack_require__(13);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Missions_js__ = __webpack_require__(26);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__FactionInfo_js__ = __webpack_require__(51);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Location_js__ = __webpack_require__(12);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Missions_js__ = __webpack_require__(28);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Settings_js__ = __webpack_require__(14);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Settings_js__ = __webpack_require__(16);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__ = __webpack_require__(1);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_FactionInvitationBox_js__ = __webpack_require__(54);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_FactionInvitationBox_js__ = __webpack_require__(75);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__utils_HelperFunctions_js__ = __webpack_require__(2);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__utils_JSONReviver_js__ = __webpack_require__(8);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__utils_JSONReviver_js__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__ = __webpack_require__(4);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__utils_YesNoBox_js__ = __webpack_require__(22);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__utils_YesNoBox_js__ = __webpack_require__(14);
@@ -17596,7 +18056,6 @@ function displayFactionContent(factionName) {
var newPurchaseAugmentationsButton = Object(__WEBPACK_IMPORTED_MODULE_11__utils_HelperFunctions_js__["b" /* clearEventListeners */])("faction-purchase-augmentations");
newPurchaseAugmentationsButton.addEventListener("click", function() {
__WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].hideAllContent();
- //Engine.Display.factionAugmentationsContent.style.visibility = "visible";
__WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].Display.factionAugmentationsContent.style.display = "block";
var newBackButton = Object(__WEBPACK_IMPORTED_MODULE_11__utils_HelperFunctions_js__["b" /* clearEventListeners */])("faction-augmentations-back-button");
@@ -17613,6 +18072,7 @@ function displayFactionContent(factionName) {
factionName == "The Syndicate" || factionName == "The Dark Army" || factionName == "Speakers for the Dead" ||
factionName == "NiteSec" || factionName == "The Black Hand")) {
//Set everything else to invisible
+ hackMissionDiv.style.display = "none";
hackDiv.style.display = "none";
fieldWorkDiv.style.display = "none";
securityWorkDiv.style.display = "none";
@@ -18128,340 +18588,32 @@ function processPassiveFactionRepGain(numCycles) {
/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(9)))
-/***/ }),
-/* 11 */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return WorkerScript; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return workerScripts; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NetscriptPorts; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return runScriptsLoop; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return killWorkerScript; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return addWorkerScript; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return updateOnlineScriptTimes; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return prestigeWorkerScripts; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ActiveScriptsUI_js__ = __webpack_require__(25);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Constants_js__ = __webpack_require__(3);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__engine_js__ = __webpack_require__(5);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__NetscriptEnvironment_js__ = __webpack_require__(31);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__NetscriptEvaluator_js__ = __webpack_require__(38);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Server_js__ = __webpack_require__(6);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Settings_js__ = __webpack_require__(14);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_acorn_js__ = __webpack_require__(47);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_acorn_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_7__utils_acorn_js__);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__ = __webpack_require__(1);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_HelperFunctions_js__ = __webpack_require__(2);
-
-
-
-
-
-
-
-
-
-
-
-
-function WorkerScript(runningScriptObj) {
- this.name = runningScriptObj.filename;
- this.running = false;
- this.serverIp = null;
- this.code = runningScriptObj.scriptRef.code;
- this.env = new __WEBPACK_IMPORTED_MODULE_3__NetscriptEnvironment_js__["a" /* Environment */](this);
- this.env.set("args", runningScriptObj.args);
- this.output = "";
- this.ramUsage = 0;
- this.scriptRef = runningScriptObj;
- this.errorMessage = "";
- this.args = runningScriptObj.args;
- //this.killTrigger = function() {}; //CB func used to clear any delays (netscriptDelay())
- this.delay = null;
- this.fnWorker = null; //Workerscript for a function call
-}
-
-//Returns the server on which the workerScript is running
-WorkerScript.prototype.getServer = function() {
- return __WEBPACK_IMPORTED_MODULE_5__Server_js__["b" /* AllServers */][this.serverIp];
-}
-
-//Array containing all scripts that are running across all servers, to easily run them all
-let workerScripts = [];
-
-let NetscriptPorts = {
- Port1: [],
- Port2: [],
- Port3: [],
- Port4: [],
- Port5: [],
- Port6: [],
- Port7: [],
- Port8: [],
- Port9: [],
- Port10: [],
-}
-
-function prestigeWorkerScripts() {
- for (var i = 0; i < workerScripts.length; ++i) {
- Object(__WEBPACK_IMPORTED_MODULE_0__ActiveScriptsUI_js__["b" /* 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) {
- console.log("Deleting script: " + workerScripts[i].name);
- //Delete script from the runningScripts array on its host serverIp
- var ip = workerScripts[i].serverIp;
- var name = workerScripts[i].name;
-
- for (var j = 0; j < __WEBPACK_IMPORTED_MODULE_5__Server_js__["b" /* AllServers */][ip].runningScripts.length; j++) {
- if (__WEBPACK_IMPORTED_MODULE_5__Server_js__["b" /* AllServers */][ip].runningScripts[j].filename == name &&
- Object(__WEBPACK_IMPORTED_MODULE_9__utils_HelperFunctions_js__["c" /* compareArrays */])(__WEBPACK_IMPORTED_MODULE_5__Server_js__["b" /* AllServers */][ip].runningScripts[j].args, workerScripts[i].args)) {
- __WEBPACK_IMPORTED_MODULE_5__Server_js__["b" /* AllServers */][ip].runningScripts.splice(j, 1);
- break;
- }
- }
-
- //Free RAM
- __WEBPACK_IMPORTED_MODULE_5__Server_js__["b" /* AllServers */][ip].ramUsed -= workerScripts[i].ramUsage;
-
- //Delete script from Active Scripts
- Object(__WEBPACK_IMPORTED_MODULE_0__ActiveScriptsUI_js__["b" /* deleteActiveScriptsItem */])(workerScripts[i]);
-
- //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(__WEBPACK_IMPORTED_MODULE_7__utils_acorn_js__["parse"])(workerScripts[i].code);
- //console.log(ast);
- } catch (e) {
- console.log("Error parsing script: " + workerScripts[i].name);
- Object(__WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Syntax ERROR in " + workerScripts[i].name + ":
" + e);
- workerScripts[i].env.stopFlag = true;
- continue;
- }
-
- workerScripts[i].running = true;
- var p = Object(__WEBPACK_IMPORTED_MODULE_4__NetscriptEvaluator_js__["a" /* 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) {
- console.log(w);
- if (w instanceof Error) {
- Object(__WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__["a" /* 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(__WEBPACK_IMPORTED_MODULE_4__NetscriptEvaluator_js__["b" /* 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(__WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Script runtime error:
Server Ip: " + serverIp +
- "
Script name: " + scriptName +
- "
Args:" + Object(__WEBPACK_IMPORTED_MODULE_9__utils_HelperFunctions_js__["f" /* 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(__WEBPACK_IMPORTED_MODULE_4__NetscriptEvaluator_js__["b" /* isScriptErrorMessage */])(w)) {
- Object(__WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__["a" /* 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(__WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__["a" /* 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(__WEBPACK_IMPORTED_MODULE_9__utils_HelperFunctions_js__["c" /* compareArrays */])(workerScripts[i].args, runningScriptObj.args)) {
- workerScripts[i].env.stopFlag = true;
- Object(__WEBPACK_IMPORTED_MODULE_4__NetscriptEvaluator_js__["c" /* killNetscriptDelay */])(workerScripts[i]);
- if (workerScripts[i].fnWorker) {
- workerScripts[i].fnWorker.env.stopFlag = true;
- Object(__WEBPACK_IMPORTED_MODULE_4__NetscriptEvaluator_js__["c" /* killNetscriptDelay */])(workerScripts[i].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(__WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].MultithreadingRAMCost, threads-1);
- var ramAvailable = server.maxRam - server.ramUsed;
- if (ramUsage > ramAvailable) {
- Object(__WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Not enough RAM to run script " + runningScriptObj.filename + " with args " +
- Object(__WEBPACK_IMPORTED_MODULE_9__utils_HelperFunctions_js__["f" /* 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(__WEBPACK_IMPORTED_MODULE_0__ActiveScriptsUI_js__["a" /* 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 * __WEBPACK_IMPORTED_MODULE_2__engine_js__["Engine"]._idleSpeed) / 1000; //seconds
- for (var i = 0; i < workerScripts.length; ++i) {
- workerScripts[i].scriptRef.onlineRunningTime += time;
- }
-}
-
-
-
-
/***/ }),
/* 12 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return SpecialServerNames; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return SpecialServerIps; });
-/* unused harmony export SpecialServerIpsMap */
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return loadSpecialServerIps; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return prestigeSpecialServerIps; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return initSpecialServerIps; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_JSONReviver_js__ = __webpack_require__(8);
-
-
-/* Holds IP of Special Servers */
-let SpecialServerNames = {
- FulcrumSecretTechnologies: "Fulcrum Secret Technologies Server",
- CyberSecServer: "CyberSec Server",
- NiteSecServer: "NiteSec Server",
- TheBlackHandServer: "The Black Hand Server",
- BitRunnersServer: "BitRunners Server",
- TheDarkArmyServer: "The Dark Army Server",
- DaedalusServer: "Daedalus Server",
- WorldDaemon: "w0r1d_d43m0n",
-}
-function SpecialServerIpsMap() {}
-
-SpecialServerIpsMap.prototype.addIp = function(name, ip) {
- this[name] = ip;
-}
-
-SpecialServerIpsMap.prototype.toJSON = function() {
- return Object(__WEBPACK_IMPORTED_MODULE_0__utils_JSONReviver_js__["b" /* Generic_toJSON */])("SpecialServerIpsMap", this);
-}
-
-SpecialServerIpsMap.fromJSON = function(value) {
- return Object(__WEBPACK_IMPORTED_MODULE_0__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(SpecialServerIpsMap, value.data);
-}
-
-__WEBPACK_IMPORTED_MODULE_0__utils_JSONReviver_js__["c" /* Reviver */].constructors.SpecialServerIpsMap = SpecialServerIpsMap;
-
-let SpecialServerIps = new SpecialServerIpsMap();
-
-function prestigeSpecialServerIps() {
- for (var member in SpecialServerIps) {
- delete SpecialServerIps[member];
- }
- SpecialServerIps = null;
- SpecialServerIps = new SpecialServerIpsMap();
-}
-
-function loadSpecialServerIps(saveString) {
- SpecialServerIps = JSON.parse(saveString, __WEBPACK_IMPORTED_MODULE_0__utils_JSONReviver_js__["c" /* Reviver */]);
-}
-
-function initSpecialServerIps() {
- SpecialServerIps = new SpecialServerIpsMap();
-}
-
-
-
-
-/***/ }),
-/* 13 */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Locations; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return displayLocationContent; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return initLocationButtons; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Company_js__ = __webpack_require__(21);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Constants_js__ = __webpack_require__(3);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Crimes_js__ = __webpack_require__(32);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__engine_js__ = __webpack_require__(5);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Infiltration_js__ = __webpack_require__(50);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Server_js__ = __webpack_require__(6);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__ServerPurchases_js__ = __webpack_require__(70);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__SpecialServerIps_js__ = __webpack_require__(12);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__ = __webpack_require__(1);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_HelperFunctions_js__ = __webpack_require__(2);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__utils_IPAddress_js__ = __webpack_require__(17);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__utils_numeral_min_js__ = __webpack_require__(18);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__utils_numeral_min_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_12__utils_numeral_min_js__);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__ = __webpack_require__(4);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__utils_YesNoBox_js__ = __webpack_require__(22);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__CompanyManagement_js__ = __webpack_require__(31);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Constants_js__ = __webpack_require__(3);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Crimes_js__ = __webpack_require__(32);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__engine_js__ = __webpack_require__(5);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Infiltration_js__ = __webpack_require__(52);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Player_js__ = __webpack_require__(0);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Server_js__ = __webpack_require__(6);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__ServerPurchases_js__ = __webpack_require__(74);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__SpecialServerIps_js__ = __webpack_require__(13);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_DialogBox_js__ = __webpack_require__(1);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__utils_HelperFunctions_js__ = __webpack_require__(2);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__utils_IPAddress_js__ = __webpack_require__(19);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__utils_numeral_min_js__ = __webpack_require__(17);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__utils_numeral_min_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_13__utils_numeral_min_js__);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__utils_StringHelperFunctions_js__ = __webpack_require__(4);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__utils_YesNoBox_js__ = __webpack_require__(14);
+
@@ -18531,6 +18683,7 @@ let Locations = {
Sector12IronGym: "Iron Gym",
Sector12PowerhouseGym: "Powerhouse Gym",
Sector12Slums: "Sector-12 Slums",
+ Sector12CityHall: "Sector-12 City Hall",
//New Tokyo
NewTokyoTravelAgency: "New Tokyo Travel Agency",
@@ -18566,8 +18719,8 @@ let Locations = {
}
function displayLocationContent() {
- if (__WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].debug) {
- console.log("displayLocationContent() called with location " + __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location)
+ if (__WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].debug) {
+ console.log("displayLocationContent() called with location " + __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location)
}
var returnToWorld = document.getElementById("location-return-to-world-button");
@@ -18590,7 +18743,7 @@ function displayLocationContent() {
var waiterJob = document.getElementById("location-waiter-job");
var waiterPartTimeJob = document.getElementById("location-parttime-waiter-job");
- var work = Object(__WEBPACK_IMPORTED_MODULE_10__utils_HelperFunctions_js__["b" /* clearEventListeners */])("location-work");
+ var work = Object(__WEBPACK_IMPORTED_MODULE_11__utils_HelperFunctions_js__["b" /* clearEventListeners */])("location-work");
var jobTitle = document.getElementById("location-job-title");
var jobReputation = document.getElementById("location-job-reputation");
@@ -18633,7 +18786,7 @@ function displayLocationContent() {
var travelToIshima = document.getElementById("location-travel-to-ishima");
var travelToVolhaven = document.getElementById("location-travel-to-volhaven");
- var infiltrate = Object(__WEBPACK_IMPORTED_MODULE_10__utils_HelperFunctions_js__["b" /* clearEventListeners */])("location-infiltrate");
+ var infiltrate = Object(__WEBPACK_IMPORTED_MODULE_11__utils_HelperFunctions_js__["b" /* clearEventListeners */])("location-infiltrate");
var hospitalTreatment = document.getElementById("location-hospital-treatment");
@@ -18651,10 +18804,12 @@ function displayLocationContent() {
var slumsAssassinate = document.getElementById("location-slums-assassinate");
var slumsHeist = document.getElementById("location-slums-heist");
- var loc = __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location;
+ var cityHallCreateCorporation = document.getElementById("location-cityhall-create-corporation");
+
+ var loc = __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location;
returnToWorld.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadWorldContent();
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadWorldContent();
});
locationName.innerHTML = loc;
@@ -18718,17 +18873,17 @@ function displayLocationContent() {
purchaseHomeRam.style.display = "none";
purchaseHomeCores.style.display = "none";
- purchase2gb.innerHTML = "Purchase 2GB Server - $" + Object(__WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__["c" /* formatNumber */])(2*__WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer, 2);
- purchase4gb.innerHTML = "Purchase 4GB Server - $" + Object(__WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__["c" /* formatNumber */])(4*__WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer, 2);
- purchase8gb.innerHTML = "Purchase 8GB Server - $" + Object(__WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__["c" /* formatNumber */])(8*__WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer, 2);
- purchase16gb.innerHTML = "Purchase 16GB Server - $" + Object(__WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__["c" /* formatNumber */])(16*__WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer, 2);
- purchase32gb.innerHTML = "Purchase 32GB Server - $" + Object(__WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__["c" /* formatNumber */])(32*__WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer, 2);
- purchase64gb.innerHTML = "Purchase 64GB Server - $" + Object(__WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__["c" /* formatNumber */])(64*__WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer, 2);
- purchase128gb.innerHTML = "Purchase 128GB Server - $" + Object(__WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__["c" /* formatNumber */])(128*__WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer, 2);
- purchase256gb.innerHTML = "Purchase 256GB Server - $" + Object(__WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__["c" /* formatNumber */])(256*__WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer, 2);
- purchase512gb.innerHTML = "Purchase 512GB Server - $" + Object(__WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__["c" /* formatNumber */])(512*__WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer, 2);
- purchase1tb.innerHTML = "Purchase 1TB Server - $" + Object(__WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__["c" /* formatNumber */])(1024*__WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer, 2);
- purchaseTor.innerHTML = "Purchase TOR Router - $" + Object(__WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].TorRouterCost, 2);
+ purchase2gb.innerHTML = "Purchase 2GB Server - $" + Object(__WEBPACK_IMPORTED_MODULE_14__utils_StringHelperFunctions_js__["c" /* formatNumber */])(2*__WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer, 2);
+ purchase4gb.innerHTML = "Purchase 4GB Server - $" + Object(__WEBPACK_IMPORTED_MODULE_14__utils_StringHelperFunctions_js__["c" /* formatNumber */])(4*__WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer, 2);
+ purchase8gb.innerHTML = "Purchase 8GB Server - $" + Object(__WEBPACK_IMPORTED_MODULE_14__utils_StringHelperFunctions_js__["c" /* formatNumber */])(8*__WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer, 2);
+ purchase16gb.innerHTML = "Purchase 16GB Server - $" + Object(__WEBPACK_IMPORTED_MODULE_14__utils_StringHelperFunctions_js__["c" /* formatNumber */])(16*__WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer, 2);
+ purchase32gb.innerHTML = "Purchase 32GB Server - $" + Object(__WEBPACK_IMPORTED_MODULE_14__utils_StringHelperFunctions_js__["c" /* formatNumber */])(32*__WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer, 2);
+ purchase64gb.innerHTML = "Purchase 64GB Server - $" + Object(__WEBPACK_IMPORTED_MODULE_14__utils_StringHelperFunctions_js__["c" /* formatNumber */])(64*__WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer, 2);
+ purchase128gb.innerHTML = "Purchase 128GB Server - $" + Object(__WEBPACK_IMPORTED_MODULE_14__utils_StringHelperFunctions_js__["c" /* formatNumber */])(128*__WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer, 2);
+ purchase256gb.innerHTML = "Purchase 256GB Server - $" + Object(__WEBPACK_IMPORTED_MODULE_14__utils_StringHelperFunctions_js__["c" /* formatNumber */])(256*__WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer, 2);
+ purchase512gb.innerHTML = "Purchase 512GB Server - $" + Object(__WEBPACK_IMPORTED_MODULE_14__utils_StringHelperFunctions_js__["c" /* formatNumber */])(512*__WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer, 2);
+ purchase1tb.innerHTML = "Purchase 1TB Server - $" + Object(__WEBPACK_IMPORTED_MODULE_14__utils_StringHelperFunctions_js__["c" /* formatNumber */])(1024*__WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer, 2);
+ purchaseTor.innerHTML = "Purchase TOR Router - $" + Object(__WEBPACK_IMPORTED_MODULE_14__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].TorRouterCost, 2);
travelAgencyText.style.display = "none";
travelToAevum.style.display = "none";
@@ -18756,9 +18911,11 @@ function displayLocationContent() {
slumsAssassinate.style.display = "none";
slumsHeist.style.display = "none";
+ cityHallCreateCorporation.style.display = "none";
+
//Check if the player is employed at this Location. If he is, display the "Work" button,
//update the job title, etc.
- if (loc != "" && loc === __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].companyName) {
+ if (loc != "" && loc === __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].companyName) {
var company = __WEBPACK_IMPORTED_MODULE_0__Company_js__["a" /* Companies */][loc];
jobTitle.style.display = "block";
@@ -18767,28 +18924,28 @@ function displayLocationContent() {
locationTxtDiv1.style.display = "block";
locationTxtDiv2.style.display = "block";
locationTxtDiv3.style.display = "block";
- jobTitle.innerHTML = "Job Title: " + __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].companyPosition.positionName;
+ jobTitle.innerHTML = "Job Title: " + __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].companyPosition.positionName;
var repGain = company.getFavorGain();
if (repGain.length != 2) {repGain = 0;}
repGain = repGain[0];
- jobReputation.innerHTML = "Company reputation: " + Object(__WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__["c" /* formatNumber */])(company.playerReputation, 4) +
+ jobReputation.innerHTML = "Company reputation: " + Object(__WEBPACK_IMPORTED_MODULE_14__utils_StringHelperFunctions_js__["c" /* formatNumber */])(company.playerReputation, 4) +
"You will earn " +
- Object(__WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__["c" /* formatNumber */])(repGain, 4) +
+ Object(__WEBPACK_IMPORTED_MODULE_14__utils_StringHelperFunctions_js__["c" /* formatNumber */])(repGain, 4) +
" faction favor upon resetting after installing an Augmentation";
- companyFavor.innerHTML = "Company Favor: " + Object(__WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__["c" /* formatNumber */])(company.favor, 4) +
+ companyFavor.innerHTML = "Company Favor: " + Object(__WEBPACK_IMPORTED_MODULE_14__utils_StringHelperFunctions_js__["c" /* formatNumber */])(company.favor, 4) +
"Company favor increases the rate at which " +
"you earn reputation for this company by 1% per favor. Company favor " +
"is gained whenever you reset after installing an Augmentation. The amount of " +
"favor you gain depends on how much reputation you have with the company";
work.style.display = "block";
- var currPos = __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].companyPosition;
+ var currPos = __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].companyPosition;
work.addEventListener("click", function() {
if (currPos.isPartTimeJob()) {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].startWorkPartTime();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].startWorkPartTime();
} else {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].startWork();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].startWork();
}
return false;
});
@@ -18823,8 +18980,8 @@ function displayLocationContent() {
}
//Calculate hospital Cost
- if (__WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].hp < 0) {__WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].hp = 0;}
- var hospitalTreatmentCost = (__WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].max_hp - __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].hp) * __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].HospitalCostPerHp;
+ if (__WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].hp < 0) {__WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].hp = 0;}
+ var hospitalTreatmentCost = (__WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].max_hp - __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].hp) * __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].HospitalCostPerHp;
//Set tooltip for job requirements
setJobRequirementTooltip(loc, __WEBPACK_IMPORTED_MODULE_0__Company_js__["d" /* CompanyPositions */].SoftwareIntern, softwareJob);
@@ -19222,6 +19379,15 @@ function displayLocationContent() {
setGymLocationButtons(costMult, expMult);
break;
+ case Locations.Sector12CityHall:
+ cityHallCreateCorporation.style.display = "block";
+ if (__WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].corporation instanceof __WEBPACK_IMPORTED_MODULE_1__CompanyManagement_js__["a" /* Corporation */]) {
+ cityHallCreateCorporation.className = "a-link-button-inactive";
+ } else {
+ cityHallCreateCorporation.className = "a-link-button";
+ }
+ break;
+
case Locations.NewTokyoTravelAgency:
travelAgencyText.style.display = "block";
travelToAevum.style.display = "block";
@@ -19472,18 +19638,18 @@ function displayLocationContent() {
case Locations.NewTokyoSlums:
case Locations.IshimaSlums:
case Locations.VolhavenSlums:
- var shopliftChance = Object(__WEBPACK_IMPORTED_MODULE_2__Crimes_js__["w" /* determineCrimeChanceShoplift */])();
- var robStoreChance = Object(__WEBPACK_IMPORTED_MODULE_2__Crimes_js__["v" /* determineCrimeChanceRobStore */])();
- var mugChance = Object(__WEBPACK_IMPORTED_MODULE_2__Crimes_js__["u" /* determineCrimeChanceMug */])();
- var larcenyChance = Object(__WEBPACK_IMPORTED_MODULE_2__Crimes_js__["t" /* determineCrimeChanceLarceny */])();
- var drugsChance = Object(__WEBPACK_IMPORTED_MODULE_2__Crimes_js__["o" /* determineCrimeChanceDealDrugs */])();
- var bondChance = Object(__WEBPACK_IMPORTED_MODULE_2__Crimes_js__["n" /* determineCrimeChanceBondForgery */])();
- var armsChance = Object(__WEBPACK_IMPORTED_MODULE_2__Crimes_js__["x" /* determineCrimeChanceTraffickArms */])();
- var homicideChance = Object(__WEBPACK_IMPORTED_MODULE_2__Crimes_js__["r" /* determineCrimeChanceHomicide */])();
- var gtaChance = Object(__WEBPACK_IMPORTED_MODULE_2__Crimes_js__["p" /* determineCrimeChanceGrandTheftAuto */])();
- var kidnapChance = Object(__WEBPACK_IMPORTED_MODULE_2__Crimes_js__["s" /* determineCrimeChanceKidnap */])();
- var assassinateChance = Object(__WEBPACK_IMPORTED_MODULE_2__Crimes_js__["m" /* determineCrimeChanceAssassination */])();
- var heistChance = Object(__WEBPACK_IMPORTED_MODULE_2__Crimes_js__["q" /* determineCrimeChanceHeist */])();
+ var shopliftChance = Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["w" /* determineCrimeChanceShoplift */])();
+ var robStoreChance = Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["v" /* determineCrimeChanceRobStore */])();
+ var mugChance = Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["u" /* determineCrimeChanceMug */])();
+ var larcenyChance = Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["t" /* determineCrimeChanceLarceny */])();
+ var drugsChance = Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["o" /* determineCrimeChanceDealDrugs */])();
+ var bondChance = Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["n" /* determineCrimeChanceBondForgery */])();
+ var armsChance = Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["x" /* determineCrimeChanceTraffickArms */])();
+ var homicideChance = Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["r" /* determineCrimeChanceHomicide */])();
+ var gtaChance = Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["p" /* determineCrimeChanceGrandTheftAuto */])();
+ var kidnapChance = Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["s" /* determineCrimeChanceKidnap */])();
+ var assassinateChance = Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["m" /* determineCrimeChanceAssassination */])();
+ var heistChance = Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["q" /* determineCrimeChanceHeist */])();
slumsDescText.style.display = "block";
slumsShoplift.style.display = "block";
@@ -19526,19 +19692,18 @@ function displayLocationContent() {
//Hospital
case Locations.Hospital:
- hospitalTreatment.innerText = "Get treatment for wounds - $" + Object(__WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__["c" /* formatNumber */])(hospitalTreatmentCost, 2).toString();
+ hospitalTreatment.innerText = "Get treatment for wounds - $" + Object(__WEBPACK_IMPORTED_MODULE_14__utils_StringHelperFunctions_js__["c" /* formatNumber */])(hospitalTreatmentCost, 2).toString();
hospitalTreatment.style.display = "block";
break;
default:
console.log("ERROR: INVALID LOCATION");
-
}
//Make the "Apply to be Employee and Waiter" texts disappear if you already hold the job
//Includes part-time stuff
- if (loc == __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].companyName) {
- var currPos = __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].companyPosition;
+ if (loc == __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].companyName) {
+ var currPos = __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].companyPosition;
if (currPos.positionName == __WEBPACK_IMPORTED_MODULE_0__Company_js__["d" /* CompanyPositions */].Employee.positionName) {
employeeJob.style.display = "none";
@@ -19556,456 +19721,463 @@ function initLocationButtons() {
//Buttons to travel to different locations in World
let aevumTravelAgency = document.getElementById("aevum-travelagency");
aevumTravelAgency.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.AevumTravelAgency;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.AevumTravelAgency;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let aevumHospital = document.getElementById("aevum-hospital");
aevumHospital.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.Hospital;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.Hospital;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let aevumSummitUniversity = document.getElementById("aevum-summituniversity");
aevumSummitUniversity.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.AevumSummitUniversity;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.AevumSummitUniversity;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let aevumECorp = document.getElementById("aevum-ecorp");
aevumECorp.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.AevumECorp;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.AevumECorp;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let aevumBachmanAndAssociates = document.getElementById("aevum-bachmanandassociates");
aevumBachmanAndAssociates.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.AevumBachmanAndAssociates;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.AevumBachmanAndAssociates;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let aevumClarkeIncorporated = document.getElementById("aevum-clarkeincorporated");
aevumClarkeIncorporated.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.AevumClarkeIncorporated;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.AevumClarkeIncorporated;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let aevumFulcrumTechnologies = document.getElementById("aevum-fulcrumtechnologies");
aevumFulcrumTechnologies.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.AevumFulcrumTechnologies;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.AevumFulcrumTechnologies;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let aevumAeroCorp = document.getElementById("aevum-aerocorp");
aevumAeroCorp.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.AevumAeroCorp;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.AevumAeroCorp;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let aevumGalacticCybersystems = document.getElementById("aevum-galacticcybersystems");
aevumGalacticCybersystems.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.AevumGalacticCybersystems;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.AevumGalacticCybersystems;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let aevumWatchdogSecurity = document.getElementById("aevum-watchdogsecurity");
aevumWatchdogSecurity.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.AevumWatchdogSecurity;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.AevumWatchdogSecurity;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let aevumRhoConstruction = document.getElementById("aevum-rhoconstruction");
aevumRhoConstruction.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.AevumRhoConstruction;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.AevumRhoConstruction;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let aevumPolice = document.getElementById("aevum-aevumpolice");
aevumPolice.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.AevumPolice;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.AevumPolice;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let aevumNetLinkTechnologies = document.getElementById("aevum-netlinktechnologies");
aevumNetLinkTechnologies.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.AevumNetLinkTechnologies;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.AevumNetLinkTechnologies;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let aevumCrushFitnessGym = document.getElementById("aevum-crushfitnessgym");
aevumCrushFitnessGym.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.AevumCrushFitnessGym;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.AevumCrushFitnessGym;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let aevumSnapFitnessGym = document.getElementById("aevum-snapfitnessgym");
aevumSnapFitnessGym.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.AevumSnapFitnessGym;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.AevumSnapFitnessGym;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let aevumSlums = document.getElementById("aevum-slums");
aevumSlums.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.AevumSlums;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.AevumSlums;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let chongqingTravelAgency = document.getElementById("chongqing-travelagency");
chongqingTravelAgency.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.ChongqingTravelAgency;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.ChongqingTravelAgency;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let chongqingHospital = document.getElementById("chongqing-hospital");
chongqingHospital.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.Hospital;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.Hospital;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let chongqingKuaiGongInternational = document.getElementById("chongqing-kuaigonginternational");
chongqingKuaiGongInternational.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.ChongqingKuaiGongInternational;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.ChongqingKuaiGongInternational;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let chongqingSolarisSpaceSystems = document.getElementById("chongqing-solarisspacesystems");
chongqingSolarisSpaceSystems.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.ChongqingSolarisSpaceSystems;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.ChongqingSolarisSpaceSystems;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let chongqingSlums = document.getElementById("chongqing-slums");
chongqingSlums.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.ChongqingSlums;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.ChongqingSlums;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let sector12TravelAgency = document.getElementById("sector12-travelagency");
sector12TravelAgency.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.Sector12TravelAgency;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.Sector12TravelAgency;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let sector12Hospital = document.getElementById("sector12-hospital");
sector12Hospital.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.Hospital;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.Hospital;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let sector12RothmanUniversity = document.getElementById("sector12-rothmanuniversity");
sector12RothmanUniversity.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.Sector12RothmanUniversity;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.Sector12RothmanUniversity;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let sector12MegaCorp = document.getElementById("sector12-megacorp");
sector12MegaCorp.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.Sector12MegaCorp;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.Sector12MegaCorp;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let sector12BladeIndustries = document.getElementById("sector12-bladeindustries");
sector12BladeIndustries.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.Sector12BladeIndustries;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.Sector12BladeIndustries;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let sector12FourSigma = document.getElementById("sector12-foursigma");
sector12FourSigma.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.Sector12FourSigma;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.Sector12FourSigma;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let sector12IcarusMicrosystems = document.getElementById("sector12-icarusmicrosystems");
sector12IcarusMicrosystems.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.Sector12IcarusMicrosystems;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.Sector12IcarusMicrosystems;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let sector12UniversalEnergy = document.getElementById("sector12-universalenergy");
sector12UniversalEnergy.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.Sector12UniversalEnergy;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.Sector12UniversalEnergy;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let sector12DeltaOne = document.getElementById("sector12-deltaone");
sector12DeltaOne.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.Sector12DeltaOne;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.Sector12DeltaOne;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let sector12CIA = document.getElementById("sector12-cia");
sector12CIA.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.Sector12CIA;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.Sector12CIA;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let sector12NSA = document.getElementById("sector12-nsa");
sector12NSA.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.Sector12NSA;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.Sector12NSA;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let sector12AlphaEnterprises = document.getElementById("sector12-alphaenterprises");
sector12AlphaEnterprises.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.Sector12AlphaEnterprises;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.Sector12AlphaEnterprises;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let sector12CarmichaelSecurity = document.getElementById("sector12-carmichaelsecurity");
sector12CarmichaelSecurity.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.Sector12CarmichaelSecurity;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.Sector12CarmichaelSecurity;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let sector12FoodNStuff = document.getElementById("sector12-foodnstuff");
sector12FoodNStuff.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.Sector12FoodNStuff;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.Sector12FoodNStuff;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let sector12JoesGuns = document.getElementById("sector12-joesguns");
sector12JoesGuns.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.Sector12JoesGuns;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.Sector12JoesGuns;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let sector12IronGym = document.getElementById("sector12-irongym");
sector12IronGym.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.Sector12IronGym;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.Sector12IronGym;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let sector12PowerhouseGym = document.getElementById("sector12-powerhousegym");
sector12PowerhouseGym.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.Sector12PowerhouseGym;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.Sector12PowerhouseGym;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let sector12Slums = document.getElementById("sector12-slums");
sector12Slums.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.Sector12Slums;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.Sector12Slums;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
+ return false;
+ });
+
+ let sector12CityHall = document.getElementById("sector12-cityhall");
+ sector12CityHall.addEventListener("click", function() {
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.Sector12CityHall;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let newTokyoTravelAgency = document.getElementById("newtokyo-travelagency");
newTokyoTravelAgency.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.NewTokyoTravelAgency;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.NewTokyoTravelAgency;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let newTokyoHospital = document.getElementById("newtokyo-hospital");
newTokyoHospital.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.Hospital;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.Hospital;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let newTokyoDefComm = document.getElementById("newtokyo-defcomm");
newTokyoDefComm.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.NewTokyoDefComm;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.NewTokyoDefComm;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let newTokyoVitaLife = document.getElementById("newtokyo-vitalife");
newTokyoVitaLife.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.NewTokyoVitaLife;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.NewTokyoVitaLife;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let newTokyoGlobalPharmaceuticals = document.getElementById("newtokyo-globalpharmaceuticals");
newTokyoGlobalPharmaceuticals.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.NewTokyoGlobalPharmaceuticals;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.NewTokyoGlobalPharmaceuticals;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let newTokyoNoodleBar = document.getElementById("newtokyo-noodlebar");
newTokyoNoodleBar.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.NewTokyoNoodleBar;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.NewTokyoNoodleBar;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let newTokyoSlums = document.getElementById("newtokyo-slums");
newTokyoSlums.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.NewTokyoSlums;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.NewTokyoSlums;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let ishimaTravelAgency = document.getElementById("ishima-travelagency");
ishimaTravelAgency.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.IshimaTravelAgency;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.IshimaTravelAgency;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let ishimaHospital = document.getElementById("ishima-hospital");
ishimaHospital.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.Hospital;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.Hospital;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let ishimaStormTechnologies = document.getElementById("ishima-stormtechnologies");
ishimaStormTechnologies.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.IshimaStormTechnologies;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.IshimaStormTechnologies;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let ishimaNovaMedical = document.getElementById("ishima-novamedical");
ishimaNovaMedical.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.IshimaNovaMedical;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.IshimaNovaMedical;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let ishimaOmegaSoftware = document.getElementById("ishima-omegasoftware");
ishimaOmegaSoftware.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.IshimaOmegaSoftware;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.IshimaOmegaSoftware;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let ishimaSlums = document.getElementById("ishima-slums");
ishimaSlums.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.IshimaSlums;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.IshimaSlums;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let volhavenTravelAgency = document.getElementById("volhaven-travelagency");
volhavenTravelAgency.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.VolhavenTravelAgency;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.VolhavenTravelAgency;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let volhavenHospital = document.getElementById("volhaven-hospital");
volhavenHospital.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.Hospital;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.Hospital;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let volhavenZBInstituteOfTechnology = document.getElementById("volhaven-zbinstituteoftechnology");
volhavenZBInstituteOfTechnology.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.VolhavenZBInstituteOfTechnology;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.VolhavenZBInstituteOfTechnology;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let volhavenOmniTekIncorporated = document.getElementById("volhaven-omnitekincorporated");
volhavenOmniTekIncorporated.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.VolhavenOmniTekIncorporated;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.VolhavenOmniTekIncorporated;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let volhavenNWO = document.getElementById("volhaven-nwo");
volhavenNWO.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.VolhavenNWO;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.VolhavenNWO;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let volhavenHeliosLabs = document.getElementById("volhaven-helioslabs");
volhavenHeliosLabs.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.VolhavenHeliosLabs;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.VolhavenHeliosLabs;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let volhavenOmniaCybersystems = document.getElementById("volhaven-omniacybersystems");
volhavenOmniaCybersystems.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.VolhavenOmniaCybersystems;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.VolhavenOmniaCybersystems;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let volhavenLexoCorp = document.getElementById("volhaven-lexocorp");
volhavenLexoCorp.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.VolhavenLexoCorp;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.VolhavenLexoCorp;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let volhavenSysCoreSecurities = document.getElementById("volhaven-syscoresecurities");
volhavenSysCoreSecurities.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.VolhavenSysCoreSecurities;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.VolhavenSysCoreSecurities;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let volhavenCompuTek = document.getElementById("volhaven-computek");
volhavenCompuTek.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.VolhavenCompuTek;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.VolhavenCompuTek;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let volhavenMilleniumFitnessGym = document.getElementById("volhaven-milleniumfitnessgym");
volhavenMilleniumFitnessGym.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.VolhavenMilleniumFitnessGym;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.VolhavenMilleniumFitnessGym;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let volhavenSlums = document.getElementById("volhaven-slums");
volhavenSlums.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.VolhavenSlums;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadLocationContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.VolhavenSlums;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadLocationContent();
return false;
});
let worldStockExchange = document.getElementById("generic-location-wse");
worldStockExchange.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].location = Locations.WorldStockExchange;
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadStockMarketContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].location = Locations.WorldStockExchange;
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadStockMarketContent();
return false;
});
@@ -20061,120 +20233,122 @@ function initLocationButtons() {
var slumsAssassinate = document.getElementById("location-slums-assassinate");
var slumsHeist = document.getElementById("location-slums-heist");
+ var cityHallCreateCorporation = document.getElementById("location-cityhall-create-corporation");
+
var hospitalTreatment = document.getElementById("location-hospital-treatment");
softwareJob.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].applyForSoftwareJob();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].applyForSoftwareJob();
return false;
});
softwareConsultantJob.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].applyForSoftwareConsultantJob();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].applyForSoftwareConsultantJob();
return false;
});
itJob.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].applyForItJob();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].applyForItJob();
return false;
});
securityEngineerJob.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].applyForSecurityEngineerJob();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].applyForSecurityEngineerJob();
return false;
});
networkEngineerJob.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].applyForNetworkEngineerJob();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].applyForNetworkEngineerJob();
return false;
});
businessJob.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].applyForBusinessJob();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].applyForBusinessJob();
return false;
});
businessConsultantJob.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].applyForBusinessConsultantJob();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].applyForBusinessConsultantJob();
return false;
});
securityJob.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].applyForSecurityJob();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].applyForSecurityJob();
return false;
});
agentJob.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].applyForAgentJob();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].applyForAgentJob();
return false;
});
employeeJob.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].applyForEmployeeJob();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].applyForEmployeeJob();
return false;
});
employeePartTimeJob.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].applyForPartTimeEmployeeJob();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].applyForPartTimeEmployeeJob();
return false;
});
waiterJob.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].applyForWaiterJob();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].applyForWaiterJob();
return false;
});
waiterPartTimeJob.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].applyForPartTimeWaiterJob();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].applyForPartTimeWaiterJob();
return false;
});
purchase2gb.addEventListener("click", function() {
- purchaseServerBoxCreate(2, 2 * __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer);
+ purchaseServerBoxCreate(2, 2 * __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer);
return false;
});
purchase4gb.addEventListener("click", function() {
- purchaseServerBoxCreate(4, 4 * __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer);
+ purchaseServerBoxCreate(4, 4 * __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer);
return false;
});
purchase8gb.addEventListener("click", function() {
- purchaseServerBoxCreate(8, 8 * __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer);
+ purchaseServerBoxCreate(8, 8 * __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer);
return false;
});
purchase16gb.addEventListener("click", function() {
- purchaseServerBoxCreate(16, 16 * __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer);
+ purchaseServerBoxCreate(16, 16 * __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer);
return false;
});
purchase32gb.addEventListener("click", function() {
- purchaseServerBoxCreate(32, 32 * __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer);
+ purchaseServerBoxCreate(32, 32 * __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer);
return false;
});
purchase64gb.addEventListener("click", function() {
- purchaseServerBoxCreate(64, 64 * __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer);
+ purchaseServerBoxCreate(64, 64 * __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer);
return false;
});
purchase128gb.addEventListener("click", function() {
- purchaseServerBoxCreate(128, 128 * __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer);
+ purchaseServerBoxCreate(128, 128 * __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer);
return false;
});
purchase256gb.addEventListener("click", function() {
- purchaseServerBoxCreate(256, 256 * __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer);
+ purchaseServerBoxCreate(256, 256 * __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer);
return false;
});
purchase512gb.addEventListener("click", function() {
- purchaseServerBoxCreate(512, 512 * __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer);
+ purchaseServerBoxCreate(512, 512 * __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer);
return false;
});
purchase1tb.addEventListener("click", function() {
- purchaseServerBoxCreate(1024, 1024 * __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer);
+ purchaseServerBoxCreate(1024, 1024 * __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer);
return false;
});
@@ -20185,32 +20359,32 @@ function initLocationButtons() {
purchaseHomeRam.addEventListener("click", function() {
//Calculate how many times ram has been upgraded (doubled)
- var currentRam = __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].getHomeComputer().maxRam;
+ var currentRam = __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].getHomeComputer().maxRam;
var newRam = currentRam * 2;
var numUpgrades = Math.log2(currentRam);
//Calculate cost
//Have cost increase by some percentage each time RAM has been upgraded
- var cost = currentRam * __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamHome;
+ var cost = currentRam * __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamHome;
var mult = Math.pow(1.55, numUpgrades);
cost = cost * mult;
- var yesBtn = Object(__WEBPACK_IMPORTED_MODULE_14__utils_YesNoBox_js__["d" /* yesNoBoxGetYesButton */])(), noBtn = Object(__WEBPACK_IMPORTED_MODULE_14__utils_YesNoBox_js__["c" /* yesNoBoxGetNoButton */])();
+ var yesBtn = Object(__WEBPACK_IMPORTED_MODULE_15__utils_YesNoBox_js__["d" /* yesNoBoxGetYesButton */])(), noBtn = Object(__WEBPACK_IMPORTED_MODULE_15__utils_YesNoBox_js__["c" /* yesNoBoxGetNoButton */])();
yesBtn.innerHTML = "Purchase"; noBtn.innerHTML = "Cancel";
yesBtn.addEventListener("click", ()=>{
- Object(__WEBPACK_IMPORTED_MODULE_7__ServerPurchases_js__["a" /* purchaseRamForHomeComputer */])(cost);
- Object(__WEBPACK_IMPORTED_MODULE_14__utils_YesNoBox_js__["a" /* yesNoBoxClose */])();
+ Object(__WEBPACK_IMPORTED_MODULE_8__ServerPurchases_js__["a" /* purchaseRamForHomeComputer */])(cost);
+ Object(__WEBPACK_IMPORTED_MODULE_15__utils_YesNoBox_js__["a" /* yesNoBoxClose */])();
});
noBtn.addEventListener("click", ()=>{
- Object(__WEBPACK_IMPORTED_MODULE_14__utils_YesNoBox_js__["a" /* yesNoBoxClose */])();
+ Object(__WEBPACK_IMPORTED_MODULE_15__utils_YesNoBox_js__["a" /* yesNoBoxClose */])();
});
- Object(__WEBPACK_IMPORTED_MODULE_14__utils_YesNoBox_js__["b" /* yesNoBoxCreate */])("Would you like to purchase additional RAM for your home computer?
" +
+ Object(__WEBPACK_IMPORTED_MODULE_15__utils_YesNoBox_js__["b" /* yesNoBoxCreate */])("Would you like to purchase additional RAM for your home computer?
" +
"This will upgrade your RAM from " + currentRam + "GB to " + newRam + "GB.
" +
- "This will cost $" + Object(__WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__["c" /* formatNumber */])(cost, 2));
+ "This will cost $" + Object(__WEBPACK_IMPORTED_MODULE_14__utils_StringHelperFunctions_js__["c" /* formatNumber */])(cost, 2));
});
purchaseHomeCores.addEventListener("click", function() {
- var currentCores = __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].getHomeComputer().cpuCores;
+ var currentCores = __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].getHomeComputer().cpuCores;
if (currentCores >= 8) {return;} //Max of 8 cores
//Cost of purchasing another cost is found by indexing this array with number of current cores
@@ -20223,26 +20397,26 @@ function initLocationButtons() {
20000000000000000, //6->7 Cores - 20 quadrillion
200000000000000000]; //7->8 Cores - 200 quadrillion
cost = cost[currentCores];
- var yesBtn = Object(__WEBPACK_IMPORTED_MODULE_14__utils_YesNoBox_js__["d" /* yesNoBoxGetYesButton */])(), noBtn = Object(__WEBPACK_IMPORTED_MODULE_14__utils_YesNoBox_js__["c" /* yesNoBoxGetNoButton */])();
+ var yesBtn = Object(__WEBPACK_IMPORTED_MODULE_15__utils_YesNoBox_js__["d" /* yesNoBoxGetYesButton */])(), noBtn = Object(__WEBPACK_IMPORTED_MODULE_15__utils_YesNoBox_js__["c" /* yesNoBoxGetNoButton */])();
yesBtn.innerHTML = "Purchase"; noBtn.innerHTML = "Cancel";
yesBtn.addEventListener("click", ()=>{
- if (__WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].money.lt(cost)) {
- Object(__WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You do not have enough mone to purchase an additional CPU Core for your home computer!");
+ if (__WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].money.lt(cost)) {
+ Object(__WEBPACK_IMPORTED_MODULE_10__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You do not have enough mone to purchase an additional CPU Core for your home computer!");
} else {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].loseMoney(cost);
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].getHomeComputer().cpuCores++;
- Object(__WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You purchased an additional CPU Core for your home computer! It now has " +
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].getHomeComputer().cpuCores + " cores.");
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].loseMoney(cost);
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].getHomeComputer().cpuCores++;
+ Object(__WEBPACK_IMPORTED_MODULE_10__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You purchased an additional CPU Core for your home computer! It now has " +
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].getHomeComputer().cpuCores + " cores.");
}
- Object(__WEBPACK_IMPORTED_MODULE_14__utils_YesNoBox_js__["a" /* yesNoBoxClose */])();
+ Object(__WEBPACK_IMPORTED_MODULE_15__utils_YesNoBox_js__["a" /* yesNoBoxClose */])();
});
noBtn.addEventListener("click", ()=>{
- Object(__WEBPACK_IMPORTED_MODULE_14__utils_YesNoBox_js__["a" /* yesNoBoxClose */])();
+ Object(__WEBPACK_IMPORTED_MODULE_15__utils_YesNoBox_js__["a" /* yesNoBoxClose */])();
});
- Object(__WEBPACK_IMPORTED_MODULE_14__utils_YesNoBox_js__["b" /* yesNoBoxCreate */])("Would you like to purchase an additional CPU Core for your home computer? Each CPU Core " +
+ Object(__WEBPACK_IMPORTED_MODULE_15__utils_YesNoBox_js__["b" /* yesNoBoxCreate */])("Would you like to purchase an additional CPU Core for your home computer? Each CPU Core " +
"lets you start with an additional Core Node in Hacking Missions.
" +
- "Purchasing an additional core (for a total of " + (__WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].getHomeComputer().cpuCores + 1) + ") will " +
- "cost " + __WEBPACK_IMPORTED_MODULE_12__utils_numeral_min_js___default()(cost).format('$0.000a'));
+ "Purchasing an additional core (for a total of " + (__WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].getHomeComputer().cpuCores + 1) + ") will " +
+ "cost " + __WEBPACK_IMPORTED_MODULE_13__utils_numeral_min_js___default()(cost).format('$0.000a'));
});
travelToAevum.addEventListener("click", function() {
@@ -20276,112 +20450,148 @@ function initLocationButtons() {
});
slumsShoplift.addEventListener("click", function() {
- Object(__WEBPACK_IMPORTED_MODULE_2__Crimes_js__["k" /* commitShopliftCrime */])();
+ Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["k" /* commitShopliftCrime */])();
return false;
});
slumsRobStore.addEventListener("click", function() {
- Object(__WEBPACK_IMPORTED_MODULE_2__Crimes_js__["j" /* commitRobStoreCrime */])();
+ Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["j" /* commitRobStoreCrime */])();
return false;
});
slumsMug.addEventListener("click", function() {
- Object(__WEBPACK_IMPORTED_MODULE_2__Crimes_js__["i" /* commitMugCrime */])();
+ Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["i" /* commitMugCrime */])();
return false;
});
slumsLarceny.addEventListener("click", function() {
- Object(__WEBPACK_IMPORTED_MODULE_2__Crimes_js__["h" /* commitLarcenyCrime */])();
+ Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["h" /* commitLarcenyCrime */])();
return false;
});
slumsDealDrugs.addEventListener("click", function() {
- Object(__WEBPACK_IMPORTED_MODULE_2__Crimes_js__["c" /* commitDealDrugsCrime */])();
+ Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["c" /* commitDealDrugsCrime */])();
return false;
});
slumsBondForgery.addEventListener("click", function() {
- Object(__WEBPACK_IMPORTED_MODULE_2__Crimes_js__["b" /* commitBondForgeryCrime */])();
+ Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["b" /* commitBondForgeryCrime */])();
return false;
});
slumsTrafficArms.addEventListener("click", function() {
- Object(__WEBPACK_IMPORTED_MODULE_2__Crimes_js__["l" /* commitTraffickArmsCrime */])();
+ Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["l" /* commitTraffickArmsCrime */])();
return false;
});
slumsHomicide.addEventListener("click", function() {
- Object(__WEBPACK_IMPORTED_MODULE_2__Crimes_js__["f" /* commitHomicideCrime */])();
+ Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["f" /* commitHomicideCrime */])();
return false;
});
slumsGta.addEventListener("click", function() {
- Object(__WEBPACK_IMPORTED_MODULE_2__Crimes_js__["d" /* commitGrandTheftAutoCrime */])();
+ Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["d" /* commitGrandTheftAutoCrime */])();
return false;
});
slumsKidnap.addEventListener("click", function() {
- Object(__WEBPACK_IMPORTED_MODULE_2__Crimes_js__["g" /* commitKidnapCrime */])();
+ Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["g" /* commitKidnapCrime */])();
return false;
});
slumsAssassinate.addEventListener("click", function() {
- Object(__WEBPACK_IMPORTED_MODULE_2__Crimes_js__["a" /* commitAssassinationCrime */])();
+ Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["a" /* commitAssassinationCrime */])();
return false;
});
slumsHeist.addEventListener("click", function() {
- Object(__WEBPACK_IMPORTED_MODULE_2__Crimes_js__["e" /* commitHeistCrime */])();
+ Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["e" /* commitHeistCrime */])();
return false;
});
+ cityHallCreateCorporation.addEventListener("click", function() {
+ var yesBtn = Object(__WEBPACK_IMPORTED_MODULE_15__utils_YesNoBox_js__["j" /* yesNoTxtInpBoxGetYesButton */])(),
+ noBtn = Object(__WEBPACK_IMPORTED_MODULE_15__utils_YesNoBox_js__["i" /* yesNoTxtInpBoxGetNoButton */])();
+ yesBtn.innerText = "Create Corporation";
+ noBtn.innerText = "Cancel";
+ yesBtn.addEventListener("click", function() {
+ if (__WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].money.lt(150e9)) {
+ Object(__WEBPACK_IMPORTED_MODULE_10__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You don't have enough money to create a corporation! You need $150b");
+ return Object(__WEBPACK_IMPORTED_MODULE_15__utils_YesNoBox_js__["f" /* yesNoTxtInpBoxClose */])();
+ }
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].loseMoney(150e9);
+ var companyName = Object(__WEBPACK_IMPORTED_MODULE_15__utils_YesNoBox_js__["h" /* yesNoTxtInpBoxGetInput */])();
+ if (companyName == null || companyName == "") {
+ Object(__WEBPACK_IMPORTED_MODULE_10__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Invalid company name!");
+ return false;
+ }
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].corporation = new __WEBPACK_IMPORTED_MODULE_1__CompanyManagement_js__["a" /* Corporation */]({
+ name:companyName,
+ });
+ displayLocationContent();
+ Object(__WEBPACK_IMPORTED_MODULE_10__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Congratulations! You just started your own corporation. You can visit " +
+ "and manage your company in the City");
+ return Object(__WEBPACK_IMPORTED_MODULE_15__utils_YesNoBox_js__["f" /* yesNoTxtInpBoxClose */])();
+ });
+ noBtn.addEventListener("click", function() {
+ return Object(__WEBPACK_IMPORTED_MODULE_15__utils_YesNoBox_js__["f" /* yesNoTxtInpBoxClose */])();
+ });
+ if (__WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].corporation instanceof __WEBPACK_IMPORTED_MODULE_1__CompanyManagement_js__["a" /* Corporation */]) {
+ return;
+ } else {
+ Object(__WEBPACK_IMPORTED_MODULE_15__utils_YesNoBox_js__["g" /* yesNoTxtInpBoxCreate */])("Would you like to start a corporation? This will require $150b " +
+ "for registration and initial funding.
If so, please enter " +
+ "a name for your corporation below:");
+ }
+ });
+
hospitalTreatment.addEventListener("click", function() {
- if (__WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].hp < 0) {__WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].hp = 0;}
- var price = (__WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].max_hp - __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].hp) * __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].HospitalCostPerHp;
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].loseMoney(price);
- Object(__WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You were healed to full health! The hospital billed " +
- "you for $" + Object(__WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__["c" /* formatNumber */])(price, 2).toString());
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].hp = __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].max_hp;
+ if (__WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].hp < 0) {__WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].hp = 0;}
+ var price = (__WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].max_hp - __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].hp) * __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].HospitalCostPerHp;
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].loseMoney(price);
+ Object(__WEBPACK_IMPORTED_MODULE_10__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You were healed to full health! The hospital billed " +
+ "you for $" + Object(__WEBPACK_IMPORTED_MODULE_14__utils_StringHelperFunctions_js__["c" /* formatNumber */])(price, 2).toString());
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].hp = __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].max_hp;
displayLocationContent();
return false;
});
}
function travelToCity(destCityName, cost) {
- if (__WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].firstTimeTraveled === false) {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].firstTimeTraveled = true;
+ if (__WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].firstTimeTraveled === false) {
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].firstTimeTraveled = true;
document.getElementById("travel-tab").style.display = "list-item";
document.getElementById("world-menu-header").click();
document.getElementById("world-menu-header").click();
}
- if (__WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].money.lt(cost)) {
- Object(__WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You cannot afford to travel to " + destCityName);
+ if (__WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].money.lt(cost)) {
+ Object(__WEBPACK_IMPORTED_MODULE_10__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You cannot afford to travel to " + destCityName);
return;
}
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].loseMoney(cost);
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].loseMoney(cost);
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].city = destCityName;
- Object(__WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You are now in " + destCityName + "!");
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadWorldContent();
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].city = destCityName;
+ Object(__WEBPACK_IMPORTED_MODULE_10__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You are now in " + destCityName + "!");
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadWorldContent();
}
function purchaseTorRouter() {
- if (__WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].money.lt(__WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].TorRouterCost)) {
- Object(__WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You cannot afford to purchase the Tor router");
+ if (__WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].money.lt(__WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].TorRouterCost)) {
+ Object(__WEBPACK_IMPORTED_MODULE_10__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You cannot afford to purchase the Tor router");
return;
}
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].loseMoney(__WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].TorRouterCost);
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].loseMoney(__WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].TorRouterCost);
- var darkweb = new __WEBPACK_IMPORTED_MODULE_6__Server_js__["d" /* Server */](Object(__WEBPACK_IMPORTED_MODULE_11__utils_IPAddress_js__["a" /* createRandomIp */])(), "darkweb", "", false, false, false, 1);
- Object(__WEBPACK_IMPORTED_MODULE_6__Server_js__["a" /* AddToAllServers */])(darkweb);
- __WEBPACK_IMPORTED_MODULE_8__SpecialServerIps_js__["a" /* SpecialServerIps */].addIp("Darkweb Server", darkweb.ip);
+ var darkweb = new __WEBPACK_IMPORTED_MODULE_7__Server_js__["d" /* Server */](Object(__WEBPACK_IMPORTED_MODULE_12__utils_IPAddress_js__["a" /* createRandomIp */])(), "darkweb", "", false, false, false, 1);
+ Object(__WEBPACK_IMPORTED_MODULE_7__Server_js__["a" /* AddToAllServers */])(darkweb);
+ __WEBPACK_IMPORTED_MODULE_9__SpecialServerIps_js__["a" /* SpecialServerIps */].addIp("Darkweb Server", darkweb.ip);
document.getElementById("location-purchase-tor").setAttribute("class", "a-link-button-inactive");
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].getHomeComputer().serversOnNetwork.push(darkweb.ip);
- darkweb.serversOnNetwork.push(__WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].getHomeComputer().ip);
- Object(__WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You have purchased a Tor router!
You now have access to the dark web from your home computer
Use the scan/netstat commands to search for the dark web connection.");
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].getHomeComputer().serversOnNetwork.push(darkweb.ip);
+ darkweb.serversOnNetwork.push(__WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].getHomeComputer().ip);
+ Object(__WEBPACK_IMPORTED_MODULE_10__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You have purchased a Tor router!
You now have access to the dark web from your home computer
Use the scan/netstat commands to search for the dark web connection.");
}
function displayUniversityLocationContent(costMult) {
@@ -20399,11 +20609,11 @@ function displayUniversityLocationContent(costMult) {
classLeadershipButton.style.display = "block";
//Costs (per second)
- var dataStructuresCost = __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].ClassDataStructuresBaseCost * costMult;
- var networksCost = __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].ClassNetworksBaseCost * costMult;
- var algorithmsCost = __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].ClassAlgorithmsBaseCost * costMult;
- var managementCost = __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].ClassManagementBaseCost * costMult;
- var leadershipCost = __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].ClassLeadershipBaseCost * costMult;
+ var dataStructuresCost = __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassDataStructuresBaseCost * costMult;
+ var networksCost = __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassNetworksBaseCost * costMult;
+ var algorithmsCost = __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassAlgorithmsBaseCost * costMult;
+ var managementCost = __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassManagementBaseCost * costMult;
+ var leadershipCost = __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassLeadershipBaseCost * costMult;
//Update button text to show cost
classDataStructuresButton.innerHTML = "Take Data Structures course ($" + dataStructuresCost + " / sec)";
@@ -20414,39 +20624,39 @@ function displayUniversityLocationContent(costMult) {
}
function setUniversityLocationButtons(costMult, expMult) {
- var newStudyCS = Object(__WEBPACK_IMPORTED_MODULE_10__utils_HelperFunctions_js__["b" /* clearEventListeners */])("location-study-computer-science");
+ var newStudyCS = Object(__WEBPACK_IMPORTED_MODULE_11__utils_HelperFunctions_js__["b" /* clearEventListeners */])("location-study-computer-science");
newStudyCS.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].ClassStudyComputerScience);
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassStudyComputerScience);
return false;
});
- var newClassDataStructures = Object(__WEBPACK_IMPORTED_MODULE_10__utils_HelperFunctions_js__["b" /* clearEventListeners */])("location-data-structures-class");
+ var newClassDataStructures = Object(__WEBPACK_IMPORTED_MODULE_11__utils_HelperFunctions_js__["b" /* clearEventListeners */])("location-data-structures-class");
newClassDataStructures.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].ClassDataStructures);
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassDataStructures);
return false;
});
- var newClassNetworks = Object(__WEBPACK_IMPORTED_MODULE_10__utils_HelperFunctions_js__["b" /* clearEventListeners */])("location-networks-class");
+ var newClassNetworks = Object(__WEBPACK_IMPORTED_MODULE_11__utils_HelperFunctions_js__["b" /* clearEventListeners */])("location-networks-class");
newClassNetworks.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].ClassNetworks);
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassNetworks);
return false;
});
- var newClassAlgorithms = Object(__WEBPACK_IMPORTED_MODULE_10__utils_HelperFunctions_js__["b" /* clearEventListeners */])("location-algorithms-class");
+ var newClassAlgorithms = Object(__WEBPACK_IMPORTED_MODULE_11__utils_HelperFunctions_js__["b" /* clearEventListeners */])("location-algorithms-class");
newClassAlgorithms.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].ClassAlgorithms);
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassAlgorithms);
return false;
});
- var newClassManagement = Object(__WEBPACK_IMPORTED_MODULE_10__utils_HelperFunctions_js__["b" /* clearEventListeners */])("location-management-class");
+ var newClassManagement = Object(__WEBPACK_IMPORTED_MODULE_11__utils_HelperFunctions_js__["b" /* clearEventListeners */])("location-management-class");
newClassManagement.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].ClassManagement);
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassManagement);
return false;
});
- var newClassLeadership = Object(__WEBPACK_IMPORTED_MODULE_10__utils_HelperFunctions_js__["b" /* clearEventListeners */])("location-leadership-class");
+ var newClassLeadership = Object(__WEBPACK_IMPORTED_MODULE_11__utils_HelperFunctions_js__["b" /* clearEventListeners */])("location-leadership-class");
newClassLeadership.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].ClassLeadership);
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassLeadership);
return false;
});
}
@@ -20462,7 +20672,7 @@ function displayGymLocationContent(costMult) {
gymAgiButton.style.display = "block";
//Costs (per second)
- var cost = __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].ClassGymBaseCost * costMult;
+ var cost = __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassGymBaseCost * costMult;
//Update button text to show cost
gymStrButton.innerHTML = "Train Strength ($" + cost + " / sec)";
@@ -20472,27 +20682,27 @@ function displayGymLocationContent(costMult) {
}
function setGymLocationButtons(costMult, expMult) {
- var gymStr = Object(__WEBPACK_IMPORTED_MODULE_10__utils_HelperFunctions_js__["b" /* clearEventListeners */])("location-gym-train-str");
+ var gymStr = Object(__WEBPACK_IMPORTED_MODULE_11__utils_HelperFunctions_js__["b" /* clearEventListeners */])("location-gym-train-str");
gymStr.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].ClassGymStrength);
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassGymStrength);
return false;
});
- var gymDef = Object(__WEBPACK_IMPORTED_MODULE_10__utils_HelperFunctions_js__["b" /* clearEventListeners */])("location-gym-train-def");
+ var gymDef = Object(__WEBPACK_IMPORTED_MODULE_11__utils_HelperFunctions_js__["b" /* clearEventListeners */])("location-gym-train-def");
gymDef.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].ClassGymDefense);
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassGymDefense);
return false;
});
- var gymDex = Object(__WEBPACK_IMPORTED_MODULE_10__utils_HelperFunctions_js__["b" /* clearEventListeners */])("location-gym-train-dex");
+ var gymDex = Object(__WEBPACK_IMPORTED_MODULE_11__utils_HelperFunctions_js__["b" /* clearEventListeners */])("location-gym-train-dex");
gymDex.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].ClassGymDexterity);
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassGymDexterity);
return false;
});
- var gymAgi = Object(__WEBPACK_IMPORTED_MODULE_10__utils_HelperFunctions_js__["b" /* clearEventListeners */])("location-gym-train-agi");
+ var gymAgi = Object(__WEBPACK_IMPORTED_MODULE_11__utils_HelperFunctions_js__["b" /* clearEventListeners */])("location-gym-train-agi");
gymAgi.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].ClassGymAgility);
+ __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassGymAgility);
return false;
});
}
@@ -20500,8 +20710,8 @@ function setGymLocationButtons(costMult, expMult) {
function setInfiltrateButton(btn, companyName, startLevel, val, maxClearance, difficulty) {
btn.style.display = "block";
btn.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_3__engine_js__["Engine"].loadInfiltrationContent();
- Object(__WEBPACK_IMPORTED_MODULE_4__Infiltration_js__["a" /* beginInfiltration */])(companyName, startLevel, val, maxClearance, difficulty)
+ __WEBPACK_IMPORTED_MODULE_4__engine_js__["Engine"].loadInfiltrationContent();
+ Object(__WEBPACK_IMPORTED_MODULE_5__Infiltration_js__["a" /* beginInfiltration */])(companyName, startLevel, val, maxClearance, difficulty)
return false;
});
}
@@ -20511,7 +20721,7 @@ function setInfiltrateButton(btn, companyName, startLevel, val, maxClearance, di
function setJobRequirementTooltip(loc, entryPosType, btn) {
var company = __WEBPACK_IMPORTED_MODULE_0__Company_js__["a" /* Companies */][loc];
if (company == null) {return;}
- var pos = __WEBPACK_IMPORTED_MODULE_5__Player_js__["a" /* Player */].getNextCompanyPosition(company, entryPosType);
+ var pos = __WEBPACK_IMPORTED_MODULE_6__Player_js__["a" /* Player */].getNextCompanyPosition(company, entryPosType);
if (pos == null) {return};
if (!company.hasPosition(pos)) {return;}
var reqText = Object(__WEBPACK_IMPORTED_MODULE_0__Company_js__["f" /* getJobRequirementText */])(company, pos, true);
@@ -20519,109 +20729,203 @@ function setJobRequirementTooltip(loc, entryPosType, btn) {
}
function travelBoxCreate(destCityName, cost) {
- var yesBtn = Object(__WEBPACK_IMPORTED_MODULE_14__utils_YesNoBox_js__["d" /* yesNoBoxGetYesButton */])(), noBtn = Object(__WEBPACK_IMPORTED_MODULE_14__utils_YesNoBox_js__["c" /* yesNoBoxGetNoButton */])();
+ var yesBtn = Object(__WEBPACK_IMPORTED_MODULE_15__utils_YesNoBox_js__["d" /* yesNoBoxGetYesButton */])(), noBtn = Object(__WEBPACK_IMPORTED_MODULE_15__utils_YesNoBox_js__["c" /* yesNoBoxGetNoButton */])();
yesBtn.innerHTML = "Yes";
noBtn.innerHTML = "No";
noBtn.addEventListener("click", () => {
- Object(__WEBPACK_IMPORTED_MODULE_14__utils_YesNoBox_js__["a" /* yesNoBoxClose */])();
+ Object(__WEBPACK_IMPORTED_MODULE_15__utils_YesNoBox_js__["a" /* yesNoBoxClose */])();
return false;
});
yesBtn.addEventListener("click", () => {
- Object(__WEBPACK_IMPORTED_MODULE_14__utils_YesNoBox_js__["a" /* yesNoBoxClose */])();
+ Object(__WEBPACK_IMPORTED_MODULE_15__utils_YesNoBox_js__["a" /* yesNoBoxClose */])();
travelToCity(destCityName, cost);
return false;
});
- Object(__WEBPACK_IMPORTED_MODULE_14__utils_YesNoBox_js__["b" /* yesNoBoxCreate */])("Would you like to travel to " + destCityName + "? The trip will cost $" + Object(__WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__["c" /* formatNumber */])(cost, 2) + ".");
+ Object(__WEBPACK_IMPORTED_MODULE_15__utils_YesNoBox_js__["b" /* yesNoBoxCreate */])("Would you like to travel to " + destCityName + "? The trip will cost $" + Object(__WEBPACK_IMPORTED_MODULE_14__utils_StringHelperFunctions_js__["c" /* formatNumber */])(cost, 2) + ".");
}
function purchaseServerBoxCreate(ram, cost) {
- var yesBtn = Object(__WEBPACK_IMPORTED_MODULE_14__utils_YesNoBox_js__["j" /* yesNoTxtInpBoxGetYesButton */])();
- var noBtn = Object(__WEBPACK_IMPORTED_MODULE_14__utils_YesNoBox_js__["i" /* yesNoTxtInpBoxGetNoButton */])();
+ var yesBtn = Object(__WEBPACK_IMPORTED_MODULE_15__utils_YesNoBox_js__["j" /* yesNoTxtInpBoxGetYesButton */])();
+ var noBtn = Object(__WEBPACK_IMPORTED_MODULE_15__utils_YesNoBox_js__["i" /* yesNoTxtInpBoxGetNoButton */])();
yesBtn.innerHTML = "Purchase Server";
noBtn.innerHTML = "Cancel";
yesBtn.addEventListener("click", function() {
- Object(__WEBPACK_IMPORTED_MODULE_7__ServerPurchases_js__["b" /* purchaseServer */])(ram, cost);
- Object(__WEBPACK_IMPORTED_MODULE_14__utils_YesNoBox_js__["f" /* yesNoTxtInpBoxClose */])();
+ Object(__WEBPACK_IMPORTED_MODULE_8__ServerPurchases_js__["b" /* purchaseServer */])(ram, cost);
+ Object(__WEBPACK_IMPORTED_MODULE_15__utils_YesNoBox_js__["f" /* yesNoTxtInpBoxClose */])();
});
noBtn.addEventListener("click", function() {
- Object(__WEBPACK_IMPORTED_MODULE_14__utils_YesNoBox_js__["f" /* yesNoTxtInpBoxClose */])();
+ Object(__WEBPACK_IMPORTED_MODULE_15__utils_YesNoBox_js__["f" /* yesNoTxtInpBoxClose */])();
});
- Object(__WEBPACK_IMPORTED_MODULE_14__utils_YesNoBox_js__["g" /* yesNoTxtInpBoxCreate */])("Would you like to purchase a new server with " + ram +
- "GB of RAM for $" + Object(__WEBPACK_IMPORTED_MODULE_13__utils_StringHelperFunctions_js__["c" /* formatNumber */])(cost, 2) + "?
" +
+ Object(__WEBPACK_IMPORTED_MODULE_15__utils_YesNoBox_js__["g" /* yesNoTxtInpBoxCreate */])("Would you like to purchase a new server with " + ram +
+ "GB of RAM for $" + Object(__WEBPACK_IMPORTED_MODULE_14__utils_StringHelperFunctions_js__["c" /* formatNumber */])(cost, 2) + "?
" +
"Please enter the server hostname below:
");
}
+/***/ }),
+/* 13 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return SpecialServerNames; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return SpecialServerIps; });
+/* unused harmony export SpecialServerIpsMap */
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return loadSpecialServerIps; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return prestigeSpecialServerIps; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return initSpecialServerIps; });
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_JSONReviver_js__ = __webpack_require__(7);
+
+
+/* Holds IP of Special Servers */
+let SpecialServerNames = {
+ FulcrumSecretTechnologies: "Fulcrum Secret Technologies Server",
+ CyberSecServer: "CyberSec Server",
+ NiteSecServer: "NiteSec Server",
+ TheBlackHandServer: "The Black Hand Server",
+ BitRunnersServer: "BitRunners Server",
+ TheDarkArmyServer: "The Dark Army Server",
+ DaedalusServer: "Daedalus Server",
+ WorldDaemon: "w0r1d_d43m0n",
+}
+function SpecialServerIpsMap() {}
+
+SpecialServerIpsMap.prototype.addIp = function(name, ip) {
+ this[name] = ip;
+}
+
+SpecialServerIpsMap.prototype.toJSON = function() {
+ return Object(__WEBPACK_IMPORTED_MODULE_0__utils_JSONReviver_js__["b" /* Generic_toJSON */])("SpecialServerIpsMap", this);
+}
+
+SpecialServerIpsMap.fromJSON = function(value) {
+ return Object(__WEBPACK_IMPORTED_MODULE_0__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(SpecialServerIpsMap, value.data);
+}
+
+__WEBPACK_IMPORTED_MODULE_0__utils_JSONReviver_js__["c" /* Reviver */].constructors.SpecialServerIpsMap = SpecialServerIpsMap;
+
+let SpecialServerIps = new SpecialServerIpsMap();
+
+function prestigeSpecialServerIps() {
+ for (var member in SpecialServerIps) {
+ delete SpecialServerIps[member];
+ }
+ SpecialServerIps = null;
+ SpecialServerIps = new SpecialServerIpsMap();
+}
+
+function loadSpecialServerIps(saveString) {
+ SpecialServerIps = JSON.parse(saveString, __WEBPACK_IMPORTED_MODULE_0__utils_JSONReviver_js__["c" /* Reviver */]);
+}
+
+function initSpecialServerIps() {
+ SpecialServerIps = new SpecialServerIpsMap();
+}
+
+
+
+
/***/ }),
/* 14 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Settings; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return initSettings; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return setSettingsLabels; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return loadSettings; });
-/* Settings.js */
-let Settings = {
- CodeInstructionRunTime: 50,
- MaxLogCapacity: 50,
- MaxPortCapacity: 50,
- SuppressMessages: false,
- SuppressFactionInvites: false,
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return yesNoBoxCreate; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return yesNoTxtInpBoxCreate; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return yesNoBoxGetYesButton; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return yesNoBoxGetNoButton; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return yesNoTxtInpBoxGetYesButton; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return yesNoTxtInpBoxGetNoButton; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return yesNoTxtInpBoxGetInput; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return yesNoBoxClose; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return yesNoTxtInpBoxClose; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return yesNoBoxOpen; });
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__HelperFunctions_js__ = __webpack_require__(2);
+
+/* 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 loadSettings(saveString) {
- Settings = JSON.parse(saveString);
+function yesNoBoxGetYesButton() {
+ return Object(__WEBPACK_IMPORTED_MODULE_0__HelperFunctions_js__["b" /* clearEventListeners */])("yes-no-box-yes");
}
-function initSettings() {
- Settings.CodeInstructionRunTime = 50;
- Settings.MaxLogCapacity = 50;
- Settings.MaxPortCapacity = 50;
- Settings.SuppressMessages = false;
- Settings.SuppressFactionInvites = false;
+function yesNoBoxGetNoButton() {
+ return Object(__WEBPACK_IMPORTED_MODULE_0__HelperFunctions_js__["b" /* clearEventListeners */])("yes-no-box-no");
}
-function setSettingsLabels() {
- var nsExecTime = document.getElementById("settingsNSExecTimeRangeValLabel");
- var nsLogLimit = document.getElementById("settingsNSLogRangeValLabel");
- var nsPortLimit = document.getElementById("settingsNSPortRangeValLabel");
- var suppressMsgs = document.getElementById("settingsSuppressMessages");
- var suppressFactionInv = document.getElementById("settingsSuppressFactionInvites")
+function yesNoBoxCreate(txt) {
+ if (yesNoBoxOpen) {return false;} //Already open
+ yesNoBoxOpen = true;
+ var textElement = document.getElementById("yes-no-box-text");
+ if (textElement) {
+ textElement.innerHTML = txt;
+ }
- //Initialize values on labels
- nsExecTime.innerHTML = Settings.CodeInstructionRunTime + "ms";
- nsLogLimit.innerHTML = Settings.MaxLogCapacity;
- nsPortLimit.innerHTML = Settings.MaxPortCapacity;
- suppressMsgs.checked = Settings.SuppressMessages;
- suppressFactionInv.checked = Settings.SuppressFactionInvites;
+ 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;
+}
- //Set handlers for when input changes
- document.getElementById("settingsNSExecTimeRangeVal").oninput = function() {
- nsExecTime.innerHTML = this.value + 'ms';
- Settings.CodeInstructionRunTime = this.value;
- };
+/* 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;
+}
- document.getElementById("settingsNSLogRangeVal").oninput = function() {
- nsLogLimit.innerHTML = this.value;
- Settings.MaxLogCapacity = this.value;
- };
+function yesNoTxtInpBoxGetYesButton() {
+ return Object(__WEBPACK_IMPORTED_MODULE_0__HelperFunctions_js__["b" /* clearEventListeners */])("yes-no-text-input-box-yes");
+}
- document.getElementById("settingsNSPortRangeVal").oninput = function() {
- nsPortLimit.innerHTML = this.value;
- Settings.MaxPortCapacity = this.value;
- };
+function yesNoTxtInpBoxGetNoButton() {
+ return Object(__WEBPACK_IMPORTED_MODULE_0__HelperFunctions_js__["b" /* clearEventListeners */])("yes-no-text-input-box-no");
+}
- document.getElementById("settingsSuppressMessages").onclick = function() {
- Settings.SuppressMessages = this.checked;
- };
+function yesNoTxtInpBoxGetInput() {
+ var val = document.getElementById("yes-no-text-input-box-input").value;
+ val = val.replace(/\s+/g, '');
+ return val;
+}
- document.getElementById("settingsSuppressFactionInvites").onclick = function() {
- Settings.SuppressFactionInvites = this.checked;
- };
+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();
}
@@ -20844,6 +21148,95 @@ function initCreateProgramButtons() {
/* 16 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
+"use strict";
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Settings; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return initSettings; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return setSettingsLabels; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return loadSettings; });
+/* Settings.js */
+let Settings = {
+ CodeInstructionRunTime: 50,
+ MaxLogCapacity: 50,
+ MaxPortCapacity: 50,
+ SuppressMessages: false,
+ SuppressFactionInvites: false,
+}
+
+function loadSettings(saveString) {
+ Settings = JSON.parse(saveString);
+}
+
+function initSettings() {
+ Settings.CodeInstructionRunTime = 50;
+ Settings.MaxLogCapacity = 50;
+ Settings.MaxPortCapacity = 50;
+ Settings.SuppressMessages = false;
+ Settings.SuppressFactionInvites = false;
+}
+
+function setSettingsLabels() {
+ var nsExecTime = document.getElementById("settingsNSExecTimeRangeValLabel");
+ var nsLogLimit = document.getElementById("settingsNSLogRangeValLabel");
+ var nsPortLimit = document.getElementById("settingsNSPortRangeValLabel");
+ var suppressMsgs = document.getElementById("settingsSuppressMessages");
+ var suppressFactionInv = document.getElementById("settingsSuppressFactionInvites")
+
+ //Initialize values on labels
+ nsExecTime.innerHTML = Settings.CodeInstructionRunTime + "ms";
+ nsLogLimit.innerHTML = Settings.MaxLogCapacity;
+ nsPortLimit.innerHTML = Settings.MaxPortCapacity;
+ suppressMsgs.checked = Settings.SuppressMessages;
+ suppressFactionInv.checked = Settings.SuppressFactionInvites;
+
+ //Set handlers for when input changes
+ document.getElementById("settingsNSExecTimeRangeVal").oninput = function() {
+ nsExecTime.innerHTML = this.value + 'ms';
+ Settings.CodeInstructionRunTime = this.value;
+ };
+
+ document.getElementById("settingsNSLogRangeVal").oninput = function() {
+ nsLogLimit.innerHTML = this.value;
+ Settings.MaxLogCapacity = this.value;
+ };
+
+ document.getElementById("settingsNSPortRangeVal").oninput = function() {
+ nsPortLimit.innerHTML = this.value;
+ Settings.MaxPortCapacity = this.value;
+ };
+
+ document.getElementById("settingsSuppressMessages").onclick = function() {
+ Settings.SuppressMessages = this.checked;
+ };
+
+ document.getElementById("settingsSuppressFactionInvites").onclick = function() {
+ Settings.SuppressFactionInvites = this.checked;
+ };
+}
+
+
+
+
+/***/ }),
+/* 17 */
+/***/ (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__)):"object"==typeof module&&module.exports?module.exports=b():a.numeral=b()}(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(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(mat.qty, 3) +
+ "(" + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(totalGain, 3) + "/s)" +
+ "Buy: " + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(mat.buy, 3) +
+ "/s MP: $" + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(mat.bCost, 2) +
+ "Market Price: The price you would pay if " +
+ "you were to buy this material on the market Quality: " + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(mat.qlt, 2) +
+ "The quality of your material. Higher quality " +
+ "will lead to more sales " + product.name + ": " + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(product.data[city][0], 3) + //Quantity
+ "(" + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(totalGain, 3) + "/s)" +
+ "Prod: " + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(product.data[city][1], 3) + "/s Rating: " + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(product.rat, 3) +
+ "Quality: " + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(product.qlt, 3) + " Est. Production Cost: " + __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(product.pCost).format("$0.000a") +
+ "An estimate of how much it costs to produce one unit of this product. " +
+ "If your sell price exceeds this by too much, people won't buy your product. The better your " +
+ "product is, the higher you can mark up its price. Production Multiplier: " + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(division.prodMult, 2) +
+ "Production gain from owning production-boosting materials " +
+ "such as hardware, Robots, AI Cores, and Real Estate
" +
- "DON'T USE TPRINT() TO OUTPUT HTML ELEMENTS TO YOUR TERMINAL!!!!
" +
- "(You lost 1 HP)");
- return;
- }
- Object(__WEBPACK_IMPORTED_MODULE_20__Terminal_js__["b" /* post */])(workerScript.scriptRef.filename + ": " + args.toString());
- },
- clearLog : function() {
- workerScript.scriptRef.clearLog();
- },
- nuke : function(ip){
- if (ip === undefined) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument");
- }
- var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
- if (server == null) {
- workerScript.scriptRef.log("Cannot call nuke(). Invalid IP or hostname passed in: " + ip);
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call nuke(). Invalid IP or hostname passed in: " + ip);
- }
- if (!__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].NukeProgram)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "You do not have the NUKE.exe virus!");
- }
- if (server.openPortCount < server.numOpenPortsRequired) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Not enough ports opened to use NUKE.exe virus");
- }
- if (server.hasAdminRights) {
- workerScript.scriptRef.log("Already have root access to " + server.hostname);
- } else {
- server.hasAdminRights = true;
- workerScript.scriptRef.log("Executed NUKE.exe virus on " + server.hostname + " to gain root access");
- }
- return true;
- },
- brutessh : function(ip){
- if (ip === undefined) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument");
- }
- var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
- if (server == null) {
- workerScript.scriptRef.log("Cannot call brutessh(). Invalid IP or hostname passed in: " + ip);
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call brutessh(). Invalid IP or hostname passed in: " + ip);
- }
- if (!__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].BruteSSHProgram)) {
- workerScript.scriptRef.log("You do not have the BruteSSH.exe program!");
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "You do not have the BruteSSH.exe program!");
- }
- if (!server.sshPortOpen) {
- workerScript.scriptRef.log("Executed BruteSSH.exe on " + server.hostname + " to open SSH port (22)");
- server.sshPortOpen = true;
- ++server.openPortCount;
- } else {
- workerScript.scriptRef.log("SSH Port (22) already opened on " + server.hostname);
- }
- return true;
- },
- ftpcrack : function(ip){
- if (ip === undefined) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument");
- }
- var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
- if (server == null) {
- workerScript.scriptRef.log("Cannot call ftpcrack(). Invalid IP or hostname passed in: " + ip);
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call ftpcrack(). Invalid IP or hostname passed in: " + ip);
- }
- if (!__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].FTPCrackProgram)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "You do not have the FTPCrack.exe program!");
- }
- if (!server.ftpPortOpen) {
- workerScript.scriptRef.log("Executed FTPCrack.exe on " + server.hostname + " to open FTP port (21)");
- server.ftpPortOpen = true;
- ++server.openPortCount;
- } else {
- workerScript.scriptRef.log("FTP Port (21) already opened on " + server.hostname);
- }
- return true;
- },
- relaysmtp : function(ip){
- if (ip === undefined) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument");
- }
- var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
- if (server == null) {
- workerScript.scriptRef.log("Cannot call relaysmtp(). Invalid IP or hostname passed in: " + ip);
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call relaysmtp(). Invalid IP or hostname passed in: " + ip);
- }
- if (!__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "You do not have the relaySMTP.exe program!");
- }
- if (!server.smtpPortOpen) {
- workerScript.scriptRef.log("Executed relaySMTP.exe on " + server.hostname + " to open SMTP port (25)");
- server.smtpPortOpen = true;
- ++server.openPortCount;
- } else {
- workerScript.scriptRef.log("SMTP Port (25) already opened on " + server.hostname);
- }
- return true;
- },
- httpworm : function(ip){
- if (ip === undefined) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument");
- }
- var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
- if (server == null) {
- workerScript.scriptRef.log("Cannot call httpworm(). Invalid IP or hostname passed in: " + ip);
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call httpworm(). Invalid IP or hostname passed in: " + ip);
- }
- if (!__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].HTTPWormProgram)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "You do not have the HTTPWorm.exe program!");
- }
- if (!server.httpPortOpen) {
- workerScript.scriptRef.log("Executed HTTPWorm.exe on " + server.hostname + " to open HTTP port (80)");
- server.httpPortOpen = true;
- ++server.openPortCount;
- } else {
- workerScript.scriptRef.log("HTTP Port (80) already opened on " + server.hostname);
- }
- return true;
- },
- sqlinject : function(ip){
- if (ip === undefined) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument");
- }
- var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
- if (server == null) {
- workerScript.scriptRef.log("Cannot call sqlinject(). Invalid IP or hostname passed in: " + ip);
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call sqlinject(). Invalid IP or hostname passed in: " + ip);
- }
- if (!__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].SQLInjectProgram)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "You do not have the SQLInject.exe program!");
- }
- if (!server.sqlPortOpen) {
- workerScript.scriptRef.log("Executed SQLInject.exe on " + server.hostname + " to open SQL port (1433)");
- server.sqlPortOpen = true;
- ++server.openPortCount;
- } else {
- workerScript.scriptRef.log("SQL Port (1433) already opened on " + server.hostname);
- }
- return true;
- },
- run : function(scriptname,threads = 1){
- if (scriptname === undefined) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "run() call has incorrect number of arguments. Usage: run(scriptname, [numThreads], [arg1], [arg2]...)");
- }
- if (isNaN(threads) || threads < 1) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Invalid argument for thread count passed into run(). Must be numeric and greater than 0");
- }
- var argsForNewScript = [];
- for (var i = 2; i < arguments.length; ++i) {
- argsForNewScript.push(arguments[i]);
- }
- var scriptServer = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(workerScript.serverIp);
- if (scriptServer == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Could not find server. This is a bug in the game. Report to game dev");
- }
-
- return Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["f" /* runScriptFromScript */])(scriptServer, scriptname, argsForNewScript, workerScript, threads);
- },
- exec : function(scriptname,ip,threads = 1){
- if (scriptname === undefined || ip === undefined) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "exec() call has incorrect number of arguments. Usage: exec(scriptname, server, [numThreads], [arg1], [arg2]...)");
- }
- if (isNaN(threads) || threads < 1) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Invalid argument for thread count passed into exec(). Must be numeric and greater than 0");
- }
- var argsForNewScript = [];
- for (var i = 3; i < arguments.length; ++i) {
- argsForNewScript.push(arguments[i]);
- }
- var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
- if (server == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Invalid hostname/ip passed into exec() command: " + ip);
- }
- return Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["f" /* runScriptFromScript */])(server, scriptname, argsForNewScript, workerScript, threads);
- },
- kill : function(filename,ip){
- if (filename === undefined || ip === undefined) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "kill() call has incorrect number of arguments. Usage: kill(scriptname, server, [arg1], [arg2]...)");
- }
- var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
- if (server == null) {
- workerScript.scriptRef.log("kill() failed. Invalid IP or hostname passed in: " + ip);
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "kill() failed. Invalid IP or hostname passed in: " + ip);
- }
- var argsForKillTarget = [];
- for (var i = 2; i < arguments.length; ++i) {
- argsForKillTarget.push(arguments[i]);
- }
- var runningScriptObj = Object(__WEBPACK_IMPORTED_MODULE_15__Script_js__["d" /* findRunningScript */])(filename, argsForKillTarget, server);
- if (runningScriptObj == null) {
- workerScript.scriptRef.log("kill() failed. No such script "+ filename + " on " + server.hostname + " with args: " + Object(__WEBPACK_IMPORTED_MODULE_27__utils_HelperFunctions_js__["f" /* printArray */])(argsForKillTarget));
- return false;
- }
- var res = Object(__WEBPACK_IMPORTED_MODULE_22__NetscriptWorker_js__["d" /* killWorkerScript */])(runningScriptObj, server.ip);
- if (res) {
- workerScript.scriptRef.log("Killing " + filename + " on " + server.hostname + " with args: " + Object(__WEBPACK_IMPORTED_MODULE_27__utils_HelperFunctions_js__["f" /* printArray */])(argsForKillTarget) + ". May take up to a few minutes for the scripts to die...");
- return true;
- } else {
- workerScript.scriptRef.log("kill() failed. No such script "+ filename + " on " + server.hostname + " with args: " + Object(__WEBPACK_IMPORTED_MODULE_27__utils_HelperFunctions_js__["f" /* printArray */])(argsForKillTarget));
- return false;
- }
- },
- killall : function(ip){
- if (ip === undefined) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "killall() call has incorrect number of arguments. Takes 1 argument");
- }
- var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
- if (server == null) {
- workerScript.scriptRef.log("killall() failed. Invalid IP or hostname passed in: " + ip);
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "killall() failed. Invalid IP or hostname passed in: " + ip);
- }
- for (var i = server.runningScripts.length-1; i >= 0; --i) {
- Object(__WEBPACK_IMPORTED_MODULE_22__NetscriptWorker_js__["d" /* killWorkerScript */])(server.runningScripts[i], server.ip);
- }
- workerScript.scriptRef.log("killall(): Killing all scripts on " + server.hostname + ". May take a few minutes for the scripts to die");
- return true;
- },
- scp : function(scriptname, ip1, ip2){
- if (arguments.length !== 2 && arguments.length !== 3) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Error: scp() call has incorrect number of arguments. Takes 2 or 3 arguments");
- }
- if (scriptname && scriptname.constructor === Array) {
- //Recursively call scp on all elements of array
- var res = false;
- scriptname.forEach(function(script) {
- if (NetscriptFunctions(workerScript).scp(script, ip1, ip2)) {
- res = true;
- };
- });
- return res;
- }
- if (!scriptname.endsWith(".lit") && !scriptname.endsWith(".script")) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Error: scp() only works for .script and .lit files");
- }
-
- var destServer, currServ;
-
- if (arguments.length === 3) { //scriptname, source, destination
- if (scriptname === undefined || ip1 === undefined || ip2 === undefined) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Error: scp() call has incorrect number of arguments. Takes 2 or 3 arguments");
- }
- destServer = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip2);
- if (destServer == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Error: Invalid hostname/ip passed into scp() command: " + ip);
- }
-
- currServ = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip1);
- if (currServ == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Could not find server ip for this script. This is a bug please contact game developer");
- }
- } else if (arguments.length === 2) { //scriptname, destination
- if (scriptname === undefined || ip1 === undefined) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Error: scp() call has incorrect number of arguments. Takes 2 or 3 arguments");
- }
- destServer = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip1);
- if (destServer == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Error: Invalid hostname/ip passed into scp() command: " + ip);
- }
-
- currServ = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(workerScript.serverIp);
- if (currServ == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Could not find server ip for this script. This is a bug please contact game developer");
- }
- }
-
- //Scp for lit files
- if (scriptname.endsWith(".lit")) {
- var found = false;
- for (var i = 0; i < currServ.messages.length; ++i) {
- if (!(currServ.messages[i] instanceof __WEBPACK_IMPORTED_MODULE_12__Message_js__["a" /* Message */]) && currServ.messages[i] == scriptname) {
- found = true;
- }
- }
-
- if (!found) {
- workerScript.scriptRef.log(scriptname + " does not exist. scp() failed");
- return false;
- }
-
- for (var i = 0; i < destServer.messages.length; ++i) {
- if (destServer.messages[i] === scriptname) {
- workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname);
- return true; //Already exists
- }
- }
- destServer.messages.push(scriptname);
- workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname);
- return true;
- }
-
- //Scp for script files
- var sourceScript = null;
- for (var i = 0; i < currServ.scripts.length; ++i) {
- if (scriptname == currServ.scripts[i].filename) {
- sourceScript = currServ.scripts[i];
- break;
- }
- }
- if (sourceScript == null) {
- workerScript.scriptRef.log(scriptname + " does not exist. scp() failed");
- return false;
- }
-
- //Overwrite script if it already exists
- for (var i = 0; i < destServer.scripts.length; ++i) {
- if (scriptname == destServer.scripts[i].filename) {
- workerScript.scriptRef.log("WARNING: " + scriptname + " already exists on " + destServer.hostname + " and it will be overwritten.");
- workerScript.scriptRef.log(scriptname + " overwritten on " + destServer.hostname);
- var oldScript = destServer.scripts[i];
- oldScript.code = sourceScript.code;
- oldScript.ramUsage = sourceScript.ramUsage;
- return true;
- }
- }
-
- //Create new script if it does not already exist
- var newScript = new __WEBPACK_IMPORTED_MODULE_15__Script_js__["c" /* Script */]();
- newScript.filename = scriptname;
- newScript.code = sourceScript.code;
- newScript.ramUsage = sourceScript.ramUsage;
- newScript.server = destServer.ip;
- destServer.scripts.push(newScript);
- workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname);
- return true;
- },
- ls : function(ip, grep) {
- if (ip === undefined) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "ls() failed because of invalid arguments. Usage: ls(ip/hostname, [grep filter])");
- }
- var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
- if (server == null) {
- workerScript.scriptRef.log("ls() failed. Invalid IP or hostname passed in: " + ip);
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "ls() failed. Invalid IP or hostname passed in: " + ip);
- }
-
- //Get the grep filter, if one exists
- var filter = false;
- if (arguments.length >= 2) {
- filter = grep.toString();
- }
-
- var allFiles = [];
- for (var i = 0; i < server.programs.length; i++) {
- if (filter) {
- if (server.programs[i].includes(filter)) {
- allFiles.push(server.programs[i]);
- }
- } else {
- allFiles.push(server.programs[i]);
- }
- }
- for (var i = 0; i < server.scripts.length; i++) {
- if (filter) {
- if (server.scripts[i].filename.includes(filter)) {
- allFiles.push(server.scripts[i].filename);
- }
- } else {
- allFiles.push(server.scripts[i].filename);
- }
-
- }
- for (var i = 0; i < server.messages.length; i++) {
- if (filter) {
- if (server.messages[i] instanceof __WEBPACK_IMPORTED_MODULE_12__Message_js__["a" /* Message */]) {
- if (server.messages[i].filename.includes(filter)) {
- allFiles.push(server.messages[i].filename);
- }
- } else if (server.messages[i].includes(filter)) {
- allFiles.push(server.messages[i]);
- }
- } else {
- if (server.messages[i] instanceof __WEBPACK_IMPORTED_MODULE_12__Message_js__["a" /* Message */]) {
- allFiles.push(server.messages[i].filename);
- } else {
- allFiles.push(server.messages[i]);
- }
- }
- }
-
- //Sort the files alphabetically then print each
- allFiles.sort();
- return allFiles;
- },
- hasRootAccess : function(ip){
- if (ip===undefined){
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "hasRootAccess() call has incorrect number of arguments. Takes 1 argument");
- }
- var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
- if (server == null){
- workerScript.scriptRef.log("hasRootAccess() failed. Invalid IP or hostname passed in: " + ip);
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "hasRootAccess() failed. Invalid IP or hostname passed in: " + ip);
- }
- return server.hasAdminRights;
- },
- getIp : function() {
- var scriptServer = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(workerScript.serverIp);
- if (scriptServer == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Could not find server. This is a bug in the game. Report to game dev");
- }
- return scriptServer.ip;
- },
- getHostname : function(){
- var scriptServer = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(workerScript.serverIp);
- if (scriptServer == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Could not find server. This is a bug in the game. Report to game dev");
- }
- return scriptServer.hostname;
- },
- getHackingLevel : function(){
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].updateSkillLevels();
- workerScript.scriptRef.log("getHackingLevel() returned " + __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hacking_skill);
- return __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hacking_skill;
- },
- getHackingMultipliers : function() {
- return {
- chance: __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hacking_chance_mult,
- speed: __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hacking_speed_mult,
- money: __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hacking_money_mult,
- growth: __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hacking_grow_mult,
- };
- },
- getBitNodeMultipliers: function() {
- if (!hasAISF) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run getBitNodeMultipliers(). It requires Source-File 5 to run.");
- }
- return __WEBPACK_IMPORTED_MODULE_2__BitNode_js__["a" /* BitNodeMultipliers */];
- },
- getServerMoneyAvailable : function(ip){
- var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
- if (server == null) {
- workerScript.scriptRef.log("getServerMoneyAvailable() failed. Invalid IP or hostname passed in: " + ip);
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "getServerMoneyAvailable() failed. Invalid IP or hostname passed in: " + ip);
- }
- if (server.hostname == "home") {
- //Return player's money
- workerScript.scriptRef.log("getServerMoneyAvailable('home') returned player's money: $" + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].money.toNumber(), 2));
- return __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].money.toNumber();
- }
- workerScript.scriptRef.log("getServerMoneyAvailable() returned " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.moneyAvailable, 2) + " for " + server.hostname);
- return server.moneyAvailable;
- },
- getServerSecurityLevel : function(ip){
- var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
- if (server == null) {
- workerScript.scriptRef.log("getServerSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "getServerSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
- }
- workerScript.scriptRef.log("getServerSecurityLevel() returned " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.hackDifficulty, 3) + " for " + server.hostname);
- return server.hackDifficulty;
- },
- getServerBaseSecurityLevel : function(ip){
- var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
- if (server == null) {
- workerScript.scriptRef.log("getServerBaseSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "getServerBaseSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
- }
- workerScript.scriptRef.log("getServerBaseSecurityLevel() returned " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.baseDifficulty, 3) + " for " + server.hostname);
- return server.baseDifficulty;
- },
- getServerMinSecurityLevel : function(ip) {
- var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
- if (server == null) {
- workerScript.scriptRef.log("getServerMinSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "getServerMinSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
- }
- workerScript.scriptRef.log("getServerMinSecurityLevel() returned " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.minDifficulty, 3) + " for " + server.hostname);
- return server.minDifficulty;
- },
- getServerRequiredHackingLevel : function(ip){
- var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
- if (server == null) {
- workerScript.scriptRef.log("getServerRequiredHackingLevel() failed. Invalid IP or hostname passed in: " + ip);
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "getServerRequiredHackingLevel() failed. Invalid IP or hostname passed in: " + ip);
- }
- workerScript.scriptRef.log("getServerRequiredHackingLevel returned " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.requiredHackingSkill, 0) + " for " + server.hostname);
- return server.requiredHackingSkill;
- },
- getServerMaxMoney : function(ip){
- var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
- if (server == null) {
- workerScript.scriptRef.log("getServerMaxMoney() failed. Invalid IP or hostname passed in: " + ip);
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "getServerMaxMoney() failed. Invalid IP or hostname passed in: " + ip);
- }
- workerScript.scriptRef.log("getServerMaxMoney() returned " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.moneyMax, 0) + " for " + server.hostname);
- return server.moneyMax;
- },
- getServerGrowth : function(ip) {
- var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
- if (server == null) {
- workerScript.scriptRef.log("getServerGrowth() failed. Invalid IP or hostname passed in: " + ip);
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "getServerGrowth() failed. Invalid IP or hostname passed in: " + ip);
- }
- workerScript.scriptRef.log("getServerGrowth() returned " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.serverGrowth, 0) + " for " + server.hostname);
- return server.serverGrowth;
- },
- getServerNumPortsRequired : function(ip){
- var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
- if (server == null) {
- workerScript.scriptRef.log("getServerNumPortsRequired() failed. Invalid IP or hostname passed in: " + ip);
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "getServerNumPortsRequired() failed. Invalid IP or hostname passed in: " + ip);
- }
- workerScript.scriptRef.log("getServerNumPortsRequired() returned " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.numOpenPortsRequired, 0) + " for " + server.hostname);
- return server.numOpenPortsRequired;
- },
- getServerRam : function(ip) {
- var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
- if (server == null) {
- workerScript.scriptRef.log("getServerRam() failed. Invalid IP or hostname passed in: " + ip);
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "getServerRam() failed. Invalid IP or hostname passed in: " + ip);
- }
- workerScript.scriptRef.log("getServerRam() returned [" + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.maxRam, 2) + "GB, " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.ramUsed, 2) + "GB]");
- return [server.maxRam, server.ramUsed];
- },
- serverExists : function(ip) {
- return (Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip) !== null);
- },
- fileExists : function(filename,ip=workerScript.serverIp){
- if (filename === undefined) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "fileExists() call has incorrect number of arguments. Usage: fileExists(scriptname, [server])");
- }
- var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
- if (server == null) {
- workerScript.scriptRef.log("fileExists() failed. Invalid IP or hostname passed in: " + ip);
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "fileExists() failed. Invalid IP or hostname passed in: " + ip);
- }
- for (var i = 0; i < server.scripts.length; ++i) {
- if (filename == server.scripts[i].filename) {
- return true;
- }
- }
- for (var i = 0; i < server.programs.length; ++i) {
- if (filename.toLowerCase() == server.programs[i].toLowerCase()) {
- return true;
- }
- }
- for (var i = 0; i < server.messages.length; ++i) {
- if (!(server.messages[i] instanceof __WEBPACK_IMPORTED_MODULE_12__Message_js__["a" /* Message */]) &&
- filename.toLowerCase() === server.messages[i]) {
- return true;
- }
- }
- return false;
- },
- isRunning : function(filename,ip){
- if (filename === undefined || ip === undefined) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "isRunning() call has incorrect number of arguments. Usage: isRunning(scriptname, server, [arg1], [arg2]...)");
- }
- var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
- if (server == null) {
- workerScript.scriptRef.log("isRunning() failed. Invalid IP or hostname passed in: " + ip);
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "isRunning() failed. Invalid IP or hostname passed in: " + ip);
- }
- var argsForTargetScript = [];
- for (var i = 2; i < arguments.length; ++i) {
- argsForTargetScript.push(arguments[i]);
- }
- return (Object(__WEBPACK_IMPORTED_MODULE_15__Script_js__["d" /* findRunningScript */])(filename, argsForTargetScript, server) != null);
- },
- getNextHacknetNodeCost : __WEBPACK_IMPORTED_MODULE_10__HacknetNode_js__["b" /* getCostOfNextHacknetNode */],
- purchaseHacknetNode : __WEBPACK_IMPORTED_MODULE_10__HacknetNode_js__["d" /* purchaseHacknet */],
- getStockPrice : function(symbol) {
- if (!__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hasTixApiAccess) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use getStockPrice()");
- }
- var stock = __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["d" /* SymbolToStockMap */][symbol];
- if (stock == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Invalid stock symbol passed into getStockPrice()");
- }
- return parseFloat(stock.price.toFixed(3));
- },
- getStockPosition : function(symbol) {
- if (!__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hasTixApiAccess) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use getStockPosition()");
- }
- var stock = __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["d" /* SymbolToStockMap */][symbol];
- if (stock == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Invalid stock symbol passed into getStockPrice()");
- }
- return [stock.playerShares, stock.playerAvgPx, stock.playerShortShares, stock.playerAvgShortPx];
- },
- buyStock : function(symbol, shares) {
- if (!__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hasTixApiAccess) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use buyStock()");
- }
- var stock = __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["d" /* SymbolToStockMap */][symbol];
- if (stock == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Invalid stock symbol passed into buyStock()");
- }
- if (shares < 0 || isNaN(shares)) {
- workerScript.scriptRef.log("Error: Invalid 'shares' argument passed to buyStock()");
- return false;
- }
- shares = Math.round(shares);
- if (shares === 0) {return false;}
-
- var totalPrice = stock.price * shares;
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].money.lt(totalPrice + __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].StockMarketCommission)) {
- workerScript.scriptRef.log("Not enough money to purchase " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(shares, 0) + " shares of " +
- symbol + ". Need $" +
- Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(totalPrice + __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].StockMarketCommission, 2).toString());
- return false;
- }
-
- var origTotal = stock.playerShares * stock.playerAvgPx;
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].loseMoney(totalPrice + __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].StockMarketCommission);
- var newTotal = origTotal + totalPrice;
- stock.playerShares += shares;
- stock.playerAvgPx = newTotal / stock.playerShares;
- if (__WEBPACK_IMPORTED_MODULE_8__engine_js__["Engine"].currentPage == __WEBPACK_IMPORTED_MODULE_8__engine_js__["Engine"].Page.StockMarket) {
- Object(__WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["p" /* updateStockPlayerPosition */])(stock);
- }
- workerScript.scriptRef.log("Bought " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(shares, 0) + " shares of " + stock.symbol + " at $" +
- Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(stock.price, 2) + " per share");
- return true;
- },
- sellStock : function(symbol, shares) {
- if (!__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hasTixApiAccess) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use sellStock()");
- }
- var stock = __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["d" /* SymbolToStockMap */][symbol];
- if (stock == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Invalid stock symbol passed into sellStock()");
- }
- if (shares < 0 || isNaN(shares)) {
- workerScript.scriptRef.log("Error: Invalid 'shares' argument passed to sellStock()");
- return false;
- }
- shares = Math.round(shares);
- if (shares > stock.playerShares) {shares = stock.playerShares;}
- if (shares === 0) {return false;}
- var gains = stock.price * shares - __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].StockMarketCommission;
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].gainMoney(gains);
-
- //Calculate net profit and add to script stats
- var netProfit = ((stock.price - stock.playerAvgPx) * shares) - __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].StockMarketCommission;
- if (isNaN(netProfit)) {netProfit = 0;}
- workerScript.scriptRef.onlineMoneyMade += netProfit;
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].scriptProdSinceLastAug += netProfit;
-
- stock.playerShares -= shares;
- if (stock.playerShares == 0) {
- stock.playerAvgPx = 0;
- }
- if (__WEBPACK_IMPORTED_MODULE_8__engine_js__["Engine"].currentPage == __WEBPACK_IMPORTED_MODULE_8__engine_js__["Engine"].Page.StockMarket) {
- Object(__WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["p" /* updateStockPlayerPosition */])(stock);
- }
- workerScript.scriptRef.log("Sold " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(shares, 0) + " shares of " + stock.symbol + " at $" +
- Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(stock.price, 2) + " per share. Gained " +
- "$" + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(gains, 2));
- return true;
- },
- shortStock(symbol, shares) {
- if (!__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hasTixApiAccess) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use shortStock()");
- }
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN !== 8) {
- if (!(hasWallStreetSF && wallStreetSFLvl >= 2)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "ERROR: Cannot use shortStock(). You must either be in BitNode-8 or you must have Level 2 of Source-File 8");
- }
- }
- var stock = __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["d" /* SymbolToStockMap */][symbol];
- if (stock == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "ERROR: Invalid stock symbol passed into shortStock()");
- }
- return Object(__WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["n" /* shortStock */])(stock, shares, workerScript);
- },
- sellShort(symbol, shares) {
- if (!__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hasTixApiAccess) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use sellShort()");
- }
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN !== 8) {
- if (!(hasWallStreetSF && wallStreetSFLvl >= 2)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "ERROR: Cannot use sellShort(). You must either be in BitNode-8 or you must have Level 2 of Source-File 8");
- }
- }
- var stock = __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["d" /* SymbolToStockMap */][symbol];
- if (stock == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "ERROR: Invalid stock symbol passed into sellShort()");
- }
- return Object(__WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["l" /* sellShort */])(stock, shares, workerScript);
- },
- placeOrder(symbol, shares, price, type, pos) {
- if (!__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hasTixApiAccess) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use placeOrder()");
- }
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN !== 8) {
- if (!(hasWallStreetSF && wallStreetSFLvl >= 3)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "ERROR: Cannot use placeOrder(). You must either be in BitNode-8 or have Level 3 of Source-File 8");
- }
- }
- var stock = __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["d" /* SymbolToStockMap */][symbol];
- if (stock == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "ERROR: Invalid stock symbol passed into placeOrder()");
- }
- var orderType, orderPos;
- type = type.toLowerCase();
- if (type.includes("limit") && type.includes("buy")) {
- orderType = __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["a" /* OrderTypes */].LimitBuy;
- } else if (type.includes("limit") && type.includes("sell")) {
- orderType = __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["a" /* OrderTypes */].LimitSell;
- } else if (type.includes("stop") && type.includes("buy")) {
- orderType = __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["a" /* OrderTypes */].StopBuy;
- } else if (type.includes("stop") && type.includes("sell")) {
- orderType = __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["a" /* OrderTypes */].StopSell;
- } else {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "ERROR: Invalid Order Type passed into placeOrder()");
- }
-
- pos = pos.toLowerCase();
- if (pos.includes("l")) {
- orderPos = __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["b" /* PositionTypes */].Long;
- } else if (pos.includes('s')) {
- orderPos = __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["b" /* PositionTypes */].Short;
- } else {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "ERROR: Invalid Position Type passed into placeOrder()");
- }
-
- return Object(__WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["k" /* placeOrder */])(stock, shares, price, orderType, orderPos, workerScript);
- },
- cancelOrder(symbol, shares, price, type, pos) {
- if (!__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hasTixApiAccess) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use cancelOrder()");
- }
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN !== 8) {
- if (!(hasWallStreetSF && wallStreetSFLvl >= 3)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "ERROR: Cannot use cancelOrder(). You must either be in BitNode-8 or have Level 3 of Source-File 8");
- }
- }
- var stock = __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["d" /* SymbolToStockMap */][symbol];
- if (stock == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "ERROR: Invalid stock symbol passed into cancelOrder()");
- }
- if (isNaN(shares) || isNaN(price)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "ERROR: Invalid shares or price argument passed into cancelOrder(). Must be numeric");
- }
- var orderType, orderPos;
- type = type.toLowerCase();
- if (type.includes("limit") && type.includes("buy")) {
- orderType = __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["a" /* OrderTypes */].LimitBuy;
- } else if (type.includes("limit") && type.includes("sell")) {
- orderType = __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["a" /* OrderTypes */].LimitSell;
- } else if (type.includes("stop") && type.includes("buy")) {
- orderType = __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["a" /* OrderTypes */].StopBuy;
- } else if (type.includes("stop") && type.includes("sell")) {
- orderType = OrderType.StopSell;
- } else {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "ERROR: Invalid Order Type passed into placeOrder()");
- }
-
- pos = pos.toLowerCase();
- if (pos.includes("l")) {
- orderPos = __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["b" /* PositionTypes */].Long;
- } else if (pos.includes('s')) {
- orderPos = __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["b" /* PositionTypes */].Short;
- } else {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "ERROR: Invalid Position Type passed into placeOrder()");
- }
- params = {
- stock: stock,
- shares: shares,
- price: price,
- type: orderType,
- pos: orderPos
- };
- return Object(__WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["e" /* cancelOrder */])(params, workerScript);
- },
- purchaseServer : function(hostname, ram) {
- var hostnameStr = String(hostname);
- hostnameStr = hostnameStr.replace(/\s\s+/g, '');
- if (hostnameStr == "") {
- workerScript.scriptRef.log("Error: Passed empty string for hostname argument of purchaseServer()");
- return "";
- }
-
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].purchasedServers.length >= __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].PurchasedServerLimit) {
- workerScript.scriptRef.log("Error: You have reached the maximum limit of " + __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].PurchasedServerLimit +
- " servers. You cannot purchase any more.");
- return "";
- }
-
- ram = Math.round(ram);
- if (isNaN(ram) || !Object(__WEBPACK_IMPORTED_MODULE_27__utils_HelperFunctions_js__["e" /* powerOfTwo */])(ram)) {
- workerScript.scriptRef.log("Error: Invalid ram argument passed to purchaseServer(). Must be numeric and a power of 2");
- return "";
- }
-
- var cost = ram * __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer;
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].money.lt(cost)) {
- workerScript.scriptRef.log("Error: Not enough money to purchase server. Need $" + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(cost, 2));
- return "";
- }
- var newServ = new __WEBPACK_IMPORTED_MODULE_16__Server_js__["d" /* Server */](Object(__WEBPACK_IMPORTED_MODULE_28__utils_IPAddress_js__["a" /* createRandomIp */])(), hostnameStr, "", false, true, true, ram);
- Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["a" /* AddToAllServers */])(newServ);
-
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].purchasedServers.push(newServ.ip);
- var homeComputer = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].getHomeComputer();
- homeComputer.serversOnNetwork.push(newServ.ip);
- newServ.serversOnNetwork.push(homeComputer.ip);
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].loseMoney(cost);
- workerScript.scriptRef.log("Purchased new server with hostname " + newServ.hostname + " for $" + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(cost, 2));
- return newServ.hostname;
- },
- deleteServer : function(hostname) {
- var hostnameStr = String(hostname);
- hostnameStr = hostnameStr.replace(/\s\s+/g, '');
- var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["c" /* GetServerByHostname */])(hostnameStr);
- if (server == null) {
- workerScript.scriptRef.log("Error: Could not find server with hostname " + hostnameStr + ". deleteServer() failed");
- return false;
- }
-
- if (!server.purchasedByPlayer || server.hostname == "home") {
- workerScript.scriptRef.log("Error: Server " + server.hostname + " is not a purchased server. " +
- "Cannot be deleted. deleteServer failed");
- return false;
- }
-
- var ip = server.ip;
-
- //A server cannot delete itself
- if (ip == workerScript.serverIp) {
- workerScript.scriptRef.log("Error: Cannot call deleteServer() on self. Function failed");
- return false;
- }
-
- //Delete all scripts running on server
- if (server.runningScripts.length > 0) {
- workerScript.scriptRef.log("Error: Cannot delete server " + server.hostname + " because it still has scripts running.");
- return false;
- }
-
- //Delete from player's purchasedServers array
- var found = false;
- for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].purchasedServers.length; ++i) {
- if (ip == __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].purchasedServers[i]) {
- found = true;
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].purchasedServers.splice(i, 1);
- break;
- }
- }
-
- if (!found) {
- workerScript.scriptRef.log("Error: Could not identify server " + server.hostname +
- "as a purchased server. This is likely a bug please contact game dev");
- return false;
- }
-
- //Delete from all servers
- delete __WEBPACK_IMPORTED_MODULE_16__Server_js__["b" /* AllServers */][ip];
-
- //Delete from home computer
- found = false;
- var homeComputer = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].getHomeComputer();
- for (var i = 0; i < homeComputer.serversOnNetwork.length; ++i) {
- if (ip == homeComputer.serversOnNetwork[i]) {
- homeComputer.serversOnNetwork.splice(i, 1);
- workerScript.scriptRef.log("Deleted server " + hostnameStr);
- return true;
- }
- }
- //Wasn't found on home computer
- workerScript.scriptRef.log("Error: Could not find server " + server.hostname +
- "as a purchased server. This is likely a bug please contact game dev");
- return false;
- },
- getPurchasedServers : function(hostname=true) {
- var res = [];
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].purchasedServers.forEach(function(ip) {
- if (hostname) {
- var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
- if (server == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "ERR: Could not find server in getPurchasedServers(). This is a bug please report to game dev");
- }
- res.push(server.hostname);
- } else {
- res.push(ip);
- }
- });
- return res;
- },
- round : function(n) {
- if (isNaN(n)) {return 0;}
- return Math.round(n);
- },
- write : function(port, data="", mode="a") {
- if (!isNaN(port)) { //Write to port
- //Port 1-10
- if (port < 1 || port > 10) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Trying to write to invalid port: " + port + ". Only ports 1-10 are valid.");
- }
- var portName = "Port" + String(port);
- var port = __WEBPACK_IMPORTED_MODULE_22__NetscriptWorker_js__["a" /* NetscriptPorts */][portName];
- if (port == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Could not find port: " + port + ". This is a bug contact the game developer");
- }
- port.push(data);
- if (port.length > __WEBPACK_IMPORTED_MODULE_17__Settings_js__["a" /* Settings */].MaxPortCapacity) {
- port.shift();
- return true;
- }
- return false;
- } else if (Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["f" /* isString */])(port)) { //Write to text file
- var fn = port;
- var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(workerScript.serverIp);
- if (server == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Error getting Server for this script in write(). This is a bug please contact game dev");
- }
- var txtFile = Object(__WEBPACK_IMPORTED_MODULE_21__TextFile_js__["b" /* getTextFile */])(fn, server);
- if (txtFile == null) {
- txtFile = Object(__WEBPACK_IMPORTED_MODULE_21__TextFile_js__["a" /* createTextFile */])(fn, data, server);
- return true;
- }
- if (mode === "w") {
- txtFile.write(data);
- } else {
- txtFile.append(data);
- }
- return true;
- } else {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Invalid argument passed in for port: " + port + ". Must be a number between 1 and 10");
- }
- },
- read : function(port) {
- if (!isNaN(port)) { //Read from port
- //Port 1-10
- if (port < 1 || port > 10) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Trying to write to invalid port: " + port + ". Only ports 1-10 are valid.");
- }
- var portName = "Port" + String(port);
- var port = __WEBPACK_IMPORTED_MODULE_22__NetscriptWorker_js__["a" /* NetscriptPorts */][portName];
- if (port == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Could not find port: " + port + ". This is a bug contact the game developer");
- }
- if (port.length == 0) {
- return "NULL PORT DATA";
- } else {
- return port.shift();
- }
- } else if (Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["f" /* isString */])(port)) { //Read from text file
- var fn = port;
- var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(workerScript.serverIp);
- if (server == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Error getting Server for this script in read(). This is a bug please contact game dev");
- }
- var txtFile = Object(__WEBPACK_IMPORTED_MODULE_21__TextFile_js__["b" /* getTextFile */])(fn, server);
- if (txtFile !== null) {
- return txtFile.text;
- } else {
- return "";
- }
- } else {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Invalid argument passed in for port: " + port + ". Must be a number between 1 and 10");
- }
- },
- scriptRunning : function(scriptname, ip) {
- var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
- if (server == null) {
- workerScript.scriptRef.log("scriptRunning() failed. Invalid IP or hostname passed in: " + ip);
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "scriptRunning() failed. Invalid IP or hostname passed in: " + ip);
- }
- for (var i = 0; i < server.runningScripts.length; ++i) {
- if (server.runningScripts[i].filename == scriptname) {
- return true;
- }
- }
- return false;
- },
- scriptKill : function(scriptname, ip) {
- var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
- if (server == null) {
- workerScript.scriptRef.log("scriptKill() failed. Invalid IP or hostname passed in: " + ip);
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "scriptKill() failed. Invalid IP or hostname passed in: " + ip);
- }
- var suc = false;
- for (var i = 0; i < server.runningScripts.length; ++i) {
- if (server.runningScripts[i].filename == scriptname) {
- Object(__WEBPACK_IMPORTED_MODULE_22__NetscriptWorker_js__["d" /* killWorkerScript */])(server.runningScripts[i], server.ip);
- suc = true;
- }
- }
- return suc;
- },
- getScriptRam : function (scriptname, ip) {
- var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
- if (server == null) {
- workerScript.scriptRef.log("getScriptRam() failed. Invalid IP or hostname passed in: " + ip);
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "getScriptRam() failed. Invalid IP or hostname passed in: " + ip);
- }
- for (var i = 0; i < server.scripts.length; ++i) {
- if (server.scripts[i].filename == scriptname) {
- return server.scripts[i].ramUsage;
- }
- }
- return 0;
- },
- getHackTime : function(ip) {
- var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
- if (server == null) {
- workerScript.scriptRef.log("getHackTime() failed. Invalid IP or hostname passed in: " + ip);
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "getHackTime() failed. Invalid IP or hostname passed in: " + ip);
- }
- return Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["j" /* scriptCalculateHackingTime */])(server); //Returns seconds
- },
- getGrowTime : function(ip) {
- var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
- if (server == null) {
- workerScript.scriptRef.log("getGrowTime() failed. Invalid IP or hostname passed in: " + ip);
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "getGrowTime() failed. Invalid IP or hostname passed in: " + ip);
- }
- return Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["h" /* scriptCalculateGrowTime */])(server) / 1000; //Returns seconds
- },
- getWeakenTime : function(ip) {
- var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
- if (server == null) {
- workerScript.scriptRef.log("getWeakenTime() failed. Invalid IP or hostname passed in: " + ip);
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "getWeakenTime() failed. Invalid IP or hostname passed in: " + ip);
- }
- return Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["l" /* scriptCalculateWeakenTime */])(server) / 1000; //Returns seconds
- },
- getScriptIncome : function(scriptname, ip) {
- if (arguments.length === 0) {
- //Get total script income
- var res = [];
- res.push(Object(__WEBPACK_IMPORTED_MODULE_0__ActiveScriptsUI_js__["d" /* updateActiveScriptsItems */])());
- res.push(__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].scriptProdSinceLastAug / (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].playtimeSinceLastAug/1000));
- return res;
- } else {
- //Get income for a particular script
- var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
- if (server == null) {
- workerScript.scriptRef.log("getScriptIncome() failed. Invalid IP or hostnamed passed in: " + ip);
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "getScriptIncome() failed. Invalid IP or hostnamed passed in: " + ip);
- }
- var argsForScript = [];
- for (var i = 2; i < arguments.length; ++i) {
- argsForScript.push(arguments[i]);
- }
- var runningScriptObj = Object(__WEBPACK_IMPORTED_MODULE_15__Script_js__["d" /* findRunningScript */])(scriptname, argsForScript, server);
- if (runningScriptObj == null) {
- workerScript.scriptRef.log("getScriptIncome() failed. No such script "+ scriptname + " on " + server.hostname + " with args: " + Object(__WEBPACK_IMPORTED_MODULE_27__utils_HelperFunctions_js__["f" /* printArray */])(argsForScript));
- return -1;
- }
- return runningScriptObj.onlineMoneyMade / runningScriptObj.onlineRunningTime;
- }
- },
- getScriptExpGain : function(scriptname, ip) {
- if (arguments.length === 0) {
- var total = 0;
- for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_22__NetscriptWorker_js__["h" /* workerScripts */].length; ++i) {
- total += (__WEBPACK_IMPORTED_MODULE_22__NetscriptWorker_js__["h" /* workerScripts */][i].scriptRef.onlineExpGained / __WEBPACK_IMPORTED_MODULE_22__NetscriptWorker_js__["h" /* workerScripts */][i].scriptRef.onlineRunningTime);
- }
- return total;
- } else {
- //Get income for a particular script
- var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
- if (server == null) {
- workerScript.scriptRef.log("getScriptExpGain() failed. Invalid IP or hostnamed passed in: " + ip);
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "getScriptExpGain() failed. Invalid IP or hostnamed passed in: " + ip);
- }
- var argsForScript = [];
- for (var i = 2; i < arguments.length; ++i) {
- argsForScript.push(arguments[i]);
- }
- var runningScriptObj = Object(__WEBPACK_IMPORTED_MODULE_15__Script_js__["d" /* findRunningScript */])(scriptname, argsForScript, server);
- if (runningScriptObj == null) {
- workerScript.scriptRef.log("getScriptExpGain() failed. No such script "+ scriptname + " on " + server.hostname + " with args: " + Object(__WEBPACK_IMPORTED_MODULE_27__utils_HelperFunctions_js__["f" /* printArray */])(argsForScript));
- return -1;
- }
- return runningScriptObj.onlineExpGained / runningScriptObj.onlineRunningTime;
- }
- },
- getTimeSinceLastAug : function() {
- return __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].playtimeSinceLastAug;
- },
- prompt : function(txt) {
- if (__WEBPACK_IMPORTED_MODULE_30__utils_YesNoBox_js__["e" /* yesNoBoxOpen */]) {
- workerScript.scriptRef.log("ERROR: confirm() failed because a pop-up dialog box is already open");
- return false;
- }
- if (!Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["f" /* isString */])(txt)) {txt = String(txt);}
- var yesBtn = Object(__WEBPACK_IMPORTED_MODULE_30__utils_YesNoBox_js__["d" /* yesNoBoxGetYesButton */])(), noBtn = Object(__WEBPACK_IMPORTED_MODULE_30__utils_YesNoBox_js__["c" /* yesNoBoxGetNoButton */])();
- yesBtn.innerHTML = "Yes";
- noBtn.innerHTML = "No";
- return new Promise(function(resolve, reject) {
- yesBtn.addEventListener("click", ()=>{
- Object(__WEBPACK_IMPORTED_MODULE_30__utils_YesNoBox_js__["a" /* yesNoBoxClose */])();
- resolve(true);
- });
- noBtn.addEventListener("click", ()=>{
- Object(__WEBPACK_IMPORTED_MODULE_30__utils_YesNoBox_js__["a" /* yesNoBoxClose */])();
- resolve(false);
- });
- Object(__WEBPACK_IMPORTED_MODULE_30__utils_YesNoBox_js__["b" /* yesNoBoxCreate */])(txt);
- });
- },
-
- /* Singularity Functions */
- universityCourse : function(universityName, className) {
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 1)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run universityCourse(). It is a Singularity Function and requires SourceFile-4 (level 1) to run.");
- return false;
- }
- }
- if (__WEBPACK_IMPORTED_MODULE_13__Missions_js__["c" /* inMission */]) {
- workerScript.scriptRef.log("ERROR: universityCourse() failed because you are in the middle of a mission.");
- return;
- }
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].isWorking) {
- var txt = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].singularityStopWork();
- workerScript.scriptRef.log(txt);
- }
-
- var costMult, expMult;
- switch(universityName.toLowerCase()) {
- case __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].AevumSummitUniversity.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Aevum) {
- workerScript.scriptRef.log("ERROR: You cannot study at Summit University because you are not in Aevum. universityCourse() failed");
- return false;
- }
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].AevumSummitUniversity;
- costMult = 4;
- expMult = 3;
- break;
- case __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Sector12RothmanUniversity.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Sector12) {
- workerScript.scriptRef.log("ERROR: You cannot study at Rothman University because you are not in Sector-12. universityCourse() failed");
- return false;
- }
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Sector12RothmanUniversity;
- costMult = 3;
- expMult = 2;
- break;
- case __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].VolhavenZBInstituteOfTechnology.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Volhaven) {
- workerScript.scriptRef.log("ERROR: You cannot study at ZB Institute of Technology because you are not in Volhaven. universityCourse() failed");
- return false;
- }
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].VolhavenZBInstituteOfTechnology;
- costMult = 5;
- expMult = 4;
- break;
- default:
- workerScript.scriptRef.log("Invalid university name: " + universityName + ". universityCourse() failed");
- return false;
- }
-
- var task;
- switch(className.toLowerCase()) {
- case "Study Computer Science".toLowerCase():
- task = __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ClassStudyComputerScience;
- break;
- case "Data Structures".toLowerCase():
- task = __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ClassDataStructures;
- break;
- case "Networks".toLowerCase():
- task = __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ClassNetworks;
- break;
- case "Algorithms".toLowerCase():
- task = __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ClassAlgorithms;
- break;
- case "Management".toLowerCase():
- task = __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ClassManagement;
- break;
- case "Leadership".toLowerCase():
- task = __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ClassLeadership;
- break;
- default:
- workerScript.scriptRef.log("Invalid class name: " + className + ". universityCourse() failed");
- return false;
- }
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startClass(costMult, expMult, task);
- workerScript.scriptRef.log("Started " + task + " at " + universityName);
- return true;
- },
-
- gymWorkout : function(gymName, stat) {
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 1)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run gymWorkout(). It is a Singularity Function and requires SourceFile-4 (level 1) to run.");
- return false;
- }
- }
- if (__WEBPACK_IMPORTED_MODULE_13__Missions_js__["c" /* inMission */]) {
- workerScript.scriptRef.log("ERROR: gymWorkout() failed because you are in the middle of a mission.");
- return;
- }
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].isWorking) {
- var txt = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].singularityStopWork();
- workerScript.scriptRef.log(txt);
- }
- var costMult, expMult;
- switch(gymName.toLowerCase()) {
- case __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].AevumCrushFitnessGym.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Aevum) {
- workerScript.scriptRef.log("ERROR: You cannot workout at Crush Fitness because you are not in Aevum. gymWorkout() failed");
- return false;
- }
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].AevumCrushFitnessGym;
- costMult = 2;
- expMult = 1.5;
- break;
- case __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].AevumSnapFitnessGym.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Aevum) {
- workerScript.scriptRef.log("ERROR: You cannot workout at Snap Fitness because you are not in Aevum. gymWorkout() failed");
- return false;
- }
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].AevumSnapFitnessGym;
- costMult = 6;
- expMult = 4;
- break;
- case __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Sector12IronGym.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Sector12) {
- workerScript.scriptRef.log("ERROR: You cannot workout at Iron Gym because you are not in Sector-12. gymWorkout() failed");
- return false;
- }
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Sector12IronGym;
- costMult = 1;
- expMult = 1;
- break;
- case __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Sector12PowerhouseGym.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Sector12) {
- workerScript.scriptRef.log("ERROR: You cannot workout at Powerhouse Gym because you are not in Sector-12. gymWorkout() failed");
- return false;
- }
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Sector12PowerhouseGym;
- costMult = 10;
- expMult = 7.5;
- break;
- case __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].VolhavenMilleniumFitnessGym:
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Volhaven) {
- workerScript.scriptRef.log("ERROR: You cannot workout at Millenium Fitness Gym because you are not in Volhaven. gymWorkout() failed");
- return false;
- }
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].VolhavenMilleniumFitnessGym;
- costMult = 3;
- expMult = 2.5;
- break;
- default:
- workerScript.scriptRef.log("Invalid gym name: " + gymName + ". gymWorkout() failed");
- return false;
- }
-
- switch(stat.toLowerCase()) {
- case "strength".toLowerCase():
- case "str".toLowerCase():
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ClassGymStrength);
- break;
- case "defense".toLowerCase():
- case "def".toLowerCase():
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ClassGymDefense);
- break;
- case "dexterity".toLowerCase():
- case "dex".toLowerCase():
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ClassGymDexterity);
- break;
- case "agility".toLowerCase():
- case "agi".toLowerCase():
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ClassGymAgility);
- break;
- default:
- workerScript.scriptRef.log("Invalid stat: " + stat + ". gymWorkout() failed");
- return false;
- }
- workerScript.scriptRef.log("Started training " + stat + " at " + gymName);
- return true;
- },
-
- travelToCity(cityname) {
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 1)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run travelToCity(). It is a Singularity Function and requires SourceFile-4 (level 1) to run.");
- return false;
- }
- }
-
- switch(cityname) {
- case __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Aevum:
- case __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Chongqing:
- case __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Sector12:
- case __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].NewTokyo:
- case __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Ishima:
- case __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Volhaven:
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].loseMoney(200000);
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].city = cityname;
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].gainIntelligenceExp(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].IntelligenceSingFnBaseExpGain);
- workerScript.scriptRef.log("Traveled to " + cityname);
- return true;
- default:
- workerScript.scriptRef.log("ERROR: Invalid city name passed into travelToCity().");
- return false;
- }
- },
-
- purchaseTor() {
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 1)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run purchaseTor(). It is a Singularity Function and requires SourceFile-4 (level 1) to run.");
- return false;
- }
- }
-
- if (__WEBPACK_IMPORTED_MODULE_18__SpecialServerIps_js__["a" /* SpecialServerIps */]["Darkweb Server"] != null) {
- workerScript.scriptRef.log("You already have a TOR router! purchaseTor() failed");
- return false;
- }
-
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].money.lt(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].TorRouterCost)) {
- workerScript.scriptRef.log("ERROR: You cannot afford to purchase a Tor router. purchaseTor() failed");
- return false;
- }
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].loseMoney(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].TorRouterCost);
-
- var darkweb = new __WEBPACK_IMPORTED_MODULE_16__Server_js__["d" /* Server */](Object(__WEBPACK_IMPORTED_MODULE_28__utils_IPAddress_js__["a" /* createRandomIp */])(), "darkweb", "", false, false, false, 1);
- Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["a" /* AddToAllServers */])(darkweb);
- __WEBPACK_IMPORTED_MODULE_18__SpecialServerIps_js__["a" /* SpecialServerIps */].addIp("Darkweb Server", darkweb.ip);
-
- document.getElementById("location-purchase-tor").setAttribute("class", "a-link-button-inactive");
-
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].getHomeComputer().serversOnNetwork.push(darkweb.ip);
- darkweb.serversOnNetwork.push(__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].getHomeComputer().ip);
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].gainIntelligenceExp(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].IntelligenceSingFnBaseExpGain);
- workerScript.scriptRef.log("You have purchased a Tor router!");
- return true;
- },
- purchaseProgram(programName) {
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 1)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run purchaseProgram(). It is a Singularity Function and requires SourceFile-4 (level 1) to run.");
- return false;
- }
- }
-
- if (__WEBPACK_IMPORTED_MODULE_18__SpecialServerIps_js__["a" /* SpecialServerIps */]["Darkweb Server"] == null) {
- workerScript.scriptRef.log("ERROR: You do not have TOR router. purchaseProgram() failed.");
- return false;
- }
-
- switch(programName.toLowerCase()) {
- case __WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].BruteSSHProgram.toLowerCase():
- var price = Object(__WEBPACK_IMPORTED_MODULE_7__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_7__DarkWeb_js__["a" /* DarkWebItems */].BruteSSHProgram);
- if (price > 0 && __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].money.gt(price)) {
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].loseMoney(price);
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].BruteSSHProgram);
- workerScript.scriptRef.log("You have purchased the BruteSSH.exe program. The new program " +
- "can be found on your home computer.");
- } else {
- workerScript.scriptRef.log("Not enough money to purchase " + programName);
- return false;
- }
- return true;
- case __WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].FTPCrackProgram.toLowerCase():
- var price = Object(__WEBPACK_IMPORTED_MODULE_7__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_7__DarkWeb_js__["a" /* DarkWebItems */].FTPCrackProgram);
- if (price > 0 && __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].money.gt(price)) {
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].loseMoney(price);
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].FTPCrackProgram);
- workerScript.scriptRef.log("You have purchased the FTPCrack.exe program. The new program " +
- "can be found on your home computer.");
- } else {
- workerScript.scriptRef.log("Not enough money to purchase " + programName);
- return false;
- }
- return true;
- case __WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram.toLowerCase():
- var price = Object(__WEBPACK_IMPORTED_MODULE_7__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_7__DarkWeb_js__["a" /* DarkWebItems */].RelaySMTPProgram);
- if (price > 0 && __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].money.gt(price)) {
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].loseMoney(price);
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram);
- workerScript.scriptRef.log("You have purchased the relaySMTP.exe program. The new program " +
- "can be found on your home computer.");
- } else {
- workerScript.scriptRef.log("Not enough money to purchase " + programName);
- return false;
- }
- return true;
- case __WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].HTTPWormProgram.toLowerCase():
- var price = Object(__WEBPACK_IMPORTED_MODULE_7__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_7__DarkWeb_js__["a" /* DarkWebItems */].HTTPWormProgram);
- if (price > 0 && __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].money.gt(price)) {
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].loseMoney(price);
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].HTTPWormProgram);
- workerScript.scriptRef.log("You have purchased the HTTPWorm.exe program. The new program " +
- "can be found on your home computer.");
- } else {
- workerScript.scriptRef.log("Not enough money to purchase " + programName);
- return false;
- }
- return true;
- case __WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].SQLInjectProgram.toLowerCase():
- var price = Object(__WEBPACK_IMPORTED_MODULE_7__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_7__DarkWeb_js__["a" /* DarkWebItems */].SQLInjectProgram);
- if (price > 0 && __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].money.gt(price)) {
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].loseMoney(price);
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].SQLInjectProgram);
- workerScript.scriptRef.log("You have purchased the SQLInject.exe program. The new program " +
- "can be found on your home computer.");
- } else {
- workerScript.scriptRef.log("Not enough money to purchase " + programName);
- return false;
- }
- return true;
- case __WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].DeepscanV1.toLowerCase():
- var price = Object(__WEBPACK_IMPORTED_MODULE_7__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_7__DarkWeb_js__["a" /* DarkWebItems */].DeepScanV1Program);
- if (price > 0 && __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].money.gt(price)) {
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].loseMoney(price);
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].DeepscanV1);
- workerScript.scriptRef.log("You have purchased the DeepscanV1.exe program. The new program " +
- "can be found on your home computer.");
- } else {
- workerScript.scriptRef.log("Not enough money to purchase " + programName);
- return false;
- }
- return true;
- case __WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].DeepscanV2.toLowerCase():
- var price = Object(__WEBPACK_IMPORTED_MODULE_7__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_7__DarkWeb_js__["a" /* DarkWebItems */].DeepScanV2Program);
- if (price > 0 && __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].money.gt(price)) {
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].loseMoney(price);
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].DeepscanV2);
- workerScript.scriptRef.log("You have purchased the DeepscanV2.exe program. The new program " +
- "can be found on your home computer.");
- } else {
- workerScript.scriptRef.log("Not enough money to purchase " + programName);
- return false;
- }
- return true;
- default:
- workerScript.scriptRef.log("ERROR: Invalid program passed into purchaseProgram().");
- return false;
- }
- return true;
- },
- getStats : function() {
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 1)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run getStats(). It is a Singularity Function and requires SourceFile-4 (level 1) to run.");
- return {};
- }
- }
-
- return {
- hacking: __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hacking_skill,
- strength: __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].strength,
- defense: __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].defense,
- dexterity: __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].dexterity,
- agility: __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].agility,
- charisma: __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].charisma,
- intelligence: __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].intelligence
- }
- },
- isBusy : function() {
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 1)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run isBusy(). It is a Singularity Function and requires SourceFile-4 (level 1) to run.");
- return;
- }
- }
- return __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].isWorking;
- },
- upgradeHomeRam() {
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 2)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run upgradeHomeRam(). It is a Singularity Function and requires SourceFile-4 (level 2) to run.");
- return false;
- }
- }
-
- //Calculate how many times ram has been upgraded (doubled)
- var currentRam = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].getHomeComputer().maxRam;
- var numUpgrades = Math.log2(currentRam);
-
- //Calculate cost
- //Have cost increase by some percentage each time RAM has been upgraded
- var cost = currentRam * __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamHome;
- var mult = Math.pow(1.55, numUpgrades);
- cost = cost * mult;
-
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].money.lt(cost)) {
- workerScript.scriptRef.log("ERROR: upgradeHomeRam() failed because you don't have enough money");
- return false;
- }
-
- var homeComputer = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].getHomeComputer();
- homeComputer.maxRam *= 2;
-
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].loseMoney(cost);
-
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].gainIntelligenceExp(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].IntelligenceSingFnBaseExpGain);
- workerScript.scriptRef.log("Purchased additional RAM for home computer! It now has " + homeComputer.maxRam + "GB of RAM.");
- return true;
- },
- getUpgradeHomeRamCost() {
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 2)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run getUpgradeHomeRamCost(). It is a Singularity Function and requires SourceFile-4 (level 2) to run.");
- return false;
- }
- }
-
- //Calculate how many times ram has been upgraded (doubled)
- var currentRam = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].getHomeComputer().maxRam;
- var numUpgrades = Math.log2(currentRam);
-
- //Calculate cost
- //Have cost increase by some percentage each time RAM has been upgraded
- var cost = currentRam * __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamHome;
- var mult = Math.pow(1.55, numUpgrades);
- return cost * mult;
- },
- workForCompany() {
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 2)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run workForCompany(). It is a Singularity Function and requires SourceFile-4 (level 2) to run.");
- return false;
- }
- }
-
- if (__WEBPACK_IMPORTED_MODULE_13__Missions_js__["c" /* inMission */]) {
- workerScript.scriptRef.log("ERROR: workForCompany() failed because you are in the middle of a mission.");
- return;
- }
-
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].companyPosition == "" || !(__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].companyPosition instanceof __WEBPACK_IMPORTED_MODULE_4__Company_js__["c" /* CompanyPosition */])) {
- workerScript.scriptRef.log("ERROR: workForCompany() failed because you do not have a job");
- return false;
- }
-
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].isWorking) {
- var txt = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].singularityStopWork();
- workerScript.scriptRef.log(txt);
- }
-
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].companyPosition.isPartTimeJob()) {
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startWorkPartTime();
- } else {
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startWork();
- }
- workerScript.scriptRef.log("Began working at " + __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].companyName + " as a " + __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].companyPosition.positionName);
- return true;
- },
- applyToCompany(companyName, field) {
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 2)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run applyToCompany(). It is a Singularity Function and requires SourceFile-4 (level 2) to run.");
- return false;
- }
- }
-
- if (!Object(__WEBPACK_IMPORTED_MODULE_4__Company_js__["e" /* companyExists */])(companyName)) {
- workerScript.scriptRef.log("ERROR: applyToCompany() failed because specified company " + companyName + " does not exist.");
- return false;
- }
-
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].location = companyName;
- var res;
- switch (field.toLowerCase()) {
- case "software":
- res = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].applyForSoftwareJob(true);
- break;
- case "software consultant":
- res = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].applyForSoftwareConsultantJob(true);
- break;
- case "it":
- res = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].applyForItJob(true);
- break;
- case "security engineer":
- res = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].applyForSecurityEngineerJob(true);
- break;
- case "network engineer":
- res = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].applyForNetworkEngineerJob(true);
- break;
- case "business":
- res = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].applyForBusinessJob(true);
- break;
- case "business consultant":
- res = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].applyForBusinessConsultantJob(true);
- break;
- case "security":
- res = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].applyForSecurityJob(true);
- break;
- case "agent":
- res = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].applyForAgentJob(true);
- break;
- case "employee":
- res = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].applyForEmployeeJob(true);
- break;
- case "part-time employee":
- res = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].applyForPartTimeEmployeeJob(true);
- break;
- case "waiter":
- res = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].applyForWaiterJob(true);
- break;
- case "part-time waiter":
- res = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].applyForPartTimeWaiterJob(true);
- break;
- default:
- workerScript.scriptRef.log("ERROR: Invalid job passed into applyToCompany: " + field + ". applyToCompany() failed");
- return false;
- }
- //The Player object's applyForJob function can return string with special error messages
- if (Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["f" /* isString */])(res)) {
- workerScript.scriptRef.log(res);
- return false;
- }
- if (res) {
- workerScript.scriptRef.log("You were offered a new job at " + companyName + " as a " + __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].companyPosition.positionName);
- } else {
- workerScript.scriptRef.log("You failed to get a new job/promotion at " + companyName + " in the " + field + " field.");
- }
- return res;
- },
- getCompanyRep(companyName) {
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 2)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run getCompanyRep(). It is a Singularity Function and requires SourceFile-4 (level 2) to run.");
- return false;
- }
- }
-
- var company = __WEBPACK_IMPORTED_MODULE_4__Company_js__["a" /* Companies */][companyName];
- if (company == null || !(company instanceof __WEBPACK_IMPORTED_MODULE_4__Company_js__["b" /* Company */])) {
- workerScript.scriptRef.log("ERROR: Invalid companyName passed into getCompanyRep(): " + companyName);
- return -1;
- }
- return company.playerReputation;
- },
- checkFactionInvitations() {
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 2)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run checkFactionInvitations(). It is a Singularity Function and requires SourceFile-4 (level 2) to run.");
- return false;
- }
- }
- //Make a copy of Player.factionInvitations
- return __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].factionInvitations.slice();
- },
- joinFaction(name) {
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 2)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run joinFaction(). It is a Singularity Function and requires SourceFile-4 (level 2) to run.");
- return false;
- }
- }
-
- if (!Object(__WEBPACK_IMPORTED_MODULE_9__Faction_js__["d" /* factionExists */])(name)) {
- workerScript.scriptRef.log("ERROR: Faction specified in joinFaction() does not exist.");
- return false;
- }
-
- if (!__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].factionInvitations.includes(name)) {
- workerScript.scriptRef.log("ERROR: Cannot join " + name + " Faction because you have not been invited. joinFaction() failed");
- return false;
- }
-
- var index = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].factionInvitations.indexOf(name);
- if (index === -1) {
- //Redundant and should never happen...
- workerScript.scriptRef.log("ERROR: Cannot join " + name + " Faction because you have not been invited. joinFaction() failed");
- return false;
- }
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].factionInvitations.splice(index, 1);
- var fac = __WEBPACK_IMPORTED_MODULE_9__Faction_js__["b" /* Factions */][name];
- Object(__WEBPACK_IMPORTED_MODULE_9__Faction_js__["h" /* joinFaction */])(fac);
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].gainIntelligenceExp(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].IntelligenceSingFnBaseExpGain);
- workerScript.scriptRef.log("Joined the " + name + " faction.");
- return true;
- },
- workForFaction(name, type) {
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 2)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run workForFaction(). It is a Singularity Function and requires SourceFile-4 (level 2) to run.");
- return false;
- }
- }
-
- if (__WEBPACK_IMPORTED_MODULE_13__Missions_js__["c" /* inMission */]) {
- workerScript.scriptRef.log("ERROR: workForFaction() failed because you are in the middle of a mission.");
- return;
- }
-
- if (!Object(__WEBPACK_IMPORTED_MODULE_9__Faction_js__["d" /* factionExists */])(name)) {
- workerScript.scriptRef.log("ERROR: Faction specified in workForFaction() does not exist.");
- return false;
- }
-
- if (!__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].factions.includes(name)) {
- workerScript.scriptRef.log("ERROR: workForFaction() failed because you are not a member of " + name);
- return false;
- }
-
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].isWorking) {
- var txt = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].singularityStopWork();
- workerScript.scriptRef.log(txt);
- }
-
- var fac = __WEBPACK_IMPORTED_MODULE_9__Faction_js__["b" /* Factions */][name];
- //Arrays listing factions that allow each time of work
- var hackAvailable = ["Illuminati", "Daedalus", "The Covenant", "ECorp", "MegaCorp",
- "Bachman & Associates", "Blade Industries", "NWO", "Clarke Incorporated",
- "OmniTek Incorporated", "Four Sigma", "KuaiGong International",
- "Fulcrum Secret Technologies", "BitRunners", "The Black Hand",
- "NiteSec", "Chongqing", "Sector-12", "New Tokyo", "Aevum",
- "Ishima", "Volhaven", "Speakers for the Dead", "The Dark Army",
- "The Syndicate", "Silhouette", "Netburners", "Tian Di Hui", "CyberSec"];
- var fdWkAvailable = ["Illuminati", "Daedalus", "The Covenant", "ECorp", "MegaCorp",
- "Bachman & Associates", "Blade Industries", "NWO", "Clarke Incorporated",
- "OmniTek Incorporated", "Four Sigma", "KuaiGong International",
- "The Black Hand", "Chongqing", "Sector-12", "New Tokyo", "Aevum",
- "Ishima", "Volhaven", "Speakers for the Dead", "The Dark Army",
- "The Syndicate", "Silhouette", "Tetrads", "Slum Snakes"];
- var scWkAvailable = ["ECorp", "MegaCorp",
- "Bachman & Associates", "Blade Industries", "NWO", "Clarke Incorporated",
- "OmniTek Incorporated", "Four Sigma", "KuaiGong International",
- "Fulcrum Secret Technologies", "Chongqing", "Sector-12", "New Tokyo", "Aevum",
- "Ishima", "Volhaven", "Speakers for the Dead",
- "The Syndicate", "Tetrads", "Slum Snakes", "Tian Di Hui"];
-
- switch (type.toLowerCase()) {
- case "hacking":
- case "hacking contracts":
- case "hackingcontracts":
- if (!hackAvailable.includes(fac.name)) {
- workerScript.scriptRef.log("ERROR: Cannot carry out hacking contracts for " + fac.name + ". workForFaction() failed");
- return false;
- }
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startFactionHackWork(fac);
- workerScript.scriptRef.log("Started carrying out hacking contracts for " + fac.name);
- return true;
- case "field":
- case "fieldwork":
- case "field work":
- if (!fdWkAvailable.includes(fac.name)) {
- workerScript.scriptRef.log("ERROR: Cannot carry out field missions for " + fac.name + ". workForFaction() failed");
- return false;
- }
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startFactionFieldWork(fac);
- workerScript.scriptRef.log("Started carrying out field missions for " + fac.name);
- return true;
- case "security":
- case "securitywork":
- case "security work":
- if (!scWkAvailable.includes(fac.name)) {
- workerScript.scriptRef.log("ERROR: Cannot serve as security detail for " + fac.name + ". workForFaction() failed");
- return false;
- }
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startFactionSecurityWork(fac);
- workerScript.scriptRef.log("Started serving as security details for " + fac.name);
- return true;
- default:
- workerScript.scriptRef.log("ERROR: Invalid work type passed into workForFaction(): " + type);
- }
- return true;
- },
- getFactionRep(name) {
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 2)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run getFactionRep(). It is a Singularity Function and requires SourceFile-4 (level 2) to run.");
- return -1;
- }
- }
-
- if (!Object(__WEBPACK_IMPORTED_MODULE_9__Faction_js__["d" /* factionExists */])(name)) {
- workerScript.scriptRef.log("ERROR: Faction specified in getFactionRep() does not exist.");
- return -1;
- }
-
- return __WEBPACK_IMPORTED_MODULE_9__Faction_js__["b" /* Factions */][name].playerReputation;
- },
- createProgram(name) {
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 3)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run createProgram(). It is a Singularity Function and requires SourceFile-4 (level 3) to run.");
- return false;
- }
- }
- if (__WEBPACK_IMPORTED_MODULE_13__Missions_js__["c" /* inMission */]) {
- workerScript.scriptRef.log("ERROR: createProgram() failed because you are in the middle of a mission.");
- return;
- }
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].isWorking) {
- var txt = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].singularityStopWork();
- workerScript.scriptRef.log(txt);
- }
-
- switch(name.toLowerCase()) {
- case __WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].NukeProgram.toLowerCase():
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].NukeProgram, __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].MillisecondsPerFiveMinutes, 1);
- break;
- case __WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].BruteSSHProgram.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hacking_skill < 50) {
- workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create BruteSSH (level 50 req)");
- return false;
- }
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].BruteSSHProgram, __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].MillisecondsPerFiveMinutes * 2, 50);
- break;
- case __WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].FTPCrackProgram.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hacking_skill < 100) {
- workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create FTPCrack (level 100 req)");
- return false;
- }
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].FTPCrackProgram, __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].MillisecondsPerHalfHour, 100);
- break;
- case __WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hacking_skill < 250) {
- workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create relaySMTP (level 250 req)");
- return false;
- }
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram, __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].MillisecondsPer2Hours, 250);
- break;
- case __WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].HTTPWormProgram.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hacking_skill < 500) {
- workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create HTTPWorm (level 500 req)");
- return false;
- }
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].HTTPWormProgram, __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].MillisecondsPer4Hours, 500);
- break;
- case __WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].SQLInjectProgram.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hacking_skill < 750) {
- workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create SQLInject (level 750 req)");
- return false;
- }
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].SQLInjectProgram, __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].MillisecondsPer8Hours, 750);
- break;
- case __WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].DeepscanV1.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hacking_skill < 75) {
- workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create DeepscanV1 (level 75 req)");
- return false;
- }
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].DeepscanV1, __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].MillisecondsPerQuarterHour, 75);
- break;
- case __WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].DeepscanV2.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hacking_skill < 400) {
- workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create DeepscanV2 (level 400 req)");
- return false;
- }
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].DeepscanV2, __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].MillisecondsPer2Hours, 400);
- break;
- case __WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].ServerProfiler.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hacking_skill < 75) {
- workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create ServerProfiler (level 75 req)");
- return false;
- }
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].ServerProfiler, __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].MillisecondsPerHalfHour, 75);
- break;
- case __WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].AutoLink.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hacking_skill < 25) {
- workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create AutoLink (level 25 req)");
- return false;
- }
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].AutoLink, __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].MillisecondsPerQuarterHour, 25);
- break;
- default:
- workerScript.scriptRef.log("ERROR: createProgram() failed because the specified program does not exist: " + name);
- return false;
- }
- workerScript.scriptRef.log("Began creating program: " + name);
- return true;
- },
- commitCrime : function(crime) {
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 3)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run commitCrime(). It is a Singularity Function and requires SourceFile-4 (level 3) to run.");
- return;
- }
- }
- if (__WEBPACK_IMPORTED_MODULE_13__Missions_js__["c" /* inMission */]) {
- workerScript.scriptRef.log("ERROR: commitCrime() failed because you are in the middle of a mission.");
- return;
- }
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].isWorking) {
- var txt = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].singularityStopWork();
- workerScript.scriptRef.log(txt);
- }
-
- //Set Location to slums
- switch(__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].city) {
- case __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Aevum:
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].AevumSlums;
- break;
- case __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Chongqing:
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].ChongqingSlums;
- break;
- case __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Sector12:
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Sector12Slums;
- break;
- case __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].NewTokyo:
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].NewTokyoSlums;
- break;
- case __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Ishima:
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].IshimaSlums;
- break;
- case __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Volhaven:
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].VolhavenSlums;
- break;
- default:
- console.log("Invalid Player.city value");
- }
-
- crime = crime.toLowerCase();
- if (crime.includes("shoplift")) {
- workerScript.scriptRef.log("Attempting to shoplift...");
- return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["k" /* commitShopliftCrime */])(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].CrimeSingFnDivider, {workerscript: workerScript});
- } else if (crime.includes("rob") && crime.includes("store")) {
- workerScript.scriptRef.log("Attempting to rob a store...");
- return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["j" /* commitRobStoreCrime */])(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].CrimeSingFnDivider, {workerscript: workerScript});
- } else if (crime.includes("mug")) {
- workerScript.scriptRef.log("Attempting to mug someone...");
- return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["i" /* commitMugCrime */])(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].CrimeSingFnDivider, {workerscript: workerScript});
- } else if (crime.includes("larceny")) {
- workerScript.scriptRef.log("Attempting to commit larceny...");
- return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["h" /* commitLarcenyCrime */])(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].CrimeSingFnDivider, {workerscript: workerScript});
- } else if (crime.includes("drugs")) {
- workerScript.scriptRef.log("Attempting to deal drugs...");
- return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["c" /* commitDealDrugsCrime */])(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].CrimeSingFnDivider, {workerscript: workerScript});
- } else if (crime.includes("bond") && crime.includes("forge")) {
- workerScript.scriptRef.log("Attempting to forge corporate bonds...");
- return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["b" /* commitBondForgeryCrime */])(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].CrimeSingFnDivider, {workerscript: workerScript});
- } else if (crime.includes("traffick") && crime.includes("arms")) {
- workerScript.scriptRef.log("Attempting to traffick illegal arms...");
- return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["l" /* commitTraffickArmsCrime */])(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].CrimeSingFnDivider, {workerscript: workerScript});
- } else if (crime.includes("homicide")) {
- workerScript.scriptRef.log("Attempting to commit homicide...");
- return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["f" /* commitHomicideCrime */])(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].CrimeSingFnDivider, {workerscript: workerScript});
- } else if (crime.includes("grand") && crime.includes("auto")) {
- workerScript.scriptRef.log("Attempting to commit grand theft auto...");
- return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["d" /* commitGrandTheftAutoCrime */])(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].CrimeSingFnDivider, {workerscript: workerScript});
- } else if (crime.includes("kidnap")) {
- workerScript.scriptRef.log("Attempting to kidnap and ransom a high-profile target...");
- return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["g" /* commitKidnapCrime */])(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].CrimeSingFnDivider, {workerscript: workerScript});
- } else if (crime.includes("assassinate")) {
- workerScript.scriptRef.log("Attempting to assassinate a high-profile target...");
- return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["a" /* commitAssassinationCrime */])(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].CrimeSingFnDivider, {workerscript: workerScript})
- } else if (crime.includes("heist")) {
- workerScript.scriptRef.log("Attempting to pull off a heist...");
- return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["e" /* commitHeistCrime */])(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].CrimeSingFnDivider, {workerscript: workerScript});
- } else {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Invalid crime passed into commitCrime(): " + crime);
- }
- },
- getCrimeChance(crime) {
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 3)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run getCrimeChance(). It is a Singularity Function and requires SourceFile-4 (level 3) to run.");
- return;
- }
- }
-
- crime = crime.toLowerCase();
- if (crime.includes("shoplift")) {
- return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["w" /* determineCrimeChanceShoplift */])();
- } else if (crime.includes("rob") && crime.includes("store")) {
- return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["v" /* determineCrimeChanceRobStore */])();
- } else if (crime.includes("mug")) {
- return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["u" /* determineCrimeChanceMug */])();
- } else if (crime.includes("larceny")) {
- return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["t" /* determineCrimeChanceLarceny */])();
- } else if (crime.includes("drugs")) {
- return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["o" /* determineCrimeChanceDealDrugs */])();
- } else if (crime.includes("bond") && crime.includes("forge")) {
- return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["n" /* determineCrimeChanceBondForgery */])();
- } else if (crime.includes("traffick") && crime.includes("arms")) {
- return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["x" /* determineCrimeChanceTraffickArms */])();
- } else if (crime.includes("homicide")) {
- return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["r" /* determineCrimeChanceHomicide */])();
- } else if (crime.includes("grand") && crime.includes("auto")) {
- return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["p" /* determineCrimeChanceGrandTheftAuto */])();
- } else if (crime.includes("kidnap")) {
- return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["s" /* determineCrimeChanceKidnap */])();
- } else if (crime.includes("assassinate")) {
- return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["m" /* determineCrimeChanceAssassination */])();
- } else if (crime.includes("heist")) {
- return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["q" /* determineCrimeChanceHeist */])();
- } else {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Invalid crime passed into getCrimeChance(): " + crime);
- }
- },
- getOwnedAugmentations(purchased=false) {
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 3)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run getOwnedAugmentations(). It is a Singularity Function and requires SourceFile-4 (level 3) to run.");
- return [];
- }
- }
- var res = [];
- for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].augmentations.length; ++i) {
- res.push(__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].augmentations[i].name);
- }
- if (purchased) {
- for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].queuedAugmentations.length; ++i) {
- res.push(__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].queuedAugmentations[i].name);
- }
- }
- return res;
- },
- getAugmentationsFromFaction(facname) {
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 3)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run getAugmentationsFromFaction(). It is a Singularity Function and requires SourceFile-4 (level 3) to run.");
- return [];
- }
- }
-
- if (!Object(__WEBPACK_IMPORTED_MODULE_9__Faction_js__["d" /* factionExists */])(facname)) {
- workerScript.scriptRef.log("ERROR: getAugmentationsFromFaction() failed. Invalid faction name passed in (this is case-sensitive): " + facname);
- return [];
- }
-
- var fac = __WEBPACK_IMPORTED_MODULE_9__Faction_js__["b" /* Factions */][facname];
- var res = [];
- for (var i = 0; i < fac.augmentations.length; ++i) {
- res.push(fac.augmentations[i]);
- }
- return res;
- },
- getAugmentationCost(name) {
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 3)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run getAugmentationCost(). It is a Singularity Function and requires SourceFile-4 (level 3) to run.");
- return false;
- }
- }
-
- if (!Object(__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["f" /* augmentationExists */])(name)) {
- workerScript.scriptRef.log("ERROR: getAugmentationCost() failed. Invalid Augmentation name passed in (note: this is case-sensitive): " + name);
- return [-1, -1];
- }
-
- var aug = __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["c" /* Augmentations */][name];
- return [aug.baseRepRequirement, aug.baseCost];
- },
- purchaseAugmentation(faction, name) {
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 3)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run purchaseAugmentation(). It is a Singularity Function and requires SourceFile-4 (level 3) to run.");
- return false;
- }
- }
-
- var fac = __WEBPACK_IMPORTED_MODULE_9__Faction_js__["b" /* Factions */][faction];
- if (fac == null || !(fac instanceof __WEBPACK_IMPORTED_MODULE_9__Faction_js__["a" /* Faction */])) {
- workerScript.scriptRef.log("ERROR: purchaseAugmentation() failed because of invalid faction name: " + faction);
- return false;
- }
-
- if (!fac.augmentations.includes(name)) {
- workerScript.scriptRef.log("ERROR: purchaseAugmentation() failed because the faction " + faction + " does not contain the " + name + " augmentation");
- return false;
- }
-
- var aug = __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["c" /* Augmentations */][name];
- if (aug == null || !(aug instanceof __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["a" /* Augmentation */])) {
- workerScript.scriptRef.log("ERROR: purchaseAugmentation() failed because of invalid augmentation name: " + name);
- return false;
- }
-
- var isNeuroflux = false;
- if (aug.name === __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["b" /* AugmentationNames */].NeuroFluxGovernor) {
- isNeuroflux = true;
- }
-
- if (!isNeuroflux) {
- for (var j = 0; j < __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].queuedAugmentations.length; ++j) {
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].queuedAugmentations[j].name === aug.name) {
- workerScript.scriptRef.log("ERROR: purchaseAugmentation() failed because you already have " + name);
- return false;
- }
- }
- for (var j = 0; j < __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].augmentations.length; ++j) {
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].augmentations[j].name === aug.name) {
- workerScript.scriptRef.log("ERROR: purchaseAugmentation() failed because you already have " + name);
- return false;
- }
- }
- }
-
- if (fac.playerReputation < aug.baseRepRequirement) {
- workerScript.scriptRef.log("ERROR: purchaseAugmentation() failed because you do not have enough reputation with " + fac.name);
- return false;
- }
-
- var res = Object(__WEBPACK_IMPORTED_MODULE_9__Faction_js__["k" /* purchaseAugmentation */])(aug, fac, true);
- workerScript.scriptRef.log(res);
- if (Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["f" /* isString */])(res) && res.startsWith("You purchased")) {
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].gainIntelligenceExp(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].IntelligenceSingFnBaseExpGain);
- return true;
- } else {
- return false;
- }
- },
- installAugmentations(cbScript) {
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 3)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run installAugmentations(). It is a Singularity Function and requires SourceFile-4 (level 3) to run.");
- return false;
- }
- }
-
- if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].queuedAugmentations.length === 0) {
- workerScript.scriptRef.log("ERROR: installAugmentations() failed because you do not have any Augmentations to be installed");
- return false;
- }
- __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].gainIntelligenceExp(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].IntelligenceSingFnBaseExpGain);
- workerScript.scriptRef.log("Installing Augmentations. This will cause this script to be killed");
- Object(__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["h" /* installAugmentations */])(cbScript);
- return true;
- }
- }
-}
-
-
-
-
/***/ }),
/* 20 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
@@ -23995,16 +21970,16 @@ function NetscriptFunctions(workerScript) {
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return applyAugmentation; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return augmentationExists; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Augmentation; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__BitNode_js__ = __webpack_require__(7);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__BitNode_js__ = __webpack_require__(8);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Constants_js__ = __webpack_require__(3);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Faction_js__ = __webpack_require__(10);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__NetscriptWorker_js__ = __webpack_require__(11);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Faction_js__ = __webpack_require__(11);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__NetscriptWorker_js__ = __webpack_require__(10);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Prestige_js__ = __webpack_require__(36);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Script_js__ = __webpack_require__(16);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Prestige_js__ = __webpack_require__(35);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Script_js__ = __webpack_require__(18);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Server_js__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_DialogBox_js__ = __webpack_require__(1);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_JSONReviver_js__ = __webpack_require__(8);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_JSONReviver_js__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_StringHelperFunctions_js__ = __webpack_require__(4);
@@ -26013,9 +23988,9 @@ function giveAllAugmentations() {
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return CompanyPosition; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return companyExists; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Constants_js__ = __webpack_require__(3);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Location_js__ = __webpack_require__(13);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Location_js__ = __webpack_require__(12);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_JSONReviver_js__ = __webpack_require__(8);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_JSONReviver_js__ = __webpack_require__(7);
@@ -27170,94 +25145,2398 @@ function getJobRequirementText(company, pos, tooltiptext=false) {
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return yesNoBoxCreate; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return yesNoTxtInpBoxCreate; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return yesNoBoxGetYesButton; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return yesNoBoxGetNoButton; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return yesNoTxtInpBoxGetYesButton; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return yesNoTxtInpBoxGetNoButton; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return yesNoTxtInpBoxGetInput; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return yesNoBoxClose; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return yesNoTxtInpBoxClose; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return yesNoBoxOpen; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__HelperFunctions_js__ = __webpack_require__(2);
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NetscriptFunctions; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return initSingularitySFFlags; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return hasSingularitySF; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return hasBn11SF; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return hasWallStreetSF; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return wallStreetSFLvl; });
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ActiveScriptsUI_js__ = __webpack_require__(26);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__ = __webpack_require__(20);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__BitNode_js__ = __webpack_require__(8);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Crimes_js__ = __webpack_require__(32);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Company_js__ = __webpack_require__(21);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Constants_js__ = __webpack_require__(3);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__ = __webpack_require__(15);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__DarkWeb_js__ = __webpack_require__(45);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__engine_js__ = __webpack_require__(5);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__Faction_js__ = __webpack_require__(11);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__HacknetNode_js__ = __webpack_require__(39);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__Location_js__ = __webpack_require__(12);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__Message_js__ = __webpack_require__(25);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__Missions_js__ = __webpack_require__(28);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__Player_js__ = __webpack_require__(0);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__Script_js__ = __webpack_require__(18);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__Server_js__ = __webpack_require__(6);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__Settings_js__ = __webpack_require__(16);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__SpecialServerIps_js__ = __webpack_require__(13);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__ = __webpack_require__(29);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__Terminal_js__ = __webpack_require__(23);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__TextFile_js__ = __webpack_require__(50);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__NetscriptWorker_js__ = __webpack_require__(10);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__ = __webpack_require__(37);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_24__NetscriptEnvironment_js__ = __webpack_require__(38);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_25__utils_decimal_js__ = __webpack_require__(24);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_25__utils_decimal_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_25__utils_decimal_js__);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_26__utils_DialogBox_js__ = __webpack_require__(1);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_27__utils_HelperFunctions_js__ = __webpack_require__(2);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_28__utils_IPAddress_js__ = __webpack_require__(19);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__ = __webpack_require__(4);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_30__utils_YesNoBox_js__ = __webpack_require__(14);
+var sprintf = __webpack_require__(44).sprintf,
+ vsprintf = __webpack_require__(44).vsprintf
-/* 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");
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+var hasSingularitySF=false, hasAISF=false, hasBn11SF=false, hasWallStreetSF=false;
+var singularitySFLvl=1, wallStreetSFLvl=1;
+
+//Used to check and set flags for every Source File, despite the name of the function
+function initSingularitySFFlags() {
+ for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].sourceFiles.length; ++i) {
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].sourceFiles[i].n === 4) {
+ hasSingularitySF = true;
+ singularitySFLvl = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].sourceFiles[i].lvl;
+ }
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].sourceFiles[i].n === 5) {
+ hasAISF = true;
+ }
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].sourceFiles[i].n === 8) {
+ hasWallStreetSF = true;
+ wallStreetSFLvl = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].sourceFiles[i].lvl;
+ }
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].sourceFiles[i].n === 11) {
+ hasBn11SF = true;
+ }
}
- yesNoBoxOpen = false;
}
-function yesNoBoxGetYesButton() {
- return Object(__WEBPACK_IMPORTED_MODULE_0__HelperFunctions_js__["b" /* clearEventListeners */])("yes-no-box-yes");
-}
+function NetscriptFunctions(workerScript) {
+ return {
+ Math : Math,
+ Date : Date,
+ hacknetnodes : __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hacknetNodes,
+ sprintf : sprintf,
+ vsprintf: vsprintf,
+ scan : function(ip=workerScript.serverIp, hostnames=true){
+ var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
+ if (server == null) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, 'Invalid IP or hostname passed into scan() command');
+ }
+ var out = [];
+ for (var i = 0; i < server.serversOnNetwork.length; i++) {
+ var entry;
+ if (hostnames) {
+ entry = server.getServerOnNetwork(i).hostname;
+ } else {
+ entry = server.getServerOnNetwork(i).ip;
+ }
+ if (entry == null) {
+ continue;
+ }
+ out.push(entry);
+ }
+ workerScript.scriptRef.log('scan() returned ' + server.serversOnNetwork.length + ' connections for ' + server.hostname);
+ return out;
+ },
+ hack : function(ip){
+ if (ip === undefined) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Hack() call has incorrect number of arguments. Takes 1 argument");
+ }
+ var threads = workerScript.scriptRef.threads;
+ if (isNaN(threads) || threads < 1) {threads = 1;}
+ var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
+ if (server == null) {
+ workerScript.scriptRef.log("hack() error. Invalid IP or hostname passed in: " + ip + ". Stopping...");
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "hack() error. Invalid IP or hostname passed in: " + ip + ". Stopping...");
+ }
-function yesNoBoxGetNoButton() {
- return Object(__WEBPACK_IMPORTED_MODULE_0__HelperFunctions_js__["b" /* clearEventListeners */])("yes-no-box-no");
-}
+ //Calculate the hacking time
+ var hackingTime = Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["j" /* scriptCalculateHackingTime */])(server); //This is in seconds
-function yesNoBoxCreate(txt) {
- if (yesNoBoxOpen) {return false;} //Already open
- yesNoBoxOpen = true;
- var textElement = document.getElementById("yes-no-box-text");
- if (textElement) {
- textElement.innerHTML = txt;
- }
+ //No root access or skill level too low
+ if (server.hasAdminRights == false) {
+ workerScript.scriptRef.log("Cannot hack this server (" + server.hostname + ") because user does not have root access");
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot hack this server (" + server.hostname + ") because user does not have root access");
+ }
- 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;
-}
+ if (server.requiredHackingSkill > __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hacking_skill) {
+ workerScript.scriptRef.log("Cannot hack this server (" + server.hostname + ") because user's hacking skill is not high enough");
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot hack this server (" + server.hostname + ") because user's hacking skill is not high enough");
+ }
-/* 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;
-}
+ workerScript.scriptRef.log("Attempting to hack " + ip + " in " + hackingTime.toFixed(3) + " seconds (t=" + threads + ")");
+ //console.log("Hacking " + server.hostname + " after " + hackingTime.toString() + " seconds (t=" + threads + ")");
+ return Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["e" /* netscriptDelay */])(hackingTime* 1000, workerScript).then(function() {
+ if (workerScript.env.stopFlag) {return Promise.reject(workerScript);}
+ var hackChance = Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["i" /* scriptCalculateHackingChance */])(server);
+ var rand = Math.random();
+ var expGainedOnSuccess = Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["g" /* scriptCalculateExpGain */])(server) * threads;
+ var expGainedOnFailure = (expGainedOnSuccess / 4);
+ if (rand < hackChance) { //Success!
+ var moneyGained = Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["k" /* scriptCalculatePercentMoneyHacked */])(server);
+ moneyGained = Math.floor(server.moneyAvailable * moneyGained) * threads;
-function yesNoTxtInpBoxGetYesButton() {
- return Object(__WEBPACK_IMPORTED_MODULE_0__HelperFunctions_js__["b" /* clearEventListeners */])("yes-no-text-input-box-yes");
-}
+ //Over-the-top safety checks
+ if (moneyGained <= 0) {
+ moneyGained = 0;
+ expGainedOnSuccess = expGainedOnFailure;
+ }
+ if (moneyGained > server.moneyAvailable) {moneyGained = server.moneyAvailable;}
+ server.moneyAvailable -= moneyGained;
+ if (server.moneyAvailable < 0) {server.moneyAvailable = 0;}
-function yesNoTxtInpBoxGetNoButton() {
- return Object(__WEBPACK_IMPORTED_MODULE_0__HelperFunctions_js__["b" /* clearEventListeners */])("yes-no-text-input-box-no");
-}
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].gainMoney(moneyGained);
+ workerScript.scriptRef.onlineMoneyMade += moneyGained;
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].scriptProdSinceLastAug += moneyGained;
+ workerScript.scriptRef.recordHack(server.ip, moneyGained, threads);
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].gainHackingExp(expGainedOnSuccess);
+ workerScript.scriptRef.onlineExpGained += expGainedOnSuccess;
+ //console.log("Script successfully hacked " + server.hostname + " for $" + formatNumber(moneyGained, 2) + " and " + formatNumber(expGainedOnSuccess, 4) + " exp");
+ workerScript.scriptRef.log("Script SUCCESSFULLY hacked " + server.hostname + " for $" + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(moneyGained, 2) + " and " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(expGainedOnSuccess, 4) + " exp (t=" + threads + ")");
+ server.fortify(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ServerFortifyAmount * threads);
+ return Promise.resolve(true);
+ } else {
+ //Player only gains 25% exp for failure? TODO Can change this later to balance
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].gainHackingExp(expGainedOnFailure);
+ workerScript.scriptRef.onlineExpGained += expGainedOnFailure;
+ //console.log("Script unsuccessful to hack " + server.hostname + ". Gained " + formatNumber(expGainedOnFailure, 4) + " exp");
+ workerScript.scriptRef.log("Script FAILED to hack " + server.hostname + ". Gained " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(expGainedOnFailure, 4) + " exp (t=" + threads + ")");
+ return Promise.resolve(false);
+ }
+ });
+ },
+ sleep : function(time,log=true){
+ if (time === undefined) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "sleep() call has incorrect number of arguments. Takes 1 argument");
+ }
+ if (log) {
+ workerScript.scriptRef.log("Sleeping for " + time + " milliseconds");
+ }
+ return Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["e" /* netscriptDelay */])(time, workerScript).then(function() {
+ return Promise.resolve(true);
+ });
+ },
+ grow : function(ip){
+ var threads = workerScript.scriptRef.threads;
+ if (isNaN(threads) || threads < 1) {threads = 1;}
+ if (ip === undefined) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "grow() call has incorrect number of arguments. Takes 1 argument");
+ }
+ var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
+ if (server == null) {
+ workerScript.scriptRef.log("Cannot grow(). Invalid IP or hostname passed in: " + ip);
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot grow(). Invalid IP or hostname passed in: " + ip);
+ }
-function yesNoTxtInpBoxGetInput() {
- var val = document.getElementById("yes-no-text-input-box-input").value;
- val = val.replace(/\s+/g, '');
- return val;
-}
+ //No root access or skill level too low
+ if (server.hasAdminRights == false) {
+ workerScript.scriptRef.log("Cannot grow this server (" + server.hostname + ") because user does not have root access");
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot grow this server (" + server.hostname + ") because user does not have root access");
+ }
-function yesNoTxtInpBoxCreate(txt) {
- yesNoBoxOpen = true;
- var txtE = document.getElementById("yes-no-text-input-box-text");
- if (txtE) {
- txtE.innerHTML = txt;
- }
+ var growTime = Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["h" /* scriptCalculateGrowTime */])(server);
+ //console.log("Executing grow() on server " + server.hostname + " in " + formatNumber(growTime/1000, 3) + " seconds")
+ workerScript.scriptRef.log("Executing grow() on server " + server.hostname + " in " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(growTime/1000, 3) + " seconds (t=" + threads + ")");
+ return Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["e" /* netscriptDelay */])(growTime, workerScript).then(function() {
+ if (workerScript.env.stopFlag) {return Promise.reject(workerScript);}
+ server.moneyAvailable += (1 * threads); //It can be grown even if it has no money
+ var growthPercentage = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["j" /* processSingleServerGrowth */])(server, 450 * threads);
+ workerScript.scriptRef.recordGrow(server.ip, threads);
+ var expGain = Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["g" /* scriptCalculateExpGain */])(server) * threads;
+ if (growthPercentage == 1) {
+ expGain = 0;
+ }
+ workerScript.scriptRef.log("Available money on " + server.hostname + " grown by "
+ + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(growthPercentage*100 - 100, 6) + "%. Gained " +
+ Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(expGain, 4) + " hacking exp (t=" + threads +")");
+ workerScript.scriptRef.onlineExpGained += expGain;
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].gainHackingExp(expGain);
+ return Promise.resolve(growthPercentage);
+ });
+ },
+ weaken : function(ip){
+ var threads = workerScript.scriptRef.threads;
+ if (isNaN(threads) || threads < 1) {threads = 1;}
+ if (ip === undefined) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "weaken() call has incorrect number of arguments. Takes 1 argument");
+ }
+ var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
+ if (server == null) {
+ workerScript.scriptRef.log("Cannot weaken(). Invalid IP or hostname passed in: " + ip);
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot weaken(). Invalid IP or hostname passed in: " + ip);
+ }
- 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");
+ //No root access or skill level too low
+ if (server.hasAdminRights == false) {
+ workerScript.scriptRef.log("Cannot weaken this server (" + server.hostname + ") because user does not have root access");
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot weaken this server (" + server.hostname + ") because user does not have root access");
+ }
+
+ var weakenTime = Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["l" /* scriptCalculateWeakenTime */])(server);
+ workerScript.scriptRef.log("Executing weaken() on server " + server.hostname + " in " +
+ Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(weakenTime/1000, 3) + " seconds (t=" + threads + ")");
+ return Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["e" /* netscriptDelay */])(weakenTime, workerScript).then(function() {
+ if (workerScript.env.stopFlag) {return Promise.reject(workerScript);}
+ server.weaken(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ServerWeakenAmount * threads);
+ workerScript.scriptRef.recordWeaken(server.ip, threads);
+ var expGain = Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["g" /* scriptCalculateExpGain */])(server) * threads;
+ workerScript.scriptRef.log("Server security level on " + server.hostname + " weakened to " + server.hackDifficulty +
+ ". Gained " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(expGain, 4) + " hacking exp (t=" + threads + ")");
+ workerScript.scriptRef.onlineExpGained += expGain;
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].gainHackingExp(expGain);
+ return Promise.resolve(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ServerWeakenAmount * threads);
+ });
+ },
+ print : function(args){
+ if (args === undefined) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "print() call has incorrect number of arguments. Takes 1 argument");
+ }
+ workerScript.scriptRef.log(args.toString());
+ },
+ tprint : function(args) {
+ if (args === undefined || args == null) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "tprint() call has incorrect number of arguments. Takes 1 argument");
+ }
+ var x = args.toString();
+ if (Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["d" /* isHTML */])(x)) {
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].takeDamage(1);
+ Object(__WEBPACK_IMPORTED_MODULE_26__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You suddenly feel a sharp shooting pain through your body as an angry voice in your head exclaims:
" +
+ "DON'T USE TPRINT() TO OUTPUT HTML ELEMENTS TO YOUR TERMINAL!!!!
" +
+ "(You lost 1 HP)");
+ return;
+ }
+ Object(__WEBPACK_IMPORTED_MODULE_20__Terminal_js__["b" /* post */])(workerScript.scriptRef.filename + ": " + args.toString());
+ },
+ clearLog : function() {
+ workerScript.scriptRef.clearLog();
+ },
+ nuke : function(ip){
+ if (ip === undefined) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument");
+ }
+ var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
+ if (server == null) {
+ workerScript.scriptRef.log("Cannot call nuke(). Invalid IP or hostname passed in: " + ip);
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call nuke(). Invalid IP or hostname passed in: " + ip);
+ }
+ if (!__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].NukeProgram)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "You do not have the NUKE.exe virus!");
+ }
+ if (server.openPortCount < server.numOpenPortsRequired) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Not enough ports opened to use NUKE.exe virus");
+ }
+ if (server.hasAdminRights) {
+ workerScript.scriptRef.log("Already have root access to " + server.hostname);
+ } else {
+ server.hasAdminRights = true;
+ workerScript.scriptRef.log("Executed NUKE.exe virus on " + server.hostname + " to gain root access");
+ }
+ return true;
+ },
+ brutessh : function(ip){
+ if (ip === undefined) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument");
+ }
+ var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
+ if (server == null) {
+ workerScript.scriptRef.log("Cannot call brutessh(). Invalid IP or hostname passed in: " + ip);
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call brutessh(). Invalid IP or hostname passed in: " + ip);
+ }
+ if (!__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].BruteSSHProgram)) {
+ workerScript.scriptRef.log("You do not have the BruteSSH.exe program!");
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "You do not have the BruteSSH.exe program!");
+ }
+ if (!server.sshPortOpen) {
+ workerScript.scriptRef.log("Executed BruteSSH.exe on " + server.hostname + " to open SSH port (22)");
+ server.sshPortOpen = true;
+ ++server.openPortCount;
+ } else {
+ workerScript.scriptRef.log("SSH Port (22) already opened on " + server.hostname);
+ }
+ return true;
+ },
+ ftpcrack : function(ip){
+ if (ip === undefined) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument");
+ }
+ var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
+ if (server == null) {
+ workerScript.scriptRef.log("Cannot call ftpcrack(). Invalid IP or hostname passed in: " + ip);
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call ftpcrack(). Invalid IP or hostname passed in: " + ip);
+ }
+ if (!__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].FTPCrackProgram)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "You do not have the FTPCrack.exe program!");
+ }
+ if (!server.ftpPortOpen) {
+ workerScript.scriptRef.log("Executed FTPCrack.exe on " + server.hostname + " to open FTP port (21)");
+ server.ftpPortOpen = true;
+ ++server.openPortCount;
+ } else {
+ workerScript.scriptRef.log("FTP Port (21) already opened on " + server.hostname);
+ }
+ return true;
+ },
+ relaysmtp : function(ip){
+ if (ip === undefined) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument");
+ }
+ var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
+ if (server == null) {
+ workerScript.scriptRef.log("Cannot call relaysmtp(). Invalid IP or hostname passed in: " + ip);
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call relaysmtp(). Invalid IP or hostname passed in: " + ip);
+ }
+ if (!__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "You do not have the relaySMTP.exe program!");
+ }
+ if (!server.smtpPortOpen) {
+ workerScript.scriptRef.log("Executed relaySMTP.exe on " + server.hostname + " to open SMTP port (25)");
+ server.smtpPortOpen = true;
+ ++server.openPortCount;
+ } else {
+ workerScript.scriptRef.log("SMTP Port (25) already opened on " + server.hostname);
+ }
+ return true;
+ },
+ httpworm : function(ip){
+ if (ip === undefined) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument");
+ }
+ var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
+ if (server == null) {
+ workerScript.scriptRef.log("Cannot call httpworm(). Invalid IP or hostname passed in: " + ip);
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call httpworm(). Invalid IP or hostname passed in: " + ip);
+ }
+ if (!__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].HTTPWormProgram)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "You do not have the HTTPWorm.exe program!");
+ }
+ if (!server.httpPortOpen) {
+ workerScript.scriptRef.log("Executed HTTPWorm.exe on " + server.hostname + " to open HTTP port (80)");
+ server.httpPortOpen = true;
+ ++server.openPortCount;
+ } else {
+ workerScript.scriptRef.log("HTTP Port (80) already opened on " + server.hostname);
+ }
+ return true;
+ },
+ sqlinject : function(ip){
+ if (ip === undefined) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument");
+ }
+ var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
+ if (server == null) {
+ workerScript.scriptRef.log("Cannot call sqlinject(). Invalid IP or hostname passed in: " + ip);
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call sqlinject(). Invalid IP or hostname passed in: " + ip);
+ }
+ if (!__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].SQLInjectProgram)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "You do not have the SQLInject.exe program!");
+ }
+ if (!server.sqlPortOpen) {
+ workerScript.scriptRef.log("Executed SQLInject.exe on " + server.hostname + " to open SQL port (1433)");
+ server.sqlPortOpen = true;
+ ++server.openPortCount;
+ } else {
+ workerScript.scriptRef.log("SQL Port (1433) already opened on " + server.hostname);
+ }
+ return true;
+ },
+ run : function(scriptname,threads = 1){
+ if (scriptname === undefined) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "run() call has incorrect number of arguments. Usage: run(scriptname, [numThreads], [arg1], [arg2]...)");
+ }
+ if (isNaN(threads) || threads < 1) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Invalid argument for thread count passed into run(). Must be numeric and greater than 0");
+ }
+ var argsForNewScript = [];
+ for (var i = 2; i < arguments.length; ++i) {
+ argsForNewScript.push(arguments[i]);
+ }
+ var scriptServer = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(workerScript.serverIp);
+ if (scriptServer == null) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Could not find server. This is a bug in the game. Report to game dev");
+ }
+
+ return Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["f" /* runScriptFromScript */])(scriptServer, scriptname, argsForNewScript, workerScript, threads);
+ },
+ exec : function(scriptname,ip,threads = 1){
+ if (scriptname === undefined || ip === undefined) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "exec() call has incorrect number of arguments. Usage: exec(scriptname, server, [numThreads], [arg1], [arg2]...)");
+ }
+ if (isNaN(threads) || threads < 1) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Invalid argument for thread count passed into exec(). Must be numeric and greater than 0");
+ }
+ var argsForNewScript = [];
+ for (var i = 3; i < arguments.length; ++i) {
+ argsForNewScript.push(arguments[i]);
+ }
+ var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
+ if (server == null) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Invalid hostname/ip passed into exec() command: " + ip);
+ }
+ return Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["f" /* runScriptFromScript */])(server, scriptname, argsForNewScript, workerScript, threads);
+ },
+ kill : function(filename,ip){
+ if (filename === undefined || ip === undefined) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "kill() call has incorrect number of arguments. Usage: kill(scriptname, server, [arg1], [arg2]...)");
+ }
+ var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
+ if (server == null) {
+ workerScript.scriptRef.log("kill() failed. Invalid IP or hostname passed in: " + ip);
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "kill() failed. Invalid IP or hostname passed in: " + ip);
+ }
+ var argsForKillTarget = [];
+ for (var i = 2; i < arguments.length; ++i) {
+ argsForKillTarget.push(arguments[i]);
+ }
+ var runningScriptObj = Object(__WEBPACK_IMPORTED_MODULE_15__Script_js__["d" /* findRunningScript */])(filename, argsForKillTarget, server);
+ if (runningScriptObj == null) {
+ workerScript.scriptRef.log("kill() failed. No such script "+ filename + " on " + server.hostname + " with args: " + Object(__WEBPACK_IMPORTED_MODULE_27__utils_HelperFunctions_js__["j" /* printArray */])(argsForKillTarget));
+ return false;
+ }
+ var res = Object(__WEBPACK_IMPORTED_MODULE_22__NetscriptWorker_js__["d" /* killWorkerScript */])(runningScriptObj, server.ip);
+ if (res) {
+ workerScript.scriptRef.log("Killing " + filename + " on " + server.hostname + " with args: " + Object(__WEBPACK_IMPORTED_MODULE_27__utils_HelperFunctions_js__["j" /* printArray */])(argsForKillTarget) + ". May take up to a few minutes for the scripts to die...");
+ return true;
+ } else {
+ workerScript.scriptRef.log("kill() failed. No such script "+ filename + " on " + server.hostname + " with args: " + Object(__WEBPACK_IMPORTED_MODULE_27__utils_HelperFunctions_js__["j" /* printArray */])(argsForKillTarget));
+ return false;
+ }
+ },
+ killall : function(ip){
+ if (ip === undefined) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "killall() call has incorrect number of arguments. Takes 1 argument");
+ }
+ var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
+ if (server == null) {
+ workerScript.scriptRef.log("killall() failed. Invalid IP or hostname passed in: " + ip);
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "killall() failed. Invalid IP or hostname passed in: " + ip);
+ }
+ for (var i = server.runningScripts.length-1; i >= 0; --i) {
+ Object(__WEBPACK_IMPORTED_MODULE_22__NetscriptWorker_js__["d" /* killWorkerScript */])(server.runningScripts[i], server.ip);
+ }
+ workerScript.scriptRef.log("killall(): Killing all scripts on " + server.hostname + ". May take a few minutes for the scripts to die");
+ return true;
+ },
+ scp : function(scriptname, ip1, ip2){
+ if (arguments.length !== 2 && arguments.length !== 3) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Error: scp() call has incorrect number of arguments. Takes 2 or 3 arguments");
+ }
+ if (scriptname && scriptname.constructor === Array) {
+ //Recursively call scp on all elements of array
+ var res = false;
+ scriptname.forEach(function(script) {
+ if (NetscriptFunctions(workerScript).scp(script, ip1, ip2)) {
+ res = true;
+ };
+ });
+ return res;
+ }
+ if (!scriptname.endsWith(".lit") && !scriptname.endsWith(".script")) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Error: scp() only works for .script and .lit files");
+ }
+
+ var destServer, currServ;
+
+ if (arguments.length === 3) { //scriptname, source, destination
+ if (scriptname === undefined || ip1 === undefined || ip2 === undefined) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Error: scp() call has incorrect number of arguments. Takes 2 or 3 arguments");
+ }
+ destServer = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip2);
+ if (destServer == null) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Error: Invalid hostname/ip passed into scp() command: " + ip);
+ }
+
+ currServ = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip1);
+ if (currServ == null) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Could not find server ip for this script. This is a bug please contact game developer");
+ }
+ } else if (arguments.length === 2) { //scriptname, destination
+ if (scriptname === undefined || ip1 === undefined) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Error: scp() call has incorrect number of arguments. Takes 2 or 3 arguments");
+ }
+ destServer = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip1);
+ if (destServer == null) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Error: Invalid hostname/ip passed into scp() command: " + ip);
+ }
+
+ currServ = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(workerScript.serverIp);
+ if (currServ == null) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Could not find server ip for this script. This is a bug please contact game developer");
+ }
+ }
+
+ //Scp for lit files
+ if (scriptname.endsWith(".lit")) {
+ var found = false;
+ for (var i = 0; i < currServ.messages.length; ++i) {
+ if (!(currServ.messages[i] instanceof __WEBPACK_IMPORTED_MODULE_12__Message_js__["a" /* Message */]) && currServ.messages[i] == scriptname) {
+ found = true;
+ }
+ }
+
+ if (!found) {
+ workerScript.scriptRef.log(scriptname + " does not exist. scp() failed");
+ return false;
+ }
+
+ for (var i = 0; i < destServer.messages.length; ++i) {
+ if (destServer.messages[i] === scriptname) {
+ workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname);
+ return true; //Already exists
+ }
+ }
+ destServer.messages.push(scriptname);
+ workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname);
+ return true;
+ }
+
+ //Scp for script files
+ var sourceScript = null;
+ for (var i = 0; i < currServ.scripts.length; ++i) {
+ if (scriptname == currServ.scripts[i].filename) {
+ sourceScript = currServ.scripts[i];
+ break;
+ }
+ }
+ if (sourceScript == null) {
+ workerScript.scriptRef.log(scriptname + " does not exist. scp() failed");
+ return false;
+ }
+
+ //Overwrite script if it already exists
+ for (var i = 0; i < destServer.scripts.length; ++i) {
+ if (scriptname == destServer.scripts[i].filename) {
+ workerScript.scriptRef.log("WARNING: " + scriptname + " already exists on " + destServer.hostname + " and it will be overwritten.");
+ workerScript.scriptRef.log(scriptname + " overwritten on " + destServer.hostname);
+ var oldScript = destServer.scripts[i];
+ oldScript.code = sourceScript.code;
+ oldScript.ramUsage = sourceScript.ramUsage;
+ return true;
+ }
+ }
+
+ //Create new script if it does not already exist
+ var newScript = new __WEBPACK_IMPORTED_MODULE_15__Script_js__["c" /* Script */]();
+ newScript.filename = scriptname;
+ newScript.code = sourceScript.code;
+ newScript.ramUsage = sourceScript.ramUsage;
+ newScript.server = destServer.ip;
+ destServer.scripts.push(newScript);
+ workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname);
+ return true;
+ },
+ ls : function(ip, grep) {
+ if (ip === undefined) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "ls() failed because of invalid arguments. Usage: ls(ip/hostname, [grep filter])");
+ }
+ var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
+ if (server == null) {
+ workerScript.scriptRef.log("ls() failed. Invalid IP or hostname passed in: " + ip);
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "ls() failed. Invalid IP or hostname passed in: " + ip);
+ }
+
+ //Get the grep filter, if one exists
+ var filter = false;
+ if (arguments.length >= 2) {
+ filter = grep.toString();
+ }
+
+ var allFiles = [];
+ for (var i = 0; i < server.programs.length; i++) {
+ if (filter) {
+ if (server.programs[i].includes(filter)) {
+ allFiles.push(server.programs[i]);
+ }
+ } else {
+ allFiles.push(server.programs[i]);
+ }
+ }
+ for (var i = 0; i < server.scripts.length; i++) {
+ if (filter) {
+ if (server.scripts[i].filename.includes(filter)) {
+ allFiles.push(server.scripts[i].filename);
+ }
+ } else {
+ allFiles.push(server.scripts[i].filename);
+ }
+
+ }
+ for (var i = 0; i < server.messages.length; i++) {
+ if (filter) {
+ if (server.messages[i] instanceof __WEBPACK_IMPORTED_MODULE_12__Message_js__["a" /* Message */]) {
+ if (server.messages[i].filename.includes(filter)) {
+ allFiles.push(server.messages[i].filename);
+ }
+ } else if (server.messages[i].includes(filter)) {
+ allFiles.push(server.messages[i]);
+ }
+ } else {
+ if (server.messages[i] instanceof __WEBPACK_IMPORTED_MODULE_12__Message_js__["a" /* Message */]) {
+ allFiles.push(server.messages[i].filename);
+ } else {
+ allFiles.push(server.messages[i]);
+ }
+ }
+ }
+
+ //Sort the files alphabetically then print each
+ allFiles.sort();
+ return allFiles;
+ },
+ hasRootAccess : function(ip){
+ if (ip===undefined){
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "hasRootAccess() call has incorrect number of arguments. Takes 1 argument");
+ }
+ var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
+ if (server == null){
+ workerScript.scriptRef.log("hasRootAccess() failed. Invalid IP or hostname passed in: " + ip);
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "hasRootAccess() failed. Invalid IP or hostname passed in: " + ip);
+ }
+ return server.hasAdminRights;
+ },
+ getIp : function() {
+ var scriptServer = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(workerScript.serverIp);
+ if (scriptServer == null) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Could not find server. This is a bug in the game. Report to game dev");
+ }
+ return scriptServer.ip;
+ },
+ getHostname : function(){
+ var scriptServer = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(workerScript.serverIp);
+ if (scriptServer == null) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Could not find server. This is a bug in the game. Report to game dev");
+ }
+ return scriptServer.hostname;
+ },
+ getHackingLevel : function(){
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].updateSkillLevels();
+ workerScript.scriptRef.log("getHackingLevel() returned " + __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hacking_skill);
+ return __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hacking_skill;
+ },
+ getHackingMultipliers : function() {
+ return {
+ chance: __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hacking_chance_mult,
+ speed: __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hacking_speed_mult,
+ money: __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hacking_money_mult,
+ growth: __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hacking_grow_mult,
+ };
+ },
+ getBitNodeMultipliers: function() {
+ if (!hasAISF) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run getBitNodeMultipliers(). It requires Source-File 5 to run.");
+ }
+ return __WEBPACK_IMPORTED_MODULE_2__BitNode_js__["a" /* BitNodeMultipliers */];
+ },
+ getServerMoneyAvailable : function(ip){
+ var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
+ if (server == null) {
+ workerScript.scriptRef.log("getServerMoneyAvailable() failed. Invalid IP or hostname passed in: " + ip);
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "getServerMoneyAvailable() failed. Invalid IP or hostname passed in: " + ip);
+ }
+ if (server.hostname == "home") {
+ //Return player's money
+ workerScript.scriptRef.log("getServerMoneyAvailable('home') returned player's money: $" + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].money.toNumber(), 2));
+ return __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].money.toNumber();
+ }
+ workerScript.scriptRef.log("getServerMoneyAvailable() returned " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.moneyAvailable, 2) + " for " + server.hostname);
+ return server.moneyAvailable;
+ },
+ getServerSecurityLevel : function(ip){
+ var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
+ if (server == null) {
+ workerScript.scriptRef.log("getServerSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "getServerSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
+ }
+ workerScript.scriptRef.log("getServerSecurityLevel() returned " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.hackDifficulty, 3) + " for " + server.hostname);
+ return server.hackDifficulty;
+ },
+ getServerBaseSecurityLevel : function(ip){
+ var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
+ if (server == null) {
+ workerScript.scriptRef.log("getServerBaseSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "getServerBaseSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
+ }
+ workerScript.scriptRef.log("getServerBaseSecurityLevel() returned " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.baseDifficulty, 3) + " for " + server.hostname);
+ return server.baseDifficulty;
+ },
+ getServerMinSecurityLevel : function(ip) {
+ var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
+ if (server == null) {
+ workerScript.scriptRef.log("getServerMinSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "getServerMinSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
+ }
+ workerScript.scriptRef.log("getServerMinSecurityLevel() returned " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.minDifficulty, 3) + " for " + server.hostname);
+ return server.minDifficulty;
+ },
+ getServerRequiredHackingLevel : function(ip){
+ var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
+ if (server == null) {
+ workerScript.scriptRef.log("getServerRequiredHackingLevel() failed. Invalid IP or hostname passed in: " + ip);
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "getServerRequiredHackingLevel() failed. Invalid IP or hostname passed in: " + ip);
+ }
+ workerScript.scriptRef.log("getServerRequiredHackingLevel returned " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.requiredHackingSkill, 0) + " for " + server.hostname);
+ return server.requiredHackingSkill;
+ },
+ getServerMaxMoney : function(ip){
+ var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
+ if (server == null) {
+ workerScript.scriptRef.log("getServerMaxMoney() failed. Invalid IP or hostname passed in: " + ip);
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "getServerMaxMoney() failed. Invalid IP or hostname passed in: " + ip);
+ }
+ workerScript.scriptRef.log("getServerMaxMoney() returned " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.moneyMax, 0) + " for " + server.hostname);
+ return server.moneyMax;
+ },
+ getServerGrowth : function(ip) {
+ var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
+ if (server == null) {
+ workerScript.scriptRef.log("getServerGrowth() failed. Invalid IP or hostname passed in: " + ip);
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "getServerGrowth() failed. Invalid IP or hostname passed in: " + ip);
+ }
+ workerScript.scriptRef.log("getServerGrowth() returned " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.serverGrowth, 0) + " for " + server.hostname);
+ return server.serverGrowth;
+ },
+ getServerNumPortsRequired : function(ip){
+ var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
+ if (server == null) {
+ workerScript.scriptRef.log("getServerNumPortsRequired() failed. Invalid IP or hostname passed in: " + ip);
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "getServerNumPortsRequired() failed. Invalid IP or hostname passed in: " + ip);
+ }
+ workerScript.scriptRef.log("getServerNumPortsRequired() returned " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.numOpenPortsRequired, 0) + " for " + server.hostname);
+ return server.numOpenPortsRequired;
+ },
+ getServerRam : function(ip) {
+ var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
+ if (server == null) {
+ workerScript.scriptRef.log("getServerRam() failed. Invalid IP or hostname passed in: " + ip);
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "getServerRam() failed. Invalid IP or hostname passed in: " + ip);
+ }
+ workerScript.scriptRef.log("getServerRam() returned [" + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.maxRam, 2) + "GB, " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.ramUsed, 2) + "GB]");
+ return [server.maxRam, server.ramUsed];
+ },
+ serverExists : function(ip) {
+ return (Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip) !== null);
+ },
+ fileExists : function(filename,ip=workerScript.serverIp){
+ if (filename === undefined) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "fileExists() call has incorrect number of arguments. Usage: fileExists(scriptname, [server])");
+ }
+ var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
+ if (server == null) {
+ workerScript.scriptRef.log("fileExists() failed. Invalid IP or hostname passed in: " + ip);
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "fileExists() failed. Invalid IP or hostname passed in: " + ip);
+ }
+ for (var i = 0; i < server.scripts.length; ++i) {
+ if (filename == server.scripts[i].filename) {
+ return true;
+ }
+ }
+ for (var i = 0; i < server.programs.length; ++i) {
+ if (filename.toLowerCase() == server.programs[i].toLowerCase()) {
+ return true;
+ }
+ }
+ for (var i = 0; i < server.messages.length; ++i) {
+ if (!(server.messages[i] instanceof __WEBPACK_IMPORTED_MODULE_12__Message_js__["a" /* Message */]) &&
+ filename.toLowerCase() === server.messages[i]) {
+ return true;
+ }
+ }
+ return false;
+ },
+ isRunning : function(filename,ip){
+ if (filename === undefined || ip === undefined) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "isRunning() call has incorrect number of arguments. Usage: isRunning(scriptname, server, [arg1], [arg2]...)");
+ }
+ var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
+ if (server == null) {
+ workerScript.scriptRef.log("isRunning() failed. Invalid IP or hostname passed in: " + ip);
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "isRunning() failed. Invalid IP or hostname passed in: " + ip);
+ }
+ var argsForTargetScript = [];
+ for (var i = 2; i < arguments.length; ++i) {
+ argsForTargetScript.push(arguments[i]);
+ }
+ return (Object(__WEBPACK_IMPORTED_MODULE_15__Script_js__["d" /* findRunningScript */])(filename, argsForTargetScript, server) != null);
+ },
+ getNextHacknetNodeCost : __WEBPACK_IMPORTED_MODULE_10__HacknetNode_js__["b" /* getCostOfNextHacknetNode */],
+ purchaseHacknetNode : __WEBPACK_IMPORTED_MODULE_10__HacknetNode_js__["d" /* purchaseHacknet */],
+ getStockPrice : function(symbol) {
+ if (!__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hasTixApiAccess) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use getStockPrice()");
+ }
+ var stock = __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["d" /* SymbolToStockMap */][symbol];
+ if (stock == null) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Invalid stock symbol passed into getStockPrice()");
+ }
+ return parseFloat(stock.price.toFixed(3));
+ },
+ getStockPosition : function(symbol) {
+ if (!__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hasTixApiAccess) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use getStockPosition()");
+ }
+ var stock = __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["d" /* SymbolToStockMap */][symbol];
+ if (stock == null) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Invalid stock symbol passed into getStockPrice()");
+ }
+ return [stock.playerShares, stock.playerAvgPx, stock.playerShortShares, stock.playerAvgShortPx];
+ },
+ buyStock : function(symbol, shares) {
+ if (!__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hasTixApiAccess) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use buyStock()");
+ }
+ var stock = __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["d" /* SymbolToStockMap */][symbol];
+ if (stock == null) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Invalid stock symbol passed into buyStock()");
+ }
+ if (shares < 0 || isNaN(shares)) {
+ workerScript.scriptRef.log("Error: Invalid 'shares' argument passed to buyStock()");
+ return 0;
+ }
+ shares = Math.round(shares);
+ if (shares === 0) {return 0;}
+
+ var totalPrice = stock.price * shares;
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].money.lt(totalPrice + __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].StockMarketCommission)) {
+ workerScript.scriptRef.log("Not enough money to purchase " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(shares, 0) + " shares of " +
+ symbol + ". Need $" +
+ Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(totalPrice + __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].StockMarketCommission, 2).toString());
+ return 0;
+ }
+
+ var origTotal = stock.playerShares * stock.playerAvgPx;
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].loseMoney(totalPrice + __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].StockMarketCommission);
+ var newTotal = origTotal + totalPrice;
+ stock.playerShares += shares;
+ stock.playerAvgPx = newTotal / stock.playerShares;
+ if (__WEBPACK_IMPORTED_MODULE_8__engine_js__["Engine"].currentPage == __WEBPACK_IMPORTED_MODULE_8__engine_js__["Engine"].Page.StockMarket) {
+ Object(__WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["p" /* updateStockPlayerPosition */])(stock);
+ }
+ workerScript.scriptRef.log("Bought " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(shares, 0) + " shares of " + stock.symbol + " at $" +
+ Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(stock.price, 2) + " per share");
+ return stock.price;
+ },
+ sellStock : function(symbol, shares) {
+ if (!__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hasTixApiAccess) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use sellStock()");
+ }
+ var stock = __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["d" /* SymbolToStockMap */][symbol];
+ if (stock == null) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Invalid stock symbol passed into sellStock()");
+ }
+ if (shares < 0 || isNaN(shares)) {
+ workerScript.scriptRef.log("Error: Invalid 'shares' argument passed to sellStock()");
+ return 0;
+ }
+ shares = Math.round(shares);
+ if (shares > stock.playerShares) {shares = stock.playerShares;}
+ if (shares === 0) {return 0;}
+ var gains = stock.price * shares - __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].StockMarketCommission;
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].gainMoney(gains);
+
+ //Calculate net profit and add to script stats
+ var netProfit = ((stock.price - stock.playerAvgPx) * shares) - __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].StockMarketCommission;
+ if (isNaN(netProfit)) {netProfit = 0;}
+ workerScript.scriptRef.onlineMoneyMade += netProfit;
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].scriptProdSinceLastAug += netProfit;
+
+ stock.playerShares -= shares;
+ if (stock.playerShares == 0) {
+ stock.playerAvgPx = 0;
+ }
+ if (__WEBPACK_IMPORTED_MODULE_8__engine_js__["Engine"].currentPage == __WEBPACK_IMPORTED_MODULE_8__engine_js__["Engine"].Page.StockMarket) {
+ Object(__WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["p" /* updateStockPlayerPosition */])(stock);
+ }
+ workerScript.scriptRef.log("Sold " + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(shares, 0) + " shares of " + stock.symbol + " at $" +
+ Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(stock.price, 2) + " per share. Gained " +
+ "$" + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(gains, 2));
+ return stock.price;
+ },
+ shortStock(symbol, shares) {
+ if (!__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hasTixApiAccess) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use shortStock()");
+ }
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN !== 8) {
+ if (!(hasWallStreetSF && wallStreetSFLvl >= 2)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "ERROR: Cannot use shortStock(). You must either be in BitNode-8 or you must have Level 2 of Source-File 8");
+ }
+ }
+ var stock = __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["d" /* SymbolToStockMap */][symbol];
+ if (stock == null) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "ERROR: Invalid stock symbol passed into shortStock()");
+ }
+ var res = Object(__WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["n" /* shortStock */])(stock, shares, workerScript);
+ return res ? stock.price : 0;
+ },
+ sellShort(symbol, shares) {
+ if (!__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hasTixApiAccess) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use sellShort()");
+ }
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN !== 8) {
+ if (!(hasWallStreetSF && wallStreetSFLvl >= 2)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "ERROR: Cannot use sellShort(). You must either be in BitNode-8 or you must have Level 2 of Source-File 8");
+ }
+ }
+ var stock = __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["d" /* SymbolToStockMap */][symbol];
+ if (stock == null) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "ERROR: Invalid stock symbol passed into sellShort()");
+ }
+ var res = Object(__WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["l" /* sellShort */])(stock, shares, workerScript);
+ return res ? stock.price : 0;
+ },
+ placeOrder(symbol, shares, price, type, pos) {
+ if (!__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hasTixApiAccess) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use placeOrder()");
+ }
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN !== 8) {
+ if (!(hasWallStreetSF && wallStreetSFLvl >= 3)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "ERROR: Cannot use placeOrder(). You must either be in BitNode-8 or have Level 3 of Source-File 8");
+ }
+ }
+ var stock = __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["d" /* SymbolToStockMap */][symbol];
+ if (stock == null) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "ERROR: Invalid stock symbol passed into placeOrder()");
+ }
+ var orderType, orderPos;
+ type = type.toLowerCase();
+ if (type.includes("limit") && type.includes("buy")) {
+ orderType = __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["a" /* OrderTypes */].LimitBuy;
+ } else if (type.includes("limit") && type.includes("sell")) {
+ orderType = __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["a" /* OrderTypes */].LimitSell;
+ } else if (type.includes("stop") && type.includes("buy")) {
+ orderType = __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["a" /* OrderTypes */].StopBuy;
+ } else if (type.includes("stop") && type.includes("sell")) {
+ orderType = __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["a" /* OrderTypes */].StopSell;
+ } else {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "ERROR: Invalid Order Type passed into placeOrder()");
+ }
+
+ pos = pos.toLowerCase();
+ if (pos.includes("l")) {
+ orderPos = __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["b" /* PositionTypes */].Long;
+ } else if (pos.includes('s')) {
+ orderPos = __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["b" /* PositionTypes */].Short;
+ } else {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "ERROR: Invalid Position Type passed into placeOrder()");
+ }
+
+ return Object(__WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["k" /* placeOrder */])(stock, shares, price, orderType, orderPos, workerScript);
+ },
+ cancelOrder(symbol, shares, price, type, pos) {
+ if (!__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hasTixApiAccess) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use cancelOrder()");
+ }
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN !== 8) {
+ if (!(hasWallStreetSF && wallStreetSFLvl >= 3)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "ERROR: Cannot use cancelOrder(). You must either be in BitNode-8 or have Level 3 of Source-File 8");
+ }
+ }
+ var stock = __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["d" /* SymbolToStockMap */][symbol];
+ if (stock == null) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "ERROR: Invalid stock symbol passed into cancelOrder()");
+ }
+ if (isNaN(shares) || isNaN(price)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "ERROR: Invalid shares or price argument passed into cancelOrder(). Must be numeric");
+ }
+ var orderType, orderPos;
+ type = type.toLowerCase();
+ if (type.includes("limit") && type.includes("buy")) {
+ orderType = __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["a" /* OrderTypes */].LimitBuy;
+ } else if (type.includes("limit") && type.includes("sell")) {
+ orderType = __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["a" /* OrderTypes */].LimitSell;
+ } else if (type.includes("stop") && type.includes("buy")) {
+ orderType = __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["a" /* OrderTypes */].StopBuy;
+ } else if (type.includes("stop") && type.includes("sell")) {
+ orderType = OrderType.StopSell;
+ } else {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "ERROR: Invalid Order Type passed into placeOrder()");
+ }
+
+ pos = pos.toLowerCase();
+ if (pos.includes("l")) {
+ orderPos = __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["b" /* PositionTypes */].Long;
+ } else if (pos.includes('s')) {
+ orderPos = __WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["b" /* PositionTypes */].Short;
+ } else {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "ERROR: Invalid Position Type passed into placeOrder()");
+ }
+ params = {
+ stock: stock,
+ shares: shares,
+ price: price,
+ type: orderType,
+ pos: orderPos
+ };
+ return Object(__WEBPACK_IMPORTED_MODULE_19__StockMarket_js__["e" /* cancelOrder */])(params, workerScript);
+ },
+ purchaseServer : function(hostname, ram) {
+ var hostnameStr = String(hostname);
+ hostnameStr = hostnameStr.replace(/\s\s+/g, '');
+ if (hostnameStr == "") {
+ workerScript.scriptRef.log("Error: Passed empty string for hostname argument of purchaseServer()");
+ return "";
+ }
+
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].purchasedServers.length >= __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].PurchasedServerLimit) {
+ workerScript.scriptRef.log("Error: You have reached the maximum limit of " + __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].PurchasedServerLimit +
+ " servers. You cannot purchase any more.");
+ return "";
+ }
+
+ ram = Math.round(ram);
+ if (isNaN(ram) || !Object(__WEBPACK_IMPORTED_MODULE_27__utils_HelperFunctions_js__["i" /* powerOfTwo */])(ram)) {
+ workerScript.scriptRef.log("Error: Invalid ram argument passed to purchaseServer(). Must be numeric and a power of 2");
+ return "";
+ }
+
+ var cost = ram * __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer;
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].money.lt(cost)) {
+ workerScript.scriptRef.log("Error: Not enough money to purchase server. Need $" + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(cost, 2));
+ return "";
+ }
+ var newServ = new __WEBPACK_IMPORTED_MODULE_16__Server_js__["d" /* Server */](Object(__WEBPACK_IMPORTED_MODULE_28__utils_IPAddress_js__["a" /* createRandomIp */])(), hostnameStr, "", false, true, true, ram);
+ Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["a" /* AddToAllServers */])(newServ);
+
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].purchasedServers.push(newServ.ip);
+ var homeComputer = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].getHomeComputer();
+ homeComputer.serversOnNetwork.push(newServ.ip);
+ newServ.serversOnNetwork.push(homeComputer.ip);
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].loseMoney(cost);
+ workerScript.scriptRef.log("Purchased new server with hostname " + newServ.hostname + " for $" + Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["c" /* formatNumber */])(cost, 2));
+ return newServ.hostname;
+ },
+ deleteServer : function(hostname) {
+ var hostnameStr = String(hostname);
+ hostnameStr = hostnameStr.replace(/\s\s+/g, '');
+ var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["c" /* GetServerByHostname */])(hostnameStr);
+ if (server == null) {
+ workerScript.scriptRef.log("Error: Could not find server with hostname " + hostnameStr + ". deleteServer() failed");
+ return false;
+ }
+
+ if (!server.purchasedByPlayer || server.hostname == "home") {
+ workerScript.scriptRef.log("Error: Server " + server.hostname + " is not a purchased server. " +
+ "Cannot be deleted. deleteServer failed");
+ return false;
+ }
+
+ var ip = server.ip;
+
+ //A server cannot delete itself
+ if (ip == workerScript.serverIp) {
+ workerScript.scriptRef.log("Error: Cannot call deleteServer() on self. Function failed");
+ return false;
+ }
+
+ //Delete all scripts running on server
+ if (server.runningScripts.length > 0) {
+ workerScript.scriptRef.log("Error: Cannot delete server " + server.hostname + " because it still has scripts running.");
+ return false;
+ }
+
+ //Delete from player's purchasedServers array
+ var found = false;
+ for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].purchasedServers.length; ++i) {
+ if (ip == __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].purchasedServers[i]) {
+ found = true;
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].purchasedServers.splice(i, 1);
+ break;
+ }
+ }
+
+ if (!found) {
+ workerScript.scriptRef.log("Error: Could not identify server " + server.hostname +
+ "as a purchased server. This is likely a bug please contact game dev");
+ return false;
+ }
+
+ //Delete from all servers
+ delete __WEBPACK_IMPORTED_MODULE_16__Server_js__["b" /* AllServers */][ip];
+
+ //Delete from home computer
+ found = false;
+ var homeComputer = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].getHomeComputer();
+ for (var i = 0; i < homeComputer.serversOnNetwork.length; ++i) {
+ if (ip == homeComputer.serversOnNetwork[i]) {
+ homeComputer.serversOnNetwork.splice(i, 1);
+ workerScript.scriptRef.log("Deleted server " + hostnameStr);
+ return true;
+ }
+ }
+ //Wasn't found on home computer
+ workerScript.scriptRef.log("Error: Could not find server " + server.hostname +
+ "as a purchased server. This is likely a bug please contact game dev");
+ return false;
+ },
+ getPurchasedServers : function(hostname=true) {
+ var res = [];
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].purchasedServers.forEach(function(ip) {
+ if (hostname) {
+ var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
+ if (server == null) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "ERR: Could not find server in getPurchasedServers(). This is a bug please report to game dev");
+ }
+ res.push(server.hostname);
+ } else {
+ res.push(ip);
+ }
+ });
+ return res;
+ },
+ round : function(n) {
+ if (isNaN(n)) {return 0;}
+ return Math.round(n);
+ },
+ write : function(port, data="", mode="a") {
+ if (!isNaN(port)) { //Write to port
+ //Port 1-10
+ if (port < 1 || port > 10) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Trying to write to invalid port: " + port + ". Only ports 1-10 are valid.");
+ }
+ var portName = "Port" + String(port);
+ var port = __WEBPACK_IMPORTED_MODULE_22__NetscriptWorker_js__["a" /* NetscriptPorts */][portName];
+ if (port == null) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Could not find port: " + port + ". This is a bug contact the game developer");
+ }
+ port.push(data);
+ if (port.length > __WEBPACK_IMPORTED_MODULE_17__Settings_js__["a" /* Settings */].MaxPortCapacity) {
+ port.shift();
+ return true;
+ }
+ return false;
+ } else if (Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["f" /* isString */])(port)) { //Write to text file
+ var fn = port;
+ var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(workerScript.serverIp);
+ if (server == null) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Error getting Server for this script in write(). This is a bug please contact game dev");
+ }
+ var txtFile = Object(__WEBPACK_IMPORTED_MODULE_21__TextFile_js__["b" /* getTextFile */])(fn, server);
+ if (txtFile == null) {
+ txtFile = Object(__WEBPACK_IMPORTED_MODULE_21__TextFile_js__["a" /* createTextFile */])(fn, data, server);
+ return true;
+ }
+ if (mode === "w") {
+ txtFile.write(data);
+ } else {
+ txtFile.append(data);
+ }
+ return true;
+ } else {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Invalid argument passed in for port: " + port + ". Must be a number between 1 and 10");
+ }
+ },
+ read : function(port) {
+ if (!isNaN(port)) { //Read from port
+ //Port 1-10
+ if (port < 1 || port > 10) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Trying to write to invalid port: " + port + ". Only ports 1-10 are valid.");
+ }
+ var portName = "Port" + String(port);
+ var port = __WEBPACK_IMPORTED_MODULE_22__NetscriptWorker_js__["a" /* NetscriptPorts */][portName];
+ if (port == null) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Could not find port: " + port + ". This is a bug contact the game developer");
+ }
+ if (port.length == 0) {
+ return "NULL PORT DATA";
+ } else {
+ return port.shift();
+ }
+ } else if (Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["f" /* isString */])(port)) { //Read from text file
+ var fn = port;
+ var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(workerScript.serverIp);
+ if (server == null) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Error getting Server for this script in read(). This is a bug please contact game dev");
+ }
+ var txtFile = Object(__WEBPACK_IMPORTED_MODULE_21__TextFile_js__["b" /* getTextFile */])(fn, server);
+ if (txtFile !== null) {
+ return txtFile.text;
+ } else {
+ return "";
+ }
+ } else {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Invalid argument passed in for port: " + port + ". Must be a number between 1 and 10");
+ }
+ },
+ scriptRunning : function(scriptname, ip) {
+ var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
+ if (server == null) {
+ workerScript.scriptRef.log("scriptRunning() failed. Invalid IP or hostname passed in: " + ip);
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "scriptRunning() failed. Invalid IP or hostname passed in: " + ip);
+ }
+ for (var i = 0; i < server.runningScripts.length; ++i) {
+ if (server.runningScripts[i].filename == scriptname) {
+ return true;
+ }
+ }
+ return false;
+ },
+ scriptKill : function(scriptname, ip) {
+ var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
+ if (server == null) {
+ workerScript.scriptRef.log("scriptKill() failed. Invalid IP or hostname passed in: " + ip);
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "scriptKill() failed. Invalid IP or hostname passed in: " + ip);
+ }
+ var suc = false;
+ for (var i = 0; i < server.runningScripts.length; ++i) {
+ if (server.runningScripts[i].filename == scriptname) {
+ Object(__WEBPACK_IMPORTED_MODULE_22__NetscriptWorker_js__["d" /* killWorkerScript */])(server.runningScripts[i], server.ip);
+ suc = true;
+ }
+ }
+ return suc;
+ },
+ getScriptRam : function (scriptname, ip) {
+ var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
+ if (server == null) {
+ workerScript.scriptRef.log("getScriptRam() failed. Invalid IP or hostname passed in: " + ip);
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "getScriptRam() failed. Invalid IP or hostname passed in: " + ip);
+ }
+ for (var i = 0; i < server.scripts.length; ++i) {
+ if (server.scripts[i].filename == scriptname) {
+ return server.scripts[i].ramUsage;
+ }
+ }
+ return 0;
+ },
+ getHackTime : function(ip) {
+ var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
+ if (server == null) {
+ workerScript.scriptRef.log("getHackTime() failed. Invalid IP or hostname passed in: " + ip);
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "getHackTime() failed. Invalid IP or hostname passed in: " + ip);
+ }
+ return Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["j" /* scriptCalculateHackingTime */])(server); //Returns seconds
+ },
+ getGrowTime : function(ip) {
+ var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
+ if (server == null) {
+ workerScript.scriptRef.log("getGrowTime() failed. Invalid IP or hostname passed in: " + ip);
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "getGrowTime() failed. Invalid IP or hostname passed in: " + ip);
+ }
+ return Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["h" /* scriptCalculateGrowTime */])(server) / 1000; //Returns seconds
+ },
+ getWeakenTime : function(ip) {
+ var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
+ if (server == null) {
+ workerScript.scriptRef.log("getWeakenTime() failed. Invalid IP or hostname passed in: " + ip);
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "getWeakenTime() failed. Invalid IP or hostname passed in: " + ip);
+ }
+ return Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["l" /* scriptCalculateWeakenTime */])(server) / 1000; //Returns seconds
+ },
+ getScriptIncome : function(scriptname, ip) {
+ if (arguments.length === 0) {
+ //Get total script income
+ var res = [];
+ res.push(Object(__WEBPACK_IMPORTED_MODULE_0__ActiveScriptsUI_js__["d" /* updateActiveScriptsItems */])());
+ res.push(__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].scriptProdSinceLastAug / (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].playtimeSinceLastAug/1000));
+ return res;
+ } else {
+ //Get income for a particular script
+ var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
+ if (server == null) {
+ workerScript.scriptRef.log("getScriptIncome() failed. Invalid IP or hostnamed passed in: " + ip);
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "getScriptIncome() failed. Invalid IP or hostnamed passed in: " + ip);
+ }
+ var argsForScript = [];
+ for (var i = 2; i < arguments.length; ++i) {
+ argsForScript.push(arguments[i]);
+ }
+ var runningScriptObj = Object(__WEBPACK_IMPORTED_MODULE_15__Script_js__["d" /* findRunningScript */])(scriptname, argsForScript, server);
+ if (runningScriptObj == null) {
+ workerScript.scriptRef.log("getScriptIncome() failed. No such script "+ scriptname + " on " + server.hostname + " with args: " + Object(__WEBPACK_IMPORTED_MODULE_27__utils_HelperFunctions_js__["j" /* printArray */])(argsForScript));
+ return -1;
+ }
+ return runningScriptObj.onlineMoneyMade / runningScriptObj.onlineRunningTime;
+ }
+ },
+ getScriptExpGain : function(scriptname, ip) {
+ if (arguments.length === 0) {
+ var total = 0;
+ for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_22__NetscriptWorker_js__["h" /* workerScripts */].length; ++i) {
+ total += (__WEBPACK_IMPORTED_MODULE_22__NetscriptWorker_js__["h" /* workerScripts */][i].scriptRef.onlineExpGained / __WEBPACK_IMPORTED_MODULE_22__NetscriptWorker_js__["h" /* workerScripts */][i].scriptRef.onlineRunningTime);
+ }
+ return total;
+ } else {
+ //Get income for a particular script
+ var server = Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["e" /* getServer */])(ip);
+ if (server == null) {
+ workerScript.scriptRef.log("getScriptExpGain() failed. Invalid IP or hostnamed passed in: " + ip);
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "getScriptExpGain() failed. Invalid IP or hostnamed passed in: " + ip);
+ }
+ var argsForScript = [];
+ for (var i = 2; i < arguments.length; ++i) {
+ argsForScript.push(arguments[i]);
+ }
+ var runningScriptObj = Object(__WEBPACK_IMPORTED_MODULE_15__Script_js__["d" /* findRunningScript */])(scriptname, argsForScript, server);
+ if (runningScriptObj == null) {
+ workerScript.scriptRef.log("getScriptExpGain() failed. No such script "+ scriptname + " on " + server.hostname + " with args: " + Object(__WEBPACK_IMPORTED_MODULE_27__utils_HelperFunctions_js__["j" /* printArray */])(argsForScript));
+ return -1;
+ }
+ return runningScriptObj.onlineExpGained / runningScriptObj.onlineRunningTime;
+ }
+ },
+ getTimeSinceLastAug : function() {
+ return __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].playtimeSinceLastAug;
+ },
+ prompt : function(txt) {
+ if (__WEBPACK_IMPORTED_MODULE_30__utils_YesNoBox_js__["e" /* yesNoBoxOpen */]) {
+ workerScript.scriptRef.log("ERROR: confirm() failed because a pop-up dialog box is already open");
+ return false;
+ }
+ if (!Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["f" /* isString */])(txt)) {txt = String(txt);}
+ var yesBtn = Object(__WEBPACK_IMPORTED_MODULE_30__utils_YesNoBox_js__["d" /* yesNoBoxGetYesButton */])(), noBtn = Object(__WEBPACK_IMPORTED_MODULE_30__utils_YesNoBox_js__["c" /* yesNoBoxGetNoButton */])();
+ yesBtn.innerHTML = "Yes";
+ noBtn.innerHTML = "No";
+ return new Promise(function(resolve, reject) {
+ yesBtn.addEventListener("click", ()=>{
+ Object(__WEBPACK_IMPORTED_MODULE_30__utils_YesNoBox_js__["a" /* yesNoBoxClose */])();
+ resolve(true);
+ });
+ noBtn.addEventListener("click", ()=>{
+ Object(__WEBPACK_IMPORTED_MODULE_30__utils_YesNoBox_js__["a" /* yesNoBoxClose */])();
+ resolve(false);
+ });
+ Object(__WEBPACK_IMPORTED_MODULE_30__utils_YesNoBox_js__["b" /* yesNoBoxCreate */])(txt);
+ });
+ },
+
+ /* Singularity Functions */
+ universityCourse : function(universityName, className) {
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 1)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run universityCourse(). It is a Singularity Function and requires SourceFile-4 (level 1) to run.");
+ return false;
+ }
+ }
+ if (__WEBPACK_IMPORTED_MODULE_13__Missions_js__["c" /* inMission */]) {
+ workerScript.scriptRef.log("ERROR: universityCourse() failed because you are in the middle of a mission.");
+ return;
+ }
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].isWorking) {
+ var txt = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].singularityStopWork();
+ workerScript.scriptRef.log(txt);
+ }
+
+ var costMult, expMult;
+ switch(universityName.toLowerCase()) {
+ case __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].AevumSummitUniversity.toLowerCase():
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Aevum) {
+ workerScript.scriptRef.log("ERROR: You cannot study at Summit University because you are not in Aevum. universityCourse() failed");
+ return false;
+ }
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].AevumSummitUniversity;
+ costMult = 4;
+ expMult = 3;
+ break;
+ case __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Sector12RothmanUniversity.toLowerCase():
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Sector12) {
+ workerScript.scriptRef.log("ERROR: You cannot study at Rothman University because you are not in Sector-12. universityCourse() failed");
+ return false;
+ }
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Sector12RothmanUniversity;
+ costMult = 3;
+ expMult = 2;
+ break;
+ case __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].VolhavenZBInstituteOfTechnology.toLowerCase():
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Volhaven) {
+ workerScript.scriptRef.log("ERROR: You cannot study at ZB Institute of Technology because you are not in Volhaven. universityCourse() failed");
+ return false;
+ }
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].VolhavenZBInstituteOfTechnology;
+ costMult = 5;
+ expMult = 4;
+ break;
+ default:
+ workerScript.scriptRef.log("Invalid university name: " + universityName + ". universityCourse() failed");
+ return false;
+ }
+
+ var task;
+ switch(className.toLowerCase()) {
+ case "Study Computer Science".toLowerCase():
+ task = __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ClassStudyComputerScience;
+ break;
+ case "Data Structures".toLowerCase():
+ task = __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ClassDataStructures;
+ break;
+ case "Networks".toLowerCase():
+ task = __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ClassNetworks;
+ break;
+ case "Algorithms".toLowerCase():
+ task = __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ClassAlgorithms;
+ break;
+ case "Management".toLowerCase():
+ task = __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ClassManagement;
+ break;
+ case "Leadership".toLowerCase():
+ task = __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ClassLeadership;
+ break;
+ default:
+ workerScript.scriptRef.log("Invalid class name: " + className + ". universityCourse() failed");
+ return false;
+ }
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startClass(costMult, expMult, task);
+ workerScript.scriptRef.log("Started " + task + " at " + universityName);
+ return true;
+ },
+
+ gymWorkout : function(gymName, stat) {
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 1)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run gymWorkout(). It is a Singularity Function and requires SourceFile-4 (level 1) to run.");
+ return false;
+ }
+ }
+ if (__WEBPACK_IMPORTED_MODULE_13__Missions_js__["c" /* inMission */]) {
+ workerScript.scriptRef.log("ERROR: gymWorkout() failed because you are in the middle of a mission.");
+ return;
+ }
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].isWorking) {
+ var txt = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].singularityStopWork();
+ workerScript.scriptRef.log(txt);
+ }
+ var costMult, expMult;
+ switch(gymName.toLowerCase()) {
+ case __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].AevumCrushFitnessGym.toLowerCase():
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Aevum) {
+ workerScript.scriptRef.log("ERROR: You cannot workout at Crush Fitness because you are not in Aevum. gymWorkout() failed");
+ return false;
+ }
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].AevumCrushFitnessGym;
+ costMult = 2;
+ expMult = 1.5;
+ break;
+ case __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].AevumSnapFitnessGym.toLowerCase():
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Aevum) {
+ workerScript.scriptRef.log("ERROR: You cannot workout at Snap Fitness because you are not in Aevum. gymWorkout() failed");
+ return false;
+ }
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].AevumSnapFitnessGym;
+ costMult = 6;
+ expMult = 4;
+ break;
+ case __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Sector12IronGym.toLowerCase():
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Sector12) {
+ workerScript.scriptRef.log("ERROR: You cannot workout at Iron Gym because you are not in Sector-12. gymWorkout() failed");
+ return false;
+ }
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Sector12IronGym;
+ costMult = 1;
+ expMult = 1;
+ break;
+ case __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Sector12PowerhouseGym.toLowerCase():
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Sector12) {
+ workerScript.scriptRef.log("ERROR: You cannot workout at Powerhouse Gym because you are not in Sector-12. gymWorkout() failed");
+ return false;
+ }
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Sector12PowerhouseGym;
+ costMult = 10;
+ expMult = 7.5;
+ break;
+ case __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].VolhavenMilleniumFitnessGym:
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Volhaven) {
+ workerScript.scriptRef.log("ERROR: You cannot workout at Millenium Fitness Gym because you are not in Volhaven. gymWorkout() failed");
+ return false;
+ }
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].VolhavenMilleniumFitnessGym;
+ costMult = 3;
+ expMult = 2.5;
+ break;
+ default:
+ workerScript.scriptRef.log("Invalid gym name: " + gymName + ". gymWorkout() failed");
+ return false;
+ }
+
+ switch(stat.toLowerCase()) {
+ case "strength".toLowerCase():
+ case "str".toLowerCase():
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ClassGymStrength);
+ break;
+ case "defense".toLowerCase():
+ case "def".toLowerCase():
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ClassGymDefense);
+ break;
+ case "dexterity".toLowerCase():
+ case "dex".toLowerCase():
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ClassGymDexterity);
+ break;
+ case "agility".toLowerCase():
+ case "agi".toLowerCase():
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].ClassGymAgility);
+ break;
+ default:
+ workerScript.scriptRef.log("Invalid stat: " + stat + ". gymWorkout() failed");
+ return false;
+ }
+ workerScript.scriptRef.log("Started training " + stat + " at " + gymName);
+ return true;
+ },
+
+ travelToCity(cityname) {
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 1)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run travelToCity(). It is a Singularity Function and requires SourceFile-4 (level 1) to run.");
+ return false;
+ }
+ }
+
+ switch(cityname) {
+ case __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Aevum:
+ case __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Chongqing:
+ case __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Sector12:
+ case __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].NewTokyo:
+ case __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Ishima:
+ case __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Volhaven:
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].loseMoney(200000);
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].city = cityname;
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].gainIntelligenceExp(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].IntelligenceSingFnBaseExpGain);
+ workerScript.scriptRef.log("Traveled to " + cityname);
+ return true;
+ default:
+ workerScript.scriptRef.log("ERROR: Invalid city name passed into travelToCity().");
+ return false;
+ }
+ },
+
+ purchaseTor() {
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 1)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run purchaseTor(). It is a Singularity Function and requires SourceFile-4 (level 1) to run.");
+ return false;
+ }
+ }
+
+ if (__WEBPACK_IMPORTED_MODULE_18__SpecialServerIps_js__["a" /* SpecialServerIps */]["Darkweb Server"] != null) {
+ workerScript.scriptRef.log("You already have a TOR router! purchaseTor() failed");
+ return false;
+ }
+
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].money.lt(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].TorRouterCost)) {
+ workerScript.scriptRef.log("ERROR: You cannot afford to purchase a Tor router. purchaseTor() failed");
+ return false;
+ }
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].loseMoney(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].TorRouterCost);
+
+ var darkweb = new __WEBPACK_IMPORTED_MODULE_16__Server_js__["d" /* Server */](Object(__WEBPACK_IMPORTED_MODULE_28__utils_IPAddress_js__["a" /* createRandomIp */])(), "darkweb", "", false, false, false, 1);
+ Object(__WEBPACK_IMPORTED_MODULE_16__Server_js__["a" /* AddToAllServers */])(darkweb);
+ __WEBPACK_IMPORTED_MODULE_18__SpecialServerIps_js__["a" /* SpecialServerIps */].addIp("Darkweb Server", darkweb.ip);
+
+ document.getElementById("location-purchase-tor").setAttribute("class", "a-link-button-inactive");
+
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].getHomeComputer().serversOnNetwork.push(darkweb.ip);
+ darkweb.serversOnNetwork.push(__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].getHomeComputer().ip);
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].gainIntelligenceExp(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].IntelligenceSingFnBaseExpGain);
+ workerScript.scriptRef.log("You have purchased a Tor router!");
+ return true;
+ },
+ purchaseProgram(programName) {
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 1)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run purchaseProgram(). It is a Singularity Function and requires SourceFile-4 (level 1) to run.");
+ return false;
+ }
+ }
+
+ if (__WEBPACK_IMPORTED_MODULE_18__SpecialServerIps_js__["a" /* SpecialServerIps */]["Darkweb Server"] == null) {
+ workerScript.scriptRef.log("ERROR: You do not have TOR router. purchaseProgram() failed.");
+ return false;
+ }
+
+ switch(programName.toLowerCase()) {
+ case __WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].BruteSSHProgram.toLowerCase():
+ var price = Object(__WEBPACK_IMPORTED_MODULE_7__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_7__DarkWeb_js__["a" /* DarkWebItems */].BruteSSHProgram);
+ if (price > 0 && __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].money.gt(price)) {
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].loseMoney(price);
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].BruteSSHProgram);
+ workerScript.scriptRef.log("You have purchased the BruteSSH.exe program. The new program " +
+ "can be found on your home computer.");
+ } else {
+ workerScript.scriptRef.log("Not enough money to purchase " + programName);
+ return false;
+ }
+ return true;
+ case __WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].FTPCrackProgram.toLowerCase():
+ var price = Object(__WEBPACK_IMPORTED_MODULE_7__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_7__DarkWeb_js__["a" /* DarkWebItems */].FTPCrackProgram);
+ if (price > 0 && __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].money.gt(price)) {
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].loseMoney(price);
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].FTPCrackProgram);
+ workerScript.scriptRef.log("You have purchased the FTPCrack.exe program. The new program " +
+ "can be found on your home computer.");
+ } else {
+ workerScript.scriptRef.log("Not enough money to purchase " + programName);
+ return false;
+ }
+ return true;
+ case __WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram.toLowerCase():
+ var price = Object(__WEBPACK_IMPORTED_MODULE_7__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_7__DarkWeb_js__["a" /* DarkWebItems */].RelaySMTPProgram);
+ if (price > 0 && __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].money.gt(price)) {
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].loseMoney(price);
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram);
+ workerScript.scriptRef.log("You have purchased the relaySMTP.exe program. The new program " +
+ "can be found on your home computer.");
+ } else {
+ workerScript.scriptRef.log("Not enough money to purchase " + programName);
+ return false;
+ }
+ return true;
+ case __WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].HTTPWormProgram.toLowerCase():
+ var price = Object(__WEBPACK_IMPORTED_MODULE_7__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_7__DarkWeb_js__["a" /* DarkWebItems */].HTTPWormProgram);
+ if (price > 0 && __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].money.gt(price)) {
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].loseMoney(price);
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].HTTPWormProgram);
+ workerScript.scriptRef.log("You have purchased the HTTPWorm.exe program. The new program " +
+ "can be found on your home computer.");
+ } else {
+ workerScript.scriptRef.log("Not enough money to purchase " + programName);
+ return false;
+ }
+ return true;
+ case __WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].SQLInjectProgram.toLowerCase():
+ var price = Object(__WEBPACK_IMPORTED_MODULE_7__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_7__DarkWeb_js__["a" /* DarkWebItems */].SQLInjectProgram);
+ if (price > 0 && __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].money.gt(price)) {
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].loseMoney(price);
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].SQLInjectProgram);
+ workerScript.scriptRef.log("You have purchased the SQLInject.exe program. The new program " +
+ "can be found on your home computer.");
+ } else {
+ workerScript.scriptRef.log("Not enough money to purchase " + programName);
+ return false;
+ }
+ return true;
+ case __WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].DeepscanV1.toLowerCase():
+ var price = Object(__WEBPACK_IMPORTED_MODULE_7__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_7__DarkWeb_js__["a" /* DarkWebItems */].DeepScanV1Program);
+ if (price > 0 && __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].money.gt(price)) {
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].loseMoney(price);
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].DeepscanV1);
+ workerScript.scriptRef.log("You have purchased the DeepscanV1.exe program. The new program " +
+ "can be found on your home computer.");
+ } else {
+ workerScript.scriptRef.log("Not enough money to purchase " + programName);
+ return false;
+ }
+ return true;
+ case __WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].DeepscanV2.toLowerCase():
+ var price = Object(__WEBPACK_IMPORTED_MODULE_7__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_7__DarkWeb_js__["a" /* DarkWebItems */].DeepScanV2Program);
+ if (price > 0 && __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].money.gt(price)) {
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].loseMoney(price);
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].DeepscanV2);
+ workerScript.scriptRef.log("You have purchased the DeepscanV2.exe program. The new program " +
+ "can be found on your home computer.");
+ } else {
+ workerScript.scriptRef.log("Not enough money to purchase " + programName);
+ return false;
+ }
+ return true;
+ default:
+ workerScript.scriptRef.log("ERROR: Invalid program passed into purchaseProgram().");
+ return false;
+ }
+ return true;
+ },
+ getStats : function() {
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 1)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run getStats(). It is a Singularity Function and requires SourceFile-4 (level 1) to run.");
+ return {};
+ }
+ }
+
+ return {
+ hacking: __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hacking_skill,
+ strength: __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].strength,
+ defense: __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].defense,
+ dexterity: __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].dexterity,
+ agility: __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].agility,
+ charisma: __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].charisma,
+ intelligence: __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].intelligence
+ }
+ },
+ isBusy : function() {
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 1)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run isBusy(). It is a Singularity Function and requires SourceFile-4 (level 1) to run.");
+ return;
+ }
+ }
+ return __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].isWorking;
+ },
+ upgradeHomeRam() {
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 2)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run upgradeHomeRam(). It is a Singularity Function and requires SourceFile-4 (level 2) to run.");
+ return false;
+ }
+ }
+
+ //Calculate how many times ram has been upgraded (doubled)
+ var currentRam = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].getHomeComputer().maxRam;
+ var numUpgrades = Math.log2(currentRam);
+
+ //Calculate cost
+ //Have cost increase by some percentage each time RAM has been upgraded
+ var cost = currentRam * __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamHome;
+ var mult = Math.pow(1.55, numUpgrades);
+ cost = cost * mult;
+
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].money.lt(cost)) {
+ workerScript.scriptRef.log("ERROR: upgradeHomeRam() failed because you don't have enough money");
+ return false;
+ }
+
+ var homeComputer = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].getHomeComputer();
+ homeComputer.maxRam *= 2;
+
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].loseMoney(cost);
+
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].gainIntelligenceExp(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].IntelligenceSingFnBaseExpGain);
+ workerScript.scriptRef.log("Purchased additional RAM for home computer! It now has " + homeComputer.maxRam + "GB of RAM.");
+ return true;
+ },
+ getUpgradeHomeRamCost() {
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 2)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run getUpgradeHomeRamCost(). It is a Singularity Function and requires SourceFile-4 (level 2) to run.");
+ return false;
+ }
+ }
+
+ //Calculate how many times ram has been upgraded (doubled)
+ var currentRam = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].getHomeComputer().maxRam;
+ var numUpgrades = Math.log2(currentRam);
+
+ //Calculate cost
+ //Have cost increase by some percentage each time RAM has been upgraded
+ var cost = currentRam * __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamHome;
+ var mult = Math.pow(1.55, numUpgrades);
+ return cost * mult;
+ },
+ workForCompany() {
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 2)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run workForCompany(). It is a Singularity Function and requires SourceFile-4 (level 2) to run.");
+ return false;
+ }
+ }
+
+ if (__WEBPACK_IMPORTED_MODULE_13__Missions_js__["c" /* inMission */]) {
+ workerScript.scriptRef.log("ERROR: workForCompany() failed because you are in the middle of a mission.");
+ return;
+ }
+
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].companyPosition == "" || !(__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].companyPosition instanceof __WEBPACK_IMPORTED_MODULE_4__Company_js__["c" /* CompanyPosition */])) {
+ workerScript.scriptRef.log("ERROR: workForCompany() failed because you do not have a job");
+ return false;
+ }
+
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].isWorking) {
+ var txt = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].singularityStopWork();
+ workerScript.scriptRef.log(txt);
+ }
+
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].companyPosition.isPartTimeJob()) {
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startWorkPartTime();
+ } else {
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startWork();
+ }
+ workerScript.scriptRef.log("Began working at " + __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].companyName + " as a " + __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].companyPosition.positionName);
+ return true;
+ },
+ applyToCompany(companyName, field) {
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 2)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run applyToCompany(). It is a Singularity Function and requires SourceFile-4 (level 2) to run.");
+ return false;
+ }
+ }
+
+ if (!Object(__WEBPACK_IMPORTED_MODULE_4__Company_js__["e" /* companyExists */])(companyName)) {
+ workerScript.scriptRef.log("ERROR: applyToCompany() failed because specified company " + companyName + " does not exist.");
+ return false;
+ }
+
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].location = companyName;
+ var res;
+ switch (field.toLowerCase()) {
+ case "software":
+ res = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].applyForSoftwareJob(true);
+ break;
+ case "software consultant":
+ res = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].applyForSoftwareConsultantJob(true);
+ break;
+ case "it":
+ res = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].applyForItJob(true);
+ break;
+ case "security engineer":
+ res = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].applyForSecurityEngineerJob(true);
+ break;
+ case "network engineer":
+ res = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].applyForNetworkEngineerJob(true);
+ break;
+ case "business":
+ res = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].applyForBusinessJob(true);
+ break;
+ case "business consultant":
+ res = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].applyForBusinessConsultantJob(true);
+ break;
+ case "security":
+ res = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].applyForSecurityJob(true);
+ break;
+ case "agent":
+ res = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].applyForAgentJob(true);
+ break;
+ case "employee":
+ res = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].applyForEmployeeJob(true);
+ break;
+ case "part-time employee":
+ res = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].applyForPartTimeEmployeeJob(true);
+ break;
+ case "waiter":
+ res = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].applyForWaiterJob(true);
+ break;
+ case "part-time waiter":
+ res = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].applyForPartTimeWaiterJob(true);
+ break;
+ default:
+ workerScript.scriptRef.log("ERROR: Invalid job passed into applyToCompany: " + field + ". applyToCompany() failed");
+ return false;
+ }
+ //The Player object's applyForJob function can return string with special error messages
+ if (Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["f" /* isString */])(res)) {
+ workerScript.scriptRef.log(res);
+ return false;
+ }
+ if (res) {
+ workerScript.scriptRef.log("You were offered a new job at " + companyName + " as a " + __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].companyPosition.positionName);
+ } else {
+ workerScript.scriptRef.log("You failed to get a new job/promotion at " + companyName + " in the " + field + " field.");
+ }
+ return res;
+ },
+ getCompanyRep(companyName) {
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 2)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run getCompanyRep(). It is a Singularity Function and requires SourceFile-4 (level 2) to run.");
+ return false;
+ }
+ }
+
+ var company = __WEBPACK_IMPORTED_MODULE_4__Company_js__["a" /* Companies */][companyName];
+ if (company == null || !(company instanceof __WEBPACK_IMPORTED_MODULE_4__Company_js__["b" /* Company */])) {
+ workerScript.scriptRef.log("ERROR: Invalid companyName passed into getCompanyRep(): " + companyName);
+ return -1;
+ }
+ return company.playerReputation;
+ },
+ checkFactionInvitations() {
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 2)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run checkFactionInvitations(). It is a Singularity Function and requires SourceFile-4 (level 2) to run.");
+ return false;
+ }
+ }
+ //Make a copy of Player.factionInvitations
+ return __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].factionInvitations.slice();
+ },
+ joinFaction(name) {
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 2)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run joinFaction(). It is a Singularity Function and requires SourceFile-4 (level 2) to run.");
+ return false;
+ }
+ }
+
+ if (!Object(__WEBPACK_IMPORTED_MODULE_9__Faction_js__["d" /* factionExists */])(name)) {
+ workerScript.scriptRef.log("ERROR: Faction specified in joinFaction() does not exist.");
+ return false;
+ }
+
+ if (!__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].factionInvitations.includes(name)) {
+ workerScript.scriptRef.log("ERROR: Cannot join " + name + " Faction because you have not been invited. joinFaction() failed");
+ return false;
+ }
+
+ var index = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].factionInvitations.indexOf(name);
+ if (index === -1) {
+ //Redundant and should never happen...
+ workerScript.scriptRef.log("ERROR: Cannot join " + name + " Faction because you have not been invited. joinFaction() failed");
+ return false;
+ }
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].factionInvitations.splice(index, 1);
+ var fac = __WEBPACK_IMPORTED_MODULE_9__Faction_js__["b" /* Factions */][name];
+ Object(__WEBPACK_IMPORTED_MODULE_9__Faction_js__["h" /* joinFaction */])(fac);
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].gainIntelligenceExp(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].IntelligenceSingFnBaseExpGain);
+ workerScript.scriptRef.log("Joined the " + name + " faction.");
+ return true;
+ },
+ workForFaction(name, type) {
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 2)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run workForFaction(). It is a Singularity Function and requires SourceFile-4 (level 2) to run.");
+ return false;
+ }
+ }
+
+ if (__WEBPACK_IMPORTED_MODULE_13__Missions_js__["c" /* inMission */]) {
+ workerScript.scriptRef.log("ERROR: workForFaction() failed because you are in the middle of a mission.");
+ return;
+ }
+
+ if (!Object(__WEBPACK_IMPORTED_MODULE_9__Faction_js__["d" /* factionExists */])(name)) {
+ workerScript.scriptRef.log("ERROR: Faction specified in workForFaction() does not exist.");
+ return false;
+ }
+
+ if (!__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].factions.includes(name)) {
+ workerScript.scriptRef.log("ERROR: workForFaction() failed because you are not a member of " + name);
+ return false;
+ }
+
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].isWorking) {
+ var txt = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].singularityStopWork();
+ workerScript.scriptRef.log(txt);
+ }
+
+ var fac = __WEBPACK_IMPORTED_MODULE_9__Faction_js__["b" /* Factions */][name];
+ //Arrays listing factions that allow each time of work
+ var hackAvailable = ["Illuminati", "Daedalus", "The Covenant", "ECorp", "MegaCorp",
+ "Bachman & Associates", "Blade Industries", "NWO", "Clarke Incorporated",
+ "OmniTek Incorporated", "Four Sigma", "KuaiGong International",
+ "Fulcrum Secret Technologies", "BitRunners", "The Black Hand",
+ "NiteSec", "Chongqing", "Sector-12", "New Tokyo", "Aevum",
+ "Ishima", "Volhaven", "Speakers for the Dead", "The Dark Army",
+ "The Syndicate", "Silhouette", "Netburners", "Tian Di Hui", "CyberSec"];
+ var fdWkAvailable = ["Illuminati", "Daedalus", "The Covenant", "ECorp", "MegaCorp",
+ "Bachman & Associates", "Blade Industries", "NWO", "Clarke Incorporated",
+ "OmniTek Incorporated", "Four Sigma", "KuaiGong International",
+ "The Black Hand", "Chongqing", "Sector-12", "New Tokyo", "Aevum",
+ "Ishima", "Volhaven", "Speakers for the Dead", "The Dark Army",
+ "The Syndicate", "Silhouette", "Tetrads", "Slum Snakes"];
+ var scWkAvailable = ["ECorp", "MegaCorp",
+ "Bachman & Associates", "Blade Industries", "NWO", "Clarke Incorporated",
+ "OmniTek Incorporated", "Four Sigma", "KuaiGong International",
+ "Fulcrum Secret Technologies", "Chongqing", "Sector-12", "New Tokyo", "Aevum",
+ "Ishima", "Volhaven", "Speakers for the Dead",
+ "The Syndicate", "Tetrads", "Slum Snakes", "Tian Di Hui"];
+
+ switch (type.toLowerCase()) {
+ case "hacking":
+ case "hacking contracts":
+ case "hackingcontracts":
+ if (!hackAvailable.includes(fac.name)) {
+ workerScript.scriptRef.log("ERROR: Cannot carry out hacking contracts for " + fac.name + ". workForFaction() failed");
+ return false;
+ }
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startFactionHackWork(fac);
+ workerScript.scriptRef.log("Started carrying out hacking contracts for " + fac.name);
+ return true;
+ case "field":
+ case "fieldwork":
+ case "field work":
+ if (!fdWkAvailable.includes(fac.name)) {
+ workerScript.scriptRef.log("ERROR: Cannot carry out field missions for " + fac.name + ". workForFaction() failed");
+ return false;
+ }
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startFactionFieldWork(fac);
+ workerScript.scriptRef.log("Started carrying out field missions for " + fac.name);
+ return true;
+ case "security":
+ case "securitywork":
+ case "security work":
+ if (!scWkAvailable.includes(fac.name)) {
+ workerScript.scriptRef.log("ERROR: Cannot serve as security detail for " + fac.name + ". workForFaction() failed");
+ return false;
+ }
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startFactionSecurityWork(fac);
+ workerScript.scriptRef.log("Started serving as security details for " + fac.name);
+ return true;
+ default:
+ workerScript.scriptRef.log("ERROR: Invalid work type passed into workForFaction(): " + type);
+ }
+ return true;
+ },
+ getFactionRep(name) {
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 2)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run getFactionRep(). It is a Singularity Function and requires SourceFile-4 (level 2) to run.");
+ return -1;
+ }
+ }
+
+ if (!Object(__WEBPACK_IMPORTED_MODULE_9__Faction_js__["d" /* factionExists */])(name)) {
+ workerScript.scriptRef.log("ERROR: Faction specified in getFactionRep() does not exist.");
+ return -1;
+ }
+
+ return __WEBPACK_IMPORTED_MODULE_9__Faction_js__["b" /* Factions */][name].playerReputation;
+ },
+ createProgram(name) {
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 3)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run createProgram(). It is a Singularity Function and requires SourceFile-4 (level 3) to run.");
+ return false;
+ }
+ }
+ if (__WEBPACK_IMPORTED_MODULE_13__Missions_js__["c" /* inMission */]) {
+ workerScript.scriptRef.log("ERROR: createProgram() failed because you are in the middle of a mission.");
+ return;
+ }
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].isWorking) {
+ var txt = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].singularityStopWork();
+ workerScript.scriptRef.log(txt);
+ }
+
+ switch(name.toLowerCase()) {
+ case __WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].NukeProgram.toLowerCase():
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].NukeProgram, __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].MillisecondsPerFiveMinutes, 1);
+ break;
+ case __WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].BruteSSHProgram.toLowerCase():
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hacking_skill < 50) {
+ workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create BruteSSH (level 50 req)");
+ return false;
+ }
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].BruteSSHProgram, __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].MillisecondsPerFiveMinutes * 2, 50);
+ break;
+ case __WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].FTPCrackProgram.toLowerCase():
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hacking_skill < 100) {
+ workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create FTPCrack (level 100 req)");
+ return false;
+ }
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].FTPCrackProgram, __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].MillisecondsPerHalfHour, 100);
+ break;
+ case __WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram.toLowerCase():
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hacking_skill < 250) {
+ workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create relaySMTP (level 250 req)");
+ return false;
+ }
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram, __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].MillisecondsPer2Hours, 250);
+ break;
+ case __WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].HTTPWormProgram.toLowerCase():
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hacking_skill < 500) {
+ workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create HTTPWorm (level 500 req)");
+ return false;
+ }
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].HTTPWormProgram, __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].MillisecondsPer4Hours, 500);
+ break;
+ case __WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].SQLInjectProgram.toLowerCase():
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hacking_skill < 750) {
+ workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create SQLInject (level 750 req)");
+ return false;
+ }
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].SQLInjectProgram, __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].MillisecondsPer8Hours, 750);
+ break;
+ case __WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].DeepscanV1.toLowerCase():
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hacking_skill < 75) {
+ workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create DeepscanV1 (level 75 req)");
+ return false;
+ }
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].DeepscanV1, __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].MillisecondsPerQuarterHour, 75);
+ break;
+ case __WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].DeepscanV2.toLowerCase():
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hacking_skill < 400) {
+ workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create DeepscanV2 (level 400 req)");
+ return false;
+ }
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].DeepscanV2, __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].MillisecondsPer2Hours, 400);
+ break;
+ case __WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].ServerProfiler.toLowerCase():
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hacking_skill < 75) {
+ workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create ServerProfiler (level 75 req)");
+ return false;
+ }
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].ServerProfiler, __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].MillisecondsPerHalfHour, 75);
+ break;
+ case __WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].AutoLink.toLowerCase():
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].hacking_skill < 25) {
+ workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create AutoLink (level 25 req)");
+ return false;
+ }
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_6__CreateProgram_js__["a" /* Programs */].AutoLink, __WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].MillisecondsPerQuarterHour, 25);
+ break;
+ default:
+ workerScript.scriptRef.log("ERROR: createProgram() failed because the specified program does not exist: " + name);
+ return false;
+ }
+ workerScript.scriptRef.log("Began creating program: " + name);
+ return true;
+ },
+ commitCrime : function(crime) {
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 3)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run commitCrime(). It is a Singularity Function and requires SourceFile-4 (level 3) to run.");
+ return;
+ }
+ }
+ if (__WEBPACK_IMPORTED_MODULE_13__Missions_js__["c" /* inMission */]) {
+ workerScript.scriptRef.log("ERROR: commitCrime() failed because you are in the middle of a mission.");
+ return;
+ }
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].isWorking) {
+ var txt = __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].singularityStopWork();
+ workerScript.scriptRef.log(txt);
+ }
+
+ //Set Location to slums
+ switch(__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].city) {
+ case __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Aevum:
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].AevumSlums;
+ break;
+ case __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Chongqing:
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].ChongqingSlums;
+ break;
+ case __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Sector12:
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Sector12Slums;
+ break;
+ case __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].NewTokyo:
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].NewTokyoSlums;
+ break;
+ case __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Ishima:
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].IshimaSlums;
+ break;
+ case __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].Volhaven:
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_11__Location_js__["a" /* Locations */].VolhavenSlums;
+ break;
+ default:
+ console.log("Invalid Player.city value");
+ }
+
+ crime = crime.toLowerCase();
+ if (crime.includes("shoplift")) {
+ workerScript.scriptRef.log("Attempting to shoplift...");
+ return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["k" /* commitShopliftCrime */])(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].CrimeSingFnDivider, {workerscript: workerScript});
+ } else if (crime.includes("rob") && crime.includes("store")) {
+ workerScript.scriptRef.log("Attempting to rob a store...");
+ return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["j" /* commitRobStoreCrime */])(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].CrimeSingFnDivider, {workerscript: workerScript});
+ } else if (crime.includes("mug")) {
+ workerScript.scriptRef.log("Attempting to mug someone...");
+ return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["i" /* commitMugCrime */])(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].CrimeSingFnDivider, {workerscript: workerScript});
+ } else if (crime.includes("larceny")) {
+ workerScript.scriptRef.log("Attempting to commit larceny...");
+ return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["h" /* commitLarcenyCrime */])(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].CrimeSingFnDivider, {workerscript: workerScript});
+ } else if (crime.includes("drugs")) {
+ workerScript.scriptRef.log("Attempting to deal drugs...");
+ return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["c" /* commitDealDrugsCrime */])(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].CrimeSingFnDivider, {workerscript: workerScript});
+ } else if (crime.includes("bond") && crime.includes("forge")) {
+ workerScript.scriptRef.log("Attempting to forge corporate bonds...");
+ return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["b" /* commitBondForgeryCrime */])(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].CrimeSingFnDivider, {workerscript: workerScript});
+ } else if (crime.includes("traffick") && crime.includes("arms")) {
+ workerScript.scriptRef.log("Attempting to traffick illegal arms...");
+ return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["l" /* commitTraffickArmsCrime */])(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].CrimeSingFnDivider, {workerscript: workerScript});
+ } else if (crime.includes("homicide")) {
+ workerScript.scriptRef.log("Attempting to commit homicide...");
+ return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["f" /* commitHomicideCrime */])(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].CrimeSingFnDivider, {workerscript: workerScript});
+ } else if (crime.includes("grand") && crime.includes("auto")) {
+ workerScript.scriptRef.log("Attempting to commit grand theft auto...");
+ return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["d" /* commitGrandTheftAutoCrime */])(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].CrimeSingFnDivider, {workerscript: workerScript});
+ } else if (crime.includes("kidnap")) {
+ workerScript.scriptRef.log("Attempting to kidnap and ransom a high-profile target...");
+ return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["g" /* commitKidnapCrime */])(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].CrimeSingFnDivider, {workerscript: workerScript});
+ } else if (crime.includes("assassinate")) {
+ workerScript.scriptRef.log("Attempting to assassinate a high-profile target...");
+ return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["a" /* commitAssassinationCrime */])(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].CrimeSingFnDivider, {workerscript: workerScript})
+ } else if (crime.includes("heist")) {
+ workerScript.scriptRef.log("Attempting to pull off a heist...");
+ return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["e" /* commitHeistCrime */])(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].CrimeSingFnDivider, {workerscript: workerScript});
+ } else {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Invalid crime passed into commitCrime(): " + crime);
+ }
+ },
+ getCrimeChance(crime) {
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 3)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run getCrimeChance(). It is a Singularity Function and requires SourceFile-4 (level 3) to run.");
+ return;
+ }
+ }
+
+ crime = crime.toLowerCase();
+ if (crime.includes("shoplift")) {
+ return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["w" /* determineCrimeChanceShoplift */])();
+ } else if (crime.includes("rob") && crime.includes("store")) {
+ return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["v" /* determineCrimeChanceRobStore */])();
+ } else if (crime.includes("mug")) {
+ return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["u" /* determineCrimeChanceMug */])();
+ } else if (crime.includes("larceny")) {
+ return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["t" /* determineCrimeChanceLarceny */])();
+ } else if (crime.includes("drugs")) {
+ return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["o" /* determineCrimeChanceDealDrugs */])();
+ } else if (crime.includes("bond") && crime.includes("forge")) {
+ return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["n" /* determineCrimeChanceBondForgery */])();
+ } else if (crime.includes("traffick") && crime.includes("arms")) {
+ return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["x" /* determineCrimeChanceTraffickArms */])();
+ } else if (crime.includes("homicide")) {
+ return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["r" /* determineCrimeChanceHomicide */])();
+ } else if (crime.includes("grand") && crime.includes("auto")) {
+ return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["p" /* determineCrimeChanceGrandTheftAuto */])();
+ } else if (crime.includes("kidnap")) {
+ return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["s" /* determineCrimeChanceKidnap */])();
+ } else if (crime.includes("assassinate")) {
+ return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["m" /* determineCrimeChanceAssassination */])();
+ } else if (crime.includes("heist")) {
+ return Object(__WEBPACK_IMPORTED_MODULE_3__Crimes_js__["q" /* determineCrimeChanceHeist */])();
+ } else {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Invalid crime passed into getCrimeChance(): " + crime);
+ }
+ },
+ getOwnedAugmentations(purchased=false) {
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 3)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run getOwnedAugmentations(). It is a Singularity Function and requires SourceFile-4 (level 3) to run.");
+ return [];
+ }
+ }
+ var res = [];
+ for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].augmentations.length; ++i) {
+ res.push(__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].augmentations[i].name);
+ }
+ if (purchased) {
+ for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].queuedAugmentations.length; ++i) {
+ res.push(__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].queuedAugmentations[i].name);
+ }
+ }
+ return res;
+ },
+ getAugmentationsFromFaction(facname) {
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 3)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run getAugmentationsFromFaction(). It is a Singularity Function and requires SourceFile-4 (level 3) to run.");
+ return [];
+ }
+ }
+
+ if (!Object(__WEBPACK_IMPORTED_MODULE_9__Faction_js__["d" /* factionExists */])(facname)) {
+ workerScript.scriptRef.log("ERROR: getAugmentationsFromFaction() failed. Invalid faction name passed in (this is case-sensitive): " + facname);
+ return [];
+ }
+
+ var fac = __WEBPACK_IMPORTED_MODULE_9__Faction_js__["b" /* Factions */][facname];
+ var res = [];
+ for (var i = 0; i < fac.augmentations.length; ++i) {
+ res.push(fac.augmentations[i]);
+ }
+ return res;
+ },
+ getAugmentationCost(name) {
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 3)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run getAugmentationCost(). It is a Singularity Function and requires SourceFile-4 (level 3) to run.");
+ return false;
+ }
+ }
+
+ if (!Object(__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["f" /* augmentationExists */])(name)) {
+ workerScript.scriptRef.log("ERROR: getAugmentationCost() failed. Invalid Augmentation name passed in (note: this is case-sensitive): " + name);
+ return [-1, -1];
+ }
+
+ var aug = __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["c" /* Augmentations */][name];
+ return [aug.baseRepRequirement, aug.baseCost];
+ },
+ purchaseAugmentation(faction, name) {
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 3)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run purchaseAugmentation(). It is a Singularity Function and requires SourceFile-4 (level 3) to run.");
+ return false;
+ }
+ }
+
+ var fac = __WEBPACK_IMPORTED_MODULE_9__Faction_js__["b" /* Factions */][faction];
+ if (fac == null || !(fac instanceof __WEBPACK_IMPORTED_MODULE_9__Faction_js__["a" /* Faction */])) {
+ workerScript.scriptRef.log("ERROR: purchaseAugmentation() failed because of invalid faction name: " + faction);
+ return false;
+ }
+
+ if (!fac.augmentations.includes(name)) {
+ workerScript.scriptRef.log("ERROR: purchaseAugmentation() failed because the faction " + faction + " does not contain the " + name + " augmentation");
+ return false;
+ }
+
+ var aug = __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["c" /* Augmentations */][name];
+ if (aug == null || !(aug instanceof __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["a" /* Augmentation */])) {
+ workerScript.scriptRef.log("ERROR: purchaseAugmentation() failed because of invalid augmentation name: " + name);
+ return false;
+ }
+
+ var isNeuroflux = false;
+ if (aug.name === __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["b" /* AugmentationNames */].NeuroFluxGovernor) {
+ isNeuroflux = true;
+ }
+
+ if (!isNeuroflux) {
+ for (var j = 0; j < __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].queuedAugmentations.length; ++j) {
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].queuedAugmentations[j].name === aug.name) {
+ workerScript.scriptRef.log("ERROR: purchaseAugmentation() failed because you already have " + name);
+ return false;
+ }
+ }
+ for (var j = 0; j < __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].augmentations.length; ++j) {
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].augmentations[j].name === aug.name) {
+ workerScript.scriptRef.log("ERROR: purchaseAugmentation() failed because you already have " + name);
+ return false;
+ }
+ }
+ }
+
+ if (fac.playerReputation < aug.baseRepRequirement) {
+ workerScript.scriptRef.log("ERROR: purchaseAugmentation() failed because you do not have enough reputation with " + fac.name);
+ return false;
+ }
+
+ var res = Object(__WEBPACK_IMPORTED_MODULE_9__Faction_js__["k" /* purchaseAugmentation */])(aug, fac, true);
+ workerScript.scriptRef.log(res);
+ if (Object(__WEBPACK_IMPORTED_MODULE_29__utils_StringHelperFunctions_js__["f" /* isString */])(res) && res.startsWith("You purchased")) {
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].gainIntelligenceExp(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].IntelligenceSingFnBaseExpGain);
+ return true;
+ } else {
+ return false;
+ }
+ },
+ installAugmentations(cbScript) {
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 3)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_23__NetscriptEvaluator_js__["d" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run installAugmentations(). It is a Singularity Function and requires SourceFile-4 (level 3) to run.");
+ return false;
+ }
+ }
+
+ if (__WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].queuedAugmentations.length === 0) {
+ workerScript.scriptRef.log("ERROR: installAugmentations() failed because you do not have any Augmentations to be installed");
+ return false;
+ }
+ __WEBPACK_IMPORTED_MODULE_14__Player_js__["a" /* Player */].gainIntelligenceExp(__WEBPACK_IMPORTED_MODULE_5__Constants_js__["a" /* CONSTANTS */].IntelligenceSingFnBaseExpGain);
+ workerScript.scriptRef.log("Installing Augmentations. This will cause this script to be killed");
+ Object(__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["h" /* installAugmentations */])(cbScript);
+ return true;
+ }
}
}
@@ -27272,23 +27551,23 @@ function yesNoTxtInpBoxCreate(txt) {
/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return postNetburnerText; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return post; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Terminal; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Alias_js__ = __webpack_require__(44);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Alias_js__ = __webpack_require__(46);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Constants_js__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__CreateProgram_js__ = __webpack_require__(15);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__DarkWeb_js__ = __webpack_require__(45);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__engine_js__ = __webpack_require__(5);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__HelpText_js__ = __webpack_require__(71);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__HelpText_js__ = __webpack_require__(69);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__InteractiveTutorial_js__ = __webpack_require__(27);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Literature_js__ = __webpack_require__(46);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Message_js__ = __webpack_require__(24);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__NetscriptEvaluator_js__ = __webpack_require__(38);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__NetscriptWorker_js__ = __webpack_require__(11);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Literature_js__ = __webpack_require__(47);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Message_js__ = __webpack_require__(25);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__NetscriptEvaluator_js__ = __webpack_require__(37);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__NetscriptWorker_js__ = __webpack_require__(10);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__RedPill_js__ = __webpack_require__(37);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__Script_js__ = __webpack_require__(16);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__RedPill_js__ = __webpack_require__(34);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__Script_js__ = __webpack_require__(18);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__Server_js__ = __webpack_require__(6);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__SpecialServerIps_js__ = __webpack_require__(12);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__TextFile_js__ = __webpack_require__(49);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__SpecialServerIps_js__ = __webpack_require__(13);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__TextFile_js__ = __webpack_require__(50);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__utils_StringHelperFunctions_js__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__utils_HelperFunctions_js__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__utils_LogBox_js__ = __webpack_require__(30);
@@ -28996,7 +29275,7 @@ let Terminal = {
return;
} else {
//Able to run script
- post("Running script with " + numThreads + " thread(s) and args: " + Object(__WEBPACK_IMPORTED_MODULE_18__utils_HelperFunctions_js__["f" /* printArray */])(args) + ".");
+ post("Running script with " + numThreads + " thread(s) and args: " + Object(__WEBPACK_IMPORTED_MODULE_18__utils_HelperFunctions_js__["j" /* printArray */])(args) + ".");
post("May take a few seconds to start up the process...");
var runningScriptObj = new __WEBPACK_IMPORTED_MODULE_13__Script_js__["b" /* RunningScript */](script, args);
runningScriptObj.threads = numThreads;
@@ -29018,2648 +29297,6 @@ let Terminal = {
/***/ }),
/* 24 */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return Messages; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return checkForMessagesToSend; });
-/* unused harmony export sendMessage */
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return showMessage; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return loadMessages; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return initMessages; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Message; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__ = __webpack_require__(20);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__CreateProgram_js__ = __webpack_require__(15);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Missions_js__ = __webpack_require__(26);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__RedPill_js__ = __webpack_require__(37);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Server_js__ = __webpack_require__(6);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Settings_js__ = __webpack_require__(14);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_DialogBox_js__ = __webpack_require__(1);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__ = __webpack_require__(8);
-
-
-
-
-
-
-
-
-
-
-/* Message.js */
-function Message(filename="", msg="") {
- this.filename = filename;
- this.msg = msg;
- this.recvd = false;
-}
-
-Message.prototype.toJSON = function() {
- return Object(__WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__["b" /* Generic_toJSON */])("Message", this);
-}
-
-
-Message.fromJSON = function(value) {
- return Object(__WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(Message, value.data);
-}
-
-__WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__["c" /* Reviver */].constructors.Message = Message;
-
-//Sends message to player, including a pop up
-function sendMessage(msg, forced=false) {
- console.log("sending message: " + msg.filename);
- msg.recvd = true;
- if (forced || !__WEBPACK_IMPORTED_MODULE_6__Settings_js__["a" /* Settings */].SuppressMessages) {
- showMessage(msg);
- }
- addMessageToServer(msg, "home");
-}
-
-function showMessage(msg) {
- var txt = "Message received from unknown sender:
" +
- "" + msg.msg + "
" +
- "This message was saved as " + msg.filename + " onto your home computer.";
- Object(__WEBPACK_IMPORTED_MODULE_7__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);
-}
-
-//Adds a message to a server
-function addMessageToServer(msg, serverHostname) {
- var server = Object(__WEBPACK_IMPORTED_MODULE_5__Server_js__["c" /* GetServerByHostname */])(serverHostname);
- if (server == null) {
- console.log("WARNING: Did not locate " + serverHostname);
- return;
- }
- for (var i = 0; i < server.messages.length; ++i) {
- if (server.messages[i].filename === msg.filename) {
- return; //Already exists
- }
- }
- server.messages.push(msg);
-}
-
-//Checks if any of the 'timed' messages should be sent
-function checkForMessagesToSend() {
- var jumper0 = Messages[MessageFilenames.Jumper0];
- var jumper1 = Messages[MessageFilenames.Jumper1];
- var jumper2 = Messages[MessageFilenames.Jumper2];
- var jumper3 = Messages[MessageFilenames.Jumper3];
- var jumper4 = Messages[MessageFilenames.Jumper4];
- var cybersecTest = Messages[MessageFilenames.CyberSecTest];
- var nitesecTest = Messages[MessageFilenames.NiteSecTest];
- var bitrunnersTest = Messages[MessageFilenames.BitRunnersTest];
- var redpill = Messages[MessageFilenames.RedPill];
-
- var redpillOwned = false;
- if (__WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["c" /* Augmentations */][__WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].TheRedPill].owned) {
- redpillOwned = true;
- }
-
- if (redpill && redpillOwned && __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].sourceFiles.length === 0 && !__WEBPACK_IMPORTED_MODULE_4__RedPill_js__["b" /* redPillFlag */] && !__WEBPACK_IMPORTED_MODULE_2__Missions_js__["c" /* inMission */]) {
- if (!__WEBPACK_IMPORTED_MODULE_7__utils_DialogBox_js__["b" /* dialogBoxOpened */]) {
- sendMessage(redpill, true);
- }
- } else if (redpill && redpillOwned) {
- //If player has already destroyed a BitNode, message is not forced
- if (!__WEBPACK_IMPORTED_MODULE_4__RedPill_js__["b" /* redPillFlag */] && !__WEBPACK_IMPORTED_MODULE_2__Missions_js__["c" /* inMission */] && !__WEBPACK_IMPORTED_MODULE_7__utils_DialogBox_js__["b" /* dialogBoxOpened */]) {
- sendMessage(redpill);
- }
- } else if (jumper0 && !jumper0.recvd && __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill >= 25) {
- sendMessage(jumper0);
- __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_1__CreateProgram_js__["a" /* Programs */].Flight);
- } else if (jumper1 && !jumper1.recvd && __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill >= 40) {
- sendMessage(jumper1);
- } else if (cybersecTest && !cybersecTest.recvd && __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill >= 50) {
- sendMessage(cybersecTest);
- } else if (jumper2 && !jumper2.recvd && __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill >= 175) {
- sendMessage(jumper2);
- } else if (nitesecTest && !nitesecTest.recvd && __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill >= 200) {
- sendMessage(nitesecTest);
- } else if (jumper3 && !jumper3.recvd && __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill >= 350) {
- sendMessage(jumper3);
- } else if (jumper4 && !jumper4.recvd && __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill >= 490) {
- sendMessage(jumper4);
- } else if (bitrunnersTest && !bitrunnersTest.recvd && __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill >= 500) {
- sendMessage(bitrunnersTest);
- }
-}
-
-function AddToAllMessages(msg) {
- Messages[msg.filename] = msg;
-}
-
-let Messages = {}
-
-function loadMessages(saveString) {
- Messages = JSON.parse(saveString, __WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__["c" /* Reviver */]);
-}
-
-let MessageFilenames = {
- Jumper0: "j0.msg",
- Jumper1: "j1.msg",
- Jumper2: "j2.msg",
- Jumper3: "j3.msg",
- Jumper4: "j4.msg",
- CyberSecTest: "csec-test.msg",
- NiteSecTest: "nitesec-test.msg",
- BitRunnersTest: "19dfj3l1nd.msg",
- RedPill: "icarus.msg",
-}
-
-function initMessages() {
- //Reset
- Messages = {};
-
- //jump3R Messages
- AddToAllMessages(new Message(MessageFilenames.Jumper0,
- "I know you can sense it. I know you're searching for it. " +
- "It's why you spend night after " +
- "night at your computer.
It's real, I've seen it. And I can " +
- "help you find it. But not right now. You're not ready yet.
" +
- "Use this program to track your progress
" +
- "The fl1ght.exe program was added to your home computer
" +
- "-jump3R"));
- AddToAllMessages(new Message(MessageFilenames.Jumper1,
- "Soon you will be contacted by a hacking group known as CyberSec. " +
- "They can help you with your search.
" +
- "You should join them, garner their favor, and " +
- "exploit them for their Augmentations. But do not trust them. " +
- "They are not what they seem. No one is.
" +
- "-jump3R"));
- AddToAllMessages(new Message(MessageFilenames.Jumper2,
- "Do not try to save the world. There is no world to save. If " +
- "you want to find the truth, worry only about yourself. Ethics and " +
- "morals will get you killed.
Watch out for a hacking group known as NiteSec." +
- "
-jump3R"));
- AddToAllMessages(new Message(MessageFilenames.Jumper3,
- "You must learn to walk before you can run. And you must " +
- "run before you can fly. Look for the black hand.
" +
- "I.I.I.I
-jump3R"));
- AddToAllMessages(new Message(MessageFilenames.Jumper4,
- "To find what you are searching for, you must understand the bits. " +
- "The bits are all around us. The runners will help you.
" +
- "-jump3R"));
-
- //Messages from hacking factions
- AddToAllMessages(new Message(MessageFilenames.CyberSecTest,
- "We've been watching you. Your skills are very impressive. But you're wasting " +
- "your talents. If you join us, you can put your skills to good use and change " +
- "the world for the better. If you join us, we can unlock your full potential.
" +
- "But first, you must pass our test. Find and hack our server using the Terminal.
" +
- "-CyberSec"));
- AddToAllMessages(new Message(MessageFilenames.NiteSecTest,
- "People say that the corrupted governments and corporations rule the world. " +
- "Yes, maybe they do. But do you know who everyone really fears? People " +
- "like us. Because they can't hide from us. Because they can't fight shadows " +
- "and ideas with bullets.
" +
- "Join us, and people will fear you, too.
" +
- "Find and hack our hidden server using the Terminal. Then, we will contact you again." +
- "
-NiteSec"));
- AddToAllMessages(new Message(MessageFilenames.BitRunnersTest,
- "We know what you are doing. We know what drives you. We know " +
- "what you are looking for.
" +
- "We can help you find the answers.
" +
- "run4theh111z"));
-
- AddToAllMessages(new Message(MessageFilenames.RedPill,
- "@)(#V%*N)@(#*)*C)@#%*)*V)@#(*%V@)(#VN%*)@#(*%
" +
- ")@B(*#%)@)M#B*%V)____FIND___#$@)#%(B*)@#(*%B)
" +
- "@_#(%_@#M(BDSPOMB__THE-CAVE_#)$(*@#$)@#BNBEGB
" +
- "DFLSMFVMV)#@($*)@#*$MV)@#(*$V)M#(*$)M@(#*VM$)"));
-}
-
-
-
-
-/***/ }),
-/* 25 */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return setActiveScriptsClickHandlers; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return addActiveScriptsItem; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return deleteActiveScriptsItem; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return updateActiveScriptsItems; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__NetscriptWorker_js__ = __webpack_require__(11);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Server_js__ = __webpack_require__(6);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__ = __webpack_require__(1);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__ = __webpack_require__(2);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_LogBox_js__ = __webpack_require__(30);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js__ = __webpack_require__(18);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js__);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__ = __webpack_require__(4);
-
-
-
-
-
-
-
-
-
-
-/* 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(__WEBPACK_IMPORTED_MODULE_2__Server_js__["e" /* 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(workerscript.args[i].toString());
- }
- var itemName = itemNameArray.join("-");
- //var itemName = "active-scripts-" + server.hostname + "-" + workerscript.name;
- 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(__WEBPACK_IMPORTED_MODULE_2__Server_js__["e" /* 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(workerscript.args[i].toString());
- }
- var itemName = itemNameArray.join("-");
- //var itemName = "active-scripts-" + server.hostname + "-" + workerscript.name;
- 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 < __WEBPACK_IMPORTED_MODULE_0__NetscriptWorker_js__["h" /* workerScripts */].length; ++i) {
- total += updateActiveScriptsItemContent(__WEBPACK_IMPORTED_MODULE_0__NetscriptWorker_js__["h" /* workerScripts */][i]);
- }
- document.getElementById("active-scripts-total-prod").innerHTML =
- "Total online production of Active Scripts: " + __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(total).format('$0.000a') + " / sec
" +
- "Total online production since last Aug installation: " +
- __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].scriptProdSinceLastAug).format('$0.000a') + " (" +
- __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].scriptProdSinceLastAug / (__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* 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(__WEBPACK_IMPORTED_MODULE_2__Server_js__["e" /* 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(workerscript.args[i].toString());
- }
- 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(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* 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(__WEBPACK_IMPORTED_MODULE_5__utils_LogBox_js__["a" /* logBoxCreate */])(workerscript.scriptRef);
- return false;
- });
- killButton.addEventListener("click", function() {
- Object(__WEBPACK_IMPORTED_MODULE_0__NetscriptWorker_js__["d" /* killWorkerScript */])(workerscript.scriptRef, workerscript.scriptRef.scriptRef.server);
- Object(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* 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(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(workerscript.scriptRef.onlineMoneyMade, 2);
- var onlineTotalExpEarned = (Array(26).join(" ") + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(workerscript.scriptRef.onlineExpGained, 2) + " hacking exp").replace( / /g, " ");
-
- var onlineMps = workerscript.scriptRef.onlineMoneyMade / workerscript.scriptRef.onlineRunningTime;
- var onlineMpsText = "Online production rate: $" + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(onlineMps, 2) + "/second";
- var onlineEps = workerscript.scriptRef.onlineExpGained / workerscript.scriptRef.onlineRunningTime;
- var onlineEpsText = (Array(25).join(" ") + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(onlineEps, 4) + " hacking exp/second").replace( / /g, " ");
-
- //Offline
- var offlineTotalMoneyMade = "Total offline production: $" + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(workerscript.scriptRef.offlineMoneyMade, 2);
- var offlineTotalExpEarned = (Array(27).join(" ") + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(workerscript.scriptRef.offlineExpGained, 2) + " hacking exp").replace( / /g, " ");
-
- var offlineMps = workerscript.scriptRef.offlineMoneyMade / workerscript.scriptRef.offlineRunningTime;
- var offlineMpsText = "Offline production rate: $" + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(offlineMps, 2) + "/second";
- var offlineEps = workerscript.scriptRef.offlineExpGained / workerscript.scriptRef.offlineRunningTime;
- var offlineEpsText = (Array(26).join(" ") + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(offlineEps, 4) + " hacking exp/second").replace( / /g, " ");
-
- itemTextStats.innerHTML = onlineTotalMoneyMade + "
" + onlineTotalExpEarned + "
" +
- onlineMpsText + "
" + onlineEpsText + "
" + offlineTotalMoneyMade + "
" + offlineTotalExpEarned + "
" +
- offlineMpsText + "
" + offlineEpsText + "
";
- return onlineMps;
-}
-
-
-
-
-/***/ }),
-/* 26 */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return HackingMission; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return inMission; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return setInMission; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return currMission; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Constants_js__ = __webpack_require__(3);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__engine_js__ = __webpack_require__(5);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Faction_js__ = __webpack_require__(10);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__ = __webpack_require__(1);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__ = __webpack_require__(2);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__ = __webpack_require__(4);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_jsplumb__ = __webpack_require__(53);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_jsplumb___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_7_jsplumb__);
-
-
-
-
-
-
-
-
-
-let inMission = false; //Flag to denote whether a mission is running
-let currMission = null;
-function setInMission(bool, mission) {
- inMission = bool;
- if (bool) {
- currMission = mission;
- } else {
- currMission = null;
- }
-}
-
-//Keyboard shortcuts
-$(document).keydown(function(e) {
- if (inMission && currMission && currMission.selectedNode != null) {
- switch (e.keyCode) {
- case 65: //a for Attack
- currMission.actionButtons[0].click();
- break;
- case 83: //s for Scan
- currMission.actionButtons[1].click();
- break;
- case 87: //w for Weaken
- currMission.actionButtons[2].click();
- break;
- case 70: //f for Fortify
- currMission.actionButtons[3].click();
- break;
- case 82: //r for Overflow
- currMission.actionButtons[4].click();
- break;
- case 68: //d for Detach connection
- currMission.actionButtons[5].click();
- break;
- default:
- break;
- }
- }
-});
-
-let NodeTypes = {
- Core: "CPU Core Node", //All actions available
- Firewall: "Firewall Node", //No actions available
- Database: "Database Node", //No actions available
- Spam: "Spam Node", //No actions Available
- Transfer: "Transfer Node", //Can Weaken, Scan, Fortify and Overflow
- Shield: "Shield Node" //Can Fortify
-}
-
-let NodeActions = {
- Attack: "Attacking", //Damaged based on attack stat + hacking level + opp def
- Scan: "Scanning", //-Def for target, affected by attack and hacking level
- Weaken: "Weakening", //-Attack for target, affected by attack and hacking level
- Fortify: "Fortifying", //+Defense for Node, affected by hacking level
- Overflow: "Overflowing", //+Attack but -Defense for Node, affected by hacking level
-}
-
-function Node(type, stats) {
- this.type = type;
- this.atk = stats.atk ? stats.atk : 0;
- this.def = stats.def ? stats.def : 0;
- this.hp = stats.hp ? stats.hp : 0;
- this.maxhp = this.hp;
- this.plyrCtrl = false;
- this.enmyCtrl = false;
- this.pos = [0, 0]; //x, y
- this.el = null; //Holds the Node's DOM element
- this.action = null;
- this.targetedCount = 0; //Count of how many connections this node is the target of
-
- //Holds the JsPlumb Connection object for this Node,
- //where this Node is the Source (since each Node
- //can only have 1 outgoing Connection)
- this.conn = null;
-}
-
-Node.prototype.setPosition = function(x, y) {
- this.pos = [x, y];
-}
-
-Node.prototype.setControlledByPlayer = function() {
- this.plyrCtrl = true;
- this.enmyCtrl = false;
- if (this.el) {
- this.el.classList.remove("hack-mission-enemy-node");
- this.el.classList.add("hack-mission-player-node");
- }
-}
-
-Node.prototype.setControlledByEnemy = function() {
- this.plyrCtrl = false;
- this.enmyCtrl = true;
- if (this.el) {
- this.el.classList.remove("hack-mission-player-node");
- this.el.classList.add("hack-mission-enemy-node");
- }
-}
-
-//Sets this node to be the active node
-Node.prototype.select = function(actionButtons) {
- if (this.enmyCtrl) {return;}
- this.el.classList.add("hack-mission-player-node-active");
-
- //Make all buttons inactive
- for (var i = 0; i < actionButtons.length; ++i) {
- actionButtons[i].classList.remove("a-link-button");
- actionButtons[i].classList.add("a-link-button-inactive");
- }
-
- switch(this.type) {
- case NodeTypes.Core:
- //All buttons active
- for (var i = 0; i < actionButtons.length; ++i) {
- actionButtons[i].classList.remove("a-link-button-inactive");
- actionButtons[i].classList.add("a-link-button");
- }
- break;
- case NodeTypes.Transfer:
- actionButtons[1].classList.remove("a-link-button-inactive");
- actionButtons[1].classList.add("a-link-button");
- actionButtons[2].classList.remove("a-link-button-inactive");
- actionButtons[2].classList.add("a-link-button");
- actionButtons[3].classList.remove("a-link-button-inactive");
- actionButtons[3].classList.add("a-link-button");
- actionButtons[4].classList.remove("a-link-button-inactive");
- actionButtons[4].classList.add("a-link-button");
- actionButtons[5].classList.remove("a-link-button-inactive");
- actionButtons[5].classList.add("a-link-button");
- break;
- default:
- break;
- }
-}
-
-Node.prototype.deselect = function(actionButtons) {
- this.el.classList.remove("hack-mission-player-node-active");
- for (var i = 0; i < actionButtons.length; ++i) {
- actionButtons[i].classList.remove("a-link-button");
- actionButtons[i].classList.add("a-link-button-inactive");
- }
-}
-
-
-Node.prototype.untarget = function() {
- if (this.targetedCount === 0) {
- console.log("WARN: Node " + this.el.id + " is being 'untargeted' when it has no target count");
- return;
- }
- --this.targetedCount;
-}
-
-//Hacking mission instance
-//Takes in the reputation of the Faction for which the mission is
-//being conducted
-function HackingMission(rep, fac) {
- this.faction = fac;
-
- this.started = false;
- this.time = 180000; //5 minutes to start, milliseconds
-
- this.playerCores = [];
- this.playerNodes = []; //Non-core nodes
- this.playerAtk = 0;
- this.playerDef = 0;
-
- this.enemyCores = [];
- this.enemyDatabases = [];
- this.enemyNodes = []; //Non-core nodes
- this.enemyAtk = 0;
- this.enemyDef = 0;
-
- this.miscNodes = [];
-
- this.selectedNode = null; //Which of the player's nodes is currently selected
-
- this.actionButtons = []; //DOM buttons for actions
-
- this.availablePositions = [];
- for (var r = 0; r < 8; ++r) {
- for (var c = 0; c < 8; ++c) {
- this.availablePositions.push([r, c]);
- }
- }
-
- this.map = [];
- for (var i = 0; i < 8; ++i) {
- this.map.push([null, null, null, null, null, null, null, null]);
- }
-
- this.jsplumbinstance = null;
-
- this.difficulty = rep / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].HackingMissionRepToDiffConversion + 1;
- console.log("difficulty: " + this.difficulty);
- this.reward = 250 + (rep / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].HackingMissionRepToRewardConversion);
-}
-
-HackingMission.prototype.init = function() {
- //Create Header DOM
- this.createPageDom();
-
- //Create player starting nodes
- var home = __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].getHomeComputer()
- for (var i = 0; i < home.cpuCores; ++i) {
- var stats = {
- atk: (__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill / 7.5) + 30,
- def: (__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill / 20),
- hp: (__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill / 4),
- };
- this.playerCores.push(new Node(NodeTypes.Core, stats));
- this.playerCores[i].setControlledByPlayer();
- this.setNodePosition(this.playerCores[i], i, 0);
- this.removeAvailablePosition(i, 0);
- }
-
- //Randomly generate enemy nodes (CPU and Firewall) based on difficulty
- var numNodes = Math.min(8, Math.max(1, Math.round(this.difficulty / 4)));
- var numFirewalls = Math.min(20,
- Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(Math.round(this.difficulty/2), Math.round(this.difficulty/2) + 1));
- var numDatabases = Math.min(10, Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(1, Math.round(this.difficulty / 3) + 1));
- var totalNodes = numNodes + numFirewalls + numDatabases;
- var xlimit = 7 - Math.floor(totalNodes / 8);
- console.log("numNodes: " + numNodes);
- console.log("numFirewalls: " + numFirewalls);
- console.log("numDatabases: " + numDatabases);
- console.log("totalNodes: " + totalNodes);
- console.log("xlimit: " + xlimit);
- var randMult = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["a" /* addOffset */])(0.8 + (this.difficulty / 5), 10);
- for (var i = 0; i < numNodes; ++i) {
- var stats = {
- atk: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(75, 85),
- def: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(25, 35),
- hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(210, 230)
- }
- this.enemyCores.push(new Node(NodeTypes.Core, stats));
- this.enemyCores[i].setControlledByEnemy();
- this.setNodeRandomPosition(this.enemyCores[i], xlimit);
- }
- for (var i = 0; i < numFirewalls; ++i) {
- var stats = {
- atk: 0,
- def: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(80, 90),
- hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(275, 300)
- }
- this.enemyNodes.push(new Node(NodeTypes.Firewall, stats));
- this.enemyNodes[i].setControlledByEnemy();
- this.setNodeRandomPosition(this.enemyNodes[i], xlimit);
- }
- for (var i = 0; i < numDatabases; ++i) {
- var stats = {
- atk: 0,
- def: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(70, 85),
- hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(210, 275)
- }
- var node = new Node(NodeTypes.Database, stats);
- node.setControlledByEnemy();
- this.setNodeRandomPosition(node, xlimit);
- this.enemyDatabases.push(node);
- }
- this.calculateDefenses();
- this.calculateAttacks();
- this.createMap();
-}
-
-HackingMission.prototype.createPageDom = function() {
- var container = document.getElementById("mission-container");
-
- var favorMult = 1 + (this.faction.favor / 100);
- var gain = this.reward * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].faction_rep_mult * favorMult;
- var headerText = document.createElement("p");
- headerText.innerHTML = "You are about to start a hacking mission! You will gain " +
- Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(gain, 3) + " faction reputation with " + this.faction.name +
- " if you win. For more information " +
- "about how hacking missions work, click one of the guide links " +
- "below (one opens up an in-game guide and the other opens up " +
- "the guide from the wiki). Click the 'Start' button to begin.";
- headerText.style.display = "block";
- headerText.classList.add("hack-mission-header-element");
- headerText.style.width = "80%";
-
- var inGameGuideBtn = document.createElement("a");
- inGameGuideBtn.innerText = "How to Play";
- inGameGuideBtn.classList.add("a-link-button");
- inGameGuideBtn.style.display = "inline-block";
- inGameGuideBtn.classList.add("hack-mission-header-element");
- inGameGuideBtn.addEventListener("click", function() {
- Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])(__WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].HackingMissionHowToPlay);
- return false;
- });
-
- var wikiGuideBtn = document.createElement("a");
- wikiGuideBtn.innerText = "Wiki Guide";
- wikiGuideBtn.classList.add("a-link-button");
- wikiGuideBtn.style.display = "inline-block";
- wikiGuideBtn.classList.add("hack-mission-header-element");
- wikiGuideBtn.target = "_blank";
- //TODO Add link to wiki page wikiGuideBtn.href =
-
-
- //Start button will get replaced with forfeit when game is started
- var startBtn = document.createElement("a");
- startBtn.innerHTML = "Start";
- startBtn.setAttribute("id", "hack-mission-start-btn");
- startBtn.classList.add("a-link-button");
- startBtn.classList.add("hack-mission-header-element");
- startBtn.style.display = "inline-block";
- startBtn.addEventListener("click", ()=>{
- this.start();
- return false;
- });
-
- var forfeitMission = document.createElement("a");
- forfeitMission.innerHTML = "Forfeit Mission (Exit)";
- forfeitMission.classList.add("a-link-button");
- forfeitMission.classList.add("hack-mission-header-element");
- forfeitMission.style.display = "inline-block";
- forfeitMission.addEventListener("click", ()=> {
- this.finishMission(false);
- return false;
- });
-
- var timer = document.createElement("p");
- timer.setAttribute("id", "hacking-mission-timer");
- timer.style.display = "inline-block";
- timer.style.margin = "6px";
-
- //Create Action Buttons (Attack/Scan/Weaken/ etc...)
- var actionsContainer = document.createElement("span");
- actionsContainer.style.display = "block";
- actionsContainer.classList.add("hack-mission-action-buttons-container");
- for (var i = 0; i < 6; ++i) {
- this.actionButtons.push(document.createElement("a"));
- this.actionButtons[i].style.display = "inline-block";
- this.actionButtons[i].classList.add("a-link-button-inactive"); //Disabled at start
- this.actionButtons[i].classList.add("tooltip"); //Disabled at start
- this.actionButtons[i].classList.add("hack-mission-header-element");
- actionsContainer.appendChild(this.actionButtons[i]);
- }
- this.actionButtons[0].innerText = "Attack(a)";
- var atkTooltip = document.createElement("span");
- atkTooltip.classList.add("tooltiptexthigh");
- atkTooltip.innerText = "Lowers the targeted node's HP. The effectiveness of this depends on " +
- "this node's Attack level, your hacking level, and the opponent's defense level.";
- this.actionButtons[0].appendChild(atkTooltip);
- this.actionButtons[1].innerText = "Scan(s)";
- var scanTooltip = document.createElement("span");
- scanTooltip.classList.add("tooltiptexthigh");
- scanTooltip.innerText = "Lowers the targeted node's defense. The effectiveness of this depends on " +
- "this node's Attack level, your hacking level, and the opponent's defense level.";
- this.actionButtons[1].appendChild(scanTooltip);
- this.actionButtons[2].innerText = "Weaken(w)";
- var WeakenTooltip = document.createElement("span");
- WeakenTooltip.classList.add("tooltiptexthigh");
- WeakenTooltip.innerText = "Lowers the targeted node's attack. The effectiveness of this depends on " +
- "this node's Attack level, your hacking level, and the opponent's defense level.";
- this.actionButtons[2].appendChild(WeakenTooltip);
- this.actionButtons[3].innerText = "Fortify(f)";
- var fortifyTooltip = document.createElement("span");
- fortifyTooltip.classList.add("tooltiptexthigh");
- fortifyTooltip.innerText = "Raises this node's Defense level. The effectiveness of this depends on " +
- "your hacking level";
- this.actionButtons[3].appendChild(fortifyTooltip);
- this.actionButtons[4].innerText = "Overflow(r)";
- var overflowTooltip = document.createElement("span");
- overflowTooltip.classList.add("tooltiptexthigh");
- overflowTooltip.innerText = "Raises this node's Attack level but lowers its Defense level. The effectiveness " +
- "of this depends on your hacking level.";
- this.actionButtons[4].appendChild(overflowTooltip);
- this.actionButtons[5].innerText = "Drop Connection(d)";
- var dropconnTooltip = document.createElement("span");
- dropconnTooltip.classList.add("tooltiptexthigh");
- dropconnTooltip.innerText = "Removes this Node's current connection to some target Node, if it has one. This can " +
- "also be done by simply clicking the white connection line.";
- this.actionButtons[5].appendChild(dropconnTooltip);
-
- //Player/enemy defense displays will be in action container
- var playerStats = document.createElement("p");
- var enemyStats = document.createElement("p");
- playerStats.style.display = "inline-block";
- enemyStats.style.display = "inline-block";
- playerStats.style.color = "#00ccff";
- enemyStats.style.color = "red";
- playerStats.style.margin = "4px";
- enemyStats.style.margin = "4px";
- playerStats.setAttribute("id", "hacking-mission-player-stats");
- enemyStats.setAttribute("id", "hacking-mission-enemy-stats");
- actionsContainer.appendChild(playerStats);
- actionsContainer.appendChild(enemyStats);
-
- //Set Action Button event listeners
- this.actionButtons[0].addEventListener("click", ()=>{
- if (!(this.selectedNode instanceof Node)) {
- console.log("ERR: Pressing Action button without selected node");
- return;
- }
- if (this.selectedNode.type !== NodeTypes.Core) {return;}
- this.setActionButtonsActive();
- this.setActionButton(NodeActions.Attack, false); //Set attack button inactive
- this.selectedNode.action = NodeActions.Attack;
- });
-
- this.actionButtons[1].addEventListener("click", ()=>{
- if (!(this.selectedNode instanceof Node)) {
- console.log("ERR: Pressing Action button without selected node");
- return;
- }
- this.setActionButtonsActive();
- this.setActionButton(NodeActions.Scan, false); //Set scan button inactive
- this.selectedNode.action = NodeActions.Scan;
- });
-
- this.actionButtons[2].addEventListener("click", ()=>{
- if (!(this.selectedNode instanceof Node)) {
- console.log("ERR: Pressing Action button without selected node");
- return;
- }
- this.setActionButtonsActive();
- this.setActionButton(NodeActions.Weaken, false); //Set Weaken button inactive
- this.selectedNode.action = NodeActions.Weaken;
- });
-
- this.actionButtons[3].addEventListener("click", ()=>{
- if (!(this.selectedNode instanceof Node)) {
- console.log("ERR: Pressing Action button without selected node");
- return;
- }
- this.setActionButtonsActive();
- this.setActionButton(NodeActions.Fortify, false); //Set Fortify button inactive
- this.selectedNode.action = NodeActions.Fortify;
- });
-
- this.actionButtons[4].addEventListener("click", ()=>{
- if (!(this.selectedNode instanceof Node)) {
- console.log("ERR: Pressing Action button without selected node");
- return;
- }
- this.setActionButtonsActive();
- this.setActionButton(NodeActions.Overflow, false); //Set Overflow button inactive
- this.selectedNode.action = NodeActions.Overflow;
- });
-
- this.actionButtons[5].addEventListener("click", ()=>{
- if (!(this.selectedNode instanceof Node)) {
- console.log("ERR: Pressing Action button without selected node");
- return;
- }
- if (this.selectedNode.conn) {
- var endpoints = this.selectedNode.conn.endpoints;
- endpoints[0].detachFrom(endpoints[1]);
- }
- })
-
- var timeDisplay = document.createElement("p");
-
- container.appendChild(headerText);
- container.appendChild(inGameGuideBtn);
- container.appendChild(wikiGuideBtn);
- container.appendChild(startBtn);
- container.appendChild(forfeitMission);
- container.appendChild(timer);
- container.appendChild(actionsContainer);
- container.appendChild(timeDisplay);
-}
-
-HackingMission.prototype.setActionButtonsInactive = function() {
- for (var i = 0; i < this.actionButtons.length; ++i) {
- this.actionButtons[i].classList.remove("a-link-button");
- this.actionButtons[i].classList.add("a-link-button-inactive");
- }
-}
-
-HackingMission.prototype.setActionButtonsActive = function() {
- for (var i = 0; i < this.actionButtons.length; ++i) {
- this.actionButtons[i].classList.add("a-link-button");
- this.actionButtons[i].classList.remove("a-link-button-inactive");
- }
-}
-
-//True for active, false for inactive
-HackingMission.prototype.setActionButton = function(i, active=true) {
- if (Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["f" /* isString */])(i)) {
- switch (i) {
- case NodeActions.Attack:
- i = 0;
- break;
- case NodeActions.Scan:
- i = 1;
- break;
- case NodeActions.Weaken:
- i = 2;
- break;
- case NodeActions.Fortify:
- i = 3;
- break;
- case NodeActions.Overflow:
- default:
- i = 4;
- break;
- }
- }
- if (active) {
- this.actionButtons[i].classList.remove("a-link-button-inactive");
- this.actionButtons[i].classList.add("a-link-button");
- } else {
- this.actionButtons[i].classList.remove("a-link-button");
- this.actionButtons[i].classList.add("a-link-button-inactive");
- }
-
-}
-
-HackingMission.prototype.calculateAttacks = function() {
- var total = 0;
- for (var i = 0; i < this.playerCores.length; ++i) {
- total += this.playerCores[i].atk;
- }
- for (var i = 0; i < this.playerNodes.length; ++i) {
- total += this.playerNodes[i].atk;
- }
- this.playerAtk = total;
- document.getElementById("hacking-mission-player-stats").innerHTML =
- "Player Attack: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.playerAtk, 1) + "
" +
- "Player Defense: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.playerDef, 1);
- total = 0;
- for (var i = 0; i < this.enemyCores.length; ++i) {
- total += this.enemyCores[i].atk;
- }
- for (var i = 0; i < this.enemyDatabases.length; ++i) {
- total += this.enemyDatabases[i].atk;
- }
- for (var i = 0; i < this.enemyNodes.length; ++i) {
- total += this.enemyNodes[i].atk;
- }
- this.enemyAtk = total;
- document.getElementById("hacking-mission-enemy-stats").innerHTML =
- "Enemy Attack: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.enemyAtk, 1) + "
" +
- "Enemy Defense: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.enemyDef, 1);
-}
-
-HackingMission.prototype.calculateDefenses = function() {
- var total = 0;
- for (var i = 0; i < this.playerCores.length; ++i) {
- total += this.playerCores[i].def;
- }
- for (var i = 0; i < this.playerNodes.length; ++i) {
- total += this.playerNodes[i].def;
- }
- this.playerDef = total;
- document.getElementById("hacking-mission-player-stats").innerHTML =
- "Player Attack: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.playerAtk, 1) + "
" +
- "Player Defense: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.playerDef, 1);
- total = 0;
- for (var i = 0; i < this.enemyCores.length; ++i) {
- total += this.enemyCores[i].def;
- }
- for (var i = 0; i < this.enemyDatabases.length; ++i) {
- total += this.enemyDatabases[i].def;
- }
- for (var i = 0; i < this.enemyNodes.length; ++i) {
- total += this.enemyNodes[i].def;
- }
- this.enemyDef = total;
- document.getElementById("hacking-mission-enemy-stats").innerHTML =
- "Enemy Attack: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.enemyAtk, 1) + "
" +
- "Enemy Defense: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.enemyDef, 1);
-}
-
-HackingMission.prototype.removeAvailablePosition = function(x, y) {
- for (var i = 0; i < this.availablePositions.length; ++i) {
- if (this.availablePositions[i][0] === x &&
- this.availablePositions[i][1] === y) {
- this.availablePositions.splice(i, 1);
- return;
- }
- }
- console.log("WARNING: removeAvailablePosition() did not remove " + x + ", " + y);
-}
-
-HackingMission.prototype.setNodePosition = function(nodeObj, x, y) {
- if (!(nodeObj instanceof Node)) {
- console.log("WARNING: Non-Node object passed into setNodePOsition");
- return;
- }
- if (isNaN(x) || isNaN(y)) {
- console.log("ERR: Invalid values passed as x and y for setNodePosition");
- console.log(x);
- console.log(y);
- return;
- }
- nodeObj.pos = [x, y];
- this.map[x][y] = nodeObj;
-}
-
-HackingMission.prototype.setNodeRandomPosition = function(nodeObj, xlimit=0) {
- var i = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(0, this.availablePositions.length - 1);
- if (this.availablePositions[i][1] < xlimit) {
- //Recurse if not within limit
- return this.setNodeRandomPosition(nodeObj, xlimit);
- }
- var pos = this.availablePositions.splice(i, 1);
- pos = pos[0];
- this.setNodePosition(nodeObj, pos[0], pos[1]);
-}
-
-HackingMission.prototype.createMap = function() {
- //Use a grid
- var map = document.createElement("div");
- map.classList.add("hack-mission-grid");
- map.setAttribute("id", "hacking-mission-map");
- document.getElementById("mission-container").appendChild(map);
-
- //Create random Nodes for every space in the map that
- //hasn't been filled yet. The stats of each Node will be based on
- //the player/enemy attack
- var averageAttack = (this.playerAtk + this.enemyAtk) / 2;
- for (var x = 0; x < 8; ++x) {
- for (var y = 0; y < 8; ++y) {
- if (!(this.map[x][y] instanceof Node)) {
- var node, type = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(0, 2);
- var randMult = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["a" /* addOffset */])(0.85 + (this.difficulty / 2), 15);
- switch (type) {
- case 0: //Spam
- var stats = {
- atk: 0,
- def: averageAttack * 1.15 + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(10, 50),
- hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(200, 225)
- }
- node = new Node(NodeTypes.Spam, stats);
- break;
- case 1: //Transfer
- var stats = {
- atk: 0,
- def: averageAttack * 1.15 + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(10, 50),
- hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(250, 275)
- }
- node = new Node(NodeTypes.Transfer, stats);
- break;
- case 2: //Shield
- default:
- var stats = {
- atk: 0,
- def: averageAttack * 1.15 + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(25, 75),
- hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(300, 320)
- }
- node = new Node(NodeTypes.Shield, stats);
- break;
- }
- this.setNodePosition(node, x, y);
- this.removeAvailablePosition(x, y);
- this.miscNodes.push(node);
- }
- }
- }
-
- //Create DOM elements in order
- for (var r = 0; r < 8; ++r) {
- for (var c = 0; c < 8; ++c) {
- this.createNodeDomElement(this.map[r][c]);
- }
- }
-
- //Configure all Player CPUS
- for (var i = 0; i < this.playerCores.length; ++i) {
- console.log("Configuring Player Node: " + this.playerCores[i].el.id);
- this.configurePlayerNodeElement(this.playerCores[i].el);
- }
-}
-
-HackingMission.prototype.createNodeDomElement = function(nodeObj) {
- var nodeDiv = document.createElement("a"), txtEl = document.createElement('p');
- nodeObj.el = nodeDiv;
-
- //Set the node element's id based on its coordinates
- var id = "hacking-mission-node-" + nodeObj.pos[0] + "-" + nodeObj.pos[1];
- nodeDiv.setAttribute("id", id);
- txtEl.setAttribute("id", id + "-txt");
-
- //Set node classes for owner
- nodeDiv.classList.add("hack-mission-node");
- if (nodeObj.plyrCtrl) {
- nodeDiv.classList.add("hack-mission-player-node");
- } else if (nodeObj.enmyCtrl) {
- nodeDiv.classList.add("hack-mission-enemy-node");
- }
-
- //Set node classes based on type
- var txt;
- switch (nodeObj.type) {
- case NodeTypes.Core:
- txt = "CPU Core
" + "HP: " +
- Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
- nodeDiv.classList.add("hack-mission-cpu-node");
- break;
- case NodeTypes.Firewall:
- txt = "Firewall
" + "HP: " +
- Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
- nodeDiv.classList.add("hack-mission-firewall-node");
- break;
- case NodeTypes.Database:
- txt = "Database
" + "HP: " +
- Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
- nodeDiv.classList.add("hack-mission-database-node");
- break;
- case NodeTypes.Spam:
- txt = "Spam
" + "HP: " +
- Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
- nodeDiv.classList.add("hack-mission-spam-node");
- break;
- case NodeTypes.Transfer:
- txt = "Transfer
" + "HP: " +
- Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
- nodeDiv.classList.add("hack-mission-transfer-node");
- break;
- case NodeTypes.Shield:
- default:
- txt = "Shield
" + "HP: " +
- Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
- nodeDiv.classList.add("hack-mission-shield-node");
- break;
- }
-
- txt += "
Atk: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.atk, 1) +
- "
Def: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.def, 1);
- txtEl.innerHTML = txt;
-
- nodeDiv.appendChild(txtEl);
- document.getElementById("hacking-mission-map").appendChild(nodeDiv);
-}
-
-HackingMission.prototype.updateNodeDomElement = function(nodeObj) {
- if (nodeObj.el == null) {
- console.log("ERR: Calling updateNodeDomElement on a Node without an element");
- return;
- }
-
- var id = "hacking-mission-node-" + nodeObj.pos[0] + "-" + nodeObj.pos[1];
- var nodeDiv = document.getElementById(id), txtEl = document.getElementById(id + "-txt");
-
- //Set node classes based on type
- var txt;
- switch (nodeObj.type) {
- case NodeTypes.Core:
- txt = "CPU Core
" + "HP: " +
- Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
- break;
- case NodeTypes.Firewall:
- txt = "Firewall
" + "HP: " +
- Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
- break;
- case NodeTypes.Database:
- txt = "Database
" + "HP: " +
- Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
- break;
- case NodeTypes.Spam:
- txt = "Spam
" + "HP: " +
- Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
- break;
- case NodeTypes.Transfer:
- txt = "Transfer
" + "HP: " +
- Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
- break;
- case NodeTypes.Shield:
- default:
- txt = "Shield
" + "HP: " +
- Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
- break;
- }
-
- txt += "
Atk: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.atk, 1) +
- "
Def: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.def, 1);
- if (nodeObj.action) {
- txt += "
" + nodeObj.action;
- }
- txtEl.innerHTML = txt;
-}
-
-//Gets a Node DOM element's corresponding Node object using its
-//element id. Function accepts either the DOM element object or the ID as
-//an argument
-HackingMission.prototype.getNodeFromElement = function(el) {
- var id;
- if (Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["f" /* isString */])(el)) {
- id = el;
- } else {
- id = el.id;
- }
- id = id.replace("hacking-mission-node-", "");
- var res = id.split('-');
- if (res.length != 2) {
- console.log("ERROR Parsing Hacking Mission Node Id. Could not find coordinates");
- return null;
- }
- var x = res[0], y = res[1];
- if (isNaN(x) || isNaN(y) || x >= 8 || y >= 8 || x < 0 || y < 0) {
- console.log("ERROR: Unexpected values for x and y: " + x + ", " + y);
- return null;
- }
- return this.map[x][y];
-}
-
-function selectNode(hackMissionInst, el) {
- var nodeObj = hackMissionInst.getNodeFromElement(el);
- if (nodeObj == null) {console.log("Error getting Node object");}
- if (!nodeObj.plyrCtrl) {return;}
-
- if (hackMissionInst.selectedNode instanceof Node) {
- hackMissionInst.selectedNode.deselect(hackMissionInst.actionButtons);
- hackMissionInst.selectedNode = null;
- }
- nodeObj.select(hackMissionInst.actionButtons);
- hackMissionInst.selectedNode = nodeObj;
-}
-
-//Configures a DOM element representing a player-owned node to
-//be selectable and actionable
-//Note: Does NOT change its css class. This is handled by Node.setControlledBy...
-HackingMission.prototype.configurePlayerNodeElement = function(el) {
- var nodeObj = this.getNodeFromElement(el);
- if (nodeObj == null) {console.log("Error getting Node object");}
-
- //Add event listener
- var self = this;
- function selectNodeWrapper() {
- selectNode(self, el);
- }
- el.addEventListener("click", selectNodeWrapper);
-
- if (el.firstChild) {
- el.firstChild.addEventListener("click", selectNodeWrapper);
- }
-}
-
-//Configures a DOM element representing an enemy-node by removing
-//any event listeners
-HackingMission.prototype.configureEnemyNodeElement = function(el) {
- //Deselect node if it was the selected node
- var nodeObj = this.getNodeFromElement(el);
- if (this.selectedNode == nodeObj) {
- nodeObj.deselect(this.actionButtons);
- }
-}
-
-//Returns bool indicating whether a node is reachable by player
-//by checking if any of the adjacent nodes are owned by the player
-HackingMission.prototype.nodeReachable = function(node) {
- var x = node.pos[0], y = node.pos[1];
- if (x > 0 && this.map[x-1][y].plyrCtrl) {return true;}
- if (x < 7 && this.map[x+1][y].plyrCtrl) {return true;}
- if (y > 0 && this.map[x][y-1].plyrCtrl) {return true;}
- if (y < 7 && this.map[x][y+1].plyrCtrl) {return true;}
- return false;
-}
-
-HackingMission.prototype.nodeReachableByEnemy = function(node) {
- if (node == null) {return false;}
- var x = node.pos[0], y = node.pos[1];
- if (x > 0 && this.map[x-1][y].enmyCtrl) {return true;}
- if (x < 7 && this.map[x+1][y].enmyCtrl) {return true;}
- if (y > 0 && this.map[x][y-1].enmyCtrl) {return true;}
- if (y < 7 && this.map[x][y+1].enmyCtrl) {return true;}
- return false;
-}
-
-HackingMission.prototype.start = function() {
- this.started = true;
- this.initJsPlumb();
- var startBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["b" /* clearEventListeners */])("hack-mission-start-btn");
- startBtn.classList.remove("a-link-button");
- startBtn.classList.add("a-link-button-inactive");
-}
-
-HackingMission.prototype.initJsPlumb = function() {
- var instance = jsPlumb.getInstance({
- DragOptions:{cursor:"pointer", zIndex:2000},
- PaintStyle: {
- gradient: { stops: [
- [ 0, "#FFFFFF" ],
- [ 1, "#FFFFFF" ]
- ] },
- stroke: "#FFFFFF",
- strokeWidth: 8
- },
- });
-
- this.jsplumbinstance = instance;
-
- //All player cores are sources
- for (var i = 0; i < this.playerCores.length; ++i) {
- instance.makeSource(this.playerCores[i].el, {
- deleteEndpointsOnEmpty:true,
- maxConnections:1,
- anchor:"Continuous",
- connector:"Flowchart"
- });
- }
-
- //Everything else is a target
- for (var i = 0; i < this.enemyCores.length; ++i) {
- instance.makeTarget(this.enemyCores[i].el, {
- maxConnections:-1,
- anchor:"Continuous",
- connector:"Flowchart"
- });
- }
- for (var i = 0; i < this.enemyDatabases.length; ++i) {
- instance.makeTarget(this.enemyDatabases[i].el, {
- maxConnections:-1,
- anchor:"Continuous",
- connector:["Flowchart"]
- });
- }
- for (var i = 0; i < this.enemyNodes.length; ++i) {
- instance.makeTarget(this.enemyNodes[i].el, {
- maxConnections:-1,
- anchor:"Continuous",
- connector:"Flowchart"
- });
- }
- for (var i = 0; i < this.miscNodes.length; ++i) {
- instance.makeTarget(this.miscNodes[i].el, {
- maxConnections:-1,
- anchor:"Continuous",
- connector:"Flowchart"
- });
- }
-
- //Clicking a connection drops it
- instance.bind("click", function(conn, originalEvent) {
- var endpoints = conn.endpoints;
- endpoints[0].detachFrom(endpoints[1]);
- });
-
- //Connection events
- instance.bind("connection", (info)=>{
- var targetNode = this.getNodeFromElement(info.target);
-
- //Do not detach for enemy nodes
- var thisNode = this.getNodeFromElement(info.source);
- if (thisNode.enmyCtrl) {return;}
-
- //If the node is not reachable, drop the connection
- if (!this.nodeReachable(targetNode)) {
- info.sourceEndpoint.detachFrom(info.targetEndpoint);
- return;
- }
-
- var sourceNode = this.getNodeFromElement(info.source);
- sourceNode.conn = info.connection;
- var targetNode = this.getNodeFromElement(info.target);
- ++targetNode.targetedCount;
- });
-
- //Detach Connection events
- instance.bind("connectionDetached", (info, originalEvent)=>{
- var sourceNode = this.getNodeFromElement(info.source);
- sourceNode.conn = null;
- var targetNode = this.getNodeFromElement(info.target);
- targetNode.untarget();
- });
-
-}
-
-//Drops all connections where the specified node is the source
-HackingMission.prototype.dropAllConnectionsFromNode = function(node) {
- var allConns = this.jsplumbinstance.getAllConnections();
- for (var i = allConns.length-1; i >= 0; --i) {
- if (allConns[i].source == node.el) {
- allConns[i].endpoints[0].detachFrom(allConns[i].endpoints[1]);
- }
- }
-}
-
-//Drops all connections where the specified node is the target
-HackingMission.prototype.dropAllConnectionsToNode = function(node) {
- var allConns = this.jsplumbinstance.getAllConnections();
- for (var i = allConns.length-1; i >= 0; --i) {
- if (allConns[i].target == node.el) {
- allConns[i].endpoints[0].detachFrom(allConns[i].endpoints[1]);
- }
- }
- node.beingTargeted = false;
-}
-
-var storedCycles = 0;
-HackingMission.prototype.process = function(numCycles=1) {
- if (!this.started) {return;}
- storedCycles += numCycles;
- if (storedCycles < 2) {return;} //Only process every 3 cycles minimum
-
- var res = false;
- //Process actions of all player nodes
- this.playerCores.forEach((node)=>{
- res |= this.processNode(node, storedCycles);
- });
-
- this.playerNodes.forEach((node)=>{
- if (node.type === NodeTypes.Transfer) {
- res |= this.processNode(node, storedCycles);
- }
- });
-
- //Process actions of all enemy nodes
- this.enemyCores.forEach((node)=>{
- this.enemyAISelectAction(node);
- res |= this.processNode(node, storedCycles);
- });
-
- this.enemyNodes.forEach((node)=>{
- if (node.type === NodeTypes.Transfer) {
- this.enemyAISelectAction(node);
- res |= this.processNode(node, storedCycles);
- }
- });
-
- //The hp of enemy databases increases slowly
- this.enemyDatabases.forEach((node)=>{
- node.maxhp += (0.1 * storedCycles);
- node.hp += (0.1 * storedCycles);
- });
-
- if (res) {
- this.calculateAttacks();
- this.calculateDefenses();
- }
-
- //Win if all enemy databases are conquered
- if (this.enemyDatabases.length === 0) {
- this.finishMission(true);
- return;
- }
-
- //Lose if all your cores are gone
- if (this.playerCores.length === 0) {
- this.finishMission(false);
- return;
- }
-
- //Defense/hp of misc nodes increases slowly over time
- this.miscNodes.forEach((node)=>{
- node.def += (0.1 * storedCycles);
- node.maxhp += (0.05 * storedCycles);
- node.hp += (0.1 * storedCycles);
- if (node.hp > node.maxhp) {node.hp = node.maxhp;}
- this.updateNodeDomElement(node);
- });
-
- //Update timer and check if player lost
- this.time -= (storedCycles * __WEBPACK_IMPORTED_MODULE_1__engine_js__["Engine"]._idleSpeed);
- if (this.time <= 0) {
- this.finishMission(false);
- return;
- }
- this.updateTimer();
-
- storedCycles = 0;
-}
-
-//Returns a bool representing whether defenses need to be re-calculated
-HackingMission.prototype.processNode = function(nodeObj, numCycles=1) {
- if (nodeObj.action == null) {
- return;
- }
-
- var targetNode = null, def, atk;
- if (nodeObj.conn) {
- var targetNode;
- if (nodeObj.conn.target) {
- targetNode = this.getNodeFromElement(nodeObj.conn.target);
- } else {
- targetNode = this.getNodeFromElement(nodeObj.conn.targetId);
- }
-
- if (targetNode.plyrCtrl) {
- def = this.playerDef;
- atk = this.enemyAtk;
- } else if (targetNode.enmyCtrl) {
- def = this.enemyDef;
- atk = this.playerAtk;
- } else { //Misc Node
- def = targetNode.def;
- nodeObj.plyrCtrl ? atk = this.playerAtk : atk = this.enemyAtk;
- }
- }
-
- //Calculations are per second, so divide everything by 5
- var calcStats = false, plyr = nodeObj.plyrCtrl;
- var enmyHacking = this.difficulty * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].HackingMissionDifficultyToHacking;
- switch(nodeObj.action) {
- case NodeActions.Attack:
- if (nodeObj.conn == null) {break;}
- var dmg = this.calculateAttackDamage(atk, def, plyr ? __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill : enmyHacking);
- targetNode.hp -= (dmg/5 * numCycles);
- break;
- case NodeActions.Scan:
- if (nodeObj.conn == null) {break;}
- var eff = this.calculateScanEffect(atk, def, plyr ? __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill : enmyHacking);
- targetNode.def -= (eff/5 * numCycles);
- calcStats = true;
- break;
- case NodeActions.Weaken:
- if (nodeObj.conn == null) {break;}
- var eff = this.calculateWeakenEffect(atk, def, plyr ? __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill : enmyHacking);
- targetNode.atk -= (eff/5 * numCycles);
- calcStats = true;
- break;
- case NodeActions.Fortify:
- var eff = this.calculateFortifyEffect(__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill);
- nodeObj.def += (eff/5 * numCycles);
- calcStats = true;
- break;
- case NodeActions.Overflow:
- var eff = this.calculateOverflowEffect(__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill);
- if (nodeObj.def < eff) {break;}
- nodeObj.def -= (eff/5 * numCycles);
- nodeObj.atk += (eff/5 * numCycles);
- calcStats = true;
- break;
- default:
- console.log("ERR: Invalid Node Action: " + nodeObj.action);
- break;
- }
-
- //Stats can't go below 0
- if (nodeObj.atk < 0) {nodeObj.atk = 0;}
- if (nodeObj.def < 0) {nodeObj.def = 0;}
- if (targetNode && targetNode.atk < 0) {targetNode.atk = 0;}
- if (targetNode && targetNode.def < 0) {targetNode.def = 0;}
-
- //Conquering a node
- if (targetNode && targetNode.hp <= 0) {
- var conqueredByPlayer = nodeObj.plyrCtrl;
- targetNode.hp = targetNode.maxhp;
- targetNode.action = null;
- targetNode.conn = null;
- if (this.selectedNode == targetNode) {
- targetNode.deselect(this.actionButtons);
- }
-
- //The conquered node has its stats reduced
- targetNode.atk /= 2;
- targetNode.def /= 3.5;
-
- //Flag for whether the target node was a misc node
- var isMiscNode = !targetNode.plyrCtrl && !targetNode.enmyCtrl;
-
- //Remove all connections from Node
- this.dropAllConnectionsToNode(targetNode);
- this.dropAllConnectionsFromNode(targetNode);
-
- //Changes the css class and turn the node into a JsPlumb Source/Target
- if (conqueredByPlayer) {
- targetNode.setControlledByPlayer();
- this.jsplumbinstance.unmakeTarget(targetNode.el);
- this.jsplumbinstance.makeSource(targetNode.el, {
- deleteEndpointsOnEmpty:true,
- maxConnections:1,
- anchor:"Continuous",
- connector:"Flowchart"
- });
- } else {
- targetNode.setControlledByEnemy();
- nodeObj.conn = null; //Clear connection
- this.jsplumbinstance.unmakeSource(targetNode.el);
- this.jsplumbinstance.makeTarget(targetNode.el, {
- maxConnections:-1,
- anchor:"Continuous",
- connector:["Flowchart"]
- });
- }
-
- calcStats = true;
-
- //Helper function to swap nodes between the respective enemyNodes/playerNodes arrays
- function swapNodes(orig, dest, targetNode) {
- for (var i = 0; i < orig.length; ++i) {
- if (orig[i] == targetNode) {
- var node = orig.splice(i, 1);
- node = node[0];
- dest.push(node);
- break;
- }
- }
- }
-
- switch(targetNode.type) {
- case NodeTypes.Core:
- if (conqueredByPlayer) {
- swapNodes(this.enemyCores, this.playerCores, targetNode);
- this.configurePlayerNodeElement(targetNode.el);
- } else {
- swapNodes(this.playerCores, this.enemyCores, targetNode);
- this.configureEnemyNodeElement(targetNode.el);
- }
- break;
- case NodeTypes.Firewall:
- if (conqueredByPlayer) {
- swapNodes(this.enemyNodes, this.playerNodes, targetNode);
- } else {
- swapNodes(this.playerNodes, this.enemyNodes, targetNode);
- }
- break;
- case NodeTypes.Database:
- if (conqueredByPlayer) {
- swapNodes(this.enemyDatabases, this.playerNodes, targetNode);
- } else {
- swapNodes(this.playerNodes, this.enemyDatabases, targetNode);
- }
- break;
- case NodeTypes.Spam:
- if (conqueredByPlayer) {
- swapNodes(isMiscNode ? this.miscNodes : this.enemyNodes, this.playerNodes, targetNode);
- //Conquering spam node increases time limit
- this.time += __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].HackingMissionSpamTimeIncrease;
- } else {
- swapNodes(isMiscNode ? this.miscNodes : this.playerNodes, this.enemyNodes, targetNode);
- }
-
- break;
- case NodeTypes.Transfer:
- //Conquering a Transfer node increases the attack of all cores by some percentages
- if (conqueredByPlayer) {
- swapNodes(isMiscNode ? this.miscNodes : this.enemyNodes, this.playerNodes, targetNode);
- this.playerCores.forEach(function(node) {
- node.atk *= __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].HackingMissionTransferAttackIncrease;
- });
- this.configurePlayerNodeElement(targetNode.el);
- } else {
- swapNodes(isMiscNode ? this.miscNodes : this.playerNodes, this.enemyNodes, targetNode);
- this.enemyCores.forEach(function(node) {
- node.atk *= __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].HackingMissionTransferAttackIncrease;
- });
- this.configureEnemyNodeElement(targetNode.el);
- }
- break;
- case NodeTypes.Shield:
- if (conqueredByPlayer) {
- swapNodes(isMiscNode ? this.miscNodes : this.enemyNodes, this.playerNodes, targetNode);
- } else {
- swapNodes(isMiscNode ? this.miscNodes : this.playerNodes, this.enemyNodes, targetNode);
- }
- break;
- }
-
- //If a misc node was conquered, the defense for all misc nodes increases by some fixed amount
- if (isMiscNode) { //&& conqueredByPlayer) {
- this.miscNodes.forEach((node)=>{
- if (node.targetedCount === 0) {
- node.def *= __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].HackingMissionMiscDefenseIncrease;
- }
- });
- }
- }
-
- //Update node DOMs
- this.updateNodeDomElement(nodeObj);
- if (targetNode) {this.updateNodeDomElement(targetNode);}
- return calcStats;
-}
-
-//Enemy "AI" for CPU Core and Transfer Nodes
-HackingMission.prototype.enemyAISelectAction = function(nodeObj) {
- if (nodeObj == null) {return;}
- switch(nodeObj.type) {
- case NodeTypes.Core:
- //Select a single RANDOM target from miscNodes and player's Nodes
- //If it is reachable, it will target it. If not, no target will
- //be selected for now, and the next time process() gets called this will repeat
- if (nodeObj.conn == null) {
- if (this.miscNodes.length === 0) {
- //Randomly pick a player node and attack it if its reachable
- var rand = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(0, this.playerNodes.length-1);
- var node;
- if (this.playerNodes.length === 0) {
- node = null;
- } else {
- node = this.playerNodes[rand];
- }
- if (this.nodeReachableByEnemy(node)) {
- //Create connection
- nodeObj.conn = this.jsplumbinstance.connect({
- source:nodeObj.el,
- target:node.el
- });
- ++node.targetedCount;
- } else {
- //Randomly pick a player core and attack it if its reachable
- rand = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(0, this.playerCores.length-1);
- if (this.playerCores.length === 0) {
- return; //No Misc Nodes, no player Nodes, no Player cores. Player lost
- } else {
- node = this.playerCores[rand];
- }
-
- if (this.nodeReachableByEnemy(node)) {
- //Create connection
- nodeObj.conn = this.jsplumbinstance.connect({
- source:nodeObj.el,
- target:node.el
- });
- ++node.targetedCount;
- }
- }
- } else {
- //Randomly pick a misc node and attack it if its reachable
- var rand = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(0, this.miscNodes.length-1);
- var node = this.miscNodes[rand];
- if (this.nodeReachableByEnemy(node)) {
- nodeObj.conn = this.jsplumbinstance.connect({
- source:nodeObj.el,
- target:node.el,
- });
- ++node.targetedCount;
- }
- }
-
- //If no connection was made, set the Core to Fortify
- nodeObj.action = NodeActions.Fortify;
- } else {
- //If this node has a selected target
- var targetNode;
- if (nodeObj.conn.target) {
- targetNode = this.getNodeFromElement(nodeObj.conn.target);
- } else {
- targetNode = this.getNodeFromElement(nodeObj.conn.targetId);
- }
- if (targetNode == null) {
- console.log("Error getting Target node Object in enemyAISelectAction()");
- }
-
- if (targetNode.def > this.enemyAtk + 15) {
- if (nodeObj.def < 50) {
- nodeObj.action = NodeActions.Fortify;
- } else {
- nodeObj.action = NodeActions.Overflow;
- }
- } else if (Math.abs(targetNode.def - this.enemyAtk) <= 15) {
- nodeObj.action = NodeActions.Scan;
- } else {
- nodeObj.action = NodeActions.Attack;
- }
- }
- break;
- case NodeTypes.Transfer:
- //Switch between fortifying and overflowing as necessary
- if (nodeObj.def < 125) {
- nodeObj.action = NodeActions.Fortify;
- } else {
- nodeObj.action = NodeActions.Overflow;
- }
- break;
- default:
- break;
- }
-}
-
-var hackEffWeightSelf = 130; //Weight for Node actions on self
-var hackEffWeightTarget = 25; //Weight for Node Actions against Target
-var hackEffWeightAttack = 80; //Weight for Attack action
-
-//Returns damage per cycle based on stats
-HackingMission.prototype.calculateAttackDamage = function(atk, def, hacking = 0) {
- return Math.max(0.75 * (atk + (hacking / hackEffWeightAttack) - def), 1);
-}
-
-HackingMission.prototype.calculateScanEffect = function(atk, def, hacking=0) {
- return Math.max(0.7 * ((atk) + hacking / hackEffWeightTarget - (def * 0.95)), 2);
-}
-
-HackingMission.prototype.calculateWeakenEffect = function(atk, def, hacking=0) {
- return Math.max((atk) + hacking / hackEffWeightTarget - (def * 0.95), 2);
-}
-
-HackingMission.prototype.calculateFortifyEffect = function(hacking=0) {
- return hacking / hackEffWeightSelf;
-}
-
-HackingMission.prototype.calculateOverflowEffect = function(hacking=0) {
- return hacking / hackEffWeightSelf;
-}
-
-//Updates timer display
-HackingMission.prototype.updateTimer = function() {
- var timer = document.getElementById("hacking-mission-timer");
-
- //Convert time remaining to a string of the form mm:ss
- var seconds = Math.round(this.time / 1000);
- var minutes = Math.trunc(seconds / 60);
- seconds %= 60;
- var str = ("0" + minutes).slice(-2) + ":" + ("0" + seconds).slice(-2);
- timer.innerText = "Time left: " + str;
-}
-
-//The 'win' argument is a bool for whether or not the player won
-HackingMission.prototype.finishMission = function(win) {
- inMission = false;
- currMission = null;
-
- if (win) {
- var favorMult = 1 + (this.faction.favor / 100);
- console.log("Hacking mission base reward: " + this.reward);
- console.log("favorMult: " + favorMult);
- console.log("rep mult: " + __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].faction_rep_mult);
- var gain = this.reward * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].faction_rep_mult * favorMult;
- Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Mission won! You earned " +
- Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(gain, 3) + " reputation with " + this.faction.name);
- __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].gainIntelligenceExp(this.difficulty * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].IntelligenceHackingMissionBaseExpGain);
- this.faction.playerReputation += gain;
- } else {
- Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Mission lost/forfeited! You did not gain any faction reputation.");
- }
-
- //Clear mission container
- var container = document.getElementById("mission-container");
- while(container.firstChild) {
- container.removeChild(container.firstChild);
- }
-
- //Return to Faction page
- document.getElementById("mainmenu-container").style.visibility = "visible";
- document.getElementById("character-overview-wrapper").style.visibility = "visible";
- __WEBPACK_IMPORTED_MODULE_1__engine_js__["Engine"].loadFactionContent();
- Object(__WEBPACK_IMPORTED_MODULE_2__Faction_js__["c" /* displayFactionContent */])(this.faction.name);
-}
-
-
-
-/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(9)))
-
-/***/ }),
-/* 27 */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return iTutorialSteps; });
-/* unused harmony export iTutorialEnd */
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return iTutorialStart; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return iTutorialNextStep; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return currITutorialStep; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return iTutorialIsRunning; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__engine_js__ = __webpack_require__(5);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils_DialogBox_js__ = __webpack_require__(1);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__ = __webpack_require__(2);
-
-
-
-
-/* InteractiveTutorial.js */
-let iTutorialSteps = {
- Start: "Start",
- GoToCharacterPage: "Click on the Character page menu link",
- CharacterPage: "Introduction to Character page",
- CharacterGoToTerminalPage: "Click on the Terminal link",
- TerminalIntro: "Introduction to terminal interface",
- TerminalHelp: "Using the help command to display all options in terminal",
- TerminalLs: "Use the ls command to show all programs/scripts. Right now we have NUKE.exe",
- TerminalScan: "Using the scan command to display all available connections",
- TerminalScanAnalyze1: "Use the scan-analyze command to show hacking related information",
- TerminalScanAnalyze2: "Use the scan-analyze command with a depth of 3",
- TerminalConnect: "Using the telnet/connect command to connect to another server",
- TerminalAnalyze: "Use the analyze command to display details about this server",
- TerminalNuke: "Use the NUKE Program to gain root access to a server",
- TerminalManualHack: "Use the hack command to manually hack a server",
- TerminalHackingMechanics: "Briefly explain hacking mechanics",
- TerminalCreateScript: "Create a script using nano",
- TerminalTypeScript: "This occurs in the Script Editor page...type the script then save and close",
- TerminalFree: "Use the free command to check RAM",
- TerminalRunScript: "Use the run command to run a script",
- TerminalGoToActiveScriptsPage: "Go to the ActiveScriptsPage",
- ActiveScriptsPage: "Introduction to the Active Scripts Page",
- ActiveScriptsToTerminal: "Go from Active Scripts Page Back to Terminal",
- TerminalTailScript: "Use the tail command to show a script's logs",
- GoToHacknetNodesPage: "Go to the Hacknet Nodes page",
- HacknetNodesIntroduction: "Introduction to Hacknet Nodesm and have user purchase one",
- HacknetNodesGoToWorldPage: "Go to the world page",
- WorldDescription: "Tell the user to explore..theres a lot of different stuff to do out there",
- TutorialPageInfo: "The tutorial page contains a lot of info on different subjects",
- End: "End",
-}
-
-var currITutorialStep = iTutorialSteps.Start;
-var iTutorialIsRunning = false;
-
-function iTutorialStart() {
- //Don't autosave during this interactive tutorial
- __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].Counters.autoSaveCounter = 999000000000;
- console.log("Interactive Tutorial started");
- currITutorialStep = iTutorialSteps.Start;
- iTutorialIsRunning = true;
-
- document.getElementById("interactive-tutorial-container").style.display = "block";
-
- iTutorialEvaluateStep();
-
- //Exit tutorial button
- var exitButton = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-exit");
- exitButton.addEventListener("click", function() {
- iTutorialEnd();
- return false;
- });
-
- //Back button
- var backButton = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-back");
- backButton.style.display = "none";
- backButton.addEventListener("click", function() {
- iTutorialPrevStep();
- return false;
- });
-}
-
-function iTutorialEvaluateStep() {
- if (!iTutorialIsRunning) {console.log("Interactive Tutorial not running"); return;}
- switch(currITutorialStep) {
- case iTutorialSteps.Start:
- __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].loadTerminalContent();
-
- iTutorialSetText("Welcome to Bitburner, a cyberpunk-themed incremental RPG! " +
- "The game takes place in a dark, dystopian future...The year is 2077...
" +
- "This tutorial will show you the basics of the game. " +
- "You may skip the tutorial at any time.");
- var next = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
- next.style.display = "inline-block";
- next.addEventListener("click", function() {
- iTutorialNextStep();
- return false;
- });
- break;
- case iTutorialSteps.GoToCharacterPage:
- iTutorialSetText("Let's start by heading to the Stats page. Click the 'Stats' tab on " +
- "the main navigation menu (left-hand side of the screen)");
-
- //No next button
- var next = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
- next.style.display = "none";
-
- //Flash Character tab
- document.getElementById("stats-menu-link").setAttribute("class", "flashing-button");
-
- //Initialize everything necessary to open the "Character" page
- var charaterMainMenuButton = document.getElementById("stats-menu-link");
- charaterMainMenuButton.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].loadCharacterContent();
- iTutorialNextStep(); //Opening the character page will go to the next step
- Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("stats-menu-link");
- return false;
- });
- break;
- case iTutorialSteps.CharacterPage:
- iTutorialSetText("The Stats page shows a lot of important information about your progress, " +
- "such as your skills, money, and bonuses/multipliers. ")
- var next = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
- next.style.display = "inline-block";
- next.addEventListener("click", function() {
- iTutorialNextStep();
- return false;
- });
- break;
- case iTutorialSteps.CharacterGoToTerminalPage:
- iTutorialSetText("Let's head to your computer's terminal by clicking the 'Terminal' tab on the " +
- "main navigation menu.");
- //No next button
- var next = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
- next.style.display = "none";
-
- document.getElementById("terminal-menu-link").setAttribute("class", "flashing-button");
-
- //Initialize everything necessary to open the 'Terminal' Page
- var terminalMainMenuButton = document.getElementById("terminal-menu-link");
- terminalMainMenuButton.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].loadTerminalContent();
- iTutorialNextStep();
- Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("terminal-menu-link");
- return false;
- });
- break;
- case iTutorialSteps.TerminalIntro:
- iTutorialSetText("The Terminal is used to interface with your home computer as well as " +
- "all of the other machines around the world.");
- var next = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
- next.style.display = "inline-block";
- next.addEventListener("click", function() {
- iTutorialNextStep();
- return false;
- });
- break;
- case iTutorialSteps.TerminalHelp:
- iTutorialSetText("Let's try it out. Start by entering the 'help' command into the Terminal " +
- "(Don't forget to press Enter after typing the command)");
- var next = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
- next.style.display = "none";
- //next step triggered by terminal command
- break;
- case iTutorialSteps.TerminalLs:
- iTutorialSetText("The 'help' command displays a list of all available Terminal commands, how to use them, " +
- "and a description of what they do.
Let's try another command. Enter the 'ls' command");
- //next step triggered by terminal command
- break;
- case iTutorialSteps.TerminalScan:
- iTutorialSetText("'ls' is a basic command that shows all of the contents (programs/scripts) " +
- "on the computer. Right now, it shows that you have a program called 'NUKE.exe' on your computer. " +
- "We'll get to what this does later.
Using your home computer's terminal, you can connect " +
- "to other machines throughout the world. Let's do that now by first entering " +
- "the 'scan' command. ");
- //next step triggered by terminal command
- break;
- case iTutorialSteps.TerminalScanAnalyze1:
- iTutorialSetText("The 'scan' command shows all available network connections. In other words, " +
- "it displays a list of all servers that can be connected to from your " +
- "current machine. A server is identified by either its IP or its hostname.
" +
- "That's great and all, but there's so many servers. Which one should you go to? " +
- "The 'scan-analyze' command gives some more detailed information about servers on the " +
- "network. Try it now");
- //next step triggered by terminal command
- break;
- case iTutorialSteps.TerminalScanAnalyze2:
- iTutorialSetText("You just ran 'scan-analyze' with a depth of one. This command shows more detailed " +
- "information about each server that you can connect to (servers that are a distance of " +
- "one node away).
It is also possible to run 'scan-analyze' with " +
- "a higher depth. Let's try a depth of two with the following command: 'scan-analyze 2'.")
- //next step triggered by terminal command
- break;
- case iTutorialSteps.TerminalConnect:
- iTutorialSetText("Now you can see information about all servers that are up to two nodes away, as well " +
- "as figure out how to navigate to those servers through the network. You can only connect to " +
- "a server that is one node away. To connect to a machine, use the 'connect [ip/hostname]' command. You can type in " +
- "the ip or the hostname, but dont use both.
" +
- "From the results of the 'scan-analyze' command, we can see that the 'foodnstuff' server is " +
- "only one node away. Let's connect so it now using: 'connect foodnstuff'");
- //next step triggered by terminal command
- break;
- case iTutorialSteps.TerminalAnalyze:
- iTutorialSetText("You are now connected to another machine! What can you do now? You can hack it!
In the year 2077, currency has " +
- "become digital and decentralized. People and corporations store their money " +
- "on servers and computers. Using your hacking abilities, you can hack servers " +
- "to steal money and gain experience.
" +
- "Before you try to hack a server, you should run diagnostics using the 'analyze' command");
- //next step triggered by terminal command
- break;
- case iTutorialSteps.TerminalNuke:
- iTutorialSetText("When the 'analyze' command finishes running it will show useful information " +
- "about hacking the server.
For this server, the required hacking skill is only 1, " +
- "which means you can hack it right now. However, in order to hack a server " +
- "you must first gain root access. The 'NUKE.exe' program that we saw earlier on your " +
- "home computer is a virus that will grant you root access to a machine if there are enough " +
- "open ports.
The 'analyze' results shows that there do not need to be any open ports " +
- "on this machine for the NUKE virus to work, so go ahead and run the virus using the " +
- "'run NUKE.exe' command.");
- //next step triggered by terminal command
- break;
- case iTutorialSteps.TerminalManualHack:
- iTutorialSetText("You now have root access! You can hack the server using the 'hack' command. " +
- "Try doing that now.");
- //next step triggered by terminal command
- break;
- case iTutorialSteps.TerminalHackingMechanics:
- iTutorialSetText("You are now attempting to hack the server. Note that performing a hack takes time and " +
- "only has a certain percentage chance " +
- "of success. This time and success chance is determined by a variety of factors, including " +
- "your hacking skill and the server's security level.
" +
- "If your attempt to hack the server is successful, you will steal a certain percentage " +
- "of the server's total money. This percentage is affected by your hacking skill and " +
- "the server's security level.
The amount of money on a server is not limitless. So, if " +
- "you constantly hack a server and deplete its money, then you will encounter " +
- "diminishing returns in your hacking.");
- var next = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
- next.style.display = "inline-block";
- next.addEventListener("click", function() {
- iTutorialNextStep();
- return false;
- });
- break;
- case iTutorialSteps.TerminalCreateScript:
- iTutorialSetText("Hacking is the core mechanic of the game and is necessary for progressing. However, " +
- "you don't want to be hacking manually the entire time. You can automate your hacking " +
- "by writing scripts!
To create a new script or edit an existing one, you can use the 'nano' " +
- "command. Scripts must end with the '.script' extension. Let's make a script now by " +
- "entering 'nano foodnstuff.script' after the hack command finishes running (Sidenote: Pressing ctrl + c" +
- " will end a command like hack early)");
- var next = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
- next.style.display = "none";
- //next step triggered by terminal command
- break;
- case iTutorialSteps.TerminalTypeScript:
- iTutorialSetText("This is the script editor. You can use it to program your scripts. Scripts are " +
- "written in the Netscript language, a programming language created for " +
- "this game. There are details about the Netscript language in the documentation, which " +
- "can be accessed in the 'Tutorial' tab on the main navigation menu. I highly suggest you check " +
- "it out after this tutorial. For now, just copy " +
- "and paste the following code into the script editor:
" +
- "while(true) {
" +
- " hack('foodnstuff');
" +
- "}
" +
- "For anyone with basic programming experience, this code should be straightforward. " +
- "This script will continuously hack the 'foodnstuff' server.
" +
- "To save and close the script editor, press the button in the bottom left, or press ctrl + b.");
- //next step triggered in saveAndCloseScriptEditor() (Script.js)
- break;
- case iTutorialSteps.TerminalFree:
- iTutorialSetText("Now we'll run the script. Scripts require a certain amount of RAM to run, and can be " +
- "run on any machine which you have root access to. Different servers have different " +
- "amounts of RAM. You can also purchase more RAM for your home server.
To check how much " +
- "RAM is available on this machine, enter the 'free' command.");
- //next step triggered by terminal commmand
- break;
- case iTutorialSteps.TerminalRunScript:
- iTutorialSetText("We have 8GB of free RAM on this machine, which is enough to run our " +
- "script. Let's run our script using 'run foodnstuff.script'.");
- //next step triggered by terminal commmand
- break;
- case iTutorialSteps.TerminalGoToActiveScriptsPage:
- iTutorialSetText("Your script is now running! The script might take a few seconds to 'fully start up'. " +
- "Your scripts will continuously run in the background and will automatically stop if " +
- "the code ever completes (the 'foodnstuff.script' will never complete because it " +
- "runs an infinite loop).
These scripts can passively earn you income and hacking experience. " +
- "Your scripts will also earn money and experience while you are offline, although at a " +
- "much slower rate.
" +
- "Let's check out some statistics for our running scripts by clicking the " +
- "'Active Scripts' link in the main navigation menu.");
- document.getElementById("active-scripts-menu-link").setAttribute("class", "flashing-button");
- var activeScriptsMainMenuButton = document.getElementById("active-scripts-menu-link");
- activeScriptsMainMenuButton.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].loadActiveScriptsContent();
- iTutorialNextStep();
- Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("active-scripts-menu-link");
- return false;
- });
- break;
- case iTutorialSteps.ActiveScriptsPage:
- iTutorialSetText("This page displays stats/information about all of your scripts that are " +
- "running across every existing server. You can use this to gauge how well " +
- "your scripts are doing. Let's go back to the Terminal now using the 'Terminal'" +
- "link.");
- document.getElementById("terminal-menu-link").setAttribute("class", "flashing-button");
- //Initialize everything necessary to open the 'Terminal' Page
- var terminalMainMenuButton = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("terminal-menu-link");
- terminalMainMenuButton.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].loadTerminalContent();
- iTutorialNextStep();
- Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("terminal-menu-link");
- return false;
- });
- break;
- case iTutorialSteps.ActiveScriptsToTerminal:
- iTutorialSetText("One last thing about scripts, each active script contains logs that detail " +
- "what it's doing. We can check these logs using the 'tail' command. Do that " +
- "now for the script we just ran by typing 'tail foodnstuff.script'");
- //next step triggered by terminal command
- break;
- case iTutorialSteps.TerminalTailScript:
- iTutorialSetText("The log for this script won't show much right now (it might show nothing at all) because it " +
- "just started running...but check back again in a few minutes!
" +
- "This pretty much covers the basics of hacking. To learn more about writing " +
- "scripts using the Netscript language, select the 'Tutorial' link in the " +
- "main navigation menu to look at the documentation. For now, let's move on " +
- "to something else!");
- var next = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
- next.style.display = "inline-block";
- next.addEventListener("click", function() {
- iTutorialNextStep();
- return false;
- });
- break;
- case iTutorialSteps.GoToHacknetNodesPage:
- iTutorialSetText("Hacking is not the only way to earn money. One other way to passively " +
- "earn money is by purchasing and upgrading Hacknet Nodes. Let's go to " +
- "the 'Hacknet Nodes' page through the main navigation menu now.");
- document.getElementById("hacknet-nodes-menu-link").setAttribute("class", "flashing-button");
- var hacknetNodesButton = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("hacknet-nodes-menu-link");
- var next = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
- next.style.display = "none";
- hacknetNodesButton.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].loadHacknetNodesContent();
- iTutorialNextStep();
- Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("hacknet-nodes-menu-link");
- return false;
- });
- break;
- case iTutorialSteps.HacknetNodesIntroduction:
- iTutorialSetText("From this page you can purchase new Hacknet Nodes and upgrade your " +
- "existing ones. Let's purchase a new one now.");
- //Next step triggered by purchaseHacknet() (HacknetNode.js)
- break;
- case iTutorialSteps.HacknetNodesGoToWorldPage:
- iTutorialSetText("You just purchased a Hacknet Node! This Hacknet Node will passively " +
- "earn you money over time, both online and offline. When you get enough " +
- " money, you can upgrade " +
- "your newly-purchased Hacknet Node below.
" +
- "Let's go to the 'City' page through the main navigation menu.");
- document.getElementById("city-menu-link").setAttribute("class", "flashing-button");
- var worldButton = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("city-menu-link");
- worldButton.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].loadWorldContent();
- iTutorialNextStep();
- Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("city-menu-link");
- return false;
- });
- break;
- case iTutorialSteps.WorldDescription:
- iTutorialSetText("This page lists all of the different locations you can currently " +
- "travel to. Each location has something that you can do. " +
- "There's a lot of content out in the world, make sure " +
- "you explore and discover!
" +
- "Lastly, click on the 'Tutorial' link in the main navigation menu.");
- document.getElementById("tutorial-menu-link").setAttribute("class", "flashing-button");
- var tutorialButton = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("tutorial-menu-link");
- tutorialButton.addEventListener("click", function() {
- __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].loadTutorialContent();
- iTutorialNextStep();
- Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("tutorial-menu-link");
- return false;
- });
- break;
-
- case iTutorialSteps.TutorialPageInfo:
- iTutorialSetText("This page contains a lot of different documentation about the game's " +
- "content and mechanics. I know it's a lot, but I highly suggest you read " +
- "(or at least skim) through this before you start playing. That's the end of the tutorial. " +
- "Hope you enjoy the game!");
- var next = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
- next.style.display = "inline-block";
- next.innerHTML = "Finish Tutorial";
-
- var backButton = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-back");
- backButton.style.display = "none";
-
- next.addEventListener("click", function() {
- iTutorialNextStep();
- return false;
- });
- break;
- case iTutorialSteps.End:
- iTutorialEnd();
- break;
- default:
- throw new Error("Invalid tutorial step");
- }
-}
-
-//Go to the next step and evaluate it
-function iTutorialNextStep() {
- switch(currITutorialStep) {
- case iTutorialSteps.Start:
- currITutorialStep = iTutorialSteps.GoToCharacterPage;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.GoToCharacterPage:
- document.getElementById("stats-menu-link").removeAttribute("class");
- currITutorialStep = iTutorialSteps.CharacterPage;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.CharacterPage:
- currITutorialStep = iTutorialSteps.CharacterGoToTerminalPage;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.CharacterGoToTerminalPage:
- document.getElementById("terminal-menu-link").removeAttribute("class");
- currITutorialStep = iTutorialSteps.TerminalIntro;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalIntro:
- currITutorialStep = iTutorialSteps.TerminalHelp;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalHelp:
- currITutorialStep = iTutorialSteps.TerminalLs;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalLs:
- currITutorialStep = iTutorialSteps.TerminalScan;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalScan:
- currITutorialStep = iTutorialSteps.TerminalScanAnalyze1;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalScanAnalyze1:
- currITutorialStep = iTutorialSteps.TerminalScanAnalyze2;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalScanAnalyze2:
- currITutorialStep = iTutorialSteps.TerminalConnect;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalConnect:
- currITutorialStep = iTutorialSteps.TerminalAnalyze;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalAnalyze:
- currITutorialStep = iTutorialSteps.TerminalNuke;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalNuke:
- currITutorialStep = iTutorialSteps.TerminalManualHack;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalManualHack:
- currITutorialStep = iTutorialSteps.TerminalHackingMechanics;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalHackingMechanics:
- currITutorialStep = iTutorialSteps.TerminalCreateScript;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalCreateScript:
- currITutorialStep = iTutorialSteps.TerminalTypeScript;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalTypeScript:
- currITutorialStep = iTutorialSteps.TerminalFree;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalFree:
- currITutorialStep = iTutorialSteps.TerminalRunScript;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalRunScript:
- currITutorialStep = iTutorialSteps.TerminalGoToActiveScriptsPage;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalGoToActiveScriptsPage:
- document.getElementById("active-scripts-menu-link").removeAttribute("class");
- currITutorialStep = iTutorialSteps.ActiveScriptsPage;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.ActiveScriptsPage:
- document.getElementById("terminal-menu-link").removeAttribute("class");
- currITutorialStep = iTutorialSteps.ActiveScriptsToTerminal;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.ActiveScriptsToTerminal:
- currITutorialStep = iTutorialSteps.TerminalTailScript;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalTailScript:
- currITutorialStep = iTutorialSteps.GoToHacknetNodesPage;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.GoToHacknetNodesPage:
- document.getElementById("hacknet-nodes-menu-link").removeAttribute("class");
- currITutorialStep = iTutorialSteps.HacknetNodesIntroduction;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.HacknetNodesIntroduction:
- currITutorialStep = iTutorialSteps.HacknetNodesGoToWorldPage;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.HacknetNodesGoToWorldPage:
- document.getElementById("city-menu-link").removeAttribute("class");
- currITutorialStep = iTutorialSteps.WorldDescription;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.WorldDescription:
- document.getElementById("tutorial-menu-link").removeAttribute("class");
- currITutorialStep = iTutorialSteps.TutorialPageInfo;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TutorialPageInfo:
- currITutorialStep = iTutorialSteps.End;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.End:
- break;
- default:
- throw new Error("Invalid tutorial step");
- }
-}
-
-//Go to previous step and evaluate
-function iTutorialPrevStep() {
- switch(currITutorialStep) {
- case iTutorialSteps.Start:
- currITutorialStep = iTutorialSteps.Start;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.GoToCharacterPage:
- currITutorialStep = iTutorialSteps.Start;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.CharacterPage:
- currITutorialStep = iTutorialSteps.GoToCharacterPage;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.CharacterGoToTerminalPage:
- currITutorialStep = iTutorialSteps.CharacterPage;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalIntro:
- currITutorialStep = iTutorialSteps.CharacterGoToTerminalPage;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalHelp:
- currITutorialStep = iTutorialSteps.TerminalIntro;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalLs:
- currITutorialStep = iTutorialSteps.TerminalHelp;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalScan:
- currITutorialStep = iTutorialSteps.TerminalLs;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalConnect:
- currITutorialStep = iTutorialSteps.TerminalScan;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalAnalyze:
- currITutorialStep = iTutorialSteps.TerminalConnect;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalNuke:
- currITutorialStep = iTutorialSteps.TerminalAnalyze;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalManualHack:
- currITutorialStep = iTutorialSteps.TerminalNuke;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalHackingMechanics:
- currITutorialStep = iTutorialSteps.TerminalManualHack;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalCreateScript:
- currITutorialStep = iTutorialSteps.TerminalManualHack;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalTypeScript:
- currITutorialStep = iTutorialSteps.TerminalCreateScript;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalFree:
- currITutorialStep = iTutorialSteps.TerminalTypeScript;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalRunScript:
- currITutorialStep = iTutorialSteps.TerminalFree;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalGoToActiveScriptsPage:
- currITutorialStep = iTutorialSteps.TerminalRunScript;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.ActiveScriptsPage:
- currITutorialStep = iTutorialSteps.TerminalGoToActiveScriptsPage;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.ActiveScriptsToTerminal:
- currITutorialStep = iTutorialSteps.ActiveScriptsPage;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TerminalTailScript:
- currITutorialStep = iTutorialSteps.ActiveScriptsToTerminal;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.GoToHacknetNodesPage:
- currITutorialStep = iTutorialSteps.TerminalTailScript;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.HacknetNodesIntroduction:
- currITutorialStep = iTutorialSteps.GoToHacknetNodesPage;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.HacknetNodesGoToWorldPage:
- currITutorialStep = iTutorialSteps.HacknetNodesIntroduction;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.WorldDescription:
- currITutorialStep = iTutorialSteps.HacknetNodesGoToWorldPage;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.TutorialPageInfo:
- currITutorialStep = iTutorialSteps.WorldDescription;
- iTutorialEvaluateStep();
- break;
- case iTutorialSteps.End:
- break;
- default:
- throw new Error("Invalid tutorial step");
- }
-}
-
-function iTutorialEnd() {
- //Re-enable auto save
- __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].Counters.autoSaveCounter = 300;
- console.log("Ending interactive tutorial");
- __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].init();
- currITutorialStep = iTutorialSteps.End;
- iTutorialIsRunning = false;
- document.getElementById("interactive-tutorial-container").style.display = "none";
- Object(__WEBPACK_IMPORTED_MODULE_1__utils_DialogBox_js__["a" /* dialogBoxCreate */])("If you are new to the game, the following links may be useful for you!
" +
- "Getting Started Guide" +
- "Wiki");
-}
-
-function iTutorialSetText(txt) {
- var textBox = document.getElementById("interactive-tutorial-text");
- if (textBox == null) {throw new Error("Could not find text box"); return;}
- textBox.innerHTML = txt;
- textBox.parentElement.scrollTop = 0; // this resets scroll position
-}
-
-
-
-
-/***/ }),
-/* 28 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;/*! decimal.js v7.2.3 https://github.com/MikeMcl/decimal.js/LICENCE */
@@ -36477,6 +34114,2689 @@ var __WEBPACK_AMD_DEFINE_RESULT__;/*! decimal.js v7.2.3 https://github.com/MikeM
})(this);
+/***/ }),
+/* 25 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return Messages; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return checkForMessagesToSend; });
+/* unused harmony export sendMessage */
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return showMessage; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return loadMessages; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return initMessages; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Message; });
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__ = __webpack_require__(20);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__CreateProgram_js__ = __webpack_require__(15);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Missions_js__ = __webpack_require__(28);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Player_js__ = __webpack_require__(0);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__RedPill_js__ = __webpack_require__(34);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Server_js__ = __webpack_require__(6);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Settings_js__ = __webpack_require__(16);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_DialogBox_js__ = __webpack_require__(1);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__ = __webpack_require__(7);
+
+
+
+
+
+
+
+
+
+
+/* Message.js */
+function Message(filename="", msg="") {
+ this.filename = filename;
+ this.msg = msg;
+ this.recvd = false;
+}
+
+Message.prototype.toJSON = function() {
+ return Object(__WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__["b" /* Generic_toJSON */])("Message", this);
+}
+
+
+Message.fromJSON = function(value) {
+ return Object(__WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(Message, value.data);
+}
+
+__WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__["c" /* Reviver */].constructors.Message = Message;
+
+//Sends message to player, including a pop up
+function sendMessage(msg, forced=false) {
+ console.log("sending message: " + msg.filename);
+ msg.recvd = true;
+ if (forced || !__WEBPACK_IMPORTED_MODULE_6__Settings_js__["a" /* Settings */].SuppressMessages) {
+ showMessage(msg);
+ }
+ addMessageToServer(msg, "home");
+}
+
+function showMessage(msg) {
+ var txt = "Message received from unknown sender:
" +
+ "" + msg.msg + "
" +
+ "This message was saved as " + msg.filename + " onto your home computer.";
+ Object(__WEBPACK_IMPORTED_MODULE_7__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);
+}
+
+//Adds a message to a server
+function addMessageToServer(msg, serverHostname) {
+ var server = Object(__WEBPACK_IMPORTED_MODULE_5__Server_js__["c" /* GetServerByHostname */])(serverHostname);
+ if (server == null) {
+ console.log("WARNING: Did not locate " + serverHostname);
+ return;
+ }
+ for (var i = 0; i < server.messages.length; ++i) {
+ if (server.messages[i].filename === msg.filename) {
+ return; //Already exists
+ }
+ }
+ server.messages.push(msg);
+}
+
+//Checks if any of the 'timed' messages should be sent
+function checkForMessagesToSend() {
+ var jumper0 = Messages[MessageFilenames.Jumper0];
+ var jumper1 = Messages[MessageFilenames.Jumper1];
+ var jumper2 = Messages[MessageFilenames.Jumper2];
+ var jumper3 = Messages[MessageFilenames.Jumper3];
+ var jumper4 = Messages[MessageFilenames.Jumper4];
+ var cybersecTest = Messages[MessageFilenames.CyberSecTest];
+ var nitesecTest = Messages[MessageFilenames.NiteSecTest];
+ var bitrunnersTest = Messages[MessageFilenames.BitRunnersTest];
+ var redpill = Messages[MessageFilenames.RedPill];
+
+ var redpillOwned = false;
+ if (__WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["c" /* Augmentations */][__WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["b" /* AugmentationNames */].TheRedPill].owned) {
+ redpillOwned = true;
+ }
+
+ if (redpill && redpillOwned && __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].sourceFiles.length === 0 && !__WEBPACK_IMPORTED_MODULE_4__RedPill_js__["b" /* redPillFlag */] && !__WEBPACK_IMPORTED_MODULE_2__Missions_js__["c" /* inMission */]) {
+ if (!__WEBPACK_IMPORTED_MODULE_7__utils_DialogBox_js__["b" /* dialogBoxOpened */]) {
+ sendMessage(redpill, true);
+ }
+ } else if (redpill && redpillOwned) {
+ //If player has already destroyed a BitNode, message is not forced
+ if (!__WEBPACK_IMPORTED_MODULE_4__RedPill_js__["b" /* redPillFlag */] && !__WEBPACK_IMPORTED_MODULE_2__Missions_js__["c" /* inMission */] && !__WEBPACK_IMPORTED_MODULE_7__utils_DialogBox_js__["b" /* dialogBoxOpened */]) {
+ sendMessage(redpill);
+ }
+ } else if (jumper0 && !jumper0.recvd && __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill >= 25) {
+ sendMessage(jumper0);
+ __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_1__CreateProgram_js__["a" /* Programs */].Flight);
+ } else if (jumper1 && !jumper1.recvd && __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill >= 40) {
+ sendMessage(jumper1);
+ } else if (cybersecTest && !cybersecTest.recvd && __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill >= 50) {
+ sendMessage(cybersecTest);
+ } else if (jumper2 && !jumper2.recvd && __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill >= 175) {
+ sendMessage(jumper2);
+ } else if (nitesecTest && !nitesecTest.recvd && __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill >= 200) {
+ sendMessage(nitesecTest);
+ } else if (jumper3 && !jumper3.recvd && __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill >= 350) {
+ sendMessage(jumper3);
+ } else if (jumper4 && !jumper4.recvd && __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill >= 490) {
+ sendMessage(jumper4);
+ } else if (bitrunnersTest && !bitrunnersTest.recvd && __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill >= 500) {
+ sendMessage(bitrunnersTest);
+ }
+}
+
+function AddToAllMessages(msg) {
+ Messages[msg.filename] = msg;
+}
+
+let Messages = {}
+
+function loadMessages(saveString) {
+ Messages = JSON.parse(saveString, __WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__["c" /* Reviver */]);
+}
+
+let MessageFilenames = {
+ Jumper0: "j0.msg",
+ Jumper1: "j1.msg",
+ Jumper2: "j2.msg",
+ Jumper3: "j3.msg",
+ Jumper4: "j4.msg",
+ CyberSecTest: "csec-test.msg",
+ NiteSecTest: "nitesec-test.msg",
+ BitRunnersTest: "19dfj3l1nd.msg",
+ RedPill: "icarus.msg",
+}
+
+function initMessages() {
+ //Reset
+ Messages = {};
+
+ //jump3R Messages
+ AddToAllMessages(new Message(MessageFilenames.Jumper0,
+ "I know you can sense it. I know you're searching for it. " +
+ "It's why you spend night after " +
+ "night at your computer.
It's real, I've seen it. And I can " +
+ "help you find it. But not right now. You're not ready yet.
" +
+ "Use this program to track your progress
" +
+ "The fl1ght.exe program was added to your home computer
" +
+ "-jump3R"));
+ AddToAllMessages(new Message(MessageFilenames.Jumper1,
+ "Soon you will be contacted by a hacking group known as CyberSec. " +
+ "They can help you with your search.
" +
+ "You should join them, garner their favor, and " +
+ "exploit them for their Augmentations. But do not trust them. " +
+ "They are not what they seem. No one is.
" +
+ "-jump3R"));
+ AddToAllMessages(new Message(MessageFilenames.Jumper2,
+ "Do not try to save the world. There is no world to save. If " +
+ "you want to find the truth, worry only about yourself. Ethics and " +
+ "morals will get you killed.
Watch out for a hacking group known as NiteSec." +
+ "
-jump3R"));
+ AddToAllMessages(new Message(MessageFilenames.Jumper3,
+ "You must learn to walk before you can run. And you must " +
+ "run before you can fly. Look for the black hand.
" +
+ "I.I.I.I
-jump3R"));
+ AddToAllMessages(new Message(MessageFilenames.Jumper4,
+ "To find what you are searching for, you must understand the bits. " +
+ "The bits are all around us. The runners will help you.
" +
+ "-jump3R"));
+
+ //Messages from hacking factions
+ AddToAllMessages(new Message(MessageFilenames.CyberSecTest,
+ "We've been watching you. Your skills are very impressive. But you're wasting " +
+ "your talents. If you join us, you can put your skills to good use and change " +
+ "the world for the better. If you join us, we can unlock your full potential.
" +
+ "But first, you must pass our test. Find and hack our server using the Terminal.
" +
+ "-CyberSec"));
+ AddToAllMessages(new Message(MessageFilenames.NiteSecTest,
+ "People say that the corrupted governments and corporations rule the world. " +
+ "Yes, maybe they do. But do you know who everyone really fears? People " +
+ "like us. Because they can't hide from us. Because they can't fight shadows " +
+ "and ideas with bullets.
" +
+ "Join us, and people will fear you, too.
" +
+ "Find and hack our hidden server using the Terminal. Then, we will contact you again." +
+ "
-NiteSec"));
+ AddToAllMessages(new Message(MessageFilenames.BitRunnersTest,
+ "We know what you are doing. We know what drives you. We know " +
+ "what you are looking for.
" +
+ "We can help you find the answers.
" +
+ "run4theh111z"));
+
+ AddToAllMessages(new Message(MessageFilenames.RedPill,
+ "@)(#V%*N)@(#*)*C)@#%*)*V)@#(*%V@)(#VN%*)@#(*%
" +
+ ")@B(*#%)@)M#B*%V)____FIND___#$@)#%(B*)@#(*%B)
" +
+ "@_#(%_@#M(BDSPOMB__THE-CAVE_#)$(*@#$)@#BNBEGB
" +
+ "DFLSMFVMV)#@($*)@#*$MV)@#(*$V)M#(*$)M@(#*VM$)"));
+}
+
+
+
+
+/***/ }),
+/* 26 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return setActiveScriptsClickHandlers; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return addActiveScriptsItem; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return deleteActiveScriptsItem; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return updateActiveScriptsItems; });
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__NetscriptWorker_js__ = __webpack_require__(10);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Player_js__ = __webpack_require__(0);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Server_js__ = __webpack_require__(6);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__ = __webpack_require__(1);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__ = __webpack_require__(2);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_LogBox_js__ = __webpack_require__(30);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js__ = __webpack_require__(17);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js__);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__ = __webpack_require__(4);
+
+
+
+
+
+
+
+
+
+
+/* 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(__WEBPACK_IMPORTED_MODULE_2__Server_js__["e" /* 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(workerscript.args[i].toString());
+ }
+ var itemName = itemNameArray.join("-");
+ //var itemName = "active-scripts-" + server.hostname + "-" + workerscript.name;
+ 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(__WEBPACK_IMPORTED_MODULE_2__Server_js__["e" /* 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(workerscript.args[i].toString());
+ }
+ var itemName = itemNameArray.join("-");
+ //var itemName = "active-scripts-" + server.hostname + "-" + workerscript.name;
+ 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 < __WEBPACK_IMPORTED_MODULE_0__NetscriptWorker_js__["h" /* workerScripts */].length; ++i) {
+ total += updateActiveScriptsItemContent(__WEBPACK_IMPORTED_MODULE_0__NetscriptWorker_js__["h" /* workerScripts */][i]);
+ }
+ document.getElementById("active-scripts-total-prod").innerHTML =
+ "Total online production of Active Scripts: " + __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(total).format('$0.000a') + " / sec
" +
+ "Total online production since last Aug installation: " +
+ __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].scriptProdSinceLastAug).format('$0.000a') + " (" +
+ __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].scriptProdSinceLastAug / (__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* 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(__WEBPACK_IMPORTED_MODULE_2__Server_js__["e" /* 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(workerscript.args[i].toString());
+ }
+ 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(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["j" /* 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(__WEBPACK_IMPORTED_MODULE_5__utils_LogBox_js__["a" /* logBoxCreate */])(workerscript.scriptRef);
+ return false;
+ });
+ killButton.addEventListener("click", function() {
+ Object(__WEBPACK_IMPORTED_MODULE_0__NetscriptWorker_js__["d" /* killWorkerScript */])(workerscript.scriptRef, workerscript.scriptRef.scriptRef.server);
+ Object(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* 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(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(workerscript.scriptRef.onlineMoneyMade, 2);
+ var onlineTotalExpEarned = (Array(26).join(" ") + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(workerscript.scriptRef.onlineExpGained, 2) + " hacking exp").replace( / /g, " ");
+
+ var onlineMps = workerscript.scriptRef.onlineMoneyMade / workerscript.scriptRef.onlineRunningTime;
+ var onlineMpsText = "Online production rate: $" + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(onlineMps, 2) + "/second";
+ var onlineEps = workerscript.scriptRef.onlineExpGained / workerscript.scriptRef.onlineRunningTime;
+ var onlineEpsText = (Array(25).join(" ") + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(onlineEps, 4) + " hacking exp/second").replace( / /g, " ");
+
+ //Offline
+ var offlineTotalMoneyMade = "Total offline production: $" + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(workerscript.scriptRef.offlineMoneyMade, 2);
+ var offlineTotalExpEarned = (Array(27).join(" ") + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(workerscript.scriptRef.offlineExpGained, 2) + " hacking exp").replace( / /g, " ");
+
+ var offlineMps = workerscript.scriptRef.offlineMoneyMade / workerscript.scriptRef.offlineRunningTime;
+ var offlineMpsText = "Offline production rate: $" + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(offlineMps, 2) + "/second";
+ var offlineEps = workerscript.scriptRef.offlineExpGained / workerscript.scriptRef.offlineRunningTime;
+ var offlineEpsText = (Array(26).join(" ") + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(offlineEps, 4) + " hacking exp/second").replace( / /g, " ");
+
+ itemTextStats.innerHTML = onlineTotalMoneyMade + "
" + onlineTotalExpEarned + "
" +
+ onlineMpsText + "
" + onlineEpsText + "
" + offlineTotalMoneyMade + "
" + offlineTotalExpEarned + "
" +
+ offlineMpsText + "
" + offlineEpsText + "
";
+ return onlineMps;
+}
+
+
+
+
+/***/ }),
+/* 27 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return iTutorialSteps; });
+/* unused harmony export iTutorialEnd */
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return iTutorialStart; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return iTutorialNextStep; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return currITutorialStep; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return iTutorialIsRunning; });
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__engine_js__ = __webpack_require__(5);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils_DialogBox_js__ = __webpack_require__(1);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__ = __webpack_require__(2);
+
+
+
+
+/* InteractiveTutorial.js */
+let iTutorialSteps = {
+ Start: "Start",
+ GoToCharacterPage: "Click on the Character page menu link",
+ CharacterPage: "Introduction to Character page",
+ CharacterGoToTerminalPage: "Click on the Terminal link",
+ TerminalIntro: "Introduction to terminal interface",
+ TerminalHelp: "Using the help command to display all options in terminal",
+ TerminalLs: "Use the ls command to show all programs/scripts. Right now we have NUKE.exe",
+ TerminalScan: "Using the scan command to display all available connections",
+ TerminalScanAnalyze1: "Use the scan-analyze command to show hacking related information",
+ TerminalScanAnalyze2: "Use the scan-analyze command with a depth of 3",
+ TerminalConnect: "Using the telnet/connect command to connect to another server",
+ TerminalAnalyze: "Use the analyze command to display details about this server",
+ TerminalNuke: "Use the NUKE Program to gain root access to a server",
+ TerminalManualHack: "Use the hack command to manually hack a server",
+ TerminalHackingMechanics: "Briefly explain hacking mechanics",
+ TerminalCreateScript: "Create a script using nano",
+ TerminalTypeScript: "This occurs in the Script Editor page...type the script then save and close",
+ TerminalFree: "Use the free command to check RAM",
+ TerminalRunScript: "Use the run command to run a script",
+ TerminalGoToActiveScriptsPage: "Go to the ActiveScriptsPage",
+ ActiveScriptsPage: "Introduction to the Active Scripts Page",
+ ActiveScriptsToTerminal: "Go from Active Scripts Page Back to Terminal",
+ TerminalTailScript: "Use the tail command to show a script's logs",
+ GoToHacknetNodesPage: "Go to the Hacknet Nodes page",
+ HacknetNodesIntroduction: "Introduction to Hacknet Nodesm and have user purchase one",
+ HacknetNodesGoToWorldPage: "Go to the world page",
+ WorldDescription: "Tell the user to explore..theres a lot of different stuff to do out there",
+ TutorialPageInfo: "The tutorial page contains a lot of info on different subjects",
+ End: "End",
+}
+
+var currITutorialStep = iTutorialSteps.Start;
+var iTutorialIsRunning = false;
+
+function iTutorialStart() {
+ //Don't autosave during this interactive tutorial
+ __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].Counters.autoSaveCounter = 999000000000;
+ console.log("Interactive Tutorial started");
+ currITutorialStep = iTutorialSteps.Start;
+ iTutorialIsRunning = true;
+
+ document.getElementById("interactive-tutorial-container").style.display = "block";
+
+ iTutorialEvaluateStep();
+
+ //Exit tutorial button
+ var exitButton = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-exit");
+ exitButton.addEventListener("click", function() {
+ iTutorialEnd();
+ return false;
+ });
+
+ //Back button
+ var backButton = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-back");
+ backButton.style.display = "none";
+ backButton.addEventListener("click", function() {
+ iTutorialPrevStep();
+ return false;
+ });
+}
+
+function iTutorialEvaluateStep() {
+ if (!iTutorialIsRunning) {console.log("Interactive Tutorial not running"); return;}
+ switch(currITutorialStep) {
+ case iTutorialSteps.Start:
+ __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].loadTerminalContent();
+
+ iTutorialSetText("Welcome to Bitburner, a cyberpunk-themed incremental RPG! " +
+ "The game takes place in a dark, dystopian future...The year is 2077...
" +
+ "This tutorial will show you the basics of the game. " +
+ "You may skip the tutorial at any time.");
+ var next = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
+ next.style.display = "inline-block";
+ next.addEventListener("click", function() {
+ iTutorialNextStep();
+ return false;
+ });
+ break;
+ case iTutorialSteps.GoToCharacterPage:
+ iTutorialSetText("Let's start by heading to the Stats page. Click the 'Stats' tab on " +
+ "the main navigation menu (left-hand side of the screen)");
+
+ //No next button
+ var next = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
+ next.style.display = "none";
+
+ //Flash Character tab
+ document.getElementById("stats-menu-link").setAttribute("class", "flashing-button");
+
+ //Initialize everything necessary to open the "Character" page
+ var charaterMainMenuButton = document.getElementById("stats-menu-link");
+ charaterMainMenuButton.addEventListener("click", function() {
+ __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].loadCharacterContent();
+ iTutorialNextStep(); //Opening the character page will go to the next step
+ Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("stats-menu-link");
+ return false;
+ });
+ break;
+ case iTutorialSteps.CharacterPage:
+ iTutorialSetText("The Stats page shows a lot of important information about your progress, " +
+ "such as your skills, money, and bonuses/multipliers. ")
+ var next = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
+ next.style.display = "inline-block";
+ next.addEventListener("click", function() {
+ iTutorialNextStep();
+ return false;
+ });
+ break;
+ case iTutorialSteps.CharacterGoToTerminalPage:
+ iTutorialSetText("Let's head to your computer's terminal by clicking the 'Terminal' tab on the " +
+ "main navigation menu.");
+ //No next button
+ var next = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
+ next.style.display = "none";
+
+ document.getElementById("terminal-menu-link").setAttribute("class", "flashing-button");
+
+ //Initialize everything necessary to open the 'Terminal' Page
+ var terminalMainMenuButton = document.getElementById("terminal-menu-link");
+ terminalMainMenuButton.addEventListener("click", function() {
+ __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].loadTerminalContent();
+ iTutorialNextStep();
+ Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("terminal-menu-link");
+ return false;
+ });
+ break;
+ case iTutorialSteps.TerminalIntro:
+ iTutorialSetText("The Terminal is used to interface with your home computer as well as " +
+ "all of the other machines around the world.");
+ var next = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
+ next.style.display = "inline-block";
+ next.addEventListener("click", function() {
+ iTutorialNextStep();
+ return false;
+ });
+ break;
+ case iTutorialSteps.TerminalHelp:
+ iTutorialSetText("Let's try it out. Start by entering the 'help' command into the Terminal " +
+ "(Don't forget to press Enter after typing the command)");
+ var next = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
+ next.style.display = "none";
+ //next step triggered by terminal command
+ break;
+ case iTutorialSteps.TerminalLs:
+ iTutorialSetText("The 'help' command displays a list of all available Terminal commands, how to use them, " +
+ "and a description of what they do.
Let's try another command. Enter the 'ls' command");
+ //next step triggered by terminal command
+ break;
+ case iTutorialSteps.TerminalScan:
+ iTutorialSetText("'ls' is a basic command that shows all of the contents (programs/scripts) " +
+ "on the computer. Right now, it shows that you have a program called 'NUKE.exe' on your computer. " +
+ "We'll get to what this does later.
Using your home computer's terminal, you can connect " +
+ "to other machines throughout the world. Let's do that now by first entering " +
+ "the 'scan' command. ");
+ //next step triggered by terminal command
+ break;
+ case iTutorialSteps.TerminalScanAnalyze1:
+ iTutorialSetText("The 'scan' command shows all available network connections. In other words, " +
+ "it displays a list of all servers that can be connected to from your " +
+ "current machine. A server is identified by either its IP or its hostname.
" +
+ "That's great and all, but there's so many servers. Which one should you go to? " +
+ "The 'scan-analyze' command gives some more detailed information about servers on the " +
+ "network. Try it now");
+ //next step triggered by terminal command
+ break;
+ case iTutorialSteps.TerminalScanAnalyze2:
+ iTutorialSetText("You just ran 'scan-analyze' with a depth of one. This command shows more detailed " +
+ "information about each server that you can connect to (servers that are a distance of " +
+ "one node away).
It is also possible to run 'scan-analyze' with " +
+ "a higher depth. Let's try a depth of two with the following command: 'scan-analyze 2'.")
+ //next step triggered by terminal command
+ break;
+ case iTutorialSteps.TerminalConnect:
+ iTutorialSetText("Now you can see information about all servers that are up to two nodes away, as well " +
+ "as figure out how to navigate to those servers through the network. You can only connect to " +
+ "a server that is one node away. To connect to a machine, use the 'connect [ip/hostname]' command. You can type in " +
+ "the ip or the hostname, but dont use both.
" +
+ "From the results of the 'scan-analyze' command, we can see that the 'foodnstuff' server is " +
+ "only one node away. Let's connect so it now using: 'connect foodnstuff'");
+ //next step triggered by terminal command
+ break;
+ case iTutorialSteps.TerminalAnalyze:
+ iTutorialSetText("You are now connected to another machine! What can you do now? You can hack it!
In the year 2077, currency has " +
+ "become digital and decentralized. People and corporations store their money " +
+ "on servers and computers. Using your hacking abilities, you can hack servers " +
+ "to steal money and gain experience.
" +
+ "Before you try to hack a server, you should run diagnostics using the 'analyze' command");
+ //next step triggered by terminal command
+ break;
+ case iTutorialSteps.TerminalNuke:
+ iTutorialSetText("When the 'analyze' command finishes running it will show useful information " +
+ "about hacking the server.
For this server, the required hacking skill is only 1, " +
+ "which means you can hack it right now. However, in order to hack a server " +
+ "you must first gain root access. The 'NUKE.exe' program that we saw earlier on your " +
+ "home computer is a virus that will grant you root access to a machine if there are enough " +
+ "open ports.
The 'analyze' results shows that there do not need to be any open ports " +
+ "on this machine for the NUKE virus to work, so go ahead and run the virus using the " +
+ "'run NUKE.exe' command.");
+ //next step triggered by terminal command
+ break;
+ case iTutorialSteps.TerminalManualHack:
+ iTutorialSetText("You now have root access! You can hack the server using the 'hack' command. " +
+ "Try doing that now.");
+ //next step triggered by terminal command
+ break;
+ case iTutorialSteps.TerminalHackingMechanics:
+ iTutorialSetText("You are now attempting to hack the server. Note that performing a hack takes time and " +
+ "only has a certain percentage chance " +
+ "of success. This time and success chance is determined by a variety of factors, including " +
+ "your hacking skill and the server's security level.
" +
+ "If your attempt to hack the server is successful, you will steal a certain percentage " +
+ "of the server's total money. This percentage is affected by your hacking skill and " +
+ "the server's security level.
The amount of money on a server is not limitless. So, if " +
+ "you constantly hack a server and deplete its money, then you will encounter " +
+ "diminishing returns in your hacking.");
+ var next = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
+ next.style.display = "inline-block";
+ next.addEventListener("click", function() {
+ iTutorialNextStep();
+ return false;
+ });
+ break;
+ case iTutorialSteps.TerminalCreateScript:
+ iTutorialSetText("Hacking is the core mechanic of the game and is necessary for progressing. However, " +
+ "you don't want to be hacking manually the entire time. You can automate your hacking " +
+ "by writing scripts!
To create a new script or edit an existing one, you can use the 'nano' " +
+ "command. Scripts must end with the '.script' extension. Let's make a script now by " +
+ "entering 'nano foodnstuff.script' after the hack command finishes running (Sidenote: Pressing ctrl + c" +
+ " will end a command like hack early)");
+ var next = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
+ next.style.display = "none";
+ //next step triggered by terminal command
+ break;
+ case iTutorialSteps.TerminalTypeScript:
+ iTutorialSetText("This is the script editor. You can use it to program your scripts. Scripts are " +
+ "written in the Netscript language, a programming language created for " +
+ "this game. There are details about the Netscript language in the documentation, which " +
+ "can be accessed in the 'Tutorial' tab on the main navigation menu. I highly suggest you check " +
+ "it out after this tutorial. For now, just copy " +
+ "and paste the following code into the script editor:
" +
+ "while(true) {
" +
+ " hack('foodnstuff');
" +
+ "}
" +
+ "For anyone with basic programming experience, this code should be straightforward. " +
+ "This script will continuously hack the 'foodnstuff' server.
" +
+ "To save and close the script editor, press the button in the bottom left, or press ctrl + b.");
+ //next step triggered in saveAndCloseScriptEditor() (Script.js)
+ break;
+ case iTutorialSteps.TerminalFree:
+ iTutorialSetText("Now we'll run the script. Scripts require a certain amount of RAM to run, and can be " +
+ "run on any machine which you have root access to. Different servers have different " +
+ "amounts of RAM. You can also purchase more RAM for your home server.
To check how much " +
+ "RAM is available on this machine, enter the 'free' command.");
+ //next step triggered by terminal commmand
+ break;
+ case iTutorialSteps.TerminalRunScript:
+ iTutorialSetText("We have 8GB of free RAM on this machine, which is enough to run our " +
+ "script. Let's run our script using 'run foodnstuff.script'.");
+ //next step triggered by terminal commmand
+ break;
+ case iTutorialSteps.TerminalGoToActiveScriptsPage:
+ iTutorialSetText("Your script is now running! The script might take a few seconds to 'fully start up'. " +
+ "Your scripts will continuously run in the background and will automatically stop if " +
+ "the code ever completes (the 'foodnstuff.script' will never complete because it " +
+ "runs an infinite loop).
These scripts can passively earn you income and hacking experience. " +
+ "Your scripts will also earn money and experience while you are offline, although at a " +
+ "much slower rate.
" +
+ "Let's check out some statistics for our running scripts by clicking the " +
+ "'Active Scripts' link in the main navigation menu.");
+ document.getElementById("active-scripts-menu-link").setAttribute("class", "flashing-button");
+ var activeScriptsMainMenuButton = document.getElementById("active-scripts-menu-link");
+ activeScriptsMainMenuButton.addEventListener("click", function() {
+ __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].loadActiveScriptsContent();
+ iTutorialNextStep();
+ Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("active-scripts-menu-link");
+ return false;
+ });
+ break;
+ case iTutorialSteps.ActiveScriptsPage:
+ iTutorialSetText("This page displays stats/information about all of your scripts that are " +
+ "running across every existing server. You can use this to gauge how well " +
+ "your scripts are doing. Let's go back to the Terminal now using the 'Terminal'" +
+ "link.");
+ document.getElementById("terminal-menu-link").setAttribute("class", "flashing-button");
+ //Initialize everything necessary to open the 'Terminal' Page
+ var terminalMainMenuButton = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("terminal-menu-link");
+ terminalMainMenuButton.addEventListener("click", function() {
+ __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].loadTerminalContent();
+ iTutorialNextStep();
+ Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("terminal-menu-link");
+ return false;
+ });
+ break;
+ case iTutorialSteps.ActiveScriptsToTerminal:
+ iTutorialSetText("One last thing about scripts, each active script contains logs that detail " +
+ "what it's doing. We can check these logs using the 'tail' command. Do that " +
+ "now for the script we just ran by typing 'tail foodnstuff.script'");
+ //next step triggered by terminal command
+ break;
+ case iTutorialSteps.TerminalTailScript:
+ iTutorialSetText("The log for this script won't show much right now (it might show nothing at all) because it " +
+ "just started running...but check back again in a few minutes!
" +
+ "This pretty much covers the basics of hacking. To learn more about writing " +
+ "scripts using the Netscript language, select the 'Tutorial' link in the " +
+ "main navigation menu to look at the documentation. For now, let's move on " +
+ "to something else!");
+ var next = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
+ next.style.display = "inline-block";
+ next.addEventListener("click", function() {
+ iTutorialNextStep();
+ return false;
+ });
+ break;
+ case iTutorialSteps.GoToHacknetNodesPage:
+ iTutorialSetText("Hacking is not the only way to earn money. One other way to passively " +
+ "earn money is by purchasing and upgrading Hacknet Nodes. Let's go to " +
+ "the 'Hacknet Nodes' page through the main navigation menu now.");
+ document.getElementById("hacknet-nodes-menu-link").setAttribute("class", "flashing-button");
+ var hacknetNodesButton = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("hacknet-nodes-menu-link");
+ var next = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
+ next.style.display = "none";
+ hacknetNodesButton.addEventListener("click", function() {
+ __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].loadHacknetNodesContent();
+ iTutorialNextStep();
+ Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("hacknet-nodes-menu-link");
+ return false;
+ });
+ break;
+ case iTutorialSteps.HacknetNodesIntroduction:
+ iTutorialSetText("From this page you can purchase new Hacknet Nodes and upgrade your " +
+ "existing ones. Let's purchase a new one now.");
+ //Next step triggered by purchaseHacknet() (HacknetNode.js)
+ break;
+ case iTutorialSteps.HacknetNodesGoToWorldPage:
+ iTutorialSetText("You just purchased a Hacknet Node! This Hacknet Node will passively " +
+ "earn you money over time, both online and offline. When you get enough " +
+ " money, you can upgrade " +
+ "your newly-purchased Hacknet Node below.
" +
+ "Let's go to the 'City' page through the main navigation menu.");
+ document.getElementById("city-menu-link").setAttribute("class", "flashing-button");
+ var worldButton = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("city-menu-link");
+ worldButton.addEventListener("click", function() {
+ __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].loadWorldContent();
+ iTutorialNextStep();
+ Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("city-menu-link");
+ return false;
+ });
+ break;
+ case iTutorialSteps.WorldDescription:
+ iTutorialSetText("This page lists all of the different locations you can currently " +
+ "travel to. Each location has something that you can do. " +
+ "There's a lot of content out in the world, make sure " +
+ "you explore and discover!
" +
+ "Lastly, click on the 'Tutorial' link in the main navigation menu.");
+ document.getElementById("tutorial-menu-link").setAttribute("class", "flashing-button");
+ var tutorialButton = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("tutorial-menu-link");
+ tutorialButton.addEventListener("click", function() {
+ __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].loadTutorialContent();
+ iTutorialNextStep();
+ Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("tutorial-menu-link");
+ return false;
+ });
+ break;
+
+ case iTutorialSteps.TutorialPageInfo:
+ iTutorialSetText("This page contains a lot of different documentation about the game's " +
+ "content and mechanics. I know it's a lot, but I highly suggest you read " +
+ "(or at least skim) through this before you start playing. That's the end of the tutorial. " +
+ "Hope you enjoy the game!");
+ var next = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-next");
+ next.style.display = "inline-block";
+ next.innerHTML = "Finish Tutorial";
+
+ var backButton = Object(__WEBPACK_IMPORTED_MODULE_2__utils_HelperFunctions_js__["b" /* clearEventListeners */])("interactive-tutorial-back");
+ backButton.style.display = "none";
+
+ next.addEventListener("click", function() {
+ iTutorialNextStep();
+ return false;
+ });
+ break;
+ case iTutorialSteps.End:
+ iTutorialEnd();
+ break;
+ default:
+ throw new Error("Invalid tutorial step");
+ }
+}
+
+//Go to the next step and evaluate it
+function iTutorialNextStep() {
+ switch(currITutorialStep) {
+ case iTutorialSteps.Start:
+ currITutorialStep = iTutorialSteps.GoToCharacterPage;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.GoToCharacterPage:
+ document.getElementById("stats-menu-link").removeAttribute("class");
+ currITutorialStep = iTutorialSteps.CharacterPage;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.CharacterPage:
+ currITutorialStep = iTutorialSteps.CharacterGoToTerminalPage;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.CharacterGoToTerminalPage:
+ document.getElementById("terminal-menu-link").removeAttribute("class");
+ currITutorialStep = iTutorialSteps.TerminalIntro;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalIntro:
+ currITutorialStep = iTutorialSteps.TerminalHelp;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalHelp:
+ currITutorialStep = iTutorialSteps.TerminalLs;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalLs:
+ currITutorialStep = iTutorialSteps.TerminalScan;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalScan:
+ currITutorialStep = iTutorialSteps.TerminalScanAnalyze1;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalScanAnalyze1:
+ currITutorialStep = iTutorialSteps.TerminalScanAnalyze2;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalScanAnalyze2:
+ currITutorialStep = iTutorialSteps.TerminalConnect;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalConnect:
+ currITutorialStep = iTutorialSteps.TerminalAnalyze;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalAnalyze:
+ currITutorialStep = iTutorialSteps.TerminalNuke;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalNuke:
+ currITutorialStep = iTutorialSteps.TerminalManualHack;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalManualHack:
+ currITutorialStep = iTutorialSteps.TerminalHackingMechanics;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalHackingMechanics:
+ currITutorialStep = iTutorialSteps.TerminalCreateScript;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalCreateScript:
+ currITutorialStep = iTutorialSteps.TerminalTypeScript;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalTypeScript:
+ currITutorialStep = iTutorialSteps.TerminalFree;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalFree:
+ currITutorialStep = iTutorialSteps.TerminalRunScript;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalRunScript:
+ currITutorialStep = iTutorialSteps.TerminalGoToActiveScriptsPage;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalGoToActiveScriptsPage:
+ document.getElementById("active-scripts-menu-link").removeAttribute("class");
+ currITutorialStep = iTutorialSteps.ActiveScriptsPage;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.ActiveScriptsPage:
+ document.getElementById("terminal-menu-link").removeAttribute("class");
+ currITutorialStep = iTutorialSteps.ActiveScriptsToTerminal;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.ActiveScriptsToTerminal:
+ currITutorialStep = iTutorialSteps.TerminalTailScript;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalTailScript:
+ currITutorialStep = iTutorialSteps.GoToHacknetNodesPage;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.GoToHacknetNodesPage:
+ document.getElementById("hacknet-nodes-menu-link").removeAttribute("class");
+ currITutorialStep = iTutorialSteps.HacknetNodesIntroduction;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.HacknetNodesIntroduction:
+ currITutorialStep = iTutorialSteps.HacknetNodesGoToWorldPage;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.HacknetNodesGoToWorldPage:
+ document.getElementById("city-menu-link").removeAttribute("class");
+ currITutorialStep = iTutorialSteps.WorldDescription;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.WorldDescription:
+ document.getElementById("tutorial-menu-link").removeAttribute("class");
+ currITutorialStep = iTutorialSteps.TutorialPageInfo;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TutorialPageInfo:
+ currITutorialStep = iTutorialSteps.End;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.End:
+ break;
+ default:
+ throw new Error("Invalid tutorial step");
+ }
+}
+
+//Go to previous step and evaluate
+function iTutorialPrevStep() {
+ switch(currITutorialStep) {
+ case iTutorialSteps.Start:
+ currITutorialStep = iTutorialSteps.Start;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.GoToCharacterPage:
+ currITutorialStep = iTutorialSteps.Start;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.CharacterPage:
+ currITutorialStep = iTutorialSteps.GoToCharacterPage;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.CharacterGoToTerminalPage:
+ currITutorialStep = iTutorialSteps.CharacterPage;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalIntro:
+ currITutorialStep = iTutorialSteps.CharacterGoToTerminalPage;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalHelp:
+ currITutorialStep = iTutorialSteps.TerminalIntro;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalLs:
+ currITutorialStep = iTutorialSteps.TerminalHelp;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalScan:
+ currITutorialStep = iTutorialSteps.TerminalLs;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalConnect:
+ currITutorialStep = iTutorialSteps.TerminalScan;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalAnalyze:
+ currITutorialStep = iTutorialSteps.TerminalConnect;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalNuke:
+ currITutorialStep = iTutorialSteps.TerminalAnalyze;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalManualHack:
+ currITutorialStep = iTutorialSteps.TerminalNuke;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalHackingMechanics:
+ currITutorialStep = iTutorialSteps.TerminalManualHack;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalCreateScript:
+ currITutorialStep = iTutorialSteps.TerminalManualHack;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalTypeScript:
+ currITutorialStep = iTutorialSteps.TerminalCreateScript;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalFree:
+ currITutorialStep = iTutorialSteps.TerminalTypeScript;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalRunScript:
+ currITutorialStep = iTutorialSteps.TerminalFree;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalGoToActiveScriptsPage:
+ currITutorialStep = iTutorialSteps.TerminalRunScript;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.ActiveScriptsPage:
+ currITutorialStep = iTutorialSteps.TerminalGoToActiveScriptsPage;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.ActiveScriptsToTerminal:
+ currITutorialStep = iTutorialSteps.ActiveScriptsPage;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TerminalTailScript:
+ currITutorialStep = iTutorialSteps.ActiveScriptsToTerminal;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.GoToHacknetNodesPage:
+ currITutorialStep = iTutorialSteps.TerminalTailScript;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.HacknetNodesIntroduction:
+ currITutorialStep = iTutorialSteps.GoToHacknetNodesPage;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.HacknetNodesGoToWorldPage:
+ currITutorialStep = iTutorialSteps.HacknetNodesIntroduction;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.WorldDescription:
+ currITutorialStep = iTutorialSteps.HacknetNodesGoToWorldPage;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.TutorialPageInfo:
+ currITutorialStep = iTutorialSteps.WorldDescription;
+ iTutorialEvaluateStep();
+ break;
+ case iTutorialSteps.End:
+ break;
+ default:
+ throw new Error("Invalid tutorial step");
+ }
+}
+
+function iTutorialEnd() {
+ //Re-enable auto save
+ __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].Counters.autoSaveCounter = 300;
+ console.log("Ending interactive tutorial");
+ __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].init();
+ currITutorialStep = iTutorialSteps.End;
+ iTutorialIsRunning = false;
+ document.getElementById("interactive-tutorial-container").style.display = "none";
+ Object(__WEBPACK_IMPORTED_MODULE_1__utils_DialogBox_js__["a" /* dialogBoxCreate */])("If you are new to the game, the following links may be useful for you!
" +
+ "Getting Started Guide" +
+ "Wiki");
+}
+
+function iTutorialSetText(txt) {
+ var textBox = document.getElementById("interactive-tutorial-text");
+ if (textBox == null) {throw new Error("Could not find text box"); return;}
+ textBox.innerHTML = txt;
+ textBox.parentElement.scrollTop = 0; // this resets scroll position
+}
+
+
+
+
+/***/ }),
+/* 28 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return HackingMission; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return inMission; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return setInMission; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return currMission; });
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Constants_js__ = __webpack_require__(3);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__engine_js__ = __webpack_require__(5);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Faction_js__ = __webpack_require__(11);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Player_js__ = __webpack_require__(0);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__ = __webpack_require__(1);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__ = __webpack_require__(2);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__ = __webpack_require__(4);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_jsplumb__ = __webpack_require__(70);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_jsplumb___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_7_jsplumb__);
+
+
+
+
+
+
+
+
+
+let inMission = false; //Flag to denote whether a mission is running
+let currMission = null;
+function setInMission(bool, mission) {
+ inMission = bool;
+ if (bool) {
+ currMission = mission;
+ } else {
+ currMission = null;
+ }
+}
+
+//Keyboard shortcuts
+$(document).keydown(function(e) {
+ if (inMission && currMission && currMission.selectedNode != null) {
+ switch (e.keyCode) {
+ case 65: //a for Attack
+ currMission.actionButtons[0].click();
+ break;
+ case 83: //s for Scan
+ currMission.actionButtons[1].click();
+ break;
+ case 87: //w for Weaken
+ currMission.actionButtons[2].click();
+ break;
+ case 70: //f for Fortify
+ currMission.actionButtons[3].click();
+ break;
+ case 82: //r for Overflow
+ currMission.actionButtons[4].click();
+ break;
+ case 68: //d for Detach connection
+ currMission.actionButtons[5].click();
+ break;
+ default:
+ break;
+ }
+ }
+});
+
+let NodeTypes = {
+ Core: "CPU Core Node", //All actions available
+ Firewall: "Firewall Node", //No actions available
+ Database: "Database Node", //No actions available
+ Spam: "Spam Node", //No actions Available
+ Transfer: "Transfer Node", //Can Weaken, Scan, Fortify and Overflow
+ Shield: "Shield Node" //Can Fortify
+}
+
+let NodeActions = {
+ Attack: "Attacking", //Damaged based on attack stat + hacking level + opp def
+ Scan: "Scanning", //-Def for target, affected by attack and hacking level
+ Weaken: "Weakening", //-Attack for target, affected by attack and hacking level
+ Fortify: "Fortifying", //+Defense for Node, affected by hacking level
+ Overflow: "Overflowing", //+Attack but -Defense for Node, affected by hacking level
+}
+
+function Node(type, stats) {
+ this.type = type;
+ this.atk = stats.atk ? stats.atk : 0;
+ this.def = stats.def ? stats.def : 0;
+ this.hp = stats.hp ? stats.hp : 0;
+ this.maxhp = this.hp;
+ this.plyrCtrl = false;
+ this.enmyCtrl = false;
+ this.pos = [0, 0]; //x, y
+ this.el = null; //Holds the Node's DOM element
+ this.action = null;
+ this.targetedCount = 0; //Count of how many connections this node is the target of
+
+ //Holds the JsPlumb Connection object for this Node,
+ //where this Node is the Source (since each Node
+ //can only have 1 outgoing Connection)
+ this.conn = null;
+}
+
+Node.prototype.setPosition = function(x, y) {
+ this.pos = [x, y];
+}
+
+Node.prototype.setControlledByPlayer = function() {
+ this.plyrCtrl = true;
+ this.enmyCtrl = false;
+ if (this.el) {
+ this.el.classList.remove("hack-mission-enemy-node");
+ this.el.classList.add("hack-mission-player-node");
+ }
+}
+
+Node.prototype.setControlledByEnemy = function() {
+ this.plyrCtrl = false;
+ this.enmyCtrl = true;
+ if (this.el) {
+ this.el.classList.remove("hack-mission-player-node");
+ this.el.classList.add("hack-mission-enemy-node");
+ }
+}
+
+//Sets this node to be the active node
+Node.prototype.select = function(actionButtons) {
+ if (this.enmyCtrl) {return;}
+ this.el.classList.add("hack-mission-player-node-active");
+
+ //Make all buttons inactive
+ for (var i = 0; i < actionButtons.length; ++i) {
+ actionButtons[i].classList.remove("a-link-button");
+ actionButtons[i].classList.add("a-link-button-inactive");
+ }
+
+ switch(this.type) {
+ case NodeTypes.Core:
+ //All buttons active
+ for (var i = 0; i < actionButtons.length; ++i) {
+ actionButtons[i].classList.remove("a-link-button-inactive");
+ actionButtons[i].classList.add("a-link-button");
+ }
+ break;
+ case NodeTypes.Transfer:
+ actionButtons[1].classList.remove("a-link-button-inactive");
+ actionButtons[1].classList.add("a-link-button");
+ actionButtons[2].classList.remove("a-link-button-inactive");
+ actionButtons[2].classList.add("a-link-button");
+ actionButtons[3].classList.remove("a-link-button-inactive");
+ actionButtons[3].classList.add("a-link-button");
+ actionButtons[4].classList.remove("a-link-button-inactive");
+ actionButtons[4].classList.add("a-link-button");
+ actionButtons[5].classList.remove("a-link-button-inactive");
+ actionButtons[5].classList.add("a-link-button");
+ break;
+ case NodeTypes.Shield:
+ case NodeTypes.Firewall:
+ actionButtons[3].classList.remove("a-link-button-inactive");
+ actionButtons[3].classList.add("a-link-button");
+ break;
+ default:
+ break;
+ }
+}
+
+Node.prototype.deselect = function(actionButtons) {
+ this.el.classList.remove("hack-mission-player-node-active");
+ for (var i = 0; i < actionButtons.length; ++i) {
+ actionButtons[i].classList.remove("a-link-button");
+ actionButtons[i].classList.add("a-link-button-inactive");
+ }
+}
+
+
+Node.prototype.untarget = function() {
+ if (this.targetedCount === 0) {
+ console.log("WARN: Node " + this.el.id + " is being 'untargeted' when it has no target count");
+ return;
+ }
+ --this.targetedCount;
+}
+
+//Hacking mission instance
+//Takes in the reputation of the Faction for which the mission is
+//being conducted
+function HackingMission(rep, fac) {
+ this.faction = fac;
+
+ this.started = false;
+ this.time = 180000; //5 minutes to start, milliseconds
+
+ this.playerCores = [];
+ this.playerNodes = []; //Non-core nodes
+ this.playerAtk = 0;
+ this.playerDef = 0;
+
+ this.enemyCores = [];
+ this.enemyDatabases = [];
+ this.enemyNodes = []; //Non-core nodes
+ this.enemyAtk = 0;
+ this.enemyDef = 0;
+
+ this.miscNodes = [];
+
+ this.selectedNode = null; //Which of the player's nodes is currently selected
+
+ this.actionButtons = []; //DOM buttons for actions
+
+ this.availablePositions = [];
+ for (var r = 0; r < 8; ++r) {
+ for (var c = 0; c < 8; ++c) {
+ this.availablePositions.push([r, c]);
+ }
+ }
+
+ this.map = [];
+ for (var i = 0; i < 8; ++i) {
+ this.map.push([null, null, null, null, null, null, null, null]);
+ }
+
+ this.jsplumbinstance = null;
+
+ this.difficulty = rep / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].HackingMissionRepToDiffConversion + 1;
+ console.log("difficulty: " + this.difficulty);
+ this.reward = 250 + (rep / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].HackingMissionRepToRewardConversion);
+}
+
+HackingMission.prototype.init = function() {
+ //Create Header DOM
+ this.createPageDom();
+
+ //Create player starting nodes
+ var home = __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].getHomeComputer()
+ for (var i = 0; i < home.cpuCores; ++i) {
+ var stats = {
+ atk: (__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill / 7.5) + 30,
+ def: (__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill / 20),
+ hp: (__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill / 4),
+ };
+ this.playerCores.push(new Node(NodeTypes.Core, stats));
+ this.playerCores[i].setControlledByPlayer();
+ this.setNodePosition(this.playerCores[i], i, 0);
+ this.removeAvailablePosition(i, 0);
+ }
+
+ //Randomly generate enemy nodes (CPU and Firewall) based on difficulty
+ var numNodes = Math.min(8, Math.max(1, Math.round(this.difficulty / 4)));
+ var numFirewalls = Math.min(20,
+ Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(Math.round(this.difficulty/2), Math.round(this.difficulty/2) + 1));
+ var numDatabases = Math.min(10, Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(1, Math.round(this.difficulty / 3) + 1));
+ var totalNodes = numNodes + numFirewalls + numDatabases;
+ var xlimit = 7 - Math.floor(totalNodes / 8);
+ var randMult = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["a" /* addOffset */])(0.8 + (this.difficulty / 5), 10);
+ for (var i = 0; i < numNodes; ++i) {
+ var stats = {
+ atk: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(75, 85),
+ def: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(25, 35),
+ hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(210, 230)
+ }
+ this.enemyCores.push(new Node(NodeTypes.Core, stats));
+ this.enemyCores[i].setControlledByEnemy();
+ this.setNodeRandomPosition(this.enemyCores[i], xlimit);
+ }
+ for (var i = 0; i < numFirewalls; ++i) {
+ var stats = {
+ atk: 0,
+ def: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(80, 90),
+ hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(275, 300)
+ }
+ this.enemyNodes.push(new Node(NodeTypes.Firewall, stats));
+ this.enemyNodes[i].setControlledByEnemy();
+ this.setNodeRandomPosition(this.enemyNodes[i], xlimit);
+ }
+ for (var i = 0; i < numDatabases; ++i) {
+ var stats = {
+ atk: 0,
+ def: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(70, 85),
+ hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(210, 275)
+ }
+ var node = new Node(NodeTypes.Database, stats);
+ node.setControlledByEnemy();
+ this.setNodeRandomPosition(node, xlimit);
+ this.enemyDatabases.push(node);
+ }
+ this.calculateDefenses();
+ this.calculateAttacks();
+ this.createMap();
+}
+
+HackingMission.prototype.createPageDom = function() {
+ var container = document.getElementById("mission-container");
+
+ var favorMult = 1 + (this.faction.favor / 100);
+ var gain = this.reward * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].faction_rep_mult * favorMult;
+ var headerText = document.createElement("p");
+ headerText.innerHTML = "You are about to start a hacking mission! You will gain " +
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(gain, 3) + " faction reputation with " + this.faction.name +
+ " if you win. For more information " +
+ "about how hacking missions work, click one of the guide links " +
+ "below (one opens up an in-game guide and the other opens up " +
+ "the guide from the wiki). Click the 'Start' button to begin.";
+ headerText.style.display = "block";
+ headerText.classList.add("hack-mission-header-element");
+ headerText.style.width = "80%";
+
+ var inGameGuideBtn = document.createElement("a");
+ inGameGuideBtn.innerText = "How to Play";
+ inGameGuideBtn.classList.add("a-link-button");
+ inGameGuideBtn.style.display = "inline-block";
+ inGameGuideBtn.classList.add("hack-mission-header-element");
+ inGameGuideBtn.addEventListener("click", function() {
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])(__WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].HackingMissionHowToPlay);
+ return false;
+ });
+
+ var wikiGuideBtn = document.createElement("a");
+ wikiGuideBtn.innerText = "Wiki Guide";
+ wikiGuideBtn.classList.add("a-link-button");
+ wikiGuideBtn.style.display = "inline-block";
+ wikiGuideBtn.classList.add("hack-mission-header-element");
+ wikiGuideBtn.target = "_blank";
+ //TODO Add link to wiki page wikiGuideBtn.href =
+
+
+ //Start button will get replaced with forfeit when game is started
+ var startBtn = document.createElement("a");
+ startBtn.innerHTML = "Start";
+ startBtn.setAttribute("id", "hack-mission-start-btn");
+ startBtn.classList.add("a-link-button");
+ startBtn.classList.add("hack-mission-header-element");
+ startBtn.style.display = "inline-block";
+ startBtn.addEventListener("click", ()=>{
+ this.start();
+ return false;
+ });
+
+ var forfeitMission = document.createElement("a");
+ forfeitMission.innerHTML = "Forfeit Mission (Exit)";
+ forfeitMission.classList.add("a-link-button");
+ forfeitMission.classList.add("hack-mission-header-element");
+ forfeitMission.style.display = "inline-block";
+ forfeitMission.addEventListener("click", ()=> {
+ this.finishMission(false);
+ return false;
+ });
+
+ var timer = document.createElement("p");
+ timer.setAttribute("id", "hacking-mission-timer");
+ timer.style.display = "inline-block";
+ timer.style.margin = "6px";
+
+ //Create Action Buttons (Attack/Scan/Weaken/ etc...)
+ var actionsContainer = document.createElement("span");
+ actionsContainer.style.display = "block";
+ actionsContainer.classList.add("hack-mission-action-buttons-container");
+ for (var i = 0; i < 6; ++i) {
+ this.actionButtons.push(document.createElement("a"));
+ this.actionButtons[i].style.display = "inline-block";
+ this.actionButtons[i].classList.add("a-link-button-inactive"); //Disabled at start
+ this.actionButtons[i].classList.add("tooltip"); //Disabled at start
+ this.actionButtons[i].classList.add("hack-mission-header-element");
+ actionsContainer.appendChild(this.actionButtons[i]);
+ }
+ this.actionButtons[0].innerText = "Attack(a)";
+ var atkTooltip = document.createElement("span");
+ atkTooltip.classList.add("tooltiptexthigh");
+ atkTooltip.innerText = "Lowers the targeted node's HP. The effectiveness of this depends on " +
+ "this node's Attack level, your hacking level, and the opponent's defense level.";
+ this.actionButtons[0].appendChild(atkTooltip);
+ this.actionButtons[1].innerText = "Scan(s)";
+ var scanTooltip = document.createElement("span");
+ scanTooltip.classList.add("tooltiptexthigh");
+ scanTooltip.innerText = "Lowers the targeted node's defense. The effectiveness of this depends on " +
+ "this node's Attack level, your hacking level, and the opponent's defense level.";
+ this.actionButtons[1].appendChild(scanTooltip);
+ this.actionButtons[2].innerText = "Weaken(w)";
+ var WeakenTooltip = document.createElement("span");
+ WeakenTooltip.classList.add("tooltiptexthigh");
+ WeakenTooltip.innerText = "Lowers the targeted node's attack. The effectiveness of this depends on " +
+ "this node's Attack level, your hacking level, and the opponent's defense level.";
+ this.actionButtons[2].appendChild(WeakenTooltip);
+ this.actionButtons[3].innerText = "Fortify(f)";
+ var fortifyTooltip = document.createElement("span");
+ fortifyTooltip.classList.add("tooltiptexthigh");
+ fortifyTooltip.innerText = "Raises this node's Defense level. The effectiveness of this depends on " +
+ "your hacking level";
+ this.actionButtons[3].appendChild(fortifyTooltip);
+ this.actionButtons[4].innerText = "Overflow(r)";
+ var overflowTooltip = document.createElement("span");
+ overflowTooltip.classList.add("tooltiptexthigh");
+ overflowTooltip.innerText = "Raises this node's Attack level but lowers its Defense level. The effectiveness " +
+ "of this depends on your hacking level.";
+ this.actionButtons[4].appendChild(overflowTooltip);
+ this.actionButtons[5].innerText = "Drop Connection(d)";
+ var dropconnTooltip = document.createElement("span");
+ dropconnTooltip.classList.add("tooltiptexthigh");
+ dropconnTooltip.innerText = "Removes this Node's current connection to some target Node, if it has one. This can " +
+ "also be done by simply clicking the white connection line.";
+ this.actionButtons[5].appendChild(dropconnTooltip);
+
+ //Player/enemy defense displays will be in action container
+ var playerStats = document.createElement("p");
+ var enemyStats = document.createElement("p");
+ playerStats.style.display = "inline-block";
+ enemyStats.style.display = "inline-block";
+ playerStats.style.color = "#00ccff";
+ enemyStats.style.color = "red";
+ playerStats.style.margin = "4px";
+ enemyStats.style.margin = "4px";
+ playerStats.setAttribute("id", "hacking-mission-player-stats");
+ enemyStats.setAttribute("id", "hacking-mission-enemy-stats");
+ actionsContainer.appendChild(playerStats);
+ actionsContainer.appendChild(enemyStats);
+
+ //Set Action Button event listeners
+ this.actionButtons[0].addEventListener("click", ()=>{
+ if (!(this.selectedNode instanceof Node)) {
+ console.log("ERR: Pressing Action button without selected node");
+ return;
+ }
+ if (this.selectedNode.type !== NodeTypes.Core) {return;}
+ this.setActionButtonsActive(this.selectedNode.type);
+ this.setActionButton(NodeActions.Attack, false); //Set attack button inactive
+ this.selectedNode.action = NodeActions.Attack;
+ });
+
+ this.actionButtons[1].addEventListener("click", ()=>{
+ if (!(this.selectedNode instanceof Node)) {
+ console.log("ERR: Pressing Action button without selected node");
+ return;
+ }
+ var nodeType = this.selectedNode.type;
+ if (nodeType !== NodeTypes.Core && nodeType !== NodeTypes.Transfer) {return;}
+ this.setActionButtonsActive(nodeType);
+ this.setActionButton(NodeActions.Scan, false); //Set scan button inactive
+ this.selectedNode.action = NodeActions.Scan;
+ });
+
+ this.actionButtons[2].addEventListener("click", ()=>{
+ if (!(this.selectedNode instanceof Node)) {
+ console.log("ERR: Pressing Action button without selected node");
+ return;
+ }
+ var nodeType = this.selectedNode.type;
+ if (nodeType !== NodeTypes.Core && nodeType !== NodeTypes.Transfer) {return;}
+ this.setActionButtonsActive(nodeType);
+ this.setActionButton(NodeActions.Weaken, false); //Set Weaken button inactive
+ this.selectedNode.action = NodeActions.Weaken;
+ });
+
+ this.actionButtons[3].addEventListener("click", ()=>{
+ if (!(this.selectedNode instanceof Node)) {
+ console.log("ERR: Pressing Action button without selected node");
+ return;
+ }
+ this.setActionButtonsActive(this.selectedNode.type);
+ this.setActionButton(NodeActions.Fortify, false); //Set Fortify button inactive
+ this.selectedNode.action = NodeActions.Fortify;
+ });
+
+ this.actionButtons[4].addEventListener("click", ()=>{
+ if (!(this.selectedNode instanceof Node)) {
+ console.log("ERR: Pressing Action button without selected node");
+ return;
+ }
+ var nodeType = this.selectedNode.type;
+ if (nodeType !== NodeTypes.Core && nodeType !== NodeTypes.Transfer) {return;}
+ this.setActionButtonsActive(this.selectedNode.type);
+ this.setActionButton(NodeActions.Overflow, false); //Set Overflow button inactive
+ this.selectedNode.action = NodeActions.Overflow;
+ });
+
+ this.actionButtons[5].addEventListener("click", ()=>{
+ if (!(this.selectedNode instanceof Node)) {
+ console.log("ERR: Pressing Action button without selected node");
+ return;
+ }
+ if (this.selectedNode.conn) {
+ var endpoints = this.selectedNode.conn.endpoints;
+ endpoints[0].detachFrom(endpoints[1]);
+ }
+ })
+
+ var timeDisplay = document.createElement("p");
+
+ container.appendChild(headerText);
+ container.appendChild(inGameGuideBtn);
+ container.appendChild(wikiGuideBtn);
+ container.appendChild(startBtn);
+ container.appendChild(forfeitMission);
+ container.appendChild(timer);
+ container.appendChild(actionsContainer);
+ container.appendChild(timeDisplay);
+}
+
+HackingMission.prototype.setActionButtonsInactive = function() {
+ for (var i = 0; i < this.actionButtons.length; ++i) {
+ this.actionButtons[i].classList.remove("a-link-button");
+ this.actionButtons[i].classList.add("a-link-button-inactive");
+ }
+}
+
+HackingMission.prototype.setActionButtonsActive = function(nodeType=null) {
+ for (var i = 0; i < this.actionButtons.length; ++i) {
+ this.actionButtons[i].classList.add("a-link-button");
+ this.actionButtons[i].classList.remove("a-link-button-inactive");
+ }
+
+ //For Transfer, FireWall and Shield Nodes, certain buttons should always be disabled
+ //0 = Attack, 1 = Scan, 2 = Weaken, 3 = Fortify, 4 = overflow, 5 = Drop conn
+ if (nodeType) {
+ switch (nodeType) {
+ case NodeTypes.Firewall:
+ case NodeTypes.Shield:
+ this.actionButtons[0].classList.remove("a-link-button");
+ this.actionButtons[0].classList.add("a-link-button-inactive");
+ this.actionButtons[1].classList.remove("a-link-button");
+ this.actionButtons[1].classList.add("a-link-button-inactive");
+ this.actionButtons[2].classList.remove("a-link-button");
+ this.actionButtons[2].classList.add("a-link-button-inactive");
+ this.actionButtons[4].classList.remove("a-link-button");
+ this.actionButtons[4].classList.add("a-link-button-inactive");
+ this.actionButtons[5].classList.remove("a-link-button");
+ this.actionButtons[5].classList.add("a-link-button-inactive");
+ break;
+ case NodeTypes.Transfer:
+ this.actionButtons[0].classList.remove("a-link-button");
+ this.actionButtons[0].classList.add("a-link-button-inactive");
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+//True for active, false for inactive
+HackingMission.prototype.setActionButton = function(i, active=true) {
+ if (Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["f" /* isString */])(i)) {
+ switch (i) {
+ case NodeActions.Attack:
+ i = 0;
+ break;
+ case NodeActions.Scan:
+ i = 1;
+ break;
+ case NodeActions.Weaken:
+ i = 2;
+ break;
+ case NodeActions.Fortify:
+ i = 3;
+ break;
+ case NodeActions.Overflow:
+ default:
+ i = 4;
+ break;
+ }
+ }
+ if (active) {
+ this.actionButtons[i].classList.remove("a-link-button-inactive");
+ this.actionButtons[i].classList.add("a-link-button");
+ } else {
+ this.actionButtons[i].classList.remove("a-link-button");
+ this.actionButtons[i].classList.add("a-link-button-inactive");
+ }
+
+}
+
+HackingMission.prototype.calculateAttacks = function() {
+ var total = 0;
+ for (var i = 0; i < this.playerCores.length; ++i) {
+ total += this.playerCores[i].atk;
+ }
+ for (var i = 0; i < this.playerNodes.length; ++i) {
+ total += this.playerNodes[i].atk;
+ }
+ this.playerAtk = total;
+ document.getElementById("hacking-mission-player-stats").innerHTML =
+ "Player Attack: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.playerAtk, 1) + "
" +
+ "Player Defense: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.playerDef, 1);
+ total = 0;
+ for (var i = 0; i < this.enemyCores.length; ++i) {
+ total += this.enemyCores[i].atk;
+ }
+ for (var i = 0; i < this.enemyDatabases.length; ++i) {
+ total += this.enemyDatabases[i].atk;
+ }
+ for (var i = 0; i < this.enemyNodes.length; ++i) {
+ total += this.enemyNodes[i].atk;
+ }
+ this.enemyAtk = total;
+ document.getElementById("hacking-mission-enemy-stats").innerHTML =
+ "Enemy Attack: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.enemyAtk, 1) + "
" +
+ "Enemy Defense: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.enemyDef, 1);
+}
+
+HackingMission.prototype.calculateDefenses = function() {
+ var total = 0;
+ for (var i = 0; i < this.playerCores.length; ++i) {
+ total += this.playerCores[i].def;
+ }
+ for (var i = 0; i < this.playerNodes.length; ++i) {
+ total += this.playerNodes[i].def;
+ }
+ this.playerDef = total;
+ document.getElementById("hacking-mission-player-stats").innerHTML =
+ "Player Attack: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.playerAtk, 1) + "
" +
+ "Player Defense: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.playerDef, 1);
+ total = 0;
+ for (var i = 0; i < this.enemyCores.length; ++i) {
+ total += this.enemyCores[i].def;
+ }
+ for (var i = 0; i < this.enemyDatabases.length; ++i) {
+ total += this.enemyDatabases[i].def;
+ }
+ for (var i = 0; i < this.enemyNodes.length; ++i) {
+ total += this.enemyNodes[i].def;
+ }
+ this.enemyDef = total;
+ document.getElementById("hacking-mission-enemy-stats").innerHTML =
+ "Enemy Attack: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.enemyAtk, 1) + "
" +
+ "Enemy Defense: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.enemyDef, 1);
+}
+
+HackingMission.prototype.removeAvailablePosition = function(x, y) {
+ for (var i = 0; i < this.availablePositions.length; ++i) {
+ if (this.availablePositions[i][0] === x &&
+ this.availablePositions[i][1] === y) {
+ this.availablePositions.splice(i, 1);
+ return;
+ }
+ }
+ console.log("WARNING: removeAvailablePosition() did not remove " + x + ", " + y);
+}
+
+HackingMission.prototype.setNodePosition = function(nodeObj, x, y) {
+ if (!(nodeObj instanceof Node)) {
+ console.log("WARNING: Non-Node object passed into setNodePOsition");
+ return;
+ }
+ if (isNaN(x) || isNaN(y)) {
+ console.log("ERR: Invalid values passed as x and y for setNodePosition");
+ console.log(x);
+ console.log(y);
+ return;
+ }
+ nodeObj.pos = [x, y];
+ this.map[x][y] = nodeObj;
+}
+
+HackingMission.prototype.setNodeRandomPosition = function(nodeObj, xlimit=0) {
+ var i = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(0, this.availablePositions.length - 1);
+ if (this.availablePositions[i][1] < xlimit) {
+ //Recurse if not within limit
+ return this.setNodeRandomPosition(nodeObj, xlimit);
+ }
+ var pos = this.availablePositions.splice(i, 1);
+ pos = pos[0];
+ this.setNodePosition(nodeObj, pos[0], pos[1]);
+}
+
+HackingMission.prototype.createMap = function() {
+ //Use a grid
+ var map = document.createElement("div");
+ map.classList.add("hack-mission-grid");
+ map.setAttribute("id", "hacking-mission-map");
+ document.getElementById("mission-container").appendChild(map);
+
+ //Create random Nodes for every space in the map that
+ //hasn't been filled yet. The stats of each Node will be based on
+ //the player/enemy attack
+ var averageAttack = (this.playerAtk + this.enemyAtk) / 2;
+ for (var x = 0; x < 8; ++x) {
+ for (var y = 0; y < 8; ++y) {
+ if (!(this.map[x][y] instanceof Node)) {
+ var node, type = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(0, 2);
+ var randMult = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["a" /* addOffset */])(0.85 + (this.difficulty / 2), 15);
+ switch (type) {
+ case 0: //Spam
+ var stats = {
+ atk: 0,
+ def: averageAttack * 1.15 + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(10, 50),
+ hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(200, 225)
+ }
+ node = new Node(NodeTypes.Spam, stats);
+ break;
+ case 1: //Transfer
+ var stats = {
+ atk: 0,
+ def: averageAttack * 1.15 + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(10, 50),
+ hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(250, 275)
+ }
+ node = new Node(NodeTypes.Transfer, stats);
+ break;
+ case 2: //Shield
+ default:
+ var stats = {
+ atk: 0,
+ def: averageAttack * 1.15 + Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(25, 75),
+ hp: randMult * Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(300, 320)
+ }
+ node = new Node(NodeTypes.Shield, stats);
+ break;
+ }
+ this.setNodePosition(node, x, y);
+ this.removeAvailablePosition(x, y);
+ this.miscNodes.push(node);
+ }
+ }
+ }
+
+ //Create DOM elements in order
+ for (var r = 0; r < 8; ++r) {
+ for (var c = 0; c < 8; ++c) {
+ this.createNodeDomElement(this.map[r][c]);
+ }
+ }
+
+ //Configure all Player CPUS
+ for (var i = 0; i < this.playerCores.length; ++i) {
+ console.log("Configuring Player Node: " + this.playerCores[i].el.id);
+ this.configurePlayerNodeElement(this.playerCores[i].el);
+ }
+}
+
+HackingMission.prototype.createNodeDomElement = function(nodeObj) {
+ var nodeDiv = document.createElement("a"), txtEl = document.createElement('p');
+ nodeObj.el = nodeDiv;
+
+ //Set the node element's id based on its coordinates
+ var id = "hacking-mission-node-" + nodeObj.pos[0] + "-" + nodeObj.pos[1];
+ nodeDiv.setAttribute("id", id);
+ txtEl.setAttribute("id", id + "-txt");
+
+ //Set node classes for owner
+ nodeDiv.classList.add("hack-mission-node");
+ if (nodeObj.plyrCtrl) {
+ nodeDiv.classList.add("hack-mission-player-node");
+ } else if (nodeObj.enmyCtrl) {
+ nodeDiv.classList.add("hack-mission-enemy-node");
+ }
+
+ //Set node classes based on type
+ var txt;
+ switch (nodeObj.type) {
+ case NodeTypes.Core:
+ txt = "CPU Core
" + "HP: " +
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+ nodeDiv.classList.add("hack-mission-cpu-node");
+ break;
+ case NodeTypes.Firewall:
+ txt = "Firewall
" + "HP: " +
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+ nodeDiv.classList.add("hack-mission-firewall-node");
+ break;
+ case NodeTypes.Database:
+ txt = "Database
" + "HP: " +
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+ nodeDiv.classList.add("hack-mission-database-node");
+ break;
+ case NodeTypes.Spam:
+ txt = "Spam
" + "HP: " +
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+ nodeDiv.classList.add("hack-mission-spam-node");
+ break;
+ case NodeTypes.Transfer:
+ txt = "Transfer
" + "HP: " +
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+ nodeDiv.classList.add("hack-mission-transfer-node");
+ break;
+ case NodeTypes.Shield:
+ default:
+ txt = "Shield
" + "HP: " +
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+ nodeDiv.classList.add("hack-mission-shield-node");
+ break;
+ }
+
+ txt += "
Atk: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.atk, 1) +
+ "
Def: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.def, 1);
+ txtEl.innerHTML = txt;
+
+ nodeDiv.appendChild(txtEl);
+ document.getElementById("hacking-mission-map").appendChild(nodeDiv);
+}
+
+HackingMission.prototype.updateNodeDomElement = function(nodeObj) {
+ if (nodeObj.el == null) {
+ console.log("ERR: Calling updateNodeDomElement on a Node without an element");
+ return;
+ }
+
+ var id = "hacking-mission-node-" + nodeObj.pos[0] + "-" + nodeObj.pos[1];
+ var nodeDiv = document.getElementById(id), txtEl = document.getElementById(id + "-txt");
+
+ //Set node classes based on type
+ var txt;
+ switch (nodeObj.type) {
+ case NodeTypes.Core:
+ txt = "CPU Core
" + "HP: " +
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+ break;
+ case NodeTypes.Firewall:
+ txt = "Firewall
" + "HP: " +
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+ break;
+ case NodeTypes.Database:
+ txt = "Database
" + "HP: " +
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+ break;
+ case NodeTypes.Spam:
+ txt = "Spam
" + "HP: " +
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+ break;
+ case NodeTypes.Transfer:
+ txt = "Transfer
" + "HP: " +
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+ break;
+ case NodeTypes.Shield:
+ default:
+ txt = "Shield
" + "HP: " +
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.hp, 1);
+ break;
+ }
+
+ txt += "
Atk: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.atk, 1) +
+ "
Def: " + Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.def, 1);
+ if (nodeObj.action) {
+ txt += "
" + nodeObj.action;
+ }
+ txtEl.innerHTML = txt;
+}
+
+//Gets a Node DOM element's corresponding Node object using its
+//element id. Function accepts either the DOM element object or the ID as
+//an argument
+HackingMission.prototype.getNodeFromElement = function(el) {
+ var id;
+ if (Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["f" /* isString */])(el)) {
+ id = el;
+ } else {
+ id = el.id;
+ }
+ id = id.replace("hacking-mission-node-", "");
+ var res = id.split('-');
+ if (res.length != 2) {
+ console.log("ERROR Parsing Hacking Mission Node Id. Could not find coordinates");
+ return null;
+ }
+ var x = res[0], y = res[1];
+ if (isNaN(x) || isNaN(y) || x >= 8 || y >= 8 || x < 0 || y < 0) {
+ console.log("ERROR: Unexpected values for x and y: " + x + ", " + y);
+ return null;
+ }
+ return this.map[x][y];
+}
+
+function selectNode(hackMissionInst, el) {
+ var nodeObj = hackMissionInst.getNodeFromElement(el);
+ if (nodeObj == null) {console.log("Error getting Node object");}
+ if (!nodeObj.plyrCtrl) {return;}
+
+ if (hackMissionInst.selectedNode instanceof Node) {
+ hackMissionInst.selectedNode.deselect(hackMissionInst.actionButtons);
+ hackMissionInst.selectedNode = null;
+ }
+ nodeObj.select(hackMissionInst.actionButtons);
+ hackMissionInst.selectedNode = nodeObj;
+}
+
+//Configures a DOM element representing a player-owned node to
+//be selectable and actionable
+//Note: Does NOT change its css class. This is handled by Node.setControlledBy...
+HackingMission.prototype.configurePlayerNodeElement = function(el) {
+ var nodeObj = this.getNodeFromElement(el);
+ if (nodeObj == null) {console.log("Error getting Node object");}
+
+ //Add event listener
+ var self = this;
+ function selectNodeWrapper() {
+ selectNode(self, el);
+ }
+ el.addEventListener("click", selectNodeWrapper);
+
+ if (el.firstChild) {
+ el.firstChild.addEventListener("click", selectNodeWrapper);
+ }
+}
+
+//Configures a DOM element representing an enemy-node by removing
+//any event listeners
+HackingMission.prototype.configureEnemyNodeElement = function(el) {
+ //Deselect node if it was the selected node
+ var nodeObj = this.getNodeFromElement(el);
+ if (this.selectedNode == nodeObj) {
+ nodeObj.deselect(this.actionButtons);
+ }
+}
+
+//Returns bool indicating whether a node is reachable by player
+//by checking if any of the adjacent nodes are owned by the player
+HackingMission.prototype.nodeReachable = function(node) {
+ var x = node.pos[0], y = node.pos[1];
+ if (x > 0 && this.map[x-1][y].plyrCtrl) {return true;}
+ if (x < 7 && this.map[x+1][y].plyrCtrl) {return true;}
+ if (y > 0 && this.map[x][y-1].plyrCtrl) {return true;}
+ if (y < 7 && this.map[x][y+1].plyrCtrl) {return true;}
+ return false;
+}
+
+HackingMission.prototype.nodeReachableByEnemy = function(node) {
+ if (node == null) {return false;}
+ var x = node.pos[0], y = node.pos[1];
+ if (x > 0 && this.map[x-1][y].enmyCtrl) {return true;}
+ if (x < 7 && this.map[x+1][y].enmyCtrl) {return true;}
+ if (y > 0 && this.map[x][y-1].enmyCtrl) {return true;}
+ if (y < 7 && this.map[x][y+1].enmyCtrl) {return true;}
+ return false;
+}
+
+HackingMission.prototype.start = function() {
+ this.started = true;
+ this.initJsPlumb();
+ var startBtn = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["b" /* clearEventListeners */])("hack-mission-start-btn");
+ startBtn.classList.remove("a-link-button");
+ startBtn.classList.add("a-link-button-inactive");
+}
+
+HackingMission.prototype.initJsPlumb = function() {
+ var instance = jsPlumb.getInstance({
+ DragOptions:{cursor:"pointer", zIndex:2000},
+ PaintStyle: {
+ gradient: { stops: [
+ [ 0, "#FFFFFF" ],
+ [ 1, "#FFFFFF" ]
+ ] },
+ stroke: "#FFFFFF",
+ strokeWidth: 8
+ },
+ });
+
+ this.jsplumbinstance = instance;
+
+ //All player cores are sources
+ for (var i = 0; i < this.playerCores.length; ++i) {
+ instance.makeSource(this.playerCores[i].el, {
+ deleteEndpointsOnEmpty:true,
+ maxConnections:1,
+ anchor:"Continuous",
+ connector:"Flowchart"
+ });
+ }
+
+ //Everything else is a target
+ for (var i = 0; i < this.enemyCores.length; ++i) {
+ instance.makeTarget(this.enemyCores[i].el, {
+ maxConnections:-1,
+ anchor:"Continuous",
+ connector:"Flowchart"
+ });
+ }
+ for (var i = 0; i < this.enemyDatabases.length; ++i) {
+ instance.makeTarget(this.enemyDatabases[i].el, {
+ maxConnections:-1,
+ anchor:"Continuous",
+ connector:["Flowchart"]
+ });
+ }
+ for (var i = 0; i < this.enemyNodes.length; ++i) {
+ instance.makeTarget(this.enemyNodes[i].el, {
+ maxConnections:-1,
+ anchor:"Continuous",
+ connector:"Flowchart"
+ });
+ }
+ for (var i = 0; i < this.miscNodes.length; ++i) {
+ instance.makeTarget(this.miscNodes[i].el, {
+ maxConnections:-1,
+ anchor:"Continuous",
+ connector:"Flowchart"
+ });
+ }
+
+ //Clicking a connection drops it
+ instance.bind("click", function(conn, originalEvent) {
+ var endpoints = conn.endpoints;
+ endpoints[0].detachFrom(endpoints[1]);
+ });
+
+ //Connection events
+ instance.bind("connection", (info)=>{
+ var targetNode = this.getNodeFromElement(info.target);
+
+ //Do not detach for enemy nodes
+ var thisNode = this.getNodeFromElement(info.source);
+ if (thisNode.enmyCtrl) {return;}
+
+ //If the node is not reachable, drop the connection
+ if (!this.nodeReachable(targetNode)) {
+ info.sourceEndpoint.detachFrom(info.targetEndpoint);
+ return;
+ }
+
+ var sourceNode = this.getNodeFromElement(info.source);
+ sourceNode.conn = info.connection;
+ var targetNode = this.getNodeFromElement(info.target);
+ ++targetNode.targetedCount;
+ });
+
+ //Detach Connection events
+ instance.bind("connectionDetached", (info, originalEvent)=>{
+ var sourceNode = this.getNodeFromElement(info.source);
+ sourceNode.conn = null;
+ var targetNode = this.getNodeFromElement(info.target);
+ targetNode.untarget();
+ });
+
+}
+
+//Drops all connections where the specified node is the source
+HackingMission.prototype.dropAllConnectionsFromNode = function(node) {
+ var allConns = this.jsplumbinstance.getAllConnections();
+ for (var i = allConns.length-1; i >= 0; --i) {
+ if (allConns[i].source == node.el) {
+ allConns[i].endpoints[0].detachFrom(allConns[i].endpoints[1]);
+ }
+ }
+}
+
+//Drops all connections where the specified node is the target
+HackingMission.prototype.dropAllConnectionsToNode = function(node) {
+ var allConns = this.jsplumbinstance.getAllConnections();
+ for (var i = allConns.length-1; i >= 0; --i) {
+ if (allConns[i].target == node.el) {
+ allConns[i].endpoints[0].detachFrom(allConns[i].endpoints[1]);
+ }
+ }
+ node.beingTargeted = false;
+}
+
+var storedCycles = 0;
+HackingMission.prototype.process = function(numCycles=1) {
+ if (!this.started) {return;}
+ storedCycles += numCycles;
+ if (storedCycles < 2) {return;} //Only process every 3 cycles minimum
+
+ var res = false;
+ //Process actions of all player nodes
+ this.playerCores.forEach((node)=>{
+ res |= this.processNode(node, storedCycles);
+ });
+
+ this.playerNodes.forEach((node)=>{
+ if (node.type === NodeTypes.Transfer ||
+ node.type === NodeTypes.Shield ||
+ node.type === NodeTypes.Firewall) {
+ res |= this.processNode(node, storedCycles);
+ }
+ });
+
+ //Process actions of all enemy nodes
+ this.enemyCores.forEach((node)=>{
+ this.enemyAISelectAction(node);
+ res |= this.processNode(node, storedCycles);
+ });
+
+ this.enemyNodes.forEach((node)=>{
+ if (node.type === NodeTypes.Transfer ||
+ node.type === NodeTypes.Shield ||
+ node.type === NodeTypes.Firewall) {
+ this.enemyAISelectAction(node);
+ res |= this.processNode(node, storedCycles);
+ }
+ });
+
+ //The hp of enemy databases increases slowly
+ this.enemyDatabases.forEach((node)=>{
+ node.maxhp += (0.1 * storedCycles);
+ node.hp += (0.1 * storedCycles);
+ });
+
+ if (res) {
+ this.calculateAttacks();
+ this.calculateDefenses();
+ }
+
+ //Win if all enemy databases are conquered
+ if (this.enemyDatabases.length === 0) {
+ this.finishMission(true);
+ return;
+ }
+
+ //Lose if all your cores are gone
+ if (this.playerCores.length === 0) {
+ this.finishMission(false);
+ return;
+ }
+
+ //Defense/hp of misc nodes increases slowly over time
+ this.miscNodes.forEach((node)=>{
+ node.def += (0.1 * storedCycles);
+ node.maxhp += (0.05 * storedCycles);
+ node.hp += (0.1 * storedCycles);
+ if (node.hp > node.maxhp) {node.hp = node.maxhp;}
+ this.updateNodeDomElement(node);
+ });
+
+ //Update timer and check if player lost
+ this.time -= (storedCycles * __WEBPACK_IMPORTED_MODULE_1__engine_js__["Engine"]._idleSpeed);
+ if (this.time <= 0) {
+ this.finishMission(false);
+ return;
+ }
+ this.updateTimer();
+
+ storedCycles = 0;
+}
+
+//Returns a bool representing whether defenses need to be re-calculated
+HackingMission.prototype.processNode = function(nodeObj, numCycles=1) {
+ if (nodeObj.action == null) {
+ return;
+ }
+
+ var targetNode = null, def, atk;
+ if (nodeObj.conn) {
+ var targetNode;
+ if (nodeObj.conn.target) {
+ targetNode = this.getNodeFromElement(nodeObj.conn.target);
+ } else {
+ targetNode = this.getNodeFromElement(nodeObj.conn.targetId);
+ }
+
+ if (targetNode.plyrCtrl) {
+ def = this.playerDef;
+ atk = this.enemyAtk;
+ } else if (targetNode.enmyCtrl) {
+ def = this.enemyDef;
+ atk = this.playerAtk;
+ } else { //Misc Node
+ def = targetNode.def;
+ nodeObj.plyrCtrl ? atk = this.playerAtk : atk = this.enemyAtk;
+ }
+ }
+
+ //Calculations are per second, so divide everything by 5
+ var calcStats = false, plyr = nodeObj.plyrCtrl;
+ var enmyHacking = this.difficulty * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].HackingMissionDifficultyToHacking;
+ switch(nodeObj.action) {
+ case NodeActions.Attack:
+ if (nodeObj.conn == null) {break;}
+ var dmg = this.calculateAttackDamage(atk, def, plyr ? __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill : enmyHacking);
+ targetNode.hp -= (dmg/5 * numCycles);
+ break;
+ case NodeActions.Scan:
+ if (nodeObj.conn == null) {break;}
+ var eff = this.calculateScanEffect(atk, def, plyr ? __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill : enmyHacking);
+ targetNode.def -= (eff/5 * numCycles);
+ calcStats = true;
+ break;
+ case NodeActions.Weaken:
+ if (nodeObj.conn == null) {break;}
+ var eff = this.calculateWeakenEffect(atk, def, plyr ? __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill : enmyHacking);
+ targetNode.atk -= (eff/5 * numCycles);
+ calcStats = true;
+ break;
+ case NodeActions.Fortify:
+ var eff = this.calculateFortifyEffect(__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill);
+ nodeObj.def += (eff/5 * numCycles);
+ calcStats = true;
+ break;
+ case NodeActions.Overflow:
+ var eff = this.calculateOverflowEffect(__WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_skill);
+ if (nodeObj.def < eff) {break;}
+ nodeObj.def -= (eff/5 * numCycles);
+ nodeObj.atk += (eff/5 * numCycles);
+ calcStats = true;
+ break;
+ default:
+ console.log("ERR: Invalid Node Action: " + nodeObj.action);
+ break;
+ }
+
+ //Stats can't go below 0
+ if (nodeObj.atk < 0) {nodeObj.atk = 0;}
+ if (nodeObj.def < 0) {nodeObj.def = 0;}
+ if (targetNode && targetNode.atk < 0) {targetNode.atk = 0;}
+ if (targetNode && targetNode.def < 0) {targetNode.def = 0;}
+
+ //Conquering a node
+ if (targetNode && targetNode.hp <= 0) {
+ var conqueredByPlayer = nodeObj.plyrCtrl;
+ targetNode.hp = targetNode.maxhp;
+ targetNode.action = null;
+ targetNode.conn = null;
+ if (this.selectedNode == targetNode) {
+ targetNode.deselect(this.actionButtons);
+ }
+
+ //The conquered node has its stats reduced
+ targetNode.atk /= 2;
+ targetNode.def /= 3.5;
+
+ //Flag for whether the target node was a misc node
+ var isMiscNode = !targetNode.plyrCtrl && !targetNode.enmyCtrl;
+
+ //Remove all connections from Node
+ this.dropAllConnectionsToNode(targetNode);
+ this.dropAllConnectionsFromNode(targetNode);
+
+ //Changes the css class and turn the node into a JsPlumb Source/Target
+ if (conqueredByPlayer) {
+ targetNode.setControlledByPlayer();
+ this.jsplumbinstance.unmakeTarget(targetNode.el);
+ this.jsplumbinstance.makeSource(targetNode.el, {
+ deleteEndpointsOnEmpty:true,
+ maxConnections:1,
+ anchor:"Continuous",
+ connector:"Flowchart"
+ });
+ } else {
+ targetNode.setControlledByEnemy();
+ nodeObj.conn = null; //Clear connection
+ this.jsplumbinstance.unmakeSource(targetNode.el);
+ this.jsplumbinstance.makeTarget(targetNode.el, {
+ maxConnections:-1,
+ anchor:"Continuous",
+ connector:["Flowchart"]
+ });
+ }
+
+ calcStats = true;
+
+ //Helper function to swap nodes between the respective enemyNodes/playerNodes arrays
+ function swapNodes(orig, dest, targetNode) {
+ for (var i = 0; i < orig.length; ++i) {
+ if (orig[i] == targetNode) {
+ var node = orig.splice(i, 1);
+ node = node[0];
+ dest.push(node);
+ break;
+ }
+ }
+ }
+
+ switch(targetNode.type) {
+ case NodeTypes.Core:
+ if (conqueredByPlayer) {
+ swapNodes(this.enemyCores, this.playerCores, targetNode);
+ this.configurePlayerNodeElement(targetNode.el);
+ } else {
+ swapNodes(this.playerCores, this.enemyCores, targetNode);
+ this.configureEnemyNodeElement(targetNode.el);
+ }
+ break;
+ case NodeTypes.Firewall:
+ if (conqueredByPlayer) {
+ swapNodes(this.enemyNodes, this.playerNodes, targetNode);
+ } else {
+ swapNodes(this.playerNodes, this.enemyNodes, targetNode);
+ }
+ break;
+ case NodeTypes.Database:
+ if (conqueredByPlayer) {
+ swapNodes(this.enemyDatabases, this.playerNodes, targetNode);
+ } else {
+ swapNodes(this.playerNodes, this.enemyDatabases, targetNode);
+ }
+ break;
+ case NodeTypes.Spam:
+ if (conqueredByPlayer) {
+ swapNodes(isMiscNode ? this.miscNodes : this.enemyNodes, this.playerNodes, targetNode);
+ //Conquering spam node increases time limit
+ this.time += __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].HackingMissionSpamTimeIncrease;
+ } else {
+ swapNodes(isMiscNode ? this.miscNodes : this.playerNodes, this.enemyNodes, targetNode);
+ }
+
+ break;
+ case NodeTypes.Transfer:
+ //Conquering a Transfer node increases the attack of all cores by some percentages
+ if (conqueredByPlayer) {
+ swapNodes(isMiscNode ? this.miscNodes : this.enemyNodes, this.playerNodes, targetNode);
+ this.playerCores.forEach(function(node) {
+ node.atk *= __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].HackingMissionTransferAttackIncrease;
+ });
+ this.configurePlayerNodeElement(targetNode.el);
+ } else {
+ swapNodes(isMiscNode ? this.miscNodes : this.playerNodes, this.enemyNodes, targetNode);
+ this.enemyCores.forEach(function(node) {
+ node.atk *= __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].HackingMissionTransferAttackIncrease;
+ });
+ this.configureEnemyNodeElement(targetNode.el);
+ }
+ break;
+ case NodeTypes.Shield:
+ if (conqueredByPlayer) {
+ swapNodes(isMiscNode ? this.miscNodes : this.enemyNodes, this.playerNodes, targetNode);
+ this.configurePlayerNodeElement(targetNode.el);
+ } else {
+ swapNodes(isMiscNode ? this.miscNodes : this.playerNodes, this.enemyNodes, targetNode);
+ }
+ break;
+ }
+
+ //If a misc node was conquered, the defense for all misc nodes increases by some fixed amount
+ if (isMiscNode) { //&& conqueredByPlayer) {
+ this.miscNodes.forEach((node)=>{
+ if (node.targetedCount === 0) {
+ node.def *= __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].HackingMissionMiscDefenseIncrease;
+ }
+ });
+ }
+ }
+
+ //Update node DOMs
+ this.updateNodeDomElement(nodeObj);
+ if (targetNode) {this.updateNodeDomElement(targetNode);}
+ return calcStats;
+}
+
+//Enemy "AI" for CPU Core and Transfer Nodes
+HackingMission.prototype.enemyAISelectAction = function(nodeObj) {
+ if (nodeObj == null) {return;}
+ switch(nodeObj.type) {
+ case NodeTypes.Core:
+ //Select a single RANDOM target from miscNodes and player's Nodes
+ //If it is reachable, it will target it. If not, no target will
+ //be selected for now, and the next time process() gets called this will repeat
+ if (nodeObj.conn == null) {
+ if (this.miscNodes.length === 0) {
+ //Randomly pick a player node and attack it if its reachable
+ var rand = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(0, this.playerNodes.length-1);
+ var node;
+ if (this.playerNodes.length === 0) {
+ node = null;
+ } else {
+ node = this.playerNodes[rand];
+ }
+ if (this.nodeReachableByEnemy(node)) {
+ //Create connection
+ nodeObj.conn = this.jsplumbinstance.connect({
+ source:nodeObj.el,
+ target:node.el
+ });
+ ++node.targetedCount;
+ } else {
+ //Randomly pick a player core and attack it if its reachable
+ rand = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(0, this.playerCores.length-1);
+ if (this.playerCores.length === 0) {
+ return; //No Misc Nodes, no player Nodes, no Player cores. Player lost
+ } else {
+ node = this.playerCores[rand];
+ }
+
+ if (this.nodeReachableByEnemy(node)) {
+ //Create connection
+ nodeObj.conn = this.jsplumbinstance.connect({
+ source:nodeObj.el,
+ target:node.el
+ });
+ ++node.targetedCount;
+ }
+ }
+ } else {
+ //Randomly pick a misc node and attack it if its reachable
+ var rand = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(0, this.miscNodes.length-1);
+ var node = this.miscNodes[rand];
+ if (this.nodeReachableByEnemy(node)) {
+ nodeObj.conn = this.jsplumbinstance.connect({
+ source:nodeObj.el,
+ target:node.el,
+ });
+ ++node.targetedCount;
+ }
+ }
+
+ //If no connection was made, set the Core to Fortify
+ nodeObj.action = NodeActions.Fortify;
+ } else {
+ //If this node has a selected target
+ var targetNode;
+ if (nodeObj.conn.target) {
+ targetNode = this.getNodeFromElement(nodeObj.conn.target);
+ } else {
+ targetNode = this.getNodeFromElement(nodeObj.conn.targetId);
+ }
+ if (targetNode == null) {
+ console.log("Error getting Target node Object in enemyAISelectAction()");
+ }
+
+ if (targetNode.def > this.enemyAtk + 15) {
+ if (nodeObj.def < 50) {
+ nodeObj.action = NodeActions.Fortify;
+ } else {
+ nodeObj.action = NodeActions.Overflow;
+ }
+ } else if (Math.abs(targetNode.def - this.enemyAtk) <= 15) {
+ nodeObj.action = NodeActions.Scan;
+ } else {
+ nodeObj.action = NodeActions.Attack;
+ }
+ }
+ break;
+ case NodeTypes.Transfer:
+ //Switch between fortifying and overflowing as necessary
+ if (nodeObj.def < 125) {
+ nodeObj.action = NodeActions.Fortify;
+ } else {
+ nodeObj.action = NodeActions.Overflow;
+ }
+ break;
+ case NodeTypes.Firewall:
+ case NodeTypes.Shield:
+ nodeObj.action = NodeActions.Fortify;
+ break;
+ default:
+ break;
+ }
+}
+
+var hackEffWeightSelf = 130; //Weight for Node actions on self
+var hackEffWeightTarget = 25; //Weight for Node Actions against Target
+var hackEffWeightAttack = 80; //Weight for Attack action
+
+//Returns damage per cycle based on stats
+HackingMission.prototype.calculateAttackDamage = function(atk, def, hacking = 0) {
+ return Math.max(0.55 * (atk + (hacking / hackEffWeightAttack) - def), 1);
+}
+
+HackingMission.prototype.calculateScanEffect = function(atk, def, hacking=0) {
+ return Math.max(0.6 * ((atk) + hacking / hackEffWeightTarget - (def * 0.95)), 2);
+}
+
+HackingMission.prototype.calculateWeakenEffect = function(atk, def, hacking=0) {
+ return Math.max((atk) + hacking / hackEffWeightTarget - (def * 0.95), 2);
+}
+
+HackingMission.prototype.calculateFortifyEffect = function(hacking=0) {
+ return 0.6 * hacking / hackEffWeightSelf;
+}
+
+HackingMission.prototype.calculateOverflowEffect = function(hacking=0) {
+ return 0.95 * hacking / hackEffWeightSelf;
+}
+
+//Updates timer display
+HackingMission.prototype.updateTimer = function() {
+ var timer = document.getElementById("hacking-mission-timer");
+
+ //Convert time remaining to a string of the form mm:ss
+ var seconds = Math.round(this.time / 1000);
+ var minutes = Math.trunc(seconds / 60);
+ seconds %= 60;
+ var str = ("0" + minutes).slice(-2) + ":" + ("0" + seconds).slice(-2);
+ timer.innerText = "Time left: " + str;
+}
+
+//The 'win' argument is a bool for whether or not the player won
+HackingMission.prototype.finishMission = function(win) {
+ inMission = false;
+ currMission = null;
+
+ if (win) {
+ var favorMult = 1 + (this.faction.favor / 100);
+ console.log("Hacking mission base reward: " + this.reward);
+ console.log("favorMult: " + favorMult);
+ console.log("rep mult: " + __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].faction_rep_mult);
+ var gain = this.reward * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].faction_rep_mult * favorMult;
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Mission won! You earned " +
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_StringHelperFunctions_js__["c" /* formatNumber */])(gain, 3) + " reputation with " + this.faction.name);
+ __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].gainIntelligenceExp(this.difficulty * __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].IntelligenceHackingMissionBaseExpGain);
+ this.faction.playerReputation += gain;
+ } else {
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Mission lost/forfeited! You did not gain any faction reputation.");
+ }
+
+ //Clear mission container
+ var container = document.getElementById("mission-container");
+ while(container.firstChild) {
+ container.removeChild(container.firstChild);
+ }
+
+ //Return to Faction page
+ document.getElementById("mainmenu-container").style.visibility = "visible";
+ document.getElementById("character-overview-wrapper").style.visibility = "visible";
+ __WEBPACK_IMPORTED_MODULE_1__engine_js__["Engine"].loadFactionContent();
+ Object(__WEBPACK_IMPORTED_MODULE_2__Faction_js__["c" /* displayFactionContent */])(this.faction.name);
+}
+
+
+
+/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(9)))
+
/***/ }),
/* 29 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
@@ -36506,17 +36826,17 @@ var __WEBPACK_AMD_DEFINE_RESULT__;/*! decimal.js v7.2.3 https://github.com/MikeM
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return PositionTypes; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Constants_js__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__engine_js__ = __webpack_require__(5);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Location_js__ = __webpack_require__(13);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__NetscriptFunctions_js__ = __webpack_require__(19);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__ = __webpack_require__(11);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Location_js__ = __webpack_require__(12);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__NetscriptFunctions_js__ = __webpack_require__(22);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__ = __webpack_require__(10);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Player_js__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_DialogBox_js__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__ = __webpack_require__(2);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__ = __webpack_require__(8);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_numeral_min_js__ = __webpack_require__(18);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__ = __webpack_require__(7);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_numeral_min_js__ = __webpack_require__(17);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_numeral_min_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_9__utils_numeral_min_js__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_StringHelperFunctions_js__ = __webpack_require__(4);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__utils_YesNoBox_js__ = __webpack_require__(22);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__utils_YesNoBox_js__ = __webpack_require__(14);
@@ -36761,135 +37081,135 @@ function initStockMarket() {
}
var ecorp = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].AevumECorp;
- var ecorpStk = new Stock(ecorp, StockSymbols[ecorp], 0.45, true, 19, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(20000, 25000));
+ var ecorpStk = new Stock(ecorp, StockSymbols[ecorp], 0.45, true, 19, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(20000, 25000));
StockMarket[ecorp] = ecorpStk;
var megacorp = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].Sector12MegaCorp;
- var megacorpStk = new Stock(megacorp, StockSymbols[megacorp], 0.45, true, 19, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(25000, 33000));
+ var megacorpStk = new Stock(megacorp, StockSymbols[megacorp], 0.45, true, 19, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(25000, 33000));
StockMarket[megacorp] = megacorpStk;
var blade = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].Sector12BladeIndustries;
- var bladeStk = new Stock(blade, StockSymbols[blade], 0.75, true, 13, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(15000, 22000));
+ var bladeStk = new Stock(blade, StockSymbols[blade], 0.75, true, 13, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(15000, 22000));
StockMarket[blade] = bladeStk;
var clarke = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].AevumClarkeIncorporated;
- var clarkeStk = new Stock(clarke, StockSymbols[clarke], 0.7, true, 12, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(15000, 20000));
+ var clarkeStk = new Stock(clarke, StockSymbols[clarke], 0.7, true, 12, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(15000, 20000));
StockMarket[clarke] = clarkeStk;
var omnitek = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].VolhavenOmniTekIncorporated;
- var omnitekStk = new Stock(omnitek, StockSymbols[omnitek], 0.65, true, 12, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(35000, 40000));
+ var omnitekStk = new Stock(omnitek, StockSymbols[omnitek], 0.65, true, 12, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(35000, 40000));
StockMarket[omnitek] = omnitekStk;
var foursigma = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].Sector12FourSigma;
- var foursigmaStk = new Stock(foursigma, StockSymbols[foursigma], 1.05, true, 17, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(60000, 70000));
+ var foursigmaStk = new Stock(foursigma, StockSymbols[foursigma], 1.05, true, 17, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(60000, 70000));
StockMarket[foursigma] = foursigmaStk;
var kuaigong = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].ChongqingKuaiGongInternational;
- var kuaigongStk = new Stock(kuaigong, StockSymbols[kuaigong], 0.8, true, 10, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(20000, 24000));
+ var kuaigongStk = new Stock(kuaigong, StockSymbols[kuaigong], 0.8, true, 10, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(20000, 24000));
StockMarket[kuaigong] = kuaigongStk;
var fulcrum = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].AevumFulcrumTechnologies;
- var fulcrumStk = new Stock(fulcrum, StockSymbols[fulcrum], 1.25, true, 16, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(30000, 35000));
+ var fulcrumStk = new Stock(fulcrum, StockSymbols[fulcrum], 1.25, true, 16, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(30000, 35000));
StockMarket[fulcrum] = fulcrumStk;
var storm = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].IshimaStormTechnologies;
- var stormStk = new Stock(storm, StockSymbols[storm], 0.85, true, 7, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(21000, 24000));
+ var stormStk = new Stock(storm, StockSymbols[storm], 0.85, true, 7, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(21000, 24000));
StockMarket[storm] = stormStk;
var defcomm = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].NewTokyoDefComm;
- var defcommStk = new Stock(defcomm, StockSymbols[defcomm], 0.65, true, 10, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(10000, 15000));
+ var defcommStk = new Stock(defcomm, StockSymbols[defcomm], 0.65, true, 10, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(10000, 15000));
StockMarket[defcomm] = defcommStk;
var helios = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].VolhavenHeliosLabs;
- var heliosStk = new Stock(helios, StockSymbols[helios], 0.6, true, 9, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(12000, 16000));
+ var heliosStk = new Stock(helios, StockSymbols[helios], 0.6, true, 9, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(12000, 16000));
StockMarket[helios] = heliosStk;
var vitalife = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].NewTokyoVitaLife;
- var vitalifeStk = new Stock(vitalife, StockSymbols[vitalife], 0.75, true, 7, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(10000, 12000));
+ var vitalifeStk = new Stock(vitalife, StockSymbols[vitalife], 0.75, true, 7, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(10000, 12000));
StockMarket[vitalife] = vitalifeStk;
var icarus = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].Sector12IcarusMicrosystems;
- var icarusStk = new Stock(icarus, StockSymbols[icarus], 0.65, true, 7.5, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(16000, 20000));
+ var icarusStk = new Stock(icarus, StockSymbols[icarus], 0.65, true, 7.5, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(16000, 20000));
StockMarket[icarus] = icarusStk;
var universalenergy = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].Sector12UniversalEnergy;
- var universalenergyStk = new Stock(universalenergy, StockSymbols[universalenergy], 0.55, true, 10, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(20000, 25000));
+ var universalenergyStk = new Stock(universalenergy, StockSymbols[universalenergy], 0.55, true, 10, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(20000, 25000));
StockMarket[universalenergy] = universalenergyStk;
var aerocorp = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].AevumAeroCorp;
- var aerocorpStk = new Stock(aerocorp, StockSymbols[aerocorp], 0.6, true, 6, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(10000, 15000));
+ var aerocorpStk = new Stock(aerocorp, StockSymbols[aerocorp], 0.6, true, 6, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(10000, 15000));
StockMarket[aerocorp] = aerocorpStk;
var omnia = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].VolhavenOmniaCybersystems;
- var omniaStk = new Stock(omnia, StockSymbols[omnia], 0.7, true, 4.5, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(9000, 12000));
+ var omniaStk = new Stock(omnia, StockSymbols[omnia], 0.7, true, 4.5, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(9000, 12000));
StockMarket[omnia] = omniaStk;
var solaris = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].ChongqingSolarisSpaceSystems;
- var solarisStk = new Stock(solaris, StockSymbols[solaris], 0.75, true, 8.5, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(18000, 24000));
+ var solarisStk = new Stock(solaris, StockSymbols[solaris], 0.75, true, 8.5, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(18000, 24000));
StockMarket[solaris] = solarisStk;
var globalpharm = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].NewTokyoGlobalPharmaceuticals;
- var globalpharmStk = new Stock(globalpharm, StockSymbols[globalpharm], 0.6, true, 10.5, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(18000, 24000));
+ var globalpharmStk = new Stock(globalpharm, StockSymbols[globalpharm], 0.6, true, 10.5, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(18000, 24000));
StockMarket[globalpharm] = globalpharmStk;
var nova = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].IshimaNovaMedical;
- var novaStk = new Stock(nova, StockSymbols[nova], 0.75, true, 5, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(18000, 24000));
+ var novaStk = new Stock(nova, StockSymbols[nova], 0.75, true, 5, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(18000, 24000));
StockMarket[nova] = novaStk;
var watchdog = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].AevumWatchdogSecurity;
- var watchdogStk = new Stock(watchdog, StockSymbols[watchdog], 2.5, true, 1.5, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(5000, 7500));
+ var watchdogStk = new Stock(watchdog, StockSymbols[watchdog], 2.5, true, 1.5, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(5000, 7500));
StockMarket[watchdog] = watchdogStk;
var lexocorp = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].VolhavenLexoCorp;
- var lexocorpStk = new Stock(lexocorp, StockSymbols[lexocorp], 1.25, true, 6, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(5000, 7500));
+ var lexocorpStk = new Stock(lexocorp, StockSymbols[lexocorp], 1.25, true, 6, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(5000, 7500));
StockMarket[lexocorp] = lexocorpStk;
var rho = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].AevumRhoConstruction;
- var rhoStk = new Stock(rho, StockSymbols[rho], 0.6, true, 1, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(3000, 6000));
+ var rhoStk = new Stock(rho, StockSymbols[rho], 0.6, true, 1, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(3000, 6000));
StockMarket[rho] = rhoStk;
var alpha = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].Sector12AlphaEnterprises;
- var alphaStk = new Stock(alpha, StockSymbols[alpha], 1.9, true, 10, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(5000, 7500));
+ var alphaStk = new Stock(alpha, StockSymbols[alpha], 1.9, true, 10, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(5000, 7500));
StockMarket[alpha] = alphaStk;
var syscore = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].VolhavenSysCoreSecurities;
- var syscoreStk = new Stock(syscore, StockSymbols[syscore], 1.6, true, 3, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(4000, 7000))
+ var syscoreStk = new Stock(syscore, StockSymbols[syscore], 1.6, true, 3, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(4000, 7000))
StockMarket[syscore] = syscoreStk;
var computek = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].VolhavenCompuTek;
- var computekStk = new Stock(computek, StockSymbols[computek], 0.9, true, 4, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(2000, 5000));
+ var computekStk = new Stock(computek, StockSymbols[computek], 0.9, true, 4, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(2000, 5000));
StockMarket[computek] = computekStk;
var netlink = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].AevumNetLinkTechnologies;
- var netlinkStk = new Stock(netlink, StockSymbols[netlink], 4.2, true, 1, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(2000, 4000));
+ var netlinkStk = new Stock(netlink, StockSymbols[netlink], 4.2, true, 1, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(2000, 4000));
StockMarket[netlink] = netlinkStk;
var omega = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].IshimaOmegaSoftware;
- var omegaStk = new Stock(omega, StockSymbols[omega], 1, true, 0.5, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(3000, 6000));
+ var omegaStk = new Stock(omega, StockSymbols[omega], 1, true, 0.5, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(3000, 6000));
StockMarket[omega] = omegaStk;
var fns = __WEBPACK_IMPORTED_MODULE_2__Location_js__["a" /* Locations */].Sector12FoodNStuff;
- var fnsStk = new Stock(fns, StockSymbols[fns], 0.75, false, 1, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(1000, 4000));
+ var fnsStk = new Stock(fns, StockSymbols[fns], 0.75, false, 1, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(1000, 4000));
StockMarket[fns] = fnsStk;
var sigmacosm = "Sigma Cosmetics";
- var sigmacosmStk = new Stock(sigmacosm, StockSymbols[sigmacosm], 2.8, true, 0, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(2000, 3000));
+ var sigmacosmStk = new Stock(sigmacosm, StockSymbols[sigmacosm], 2.8, true, 0, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(2000, 3000));
StockMarket[sigmacosm] = sigmacosmStk;
var joesguns = "Joes Guns";
- var joesgunsStk = new Stock(joesguns, StockSymbols[joesguns], 3.8, true, 1, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(500, 1000));
+ var joesgunsStk = new Stock(joesguns, StockSymbols[joesguns], 3.8, true, 1, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(500, 1000));
StockMarket[joesguns] = joesgunsStk;
var catalyst = "Catalyst Ventures";
- var catalystStk = new Stock(catalyst, StockSymbols[catalyst], 1.45, true, 13.5, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(500, 1000));
+ var catalystStk = new Stock(catalyst, StockSymbols[catalyst], 1.45, true, 13.5, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(500, 1000));
StockMarket[catalyst] = catalystStk;
var microdyne = "Microdyne Technologies";
- var microdyneStk = new Stock(microdyne, StockSymbols[microdyne], 0.75, true, 8, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(20000, 25000));
+ var microdyneStk = new Stock(microdyne, StockSymbols[microdyne], 0.75, true, 8, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(20000, 25000));
StockMarket[microdyne] = microdyneStk;
var titanlabs = "Titan Laboratories";
- var titanlabsStk = new Stock(titanlabs, StockSymbols[titanlabs], 0.6, true, 11, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(15000, 20000));
+ var titanlabsStk = new Stock(titanlabs, StockSymbols[titanlabs], 0.6, true, 11, Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(15000, 20000));
StockMarket[titanlabs] = titanlabsStk;
var orders = {};
@@ -37717,8 +38037,8 @@ function updateStockPlayerPosition(stock) {
if (stock.playerShares === 0 && stock.playerShortShares === 0 &&
StockMarket["Orders"] && StockMarket["Orders"][stock.symbol] &&
StockMarket["Orders"][stock.symbol].length === 0) {
- Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["g" /* removeElementById */])(tickerId + "-hdr");
- Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["g" /* removeElementById */])(tickerId + "-panel");
+ Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["l" /* removeElementById */])(tickerId + "-hdr");
+ Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["l" /* removeElementById */])(tickerId + "-panel");
return;
} else {
//If the ticker hasn't been created, create it (handles updating)
@@ -37798,8 +38118,8 @@ function updateStockOrderList(stock) {
if (stock.playerShares === 0 && stock.playerShortShares === 0 &&
StockMarket["Orders"] && StockMarket["Orders"][stock.symbol] &&
StockMarket["Orders"][stock.symbol].length === 0) {
- Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["g" /* removeElementById */])(tickerId + "-hdr");
- Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["g" /* removeElementById */])(tickerId + "-panel");
+ Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["l" /* removeElementById */])(tickerId + "-hdr");
+ Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["l" /* removeElementById */])(tickerId + "-panel");
return;
} else {
//If the ticker hasn't been created, create it (handles updating)
@@ -37854,7 +38174,7 @@ function updateStockOrderList(stock) {
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return logBoxUpdateText; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return logBoxOpened; });
/* unused harmony export logBoxCurrentScript */
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_NetscriptWorker_js__ = __webpack_require__(11);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_NetscriptWorker_js__ = __webpack_require__(10);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__HelperFunctions_js__ = __webpack_require__(2);
@@ -37905,7 +38225,7 @@ function logBoxCreate(script) {
document.getElementById('log-box-kill-script').style.display = "inline-block";
logBoxOpen();
document.getElementById("log-box-text-header").innerHTML =
- logBoxCurrentScript.filename + " " + Object(__WEBPACK_IMPORTED_MODULE_1__HelperFunctions_js__["f" /* printArray */])(logBoxCurrentScript.args) + ":
";
+ logBoxCurrentScript.filename + " " + Object(__WEBPACK_IMPORTED_MODULE_1__HelperFunctions_js__["j" /* printArray */])(logBoxCurrentScript.args) + ":
";
logBoxCurrentScript.logUpd = true;
logBoxUpdateText();
}
@@ -37931,104 +38251,3469 @@ function logBoxUpdateText() {
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Environment; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__NetscriptFunctions_js__ = __webpack_require__(19);
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Corporation; });
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__engine_js__ = __webpack_require__(5);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Location_js__ = __webpack_require__(12);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_decimal_js__ = __webpack_require__(24);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_decimal_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2__utils_decimal_js__);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__ = __webpack_require__(1);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__ = __webpack_require__(2);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_JSONReviver_js__ = __webpack_require__(7);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js__ = __webpack_require__(17);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js__);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__ = __webpack_require__(4);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__ = __webpack_require__(14);
-/* Environment
- * NetScript program environment
- */
-function Environment(workerScript,parent) {
- if (parent){
- //Create a copy of parent's variables
- //this.vars = parent.vars;
- this.vars = Object.assign({}, parent.vars);
- } else {
- this.vars = Object(__WEBPACK_IMPORTED_MODULE_0__NetscriptFunctions_js__["a" /* NetscriptFunctions */])(workerScript);
- }
- this.parent = parent;
- this.stopFlag = false;
+
+
+
+
+
+
+
+
+
+
+/* State */
+var companyStates = ["START", "PURCHASE", "PRODUCTION", "SALE", "EXPORT"];
+function CorporationState() {
+ this.state = 0;
}
-Environment.prototype = {
- //Create a "subscope", which is a new new "sub-environment"
- //The subscope is linked to this through its parent variable
- extend: function() {
- return new Environment(null, this);
- },
- //Finds the scope where the variable with the given name is defined
- lookup: function(name) {
- var scope = this;
- while (scope) {
- if (Object.prototype.hasOwnProperty.call(scope.vars, name)) {
- return scope;
- }
- scope = scope.parent;
- }
- return null;
- },
-
- //Get the current value of a variable
- get: function(name) {
- if (name in this.vars) {
- return this.vars[name];
- }
- throw new Error("Undefined variable " + name);
- },
-
- //Sets the value of a variable in any scope
- set: function(name, value) {
- var scope = this.lookup(name);
-
- //If scope has a value, then this variable is already set in a higher scope, so
- //set is there. Otherwise, create a new variable in the local scope
- if (scope !== null) {
- return scope.vars[name] = value;
- } else {
- return this.vars[name] = value;
- }
- },
-
- setArrayElement: function(name, idx, value) {
- if (!(idx instanceof Array)) {
- throw new Error("idx parameter is not an Array");
- }
- var scope = this.lookup(name);
- if (!scope && this.parent) {
- throw new Error("Undefined variable " + name);
- }
- var arr = (scope || this).vars[name];
- if (!(arr.constructor === Array || arr instanceof Array)) {
- throw new Error("Variable is not an array: " + name);
- }
- var res = arr;
- for (var iterator = 0; iterator < idx.length-1; ++iterator) {
- var i = idx[iterator];
- if (!(res instanceof Array) || i >= res.length) {
- throw new Error("Out-of-bounds array access");
- }
- res = res[i];
- }
- return res[idx[idx.length-1]] = value;
- },
- /*
- setArrayElement: function(name, idx, value) {
- var scope = this.lookup(name);
- if (!scope && this.parent) {
- console.log("Here");
- throw new Error("Undefined variable " + name);
- }
- var arr = (scope || this).vars[name];
- if (!(arr.constructor === Array || arr instanceof Array)) {
- throw new Error("Variable is not an array: " + name);
- }
- return (scope || this).vars[name][idx] = value;
- },*/
-
- //Creates (or overwrites) a variable in the current scope
- def: function(name, value) {
- return this.vars[name] = value;
+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(__WEBPACK_IMPORTED_MODULE_5__utils_JSONReviver_js__["b" /* Generic_toJSON */])("CorporationState", this);
+}
+
+CorporationState.fromJSON = function(value) {
+ return Object(__WEBPACK_IMPORTED_MODULE_5__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(CorporationState, value.data);
+}
+
+__WEBPACK_IMPORTED_MODULE_5__utils_JSONReviver_js__["c" /* Reviver */].constructors.CorporationState = CorporationState;
+
+/* Constants */
+var TOTALSHARES = 1e9; //Total number of shares you have at your company
+var CyclesPerMarketCycle = 100;
+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 = 5e9;
+var OfficeInitialSize = 3;
+var OfficeUpgradeBaseCost = 1e9;
+
+
+
+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.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 = 750; this.mv = 0.2;
+ this.mku = 15;
+ break;
+ case "Energy":
+ this.dmd = 90; this.dmdR = [80, 100];
+ this.cmp = 80; this.cmpR = [65, 95];
+ this.bCost = 1125; this.mv = 0.2;
+ this.mku = 15;
+ break;
+ case "Food":
+ this.dmd = 80; this.dmdR = [70, 90];
+ this.cmp = 60; this.cmpR = [35, 85];
+ this.bCost = 3750; this.mv = 1;
+ this.mku = 9;
+ break;
+ case "Plants":
+ this.dmd = 70; this.dmdR = [20, 90];
+ this.cmp = 50; this.cmpR = [30, 70];
+ this.bCost = 2250; this.mv = 0.6;
+ this.mku = 12;
+ break;
+ case "Metal":
+ this.dmd = 80; this.dmdR = [75, 85];
+ this.cmp = 70; this.cmpR = [60, 80];
+ this.bCost = 2000; this.mv = 1;
+ this.mku = 15;
+ break;
+ case "Hardware":
+ this.dmd = 85; this.dmdR = [80, 90];
+ this.cmp = 80; this.cmpR = [65, 95];
+ this.bCost = 3000; this.mv = 0.5; //Less mv bc its processed twice
+ this.mku = 7;
+ break;
+ case "Chemicals":
+ this.dmd = 55; this.dmdR = [40, 70];
+ this.cmp = 60; this.cmpR = [40, 80];
+ this.bCost = 5000; this.mv = 1.2;
+ this.mku = 8;
+ break;
+ case "Real Estate":
+ this.dmd = 50; this.dmdR = [5, 100];
+ this.cmp = 50; this.cmpR = [25, 75];
+ this.bCost = 12000; this.mv = 1.5; //Less mv bc its processed twice
+ this.mku = 6;
+ break;
+ case "Drugs":
+ this.dmd = 60; this.dmdR = [45, 75];
+ this.cmp = 70; this.cmpR = [40, 100];
+ this.bCost = 6000; this.mv = 1.6;
+ this.mku = 5;
+ break;
+ case "Robots":
+ this.dmd = 90; this.dmdR = [80, 100];
+ this.cmp = 90; this.cmpR = [80, 100];
+ this.bCost = 15000; this.mv = 0.5; //Less mv bc its processed twice
+ this.mku = 3;
+ break;
+ case "AI Cores":
+ this.dmd = 90; this.dmdR = [80, 100];
+ this.cmp = 90; this.cmpR = [80, 100];
+ this.bCost = 20000; this.mv = 0.8; //Less mv bc its processed twice
+ this.mku = 2;
+ 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) / 100;
+ 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) / 100;
+ 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(__WEBPACK_IMPORTED_MODULE_5__utils_JSONReviver_js__["b" /* Generic_toJSON */])("Material", this);
+}
+
+Material.fromJSON = function(value) {
+ return Object(__WEBPACK_IMPORTED_MODULE_5__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(Material, value.data);
+}
+
+__WEBPACK_IMPORTED_MODULE_5__utils_JSONReviver_js__["c" /* 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 = {
+ [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Aevum]: [0, 0, 0],
+ [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Chongqing]: [0, 0, 0],
+ [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Sector12]: [0, 0, 0],
+ [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].NewTokyo]: [0, 0, 0],
+ [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Ishima]: [0, 0, 0],
+ [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* 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 = {
+ [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Aevum]: [false, 0],
+ [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Chongqing]: [false, 0],
+ [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Sector12]: [false, 0],
+ [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].NewTokyo]: [false, 0],
+ [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Ishima]: [false, 0],
+ [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Volhaven]: [false, 0],
+ }
+
+ this.sllman = {
+ [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Aevum]: [false, 0],
+ [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Chongqing]: [false, 0],
+ [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Sector12]: [false, 0],
+ [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].NewTokyo]: [false, 0],
+ [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Ishima]: [false, 0],
+ [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* 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 totalMult = progrMult * balanceMult * designMult;
+
+ 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);
+ console.log("advMult: " + advMult);
+ this.mku = 100 / (advMult * this.qlt * (busRatio + mgmtRatio));
+ console.log("product mku: " + this.mku);
+ this.dmd = industry.awareness === 0 ? 100 : Math.min(100, advMult * (100 * (industry.popularity / industry.awareness)));
+ this.cmp = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["h" /* 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(__WEBPACK_IMPORTED_MODULE_5__utils_JSONReviver_js__["b" /* Generic_toJSON */])("Product", this);
+}
+
+Product.fromJSON = function(value) {
+ return Object(__WEBPACK_IMPORTED_MODULE_5__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(Product, value.data);
+}
+
+__WEBPACK_IMPORTED_MODULE_5__utils_JSONReviver_js__["c" /* 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: " + __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(IndustryStartingCosts.Energy).format("$0.000a"),
+ Utilities: "Distributes water and provides wastewater services.
" +
+ "Starting cost: " + __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(IndustryStartingCosts.Utilities).format("$0.000a"),
+ Agriculture: "Cultive crops and breed livestock to produce food.
" +
+ "Starting cost: " + __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(IndustryStartingCosts.Agriculture).format("$0.000a"),
+ Fishing: "Produce food through the breeding and processing of fish and fish products
" +
+ "Starting cost: " + __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(IndustryStartingCosts.Fishing).format("$0.000a"),
+ Mining: "Extract and process metals from the earth.
" +
+ "Starting cost: " + __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(IndustryStartingCosts.Mining).format("$0.000a"),
+ Food: "Create your own restaurants all around the world.
" +
+ "Starting cost: " + __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(IndustryStartingCosts.Food).format("$0.000a"),
+ Tobacco: "Create and distribute tobacco and tobacco-related products.
" +
+ "Starting cost: " + __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(IndustryStartingCosts.Tobacco).format("$0.000a"),
+ Chemical: "Product industrial chemicals
" +
+ "Starting cost: " + __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(IndustryStartingCosts.Chemical).format("$0.000a"),
+ Pharmaceutical: "Discover, develop, and create new pharmaceutical drugs.
" +
+ "Starting cost: " + __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(IndustryStartingCosts.Pharmaceutical).format("$0.000a"),
+ Computer: "Develop and manufacture new computer hardware and networking infrastructures.
" +
+ "Starting cost: " + __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(IndustryStartingCosts.Computer).format("$0.000a"),
+ Robotics: "Develop and create robots.
" +
+ "Starting cost: " + __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(IndustryStartingCosts.Robotics).format("$0.000a"),
+ Software: "Develop computer software and create AI Cores.
" +
+ "Starting cost: " + __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(IndustryStartingCosts.Software).format("$0.000a"),
+ Healthcare: "Create and manage hospitals.
" +
+ "Starting cost: " + __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(IndustryStartingCosts.Healthcare).format("$0.000a"),
+ RealEstate: "Develop and manuage real estate properties.
" +
+ "Starting cost: " + __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(IndustryStartingCosts.RealEstate).format("$0.000a"),
+}
+
+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,
+ },
+ [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,
+ }
+}
+
+function Industry(params={}) {
+ this.offices = { //Maps locations to offices. 0 if no office at that location
+ [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Aevum]: 0,
+ [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Chongqing]: 0,
+ [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Sector12]: new OfficeSpace({
+ loc:__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Sector12,
+ size:OfficeInitialSize,
+ }),
+ [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].NewTokyo]: 0,
+ [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Ishima]: 0,
+ [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Volhaven]: 0
+ };
+
+ this.warehouses = { //Maps locations to warehouses. 0 if no warehouse at that location
+ [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Aevum]: 0,
+ [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Chonqing]: 0,
+ [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Sector12]: new Warehouse({
+ loc:__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Sector12,
+ size: WarehouseInitialSize,
+ }),
+ [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].NewTokyo]: 0,
+ [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Ishima]: 0,
+ [__WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* 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 __WEBPACK_IMPORTED_MODULE_2__utils_decimal_js___default.a(0);
+ this.lastCycleExpenses = new __WEBPACK_IMPORTED_MODULE_2__utils_decimal_js___default.a(0);
+ this.thisCycleRevenue = new __WEBPACK_IMPORTED_MODULE_2__utils_decimal_js___default.a(0);
+ this.thisCycleExpenses = new __WEBPACK_IMPORTED_MODULE_2__utils_decimal_js___default.a(0);
+
+ this.state = 0;
+
+ 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.2;
+ this.reqMats = {
+ "Hardware": 0.1,
+ "Metal": 0.25,
+ };
+ this.prodMats = ["Energy"];
+ break;
+ case Industries.Utilities:
+ this.reFac = 0.4;
+ this.sciFac = 0.6;
+ this.robFac = 0.3;
+ this.aiFac = 0.3;
+ this.advFac = 0.2;
+ this.reqMats = {
+ "Hardware": 0.1,
+ "Metal": 0.2,
+ }
+ this.prodMats = ["Water"];
+ break;
+ case Industries.Agriculture:
+ this.reFac = 0.8;
+ this.sciFac = 0.5;
+ this.hwFac = 0.2;
+ this.robFac = 0.3;
+ this.aiFac = 0.3;
+ this.advFac = 0.05;
+ 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.15;
+ this.reqMats = {
+ "Energy": 0.5,
+ }
+ this.prodMats = ["Food"];
+ break;
+ case Industries.Mining:
+ this.reFac = 0.3;
+ this.sciFac = 0.25;
+ this.hwFac = 0.4;
+ this.robFac = 0.5;
+ this.aiFac = 0.5;
+ this.advFac = 0.05;
+ 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.75;
+ 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.6;
+ 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.15;
+ this.robFac = 0.2;
+ this.aiFac = 0.15;
+ this.advFac = 0.1;
+ 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.55;
+ this.reqMats = {
+ "Chemicals": 2,
+ "Energy": 1,
+ "Water": 0.5,
+ }
+ this.prodMats = ["Drugs"];
+ this.makesProducts = true;
+ break;
+ case Industries.Computer:
+ this.reFac = 0.2;
+ this.sciFac = 0.65;
+ this.robFac = 0.4;
+ this.aiFac = 0.2;
+ this.advFac = 0.5;
+ this.reqMats = {
+ "Metal": 2.5,
+ "Energy": 1,
+ }
+ this.prodMats = ["Hardware"];
+ this.makesProducts = true;
+ break;
+ case Industries.Robotics:
+ this.reFac = 0.35;
+ this.sciFac = 0.7;
+ this.aiFac = 0.4;
+ this.advFac = 0.6;
+ this.reqMats = {
+ "Hardware": 5,
+ "Energy": 3,
+ }
+ this.prodMats = ["Robots"];
+ this.makesProducts = true;
+ break;
+ case Industries.Software:
+ this.sciFac = 0.7;
+ this.advFac = 0.5;
+ this.reqMats = {
+ "Hardware": 0.5,
+ "Energy": 1,
+ }
+ this.prodMats = ["AICores"];
+ this.makesProducts = true;
+ break;
+ case Industries.Healthcare:
+ //reFac is unique for this bc it diminishes greatly per city. Handle this separately in code?
+ this.sciFac = 0.75;
+ this.advFac = 0.3;
+ 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.65;
+ 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:
+ 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(city) {
+ var warehouse = this.warehouses[city];
+ if (!(warehouse instanceof Warehouse)) {
+ this.prodMult = 0;
+ return;
+ }
+ var materials = warehouse.materials,
+ office = this.offices[city];
+ //Production is multiplied by this
+ this.prodMult = 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);
+ if (this.prodMult < 1) {this.prodMult = 1;}
+}
+
+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);
+ }
+ }
+}
+
+Industry.prototype.process = function(marketCycles=1, state) {
+ this.state = state;
+
+ //At the start of a cycle, store and reset revenue/expenses
+ //Then calculate salaries and processs the markets
+ if (state === "START") {
+ this.lastCycleRevenue = this.thisCycleRevenue.dividedBy(marketCycles * SecsPerMarketCycle);
+ this.lastCycleExpenses = this.thisCycleExpenses.dividedBy(marketCycles * SecsPerMarketCycle);
+ this.thisCycleRevenue = this.thisCycleRevenue.times(0);
+ this.thisCycleExpenses = this.thisCycleExpenses.times(0);
+
+ //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, this);
+ }
+ }
+ this.thisCycleExpenses = this.thisCycleExpenses.plus(employeeSalary);
+
+ //Process change in demand/competition of materials/products
+ this.processMaterialMarket(marketCycles);
+ this.processProductMarket(marketCycles);
+ return;
+ }
+
+ //Process production, purchase, and import/export of materials
+ var res = this.processMaterials(marketCycles);
+ this.thisCycleRevenue = this.thisCycleRevenue.plus(res[0]);
+ this.thisCycleExpenses = this.thisCycleExpenses.plus(res[1]);
+
+ //Process creation, production & sale of products
+ res = this.processProducts(marketCycles);
+ 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(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["h" /* getRandomInt */])(1, 5) * 0.001;
+ if (this.type === Industries.Pharmaceutical || this.type === Industries.Software ||
+ this.type === Industries.Robotics) {
+ change *= 2.5;
+ }
+ change *= marketCycles;
+ product.dmd -= change;
+ product.cmp += change;
+ }
+ }
+}
+
+//Process production, purchase, and import/export of materials
+Industry.prototype.processMaterials = function(marketCycles=1) {
+ var revenue = 0, expenses = 0;
+ for (var i = 0; i < Cities.length; ++i) {
+ var city = Cities[i], office = this.offices[city];
+
+ if (this.warehouses[city] instanceof Warehouse) {
+ this.calculateProductionFactors(city);
+ 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) {
+ var mat = warehouse.materials[matName];
+ var buyAmt = (mat.buy * SecsPerMarketCycle * marketCycles), maxAmt
+ 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);
+ this.updateWarehouseSizeUsed(warehouse);
+ }
+ } //End process purchase of materials
+ break;
+
+ case "PRODUCTION":
+ /* 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 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
+ }
+ var maxProd = 2 * ratio * Math.pow(total, 0.3), prod;
+
+ if (mat.prdman[0]) {
+ //Production is manually limited
+ prod = Math.min(maxProd, mat.prdman[1]);
+ } else {
+ prod = maxProd;
+ }
+ prod *= (SecsPerMarketCycle * marketCycles * this.prodMult); //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);
+ }
+
+ //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);
+ }
+ }
+ }
+
+ //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 {
+ console.log("Production of materials failed because producableFrac <= 0 or prod <= 0.");
+ console.log("prod: " + prod);
+ }
+ //Per second
+ var fooProd = prod * producableFrac / (SecsPerMarketCycle * marketCycles);
+ for (var fooI = 0; fooI < this.prodMats.length; ++fooI) {
+ warehouse.materials[this.prodMats[fooI]].prd = fooProd;
+ }
+ }
+ 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) {continue;}
+ var mat = warehouse.materials[matName];
+
+ var sCost;
+ if (Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["f" /* 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 maxSell = (mat.qlt + .001) * mat.dmd * (100 - mat.cmp)/100 * markup * businessFactor *
+ (this.awareness === 0 ? 0.01 : (this.popularity + .001) / this.awareness);
+ var sellAmt;
+ if (mat.sllman[1] !== -1) {
+ //Sell amount is manually limited
+ sellAmt = Math.min(maxSell, mat.sllman[1]);
+ } else {
+ sellAmt = maxSell;
+ }
+ sellAmt = (sellAmt * SecsPerMarketCycle * marketCycles);
+ sellAmt = Math.min(mat.qty, sellAmt);
+ if (sellAmt < 0) {
+ console.log("ERROR: sellAmt is negative");
+ continue;
+ }
+ if (sellAmt && sCost) {
+ mat.qty -= sellAmt;
+ revenue += (sellAmt * sCost);
+ mat.sll = sellAmt / (SecsPerMarketCycle * marketCycles);
+ } else {
+ mat.sll = 0;
+ }
+ }
+ } //End processing of sale of materials
+ break;
+
+ /* TODO Process Export of materials */
+
+ case "START":
+ case "EXPORT":
+ 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 += .01 * Math.pow(office.employeeProd[EmployeePositions.RandD], 0.5);
+ }
+ }
+ return [revenue, expenses];
+}
+
+//Process production & sale of this industry's FINISHED products (including all of their stats)
+Industry.prototype.processProducts = function(marketCycles=1) {
+ 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["total"], 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.3));
+ 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);
+ }
+ }
+ }
+ return [revenue, expenses];
+}
+
+//Processes FINISHED products
+Industry.prototype.processProduct = function(marketCycles=1, product) {
+ 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 Product based on
+ //office's productivity, materials, etc.
+ var total = office.employeeProd[EmployeePositions.Operations] +
+ office.employeeProd[EmployeePositions.Engineer] +
+ office.employeeProd[EmployeePositions.Management];
+ var ratio = (office.employeeProd[EmployeePositions.Operations] / total) *
+ (office.employeeProd[EmployeePositions.Engineer] / total) *
+ (office.employeeProd[EmployeePositions.Management] / total);
+ var maxProd = ratio * Math.pow(total, 0.2), 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 *= (this.prodMult * 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);
+ }
+
+ //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) {
+ 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 *= 3;
+ console.log("Product pCost:" + product.pCost);
+
+ var markup = 1, markupLimit = product.rat / product.mku;
+ if (product.sCost > product.pCost) {
+ if ((product.sCost - product.pCost) > markupLimit) {
+ markup = markupLimit / (product.sCost - product.pCost);
+ }
+ }
+ var maxSell = Math.pow(product.rat, 0.95) * product.dmd * (1-(product.cmp/100)) *
+ (this.awareness === 0 ? 0.01 : (this.popularity+0.001) / this.awareness) * markup;
+ var sellAmt;
+ if (product.sllman[city][0] && product.sllman[city][1] > 0) {
+ //Sell amount is manually limited
+ sellAmt = Math.min(maxSell, product.sllman[city][1]);
+ } else {
+ sellAmt = maxSell;
+ }
+ sellAmt = sellAmt * SecsPerMarketCycle * marketCycles;
+ sellAmt = Math.min(product.data[city][0], sellAmt); //data[0] is qty
+ if (sellAmt && product.sCost) {
+ product.data[city][0] -= sellAmt; //data[0] is qty
+ totalProfit += (sellAmt * product.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.toJSON = function() {
+ return Object(__WEBPACK_IMPORTED_MODULE_5__utils_JSONReviver_js__["b" /* Generic_toJSON */])("Industry", this);
+}
+
+Industry.fromJSON = function(value) {
+ return Object(__WEBPACK_IMPORTED_MODULE_5__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(Industry, value.data);
+}
+
+__WEBPACK_IMPORTED_MODULE_5__utils_JSONReviver_js__["c" /* Reviver */].constructors.Industry = Industry;
+
+var EmployeePositions = {
+ Operations: "Operations",
+ Engineer: "Engineer",
+ Business: "Business",
+ Management: "Management",
+ RandD: "Research & Development"
+}
+
+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(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["h" /* getRandomInt */])(50, 100);
+ this.hap = params.happiness ? params.happiness : Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["h" /* getRandomInt */])(50, 100);
+ this.ene = params.energy ? params.energy : Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["h" /* getRandomInt */])(50, 100);
+
+ this.age = params.age ? params.age : Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["h" /* getRandomInt */])(20, 50);
+ this.int = params.intelligence ? params.intelligence : Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["h" /* getRandomInt */])(10, 50);
+ this.cha = params.charisma ? params.charisma : Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["h" /* getRandomInt */])(10, 50);
+ this.exp = params.experience ? params.experience : Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["h" /* getRandomInt */])(10, 50);
+ this.cre = params.creativity ? params.creativity : Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["h" /* getRandomInt */])(10, 50);
+ this.eff = params.efficiency ? params.efficiency : Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["h" /* getRandomInt */])(10, 50);
+ this.sal = params.salary ? params.salary : Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["h" /* getRandomInt */])(0.1, 5);
+ this.pro = 0; //Productivity, This is calculated
+
+ this.loc = params.loc ? params.loc : "";
+ this.pos = params.position ? params.position : EmployeePositions.Operations;
+}
+
+//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;
+ }
+
+ //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() {
+ 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 * this.int) + (0.1 * this.cha) + (this.exp) +
+ (0.5 * this.cre) + (this.eff);
+ break;
+ case EmployeePositions.Engineer:
+ prodMult = (this.int) + (0.1 * this.cha) + (1.5 * this.exp) +
+ (this.eff);
+ break;
+ case EmployeePositions.Business:
+ prodMult = (0.4 * this.int) + (this.cha) + (0.5 * this.exp);
+ break;
+ case EmployeePositions.Management:
+ prodMult = (2 * this.cha) + (this.exp) + (0.2 * this.cre) +
+ (0.7 * this.eff);
+ break;
+ case EmployeePositions.RandD:
+ prodMult = (1.5 * this.int) + (0.8 * this.exp) + (this.cre) +
+ (0.5 * this.eff);
+ break;
+ default:
+ console.log("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) {
+ panel.style.color = "white";
+ panel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("p", {
+ id:"cmpy-mgmt-employee-" + this.name + "-panel-text",
+ innerHTML:"Morale: " + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.mor, 3) + "
" +
+ "Happiness: " + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.hap, 3) + "
" +
+ "Energy: " + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.ene, 3) + "
" +
+ "Age: " + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.age, 3) + "
" +
+ "Intelligence: " + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.int, 3) + "
" +
+ "Charisma: " + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.cha, 3) + "
" +
+ "Experience: " + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.exp, 3) + "
" +
+ "Creativity: " + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.cre, 3) + "
" +
+ "Efficiency: " + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.eff, 3) + "
" +
+ "Salary: " + __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(this.sal).format("$0.000a") + "/ s
",
+ }));
+
+ //Selector for employee position
+ var selector = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("select", {});
+ for (var key in EmployeePositions) {
+ if (EmployeePositions.hasOwnProperty(key)) {
+ selector.add(Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* 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) {
+ 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(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.mor, 3) + "
" +
+ "Happiness: " + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.hap, 3) + "
" +
+ "Energy: " + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.ene, 3) + "
" +
+ "Age: " + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.age, 3) + "
" +
+ "Intelligence: " + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.int, 3) + "
" +
+ "Charisma: " + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.cha, 3) + "
" +
+ "Experience: " + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.exp, 3) + "
" +
+ "Creativity: " + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.cre, 3) + "
" +
+ "Efficiency: " + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.eff, 3) + "
" +
+ "Salary: " + __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(this.sal).format("$0.000a") + "/ s
";
+}
+
+Employee.prototype.toJSON = function() {
+ return Object(__WEBPACK_IMPORTED_MODULE_5__utils_JSONReviver_js__["b" /* Generic_toJSON */])("Employee", this);
+}
+
+Employee.fromJSON = function(value) {
+ return Object(__WEBPACK_IMPORTED_MODULE_5__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(Employee, value.data);
+}
+
+__WEBPACK_IMPORTED_MODULE_5__utils_JSONReviver_js__["c" /* 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, 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);
+ return salaryPaid;
+}
+
+OfficeSpace.prototype.calculateEmployeeProductivity = function(marketCycles=1) {
+ //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();
+ this.employeeProd[employee.pos] += prod;
+ total += prod;
+ }
+ this.employeeProd["total"] = total;
+}
+
+//Takes care of UI as well
+OfficeSpace.prototype.findEmployees = function(company) {
+ if (document.getElementById("cmpy-mgmt-hire-employee-popup") != null) {return;}
+
+ //Generate three random employees (meh, decent, amazing)
+ var mult1 = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["h" /* getRandomInt */])(25, 50)/100,
+ mult2 = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["h" /* getRandomInt */])(51, 75)/100,
+ mult3 = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["h" /* getRandomInt */])(76, 100)/100;
+ var int = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["h" /* getRandomInt */])(50, 100),
+ cha = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["h" /* getRandomInt */])(50, 100),
+ exp = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["h" /* getRandomInt */])(50, 100),
+ cre = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["h" /* getRandomInt */])(50, 100),
+ eff = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["h" /* 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(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("h1", {
+ innerHTML: "Select one of the following candidates for hire:",
+ });
+
+ var createEmpDiv = function(employee, office) {
+ var div = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("div", {
+ class:"cmpy-mgmt-find-employee-option",
+ innerHTML: "Intelligence: " + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(employee.int, 1) + "
" +
+ "Charisma: " + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(employee.cha, 1) + "
" +
+ "Experience: " + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(employee.exp, 1) + "
" +
+ "Creativity: " + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(employee.cre, 1) + "
" +
+ "Efficiency: " + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(employee.eff, 1) + "
" +
+ "Salary: " + __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(employee.sal).format('$0.000a') + " \ s
",
+ clickListener:()=>{
+ office.hireEmployee(employee, company);
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["l" /* removeElementById */])("cmpy-mgmt-hire-employee-popup");
+ return false;
+ }
+ });
+ return div;
+ };
+
+ var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ class:"a-link-button",
+ innerText:"Cancel",
+ float:"right",
+ clickListener:()=>{
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["l" /* removeElementById */])("cmpy-mgmt-hire-employee-popup");
+ return false;
+ }
+ });
+
+ var elems = [text,
+ createEmpDiv(emp1, this),
+ createEmpDiv(emp2, this),
+ createEmpDiv(emp3, this),
+ cancelBtn];
+
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["g" /* createPopup */])("cmpy-mgmt-hire-employee-popup", elems);
+}
+
+OfficeSpace.prototype.hireEmployee = function(employee, company) {
+ var yesBtn = Object(__WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__["j" /* yesNoTxtInpBoxGetYesButton */])(),
+ noBtn = Object(__WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__["i" /* yesNoTxtInpBoxGetNoButton */])();
+ yesBtn.innerHTML = "Hire";
+ noBtn.innerHTML = "Cancel";
+ yesBtn.addEventListener("click", ()=>{
+ var name = Object(__WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__["h" /* yesNoTxtInpBoxGetInput */])();
+ for (var i = 0; i < this.employees.length; ++i) {
+ if (this.employees[i].name === name) {
+ Object(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* 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.updateUIContent();
+ return Object(__WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__["f" /* yesNoTxtInpBoxClose */])();
+ });
+ noBtn.addEventListener("click", ()=>{
+ return Object(__WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__["f" /* yesNoTxtInpBoxClose */])();
+ });
+ Object(__WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__["g" /* yesNoTxtInpBoxCreate */])("Give your employee a nickname!");
+}
+
+OfficeSpace.prototype.toJSON = function() {
+ return Object(__WEBPACK_IMPORTED_MODULE_5__utils_JSONReviver_js__["b" /* Generic_toJSON */])("OfficeSpace", this);
+}
+
+OfficeSpace.fromJSON = function(value) {
+ return Object(__WEBPACK_IMPORTED_MODULE_5__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(OfficeSpace, value.data);
+}
+
+__WEBPACK_IMPORTED_MODULE_5__utils_JSONReviver_js__["c" /* Reviver */].constructors.OfficeSpace = OfficeSpace;
+
+function Warehouse(params={}) {
+ this.loc = params.loc ? params.loc : "";
+ this.size = params.size ? params.size : 0;
+ this.sizeUsed = 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;
+ 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 (this.sizeUsed > this.size) {
+ console.log("ERROR: Warehouse size used greater than capacity, something went wrong");
+ }
+}
+
+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(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["k" /* removeChildrenFromElement */])(industryWarehousePanel);
+ var storageText = "Storage: " +
+ (this.sizedUsed >= this.size ? Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.sizeUsed, 3) : Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.sizeUsed, 3)) +
+ "/" + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.size, 3);
+ industryWarehousePanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("p", {
+ innerHTML: storageText,
+ display:"inline-block",
+ color: this.sizeUsed >= this.size ? "red" : "white",
+ }));
+
+ //Upgrade warehouse size button
+ var upgradeCost = WarehouseUpgradeBaseCost * Math.pow(1.07, Math.round(this.size / 100) - 1);
+ industryWarehousePanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ innerText:"Upgrade Warehouse Size - " + __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(upgradeCost).format('$0.000a'),
+ display:"inline-block",
+ class: company.funds.lt(upgradeCost) ? "a-link-button-inactive" : "a-link-button",
+ clickListener:()=>{
+ this.size += 100;
+ company.funds = company.funds.minus(upgradeCost);
+ this.createUI(parentRefs);
+ return;
+ }
+ }));
+
+ //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.
" +
+ "Current state: ";
+ switch(industry.state) {
+ case "START":
+ reqText += "Preparing...";
+ break;
+ case "PURCHASE":
+ reqText += "Purchasing materials...";
+ break;
+ case "PRODUCTION":
+ reqText += "Producing materials and/or products...";
+ break;
+ case "SALE":
+ reqText += "Selling materials and/or products...";
+ break;
+ case "EXPORT":
+ reqText += "Exporting materials and/or products...";
+ break;
+ default:
+ console.log("ERROR: Invalid state: " + industry.state);
+ break;
+ }
+ industryWarehousePanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("p", {
+ innerHTML:reqText,
+ }));
+
+ //Materials
+ industryWarehousePanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("p", {
+ innerHTML: "
Materials:
",
+ }));
+ 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") {
+ this.createMaterialUI(this.materials[matName], matName, parentRefs);
+ }
+ }
+ }
+
+ //Products
+ if (!(industry.makesProducts && Object.keys(industry.products).length > 0)) {return;}
+ industryWarehousePanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("p", {
+ innerHTML: "
Products:
",
+ }));
+ for (var productName in industry.products) {
+ if (industry.products.hasOwnProperty(productName) && industry.products[productName] instanceof Product) {
+ 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(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("div", {
+ class:"cmpy-mgmt-warehouse-material-div",
+ });
+
+ //Storage size
+ var totalExport = 0;
+ for (var i = 0; i < mat.exp.length; ++i) {
+ totalExport += mat.exp[i].amt;
+ }
+ var totalGain = mat.buy + mat.prd + mat.imp - mat.sll - totalExport;
+ div.appendChild(Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("p", {
+ innerHTML: "
Prod: " + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(mat.prd, 3) + "/s
Sell: " + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(mat.sll, 3) +
+ "/s
Export: " + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(totalExport, 3) + "/s
Import: " +
+ Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(mat.imp, 3) + "/s
" +
+ "
" +
+ "
" +
+ "City: " + mat.exp[i].city + "
" +
+ "Amount/s: " + mat.exp[i].amt,
+ clickListener:()=>{
+ mat.exp[i].splice(i, 1);
+
+ //Go to the target city and decrease the mat.imp attribute for the corresponding material
+ for (var i = 0; i < company.divisions.length; ++i) {
+ if (company.divisions[i].name === mat.exp[i].ind) {
+ var warehouse = company.divisions[i].warehouses[mat.exp[i].city];
+ if (warehouse instanceof Warehouse) {
+ warehouse.materials[matName].imp -= mat.exp[i].amt;
+ return false;
+ } else {
+ console.log("ERROR: Target city for export does not have warehouse in specified city");
+ }
+ }
+ }
+ }
+ }));
+ })(i, mat, currExports);
+ }
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["g" /* createPopup */])(popupId, [exportTxt, industrySelector, citySelector, exportAmount,
+ exportBtn, cancelBtn, currExportsText].concat(currExports));
+ }
+ }));
+
+
+ buttonPanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("br", {})); // Force line break
+
+ //Button to set sell amount
+ var innerTextString = (mat.sllman[1] === -1 ? "Sell (" + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(mat.sll, 3) + "/MAX)" :
+ "Sell (" + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(mat.sll, 3) + "/" + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(mat.sllman[1], 3) + ")")
+ if (mat.sCost) {
+ if (Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["f" /* isString */])(mat.sCost)) {
+ var sCost = mat.sCost.replace(/MP/g, mat.bCost);
+ innerTextString += " @ $" + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(eval(sCost), 2);
+ } else {
+ innerTextString += " @ $" + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(mat.sCost, 2);
+ }
+ }
+ buttonPanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ innerText: innerTextString, display:"inline-block", class:"a-link-button",
+ clickListener:()=>{
+ var txt = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* 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 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 inputQty = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("input", {
+ type:"text", value: mat.sllman[1] ? mat.sllman[1] : null, placeholder: "Sell amount"
+ });
+ var inputPx = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("input", {
+ type:"text", value: mat.sCost ? mat.sCost : null, placeholder: "Sell price"
+ });
+ var confirmBtn = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ innerText:"Confirm",
+ class:"a-link-button",
+ margin:"6px",
+ clickListener:()=>{
+ //Parse price
+ //Sanitize cost
+ var cost = inputPx.value.replace(/\s+/g, '');
+ cost = cost.replace(/[^-()\d/*+.MP]/g, '');
+ var temp = cost.replace(/MP/g, mat.bCost);
+ var temp = eval(temp);
+ if (temp == null || isNaN(temp)) {
+ Object(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* 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 === "MAX") {
+ mat.sllman[0] = true;
+ mat.sllman[1] = -1;
+ } else if (isNaN(inputQty.value)) {
+ Object(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* 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;
+ } else {
+ mat.sllman[0] = true;
+ mat.sllman[1] = qty;
+ }
+ }
+
+ this.createUI(parentRefs);
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["l" /* removeElementById */])(sellPopupid);
+ return false;
+ }
+ });
+ var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ innerText:"Cancel",
+ class:"a-link-button",
+ margin: "6px",
+ clickListener:()=>{
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["l" /* removeElementById */])(sellPopupid);
+ }
+ });
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["g" /* createPopup */])(sellPopupid, [txt, inputQty, inputPx, confirmBtn, cancelBtn]);
+ inputQty.focus();
+ }
+ }));
+
+ industryWarehousePanel.appendChild(div);
+}
+
+Warehouse.prototype.createProductUI = function(product, parentRefs) {
+ var company = parentRefs.company, industry = parentRefs.industry,
+ city = currentCityUi;
+ var div = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("div", {
+ class:"cmpy-mgmt-warehouse-product-div"
+ });
+
+ //Products being designed TODO
+ if (!product.fin) {
+ div.appendChild(Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("p", {
+ innerHTML: "Designing " + product.name + "...
" +
+ Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(product.prog, 2) + "% complete",
+ }));
+ industryWarehousePanel.appendChild(div);
+ return;
+ }
+
+ //Completed products
+ var totalGain = product.data[city][1] - product.data[city][2]; //Production - sale
+ div.appendChild(Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("p", {
+ innerHTML: "
" +
+ "Sell: " + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(product.data[city][2], 3) + "/s
" +
+ "
" +
+ "Performance: " + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(product.per, 3) + "
" +
+ "Durability: " + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(product.dur, 3) + "
" +
+ "Reliability: " + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(product.rel, 3) + "
" +
+ "Aesthetics: " + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(product.aes, 3) + "
" +
+ "Features: " + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(product.fea, 3) + "
" +
+ "
" +
+ "Size: " + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(product.siz, 3),
+ }));
+ var buttonPanel = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("div", {
+ display:"inline-block",
+ });
+ div.appendChild(buttonPanel);
+
+ //Sell button
+ var sellInnerTextString = (product.sllman[city][1] === -1 ? "Sell (" + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(product.data[city][2], 3) + "/MAX)" :
+ "Sell (" + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(product.data[city][2], 3) + "/" + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(product.sllman[city][1], 3) + ")");
+ if (product.sCost) {
+ sellInnerTextString += (" @ " + __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(product.sCost).format("$0.000a"));
+ }
+ div.appendChild(Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ innerText:sellInnerTextString, class:"a-link-button", display:"inline-block",margin:"6px",
+ clickListener:()=>{
+ var popupId = "cmpy-mgmt-sell-product-popup";
+ var txt = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("p", {
+ innerHTML:"Enter the maximum amount of " + product.name + " you would like " +
+ "to sell per second, as well as the price at which you would like to " +
+ "sell it at.
" +
+ "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.
",
+ });
+ var inputQty = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("input", {
+ type:"text", value:product.sllman[city][1] ? product.sllman[city][1] : null, placeholder: "Sell amount"
+ });
+ var inputPx = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("input", {
+ type:"text", value: product.sCost ? product.sCost : null, placeholder: "Sell price"
+ });
+ var confirmBtn = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ class:"a-link-button", innerText:"Confirm",
+ clickListener:()=>{
+ //Parse price
+ var cost = parseFloat(inputPx.value);
+ if (isNaN(cost)) {
+ Object(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Invalid value for sell price field");
+ return false;
+ }
+ product.sCost = cost;
+
+ //Parse quantity
+ if (inputQty.value === "MAX") {
+ product.sllman[city][0] = true;
+ product.sllman[city][1] = -1;
+ } else if (isNaN(inputQty.value)) {
+ Object(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* 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(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId);
+ return false;
+ }
+ });
+ var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ class:"a-link-button", innerText:"Cancel",
+ clickListener:()=>{
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId);
+ return false;
+ }
+ });
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["g" /* createPopup */])(popupId, [txt, inputQty, inputPx, confirmBtn, cancelBtn]);
+ inputQty.focus();
+ }
+ }));
+ div.appendChild(Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("br",{})); //force line break
+
+ //Limit production button
+ var limitProductionInnerText = "Limit Production";
+ if (product.prdman[city][0]) {
+ limitProductionInnerText += " (" + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(product.prdman[city][1], 3) + ")";
+ }
+ div.appendChild(Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ class:"a-link-button", innerText:limitProductionInnerText,display:"inline-block",
+ clickListener:()=>{
+ var popupId = "cmpy-mgmt-limit-product-production-popup";
+ var txt = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* 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 input = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("input", {
+ type:"number", placeholder:"Limit"
+ });
+ var confirmBtn = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ class:"a-link-button", display:"inline-block", innerText:"Limit production", margin:'6px',
+ clickListener:()=>{
+ if (input.value === "") {
+ product.prdman[city][0] = false;
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId);
+ return false;
+ }
+ var qty = parseFloat(input.value);
+ if (isNaN(qty)) {
+ Object(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* 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(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId);
+ return false;
+ }
+ });
+ var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ class:"a-link-button", display:"inline-block", innerText:"Cancel", margin:"6px",
+ clickListener:()=>{
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId);
+ return false;
+ }
+ });
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["g" /* createPopup */])(popupId, [txt, input, confirmBtn, cancelBtn]);
+ }
+ }));
+
+ //Discontinue button
+ div.appendChild(Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ class:'a-link-button', display:"inline-block",innerText:"Discontinue",
+ clickListener:()=>{
+ var popupId = "cmpy-mgmt-discontinue-product-popup";
+ var txt = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* 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(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ class:"a-link-button",innerText:"Discontinue",
+ clickListener:()=>{
+ industry.discontinueProduct(product, parentRefs);
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId);
+ return false;
+ }
+ });
+ var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ class:"a-link-button", innerText:"Cancel",
+ clickListener:()=>{
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId);
+ return false;
+ }
+ });
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["g" /* createPopup */])(popupId, [txt, confirmBtn, cancelBtn]);
+ }
+ }));
+ industryWarehousePanel.appendChild(div);
+}
+
+Warehouse.prototype.toJSON = function() {
+ return Object(__WEBPACK_IMPORTED_MODULE_5__utils_JSONReviver_js__["b" /* Generic_toJSON */])("Warehouse", this);
+}
+
+Warehouse.fromJSON = function(value) {
+ return Object(__WEBPACK_IMPORTED_MODULE_5__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(Warehouse, value.data);
+}
+
+__WEBPACK_IMPORTED_MODULE_5__utils_JSONReviver_js__["c" /* Reviver */].constructors.Warehouse = Warehouse;
+
+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 __WEBPACK_IMPORTED_MODULE_2__utils_decimal_js___default.a(150e9);
+ this.revenue = new __WEBPACK_IMPORTED_MODULE_2__utils_decimal_js___default.a(0);
+ this.expenses = new __WEBPACK_IMPORTED_MODULE_2__utils_decimal_js___default.a(0);
+ this.fundingRound = 0;
+ this.public = false; //Publicly traded
+ this.numShares = TOTALSHARES;
+ this.issuedShares = 0;
+ this.sharePrice = 0;
+ this.storedCycles = 0;
+
+ this.state = new CorporationState();
+}
+
+Corporation.prototype.getState = function() {
+ return this.state.getState();
+}
+
+Corporation.prototype.process = function(numCycles=1) {
+ this.storedCycles += numCycles;
+ if (this.storedCycles >= CyclesPerIndustryStateCycle) {
+ var state = this.getState(), marketCycles = 1;
+ this.storedCycles -= (marketCycles * CyclesPerIndustryStateCycle);
+ this.divisions.forEach(function(ind) {
+ ind.process(marketCycles, state);
+ });
+
+ //At the start of a new cycle, calculate profits from previous cycle
+ if (state === "START") {
+ this.revenue = this.revenue.times(0);
+ this.expenses = this.expenses.times(0);
+ this.divisions.forEach((ind)=>{
+ this.revenue = this.revenue.plus(ind.lastCycleRevenue);
+ this.expenses = this.expenses.plus(ind.lastCycleExpenses);
+ });
+ this.funds = this.funds.plus(this.revenue.minus(this.expenses));
+ this.updateSharePrice();
+ }
+ this.state.nextState();
+
+ if (__WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].currentPage === __WEBPACK_IMPORTED_MODULE_0__engine_js__["Engine"].Page.Corporation) {this.updateUIContent();}
+ }
+}
+
+Corporation.prototype.determineValuation = function() {
+ var val, profit = (this.revenue - this.expenses);
+ if (this.public) {
+ val = 50e9 + this.funds + (profit * Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["h" /* getRandomInt */])(7000, 8500));
+ val *= (Math.pow(1.1, this.divisions.length));
+ val = Math.max(val, 0);
+ } else {
+ val = 10e9 + Math.max(this.funds, 0); //Base valuation
+ if (profit > 0) {
+ val += (profit * Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["h" /* getRandomInt */])(12e3, 14e3));
+ 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;
+}
+
+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,
+ investShares = Math.floor(TOTALSHARES * percShares),
+ yesBtn = Object(__WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__["d" /* yesNoBoxGetYesButton */])(),
+ noBtn = Object(__WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__["c" /* yesNoBoxGetNoButton */])();
+ yesBtn.innerHTML = "Accept";
+ noBtn.innerHML = "Reject";
+ yesBtn.addEventListener("click", ()=>{
+ ++this.fundingRound;
+ this.funds = this.funds.plus(funding);
+ this.numShares -= investShares;
+ return Object(__WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__["a" /* yesNoBoxClose */])();
+ });
+ noBtn.addEventListener("click", ()=>{
+ return Object(__WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__["a" /* yesNoBoxClose */])();
+ });
+ Object(__WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__["b" /* yesNoBoxCreate */])("An investment firm has offered you " + __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(funding).format('$0.000a') +
+ " in funding in exchange for a " + __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(percShares*100).format("0.000a") +
+ "% stake in the company (" + __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___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(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* 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. You will receive " +
+ __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(initialSharePrice).format('$0.000a') + " per share.
" +
+ "Furthermore, issuing more shares now will help drive up " +
+ "your company's stock price in the future.
" +
+ "You have a total of " + this.numShares + " of shares that you can issue.",
+ });
+ var input = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("input", {
+ type:"number",
+ placeholder: "Shares to issue",
+ });
+ var yesBtn = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ class:"a-link-button",
+ innerText:"Go Public",
+ clickListener:()=>{
+ var numShares = input.value;
+ var initialSharePrice = this.determineValuation() / (TOTALSHARES);
+ if (isNaN(numShares)) {
+ Object(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Invalid value for number of issued shares");
+ return false;
+ }
+ if (numShares > this.numShares) {
+ Object(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* 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);
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["l" /* removeElementById */])(goPublicPopupId);
+ return false;
+ }
+ });
+ var noBtn = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ class:"a-link-button",
+ innerText:"Cancel",
+ clickListener:()=>{
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["l" /* removeElementById */])(goPublicPopupId);
+ return false;
+ }
+ });
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["g" /* createPopup */])(goPublicPopupId, [txt, 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));
+ }
+}
+
+//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,
+ industryOverviewPanel, industryOverviewText,
+ industryEmployeePanel, industryEmployeeText, industryEmployeeHireButton, industryEmployeeList,
+ industryOfficeUpgradeSizeButton,
+ industryWarehousePanel,
+ headerTabs, cityTabs;
+Corporation.prototype.createUI = function() {
+ companyManagementDiv = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("div", {
+ id:"cmpy-mgmt-container",
+ position:"fixed",
+ class:"generic-menupage-container"
+ });
+ companyManagementHeaderTabs = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* 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(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* 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(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["k" /* 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(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* 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(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* 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(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("div", {
+ class:"popup-box-container",
+ id:"cmpy-mgmt-expand-industry-popup",
+ }),
+ content = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("div", {class:"popup-box-content"}),
+ txt = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("p", {
+ innerHTML: "Create a new division to expand into a new industry:",
+ }),
+ selector = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("select", {
+ class:"cmpy-mgmt-industry-select"
+ }),
+ industryDescription = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("p", {}),
+ nameInput = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("input", {
+ type:"text",
+ id:"cmpy-mgmt-expand-industry-name-input",
+ color:"white",
+ backgroundColor:"black",
+ display:"block",
+ maxLength: 30,
+ pattern:"[a-zA-Z0-9-_]"
+ }),
+ nameLabel = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("label", {
+ for:"cmpy-mgmt-expand-industry-name-input",
+ innerText:"Division name: "
+ }),
+ yesBtn = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* 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(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* dialogBoxCreate */])("This name is already in use!");
+ return false;
+ }
+ }
+ if (this.funds.lt(IndustryStartingCosts[ind])) {
+ Object(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Not enough money to create a new division in this industry");
+ } else if (newDivisionName === "") {
+ Object(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* 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(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["l" /* removeElementById */])("cmpy-mgmt-expand-industry-popup");
+ this.displayDivisionContent(newInd, __WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* Locations */].Sector12);
+ }
+ return false;
+ }
+ }),
+ noBtn = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("span", {
+ class:"popup-box-button",
+ innerText:"Cancel",
+ clickListener: function() {
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["l" /* removeElementById */])("cmpy-mgmt-expand-industry-popup");
+ return false;
+ }
+ });
+
+ //Add industry types to selector
+ for (var key in Industries) {
+ if (Industries.hasOwnProperty(key)) {
+ var ind = Industries[key];
+ selector.add(Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* 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(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("button", {
+ id:tabId,
+ class:"cmpy-mgmt-header-tab",
+ innerText:division.name,
+ clickListener:()=>{
+ this.selectHeaderTab(tab);
+ this.displayDivisionContent(division, __WEBPACK_IMPORTED_MODULE_1__Location_js__["a" /* 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(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("p", {
+ id:"cmpy-mgmt-overview-text",
+ }));
+ if (headerTabs && headerTabs.length >= 1) {
+ this.selectHeaderTab(headerTabs[0]);
+ }
+
+ //Investors
+ if (this.public) {
+ //Sell share buttons
+ var sellShares = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ class:"a-link-button tooltip",
+ innerText:"Sell Shares",
+ display:"inline-block",
+ clickListener:()=>{
+ var popupId = "cmpy-mgmt-sell-shares-popup";
+ var currentStockPrice = this.sharePrice;
+ var txt = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("p", {
+ innerHTML: "Enter the number of shares you would like to sell. The current price of your " +
+ "company's stock is " + __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(currentStockPrice).format("$0.000a"),
+ });
+ var profitIndicator = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("p", {});
+ var input = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("input", {
+ type:"number",
+ placeholder:"Shares to sell",
+ inputListener: ()=> {
+ var numShares = Math.round(input.value);
+ if (isNaN(numShares)) {
+ 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 " +
+ __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(numShares * currentStockPrice).format('$0.000a');
+ }
+ }
+ });
+ var confirmBtn = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ class:"a-link-button",
+ innerText:"Sell shares",
+ display:"inline-block",
+ clickListener:()=>{
+ var shares = Math.round(input.value);
+ if (isNaN(shares)) {
+ Object(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* dialogBoxCreate */])("ERROR: Invalid value for number of shares");
+ } else if (shares > this.numShares) {
+ Object(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* dialogBoxCreate */])("ERROR: You don't have this many shares to sell");
+ } else {
+ this.numShares -= shares;
+ this.issuedShares += shares;
+ //TODO ADD TO PLAYER MONEY
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId);
+ return false;
+ }
+
+ }
+ });
+ var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ class:"a-link-button",
+ innerText:"Cancel",
+ display:"inline-block",
+ clickListener:()=>{
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId);
+ return false;
+ }
+ });
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["g" /* createPopup */])(popupId, [txt, profitIndicator, input, confirmBtn, cancelBtn]);
+ }
+ });
+ var sellSharesTooltip = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("span", {
+ class:"tooltiptext",
+ innerText:"Sell your shares in the company. This is the only way to " +
+ "profit from your business venture.",
+ });
+ sellShares.appendChild(sellSharesTooltip);
+
+ //Buyback shares button
+ var buybackShares = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ class:"a-link-button tooltip",
+ innerText:"Buyback shares",
+ display:"inline-block",
+ clickListener:()=>{
+ var popupId = "cmpy-mgmt-buyback-shares-popup";
+ var currentStockPrice = this.sharePrice;
+ var txt = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("p", {
+ innerHTML: "Enter the number of shares you would like to buy back at market price. The current price of your " +
+ "company's stock is " + __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(currentStockPrice).format("$0.000a"),
+ });
+ var costIndicator = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("p", {});
+ var input = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("input", {
+ type:"number",
+ placeholder:"Shares to sell",
+ inputListener: ()=> {
+ var numShares = Math.round(input.value);
+ //TODO add conditional for if player doesn't have enough money
+ if (isNaN(numShares)) {
+ 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 {
+ costIndicator.innerText = "Purchase " + numShares + " shares for a total of " +
+ __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(numShares * currentStockPrice).format('$0.000a');
+ }
+ }
+ });
+ var confirmBtn = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ class:"a-link-button",
+ innerText:"Sell shares",
+ display:"inline-block",
+ clickListener:()=>{
+ var shares = Math.round(input.value);
+ if (isNaN(shares)) {
+ Object(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* dialogBoxCreate */])("ERROR: Invalid value for number of shares");
+ } else if (shares > this.issuedShares) {
+ Object(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* dialogBoxCreate */])("ERROR: There are not this many oustanding shares to buy back");
+ } else {
+ this.numShares += shares;
+ this.issuedShares -= shares;
+ //TODO REMOVE from Player money
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId);
+ return false;
+ }
+
+ }
+ });
+ var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ class:"a-link-button",
+ innerText:"Cancel",
+ display:"inline-block",
+ clickListener:()=>{
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId);
+ return false;
+ }
+ });
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["g" /* createPopup */])(popupId, [txt, costIndicator, input, confirmBtn, cancelBtn]);
+ }
+ });
+ var buybackSharesTooltip = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("span", {
+ class:"tooltiptext",
+ innerText:"Buy back shares you that previously issued or sold at market " +
+ "price."
+ });
+ buybackShares.appendChild(buybackSharesTooltip);
+
+ companyManagementPanel.appendChild(sellShares);
+ companyManagementPanel.appendChild(buybackShares);
+ } else {
+ var findInvestors = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ class: this.fundingRound >= 4 ? "a-link-button-inactive" : "a-link-button tooltip",
+ innerText: "Find Investors",
+ display:"inline-block",
+ clickListener:()=>{
+ this.getInvestment();
+ }
+ });
+ var findInvestorsTooltip = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* 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(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ class:"a-link-button tooltip",
+ innerText:"Go Public",
+ display:"inline-block",
+ clickListener:()=>{
+ this.goPublic();
+ return false;
+ }
+ });
+ var goPublicTooltip = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* 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);
+ }
+
+ this.updateCorporationOverviewContent();
+}
+
+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 __WEBPACK_IMPORTED_MODULE_2__utils_decimal_js___default.a(0),
+ totalExpenses = new __WEBPACK_IMPORTED_MODULE_2__utils_decimal_js___default.a(0);
+
+ var profit = this.revenue.minus(this.expenses).toNumber(),
+ profitStr = profit >= 0 ? __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(profit).format("$0.000a") : "-" + __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(-1 * profit).format("$0.000a");
+
+ var txt = "Total Funds: " + __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(totalFunds.toNumber()).format('$0.000a') + "
" +
+ "Total Revenue: " + __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(this.revenue.toNumber()).format("$0.000a") + " / s
" +
+ "Total Expenses: " + __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(this.expenses.toNumber()).format("$0.000a") + "/ s
" +
+ "Total Profits: " + profitStr + " / s
" +
+ "Publicly Traded: " + (this.public ? "Yes" : "No") + "
" +
+ "Owned Stock Shares: " + __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(this.numShares).format('0.000a') + "
" +
+ "Stock Price: " + (this.public ? "$" + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(this.sharePrice, 2) : "N/A") + "
";
+ 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(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* 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(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("p", {
+ innerText: "Would you like to expand into a new city by opening an office? " +
+ "This would cost " + __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(OfficeInitialCost).format('$0.000a'),
+ });
+ var citySelector = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("select", {});
+ for (var cityName in division.offices) {
+ if (division.offices.hasOwnProperty(cityName)) {
+ if (!(division.offices[cityName] instanceof OfficeSpace)) {
+ citySelector.add(Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("option", {
+ text: cityName,
+ value: cityName
+ }));
+ }
+ }
+ }
+
+ var confirmBtn = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* 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(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You don't have enough company funds to open a new office!");
+ } else {
+ this.funds = this.funds.minus(OfficeInitialCost);
+ Object(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Opened a new office in " + city + "!");
+ division.offices[city] = new OfficeSpace({
+ loc:city,
+ size:OfficeInitialSize,
+ });
+ this.displayDivisionContent(division, city);
+ }
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId);
+ return false;
+ }
+ });
+ var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ innerText:"Cancel", class:"a-link-button", display:"inline-block", margin:"3px",
+ clickListener:()=>{
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId);
+ return false;
+ }
+ })
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["g" /* createPopup */])(popupId, [text, citySelector, confirmBtn, cancelBtn]);
+ return false;
+ }
+ }));
+ companyManagementPanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("br", {})); // Force line break
+
+ //Left and right panels
+ var leftPanel = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("div", {
+ class:"cmpy-mgmt-industry-left-panel"
+ });
+ var rightPanel = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("div", {
+ class:"cmpy-mgmt-industry-right-panel"
+ });
+ companyManagementPanel.appendChild(leftPanel);
+ companyManagementPanel.appendChild(rightPanel);
+
+ //Different sections (Overview, Employee/Office, and Warehouse)
+ industryOverviewPanel = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("div", {
+ id:"cmpy-mgmt-industry-overview-panel",
+ class:"cmpy-mgmt-industry-overview-panel"
+ });
+ leftPanel.appendChild(industryOverviewPanel);
+
+ industryEmployeePanel = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("div", {
+ id:"cmpy-mgmt-employee-panel",
+ class:"cmpy-mgmt-employee-panel"
+ });
+ leftPanel.appendChild(industryEmployeePanel);
+
+ industryWarehousePanel = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("div", {
+ id:"cmpy-mgmt-warehouse-panel",
+ class:"cmpy-mgmt-warehouse-panel"
+ });
+ rightPanel.appendChild(industryWarehousePanel);
+
+ //Industry overview text element
+ industryOverviewText = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("p", {});
+ industryOverviewPanel.appendChild(industryOverviewText);
+
+ //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:
+ 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(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ class:"a-link-button", innerText:createProductButtonText, margin:"6px", display:"inline-block",
+ clickListener:()=>{
+ var popupId = "cmpy-mgmt-create-product-popup";
+ var txt = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("p", {
+ innerHTML:createProductPopupText,
+ });
+ var designCity = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("select", {});
+ for (var cityName in division.offices) {
+ if (division.offices[cityName] instanceof OfficeSpace) {
+ designCity.add(Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* 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(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("input", {
+ placeholder:foo,
+ });
+ var lineBreak1 = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("br",{});
+ var designInvestInput = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("input", {
+ type:"number",
+ placeholder:"Design investment"
+ });
+ var marketingInvestInput = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("input", {
+ type:"number",
+ placeholder:"Marketing investment"
+ });
+ var confirmBtn = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* 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(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You must specify a name for your product!");
+ } else if (isNaN(designInvest)) {
+ Object(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Invalid value for design investment");
+ } else if (isNaN(marketingInvest)) {
+ Object(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Invalid value for marketing investment");
+ } else if (this.funds.lt(designInvest + marketingInvest)) {
+ Object(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* 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(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId);
+ }
+ this.updateUIContent();
+ return false;
+ }
+ })
+ var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ class:"a-link-button",
+ innerText:"Cancel",
+ clickListener:()=>{
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId);
+ return false;
+ }
+ })
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["g" /* createPopup */])(popupId, [txt, designCity, productNameInput, lineBreak1,
+ designInvestInput, marketingInvestInput, confirmBtn, cancelBtn]);
+ }
+ }));
+ }
+
+ //Employee and Office Panel
+ var office = division.offices[currentCityUi];
+ if (!(office instanceof OfficeSpace)) {
+ console.log("ERROR: Current city for UI does not have an office space");
+ return;
+ }
+ industryEmployeeText = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* 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);
+
+ industryEmployeeHireButton = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ class:"a-link-button",
+ innerText:"Hire Employee",
+ display:"inline-block",
+ clickListener:()=>{
+ office.findEmployees(this);
+ return false;
+ }
+ });
+ industryEmployeePanel.appendChild(industryEmployeeHireButton);
+
+ //Upgrade Office Size button
+ industryOfficeUpgradeSizeButton = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ class:"a-link-button", innerText:"Upgrade Office size", display:"inline-block", margin:"6px",
+ clickListener:()=>{
+ var popupId = "cmpy-mgmt-upgrade-office-size-popup";
+ var upgradeCost = OfficeInitialCost * Math.pow(1.13, Math.round(office.size / OfficeInitialSize));
+ var text = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("p", {
+ innerHTML:"Increase the size of your office space to fit " + OfficeInitialSize +
+ " more employees. This will cost " + __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(upgradeCost).format('$0.000a'),
+ });
+ var confirmBtn = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ class:"a-link-button",
+ display:"inline-block",
+ margin:"8px",
+ innerText:"Upgrade Office Size",
+ clickListener:()=>{
+ if (this.funds.lt(upgradeCost)) {
+ Object(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You don't have enough company funds to purchase this upgrade!");
+ } else {
+ office.size += OfficeInitialSize;
+ this.funds = this.funds.minus(upgradeCost);
+ Object(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Office space increased! It can now hold " + office.size + " employees");
+ this.updateUIContent();
+ }
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId);
+ return false;
+ }
+ });
+ var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ class:"a-link-button",
+ innerText:"Cancel",
+ display:"inline-block",
+ margin:"8px",
+ clickListener:()=>{
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId);
+ return false;
+ }
+ })
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["g" /* createPopup */])(popupId, [text, confirmBtn, cancelBtn]);
+ return false;
+ }
+ });
+ industryEmployeePanel.appendChild(industryOfficeUpgradeSizeButton);
+
+ //Throw Office Party
+ industryEmployeePanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("br",{}));
+ industryEmployeePanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ class:"a-link-button",
+ display:"inline-block",
+ innerText:"Throw Office Party",
+ 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(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("p", {
+ innerText:"Enter the amount of money you would like to spend PER EMPLOYEE " +
+ "on this office party"
+ });
+ var totalCostTxt = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("p", {
+ innerText:"Throwing this party will cost a total of $0"
+ });
+ var input = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("input", {
+ type:"number",
+ 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 " + __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(totalCost).format('$0.000a');
+ }
+ }
+ });
+ var confirmBtn = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ class:"a-link-button",
+ display:"inline-block",
+ innerText:"Throw Party",
+ clickListener:()=>{
+ if (isNaN(input.value) || input.value < 0) {
+ Object(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Invalid value entered");
+ } else {
+ var totalCost = input.value * office.employees.length;
+ if (this.funds.lt(totalCost)) {
+ Object(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* 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(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You threw a party for the office! The morale and happiness " +
+ "of each employee increased by " + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])((mult-1) * 100, 2) + "%.");
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId);
+ }
+ }
+ return false;
+ }
+ });
+ var cancelBtn = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ class:"a-link-button",
+ display:"inline-block",
+ innerText:"Cancel",
+ clickListener:()=>{
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId);
+ return false;
+ }
+ });
+ Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["g" /* createPopup */])(popupId, [txt, totalCostTxt, input, confirmBtn, cancelBtn]);
+ }
+ }));
+
+ //Employee list
+ var industryEmployeeList = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("ul", {
+ id:"cmpy-mgmt-employee-ul"
+ });
+ industryEmployeePanel.appendChild(industryEmployeeList);
+ for (var i = 0; i < office.employees.length; ++i) {
+ (function() {
+ var emp = office.employees[i];
+ var li = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["e" /* createAccordionElement */])({
+ id:"cmpy-mgmt-employee-" + emp.name,
+ hdrText:emp.name,
+ });
+ var panel = li.children[1];
+ if (panel == null) {
+ console.log("ERROR: Could not find employee accordion panel");
+ return;
+ }
+ emp.createUI(panel);
+ industryEmployeeList.appendChild(li);
+ })();
+ }
+
+ //Warehouse Panel
+ var warehouse = division.warehouses[currentCityUi];
+ if (warehouse instanceof Warehouse) {
+ warehouse.createUI({industry:division, company: this});
+ } else {
+ industryWarehousePanel.appendChild(Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* createElement */])("a", {
+ innerText:"Purchase Warehouse ($5b)",
+ class: "a-link-button",
+ clickListener:()=>{
+ if (this.funds.lt(WarehouseInitialCost)) {
+ Object(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* 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.updateDivisionContent(division);
+ }
+ return false;
+ }
+ }));
+ }
+ this.updateDivisionContent(division);
+}
+
+Corporation.prototype.updateDivisionContent = function(division) {
+ if (!(division instanceof Industry)) {
+ console.log("ERROR: Invalid 'division' argument in Corporation.updateDivisionContent");
+ return;
+ }
+ //Industry Overview Text
+ var profit = division.lastCycleRevenue.minus(division.lastCycleExpenses).toNumber(),
+ profitStr = profit >= 0 ? __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(profit).format("$0.000a") : "-" + __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(-1 * profit).format("$0.000a");
+ industryOverviewText.innerHTML =
+ "Industry: " + division.type + "
" +
+ "Awareness: " + division.awareness + "
" +
+ "Popularity: " + division.popularity + "
" +
+ "Revenue: " + __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(division.lastCycleRevenue.toNumber()).format("$0.000a") + " / s
" +
+ "Expenses: " + __WEBPACK_IMPORTED_MODULE_6__utils_numeral_min_js___default()(division.lastCycleExpenses.toNumber()).format("$0.000a") + " /s
" +
+ "Profit: " + profitStr + " / s
" +
+ "
" +
+ "Scientific Research: " + Object(__WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__["c" /* formatNumber */])(division.sciResearch.qty, 3);
+
+ //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";
+ } else {
+ industryEmployeeHireButton.className = "a-link-button";
+ }
+ var employeeList = document.getElementById("cmpy-mgmt-employee-ul");
+ if (employeeList && office instanceof OfficeSpace) {
+ for (var i = 0; i < office.employees.length; ++i) {
+ (function(company) {
+ var emp = office.employees[i];
+ var panel = document.getElementById("cmpy-mgmt-employee-" + emp.name + "-panel");
+ if (panel == null) {
+ var li = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["e" /* createAccordionElement */])({
+ id:"cmpy-mgmt-employee-" + emp.name,
+ hdrText:emp.name,
+ });
+ panel = li.children[1];
+ emp.createUI(panel);
+ employeeList.appendChild(li);
+ return;
+ }
+ emp.updateUI(panel);
+ })(this);
+ }
+ }
+
+ //Warehouse
+ var warehouse = division.warehouses[currentCityUi];
+ if (warehouse instanceof Warehouse) {
+ warehouse.createUI({industry:division, company:this});
+ }
+}
+
+Corporation.prototype.createCityUITab = function(city, division) {
+ var tab = Object(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["f" /* 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(__WEBPACK_IMPORTED_MODULE_4__utils_HelperFunctions_js__["l" /* removeElementById */])(companyManagementDiv.id);}
+
+ //Reset global DOM variables
+ companyManagementDiv = null;
+ companyManagementPanel = null;
+ currentCityUi = null;
+
+ industryOverviewPanel = null;
+ industryOverviewText = null;
+
+ industryEmployeePanel = null;
+ industryEmployeeText = null;
+ industryEmployeeHireButton = null;
+ industryEmployeeList = null;
+
+ industryOfficeUpgradeSizeButton = null;
+
+ industryWarehousePanel = null;
+
+ companyManagementHeaderTabs = null;
+ headerTabs = null;
+ cityTabs = null;
+
+ document.getElementById("character-overview-wrapper").style.visibility = "visible";
+}
+
+Corporation.prototype.toJSON = function() {
+ return Object(__WEBPACK_IMPORTED_MODULE_5__utils_JSONReviver_js__["b" /* Generic_toJSON */])("Corporation", this);
+}
+
+Corporation.fromJSON = function(value) {
+ return Object(__WEBPACK_IMPORTED_MODULE_5__utils_JSONReviver_js__["a" /* Generic_fromJSON */])(Corporation, value.data);
+}
+
+__WEBPACK_IMPORTED_MODULE_5__utils_JSONReviver_js__["c" /* Reviver */].constructors.Corporation = Corporation;
@@ -38375,6 +42060,2276 @@ module.exports = g;
/* 34 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
+"use strict";
+/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return redPillFlag; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return hackWorldDaemon; });
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__BitNode_js__ = __webpack_require__(8);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__engine_js__ = __webpack_require__(5);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Player_js__ = __webpack_require__(0);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Prestige_js__ = __webpack_require__(35);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__SourceFile_js__ = __webpack_require__(36);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Terminal_js__ = __webpack_require__(23);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_DialogBox_js__ = __webpack_require__(1);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__ = __webpack_require__(2);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__ = __webpack_require__(14);
+
+
+
+
+
+
+
+
+
+
+
+/* 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) {
+ redPillFlag = true;
+ __WEBPACK_IMPORTED_MODULE_1__engine_js__["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);
+ }).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 = __WEBPACK_IMPORTED_MODULE_4__SourceFile_js__["b" /* 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 < __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].sourceFiles.length; ++i) {
+ if (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].sourceFiles[i].n === bitNodeNumber) {
+ alreadyOwned = true;
+ ownedSourceFile = __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].sourceFiles[i];
+ break;
+ }
+ }
+
+ if (alreadyOwned && ownedSourceFile) {
+ if (ownedSourceFile.lvl >= 3) {
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_DialogBox_js__["a" /* dialogBoxCreate */])("The Source-File for the BitNode you just destroyed, " + sourceFile.name + ", " +
+ "is already at max level!");
+ } else {
+ ++ownedSourceFile.lvl;
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_DialogBox_js__["a" /* dialogBoxCreate */])(sourceFile.name + " was upgraded to level " + ownedSourceFile.lvl + " for " +
+ "destroying its corresponding BitNode!");
+ }
+ } else {
+ var playerSrcFile = new __WEBPACK_IMPORTED_MODULE_4__SourceFile_js__["a" /* PlayerOwnedSourceFile */](bitNodeNumber, 1);
+ __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].sourceFiles.push(playerSrcFile);
+ if (bitNodeNumber === 5) { //Artificial Intelligence
+ __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].intelligence = 1;
+ }
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You received a Source-File for destroying a Bit Node!
" +
+ sourceFile.name + "
" + sourceFile.info);
+ }
+}
+
+function loadBitVerse(destroyedBitNodeNum) {
+ //Clear the screen
+ var container = document.getElementById("red-pill-container");
+ while (container.firstChild) {
+ container.removeChild(container.firstChild);
+ }
+
+ //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(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["b" /* clearEventListeners */])(elemId);
+ if (elem == null) {return;}
+ if (i === 1 || i === 2 || i === 3 || i === 4 || i === 5 || i === 8 || i === 11) {
+ elem.addEventListener("click", function() {
+ var bitNodeKey = "BitNode" + i;
+ var bitNode = __WEBPACK_IMPORTED_MODULE_0__BitNode_js__["b" /* BitNodes */][bitNodeKey];
+ if (bitNode == null) {
+ console.log("ERROR: Could not find BitNode object for number: " + i);
+ return;
+ }
+ Object(__WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__["b" /* yesNoBoxCreate */])("BitNode-" + i + ": " + bitNode.name + "
" + bitNode.info);
+ createBitNodeYesNoEventListeners(i, destroyedBitNodeNum);
+ });
+ } else {
+ elem.addEventListener("click", function() {
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_DialogBox_js__["a" /* 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 = __WEBPACK_IMPORTED_MODULE_0__BitNode_js__["b" /* BitNodes */][bitNodeStr];
+ if (bitNode == null) {return "O";}
+ return "O" +
+ "" +
+ "BitNode-" + bitNode.number.toString() + "
" + bitNode.name+ "
" +
+ bitNode.desc + "
" +
+ "";
+}
+
+function createBitNodeYesNoEventListeners(newBitNode, destroyedBitNode) {
+ var yesBtn = Object(__WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__["d" /* yesNoBoxGetYesButton */])();
+ yesBtn.innerHTML = "Enter BitNode-" + newBitNode;
+ yesBtn.addEventListener("click", function() {
+ giveSourceFile(destroyedBitNode);
+ redPillFlag = false;
+ var container = document.getElementById("red-pill-container");
+ while (container.firstChild) {
+ container.removeChild(container.firstChild);
+ }
+
+ //Set new Bit Node
+ __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].bitNodeN = newBitNode;
+ console.log("Entering Bit Node " + __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* 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);
+
+ __WEBPACK_IMPORTED_MODULE_5__Terminal_js__["a" /* Terminal */].hackFlag = false;
+
+ Object(__WEBPACK_IMPORTED_MODULE_3__Prestige_js__["b" /* prestigeSourceFile */])();
+ Object(__WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__["a" /* yesNoBoxClose */])();
+ });
+ var noBtn = Object(__WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__["c" /* yesNoBoxGetNoButton */])();
+ noBtn.innerHTML = "Back";
+ noBtn.addEventListener("click", function() {
+ Object(__WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__["a" /* yesNoBoxClose */])();
+ });
+
+}
+
+
+
+/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(9)))
+
+/***/ }),
+/* 35 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return prestigeAugmentation; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return prestigeSourceFile; });
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ActiveScriptsUI_js__ = __webpack_require__(26);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__ = __webpack_require__(20);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__BitNode_js__ = __webpack_require__(8);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Company_js__ = __webpack_require__(21);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__ = __webpack_require__(15);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__engine_js__ = __webpack_require__(5);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Faction_js__ = __webpack_require__(11);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Location_js__ = __webpack_require__(12);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Message_js__ = __webpack_require__(25);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__NetscriptFunctions_js__ = __webpack_require__(22);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__NetscriptWorker_js__ = __webpack_require__(10);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__Player_js__ = __webpack_require__(0);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__Server_js__ = __webpack_require__(6);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__ = __webpack_require__(13);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__StockMarket_js__ = __webpack_require__(29);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__Terminal_js__ = __webpack_require__(23);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__utils_decimal_js__ = __webpack_require__(24);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__utils_decimal_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_16__utils_decimal_js__);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+//Prestige by purchasing augmentation
+function prestigeAugmentation() {
+ Object(__WEBPACK_IMPORTED_MODULE_2__BitNode_js__["c" /* initBitNodeMultipliers */])();
+
+ __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].prestigeAugmentation();
+
+ //Delete all Worker Scripts objects
+ Object(__WEBPACK_IMPORTED_MODULE_10__NetscriptWorker_js__["e" /* prestigeWorkerScripts */])();
+
+ var homeComp = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getHomeComputer();
+ //Delete all servers except home computer
+ Object(__WEBPACK_IMPORTED_MODULE_12__Server_js__["h" /* prestigeAllServers */])();
+
+ //Delete Special Server IPs
+ Object(__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["e" /* prestigeSpecialServerIps */])(); //Must be done before initForeignServers()
+
+ //Reset home computer (only the programs) and add to AllServers
+ Object(__WEBPACK_IMPORTED_MODULE_12__Server_js__["i" /* prestigeHomeComputer */])(homeComp);
+
+ if (Object(__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["f" /* augmentationExists */])(__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["b" /* AugmentationNames */].Neurolink) &&
+ __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["c" /* Augmentations */][__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["b" /* AugmentationNames */].Neurolink].owned) {
+ homeComp.programs.push(__WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].FTPCrackProgram);
+ homeComp.programs.push(__WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram);
+ }
+ if (Object(__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["f" /* augmentationExists */])(__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["b" /* AugmentationNames */].CashRoot) &&
+ __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["c" /* Augmentations */][__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["b" /* AugmentationNames */].CashRoot].owned) {
+ __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].setMoney(new __WEBPACK_IMPORTED_MODULE_16__utils_decimal_js___default.a(1000000));
+ homeComp.programs.push(__WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].BruteSSHProgram);
+ }
+
+ Object(__WEBPACK_IMPORTED_MODULE_12__Server_js__["a" /* AddToAllServers */])(homeComp);
+
+ //Re-create foreign servers
+ Object(__WEBPACK_IMPORTED_MODULE_12__Server_js__["f" /* initForeignServers */])();
+
+ //Darkweb is purchase-able
+ document.getElementById("location-purchase-tor").setAttribute("class", "a-link-button");
+
+ //Gain favor for Companies
+ for (var member in __WEBPACK_IMPORTED_MODULE_3__Company_js__["a" /* Companies */]) {
+ if (__WEBPACK_IMPORTED_MODULE_3__Company_js__["a" /* Companies */].hasOwnProperty(member)) {
+ __WEBPACK_IMPORTED_MODULE_3__Company_js__["a" /* Companies */][member].gainFavor();
+ }
+ }
+
+ //Gain favor for factions
+ for (var member in __WEBPACK_IMPORTED_MODULE_6__Faction_js__["b" /* Factions */]) {
+ if (__WEBPACK_IMPORTED_MODULE_6__Faction_js__["b" /* Factions */].hasOwnProperty(member)) {
+ __WEBPACK_IMPORTED_MODULE_6__Faction_js__["b" /* Factions */][member].gainFavor();
+ }
+ }
+
+ //Stop a Terminal action if there is onerror
+ if (__WEBPACK_IMPORTED_MODULE_5__engine_js__["Engine"]._actionInProgress) {
+ __WEBPACK_IMPORTED_MODULE_5__engine_js__["Engine"]._actionInProgress = false;
+ __WEBPACK_IMPORTED_MODULE_15__Terminal_js__["a" /* Terminal */].finishAction(true);
+ }
+
+ //Re-initialize things - This will update any changes
+ Object(__WEBPACK_IMPORTED_MODULE_6__Faction_js__["f" /* initFactions */])(); //Factions must be initialized before augmentations
+ Object(__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["g" /* initAugmentations */])(); //Calls reapplyAllAugmentations() and resets Player multipliers
+ __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].reapplyAllSourceFiles();
+ Object(__WEBPACK_IMPORTED_MODULE_3__Company_js__["h" /* initCompanies */])();
+
+ //Clear terminal
+ $("#terminal tr:not(:last)").remove();
+ Object(__WEBPACK_IMPORTED_MODULE_15__Terminal_js__["c" /* postNetburnerText */])();
+
+ //Messages
+ Object(__WEBPACK_IMPORTED_MODULE_8__Message_js__["d" /* initMessages */])();
+
+ //Reset Stock market
+ if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hasWseAccount) {
+ Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["g" /* initStockMarket */])();
+ Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["i" /* initSymbolToStockMap */])();
+ }
+ Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["m" /* setStockMarketContentCreated */])(false);
+ var stockMarketList = document.getElementById("stock-market-list");
+ while(stockMarketList.firstChild) {
+ stockMarketList.removeChild(stockMarketList.firstChild);
+ }
+
+ //Gang, in BitNode 2
+ if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].bitNodeN == 2 && __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].inGang()) {
+ var faction = __WEBPACK_IMPORTED_MODULE_6__Faction_js__["b" /* Factions */][__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].gang.facName];
+ if (faction instanceof __WEBPACK_IMPORTED_MODULE_6__Faction_js__["a" /* Faction */]) {
+ Object(__WEBPACK_IMPORTED_MODULE_6__Faction_js__["h" /* joinFaction */])(faction);
+ }
+ }
+
+ //BitNode 3: Corporatocracy
+ if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].bitNodeN === 3) {__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].money = new __WEBPACK_IMPORTED_MODULE_16__utils_decimal_js___default.a(150e9);}
+
+ //BitNode 8: Ghost of Wall Street
+ if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].bitNodeN === 8) {__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].money = new __WEBPACK_IMPORTED_MODULE_16__utils_decimal_js___default.a(100e6);}
+ if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].bitNodeN === 8 || __WEBPACK_IMPORTED_MODULE_9__NetscriptFunctions_js__["d" /* hasWallStreetSF */]) {
+ __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hasWseAccount = true;
+ __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hasTixApiAccess = true;
+ }
+
+ var mainMenu = document.getElementById("mainmenu-container");
+ mainMenu.style.visibility = "visible";
+ __WEBPACK_IMPORTED_MODULE_15__Terminal_js__["a" /* Terminal */].resetTerminalInput();
+ __WEBPACK_IMPORTED_MODULE_5__engine_js__["Engine"].loadTerminalContent();
+
+ //Red Pill
+ if (Object(__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["f" /* augmentationExists */])(__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["b" /* AugmentationNames */].TheRedPill) &&
+ __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["c" /* Augmentations */][__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["b" /* AugmentationNames */].TheRedPill].owned) {
+ var WorldDaemon = __WEBPACK_IMPORTED_MODULE_12__Server_js__["b" /* AllServers */][__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["a" /* SpecialServerIps */][__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["b" /* SpecialServerNames */].WorldDaemon]];
+ var DaedalusServer = __WEBPACK_IMPORTED_MODULE_12__Server_js__["b" /* AllServers */][__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["a" /* SpecialServerIps */][__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["b" /* SpecialServerNames */].DaedalusServer]];
+ if (WorldDaemon && DaedalusServer) {
+ WorldDaemon.serversOnNetwork.push(DaedalusServer.ip);
+ DaedalusServer.serversOnNetwork.push(WorldDaemon.ip);
+ }
+ }
+}
+
+
+//Prestige by destroying Bit Node and gaining a Source File
+function prestigeSourceFile() {
+ Object(__WEBPACK_IMPORTED_MODULE_2__BitNode_js__["c" /* initBitNodeMultipliers */])();
+
+ //Crime statistics
+ __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].prestigeSourceFile();
+
+ //Delete all Worker Scripts objects
+ Object(__WEBPACK_IMPORTED_MODULE_10__NetscriptWorker_js__["e" /* prestigeWorkerScripts */])();
+
+ var homeComp = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getHomeComputer();
+
+ //Delete all servers except home computer
+ Object(__WEBPACK_IMPORTED_MODULE_12__Server_js__["h" /* prestigeAllServers */])(); //Must be done before initForeignServers()
+
+ //Delete Special Server IPs
+ Object(__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["e" /* prestigeSpecialServerIps */])();
+
+ //Reset home computer (only the programs) and add to AllServers
+ Object(__WEBPACK_IMPORTED_MODULE_12__Server_js__["i" /* prestigeHomeComputer */])(homeComp);
+
+ var srcFile1Owned = false;
+ for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].sourceFiles.length; ++i) {
+ if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].sourceFiles[i].n == 1) {
+ srcFile1Owned = true;
+ }
+ }
+ if (srcFile1Owned) {
+ homeComp.setMaxRam(32);
+ } else {
+ homeComp.setMaxRam(8);
+ }
+ homeComp.cpuCores = 1;
+
+ Object(__WEBPACK_IMPORTED_MODULE_12__Server_js__["a" /* AddToAllServers */])(homeComp);
+
+ //Re-create foreign servers
+ Object(__WEBPACK_IMPORTED_MODULE_12__Server_js__["f" /* initForeignServers */])();
+
+ //Darkweb is purchase-able
+ document.getElementById("location-purchase-tor").setAttribute("class", "a-link-button");
+
+ //Reset favor for Companies
+ for (var member in __WEBPACK_IMPORTED_MODULE_3__Company_js__["a" /* Companies */]) {
+ if (__WEBPACK_IMPORTED_MODULE_3__Company_js__["a" /* Companies */].hasOwnProperty(member)) {
+ __WEBPACK_IMPORTED_MODULE_3__Company_js__["a" /* Companies */][member].favor = 0;
+ }
+ }
+
+ //Reset favor for factions
+ for (var member in __WEBPACK_IMPORTED_MODULE_6__Faction_js__["b" /* Factions */]) {
+ if (__WEBPACK_IMPORTED_MODULE_6__Faction_js__["b" /* Factions */].hasOwnProperty(member)) {
+ __WEBPACK_IMPORTED_MODULE_6__Faction_js__["b" /* Factions */][member].favor = 0;
+ }
+ }
+
+ //Stop a Terminal action if there is one
+ if (__WEBPACK_IMPORTED_MODULE_5__engine_js__["Engine"]._actionInProgress) {
+ __WEBPACK_IMPORTED_MODULE_5__engine_js__["Engine"]._actionInProgress = false;
+ __WEBPACK_IMPORTED_MODULE_15__Terminal_js__["a" /* Terminal */].finishAction(true);
+ }
+
+ //Delete all Augmentations
+ for (var name in __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["c" /* Augmentations */]) {
+ if (__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["c" /* Augmentations */].hasOwnProperty(name)) {
+ delete __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["c" /* Augmentations */][name];
+ }
+ }
+
+ //Re-initialize things - This will update any changes
+ Object(__WEBPACK_IMPORTED_MODULE_6__Faction_js__["f" /* initFactions */])(); //Factions must be initialized before augmentations
+ Object(__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["g" /* initAugmentations */])(); //Calls reapplyAllAugmentations() and resets Player multipliers
+ __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].reapplyAllSourceFiles();
+ Object(__WEBPACK_IMPORTED_MODULE_3__Company_js__["h" /* initCompanies */])();
+
+ //Clear terminal
+ $("#terminal tr:not(:last)").remove();
+ Object(__WEBPACK_IMPORTED_MODULE_15__Terminal_js__["c" /* postNetburnerText */])();
+
+ //Messages
+ Object(__WEBPACK_IMPORTED_MODULE_8__Message_js__["d" /* initMessages */])();
+
+ var mainMenu = document.getElementById("mainmenu-container");
+ mainMenu.style.visibility = "visible";
+ __WEBPACK_IMPORTED_MODULE_15__Terminal_js__["a" /* Terminal */].resetTerminalInput();
+ __WEBPACK_IMPORTED_MODULE_5__engine_js__["Engine"].loadTerminalContent();
+
+ //Reinitialize Bit Node flags
+ Object(__WEBPACK_IMPORTED_MODULE_9__NetscriptFunctions_js__["e" /* initSingularitySFFlags */])();
+
+ //Reset Stock market
+ if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hasWseAccount) {
+ Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["g" /* initStockMarket */])();
+ Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["i" /* initSymbolToStockMap */])();
+ }
+ Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["m" /* setStockMarketContentCreated */])(false);
+ var stockMarketList = document.getElementById("stock-market-list");
+ while(stockMarketList.firstChild) {
+ stockMarketList.removeChild(stockMarketList.firstChild);
+ }
+
+ //Gain int exp
+ __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].gainIntelligenceExp(5);
+}
+
+
+
+/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(9)))
+
+/***/ }),
+/* 36 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return SourceFiles; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return PlayerOwnedSourceFile; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return applySourceFile; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return initSourceFiles; });
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Player_js__ = __webpack_require__(0);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__BitNode_js__ = __webpack_require__(8);
+
+
+
+/* SourceFile.js */
+//Each SourceFile corresponds to a BitNode with the same number
+function SourceFile(number, info="") {
+ var bitnodeKey = "BitNode" + number;
+ var bitnode = __WEBPACK_IMPORTED_MODULE_1__BitNode_js__["b" /* BitNodes */][bitnodeKey];
+ if (bitnode == null) {
+ throw new Error("Invalid Bit Node for this Source File");
+ }
+
+ this.n = number;
+ this.name = "Source-File " + number + ": " + bitnode.name;
+ this.lvl = 1;
+ this.info = info;
+ this.owned = false;
+}
+
+let SourceFiles = {};
+function initSourceFiles() {
+ SourceFiles = {};
+ SourceFiles["SourceFile1"] = new SourceFile(1, "This Source-File lets the player start with 32GB of RAM on his/her " +
+ "home computer. It also increases all of the player's multipliers by:
" +
+ "Level 1: 16%
" +
+ "Level 2: 24%
" +
+ "Level 3: 28%");
+ SourceFiles["SourceFile2"] = new SourceFile(2, "This Source-File increases the player's crime success rate, crime money, and charisma " +
+ "multipliers by:
" +
+ "Level 1: 20%
" +
+ "Level 2: 30%
" +
+ "Level 3: 35%");
+ SourceFiles["SourceFile3"] = new SourceFile(3,"This Source-File lets you create corporations on other BitNodes (although " +
+ "some BitNodes will disable this mechanic). This Source-File also increases your charisma and company salary multipliers by:
" +
+ "Level 1: 8%
" +
+ "Level 2: 12%
" +
+ "Level 3: 14%");
+ SourceFiles["SourceFile4"] = new SourceFile(4, "This Source-File lets you access and use the Singularity Functions in every BitNode. Every " +
+ "level of this Source-File opens up more of the Singularity Functions you can use.");
+ SourceFiles["SourceFile5"] = new SourceFile(5, "This Source-File grants a special new stat called Intelligence. Intelligence " +
+ "is unique because it is permanent and persistent (it never gets reset back to 1). However, " +
+ "gaining Intelligence experience is much slower than other stats, and it is also hidden (you won't " +
+ "know when you gain experience and how much). Higher Intelligence levels will boost your production " +
+ "for many actions in the game. In addition, this Source-File will unlock the getBitNodeMultipliers() " +
+ "Netscript function, and will raise all of your hacking-related multipliers by:
" +
+ "Level 1: 4%
" +
+ "Level 2: 6%
" +
+ "Level 3: 7%");
+ SourceFiles["SourceFile6"] = new SourceFile(6);
+ SourceFiles["SourceFile7"] = new SourceFile(7);
+ SourceFiles["SourceFile8"] = new SourceFile(8, "This Source-File grants the following benefits:
" +
+ "Level 1: Permanent access to WSE and TIX API
" +
+ "Level 2: Ability to short stocks in other BitNodes
" +
+ "Level 3: Ability to use limit/stop orders in other BitNodes
" +
+ "This Source-File also increases your hacking growth multipliers by: " +
+ "
Level 1: 8%
Level 2: 12%
Level 3: 14%");
+ SourceFiles["SourceFile9"] = new SourceFile(9);
+ SourceFiles["SourceFile10"] = new SourceFile(10);
+ SourceFiles["SourceFile11"] = new SourceFile(11, "This Source-File makes it so that company favor increases BOTH the player's salary and reputation gain rate " +
+ "at that company by 1% per favor (rather than just the reputation gain). This Source-File also " +
+ " increases the player's company salary and reputation gain multipliers by:
" +
+ "Level 1: 24%
" +
+ "Level 2: 36%
" +
+ "Level 3: 42%
");
+ SourceFiles["SourceFile12"] = new SourceFile(12);
+}
+
+function PlayerOwnedSourceFile(number, level) {
+ this.n = number;
+ this.lvl = level;
+}
+
+//Takes in a PlayerOwnedSourceFile as the "srcFile" argument
+function applySourceFile(srcFile) {
+ var srcFileKey = "SourceFile" + srcFile.n;
+ var sourceFileObject = SourceFiles[srcFileKey];
+ if (sourceFileObject == null) {
+ console.log("ERROR: Invalid source file number: " + srcFile.n);
+ return;
+ }
+
+ switch(srcFile.n) {
+ case 1: // The Source Genesis
+ var mult = 0;
+ for (var i = 0; i < srcFile.lvl; ++i) {
+ mult += (16 / (Math.pow(2, i)));
+ }
+ var incMult = 1 + (mult / 100);
+ var decMult = 1 - (mult / 100);
+ __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_chance_mult *= incMult;
+ __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_speed_mult *= incMult;
+ __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_money_mult *= incMult;
+ __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_grow_mult *= incMult;
+ __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_mult *= incMult;
+ __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].strength_mult *= incMult;
+ __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].defense_mult *= incMult;
+ __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].dexterity_mult *= incMult;
+ __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].agility_mult *= incMult;
+ __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].charisma_mult *= incMult;
+ __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_exp_mult *= incMult;
+ __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].strength_exp_mult *= incMult;
+ __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].defense_exp_mult *= incMult;
+ __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].dexterity_exp_mult *= incMult;
+ __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].agility_exp_mult *= incMult;
+ __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].charisma_exp_mult *= incMult;
+ __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].company_rep_mult *= incMult;
+ __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].faction_rep_mult *= incMult;
+ __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].crime_money_mult *= incMult;
+ __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].crime_success_mult *= incMult;
+ __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacknet_node_money_mult *= incMult;
+ __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacknet_node_purchase_cost_mult *= decMult;
+ __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacknet_node_ram_cost_mult *= decMult;
+ __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacknet_node_core_cost_mult *= decMult;
+ __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacknet_node_level_cost_mult *= decMult;
+ __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].work_money_mult *= incMult;
+ break;
+ case 2: //Rise of the Underworld
+ var mult = 0;
+ for (var i = 0; i < srcFile.lvl; ++i) {
+ mult += (20 / (Math.pow(2, i)));
+ }
+ var incMult = 1 + (mult / 100);
+ __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].crime_money_mult *= incMult;
+ __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].crime_success_mult *= incMult;
+ __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].charisma_mult *= incMult;
+ break;
+ case 3: //Corporatocracy
+ var mult = 0;
+ for (var i = 0; i < srcFile.lvl; ++i) {
+ mult += (8 / (Math.pow(2, i)));
+ }
+ var incMult = 1 + (mult / 100);
+ __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].charisma_mult *= incMult;
+ __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].work_money_mult *= incMult;
+ break;
+ case 4: //The Singularity
+ //No effects, just gives access to Singularity functions
+ break;
+ case 5: //Artificial Intelligence
+ var mult = 0;
+ for (var i = 0; i < srcFile.lvl; ++i) {
+ mult += (4 / (Math.pow(2, i)));
+ }
+ var incMult = 1 + (mult / 100);
+ __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_chance_mult *= incMult;
+ __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_speed_mult *= incMult;
+ __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_money_mult *= incMult;
+ __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_grow_mult *= incMult;
+ __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_mult *= incMult;
+ __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_exp_mult *= incMult;
+ break;
+ case 8: //Ghost of Wall Street
+ var mult = 0;
+ for (var i = 0; i < srcFile.lvl; ++i) {
+ mult += (8 / (Math.pow(2, i)));
+ }
+ var incMult = 1 + (mult / 100);
+ __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_grow_mult *= incMult;
+ break;
+ case 11: //The Big Crash
+ var mult = 0;
+ for (var i = 0; i < srcFile.lvl; ++i) {
+ mult += (24 / (Math.pow(2, i)));
+ }
+ var incMult = 1 + (mult / 100);
+ __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].work_money_mult *= incMult;
+ __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].company_rep_mult *= incMult;
+ break;
+ default:
+ console.log("ERROR: Invalid source file number: " + srcFile.n);
+ break;
+ }
+
+ sourceFileObject.owned = true;
+}
+
+
+
+
+/***/ }),
+/* 37 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return makeRuntimeRejectMsg; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return netscriptDelay; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return runScriptFromScript; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return scriptCalculateHackingChance; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return scriptCalculateHackingTime; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return scriptCalculateExpGain; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return scriptCalculatePercentMoneyHacked; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return scriptCalculateGrowTime; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return scriptCalculateWeakenTime; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return evaluate; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return isScriptErrorMessage; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return killNetscriptDelay; });
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__BitNode_js__ = __webpack_require__(8);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Constants_js__ = __webpack_require__(3);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Player_js__ = __webpack_require__(0);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__NetscriptEnvironment_js__ = __webpack_require__(38);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__ = __webpack_require__(10);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Server_js__ = __webpack_require__(6);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Settings_js__ = __webpack_require__(16);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Script_js__ = __webpack_require__(18);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_acorn_js__ = __webpack_require__(48);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_acorn_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_8__utils_acorn_js__);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_HelperFunctions_js__ = __webpack_require__(2);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_IPAddress_js__ = __webpack_require__(19);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__utils_StringHelperFunctions_js__ = __webpack_require__(4);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+var Promise = __webpack_require__(71);
+
+Promise.config({
+ warnings: false,
+ longStackTraces: false,
+ cancellation: true,
+ monitoring: false
+});
+/* Evaluator
+ * Evaluates/Interprets the Abstract Syntax Tree generated by Acorns parser
+ *
+ * Returns a promise
+ */
+function evaluate(exp, workerScript) {
+ /* return new Promise(function(resolve, reject) {*/
+ return Promise.delay(__WEBPACK_IMPORTED_MODULE_6__Settings_js__["a" /* Settings */].CodeInstructionRunTime).then(function() {
+ var env = workerScript.env;
+ if (env.stopFlag) {return Promise.reject(workerScript);}
+ if (exp == null) {
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, "Error: NULL expression"));
+ }
+ if (env.stopFlag) {return Promise.reject(workerScript);}
+ switch (exp.type) {
+ case "BlockStatement":
+ case "Program":
+ var evaluateProgPromise = evaluateProg(exp, workerScript, 0); //TODO: make every block/program use individual enviroment
+ return evaluateProgPromise.then(function(w) {
+ return Promise.resolve(workerScript);
+ }).catch(function(e) {
+ if (e.constructor === Array && e.length === 2 && e[0] === "RETURNSTATEMENT") {
+ return Promise.reject(e);
+ } else if (Object(__WEBPACK_IMPORTED_MODULE_11__utils_StringHelperFunctions_js__["f" /* isString */])(e)) {
+ workerScript.errorMessage = e;
+ return Promise.reject(workerScript);
+ } else if (e instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */]) {
+ return Promise.reject(e);
+ } else {
+ return Promise.reject(workerScript);
+ }
+ });
+ break;
+ case "Literal":
+ return Promise.resolve(exp.value);
+ break;
+ case "Identifier":
+ if (!(exp.name in env.vars)){
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, "variable " + exp.name + " not defined"));
+ }
+ return Promise.resolve(env.get(exp.name))
+ break;
+ case "ExpressionStatement":
+ return evaluate(exp.expression, workerScript);
+ break;
+ case "ArrayExpression":
+ var argPromises = exp.elements.map(function(arg) {
+ return evaluate(arg, workerScript);
+ });
+ return Promise.all(argPromises).then(function(array) {
+ return Promise.resolve(array)
+ });
+ break;
+ case "CallExpression":
+ return evaluate(exp.callee, workerScript).then(function(func) {
+ return Promise.map(exp.arguments, function(arg) {
+ return evaluate(arg, workerScript);
+ }).then(function(args) {
+ if (func instanceof __WEBPACK_IMPORTED_MODULE_8__utils_acorn_js__["Node"]) { //Player-defined function
+ //Create new Environment for the function
+ //Should be automatically garbage collected...
+ var funcEnv = env.extend();
+
+ //Define function arguments in this new environment
+ for (var i = 0; i < func.params.length; ++i) {
+ var arg;
+ if (i >= args.length) {
+ arg = null;
+ } else {
+ arg = args[i];
+ }
+ funcEnv.def(func.params[i].name, arg);
+ }
+
+ //Create a new WorkerScript for this function evaluation
+ var funcWorkerScript = new __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */](workerScript.scriptRef);
+ funcWorkerScript.serverIp = workerScript.serverIp;
+ funcWorkerScript.env = funcEnv;
+ workerScript.fnWorker = funcWorkerScript;
+
+ return evaluate(func.body, funcWorkerScript).then(function(res) {
+ //If the function finished successfuly, that means there
+ //was no return statement since a return statement rejects. So resolve to null
+ workerScript.fnWorker = null;
+ return Promise.resolve(null);
+ }).catch(function(e) {
+ if (e.constructor === Array && e.length === 2 && e[0] === "RETURNSTATEMENT") {
+ //Return statement from function
+ return Promise.resolve(e[1]);
+ workerScript.fnWorker = null;
+ } else if (Object(__WEBPACK_IMPORTED_MODULE_11__utils_StringHelperFunctions_js__["f" /* isString */])(e)) {
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, e));
+ } else if (e instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */]) {
+ //Parse out the err message from the WorkerScript and re-reject
+ var errorMsg = e.errorMessage;
+ var errorTextArray = errorMsg.split("|");
+ if (errorTextArray.length === 4) {
+ errorMsg = errorTextArray[3];
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, errorMsg));
+ } else {
+ if (env.stopFlag) {
+ return Promise.reject(workerScript);
+ } else {
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, "Error in one of your functions. Could not identify which function"));
+ }
+ }
+ } else if (e instanceof Error) {
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, e.toString()));
+ }
+ });
+ } else if (exp.callee.type == "MemberExpression"){
+ return evaluate(exp.callee.object, workerScript).then(function(object) {
+ try {
+ var res = func.apply(object,args);
+ return Promise.resolve(res);
+ } catch (e) {
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, e));
+ }
+ });
+ } else {
+ try {
+ var out = func.apply(null,args);
+ if (out instanceof Promise){
+ return out.then(function(res) {
+ return Promise.resolve(res)
+ }).catch(function(e) {
+ return Promise.reject(e);
+ });
+ } else {
+ return Promise.resolve(out);
+ }
+ } catch (e) {
+ if (isScriptErrorMessage(e)) {
+ return Promise.reject(e);
+ } else {
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, e));
+ }
+ }
+ }
+ });
+ });
+ break;
+ case "MemberExpression":
+ return evaluate(exp.object, workerScript).then(function(object) {
+ if (exp.computed){
+ return evaluate(exp.property, workerScript).then(function(index) {
+ if (index >= object.length) {
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, "Invalid index for arrays"));
+ }
+ return Promise.resolve(object[index]);
+ }).catch(function(e) {
+ if (e instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */] || isScriptErrorMessage(e)) {
+ return Promise.reject(e);
+ } else {
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, "Invalid MemberExpression"));
+ }
+
+ });
+ } else {
+ try {
+ return Promise.resolve(object[exp.property.name])
+ } catch (e) {
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, "Failed to get property: " + e.toString()));
+ }
+ }
+ });
+ break;
+ case "LogicalExpression":
+ case "BinaryExpression":
+ return evalBinary(exp, workerScript);
+ break;
+ case "UnaryExpression":
+ return evalUnary(exp, workerScript);
+ break;
+ case "AssignmentExpression":
+ return evalAssignment(exp, workerScript);
+ break;
+ case "UpdateExpression":
+ if (exp.argument.type==="Identifier"){
+ if (exp.argument.name in env.vars){
+ if (exp.operator === "++" || exp.operator === "--") {
+ switch (exp.operator) {
+ case "++":
+ env.set(exp.argument.name,env.get(exp.argument.name)+1);
+ break;
+ case "--":
+ env.set(exp.argument.name,env.get(exp.argument.name)-1);
+ break;
+ default: break;
+ }
+ return Promise.resolve(env.get(exp.argument.name));
+ }
+ //Not sure what prefix UpdateExpressions there would be besides ++/--
+ if (exp.prefix){
+ return Promise.resolve(env.get(exp.argument.name))
+ }
+ switch (exp.operator){
+ default:
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, "Unrecognized token: " + exp.type + ". You are trying to use code that is currently unsupported"));
+ }
+ return Promise.resolve(env.get(exp.argument.name))
+ } else {
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, "variable " + exp.argument.name + " not defined"));
+ }
+ } else {
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, "argument must be an identifier"));
+ }
+ break;
+ case "EmptyStatement":
+ return Promise.resolve(false);
+ break;
+ case "ReturnStatement":
+ return evaluate(exp.argument, workerScript).then(function(res) {
+ return Promise.reject(["RETURNSTATEMENT", res]);
+ });
+ break;
+ case "BreakStatement":
+ return Promise.reject("BREAKSTATEMENT");
+ break;
+ case "ContinueStatement":
+ return Promise.reject("CONTINUESTATEMENT");
+ break;
+ case "IfStatement":
+ return evaluateIf(exp, workerScript);
+ break;
+ case "SwitchStatement":
+ var lineNum = getErrorLineNumber(exp, workerScript);
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, "Switch statements are not yet implemented in Netscript (line " + (lineNum+1) + ")"));
+ break;
+ case "WhileStatement":
+ return evaluateWhile(exp, workerScript).then(function(res) {
+ return Promise.resolve(res);
+ }).catch(function(e) {
+ if (e == "BREAKSTATEMENT" ||
+ (e instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */] && e.errorMessage == "BREAKSTATEMENT")) {
+ return Promise.resolve("whileLoopBroken");
+ } else {
+ return Promise.reject(e);
+ }
+ });
+ break;
+ case "ForStatement":
+ return evaluate(exp.init, workerScript).then(function(expInit) {
+ return evaluateFor(exp, workerScript);
+ }).then(function(forLoopRes) {
+ return Promise.resolve("forLoopDone");
+ }).catch(function(e) {
+ if (e == "BREAKSTATEMENT" ||
+ (e instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */] && e.errorMessage == "BREAKSTATEMENT")) {
+ return Promise.resolve("forLoopBroken");
+ } else {
+ return Promise.reject(e);
+ }
+ });
+ break;
+ case "FunctionDeclaration":
+ if (exp.id && exp.id.name) {
+ env.set(exp.id.name, exp);
+ return Promise.resolve(true);
+ } else {
+ var lineNum = getErrorLineNumber(exp, workerScript);
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, "Invalid function declaration at line " + lineNum+1));
+ }
+ break;
+ default:
+ var lineNum = getErrorLineNumber(exp, workerScript);
+ return Promise.reject(makeRuntimeRejectMsg(workerScript, "Unrecognized token: " + exp.type + " (line " + (lineNum+1) + "). This is currently unsupported in Netscript"));
+ break;
+ } //End switch
+ }).catch(function(e) {
+ return Promise.reject(e);
+ }); // End Promise
+}
+
+function evalBinary(exp, workerScript){
+ return evaluate(exp.left, workerScript).then(function(expLeft) {
+ //Short circuiting
+ if (expLeft == true && exp.operator === "||") {
+ return Promise.resolve(true);
+ }
+ if (expLeft == false && exp.operator === "&&") {
+ return Promise.resolve(false);
+ }
+ return evaluate(exp.right, workerScript).then(function(expRight) {
+ switch (exp.operator){
+ case "===":
+ case "==":
+ return Promise.resolve(expLeft===expRight);
+ break;
+ case "!==":
+ case "!=":
+ return Promise.resolve(expLeft!==expRight);
+ break;
+ case "<":
+ return Promise.resolve(expLeft
" +
+ "Total production from all Hacknet Nodes: $" + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].totalHacknetNodeProduction, 2) + " / second";
+
+ //Update information in each owned hacknet node
+ for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].hacknetNodes.length; ++i) {
+ updateHacknetNodeDomElement(__WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* 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(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.totalMoneyGenerated, 2) +
+ " ($" + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* 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 >= __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* 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 = __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].HacknetNodeMaxLevel - nodeObj.level;
+ multiplier = Math.min(levelsToMax, hacknetNodePurchaseMultiplier);
+ }
+
+ var upgradeLevelCost = nodeObj.calculateLevelUpgradeCost(multiplier);
+ upgradeLevelButton.innerHTML = "Upgrade Hacknet Node Level x" + multiplier +
+ " - $" + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(upgradeLevelCost, 2);
+ if (__WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* 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 >= __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* 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(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(upgradeRamCost, 2);
+ if (__WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* 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 >= __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* 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(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(upgradeCoreCost, 2);
+ if (__WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* 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 < __WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].hacknetNodes.length; ++i) {
+ total += processSingleHacknetNodeEarnings(numCycles, __WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].hacknetNodes[i]);
+ }
+ return total;
+}
+
+function processSingleHacknetNodeEarnings(numCycles, nodeObj) {
+ var cyclesPerSecond = 1000 / __WEBPACK_IMPORTED_MODULE_2__engine_js__["Engine"]._idleSpeed;
+ var earningPerCycle = nodeObj.moneyGainRatePerSecond / cyclesPerSecond;
+ if (isNaN(earningPerCycle)) {throw new Error("Calculated Earnings is not a number");}
+ var totalEarnings = numCycles * earningPerCycle;
+ nodeObj.totalMoneyGenerated += totalEarnings;
+ nodeObj.onlineTimeSeconds += (numCycles * (__WEBPACK_IMPORTED_MODULE_2__engine_js__["Engine"]._idleSpeed / 1000));
+ __WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].gainMoney(totalEarnings);
+ return totalEarnings;
+}
+
+function getHacknetNode(name) {
+ for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].hacknetNodes.length; ++i) {
+ if (__WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].hacknetNodes[i].name == name) {
+ return __WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].hacknetNodes[i];
+ }
+ }
+ return null;
+}
+
+
+
+
+/***/ }),
+/* 40 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
"use strict";
/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return Gang; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return displayGangContent; });
@@ -38384,16 +44339,16 @@ module.exports = g;
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return resetGangs; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Constants_js__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__engine_js__ = __webpack_require__(5);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Faction_js__ = __webpack_require__(10);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Location_js__ = __webpack_require__(13);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Faction_js__ = __webpack_require__(11);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Location_js__ = __webpack_require__(12);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Player_js__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_DialogBox_js__ = __webpack_require__(1);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__ = __webpack_require__(8);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_JSONReviver_js__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__ = __webpack_require__(2);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_numeral_min_js__ = __webpack_require__(18);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_numeral_min_js__ = __webpack_require__(17);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_numeral_min_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_8__utils_numeral_min_js__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_StringHelperFunctions_js__ = __webpack_require__(4);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_YesNoBox_js__ = __webpack_require__(22);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_YesNoBox_js__ = __webpack_require__(14);
@@ -38537,9 +44492,9 @@ function processAllGangTerritory(numCycles=1) {
if (gangStoredTerritoryCycles < __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].GangTerritoryUpdateTimer) {return;}
for (var i = 0; i < GangNames.length; ++i) {
- var other = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(0, GangNames.length-1);
+ var other = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(0, GangNames.length-1);
while(other == i) {
- other = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["d" /* getRandomInt */])(0, GangNames.length-1);
+ other = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["h" /* getRandomInt */])(0, GangNames.length-1);
}
var thisPwr = AllGangs[GangNames[i]].power;
var otherPwr = AllGangs[GangNames[other]].power;
@@ -39428,7 +45383,7 @@ function displayGangContent() {
territorySubpage.appendChild(territoryBorder);
}
- document.getElementById("gang-container").style.visibility = "visible";
+ document.getElementById("gang-container").style.display = "block";
updateGangContent();
}
@@ -39694,2153 +45649,7 @@ function setGangMemberTaskDescription(memberObj, taskName) {
/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(9)))
/***/ }),
-/* 35 */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return SourceFiles; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return PlayerOwnedSourceFile; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return applySourceFile; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return initSourceFiles; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__BitNode_js__ = __webpack_require__(7);
-
-
-
-/* SourceFile.js */
-//Each SourceFile corresponds to a BitNode with the same number
-function SourceFile(number, info="") {
- var bitnodeKey = "BitNode" + number;
- var bitnode = __WEBPACK_IMPORTED_MODULE_1__BitNode_js__["b" /* BitNodes */][bitnodeKey];
- if (bitnode == null) {
- throw new Error("Invalid Bit Node for this Source File");
- }
-
- this.n = number;
- this.name = "Source-File " + number + ": " + bitnode.name;
- this.lvl = 1;
- this.info = info;
- this.owned = false;
-}
-
-let SourceFiles = {};
-function initSourceFiles() {
- SourceFiles = {};
- SourceFiles["SourceFile1"] = new SourceFile(1, "This Source-File lets the player start with 32GB of RAM on his/her " +
- "home computer. It also increases all of the player's multipliers by:
" +
- "Level 1: 16%
" +
- "Level 2: 24%
" +
- "Level 3: 28%");
- SourceFiles["SourceFile2"] = new SourceFile(2, "This Source-File increases the player's crime success rate, crime money, and charisma " +
- "multipliers by:
" +
- "Level 1: 20%
" +
- "Level 2: 30%
" +
- "Level 3: 35%");
- SourceFiles["SourceFile3"] = new SourceFile(3);
- SourceFiles["SourceFile4"] = new SourceFile(4, "This Source-File lets you access and use the Singularity Functions in every BitNode. Every " +
- "level of this Source-File opens up more of the Singularity Functions you can use.");
- SourceFiles["SourceFile5"] = new SourceFile(5, "This Source-File grants a special new stat called Intelligence. Intelligence " +
- "is unique because it is permanent and persistent (it never gets reset back to 1). However, " +
- "gaining Intelligence experience is much slower than other stats, and it is also hidden (you won't " +
- "know when you gain experience and how much). Higher Intelligence levels will boost your production " +
- "for many actions in the game. In addition, this Source-File will unlock the getBitNodeMultipliers() " +
- "Netscript function, and will raise all of your hacking-related multipliers by:
" +
- "Level 1: 4%
" +
- "Level 2: 6%
" +
- "Level 3: 7%");
- SourceFiles["SourceFile6"] = new SourceFile(6);
- SourceFiles["SourceFile7"] = new SourceFile(7);
- SourceFiles["SourceFile8"] = new SourceFile(8, "This Source-File grants the following benefits:
" +
- "Level 1: Permanent access to WSE and TIX API
" +
- "Level 2: Ability to short stocks in other BitNodes
" +
- "Level 3: Ability to use limit/stop orders in other BitNodes
" +
- "This Source-File also increases your hacking growth multipliers by: " +
- "
Level 1: 8%
Level 2: 12%
Level 3: 14%");
- SourceFiles["SourceFile9"] = new SourceFile(9);
- SourceFiles["SourceFile10"] = new SourceFile(10);
- SourceFiles["SourceFile11"] = new SourceFile(11, "This Source-File makes it so that company favor increases BOTH the player's salary and reputation gain rate " +
- "at that company by 1% per favor (rather than just the reputation gain). This Source-File also " +
- " increases the player's company salary and reputation gain multipliers by:
" +
- "Level 1: 24%
" +
- "Level 2: 36%
" +
- "Level 3: 42%
");
- SourceFiles["SourceFile12"] = new SourceFile(12);
-}
-
-function PlayerOwnedSourceFile(number, level) {
- this.n = number;
- this.lvl = level;
-}
-
-//Takes in a PlayerOwnedSourceFile as the "srcFile" argument
-function applySourceFile(srcFile) {
- var srcFileKey = "SourceFile" + srcFile.n;
- var sourceFileObject = SourceFiles[srcFileKey];
- if (sourceFileObject == null) {
- console.log("ERROR: Invalid source file number: " + srcFile.n);
- return;
- }
-
- switch(srcFile.n) {
- case 1: // The Source Genesis
- var mult = 0;
- for (var i = 0; i < srcFile.lvl; ++i) {
- mult += (16 / (Math.pow(2, i)));
- }
- var incMult = 1 + (mult / 100);
- var decMult = 1 - (mult / 100);
- __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_chance_mult *= incMult;
- __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_speed_mult *= incMult;
- __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_money_mult *= incMult;
- __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_grow_mult *= incMult;
- __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_mult *= incMult;
- __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].strength_mult *= incMult;
- __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].defense_mult *= incMult;
- __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].dexterity_mult *= incMult;
- __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].agility_mult *= incMult;
- __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].charisma_mult *= incMult;
- __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_exp_mult *= incMult;
- __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].strength_exp_mult *= incMult;
- __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].defense_exp_mult *= incMult;
- __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].dexterity_exp_mult *= incMult;
- __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].agility_exp_mult *= incMult;
- __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].charisma_exp_mult *= incMult;
- __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].company_rep_mult *= incMult;
- __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].faction_rep_mult *= incMult;
- __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].crime_money_mult *= incMult;
- __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].crime_success_mult *= incMult;
- __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacknet_node_money_mult *= incMult;
- __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacknet_node_purchase_cost_mult *= decMult;
- __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacknet_node_ram_cost_mult *= decMult;
- __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacknet_node_core_cost_mult *= decMult;
- __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacknet_node_level_cost_mult *= decMult;
- __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].work_money_mult *= incMult;
- break;
- case 2: //Rise of the Underworld
- var mult = 0;
- for (var i = 0; i < srcFile.lvl; ++i) {
- mult += (20 / (Math.pow(2, i)));
- }
- var incMult = 1 + (mult / 100);
- __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].crime_money_mult *= incMult;
- __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].crime_success_mult *= incMult;
- __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].charisma_mult *= incMult;
- break;
- case 4: //The Singularity
- //No effects, just gives access to Singularity functions
- break;
- case 5: //Artificial Intelligence
- var mult = 0;
- for (var i = 0; i < srcFile.lvl; ++i) {
- mult += (4 / (Math.pow(2, i)));
- }
- var incMult = 1 + (mult / 100);
- __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_chance_mult *= incMult;
- __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_speed_mult *= incMult;
- __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_money_mult *= incMult;
- __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_grow_mult *= incMult;
- __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_mult *= incMult;
- __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_exp_mult *= incMult;
- break;
- case 8: //Ghost of Wall Street
- var mult = 0;
- for (var i = 0; i < srcFile.lvl; ++i) {
- mult += (8 / (Math.pow(2, i)));
- }
- var incMult = 1 + (mult / 100);
- __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].hacking_grow_mult *= incMult;
- break;
- case 11: //The Big Crash
- var mult = 0;
- for (var i = 0; i < srcFile.lvl; ++i) {
- mult += (24 / (Math.pow(2, i)));
- }
- var incMult = 1 + (mult / 100);
- __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].work_money_mult *= incMult;
- __WEBPACK_IMPORTED_MODULE_0__Player_js__["a" /* Player */].company_rep_mult *= incMult;
- break;
- default:
- console.log("ERROR: Invalid source file number: " + srcFile.n);
- break;
- }
-
- sourceFileObject.owned = true;
-}
-
-
-
-
-/***/ }),
-/* 36 */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return prestigeAugmentation; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return prestigeSourceFile; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ActiveScriptsUI_js__ = __webpack_require__(25);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__ = __webpack_require__(20);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__BitNode_js__ = __webpack_require__(7);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Company_js__ = __webpack_require__(21);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__ = __webpack_require__(15);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__engine_js__ = __webpack_require__(5);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Faction_js__ = __webpack_require__(10);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Location_js__ = __webpack_require__(13);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Message_js__ = __webpack_require__(24);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__NetscriptFunctions_js__ = __webpack_require__(19);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__NetscriptWorker_js__ = __webpack_require__(11);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__Server_js__ = __webpack_require__(6);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__ = __webpack_require__(12);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__StockMarket_js__ = __webpack_require__(29);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__Terminal_js__ = __webpack_require__(23);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__utils_decimal_js__ = __webpack_require__(28);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__utils_decimal_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_16__utils_decimal_js__);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-//Prestige by purchasing augmentation
-function prestigeAugmentation() {
- Object(__WEBPACK_IMPORTED_MODULE_2__BitNode_js__["c" /* initBitNodeMultipliers */])();
-
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].prestigeAugmentation();
-
- //Delete all Worker Scripts objects
- Object(__WEBPACK_IMPORTED_MODULE_10__NetscriptWorker_js__["e" /* prestigeWorkerScripts */])();
-
- var homeComp = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getHomeComputer();
- //Delete all servers except home computer
- Object(__WEBPACK_IMPORTED_MODULE_12__Server_js__["h" /* prestigeAllServers */])();
-
- //Delete Special Server IPs
- Object(__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["e" /* prestigeSpecialServerIps */])(); //Must be done before initForeignServers()
-
- //Reset home computer (only the programs) and add to AllServers
- Object(__WEBPACK_IMPORTED_MODULE_12__Server_js__["i" /* prestigeHomeComputer */])(homeComp);
-
- if (Object(__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["f" /* augmentationExists */])(__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["b" /* AugmentationNames */].Neurolink) &&
- __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["c" /* Augmentations */][__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["b" /* AugmentationNames */].Neurolink].owned) {
- homeComp.programs.push(__WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].FTPCrackProgram);
- homeComp.programs.push(__WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram);
- }
- if (Object(__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["f" /* augmentationExists */])(__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["b" /* AugmentationNames */].CashRoot) &&
- __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["c" /* Augmentations */][__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["b" /* AugmentationNames */].CashRoot].owned) {
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].setMoney(new __WEBPACK_IMPORTED_MODULE_16__utils_decimal_js___default.a(1000000));
- homeComp.programs.push(__WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].BruteSSHProgram);
- }
-
- Object(__WEBPACK_IMPORTED_MODULE_12__Server_js__["a" /* AddToAllServers */])(homeComp);
-
- //Re-create foreign servers
- Object(__WEBPACK_IMPORTED_MODULE_12__Server_js__["f" /* initForeignServers */])();
-
- //Darkweb is purchase-able
- document.getElementById("location-purchase-tor").setAttribute("class", "a-link-button");
-
- //Gain favor for Companies
- for (var member in __WEBPACK_IMPORTED_MODULE_3__Company_js__["a" /* Companies */]) {
- if (__WEBPACK_IMPORTED_MODULE_3__Company_js__["a" /* Companies */].hasOwnProperty(member)) {
- __WEBPACK_IMPORTED_MODULE_3__Company_js__["a" /* Companies */][member].gainFavor();
- }
- }
-
- //Gain favor for factions
- for (var member in __WEBPACK_IMPORTED_MODULE_6__Faction_js__["b" /* Factions */]) {
- if (__WEBPACK_IMPORTED_MODULE_6__Faction_js__["b" /* Factions */].hasOwnProperty(member)) {
- __WEBPACK_IMPORTED_MODULE_6__Faction_js__["b" /* Factions */][member].gainFavor();
- }
- }
-
- //Stop a Terminal action if there is onerror
- if (__WEBPACK_IMPORTED_MODULE_5__engine_js__["Engine"]._actionInProgress) {
- __WEBPACK_IMPORTED_MODULE_5__engine_js__["Engine"]._actionInProgress = false;
- __WEBPACK_IMPORTED_MODULE_15__Terminal_js__["a" /* Terminal */].finishAction(true);
- }
-
- //Re-initialize things - This will update any changes
- Object(__WEBPACK_IMPORTED_MODULE_6__Faction_js__["f" /* initFactions */])(); //Factions must be initialized before augmentations
- Object(__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["g" /* initAugmentations */])(); //Calls reapplyAllAugmentations() and resets Player multipliers
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].reapplyAllSourceFiles();
- Object(__WEBPACK_IMPORTED_MODULE_3__Company_js__["h" /* initCompanies */])();
-
- //Clear terminal
- $("#terminal tr:not(:last)").remove();
- Object(__WEBPACK_IMPORTED_MODULE_15__Terminal_js__["c" /* postNetburnerText */])();
-
- //Messages
- Object(__WEBPACK_IMPORTED_MODULE_8__Message_js__["d" /* initMessages */])();
-
- //Reset Stock market
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hasWseAccount) {
- Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["g" /* initStockMarket */])();
- Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["i" /* initSymbolToStockMap */])();
- }
- Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["m" /* setStockMarketContentCreated */])(false);
- var stockMarketList = document.getElementById("stock-market-list");
- while(stockMarketList.firstChild) {
- stockMarketList.removeChild(stockMarketList.firstChild);
- }
-
- //Gang, in BitNode 2
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].bitNodeN == 2 && __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].inGang()) {
- var faction = __WEBPACK_IMPORTED_MODULE_6__Faction_js__["b" /* Factions */][__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].gang.facName];
- if (faction instanceof __WEBPACK_IMPORTED_MODULE_6__Faction_js__["a" /* Faction */]) {
- Object(__WEBPACK_IMPORTED_MODULE_6__Faction_js__["h" /* joinFaction */])(faction);
- }
- }
-
- //BitNode 8: Ghost of Wall Street
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].bitNodeN === 8) {__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].money = new __WEBPACK_IMPORTED_MODULE_16__utils_decimal_js___default.a(100000000);}
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].bitNodeN === 8 || __WEBPACK_IMPORTED_MODULE_9__NetscriptFunctions_js__["d" /* hasWallStreetSF */]) {
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hasWseAccount = true;
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hasTixApiAccess = true;
- }
-
- var mainMenu = document.getElementById("mainmenu-container");
- mainMenu.style.visibility = "visible";
- __WEBPACK_IMPORTED_MODULE_15__Terminal_js__["a" /* Terminal */].resetTerminalInput();
- __WEBPACK_IMPORTED_MODULE_5__engine_js__["Engine"].loadTerminalContent();
-
- //Red Pill
- if (Object(__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["f" /* augmentationExists */])(__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["b" /* AugmentationNames */].TheRedPill) &&
- __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["c" /* Augmentations */][__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["b" /* AugmentationNames */].TheRedPill].owned) {
- var WorldDaemon = __WEBPACK_IMPORTED_MODULE_12__Server_js__["b" /* AllServers */][__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["a" /* SpecialServerIps */][__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["b" /* SpecialServerNames */].WorldDaemon]];
- var DaedalusServer = __WEBPACK_IMPORTED_MODULE_12__Server_js__["b" /* AllServers */][__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["a" /* SpecialServerIps */][__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["b" /* SpecialServerNames */].DaedalusServer]];
- if (WorldDaemon && DaedalusServer) {
- WorldDaemon.serversOnNetwork.push(DaedalusServer.ip);
- DaedalusServer.serversOnNetwork.push(WorldDaemon.ip);
- }
- }
-}
-
-
-//Prestige by destroying Bit Node and gaining a Source File
-function prestigeSourceFile() {
- Object(__WEBPACK_IMPORTED_MODULE_2__BitNode_js__["c" /* initBitNodeMultipliers */])();
-
- //Crime statistics
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].prestigeSourceFile();
-
- //Delete all Worker Scripts objects
- Object(__WEBPACK_IMPORTED_MODULE_10__NetscriptWorker_js__["e" /* prestigeWorkerScripts */])();
-
- var homeComp = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getHomeComputer();
-
- //Delete all servers except home computer
- Object(__WEBPACK_IMPORTED_MODULE_12__Server_js__["h" /* prestigeAllServers */])(); //Must be done before initForeignServers()
-
- //Delete Special Server IPs
- Object(__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["e" /* prestigeSpecialServerIps */])();
-
- //Reset home computer (only the programs) and add to AllServers
- Object(__WEBPACK_IMPORTED_MODULE_12__Server_js__["i" /* prestigeHomeComputer */])(homeComp);
-
- var srcFile1Owned = false;
- for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].sourceFiles.length; ++i) {
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].sourceFiles[i].n == 1) {
- srcFile1Owned = true;
- }
- }
- if (srcFile1Owned) {
- homeComp.setMaxRam(32);
- } else {
- homeComp.setMaxRam(8);
- }
- homeComp.cpuCores = 1;
-
- Object(__WEBPACK_IMPORTED_MODULE_12__Server_js__["a" /* AddToAllServers */])(homeComp);
-
- //Re-create foreign servers
- Object(__WEBPACK_IMPORTED_MODULE_12__Server_js__["f" /* initForeignServers */])();
-
- //Darkweb is purchase-able
- document.getElementById("location-purchase-tor").setAttribute("class", "a-link-button");
-
- //Reset favor for Companies
- for (var member in __WEBPACK_IMPORTED_MODULE_3__Company_js__["a" /* Companies */]) {
- if (__WEBPACK_IMPORTED_MODULE_3__Company_js__["a" /* Companies */].hasOwnProperty(member)) {
- __WEBPACK_IMPORTED_MODULE_3__Company_js__["a" /* Companies */][member].favor = 0;
- }
- }
-
- //Reset favor for factions
- for (var member in __WEBPACK_IMPORTED_MODULE_6__Faction_js__["b" /* Factions */]) {
- if (__WEBPACK_IMPORTED_MODULE_6__Faction_js__["b" /* Factions */].hasOwnProperty(member)) {
- __WEBPACK_IMPORTED_MODULE_6__Faction_js__["b" /* Factions */][member].favor = 0;
- }
- }
-
- //Stop a Terminal action if there is one
- if (__WEBPACK_IMPORTED_MODULE_5__engine_js__["Engine"]._actionInProgress) {
- __WEBPACK_IMPORTED_MODULE_5__engine_js__["Engine"]._actionInProgress = false;
- __WEBPACK_IMPORTED_MODULE_15__Terminal_js__["a" /* Terminal */].finishAction(true);
- }
-
- //Delete all Augmentations
- for (var name in __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["c" /* Augmentations */]) {
- if (__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["c" /* Augmentations */].hasOwnProperty(name)) {
- delete __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["c" /* Augmentations */][name];
- }
- }
-
- //Re-initialize things - This will update any changes
- Object(__WEBPACK_IMPORTED_MODULE_6__Faction_js__["f" /* initFactions */])(); //Factions must be initialized before augmentations
- Object(__WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["g" /* initAugmentations */])(); //Calls reapplyAllAugmentations() and resets Player multipliers
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].reapplyAllSourceFiles();
- Object(__WEBPACK_IMPORTED_MODULE_3__Company_js__["h" /* initCompanies */])();
-
- //Clear terminal
- $("#terminal tr:not(:last)").remove();
- Object(__WEBPACK_IMPORTED_MODULE_15__Terminal_js__["c" /* postNetburnerText */])();
-
- //Messages
- Object(__WEBPACK_IMPORTED_MODULE_8__Message_js__["d" /* initMessages */])();
-
- var mainMenu = document.getElementById("mainmenu-container");
- mainMenu.style.visibility = "visible";
- __WEBPACK_IMPORTED_MODULE_15__Terminal_js__["a" /* Terminal */].resetTerminalInput();
- __WEBPACK_IMPORTED_MODULE_5__engine_js__["Engine"].loadTerminalContent();
-
- //Reinitialize Bit Node flags
- Object(__WEBPACK_IMPORTED_MODULE_9__NetscriptFunctions_js__["e" /* initSingularitySFFlags */])();
-
- //Reset Stock market
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hasWseAccount) {
- Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["g" /* initStockMarket */])();
- Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["i" /* initSymbolToStockMap */])();
- }
- Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["m" /* setStockMarketContentCreated */])(false);
- var stockMarketList = document.getElementById("stock-market-list");
- while(stockMarketList.firstChild) {
- stockMarketList.removeChild(stockMarketList.firstChild);
- }
-
- //Gain int exp
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].gainIntelligenceExp(5);
-}
-
-
-
-/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(9)))
-
-/***/ }),
-/* 37 */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return redPillFlag; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return hackWorldDaemon; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__BitNode_js__ = __webpack_require__(7);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__engine_js__ = __webpack_require__(5);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Prestige_js__ = __webpack_require__(36);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__SourceFile_js__ = __webpack_require__(35);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Terminal_js__ = __webpack_require__(23);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_DialogBox_js__ = __webpack_require__(1);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__ = __webpack_require__(2);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__ = __webpack_require__(22);
-
-
-
-
-
-
-
-
-
-
-
-/* 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) {
- redPillFlag = true;
- __WEBPACK_IMPORTED_MODULE_1__engine_js__["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);
- }).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 = __WEBPACK_IMPORTED_MODULE_4__SourceFile_js__["b" /* 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 < __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].sourceFiles.length; ++i) {
- if (__WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].sourceFiles[i].n === bitNodeNumber) {
- alreadyOwned = true;
- ownedSourceFile = __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].sourceFiles[i];
- break;
- }
- }
-
- if (alreadyOwned && ownedSourceFile) {
- if (ownedSourceFile.lvl >= 3) {
- Object(__WEBPACK_IMPORTED_MODULE_6__utils_DialogBox_js__["a" /* dialogBoxCreate */])("The Source-File for the BitNode you just destroyed, " + sourceFile.name + ", " +
- "is already at max level!");
- } else {
- ++ownedSourceFile.lvl;
- Object(__WEBPACK_IMPORTED_MODULE_6__utils_DialogBox_js__["a" /* dialogBoxCreate */])(sourceFile.name + " was upgraded to level " + ownedSourceFile.lvl + " for " +
- "destroying its corresponding BitNode!");
- }
- } else {
- var playerSrcFile = new __WEBPACK_IMPORTED_MODULE_4__SourceFile_js__["a" /* PlayerOwnedSourceFile */](bitNodeNumber, 1);
- __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].sourceFiles.push(playerSrcFile);
- if (bitNodeNumber === 5) { //Artificial Intelligence
- __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].intelligence = 1;
- }
- Object(__WEBPACK_IMPORTED_MODULE_6__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You received a Source-File for destroying a Bit Node!
" +
- sourceFile.name + "
" + sourceFile.info);
- }
-}
-
-function loadBitVerse(destroyedBitNodeNum) {
- //Clear the screen
- var container = document.getElementById("red-pill-container");
- while (container.firstChild) {
- container.removeChild(container.firstChild);
- }
-
- //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(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["b" /* clearEventListeners */])(elemId);
- if (elem == null) {return;}
- if (i === 1 || i === 2 || i === 4 || i === 5 || i === 8 || i === 11) {
- elem.addEventListener("click", function() {
- var bitNodeKey = "BitNode" + i;
- var bitNode = __WEBPACK_IMPORTED_MODULE_0__BitNode_js__["b" /* BitNodes */][bitNodeKey];
- if (bitNode == null) {
- console.log("ERROR: Could not find BitNode object for number: " + i);
- return;
- }
- Object(__WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__["b" /* yesNoBoxCreate */])("BitNode-" + i + ": " + bitNode.name + "
" + bitNode.info);
- createBitNodeYesNoEventListeners(i, destroyedBitNodeNum);
- });
- } else {
- elem.addEventListener("click", function() {
- Object(__WEBPACK_IMPORTED_MODULE_6__utils_DialogBox_js__["a" /* 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 = __WEBPACK_IMPORTED_MODULE_0__BitNode_js__["b" /* BitNodes */][bitNodeStr];
- if (bitNode == null) {return "O";}
- return "O" +
- "" +
- "BitNode-" + bitNode.number.toString() + "
" + bitNode.name+ "
" +
- bitNode.desc + "
" +
- "";
-}
-
-function createBitNodeYesNoEventListeners(newBitNode, destroyedBitNode) {
- var yesBtn = Object(__WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__["d" /* yesNoBoxGetYesButton */])();
- yesBtn.innerHTML = "Enter BitNode-" + newBitNode;
- yesBtn.addEventListener("click", function() {
- giveSourceFile(destroyedBitNode);
- redPillFlag = false;
- var container = document.getElementById("red-pill-container");
- while (container.firstChild) {
- container.removeChild(container.firstChild);
- }
-
- //Set new Bit Node
- __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].bitNodeN = newBitNode;
- console.log("Entering Bit Node " + __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* 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);
-
- __WEBPACK_IMPORTED_MODULE_5__Terminal_js__["a" /* Terminal */].hackFlag = false;
-
- Object(__WEBPACK_IMPORTED_MODULE_3__Prestige_js__["b" /* prestigeSourceFile */])();
- Object(__WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__["a" /* yesNoBoxClose */])();
- });
- var noBtn = Object(__WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__["c" /* yesNoBoxGetNoButton */])();
- noBtn.innerHTML = "Back";
- noBtn.addEventListener("click", function() {
- Object(__WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__["a" /* yesNoBoxClose */])();
- });
-
-}
-
-
-
-/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(9)))
-
-/***/ }),
-/* 38 */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return makeRuntimeRejectMsg; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return netscriptDelay; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return runScriptFromScript; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return scriptCalculateHackingChance; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return scriptCalculateHackingTime; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return scriptCalculateExpGain; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return scriptCalculatePercentMoneyHacked; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return scriptCalculateGrowTime; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return scriptCalculateWeakenTime; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return evaluate; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return isScriptErrorMessage; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return killNetscriptDelay; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__BitNode_js__ = __webpack_require__(7);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Constants_js__ = __webpack_require__(3);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__NetscriptEnvironment_js__ = __webpack_require__(31);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__ = __webpack_require__(11);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Server_js__ = __webpack_require__(6);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Settings_js__ = __webpack_require__(14);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Script_js__ = __webpack_require__(16);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_acorn_js__ = __webpack_require__(47);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_acorn_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_8__utils_acorn_js__);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_HelperFunctions_js__ = __webpack_require__(2);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_IPAddress_js__ = __webpack_require__(17);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__utils_StringHelperFunctions_js__ = __webpack_require__(4);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-var Promise = __webpack_require__(72);
-
-Promise.config({
- warnings: false,
- longStackTraces: false,
- cancellation: true,
- monitoring: false
-});
-/* Evaluator
- * Evaluates/Interprets the Abstract Syntax Tree generated by Acorns parser
- *
- * Returns a promise
- */
-function evaluate(exp, workerScript) {
- /* return new Promise(function(resolve, reject) {*/
- return Promise.delay(__WEBPACK_IMPORTED_MODULE_6__Settings_js__["a" /* Settings */].CodeInstructionRunTime).then(function() {
- var env = workerScript.env;
- if (env.stopFlag) {return Promise.reject(workerScript);}
- if (exp == null) {
- return Promise.reject(makeRuntimeRejectMsg(workerScript, "Error: NULL expression"));
- }
- if (env.stopFlag) {return Promise.reject(workerScript);}
- switch (exp.type) {
- case "BlockStatement":
- case "Program":
- var evaluateProgPromise = evaluateProg(exp, workerScript, 0); //TODO: make every block/program use individual enviroment
- return evaluateProgPromise.then(function(w) {
- return Promise.resolve(workerScript);
- }).catch(function(e) {
- if (e.constructor === Array && e.length === 2 && e[0] === "RETURNSTATEMENT") {
- return Promise.reject(e);
- } else if (Object(__WEBPACK_IMPORTED_MODULE_11__utils_StringHelperFunctions_js__["f" /* isString */])(e)) {
- workerScript.errorMessage = e;
- return Promise.reject(workerScript);
- } else if (e instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */]) {
- return Promise.reject(e);
- } else {
- return Promise.reject(workerScript);
- }
- });
- break;
- case "Literal":
- return Promise.resolve(exp.value);
- break;
- case "Identifier":
- if (!(exp.name in env.vars)){
- return Promise.reject(makeRuntimeRejectMsg(workerScript, "variable " + exp.name + " not defined"));
- }
- return Promise.resolve(env.get(exp.name))
- break;
- case "ExpressionStatement":
- return evaluate(exp.expression, workerScript);
- break;
- case "ArrayExpression":
- var argPromises = exp.elements.map(function(arg) {
- return evaluate(arg, workerScript);
- });
- return Promise.all(argPromises).then(function(array) {
- return Promise.resolve(array)
- });
- break;
- case "CallExpression":
- return evaluate(exp.callee, workerScript).then(function(func) {
- return Promise.map(exp.arguments, function(arg) {
- return evaluate(arg, workerScript);
- }).then(function(args) {
- if (func instanceof __WEBPACK_IMPORTED_MODULE_8__utils_acorn_js__["Node"]) { //Player-defined function
- //Create new Environment for the function
- //Should be automatically garbage collected...
- var funcEnv = env.extend();
-
- //Define function arguments in this new environment
- for (var i = 0; i < func.params.length; ++i) {
- var arg;
- if (i >= args.length) {
- arg = null;
- } else {
- arg = args[i];
- }
- funcEnv.def(func.params[i].name, arg);
- }
-
- //Create a new WorkerScript for this function evaluation
- var funcWorkerScript = new __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */](workerScript.scriptRef);
- funcWorkerScript.serverIp = workerScript.serverIp;
- funcWorkerScript.env = funcEnv;
- workerScript.fnWorker = funcWorkerScript;
-
- return evaluate(func.body, funcWorkerScript).then(function(res) {
- //If the function finished successfuly, that means there
- //was no return statement since a return statement rejects. So resolve to null
- workerScript.fnWorker = null;
- return Promise.resolve(null);
- }).catch(function(e) {
- if (e.constructor === Array && e.length === 2 && e[0] === "RETURNSTATEMENT") {
- //Return statement from function
- return Promise.resolve(e[1]);
- workerScript.fnWorker = null;
- } else if (Object(__WEBPACK_IMPORTED_MODULE_11__utils_StringHelperFunctions_js__["f" /* isString */])(e)) {
- return Promise.reject(makeRuntimeRejectMsg(workerScript, e));
- } else if (e instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */]) {
- //Parse out the err message from the WorkerScript and re-reject
- var errorMsg = e.errorMessage;
- var errorTextArray = errorMsg.split("|");
- if (errorTextArray.length === 4) {
- errorMsg = errorTextArray[3];
- return Promise.reject(makeRuntimeRejectMsg(workerScript, errorMsg));
- } else {
- if (env.stopFlag) {
- return Promise.reject(workerScript);
- } else {
- return Promise.reject(makeRuntimeRejectMsg(workerScript, "Error in one of your functions. Could not identify which function"));
- }
- }
- } else if (e instanceof Error) {
- return Promise.reject(makeRuntimeRejectMsg(workerScript, e.toString()));
- }
- });
- } else if (exp.callee.type == "MemberExpression"){
- return evaluate(exp.callee.object, workerScript).then(function(object) {
- try {
- var res = func.apply(object,args);
- return Promise.resolve(res);
- } catch (e) {
- return Promise.reject(makeRuntimeRejectMsg(workerScript, e));
- }
- });
- } else {
- try {
- var out = func.apply(null,args);
- if (out instanceof Promise){
- return out.then(function(res) {
- return Promise.resolve(res)
- }).catch(function(e) {
- return Promise.reject(e);
- });
- } else {
- return Promise.resolve(out);
- }
- } catch (e) {
- if (isScriptErrorMessage(e)) {
- return Promise.reject(e);
- } else {
- return Promise.reject(makeRuntimeRejectMsg(workerScript, e));
- }
- }
- }
- });
- });
- break;
- case "MemberExpression":
- return evaluate(exp.object, workerScript).then(function(object) {
- if (exp.computed){
- return evaluate(exp.property, workerScript).then(function(index) {
- if (index >= object.length) {
- return Promise.reject(makeRuntimeRejectMsg(workerScript, "Invalid index for arrays"));
- }
- return Promise.resolve(object[index]);
- }).catch(function(e) {
- if (e instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */] || isScriptErrorMessage(e)) {
- return Promise.reject(e);
- } else {
- return Promise.reject(makeRuntimeRejectMsg(workerScript, "Invalid MemberExpression"));
- }
-
- });
- } else {
- try {
- return Promise.resolve(object[exp.property.name])
- } catch (e) {
- return Promise.reject(makeRuntimeRejectMsg(workerScript, "Failed to get property: " + e.toString()));
- }
- }
- });
- break;
- case "LogicalExpression":
- case "BinaryExpression":
- return evalBinary(exp, workerScript);
- break;
- case "UnaryExpression":
- return evalUnary(exp, workerScript);
- break;
- case "AssignmentExpression":
- return evalAssignment(exp, workerScript);
- break;
- case "UpdateExpression":
- if (exp.argument.type==="Identifier"){
- if (exp.argument.name in env.vars){
- if (exp.operator === "++" || exp.operator === "--") {
- switch (exp.operator) {
- case "++":
- env.set(exp.argument.name,env.get(exp.argument.name)+1);
- break;
- case "--":
- env.set(exp.argument.name,env.get(exp.argument.name)-1);
- break;
- default: break;
- }
- return Promise.resolve(env.get(exp.argument.name));
- }
- //Not sure what prefix UpdateExpressions there would be besides ++/--
- if (exp.prefix){
- return Promise.resolve(env.get(exp.argument.name))
- }
- switch (exp.operator){
- default:
- return Promise.reject(makeRuntimeRejectMsg(workerScript, "Unrecognized token: " + exp.type + ". You are trying to use code that is currently unsupported"));
- }
- return Promise.resolve(env.get(exp.argument.name))
- } else {
- return Promise.reject(makeRuntimeRejectMsg(workerScript, "variable " + exp.argument.name + " not defined"));
- }
- } else {
- return Promise.reject(makeRuntimeRejectMsg(workerScript, "argument must be an identifier"));
- }
- break;
- case "EmptyStatement":
- return Promise.resolve(false);
- break;
- case "ReturnStatement":
- return evaluate(exp.argument, workerScript).then(function(res) {
- return Promise.reject(["RETURNSTATEMENT", res]);
- });
- break;
- case "BreakStatement":
- return Promise.reject("BREAKSTATEMENT");
- break;
- case "ContinueStatement":
- return Promise.reject("CONTINUESTATEMENT");
- break;
- case "IfStatement":
- return evaluateIf(exp, workerScript);
- break;
- case "SwitchStatement":
- var lineNum = getErrorLineNumber(exp, workerScript);
- return Promise.reject(makeRuntimeRejectMsg(workerScript, "Switch statements are not yet implemented in Netscript (line " + (lineNum+1) + ")"));
- break;
- case "WhileStatement":
- return evaluateWhile(exp, workerScript).then(function(res) {
- return Promise.resolve(res);
- }).catch(function(e) {
- if (e == "BREAKSTATEMENT" ||
- (e instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */] && e.errorMessage == "BREAKSTATEMENT")) {
- return Promise.resolve("whileLoopBroken");
- } else {
- return Promise.reject(e);
- }
- });
- break;
- case "ForStatement":
- return evaluate(exp.init, workerScript).then(function(expInit) {
- return evaluateFor(exp, workerScript);
- }).then(function(forLoopRes) {
- return Promise.resolve("forLoopDone");
- }).catch(function(e) {
- if (e == "BREAKSTATEMENT" ||
- (e instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */] && e.errorMessage == "BREAKSTATEMENT")) {
- return Promise.resolve("forLoopBroken");
- } else {
- return Promise.reject(e);
- }
- });
- break;
- case "FunctionDeclaration":
- if (exp.id && exp.id.name) {
- env.set(exp.id.name, exp);
- return Promise.resolve(true);
- } else {
- var lineNum = getErrorLineNumber(exp, workerScript);
- return Promise.reject(makeRuntimeRejectMsg(workerScript, "Invalid function declaration at line " + lineNum+1));
- }
- break;
- default:
- var lineNum = getErrorLineNumber(exp, workerScript);
- return Promise.reject(makeRuntimeRejectMsg(workerScript, "Unrecognized token: " + exp.type + " (line " + (lineNum+1) + "). This is currently unsupported in Netscript"));
- break;
- } //End switch
- }).catch(function(e) {
- return Promise.reject(e);
- }); // End Promise
-}
-
-function evalBinary(exp, workerScript){
- return evaluate(exp.left, workerScript).then(function(expLeft) {
- //Short circuiting
- if (expLeft == true && exp.operator === "||") {
- return Promise.resolve(true);
- }
- if (expLeft == false && exp.operator === "&&") {
- return Promise.resolve(false);
- }
- return evaluate(exp.right, workerScript).then(function(expRight) {
- switch (exp.operator){
- case "===":
- case "==":
- return Promise.resolve(expLeft===expRight);
- break;
- case "!==":
- case "!=":
- return Promise.resolve(expLeft!==expRight);
- break;
- case "<":
- return Promise.resolve(expLeft
" +
- "Total production from all Hacknet Nodes: $" + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].totalHacknetNodeProduction, 2) + " / second";
-
- //Update information in each owned hacknet node
- for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].hacknetNodes.length; ++i) {
- updateHacknetNodeDomElement(__WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* 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(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(nodeObj.totalMoneyGenerated, 2) +
- " ($" + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* 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 >= __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* 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 = __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].HacknetNodeMaxLevel - nodeObj.level;
- multiplier = Math.min(levelsToMax, hacknetNodePurchaseMultiplier);
- }
-
- var upgradeLevelCost = nodeObj.calculateLevelUpgradeCost(multiplier);
- upgradeLevelButton.innerHTML = "Upgrade Hacknet Node Level x" + multiplier +
- " - $" + Object(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(upgradeLevelCost, 2);
- if (__WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* 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 >= __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* 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(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(upgradeRamCost, 2);
- if (__WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* 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 >= __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* 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(__WEBPACK_IMPORTED_MODULE_8__utils_StringHelperFunctions_js__["c" /* formatNumber */])(upgradeCoreCost, 2);
- if (__WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* 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 < __WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].hacknetNodes.length; ++i) {
- total += processSingleHacknetNodeEarnings(numCycles, __WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].hacknetNodes[i]);
- }
- return total;
-}
-
-function processSingleHacknetNodeEarnings(numCycles, nodeObj) {
- var cyclesPerSecond = 1000 / __WEBPACK_IMPORTED_MODULE_2__engine_js__["Engine"]._idleSpeed;
- var earningPerCycle = nodeObj.moneyGainRatePerSecond / cyclesPerSecond;
- if (isNaN(earningPerCycle)) {throw new Error("Calculated Earnings is not a number");}
- var totalEarnings = numCycles * earningPerCycle;
- nodeObj.totalMoneyGenerated += totalEarnings;
- nodeObj.onlineTimeSeconds += (numCycles * (__WEBPACK_IMPORTED_MODULE_2__engine_js__["Engine"]._idleSpeed / 1000));
- __WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].gainMoney(totalEarnings);
- return totalEarnings;
-}
-
-function getHacknetNode(name) {
- for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].hacknetNodes.length; ++i) {
- if (__WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].hacknetNodes[i].name == name) {
- return __WEBPACK_IMPORTED_MODULE_4__Player_js__["a" /* Player */].hacknetNodes[i];
- }
- }
- return null;
-}
-
-
-
-
-/***/ }),
-/* 40 */
+/* 41 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -41895,7 +45704,23 @@ function gameOptionsBoxOpen() {
/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(9)))
/***/ }),
-/* 41 */
+/* 42 */
+/***/ (function(module, exports) {
+
+module.exports = function() {
+ throw new Error("define cannot be used indirect");
+};
+
+
+/***/ }),
+/* 43 */
+/***/ (function(module, exports) {
+
+module.exports.id = 'ace/mode/javascript_worker';
+module.exports.src = "\"no use strict\";(function(window){function resolveModuleId(id,paths){for(var testPath=id,tail=\"\";testPath;){var alias=paths[testPath];if(\"string\"==typeof alias)return alias+tail;if(alias)return alias.location.replace(/\\/*$/,\"/\")+(tail||alias.main||alias.name);if(alias===!1)return\"\";var i=testPath.lastIndexOf(\"/\");if(-1===i)break;tail=testPath.substr(i)+tail,testPath=testPath.slice(0,i)}return id}if(!(void 0!==window.window&&window.document||window.acequire&&window.define)){window.console||(window.console=function(){var msgs=Array.prototype.slice.call(arguments,0);postMessage({type:\"log\",data:msgs})},window.console.error=window.console.warn=window.console.log=window.console.trace=window.console),window.window=window,window.ace=window,window.onerror=function(message,file,line,col,err){postMessage({type:\"error\",data:{message:message,data:err.data,file:file,line:line,col:col,stack:err.stack}})},window.normalizeModule=function(parentId,moduleName){if(-1!==moduleName.indexOf(\"!\")){var chunks=moduleName.split(\"!\");return window.normalizeModule(parentId,chunks[0])+\"!\"+window.normalizeModule(parentId,chunks[1])}if(\".\"==moduleName.charAt(0)){var base=parentId.split(\"/\").slice(0,-1).join(\"/\");for(moduleName=(base?base+\"/\":\"\")+moduleName;-1!==moduleName.indexOf(\".\")&&previous!=moduleName;){var previous=moduleName;moduleName=moduleName.replace(/^\\.\\//,\"\").replace(/\\/\\.\\//,\"/\").replace(/[^\\/]+\\/\\.\\.\\//,\"\")}}return moduleName},window.acequire=function acequire(parentId,id){if(id||(id=parentId,parentId=null),!id.charAt)throw Error(\"worker.js acequire() accepts only (parentId, id) as arguments\");id=window.normalizeModule(parentId,id);var module=window.acequire.modules[id];if(module)return module.initialized||(module.initialized=!0,module.exports=module.factory().exports),module.exports;if(!window.acequire.tlns)return console.log(\"unable to load \"+id);var path=resolveModuleId(id,window.acequire.tlns);return\".js\"!=path.slice(-3)&&(path+=\".js\"),window.acequire.id=id,window.acequire.modules[id]={},importScripts(path),window.acequire(parentId,id)},window.acequire.modules={},window.acequire.tlns={},window.define=function(id,deps,factory){if(2==arguments.length?(factory=deps,\"string\"!=typeof id&&(deps=id,id=window.acequire.id)):1==arguments.length&&(factory=id,deps=[],id=window.acequire.id),\"function\"!=typeof factory)return window.acequire.modules[id]={exports:factory,initialized:!0},void 0;deps.length||(deps=[\"require\",\"exports\",\"module\"]);var req=function(childId){return window.acequire(id,childId)};window.acequire.modules[id]={exports:{},factory:function(){var module=this,returnExports=factory.apply(this,deps.map(function(dep){switch(dep){case\"require\":return req;case\"exports\":return module.exports;case\"module\":return module;default:return req(dep)}}));return returnExports&&(module.exports=returnExports),module}}},window.define.amd={},acequire.tlns={},window.initBaseUrls=function(topLevelNamespaces){for(var i in topLevelNamespaces)acequire.tlns[i]=topLevelNamespaces[i]},window.initSender=function(){var EventEmitter=window.acequire(\"ace/lib/event_emitter\").EventEmitter,oop=window.acequire(\"ace/lib/oop\"),Sender=function(){};return function(){oop.implement(this,EventEmitter),this.callback=function(data,callbackId){postMessage({type:\"call\",id:callbackId,data:data})},this.emit=function(name,data){postMessage({type:\"event\",name:name,data:data})}}.call(Sender.prototype),new Sender};var main=window.main=null,sender=window.sender=null;window.onmessage=function(e){var msg=e.data;if(msg.event&&sender)sender._signal(msg.event,msg.data);else if(msg.command)if(main[msg.command])main[msg.command].apply(main,msg.args);else{if(!window[msg.command])throw Error(\"Unknown command:\"+msg.command);window[msg.command].apply(window,msg.args)}else if(msg.init){window.initBaseUrls(msg.tlns),acequire(\"ace/lib/es5-shim\"),sender=window.sender=window.initSender();var clazz=acequire(msg.module)[msg.classname];main=window.main=new clazz(sender)}}}})(this),ace.define(\"ace/lib/oop\",[\"require\",\"exports\",\"module\"],function(acequire,exports){\"use strict\";exports.inherits=function(ctor,superCtor){ctor.super_=superCtor,ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:!1,writable:!0,configurable:!0}})},exports.mixin=function(obj,mixin){for(var key in mixin)obj[key]=mixin[key];return obj},exports.implement=function(proto,mixin){exports.mixin(proto,mixin)}}),ace.define(\"ace/range\",[\"require\",\"exports\",\"module\"],function(acequire,exports){\"use strict\";var comparePoints=function(p1,p2){return p1.row-p2.row||p1.column-p2.column},Range=function(startRow,startColumn,endRow,endColumn){this.start={row:startRow,column:startColumn},this.end={row:endRow,column:endColumn}};(function(){this.isEqual=function(range){return this.start.row===range.start.row&&this.end.row===range.end.row&&this.start.column===range.start.column&&this.end.column===range.end.column},this.toString=function(){return\"Range: [\"+this.start.row+\"/\"+this.start.column+\"] -> [\"+this.end.row+\"/\"+this.end.column+\"]\"},this.contains=function(row,column){return 0==this.compare(row,column)},this.compareRange=function(range){var cmp,end=range.end,start=range.start;return cmp=this.compare(end.row,end.column),1==cmp?(cmp=this.compare(start.row,start.column),1==cmp?2:0==cmp?1:0):-1==cmp?-2:(cmp=this.compare(start.row,start.column),-1==cmp?-1:1==cmp?42:0)},this.comparePoint=function(p){return this.compare(p.row,p.column)},this.containsRange=function(range){return 0==this.comparePoint(range.start)&&0==this.comparePoint(range.end)},this.intersects=function(range){var cmp=this.compareRange(range);return-1==cmp||0==cmp||1==cmp},this.isEnd=function(row,column){return this.end.row==row&&this.end.column==column},this.isStart=function(row,column){return this.start.row==row&&this.start.column==column},this.setStart=function(row,column){\"object\"==typeof row?(this.start.column=row.column,this.start.row=row.row):(this.start.row=row,this.start.column=column)},this.setEnd=function(row,column){\"object\"==typeof row?(this.end.column=row.column,this.end.row=row.row):(this.end.row=row,this.end.column=column)},this.inside=function(row,column){return 0==this.compare(row,column)?this.isEnd(row,column)||this.isStart(row,column)?!1:!0:!1},this.insideStart=function(row,column){return 0==this.compare(row,column)?this.isEnd(row,column)?!1:!0:!1},this.insideEnd=function(row,column){return 0==this.compare(row,column)?this.isStart(row,column)?!1:!0:!1},this.compare=function(row,column){return this.isMultiLine()||row!==this.start.row?this.start.row>row?-1:row>this.end.row?1:this.start.row===row?column>=this.start.column?0:-1:this.end.row===row?this.end.column>=column?0:1:0:this.start.column>column?-1:column>this.end.column?1:0},this.compareStart=function(row,column){return this.start.row==row&&this.start.column==column?-1:this.compare(row,column)},this.compareEnd=function(row,column){return this.end.row==row&&this.end.column==column?1:this.compare(row,column)},this.compareInside=function(row,column){return this.end.row==row&&this.end.column==column?1:this.start.row==row&&this.start.column==column?-1:this.compare(row,column)},this.clipRows=function(firstRow,lastRow){if(this.end.row>lastRow)var end={row:lastRow+1,column:0};else if(firstRow>this.end.row)var end={row:firstRow,column:0};if(this.start.row>lastRow)var start={row:lastRow+1,column:0};else if(firstRow>this.start.row)var start={row:firstRow,column:0};return Range.fromPoints(start||this.start,end||this.end)},this.extend=function(row,column){var cmp=this.compare(row,column);if(0==cmp)return this;if(-1==cmp)var start={row:row,column:column};else var end={row:row,column:column};return Range.fromPoints(start||this.start,end||this.end)},this.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},this.isMultiLine=function(){return this.start.row!==this.end.row},this.clone=function(){return Range.fromPoints(this.start,this.end)},this.collapseRows=function(){return 0==this.end.column?new Range(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new Range(this.start.row,0,this.end.row,0)},this.toScreenRange=function(session){var screenPosStart=session.documentToScreenPosition(this.start),screenPosEnd=session.documentToScreenPosition(this.end);return new Range(screenPosStart.row,screenPosStart.column,screenPosEnd.row,screenPosEnd.column)},this.moveBy=function(row,column){this.start.row+=row,this.start.column+=column,this.end.row+=row,this.end.column+=column}}).call(Range.prototype),Range.fromPoints=function(start,end){return new Range(start.row,start.column,end.row,end.column)},Range.comparePoints=comparePoints,Range.comparePoints=function(p1,p2){return p1.row-p2.row||p1.column-p2.column},exports.Range=Range}),ace.define(\"ace/apply_delta\",[\"require\",\"exports\",\"module\"],function(acequire,exports){\"use strict\";exports.applyDelta=function(docLines,delta){var row=delta.start.row,startColumn=delta.start.column,line=docLines[row]||\"\";switch(delta.action){case\"insert\":var lines=delta.lines;if(1===lines.length)docLines[row]=line.substring(0,startColumn)+delta.lines[0]+line.substring(startColumn);else{var args=[row,1].concat(delta.lines);docLines.splice.apply(docLines,args),docLines[row]=line.substring(0,startColumn)+docLines[row],docLines[row+delta.lines.length-1]+=line.substring(startColumn)}break;case\"remove\":var endColumn=delta.end.column,endRow=delta.end.row;row===endRow?docLines[row]=line.substring(0,startColumn)+line.substring(endColumn):docLines.splice(row,endRow-row+1,line.substring(0,startColumn)+docLines[endRow].substring(endColumn))}}}),ace.define(\"ace/lib/event_emitter\",[\"require\",\"exports\",\"module\"],function(acequire,exports){\"use strict\";var EventEmitter={},stopPropagation=function(){this.propagationStopped=!0},preventDefault=function(){this.defaultPrevented=!0};EventEmitter._emit=EventEmitter._dispatchEvent=function(eventName,e){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var listeners=this._eventRegistry[eventName]||[],defaultHandler=this._defaultHandlers[eventName];if(listeners.length||defaultHandler){\"object\"==typeof e&&e||(e={}),e.type||(e.type=eventName),e.stopPropagation||(e.stopPropagation=stopPropagation),e.preventDefault||(e.preventDefault=preventDefault),listeners=listeners.slice();for(var i=0;listeners.length>i&&(listeners[i](e,this),!e.propagationStopped);i++);return defaultHandler&&!e.defaultPrevented?defaultHandler(e,this):void 0}},EventEmitter._signal=function(eventName,e){var listeners=(this._eventRegistry||{})[eventName];if(listeners){listeners=listeners.slice();for(var i=0;listeners.length>i;i++)listeners[i](e,this)}},EventEmitter.once=function(eventName,callback){var _self=this;callback&&this.addEventListener(eventName,function newCallback(){_self.removeEventListener(eventName,newCallback),callback.apply(null,arguments)})},EventEmitter.setDefaultHandler=function(eventName,callback){var handlers=this._defaultHandlers;if(handlers||(handlers=this._defaultHandlers={_disabled_:{}}),handlers[eventName]){var old=handlers[eventName],disabled=handlers._disabled_[eventName];disabled||(handlers._disabled_[eventName]=disabled=[]),disabled.push(old);var i=disabled.indexOf(callback);-1!=i&&disabled.splice(i,1)}handlers[eventName]=callback},EventEmitter.removeDefaultHandler=function(eventName,callback){var handlers=this._defaultHandlers;if(handlers){var disabled=handlers._disabled_[eventName];if(handlers[eventName]==callback)handlers[eventName],disabled&&this.setDefaultHandler(eventName,disabled.pop());else if(disabled){var i=disabled.indexOf(callback);-1!=i&&disabled.splice(i,1)}}},EventEmitter.on=EventEmitter.addEventListener=function(eventName,callback,capturing){this._eventRegistry=this._eventRegistry||{};var listeners=this._eventRegistry[eventName];return listeners||(listeners=this._eventRegistry[eventName]=[]),-1==listeners.indexOf(callback)&&listeners[capturing?\"unshift\":\"push\"](callback),callback},EventEmitter.off=EventEmitter.removeListener=EventEmitter.removeEventListener=function(eventName,callback){this._eventRegistry=this._eventRegistry||{};var listeners=this._eventRegistry[eventName];if(listeners){var index=listeners.indexOf(callback);-1!==index&&listeners.splice(index,1)}},EventEmitter.removeAllListeners=function(eventName){this._eventRegistry&&(this._eventRegistry[eventName]=[])},exports.EventEmitter=EventEmitter}),ace.define(\"ace/anchor\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/event_emitter\"],function(acequire,exports){\"use strict\";var oop=acequire(\"./lib/oop\"),EventEmitter=acequire(\"./lib/event_emitter\").EventEmitter,Anchor=exports.Anchor=function(doc,row,column){this.$onChange=this.onChange.bind(this),this.attach(doc),column===void 0?this.setPosition(row.row,row.column):this.setPosition(row,column)};(function(){function $pointsInOrder(point1,point2,equalPointsInOrder){var bColIsAfter=equalPointsInOrder?point1.column<=point2.column:point1.column
" +
+ "Only then can you discover immortality.",
+
+ //Megacorporations, each forms its own faction
+ ECorpInfo: "ECorp's mission is simple: to connect the world of today with the technology of tomorrow. " +
+ "With our wide range of Internet-related software and commercial hardware, ECorp makes the world's " +
+ "information universally accessible.",
+
+ MegaCorpInfo: "MegaCorp does things that others don't. We imagine. We create. We invent. We build things that " +
+ "others have never even dreamed of. Our work fills the world's needs for food, water, power, and " +
+ "transporation on an unprecendented scale, in ways that no other company can.
" +
+ "In our labs and factories and on the ground with customers, MegaCorp is ushering in a new era for the world.",
+
+ BachmanAndAssociatesInfo: "Where Law and Business meet - thats where we are.
" +
+ "Legal Insight - Business Instinct - Experience Innovation",
+
+ BladeIndustriesInfo: "Augmentation is salvation",
+
+ NWOInfo: "The human being created civilization not because of willingness but of a need to be assimilated into higher orders of structure and meaning.",
+
+ ClarkeIncorporatedInfo: "Unlocking the power of the genome",
+
+ OmniTekIncorporatedInfo: "Simply put, our mission is to design and build robots that make a difference",
+
+ FourSigmaInfo: "The scientific method is the best way to approach investing. Big strategies backed up with big data. Driven by " +
+ "deep learning and innovative ideas. And improved by iteration. That's Four Sigma.",
+
+ KuaiGongInternationalInfo: "Dream big. Work hard. Make history.",
+
+ //Other Corporations
+ FulcrumSecretTechnologiesInfo: "TODO",
+
+ //Hacker groups
+ BitRunnersInfo: "Our entire lives are controlled by bits. All of our actions, our thoughts, our personal information. "+
+ "It's all transformed into bits, stored in bits, communicated through bits. It’s impossible for any person " +
+ "to move, to live, to operate at any level without the use of bits. " +
+ "And when a person moves, lives, and operates, they leave behind their bits, mere traces of seemingly " +
+ "meaningless fragments of information. But these bits can be reconstructed. Transformed. Used.
" +
+ "Those who run the bits, run the world",
+
+
+ BlackHandInfo: "The world, so afraid of strong government, now has no government. Only power - Digital power. Financial power. " +
+ "Technological power. " +
+ "And those at the top rule with an invisible hand. They built a society where the rich get richer, " +
+ "and everyone else suffers.
" +
+ "So much pain. So many lives. Their darkness must end.",
+
+ NiteSecInfo:
+" __..__
" +
+" _.nITESECNIt.
" +
+" .-'NITESECNITESEc.
" +
+" .' NITESECNITESECn
" +
+" / NITESECNITESEC;
" +
+" : :NITESECNITESEC;
" +
+" ; $ NITESECNITESECN
" +
+" : _, ,N'ITESECNITESEC
" +
+" : .+^^`, : `NITESECNIT
" +
+" ) /), `-,-=,NITESECNI
" +
+" / ^ ,-;|NITESECN;
" +
+" / _.' '-';NITESECN
" +
+" ( , ,-''`^NITE'
" +
+" )` :`. .'
" +
+" )-- ; `- /
" +
+" \' _.-' :
" +
+" ( _.-' \. \
" +
+" \------. \ \
" +
+" \. \ \
" +
+" \ _.nIt
" +
+" \ _.nITESECNi
" +
+" nITESECNIT^' \
" +
+" NITE^' ___ \
" +
+" / .gP''''Tp. \
" +
+" : d' . `b \
" +
+" ; d' o `b ;
" +
+" / d; `b|
" +
+" /, $; @ `:
" +
+" /' $$ ;
" +
+" .' $$b o |
" +
+" .' d$$$; :
" +
+" / .d$$$$; , ;
" +
+" d .dNITESEC $ |
" +
+" :bp.__.gNITESEC$$ :$ ;
" +
+" NITESECNITESECNIT $$b :
",
+
+ //City factions, essentially governments
+ ChongqingInfo: "Serve the people",
+ Sector12Info: "The City of the Future",
+ HongKongInfo: "Asia's World City",
+ AevumInfo: "The Silicon City",
+ IshimaInfo: "The East Asian Order of the Future",
+ VolhavenInfo: "Benefit, Honour, and Glory",
+
+ //Criminal Organizations/Gangs
+ SpeakersForTheDeadInfo: "It is better to reign in hell than to serve in heaven.",
+
+ DarkArmyInfo: "The World doesn't care about right or wrong. It's all about power.",
+
+ TheSyndicateInfo: "Honor holds you back",
+
+ SilhouetteInfo: "Corporations have filled the void of power left behind by the collapse of Western government. The issue is they've become so big " +
+ "that you don't know who they're working for. And if you're employed at one of these corporations, you don't even know who you're working " +
+ "for.
" +
+ "That's terror. Terror, fear, and corruption. All born into the system, all propagated by the system.",
+
+ TetradsInfo: "Following the Mandate of Heaven and Carrying out the Way",
+
+ SlumSnakesInfo: "Slum Snakes rule!",
+
+ //Earlygame factions - factions the player will prestige with early on that don't
+ //belong in other categories
+ NetburnersInfo: "~~//*>H4CK|\|3T 8URN3R5**>?>\\~~",
+
+ TianDiHuiInfo: "Obey Heaven and Work Righteousness",
+
+ CyberSecInfo: "The Internet is the first thing that humanity has built that humanity doesn’t understand, " +
+ "the largest experiment in anarchy that we have ever had. And as the world becomes increasingly " +
+ "dominated by the internet, society approaches the brink of total chaos. " +
+ "We serve only to protect society, to protect humanity, to protect the world from its imminent collapse.",
+
+}
+
+
+
+
+/***/ }),
+/* 52 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return beginInfiltration; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__BitNode_js__ = __webpack_require__(7);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__BitNode_js__ = __webpack_require__(8);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Constants_js__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__engine_js__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Player_js__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__ = __webpack_require__(2);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_InfiltrationBox_js__ = __webpack_require__(51);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_InfiltrationBox_js__ = __webpack_require__(53);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_StringHelperFunctions_js__ = __webpack_require__(4);
@@ -46881,7 +50830,7 @@ function nextInfiltrationLevel(inst) {
bribeButton.style.display = "none";
escapeButton.style.display = "none";
- var rand = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["d" /* getRandomInt */])(0, 5); //This needs to change if more scenarios are added
+ var rand = Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["h" /* getRandomInt */])(0, 5); //This needs to change if more scenarios are added
var scenario = null;
switch (rand) {
case 1:
@@ -47337,10 +51286,10 @@ let intWgt = __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].In
//Success: 5%, Failure 10%, -Karma
function attemptInfiltrationKill(inst) {
var chance = getInfiltrationKillChance(inst);
- inst.gainStrengthExp(inst.securityLevel / 90) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].strength_exp_mult;
- inst.gainDefenseExp(inst.securityLevel / 90) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].defense_exp_mult;
- inst.gainDexterityExp(inst.securityLevel / 90) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].dexterity_exp_mult;
- inst.gainAgilityExp(inst.securityLevel / 90) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].agility_exp_mult;
+ inst.gainStrengthExp(inst.securityLevel / 85) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].strength_exp_mult;
+ inst.gainDefenseExp(inst.securityLevel / 85) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].defense_exp_mult;
+ inst.gainDexterityExp(inst.securityLevel / 85) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].dexterity_exp_mult;
+ inst.gainAgilityExp(inst.securityLevel / 85) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].agility_exp_mult;
if (Math.random() <= chance) {
inst.securityLevel *= 1.05;
return [true, 1.05];
@@ -47363,10 +51312,10 @@ function getInfiltrationKillChance(inst) {
//Success: 3%, Failure: 10%
function attemptInfiltrationKnockout(inst) {
var chance = getInfiltrationKnockoutChance(inst);
- inst.gainStrengthExp(inst.securityLevel / 85) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].strength_exp_mult;
- inst.gainDefenseExp(inst.securityLevel / 85) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].defense_exp_mult;
- inst.gainDexterityExp(inst.securityLevel / 85) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].dexterity_exp_mult;
- inst.gainAgilityExp(inst.securityLevel / 85) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].agility_exp_mult;
+ inst.gainStrengthExp(inst.securityLevel / 80) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].strength_exp_mult;
+ inst.gainDefenseExp(inst.securityLevel / 80) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].defense_exp_mult;
+ inst.gainDexterityExp(inst.securityLevel / 80) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].dexterity_exp_mult;
+ inst.gainAgilityExp(inst.securityLevel / 80) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].agility_exp_mult;
if (Math.random() <= chance) {
inst.securityLevel *= 1.03;
return [true, 1.03];
@@ -47388,9 +51337,9 @@ function getInfiltrationKnockoutChance(inst) {
//Success: 0%, Failure: 10%
function attemptInfiltrationStealthKnockout(inst) {
var chance = getInfiltrationStealthKnockoutChance(inst);
- inst.gainStrengthExp(inst.securityLevel / 90) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].strength_exp_mult;
- inst.gainDexterityExp(inst.securityLevel / 70) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].dexterity_exp_mult;
- inst.gainAgilityExp(inst.securityLevel / 70) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].agility_exp_mult;
+ inst.gainStrengthExp(inst.securityLevel / 85) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].strength_exp_mult;
+ inst.gainDexterityExp(inst.securityLevel / 65) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].dexterity_exp_mult;
+ inst.gainAgilityExp(inst.securityLevel / 65) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].agility_exp_mult;
if (Math.random() <= chance) {
return [true, 1];
} else {
@@ -47412,9 +51361,9 @@ function getInfiltrationStealthKnockoutChance(inst) {
//Success: 0%, Failure: 5%, -Karma
function attemptInfiltrationAssassinate(inst) {
var chance = getInfiltrationAssassinateChance(inst);
- inst.gainStrengthExp(inst.securityLevel / 90) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].strength_exp_mult;
- inst.gainDexterityExp(inst.securityLevel / 70) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].dexterity_exp_mult;
- inst.gainAgilityExp(inst.securityLevel / 70) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].agility_exp_mult;
+ inst.gainStrengthExp(inst.securityLevel / 85) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].strength_exp_mult;
+ inst.gainDexterityExp(inst.securityLevel / 65) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].dexterity_exp_mult;
+ inst.gainAgilityExp(inst.securityLevel / 65) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].agility_exp_mult;
if (Math.random() <= chance) {
return [true, 1];
} else {
@@ -47436,10 +51385,10 @@ function getInfiltrationAssassinateChance(inst) {
//Success: 5%, Failure: 10%
function attemptInfiltrationDestroySecurity(inst) {
var chance = getInfiltrationDestroySecurityChance(inst);
- inst.gainStrengthExp(inst.securityLevel / 90) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].strength_exp_mult;
- inst.gainDefenseExp(inst.securityLevel / 90) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].defense_exp_mult;
- inst.gainDexterityExp(inst.securityLevel / 90) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].dexterity_exp_mult;
- inst.gainAgilityExp(inst.securityLevel / 90) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].agility_exp_mult;
+ inst.gainStrengthExp(inst.securityLevel / 85) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].strength_exp_mult;
+ inst.gainDefenseExp(inst.securityLevel / 85) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].defense_exp_mult;
+ inst.gainDexterityExp(inst.securityLevel / 85) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].dexterity_exp_mult;
+ inst.gainAgilityExp(inst.securityLevel / 85) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].agility_exp_mult;
if (Math.random() <= chance) {
inst.securityLevel *= 1.05;
return [true, 1.05];
@@ -47463,8 +51412,8 @@ function getInfiltrationDestroySecurityChance(inst) {
//Success: 1%, Failure: 5%
function attemptInfiltrationHack(inst) {
var chance = getInfiltrationHackChance(inst);
- inst.gainHackingExp(inst.securityLevel / 50) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_exp_mult;
- inst.gainIntelligenceExp(inst.securityLevel / 700);
+ inst.gainHackingExp(inst.securityLevel / 40) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].hacking_exp_mult;
+ inst.gainIntelligenceExp(inst.securityLevel / 690);
if (Math.random() <= chance) {
inst.securityLevel *= 1.03;
return [true, 1.03];
@@ -47486,7 +51435,7 @@ function getInfiltrationHackChance(inst) {
//Success: 0%, Failure: 8%
function attemptInfiltrationSneak(inst) {
var chance = getInfiltrationSneakChance(inst);
- inst.gainAgilityExp(inst.securityLevel / 50) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].agility_exp_mult;
+ inst.gainAgilityExp(inst.securityLevel / 40) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].agility_exp_mult;
if (Math.random() <= chance) {
return [true, 1];
} else {
@@ -47507,7 +51456,7 @@ function getInfiltrationSneakChance(inst) {
//Success: 1%, Failure: 3%
function attemptInfiltrationPickLockedDoor(inst) {
var chance = getInfiltrationPickLockedDoorChance(inst);
- inst.gainDexterityExp(inst.securityLevel / 40) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].dexterity_exp_mult;
+ inst.gainDexterityExp(inst.securityLevel / 30) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].dexterity_exp_mult;
if (Math.random() <= chance) {
inst.securityLevel *= 1.01;
return [true, 1.01];
@@ -47547,8 +51496,8 @@ function getInfiltrationBribeChance(inst) {
//Failure: 5%
function attemptInfiltrationEscape(inst) {
var chance = getInfiltrationEscapeChance(inst);
- inst.gainAgilityExp(inst.securityLevel / 40) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].agility_exp_mult;
- inst.gainDexterityExp(inst.securityLevel / 40) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].dexterity_exp_mult;
+ inst.gainAgilityExp(inst.securityLevel / 35) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].agility_exp_mult;
+ inst.gainDexterityExp(inst.securityLevel / 35) * __WEBPACK_IMPORTED_MODULE_3__Player_js__["a" /* Player */].dexterity_exp_mult;
if (Math.random() <= chance) {
return [true, 1];
} else {
@@ -47569,14 +51518,14 @@ function getInfiltrationEscapeChance(inst) {
/***/ }),
-/* 51 */
+/* 53 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return infiltrationBoxCreate; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_BitNode_js__ = __webpack_require__(7);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_BitNode_js__ = __webpack_require__(8);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__src_Constants_js__ = __webpack_require__(3);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__src_Faction_js__ = __webpack_require__(10);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__src_Faction_js__ = __webpack_require__(11);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__src_Player_js__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__DialogBox_js__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__HelperFunctions_js__ = __webpack_require__(2);
@@ -47694,14765 +51643,8 @@ function infiltrationBoxCreate(inst) {
-/***/ }),
-/* 52 */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return FactionInfo; });
-//Contains the "information" property for all the Factions, which is just a description
-//of each faction
-let FactionInfo = {
- //Endgame
- IlluminatiInfo: "Humanity never changes. No matter how civilized society becomes, it will eventually fall back " +
- "into chaos. And from this chaos, we are the Invisible hand that guides them to order. ",
-
- DaedalusInfo: "Yesterday we obeyed kings and bent our necks to emperors. Today we kneel only to truth.",
-
- CovenantInfo: "Surrender yourself. Give up your empty individuality to become part of something great, something eternal. " +
- "Become a slave. Submit your mind, body, and soul. Only then can you set yourself free.
" +
- "Only then can you discover immortality.",
-
- //Megacorporations, each forms its own faction
- ECorpInfo: "ECorp's mission is simple: to connect the world of today with the technology of tomorrow. " +
- "With our wide range of Internet-related software and commercial hardware, ECorp makes the world's " +
- "information universally accessible.",
-
- MegaCorpInfo: "MegaCorp does things that others don't. We imagine. We create. We invent. We build things that " +
- "others have never even dreamed of. Our work fills the world's needs for food, water, power, and " +
- "transporation on an unprecendented scale, in ways that no other company can.
" +
- "In our labs and factories and on the ground with customers, MegaCorp is ushering in a new era for the world.",
-
- BachmanAndAssociatesInfo: "Where Law and Business meet - thats where we are.
" +
- "Legal Insight - Business Instinct - Experience Innovation",
-
- BladeIndustriesInfo: "Augmentation is salvation",
-
- NWOInfo: "The human being created civilization not because of willingness but of a need to be assimilated into higher orders of structure and meaning.",
-
- ClarkeIncorporatedInfo: "Unlocking the power of the genome",
-
- OmniTekIncorporatedInfo: "Simply put, our mission is to design and build robots that make a difference",
-
- FourSigmaInfo: "The scientific method is the best way to approach investing. Big strategies backed up with big data. Driven by " +
- "deep learning and innovative ideas. And improved by iteration. That's Four Sigma.",
-
- KuaiGongInternationalInfo: "Dream big. Work hard. Make history.",
-
- //Other Corporations
- FulcrumSecretTechnologiesInfo: "TODO",
-
- //Hacker groups
- BitRunnersInfo: "Our entire lives are controlled by bits. All of our actions, our thoughts, our personal information. "+
- "It's all transformed into bits, stored in bits, communicated through bits. It’s impossible for any person " +
- "to move, to live, to operate at any level without the use of bits. " +
- "And when a person moves, lives, and operates, they leave behind their bits, mere traces of seemingly " +
- "meaningless fragments of information. But these bits can be reconstructed. Transformed. Used.
" +
- "Those who run the bits, run the world",
-
-
- BlackHandInfo: "The world, so afraid of strong government, now has no government. Only power - Digital power. Financial power. " +
- "Technological power. " +
- "And those at the top rule with an invisible hand. They built a society where the rich get richer, " +
- "and everyone else suffers.
" +
- "So much pain. So many lives. Their darkness must end.",
-
- NiteSecInfo:
-" __..__
" +
-" _.nITESECNIt.
" +
-" .-'NITESECNITESEc.
" +
-" .' NITESECNITESECn
" +
-" / NITESECNITESEC;
" +
-" : :NITESECNITESEC;
" +
-" ; $ NITESECNITESECN
" +
-" : _, ,N'ITESECNITESEC
" +
-" : .+^^`, : `NITESECNIT
" +
-" ) /), `-,-=,NITESECNI
" +
-" / ^ ,-;|NITESECN;
" +
-" / _.' '-';NITESECN
" +
-" ( , ,-''`^NITE'
" +
-" )` :`. .'
" +
-" )-- ; `- /
" +
-" \' _.-' :
" +
-" ( _.-' \. \
" +
-" \------. \ \
" +
-" \. \ \
" +
-" \ _.nIt
" +
-" \ _.nITESECNi
" +
-" nITESECNIT^' \
" +
-" NITE^' ___ \
" +
-" / .gP''''Tp. \
" +
-" : d' . `b \
" +
-" ; d' o `b ;
" +
-" / d; `b|
" +
-" /, $; @ `:
" +
-" /' $$ ;
" +
-" .' $$b o |
" +
-" .' d$$$; :
" +
-" / .d$$$$; , ;
" +
-" d .dNITESEC $ |
" +
-" :bp.__.gNITESEC$$ :$ ;
" +
-" NITESECNITESECNIT $$b :
",
-
- //City factions, essentially governments
- ChongqingInfo: "Serve the people",
- Sector12Info: "The City of the Future",
- HongKongInfo: "Asia's World City",
- AevumInfo: "The Silicon City",
- IshimaInfo: "The East Asian Order of the Future",
- VolhavenInfo: "Benefit, Honour, and Glory",
-
- //Criminal Organizations/Gangs
- SpeakersForTheDeadInfo: "It is better to reign in hell than to serve in heaven.",
-
- DarkArmyInfo: "The World doesn't care about right or wrong. It's all about power.",
-
- TheSyndicateInfo: "Honor holds you back",
-
- SilhouetteInfo: "Corporations have filled the void of power left behind by the collapse of Western government. The issue is they've become so big " +
- "that you don't know who they're working for. And if you're employed at one of these corporations, you don't even know who you're working " +
- "for.
" +
- "That's terror. Terror, fear, and corruption. All born into the system, all propagated by the system.",
-
- TetradsInfo: "Following the Mandate of Heaven and Carrying out the Way",
-
- SlumSnakesInfo: "Slum Snakes rule!",
-
- //Earlygame factions - factions the player will prestige with early on that don't
- //belong in other categories
- NetburnersInfo: "~~//*>H4CK|\|3T 8URN3R5**>?>\\~~",
-
- TianDiHuiInfo: "Obey Heaven and Work Righteousness",
-
- CyberSecInfo: "The Internet is the first thing that humanity has built that humanity doesn’t understand, " +
- "the largest experiment in anarchy that we have ever had. And as the world becomes increasingly " +
- "dominated by the internet, society approaches the brink of total chaos. " +
- "We serve only to protect society, to protect humanity, to protect the world from its imminent collapse.",
-
-}
-
-
-
-
-/***/ }),
-/* 53 */
-/***/ (function(module, exports, __webpack_require__) {
-
-/**
- * jsBezier
- *
- * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
- *
- * licensed under the MIT license.
- *
- * a set of Bezier curve functions that deal with Beziers, used by jsPlumb, and perhaps useful for other people. These functions work with Bezier
- * curves of arbitrary degree.
- *
- * - functions are all in the 'jsBezier' namespace.
- *
- * - all input points should be in the format {x:.., y:..}. all output points are in this format too.
- *
- * - all input curves should be in the format [ {x:.., y:..}, {x:.., y:..}, {x:.., y:..}, {x:.., y:..} ]
- *
- * - 'location' as used as an input here refers to a decimal in the range 0-1 inclusive, which indicates a point some proportion along the length
- * of the curve. location as output has the same format and meaning.
- *
- *
- * Function List:
- * --------------
- *
- * distanceFromCurve(point, curve)
- *
- * Calculates the distance that the given point lies from the given Bezier. Note that it is computed relative to the center of the Bezier,
- * so if you have stroked the curve with a wide pen you may wish to take that into account! The distance returned is relative to the values
- * of the curve and the point - it will most likely be pixels.
- *
- * gradientAtPoint(curve, location)
- *
- * Calculates the gradient to the curve at the given location, as a decimal between 0 and 1 inclusive.
- *
- * gradientAtPointAlongCurveFrom (curve, location)
- *
- * Calculates the gradient at the point on the given curve that is 'distance' units from location.
- *
- * nearestPointOnCurve(point, curve)
- *
- * Calculates the nearest point to the given point on the given curve. The return value of this is a JS object literal, containing both the
- *point's coordinates and also the 'location' of the point (see above), for example: { point:{x:551,y:150}, location:0.263365 }.
- *
- * pointOnCurve(curve, location)
- *
- * Calculates the coordinates of the point on the given Bezier curve at the given location.
- *
- * pointAlongCurveFrom(curve, location, distance)
- *
- * Calculates the coordinates of the point on the given curve that is 'distance' units from location. 'distance' should be in the same coordinate
- * space as that used to construct the Bezier curve. For an HTML Canvas usage, for example, distance would be a measure of pixels.
- *
- * locationAlongCurveFrom(curve, location, distance)
- *
- * Calculates the location on the given curve that is 'distance' units from location. 'distance' should be in the same coordinate
- * space as that used to construct the Bezier curve. For an HTML Canvas usage, for example, distance would be a measure of pixels.
- *
- * perpendicularToCurveAt(curve, location, length, distance)
- *
- * Calculates the perpendicular to the given curve at the given location. length is the length of the line you wish for (it will be centered
- * on the point at 'location'). distance is optional, and allows you to specify a point along the path from the given location as the center of
- * the perpendicular returned. The return value of this is an array of two points: [ {x:...,y:...}, {x:...,y:...} ].
- *
- *
- */
-
-(function() {
-
- var root = this;
-
- if(typeof Math.sgn == "undefined") {
- Math.sgn = function(x) { return x == 0 ? 0 : x > 0 ? 1 :-1; };
- }
-
- var Vectors = {
- subtract : function(v1, v2) { return {x:v1.x - v2.x, y:v1.y - v2.y }; },
- dotProduct : function(v1, v2) { return (v1.x * v2.x) + (v1.y * v2.y); },
- square : function(v) { return Math.sqrt((v.x * v.x) + (v.y * v.y)); },
- scale : function(v, s) { return {x:v.x * s, y:v.y * s }; }
- },
-
- maxRecursion = 64,
- flatnessTolerance = Math.pow(2.0,-maxRecursion-1);
-
- /**
- * Calculates the distance that the point lies from the curve.
- *
- * @param point a point in the form {x:567, y:3342}
- * @param curve a Bezier curve in the form [{x:..., y:...}, {x:..., y:...}, {x:..., y:...}, {x:..., y:...}]. note that this is currently
- * hardcoded to assume cubiz beziers, but would be better off supporting any degree.
- * @return a JS object literal containing location and distance, for example: {location:0.35, distance:10}. Location is analogous to the location
- * argument you pass to the pointOnPath function: it is a ratio of distance travelled along the curve. Distance is the distance in pixels from
- * the point to the curve.
- */
- var _distanceFromCurve = function(point, curve) {
- var candidates = [],
- w = _convertToBezier(point, curve),
- degree = curve.length - 1, higherDegree = (2 * degree) - 1,
- numSolutions = _findRoots(w, higherDegree, candidates, 0),
- v = Vectors.subtract(point, curve[0]), dist = Vectors.square(v), t = 0.0;
-
- for (var i = 0; i < numSolutions; i++) {
- v = Vectors.subtract(point, _bezier(curve, degree, candidates[i], null, null));
- var newDist = Vectors.square(v);
- if (newDist < dist) {
- dist = newDist;
- t = candidates[i];
- }
- }
- v = Vectors.subtract(point, curve[degree]);
- newDist = Vectors.square(v);
- if (newDist < dist) {
- dist = newDist;
- t = 1.0;
- }
- return {location:t, distance:dist};
- };
- /**
- * finds the nearest point on the curve to the given point.
- */
- var _nearestPointOnCurve = function(point, curve) {
- var td = _distanceFromCurve(point, curve);
- return {point:_bezier(curve, curve.length - 1, td.location, null, null), location:td.location};
- };
- var _convertToBezier = function(point, curve) {
- var degree = curve.length - 1, higherDegree = (2 * degree) - 1,
- c = [], d = [], cdTable = [], w = [],
- z = [ [1.0, 0.6, 0.3, 0.1], [0.4, 0.6, 0.6, 0.4], [0.1, 0.3, 0.6, 1.0] ];
-
- for (var i = 0; i <= degree; i++) c[i] = Vectors.subtract(curve[i], point);
- for (var i = 0; i <= degree - 1; i++) {
- d[i] = Vectors.subtract(curve[i+1], curve[i]);
- d[i] = Vectors.scale(d[i], 3.0);
- }
- for (var row = 0; row <= degree - 1; row++) {
- for (var column = 0; column <= degree; column++) {
- if (!cdTable[row]) cdTable[row] = [];
- cdTable[row][column] = Vectors.dotProduct(d[row], c[column]);
- }
- }
- for (i = 0; i <= higherDegree; i++) {
- if (!w[i]) w[i] = [];
- w[i].y = 0.0;
- w[i].x = parseFloat(i) / higherDegree;
- }
- var n = degree, m = degree-1;
- for (var k = 0; k <= n + m; k++) {
- var lb = Math.max(0, k - m),
- ub = Math.min(k, n);
- for (i = lb; i <= ub; i++) {
- j = k - i;
- w[i+j].y += cdTable[j][i] * z[j][i];
- }
- }
- return w;
- };
- /**
- * counts how many roots there are.
- */
- var _findRoots = function(w, degree, t, depth) {
- var left = [], right = [],
- left_count, right_count,
- left_t = [], right_t = [];
-
- switch (_getCrossingCount(w, degree)) {
- case 0 : {
- return 0;
- }
- case 1 : {
- if (depth >= maxRecursion) {
- t[0] = (w[0].x + w[degree].x) / 2.0;
- return 1;
- }
- if (_isFlatEnough(w, degree)) {
- t[0] = _computeXIntercept(w, degree);
- return 1;
- }
- break;
- }
- }
- _bezier(w, degree, 0.5, left, right);
- left_count = _findRoots(left, degree, left_t, depth+1);
- right_count = _findRoots(right, degree, right_t, depth+1);
- for (var i = 0; i < left_count; i++) t[i] = left_t[i];
- for (var i = 0; i < right_count; i++) t[i+left_count] = right_t[i];
- return (left_count+right_count);
- };
- var _getCrossingCount = function(curve, degree) {
- var n_crossings = 0, sign, old_sign;
- sign = old_sign = Math.sgn(curve[0].y);
- for (var i = 1; i <= degree; i++) {
- sign = Math.sgn(curve[i].y);
- if (sign != old_sign) n_crossings++;
- old_sign = sign;
- }
- return n_crossings;
- };
- var _isFlatEnough = function(curve, degree) {
- var error,
- intercept_1, intercept_2, left_intercept, right_intercept,
- a, b, c, det, dInv, a1, b1, c1, a2, b2, c2;
- a = curve[0].y - curve[degree].y;
- b = curve[degree].x - curve[0].x;
- c = curve[0].x * curve[degree].y - curve[degree].x * curve[0].y;
-
- var max_distance_above = max_distance_below = 0.0;
-
- for (var i = 1; i < degree; i++) {
- var value = a * curve[i].x + b * curve[i].y + c;
- if (value > max_distance_above)
- max_distance_above = value;
- else if (value < max_distance_below)
- max_distance_below = value;
- }
-
- a1 = 0.0; b1 = 1.0; c1 = 0.0; a2 = a; b2 = b;
- c2 = c - max_distance_above;
- det = a1 * b2 - a2 * b1;
- dInv = 1.0/det;
- intercept_1 = (b1 * c2 - b2 * c1) * dInv;
- a2 = a; b2 = b; c2 = c - max_distance_below;
- det = a1 * b2 - a2 * b1;
- dInv = 1.0/det;
- intercept_2 = (b1 * c2 - b2 * c1) * dInv;
- left_intercept = Math.min(intercept_1, intercept_2);
- right_intercept = Math.max(intercept_1, intercept_2);
- error = right_intercept - left_intercept;
- return (error < flatnessTolerance)? 1 : 0;
- };
- var _computeXIntercept = function(curve, degree) {
- var XLK = 1.0, YLK = 0.0,
- XNM = curve[degree].x - curve[0].x, YNM = curve[degree].y - curve[0].y,
- XMK = curve[0].x - 0.0, YMK = curve[0].y - 0.0,
- det = XNM*YLK - YNM*XLK, detInv = 1.0/det,
- S = (XNM*YMK - YNM*XMK) * detInv;
- return 0.0 + XLK * S;
- };
- var _bezier = function(curve, degree, t, left, right) {
- var temp = [[]];
- for (var j =0; j <= degree; j++) temp[0][j] = curve[j];
- for (var i = 1; i <= degree; i++) {
- for (var j =0 ; j <= degree - i; j++) {
- if (!temp[i]) temp[i] = [];
- if (!temp[i][j]) temp[i][j] = {};
- temp[i][j].x = (1.0 - t) * temp[i-1][j].x + t * temp[i-1][j+1].x;
- temp[i][j].y = (1.0 - t) * temp[i-1][j].y + t * temp[i-1][j+1].y;
- }
- }
- if (left != null)
- for (j = 0; j <= degree; j++) left[j] = temp[j][0];
- if (right != null)
- for (j = 0; j <= degree; j++) right[j] = temp[degree-j][j];
-
- return (temp[degree][0]);
- };
-
- var _curveFunctionCache = {};
- var _getCurveFunctions = function(order) {
- var fns = _curveFunctionCache[order];
- if (!fns) {
- fns = [];
- var f_term = function() { return function(t) { return Math.pow(t, order); }; },
- l_term = function() { return function(t) { return Math.pow((1-t), order); }; },
- c_term = function(c) { return function(t) { return c; }; },
- t_term = function() { return function(t) { return t; }; },
- one_minus_t_term = function() { return function(t) { return 1-t; }; },
- _termFunc = function(terms) {
- return function(t) {
- var p = 1;
- for (var i = 0; i < terms.length; i++) p = p * terms[i](t);
- return p;
- };
- };
-
- fns.push(new f_term()); // first is t to the power of the curve order
- for (var i = 1; i < order; i++) {
- var terms = [new c_term(order)];
- for (var j = 0 ; j < (order - i); j++) terms.push(new t_term());
- for (var j = 0 ; j < i; j++) terms.push(new one_minus_t_term());
- fns.push(new _termFunc(terms));
- }
- fns.push(new l_term()); // last is (1-t) to the power of the curve order
-
- _curveFunctionCache[order] = fns;
- }
-
- return fns;
- };
-
-
- /**
- * calculates a point on the curve, for a Bezier of arbitrary order.
- * @param curve an array of control points, eg [{x:10,y:20}, {x:50,y:50}, {x:100,y:100}, {x:120,y:100}]. For a cubic bezier this should have four points.
- * @param location a decimal indicating the distance along the curve the point should be located at. this is the distance along the curve as it travels, taking the way it bends into account. should be a number from 0 to 1, inclusive.
- */
- var _pointOnPath = function(curve, location) {
- var cc = _getCurveFunctions(curve.length - 1),
- _x = 0, _y = 0;
- for (var i = 0; i < curve.length ; i++) {
- _x = _x + (curve[i].x * cc[i](location));
- _y = _y + (curve[i].y * cc[i](location));
- }
-
- return {x:_x, y:_y};
- };
-
- var _dist = function(p1,p2) {
- return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2));
- };
-
- var _isPoint = function(curve) {
- return curve[0].x == curve[1].x && curve[0].y == curve[1].y;
- };
-
- /**
- * finds the point that is 'distance' along the path from 'location'. this method returns both the x,y location of the point and also
- * its 'location' (proportion of travel along the path); the method below - _pointAlongPathFrom - calls this method and just returns the
- * point.
- */
- var _pointAlongPath = function(curve, location, distance) {
-
- if (_isPoint(curve)) {
- return {
- point:curve[0],
- location:location
- };
- }
-
- var prev = _pointOnPath(curve, location),
- tally = 0,
- curLoc = location,
- direction = distance > 0 ? 1 : -1,
- cur = null;
-
- while (tally < Math.abs(distance)) {
- curLoc += (0.005 * direction);
- cur = _pointOnPath(curve, curLoc);
- tally += _dist(cur, prev);
- prev = cur;
- }
- return {point:cur, location:curLoc};
- };
-
- var _length = function(curve) {
- if (_isPoint(curve)) return 0;
-
- var prev = _pointOnPath(curve, 0),
- tally = 0,
- curLoc = 0,
- direction = 1,
- cur = null;
-
- while (curLoc < 1) {
- curLoc += (0.005 * direction);
- cur = _pointOnPath(curve, curLoc);
- tally += _dist(cur, prev);
- prev = cur;
- }
- return tally;
- };
-
- /**
- * finds the point that is 'distance' along the path from 'location'.
- */
- var _pointAlongPathFrom = function(curve, location, distance) {
- return _pointAlongPath(curve, location, distance).point;
- };
-
- /**
- * finds the location that is 'distance' along the path from 'location'.
- */
- var _locationAlongPathFrom = function(curve, location, distance) {
- return _pointAlongPath(curve, location, distance).location;
- };
-
- /**
- * returns the gradient of the curve at the given location, which is a decimal between 0 and 1 inclusive.
- *
- * thanks // http://bimixual.org/AnimationLibrary/beziertangents.html
- */
- var _gradientAtPoint = function(curve, location) {
- var p1 = _pointOnPath(curve, location),
- p2 = _pointOnPath(curve.slice(0, curve.length - 1), location),
- dy = p2.y - p1.y, dx = p2.x - p1.x;
- return dy == 0 ? Infinity : Math.atan(dy / dx);
- };
-
- /**
- returns the gradient of the curve at the point which is 'distance' from the given location.
- if this point is greater than location 1, the gradient at location 1 is returned.
- if this point is less than location 0, the gradient at location 0 is returned.
- */
- var _gradientAtPointAlongPathFrom = function(curve, location, distance) {
- var p = _pointAlongPath(curve, location, distance);
- if (p.location > 1) p.location = 1;
- if (p.location < 0) p.location = 0;
- return _gradientAtPoint(curve, p.location);
- };
-
- /**
- * calculates a line that is 'length' pixels long, perpendicular to, and centered on, the path at 'distance' pixels from the given location.
- * if distance is not supplied, the perpendicular for the given location is computed (ie. we set distance to zero).
- */
- var _perpendicularToPathAt = function(curve, location, length, distance) {
- distance = distance == null ? 0 : distance;
- var p = _pointAlongPath(curve, location, distance),
- m = _gradientAtPoint(curve, p.location),
- _theta2 = Math.atan(-1 / m),
- y = length / 2 * Math.sin(_theta2),
- x = length / 2 * Math.cos(_theta2);
- return [{x:p.point.x + x, y:p.point.y + y}, {x:p.point.x - x, y:p.point.y - y}];
- };
-
- var jsBezier = this.jsBezier = {
- distanceFromCurve : _distanceFromCurve,
- gradientAtPoint : _gradientAtPoint,
- gradientAtPointAlongCurveFrom : _gradientAtPointAlongPathFrom,
- nearestPointOnCurve : _nearestPointOnCurve,
- pointOnCurve : _pointOnPath,
- pointAlongCurveFrom : _pointAlongPathFrom,
- perpendicularToCurveAt : _perpendicularToPathAt,
- locationAlongCurveFrom:_locationAlongPathFrom,
- getLength:_length,
- version:"0.9.0"
- };
-
- if (true) {
- exports.jsBezier = jsBezier;
- }
-
-}).call(typeof window !== 'undefined' ? window : this);
-
-/**
- * Biltong v0.4.0
- *
- * Various geometry functions written as part of jsPlumb and perhaps useful for others.
- *
- * Copyright (c) 2017 jsPlumb
- * https://jsplumbtoolkit.com
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following
- * conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
-;(function() {
-
- "use strict";
- var root = this;
-
- var Biltong = root.Biltong = {
- version:"0.4.0"
- };
-
- if (true) {
- exports.Biltong = Biltong;
- }
-
- var _isa = function(a) { return Object.prototype.toString.call(a) === "[object Array]"; },
- _pointHelper = function(p1, p2, fn) {
- p1 = _isa(p1) ? p1 : [p1.x, p1.y];
- p2 = _isa(p2) ? p2 : [p2.x, p2.y];
- return fn(p1, p2);
- },
- /**
- * @name Biltong.gradient
- * @function
- * @desc Calculates the gradient of a line between the two points.
- * @param {Point} p1 First point, either as a 2 entry array or object with `left` and `top` properties.
- * @param {Point} p2 Second point, either as a 2 entry array or object with `left` and `top` properties.
- * @return {Float} The gradient of a line between the two points.
- */
- _gradient = Biltong.gradient = function(p1, p2) {
- return _pointHelper(p1, p2, function(_p1, _p2) {
- if (_p2[0] == _p1[0])
- return _p2[1] > _p1[1] ? Infinity : -Infinity;
- else if (_p2[1] == _p1[1])
- return _p2[0] > _p1[0] ? 0 : -0;
- else
- return (_p2[1] - _p1[1]) / (_p2[0] - _p1[0]);
- });
- },
- /**
- * @name Biltong.normal
- * @function
- * @desc Calculates the gradient of a normal to a line between the two points.
- * @param {Point} p1 First point, either as a 2 entry array or object with `left` and `top` properties.
- * @param {Point} p2 Second point, either as a 2 entry array or object with `left` and `top` properties.
- * @return {Float} The gradient of a normal to a line between the two points.
- */
- _normal = Biltong.normal = function(p1, p2) {
- return -1 / _gradient(p1, p2);
- },
- /**
- * @name Biltong.lineLength
- * @function
- * @desc Calculates the length of a line between the two points.
- * @param {Point} p1 First point, either as a 2 entry array or object with `left` and `top` properties.
- * @param {Point} p2 Second point, either as a 2 entry array or object with `left` and `top` properties.
- * @return {Float} The length of a line between the two points.
- */
- _lineLength = Biltong.lineLength = function(p1, p2) {
- return _pointHelper(p1, p2, function(_p1, _p2) {
- return Math.sqrt(Math.pow(_p2[1] - _p1[1], 2) + Math.pow(_p2[0] - _p1[0], 2));
- });
- },
- /**
- * @name Biltong.quadrant
- * @function
- * @desc Calculates the quadrant in which the angle between the two points lies.
- * @param {Point} p1 First point, either as a 2 entry array or object with `left` and `top` properties.
- * @param {Point} p2 Second point, either as a 2 entry array or object with `left` and `top` properties.
- * @return {Integer} The quadrant - 1 for upper right, 2 for lower right, 3 for lower left, 4 for upper left.
- */
- _quadrant = Biltong.quadrant = function(p1, p2) {
- return _pointHelper(p1, p2, function(_p1, _p2) {
- if (_p2[0] > _p1[0]) {
- return (_p2[1] > _p1[1]) ? 2 : 1;
- }
- else if (_p2[0] == _p1[0]) {
- return _p2[1] > _p1[1] ? 2 : 1;
- }
- else {
- return (_p2[1] > _p1[1]) ? 3 : 4;
- }
- });
- },
- /**
- * @name Biltong.theta
- * @function
- * @desc Calculates the angle between the two points.
- * @param {Point} p1 First point, either as a 2 entry array or object with `left` and `top` properties.
- * @param {Point} p2 Second point, either as a 2 entry array or object with `left` and `top` properties.
- * @return {Float} The angle between the two points.
- */
- _theta = Biltong.theta = function(p1, p2) {
- return _pointHelper(p1, p2, function(_p1, _p2) {
- var m = _gradient(_p1, _p2),
- t = Math.atan(m),
- s = _quadrant(_p1, _p2);
- if ((s == 4 || s== 3)) t += Math.PI;
- if (t < 0) t += (2 * Math.PI);
-
- return t;
- });
- },
- /**
- * @name Biltong.intersects
- * @function
- * @desc Calculates whether or not the two rectangles intersect.
- * @param {Rectangle} r1 First rectangle, as a js object in the form `{x:.., y:.., w:.., h:..}`
- * @param {Rectangle} r2 Second rectangle, as a js object in the form `{x:.., y:.., w:.., h:..}`
- * @return {Boolean} True if the rectangles intersect, false otherwise.
- */
- _intersects = Biltong.intersects = function(r1, r2) {
- var x1 = r1.x, x2 = r1.x + r1.w, y1 = r1.y, y2 = r1.y + r1.h,
- a1 = r2.x, a2 = r2.x + r2.w, b1 = r2.y, b2 = r2.y + r2.h;
-
- return ( (x1 <= a1 && a1 <= x2) && (y1 <= b1 && b1 <= y2) ) ||
- ( (x1 <= a2 && a2 <= x2) && (y1 <= b1 && b1 <= y2) ) ||
- ( (x1 <= a1 && a1 <= x2) && (y1 <= b2 && b2 <= y2) ) ||
- ( (x1 <= a2 && a1 <= x2) && (y1 <= b2 && b2 <= y2) ) ||
- ( (a1 <= x1 && x1 <= a2) && (b1 <= y1 && y1 <= b2) ) ||
- ( (a1 <= x2 && x2 <= a2) && (b1 <= y1 && y1 <= b2) ) ||
- ( (a1 <= x1 && x1 <= a2) && (b1 <= y2 && y2 <= b2) ) ||
- ( (a1 <= x2 && x1 <= a2) && (b1 <= y2 && y2 <= b2) );
- },
- /**
- * @name Biltong.encloses
- * @function
- * @desc Calculates whether or not r2 is completely enclosed by r1.
- * @param {Rectangle} r1 First rectangle, as a js object in the form `{x:.., y:.., w:.., h:..}`
- * @param {Rectangle} r2 Second rectangle, as a js object in the form `{x:.., y:.., w:.., h:..}`
- * @param {Boolean} [allowSharedEdges=false] If true, the concept of enclosure allows for one or more edges to be shared by the two rectangles.
- * @return {Boolean} True if r1 encloses r2, false otherwise.
- */
- _encloses = Biltong.encloses = function(r1, r2, allowSharedEdges) {
- var x1 = r1.x, x2 = r1.x + r1.w, y1 = r1.y, y2 = r1.y + r1.h,
- a1 = r2.x, a2 = r2.x + r2.w, b1 = r2.y, b2 = r2.y + r2.h,
- c = function(v1, v2, v3, v4) { return allowSharedEdges ? v1 <= v2 && v3>= v4 : v1 < v2 && v3 > v4; };
-
- return c(x1,a1,x2,a2) && c(y1,b1,y2,b2);
- },
- _segmentMultipliers = [null, [1, -1], [1, 1], [-1, 1], [-1, -1] ],
- _inverseSegmentMultipliers = [null, [-1, -1], [-1, 1], [1, 1], [1, -1] ],
- /**
- * @name Biltong.pointOnLine
- * @function
- * @desc Calculates a point on the line from `fromPoint` to `toPoint` that is `distance` units along the length of the line.
- * @param {Point} p1 First point, either as a 2 entry array or object with `left` and `top` properties.
- * @param {Point} p2 Second point, either as a 2 entry array or object with `left` and `top` properties.
- * @return {Point} Point on the line, in the form `{ x:..., y:... }`.
- */
- _pointOnLine = Biltong.pointOnLine = function(fromPoint, toPoint, distance) {
- var m = _gradient(fromPoint, toPoint),
- s = _quadrant(fromPoint, toPoint),
- segmentMultiplier = distance > 0 ? _segmentMultipliers[s] : _inverseSegmentMultipliers[s],
- theta = Math.atan(m),
- y = Math.abs(distance * Math.sin(theta)) * segmentMultiplier[1],
- x = Math.abs(distance * Math.cos(theta)) * segmentMultiplier[0];
- return { x:fromPoint.x + x, y:fromPoint.y + y };
- },
- /**
- * @name Biltong.perpendicularLineTo
- * @function
- * @desc Calculates a line of length `length` that is perpendicular to the line from `fromPoint` to `toPoint` and passes through `toPoint`.
- * @param {Point} p1 First point, either as a 2 entry array or object with `left` and `top` properties.
- * @param {Point} p2 Second point, either as a 2 entry array or object with `left` and `top` properties.
- * @return {Line} Perpendicular line, in the form `[ { x:..., y:... }, { x:..., y:... } ]`.
- */
- _perpendicularLineTo = Biltong.perpendicularLineTo = function(fromPoint, toPoint, length) {
- var m = _gradient(fromPoint, toPoint),
- theta2 = Math.atan(-1 / m),
- y = length / 2 * Math.sin(theta2),
- x = length / 2 * Math.cos(theta2);
- return [{x:toPoint.x + x, y:toPoint.y + y}, {x:toPoint.x - x, y:toPoint.y - y}];
- };
-}).call(typeof window !== 'undefined' ? window : this);
-;
-(function () {
-
- "use strict";
-
- var root = this,
- Sniff = {
- android: navigator.userAgent.toLowerCase().indexOf("android") > -1
- },
- matchesSelector = function (el, selector, ctx) {
- ctx = ctx || el.parentNode;
- var possibles = ctx.querySelectorAll(selector);
- for (var i = 0; i < possibles.length; i++) {
- if (possibles[i] === el) {
- return true;
- }
- }
- return false;
- },
- _gel = function (el) {
- return (typeof el == "string" || el.constructor === String) ? document.getElementById(el) : el;
- },
- _t = function (e) {
- return e.srcElement || e.target;
- },
- //
- // gets path info for the given event - the path from target to obj, in the event's bubble chain. if doCompute
- // is false we just return target for the path.
- //
- _pi = function(e, target, obj, doCompute) {
- if (!doCompute) return { path:[target], end:1 };
- else if (typeof e.path !== "undefined" && e.path.indexOf) {
- return { path: e.path, end: e.path.indexOf(obj) };
- } else {
- var out = { path:[], end:-1 }, _one = function(el) {
- out.path.push(el);
- if (el === obj) {
- out.end = out.path.length - 1;
- }
- else if (el.parentNode != null) {
- _one(el.parentNode)
- }
- };
- _one(target);
- return out;
- }
- },
- _d = function (l, fn) {
- for (var i = 0, j = l.length; i < j; i++) {
- if (l[i] == fn) break;
- }
- if (i < l.length) l.splice(i, 1);
- },
- guid = 1,
- //
- // this function generates a guid for every handler, sets it on the handler, then adds
- // it to the associated object's map of handlers for the given event. this is what enables us
- // to unbind all events of some type, or all events (the second of which can be requested by the user,
- // but it also used by Mottle when an element is removed.)
- _store = function (obj, event, fn) {
- var g = guid++;
- obj.__ta = obj.__ta || {};
- obj.__ta[event] = obj.__ta[event] || {};
- // store each handler with a unique guid.
- obj.__ta[event][g] = fn;
- // set the guid on the handler.
- fn.__tauid = g;
- return g;
- },
- _unstore = function (obj, event, fn) {
- obj.__ta && obj.__ta[event] && delete obj.__ta[event][fn.__tauid];
- // a handler might have attached extra functions, so we unbind those too.
- if (fn.__taExtra) {
- for (var i = 0; i < fn.__taExtra.length; i++) {
- _unbind(obj, fn.__taExtra[i][0], fn.__taExtra[i][1]);
- }
- fn.__taExtra.length = 0;
- }
- // a handler might have attached an unstore callback
- fn.__taUnstore && fn.__taUnstore();
- },
- _curryChildFilter = function (children, obj, fn, evt) {
- if (children == null) return fn;
- else {
- var c = children.split(","),
- _fn = function (e) {
- _fn.__tauid = fn.__tauid;
- var t = _t(e), target = t; // t is the target element on which the event occurred. it is the
- // element we will wish to pass to any callbacks.
- var pathInfo = _pi(e, t, obj, children != null)
- if (pathInfo.end != -1) {
- for (var p = 0; p < pathInfo.end; p++) {
- target = pathInfo.path[p];
- for (var i = 0; i < c.length; i++) {
- if (matchesSelector(target, c[i], obj)) {
- fn.apply(target, arguments);
- }
- }
- }
- }
- };
- registerExtraFunction(fn, evt, _fn);
- return _fn;
- }
- },
- //
- // registers an 'extra' function on some event listener function we were given - a function that we
- // created and bound to the element as part of our housekeeping, and which we want to unbind and remove
- // whenever the given function is unbound.
- registerExtraFunction = function (fn, evt, newFn) {
- fn.__taExtra = fn.__taExtra || [];
- fn.__taExtra.push([evt, newFn]);
- },
- DefaultHandler = function (obj, evt, fn, children) {
- if (isTouchDevice && touchMap[evt]) {
- var tfn = _curryChildFilter(children, obj, fn, touchMap[evt]);
- _bind(obj, touchMap[evt], tfn , fn);
- }
- if (evt === "focus" && obj.getAttribute("tabindex") == null) {
- obj.setAttribute("tabindex", "1");
- }
- _bind(obj, evt, _curryChildFilter(children, obj, fn, evt), fn);
- },
- SmartClickHandler = function (obj, evt, fn, children) {
- if (obj.__taSmartClicks == null) {
- var down = function (e) {
- obj.__tad = _pageLocation(e);
- },
- up = function (e) {
- obj.__tau = _pageLocation(e);
- },
- click = function (e) {
- if (obj.__tad && obj.__tau && obj.__tad[0] === obj.__tau[0] && obj.__tad[1] === obj.__tau[1]) {
- for (var i = 0; i < obj.__taSmartClicks.length; i++)
- obj.__taSmartClicks[i].apply(_t(e), [ e ]);
- }
- };
- DefaultHandler(obj, "mousedown", down, children);
- DefaultHandler(obj, "mouseup", up, children);
- DefaultHandler(obj, "click", click, children);
- obj.__taSmartClicks = [];
- }
-
- // store in the list of callbacks
- obj.__taSmartClicks.push(fn);
- // the unstore function removes this function from the object's listener list for this type.
- fn.__taUnstore = function () {
- _d(obj.__taSmartClicks, fn);
- };
- },
- _tapProfiles = {
- "tap": {touches: 1, taps: 1},
- "dbltap": {touches: 1, taps: 2},
- "contextmenu": {touches: 2, taps: 1}
- },
- TapHandler = function (clickThreshold, dblClickThreshold) {
- return function (obj, evt, fn, children) {
- // if event is contextmenu, for devices which are mouse only, we want to
- // use the default bind.
- if (evt == "contextmenu" && isMouseDevice)
- DefaultHandler(obj, evt, fn, children);
- else {
- // the issue here is that this down handler gets registered only for the
- // child nodes in the first registration. in fact it should be registered with
- // no child selector and then on down we should cycle through the registered
- // functions to see if one of them matches. on mouseup we should execute ALL of
- // the functions whose children are either null or match the element.
- if (obj.__taTapHandler == null) {
- var tt = obj.__taTapHandler = {
- tap: [],
- dbltap: [],
- contextmenu: [],
- down: false,
- taps: 0,
- downSelectors: []
- };
- var down = function (e) {
- var target = _t(e), pathInfo = _pi(e, target, obj, children != null), finished = false;
- for (var p = 0; p < pathInfo.end; p++) {
- if (finished) return;
- target = pathInfo.path[p];
- for (var i = 0; i < tt.downSelectors.length; i++) {
- if (tt.downSelectors[i] == null || matchesSelector(target, tt.downSelectors[i], obj)) {
- tt.down = true;
- setTimeout(clearSingle, clickThreshold);
- setTimeout(clearDouble, dblClickThreshold);
- finished = true;
- break; // we only need one match on mousedown
- }
- }
- }
- },
- up = function (e) {
- if (tt.down) {
- var target = _t(e), currentTarget, pathInfo;
- tt.taps++;
- var tc = _touchCount(e);
- for (var eventId in _tapProfiles) {
- if (_tapProfiles.hasOwnProperty(eventId)) {
- var p = _tapProfiles[eventId];
- if (p.touches === tc && (p.taps === 1 || p.taps === tt.taps)) {
- for (var i = 0; i < tt[eventId].length; i++) {
- pathInfo = _pi(e, target, obj, tt[eventId][i][1] != null);
- for (var pLoop = 0; pLoop < pathInfo.end; pLoop++) {
- currentTarget = pathInfo.path[pLoop];
- // this is a single event registration handler.
- if (tt[eventId][i][1] == null || matchesSelector(currentTarget, tt[eventId][i][1], obj)) {
- tt[eventId][i][0].apply(currentTarget, [ e ]);
- break;
- }
- }
- }
- }
- }
- }
- }
- },
- clearSingle = function () {
- tt.down = false;
- },
- clearDouble = function () {
- tt.taps = 0;
- };
-
- DefaultHandler(obj, "mousedown", down);
- DefaultHandler(obj, "mouseup", up);
- }
- // add this child selector (it can be null, that's fine).
- obj.__taTapHandler.downSelectors.push(children);
-
- obj.__taTapHandler[evt].push([fn, children]);
- // the unstore function removes this function from the object's listener list for this type.
- fn.__taUnstore = function () {
- _d(obj.__taTapHandler[evt], fn);
- };
- }
- };
- },
- meeHelper = function (type, evt, obj, target) {
- for (var i in obj.__tamee[type]) {
- if (obj.__tamee[type].hasOwnProperty(i)) {
- obj.__tamee[type][i].apply(target, [ evt ]);
- }
- }
- },
- MouseEnterExitHandler = function () {
- var activeElements = [];
- return function (obj, evt, fn, children) {
- if (!obj.__tamee) {
- // __tamee holds a flag saying whether the mouse is currently "in" the element, and a list of
- // both mouseenter and mouseexit functions.
- obj.__tamee = { over: false, mouseenter: [], mouseexit: [] };
- // register over and out functions
- var over = function (e) {
- var t = _t(e);
- if ((children == null && (t == obj && !obj.__tamee.over)) || (matchesSelector(t, children, obj) && (t.__tamee == null || !t.__tamee.over))) {
- meeHelper("mouseenter", e, obj, t);
- t.__tamee = t.__tamee || {};
- t.__tamee.over = true;
- activeElements.push(t);
- }
- },
- out = function (e) {
- var t = _t(e);
- // is the current target one of the activeElements? and is the
- // related target NOT a descendant of it?
- for (var i = 0; i < activeElements.length; i++) {
- if (t == activeElements[i] && !matchesSelector((e.relatedTarget || e.toElement), "*", t)) {
- t.__tamee.over = false;
- activeElements.splice(i, 1);
- meeHelper("mouseexit", e, obj, t);
- }
- }
- };
-
- _bind(obj, "mouseover", _curryChildFilter(children, obj, over, "mouseover"), over);
- _bind(obj, "mouseout", _curryChildFilter(children, obj, out, "mouseout"), out);
- }
-
- fn.__taUnstore = function () {
- delete obj.__tamee[evt][fn.__tauid];
- };
-
- _store(obj, evt, fn);
- obj.__tamee[evt][fn.__tauid] = fn;
- };
- },
- isTouchDevice = "ontouchstart" in document.documentElement,
- isMouseDevice = "onmousedown" in document.documentElement,
- touchMap = { "mousedown": "touchstart", "mouseup": "touchend", "mousemove": "touchmove" },
- touchstart = "touchstart", touchend = "touchend", touchmove = "touchmove",
- iev = (function () {
- var rv = -1;
- if (navigator.appName == 'Microsoft Internet Explorer') {
- var ua = navigator.userAgent,
- re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
- if (re.exec(ua) != null)
- rv = parseFloat(RegExp.$1);
- }
- return rv;
- })(),
- isIELT9 = iev > -1 && iev < 9,
- _genLoc = function (e, prefix) {
- if (e == null) return [ 0, 0 ];
- var ts = _touches(e), t = _getTouch(ts, 0);
- return [t[prefix + "X"], t[prefix + "Y"]];
- },
- _pageLocation = function (e) {
- if (e == null) return [ 0, 0 ];
- if (isIELT9) {
- return [ e.clientX + document.documentElement.scrollLeft, e.clientY + document.documentElement.scrollTop ];
- }
- else {
- return _genLoc(e, "page");
- }
- },
- _screenLocation = function (e) {
- return _genLoc(e, "screen");
- },
- _clientLocation = function (e) {
- return _genLoc(e, "client");
- },
- _getTouch = function (touches, idx) {
- return touches.item ? touches.item(idx) : touches[idx];
- },
- _touches = function (e) {
- return e.touches && e.touches.length > 0 ? e.touches :
- e.changedTouches && e.changedTouches.length > 0 ? e.changedTouches :
- e.targetTouches && e.targetTouches.length > 0 ? e.targetTouches :
- [ e ];
- },
- _touchCount = function (e) {
- return _touches(e).length;
- },
- //http://www.quirksmode.org/blog/archives/2005/10/_and_the_winner_1.html
- _bind = function (obj, type, fn, originalFn) {
- _store(obj, type, fn);
- originalFn.__tauid = fn.__tauid;
- if (obj.addEventListener)
- obj.addEventListener(type, fn, false);
- else if (obj.attachEvent) {
- var key = type + fn.__tauid;
- obj["e" + key] = fn;
- // TODO look at replacing with .call(..)
- obj[key] = function () {
- obj["e" + key] && obj["e" + key](window.event);
- };
- obj.attachEvent("on" + type, obj[key]);
- }
- },
- _unbind = function (obj, type, fn) {
- if (fn == null) return;
- _each(obj, function () {
- var _el = _gel(this);
- _unstore(_el, type, fn);
- // it has been bound if there is a tauid. otherwise it was not bound and we can ignore it.
- if (fn.__tauid != null) {
- if (_el.removeEventListener) {
- _el.removeEventListener(type, fn, false);
- if (isTouchDevice && touchMap[type]) _el.removeEventListener(touchMap[type], fn, false);
- }
- else if (this.detachEvent) {
- var key = type + fn.__tauid;
- _el[key] && _el.detachEvent("on" + type, _el[key]);
- _el[key] = null;
- _el["e" + key] = null;
- }
- }
-
- // if a touch event was also registered, deregister now.
- if (fn.__taTouchProxy) {
- _unbind(obj, fn.__taTouchProxy[1], fn.__taTouchProxy[0]);
- }
- });
- },
- _each = function (obj, fn) {
- if (obj == null) return;
- // if a list (or list-like), use it. if a string, get a list
- // by running the string through querySelectorAll. else, assume
- // it's an Element.
- // obj.top is "unknown" in IE8.
- obj = (typeof Window !== "undefined" && (typeof obj.top !== "unknown" && obj == obj.top)) ? [ obj ] :
- (typeof obj !== "string") && (obj.tagName == null && obj.length != null) ? obj :
- typeof obj === "string" ? document.querySelectorAll(obj)
- : [ obj ];
-
- for (var i = 0; i < obj.length; i++)
- fn.apply(obj[i]);
- };
-
- /**
- * Mottle offers support for abstracting out the differences
- * between touch and mouse devices, plus "smart click" functionality
- * (don't fire click if the mouse has moved between mousedown and mouseup),
- * and synthesized click/tap events.
- * @class Mottle
- * @constructor
- * @param {Object} params Constructor params
- * @param {Number} [params.clickThreshold=250] Threshold, in milliseconds beyond which a touchstart followed by a touchend is not considered to be a click.
- * @param {Number} [params.dblClickThreshold=450] Threshold, in milliseconds beyond which two successive tap events are not considered to be a click.
- * @param {Boolean} [params.smartClicks=false] If true, won't fire click events if the mouse has moved between mousedown and mouseup. Note that this functionality
- * requires that Mottle consume the mousedown event, and so may not be viable in all use cases.
- */
- root.Mottle = function (params) {
- params = params || {};
- var clickThreshold = params.clickThreshold || 250,
- dblClickThreshold = params.dblClickThreshold || 450,
- mouseEnterExitHandler = new MouseEnterExitHandler(),
- tapHandler = new TapHandler(clickThreshold, dblClickThreshold),
- _smartClicks = params.smartClicks,
- _doBind = function (obj, evt, fn, children) {
- if (fn == null) return;
- _each(obj, function () {
- var _el = _gel(this);
- if (_smartClicks && evt === "click")
- SmartClickHandler(_el, evt, fn, children);
- else if (evt === "tap" || evt === "dbltap" || evt === "contextmenu") {
- tapHandler(_el, evt, fn, children);
- }
- else if (evt === "mouseenter" || evt == "mouseexit")
- mouseEnterExitHandler(_el, evt, fn, children);
- else
- DefaultHandler(_el, evt, fn, children);
- });
- };
-
- /**
- * Removes an element from the DOM, and deregisters all event handlers for it. You should use this
- * to ensure you don't leak memory.
- * @method remove
- * @param {String|Element} el Element, or id of the element, to remove.
- * @return {Mottle} The current Mottle instance; you can chain this method.
- */
- this.remove = function (el) {
- _each(el, function () {
- var _el = _gel(this);
- if (_el.__ta) {
- for (var evt in _el.__ta) {
- if (_el.__ta.hasOwnProperty(evt)) {
- for (var h in _el.__ta[evt]) {
- if (_el.__ta[evt].hasOwnProperty(h))
- _unbind(_el, evt, _el.__ta[evt][h]);
- }
- }
- }
- }
- _el.parentNode && _el.parentNode.removeChild(_el);
- });
- return this;
- };
-
- /**
- * Register an event handler, optionally as a delegate for some set of descendant elements. Note
- * that this method takes either 3 or 4 arguments - if you supply 3 arguments it is assumed you have
- * omitted the `children` parameter, and that the event handler should be bound directly to the given element.
- * @method on
- * @param {Element[]|Element|String} el Either an Element, or a CSS spec for a list of elements, or an array of Elements.
- * @param {String} [children] Comma-delimited list of selectors identifying allowed children.
- * @param {String} event Event ID.
- * @param {Function} fn Event handler function.
- * @return {Mottle} The current Mottle instance; you can chain this method.
- */
- this.on = function (el, event, children, fn) {
- var _el = arguments[0],
- _c = arguments.length == 4 ? arguments[2] : null,
- _e = arguments[1],
- _f = arguments[arguments.length - 1];
-
- _doBind(_el, _e, _f, _c);
- return this;
- };
-
- /**
- * Cancel delegate event handling for the given function. Note that unlike with 'on' you do not supply
- * a list of child selectors here: it removes event delegation from all of the child selectors for which the
- * given function was registered (if any).
- * @method off
- * @param {Element[]|Element|String} el Element - or ID of element - from which to remove event listener.
- * @param {String} event Event ID.
- * @param {Function} fn Event handler function.
- * @return {Mottle} The current Mottle instance; you can chain this method.
- */
- this.off = function (el, event, fn) {
- _unbind(el, event, fn);
- return this;
- };
-
- /**
- * Triggers some event for a given element.
- * @method trigger
- * @param {Element} el Element for which to trigger the event.
- * @param {String} event Event ID.
- * @param {Event} originalEvent The original event. Should be optional of course, but currently is not, due
- * to the jsPlumb use case that caused this method to be added.
- * @param {Object} [payload] Optional object to set as `payload` on the generated event; useful for message passing.
- * @return {Mottle} The current Mottle instance; you can chain this method.
- */
- this.trigger = function (el, event, originalEvent, payload) {
- // MouseEvent undefined in old IE; that's how we know it's a mouse event. A fine Microsoft paradox.
- var originalIsMouse = isMouseDevice && (typeof MouseEvent === "undefined" || originalEvent == null || originalEvent.constructor === MouseEvent);
-
- var eventToBind = (isTouchDevice && !isMouseDevice && touchMap[event]) ? touchMap[event] : event,
- bindingAMouseEvent = !(isTouchDevice && !isMouseDevice && touchMap[event]);
-
- var pl = _pageLocation(originalEvent), sl = _screenLocation(originalEvent), cl = _clientLocation(originalEvent);
- _each(el, function () {
- var _el = _gel(this), evt;
- originalEvent = originalEvent || {
- screenX: sl[0],
- screenY: sl[1],
- clientX: cl[0],
- clientY: cl[1]
- };
-
- var _decorate = function (_evt) {
- if (payload) _evt.payload = payload;
- };
-
- var eventGenerators = {
- "TouchEvent": function (evt) {
- var touch = document.createTouch(window, _el, 0, pl[0], pl[1],
- sl[0], sl[1],
- cl[0], cl[1],
- 0, 0, 0, 0);
-
- // https://gist.github.com/sstephenson/448808
- var touches = document.createTouchList(touch);
- var targetTouches = document.createTouchList(touch);
- var changedTouches = document.createTouchList(touch);
- evt.initTouchEvent(eventToBind, true, true, window, null, sl[0], sl[1],
- cl[0], cl[1], false, false, false, false,
- touches, targetTouches, changedTouches, 1, 0);
- },
- "MouseEvents": function (evt) {
- evt.initMouseEvent(eventToBind, true, true, window, 0,
- sl[0], sl[1],
- cl[0], cl[1],
- false, false, false, false, 1, _el);
-
- if (Sniff.android) {
- // Android's touch events are not standard.
- var t = document.createTouch(window, _el, 0, pl[0], pl[1],
- sl[0], sl[1],
- cl[0], cl[1],
- 0, 0, 0, 0);
-
- evt.touches = evt.targetTouches = evt.changedTouches = document.createTouchList(t);
- }
- }
- };
-
- if (document.createEvent) {
-
- var ite = !bindingAMouseEvent && !originalIsMouse && (isTouchDevice && touchMap[event] && !Sniff.android),
- evtName = ite ? "TouchEvent" : "MouseEvents";
-
- evt = document.createEvent(evtName);
- eventGenerators[evtName](evt);
- _decorate(evt);
- _el.dispatchEvent(evt);
- }
- else if (document.createEventObject) {
- evt = document.createEventObject();
- evt.eventType = evt.eventName = eventToBind;
- evt.screenX = sl[0];
- evt.screenY = sl[1];
- evt.clientX = cl[0];
- evt.clientY = cl[1];
- _decorate(evt);
- _el.fireEvent('on' + eventToBind, evt);
- }
- });
- return this;
- }
- };
-
- /**
- * Static method to assist in 'consuming' an element: uses `stopPropagation` where available, or sets
- * `e.returnValue=false` where it is not.
- * @method Mottle.consume
- * @param {Event} e Event to consume
- * @param {Boolean} [doNotPreventDefault=false] If true, does not call `preventDefault()` on the event.
- */
- root.Mottle.consume = function (e, doNotPreventDefault) {
- if (e.stopPropagation)
- e.stopPropagation();
- else
- e.returnValue = false;
-
- if (!doNotPreventDefault && e.preventDefault)
- e.preventDefault();
- };
-
- /**
- * Gets the page location corresponding to the given event. For touch events this means get the page location of the first touch.
- * @method Mottle.pageLocation
- * @param {Event} e Event to get page location for.
- * @return {Number[]} [left, top] for the given event.
- */
- root.Mottle.pageLocation = _pageLocation;
-
- /**
- * Forces touch events to be turned "on". Useful for testing: even if you don't have a touch device, you can still
- * trigger a touch event when this is switched on and it will be captured and acted on.
- * @method setForceTouchEvents
- * @param {Boolean} value If true, force touch events to be on.
- */
- root.Mottle.setForceTouchEvents = function (value) {
- isTouchDevice = value;
- };
-
- /**
- * Forces mouse events to be turned "on". Useful for testing: even if you don't have a mouse, you can still
- * trigger a mouse event when this is switched on and it will be captured and acted on.
- * @method setForceMouseEvents
- * @param {Boolean} value If true, force mouse events to be on.
- */
- root.Mottle.setForceMouseEvents = function (value) {
- isMouseDevice = value;
- };
-
- root.Mottle.version = "0.8.0";
-
- if (true) {
- exports.Mottle = root.Mottle;
- }
-
-}).call(typeof window === "undefined" ? this : window);
-
-/**
- drag/drop functionality for use with jsPlumb but with
- no knowledge of jsPlumb. supports multiple scopes (separated by whitespace), dragging
- multiple elements, constrain to parent, drop filters, drag start filters, custom
- css classes.
-
- a lot of the functionality of this script is expected to be plugged in:
-
- addClass
- removeClass
-
- addEvent
- removeEvent
-
- getPosition
- setPosition
- getSize
-
- indexOf
- intersects
-
- the name came from here:
-
- http://mrsharpoblunto.github.io/foswig.js/
-
- copyright 2016 jsPlumb
- */
-
-;(function() {
-
- "use strict";
- var root = this;
-
- var _suggest = function(list, item, head) {
- if (list.indexOf(item) === -1) {
- head ? list.unshift(item) : list.push(item);
- return true;
- }
- return false;
- };
-
- var _vanquish = function(list, item) {
- var idx = list.indexOf(item);
- if (idx != -1) list.splice(idx, 1);
- };
-
- var _difference = function(l1, l2) {
- var d = [];
- for (var i = 0; i < l1.length; i++) {
- if (l2.indexOf(l1[i]) == -1)
- d.push(l1[i]);
- }
- return d;
- };
-
- var _isString = function(f) {
- return f == null ? false : (typeof f === "string" || f.constructor == String);
- };
-
- var getOffsetRect = function (elem) {
- // (1)
- var box = elem.getBoundingClientRect(),
- body = document.body,
- docElem = document.documentElement,
- // (2)
- scrollTop = window.pageYOffset || docElem.scrollTop || body.scrollTop,
- scrollLeft = window.pageXOffset || docElem.scrollLeft || body.scrollLeft,
- // (3)
- clientTop = docElem.clientTop || body.clientTop || 0,
- clientLeft = docElem.clientLeft || body.clientLeft || 0,
- // (4)
- top = box.top + scrollTop - clientTop,
- left = box.left + scrollLeft - clientLeft;
-
- return { top: Math.round(top), left: Math.round(left) };
- };
-
- var matchesSelector = function(el, selector, ctx) {
- ctx = ctx || el.parentNode;
- var possibles = ctx.querySelectorAll(selector);
- for (var i = 0; i < possibles.length; i++) {
- if (possibles[i] === el)
- return true;
- }
- return false;
- };
-
- var iev = (function() {
- var rv = -1;
- if (navigator.appName == 'Microsoft Internet Explorer') {
- var ua = navigator.userAgent,
- re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
- if (re.exec(ua) != null)
- rv = parseFloat(RegExp.$1);
- }
- return rv;
- })(),
- DEFAULT_GRID_X = 50,
- DEFAULT_GRID_Y = 50,
- isIELT9 = iev > -1 && iev < 9,
- isIE9 = iev == 9,
- _pl = function(e) {
- if (isIELT9) {
- return [ e.clientX + document.documentElement.scrollLeft, e.clientY + document.documentElement.scrollTop ];
- }
- else {
- var ts = _touches(e), t = _getTouch(ts, 0);
- // for IE9 pageX might be null if the event was synthesized. We try for pageX/pageY first,
- // falling back to clientX/clientY if necessary. In every other browser we want to use pageX/pageY.
- return isIE9 ? [t.pageX || t.clientX, t.pageY || t.clientY] : [t.pageX, t.pageY];
- }
- },
- _getTouch = function(touches, idx) { return touches.item ? touches.item(idx) : touches[idx]; },
- _touches = function(e) {
- return e.touches && e.touches.length > 0 ? e.touches :
- e.changedTouches && e.changedTouches.length > 0 ? e.changedTouches :
- e.targetTouches && e.targetTouches.length > 0 ? e.targetTouches :
- [ e ];
- },
- _classes = {
- draggable:"katavorio-draggable", // draggable elements
- droppable:"katavorio-droppable", // droppable elements
- drag : "katavorio-drag", // elements currently being dragged
- selected:"katavorio-drag-selected", // elements in current drag selection
- active : "katavorio-drag-active", // droppables that are targets of a currently dragged element
- hover : "katavorio-drag-hover", // droppables over which a matching drag element is hovering
- noSelect : "katavorio-drag-no-select", // added to the body to provide a hook to suppress text selection
- ghostProxy:"katavorio-ghost-proxy" // added to a ghost proxy element in use when a drag has exited the bounds of its parent.
- },
- _defaultScope = "katavorio-drag-scope",
- _events = [ "stop", "start", "drag", "drop", "over", "out", "beforeStart" ],
- _devNull = function() {},
- _true = function() { return true; },
- _foreach = function(l, fn, from) {
- for (var i = 0; i < l.length; i++) {
- if (l[i] != from)
- fn(l[i]);
- }
- },
- _setDroppablesActive = function(dd, val, andHover, drag) {
- _foreach(dd, function(e) {
- e.setActive(val);
- if (val) e.updatePosition();
- if (andHover) e.setHover(drag, val);
- });
- },
- _each = function(obj, fn) {
- if (obj == null) return;
- obj = !_isString(obj) && (obj.tagName == null && obj.length != null) ? obj : [ obj ];
- for (var i = 0; i < obj.length; i++)
- fn.apply(obj[i], [ obj[i] ]);
- },
- _consume = function(e) {
- if (e.stopPropagation) {
- e.stopPropagation();
- e.preventDefault();
- }
- else {
- e.returnValue = false;
- }
- },
- _defaultInputFilterSelector = "input,textarea,select,button,option",
- //
- // filters out events on all input elements, like textarea, checkbox, input, select.
- _inputFilter = function(e, el, _katavorio) {
- var t = e.srcElement || e.target;
- return !matchesSelector(t, _katavorio.getInputFilterSelector(), el);
- };
-
- var Super = function(el, params, css, scope) {
- this.params = params || {};
- this.el = el;
- this.params.addClass(this.el, this._class);
- this.uuid = _uuid();
- var enabled = true;
- this.setEnabled = function(e) { enabled = e; };
- this.isEnabled = function() { return enabled; };
- this.toggleEnabled = function() { enabled = !enabled; };
- this.setScope = function(scopes) {
- this.scopes = scopes ? scopes.split(/\s+/) : [ scope ];
- };
- this.addScope = function(scopes) {
- var m = {};
- _each(this.scopes, function(s) { m[s] = true;});
- _each(scopes ? scopes.split(/\s+/) : [], function(s) { m[s] = true;});
- this.scopes = [];
- for (var i in m) this.scopes.push(i);
- };
- this.removeScope = function(scopes) {
- var m = {};
- _each(this.scopes, function(s) { m[s] = true;});
- _each(scopes ? scopes.split(/\s+/) : [], function(s) { delete m[s];});
- this.scopes = [];
- for (var i in m) this.scopes.push(i);
- };
- this.toggleScope = function(scopes) {
- var m = {};
- _each(this.scopes, function(s) { m[s] = true;});
- _each(scopes ? scopes.split(/\s+/) : [], function(s) {
- if (m[s]) delete m[s];
- else m[s] = true;
- });
- this.scopes = [];
- for (var i in m) this.scopes.push(i);
- };
- this.setScope(params.scope);
- this.k = params.katavorio;
- return params.katavorio;
- };
-
- var TRUE = function() { return true; };
- var FALSE = function() { return false; };
-
- var Drag = function(el, params, css, scope) {
- this._class = css.draggable;
- var k = Super.apply(this, arguments);
- this.rightButtonCanDrag = this.params.rightButtonCanDrag;
- var downAt = [0,0], posAtDown = null, pagePosAtDown = null, pageDelta = [0,0], moving = false,
- consumeStartEvent = this.params.consumeStartEvent !== false,
- dragEl = this.el,
- clone = this.params.clone,
- scroll = this.params.scroll,
- _multipleDrop = params.multipleDrop !== false,
- isConstrained = false,
- useGhostProxy = params.ghostProxy === true ? TRUE : params.ghostProxy && typeof params.ghostProxy === "function" ? params.ghostProxy : FALSE,
- ghostProxy = function(el) { return el.cloneNode(true); };
-
- var snapThreshold = params.snapThreshold || 5,
- _snap = function(pos, x, y, thresholdX, thresholdY) {
- thresholdX = thresholdX || snapThreshold;
- thresholdY = thresholdY || snapThreshold;
- var _dx = Math.floor(pos[0] / x),
- _dxl = x * _dx,
- _dxt = _dxl + x,
- _x = Math.abs(pos[0] - _dxl) <= thresholdX ? _dxl : Math.abs(_dxt - pos[0]) <= thresholdX ? _dxt : pos[0];
-
- var _dy = Math.floor(pos[1] / y),
- _dyl = y * _dy,
- _dyt = _dyl + y,
- _y = Math.abs(pos[1] - _dyl) <= thresholdY ? _dyl : Math.abs(_dyt - pos[1]) <= thresholdY ? _dyt : pos[1];
-
- return [ _x, _y];
- };
-
- this.posses = [];
- this.posseRoles = {};
-
- this.toGrid = function(pos) {
- if (this.params.grid == null) {
- return pos;
- }
- else {
- return _snap(pos, this.params.grid[0], this.params.grid[1]);
- }
- };
-
- this.snap = function(x, y) {
- if (dragEl == null) return;
- x = x || (this.params.grid ? this.params.grid[0] : DEFAULT_GRID_X);
- y = y || (this.params.grid ? this.params.grid[1] : DEFAULT_GRID_Y);
- var p = this.params.getPosition(dragEl);
- this.params.setPosition(dragEl, _snap(p, x, y, x, y));
- };
-
- this.setUseGhostProxy = function(val) {
- useGhostProxy = val ? TRUE : FALSE;
- };
-
- var constrain;
- var negativeFilter = function(pos) {
- return (params.allowNegative === false) ? [ Math.max (0, pos[0]), Math.max(0, pos[1]) ] : pos;
- };
-
- var _setConstrain = function(value) {
- constrain = typeof value === "function" ? value : value ? function(pos) {
- return negativeFilter([
- Math.max(0, Math.min(constrainRect.w - this.size[0], pos[0])),
- Math.max(0, Math.min(constrainRect.h - this.size[1], pos[1]))
- ]);
- }.bind(this) : function(pos) { return negativeFilter(pos); };
- }.bind(this);
-
- _setConstrain(typeof this.params.constrain === "function" ? this.params.constrain : (this.params.constrain || this.params.containment));
-
-
- /**
- * Sets whether or not the Drag is constrained. A value of 'true' means constrain to parent bounds; a function
- * will be executed and returns true if the position is allowed.
- * @param value
- */
- this.setConstrain = function(value) {
- _setConstrain(value);
- };
-
- var revertFunction;
- /**
- * Sets a function to call on drag stop, which, if it returns true, indicates that the given element should
- * revert to its position before the previous drag.
- * @param fn
- */
- this.setRevert = function(fn) {
- revertFunction = fn;
- };
-
- var _assignId = function(obj) {
- if (typeof obj == "function") {
- obj._katavorioId = _uuid();
- return obj._katavorioId;
- } else {
- return obj;
- }
- },
- // a map of { spec -> [ fn, exclusion ] } entries.
- _filters = {},
- _testFilter = function(e) {
- for (var key in _filters) {
- var f = _filters[key];
- var rv = f[0](e);
- if (f[1]) rv = !rv;
- if (!rv) return false;
- }
- return true;
- },
- _setFilter = this.setFilter = function(f, _exclude) {
- if (f) {
- var key = _assignId(f);
- _filters[key] = [
- function(e) {
- var t = e.srcElement || e.target, m;
- if (_isString(f)) {
- m = matchesSelector(t, f, el);
- }
- else if (typeof f === "function") {
- m = f(e, el);
- }
- return m;
- },
- _exclude !== false
- ];
-
- }
- },
- _addFilter = this.addFilter = _setFilter,
- _removeFilter = this.removeFilter = function(f) {
- var key = typeof f == "function" ? f._katavorioId : f;
- delete _filters[key];
- };
-
- this.clearAllFilters = function() {
- _filters = {};
- };
-
- this.canDrag = this.params.canDrag || _true;
-
- var constrainRect,
- matchingDroppables = [], intersectingDroppables = [];
-
- this.downListener = function(e) {
- var isNotRightClick = this.rightButtonCanDrag || (e.which !== 3 && e.button !== 2);
- if (isNotRightClick && this.isEnabled() && this.canDrag()) {
- var _f = _testFilter(e) && _inputFilter(e, this.el, this.k);
- if (_f) {
- if (!clone)
- dragEl = this.el;
- else {
- dragEl = this.el.cloneNode(true);
- dragEl.setAttribute("id", null);
- dragEl.style.position = "absolute";
- // the clone node is added to the body; getOffsetRect gives us a value
- // relative to the body.
- var b = getOffsetRect(this.el);
- dragEl.style.left = b.left + "px";
- dragEl.style.top = b.top + "px";
- document.body.appendChild(dragEl);
- }
- consumeStartEvent && _consume(e);
- downAt = _pl(e);
- //
- this.params.bind(document, "mousemove", this.moveListener);
- this.params.bind(document, "mouseup", this.upListener);
- k.markSelection(this);
- k.markPosses(this);
- this.params.addClass(document.body, css.noSelect);
- _dispatch("beforeStart", {el:this.el, pos:posAtDown, e:e, drag:this});
- }
- else if (this.params.consumeFilteredEvents) {
- _consume(e);
- }
- }
- }.bind(this);
-
- this.moveListener = function(e) {
- if (downAt) {
- if (!moving) {
- var _continue = _dispatch("start", {el:this.el, pos:posAtDown, e:e, drag:this});
- if (_continue !== false) {
- if (!downAt) return;
- this.mark(true);
- moving = true;
- }
- }
-
- // it is possible that the start event caused the drag to be aborted. So we check
- // again that we are currently dragging.
- if (downAt) {
- intersectingDroppables.length = 0;
- var pos = _pl(e), dx = pos[0] - downAt[0], dy = pos[1] - downAt[1],
- z = this.params.ignoreZoom ? 1 : k.getZoom();
- dx /= z;
- dy /= z;
- this.moveBy(dx, dy, e);
- k.updateSelection(dx, dy, this);
- k.updatePosses(dx, dy, this);
- }
- }
- }.bind(this);
-
- this.upListener = function(e) {
- if (downAt) {
- downAt = null;
- this.params.unbind(document, "mousemove", this.moveListener);
- this.params.unbind(document, "mouseup", this.upListener);
- this.params.removeClass(document.body, css.noSelect);
- this.unmark(e);
- k.unmarkSelection(this, e);
- k.unmarkPosses(this, e);
- this.stop(e);
- k.notifySelectionDragStop(this, e);
- k.notifyPosseDragStop(this, e);
- moving = false;
- if (clone) {
- dragEl && dragEl.parentNode && dragEl.parentNode.removeChild(dragEl);
- dragEl = null;
- }
-
- intersectingDroppables.length = 0;
-
- if (revertFunction && revertFunction(this.el, this.params.getPosition(this.el)) === true) {
- this.params.setPosition(this.el, posAtDown);
- _dispatch("revert", this.el);
- }
- }
- }.bind(this);
-
- this.getFilters = function() { return _filters; };
-
- this.abort = function() {
- if (downAt != null)
- this.upListener();
- };
-
- this.getDragElement = function() {
- return dragEl || this.el;
- };
-
- var listeners = {"start":[], "drag":[], "stop":[], "over":[], "out":[], "beforeStart":[], "revert":[] };
- if (params.events.start) listeners.start.push(params.events.start);
- if (params.events.beforeStart) listeners.beforeStart.push(params.events.beforeStart);
- if (params.events.stop) listeners.stop.push(params.events.stop);
- if (params.events.drag) listeners.drag.push(params.events.drag);
- if (params.events.revert) listeners.revert.push(params.events.revert);
-
- this.on = function(evt, fn) {
- if (listeners[evt]) listeners[evt].push(fn);
- };
-
- this.off = function(evt, fn) {
- if (listeners[evt]) {
- var l = [];
- for (var i = 0; i < listeners[evt].length; i++) {
- if (listeners[evt][i] !== fn) l.push(listeners[evt][i]);
- }
- listeners[evt] = l;
- }
- };
-
- var _dispatch = function(evt, value) {
- if (listeners[evt]) {
- for (var i = 0; i < listeners[evt].length; i++) {
- try {
- listeners[evt][i](value);
- }
- catch (e) { }
- }
- }
- };
-
- this.notifyStart = function(e) {
- _dispatch("start", {el:this.el, pos:this.params.getPosition(dragEl), e:e, drag:this});
- };
-
- this.stop = function(e, force) {
- if (force || moving) {
- var positions = [],
- sel = k.getSelection(),
- dPos = this.params.getPosition(dragEl);
-
- if (sel.length > 1) {
- for (var i = 0; i < sel.length; i++) {
- var p = this.params.getPosition(sel[i].el);
- positions.push([ sel[i].el, { left: p[0], top: p[1] }, sel[i] ]);
- }
- }
- else {
- positions.push([ dragEl, {left:dPos[0], top:dPos[1]}, this ]);
- }
-
- _dispatch("stop", {
- el: dragEl,
- pos: ghostProxyOffsets || dPos,
- finalPos:dPos,
- e: e,
- drag: this,
- selection:positions
- });
- }
- };
-
- this.mark = function(andNotify) {
- posAtDown = this.params.getPosition(dragEl);
- pagePosAtDown = this.params.getPosition(dragEl, true);
- pageDelta = [pagePosAtDown[0] - posAtDown[0], pagePosAtDown[1] - posAtDown[1]];
- this.size = this.params.getSize(dragEl);
- matchingDroppables = k.getMatchingDroppables(this);
- _setDroppablesActive(matchingDroppables, true, false, this);
- this.params.addClass(dragEl, this.params.dragClass || css.drag);
- //if (this.params.constrain || this.params.containment) {
- var cs = this.params.getSize(dragEl.parentNode);
- constrainRect = { w:cs[0], h:cs[1] };
- //}
- if (andNotify) {
- k.notifySelectionDragStart(this);
- }
- };
- var ghostProxyOffsets;
- this.unmark = function(e, doNotCheckDroppables) {
- _setDroppablesActive(matchingDroppables, false, true, this);
-
-
- if (isConstrained && useGhostProxy(this.el)) {
- ghostProxyOffsets = [dragEl.offsetLeft, dragEl.offsetTop];
- this.el.parentNode.removeChild(dragEl);
- dragEl = this.el;
- }
- else {
- ghostProxyOffsets = null;
- }
-
- this.params.removeClass(dragEl, this.params.dragClass || css.drag);
- matchingDroppables.length = 0;
- isConstrained = false;
- if (!doNotCheckDroppables) {
- if (intersectingDroppables.length > 0 && ghostProxyOffsets) {
- params.setPosition(this.el, ghostProxyOffsets);
- }
- intersectingDroppables.sort(_rankSort);
- for (var i = 0; i < intersectingDroppables.length; i++) {
- var retVal = intersectingDroppables[i].drop(this, e);
- if (retVal === true) break;
- }
- }
- };
- this.moveBy = function(dx, dy, e) {
- intersectingDroppables.length = 0;
- var desiredLoc = this.toGrid([posAtDown[0] + dx, posAtDown[1] + dy]),
- cPos = constrain(desiredLoc, dragEl);
-
- if (useGhostProxy(this.el)) {
- if (desiredLoc[0] != cPos[0] || desiredLoc[1] != cPos[1]) {
- if (!isConstrained) {
- var gp = ghostProxy(this.el);
- params.addClass(gp, _classes.ghostProxy);
- this.el.parentNode.appendChild(gp);
- dragEl = gp;
- isConstrained = true;
- }
- cPos = desiredLoc;
- }
- else {
- if (isConstrained) {
- this.el.parentNode.removeChild(dragEl);
- dragEl = this.el;
- isConstrained = false;
- }
- }
- }
-
- var rect = { x:cPos[0], y:cPos[1], w:this.size[0], h:this.size[1]},
- pageRect = { x:rect.x + pageDelta[0], y:rect.y + pageDelta[1], w:rect.w, h:rect.h},
- focusDropElement = null;
-
-
-
- this.params.setPosition(dragEl, cPos);
- for (var i = 0; i < matchingDroppables.length; i++) {
- var r2 = { x:matchingDroppables[i].pagePosition[0], y:matchingDroppables[i].pagePosition[1], w:matchingDroppables[i].size[0], h:matchingDroppables[i].size[1]};
- if (this.params.intersects(pageRect, r2) && (_multipleDrop || focusDropElement == null || focusDropElement == matchingDroppables[i].el) && matchingDroppables[i].canDrop(this)) {
- if (!focusDropElement) focusDropElement = matchingDroppables[i].el;
- intersectingDroppables.push(matchingDroppables[i]);
- matchingDroppables[i].setHover(this, true, e);
- }
- else if (matchingDroppables[i].isHover()) {
- matchingDroppables[i].setHover(this, false, e);
- }
- }
-
- _dispatch("drag", {el:this.el, pos:cPos, e:e, drag:this});
-
- /* test to see if the parent needs to be scrolled (future)
- if (scroll) {
- var pnsl = dragEl.parentNode.scrollLeft, pnst = dragEl.parentNode.scrollTop;
- console.log("scroll!", pnsl, pnst);
- }*/
- };
- this.destroy = function() {
- this.params.unbind(this.el, "mousedown", this.downListener);
- this.params.unbind(document, "mousemove", this.moveListener);
- this.params.unbind(document, "mouseup", this.upListener);
- this.downListener = null;
- this.upListener = null;
- this.moveListener = null;
- };
-
- // init:register mousedown, and perhaps set a filter
- this.params.bind(this.el, "mousedown", this.downListener);
-
- // if handle provded, use that. otherwise, try to set a filter.
- // note that a `handle` selector always results in filterExclude being set to false, ie.
- // the selector defines the handle element(s).
- if (this.params.handle)
- _setFilter(this.params.handle, false);
- else
- _setFilter(this.params.filter, this.params.filterExclude);
- };
-
- var Drop = function(el, params, css, scope) {
- this._class = css.droppable;
- this.params = params || {};
- this.rank = params.rank || 0;
- this._activeClass = this.params.activeClass || css.active;
- this._hoverClass = this.params.hoverClass || css.hover;
- Super.apply(this, arguments);
- var hover = false;
- this.allowLoopback = this.params.allowLoopback !== false;
-
- this.setActive = function(val) {
- this.params[val ? "addClass" : "removeClass"](this.el, this._activeClass);
- };
-
- this.updatePosition = function() {
- this.position = this.params.getPosition(this.el);
- this.pagePosition = this.params.getPosition(this.el, true);
- this.size = this.params.getSize(this.el);
- };
-
- this.canDrop = this.params.canDrop || function(drag) {
- return true;
- };
-
- this.isHover = function() { return hover; };
-
- this.setHover = function(drag, val, e) {
- // if turning off hover but this was not the drag that caused the hover, ignore.
- if (val || this.el._katavorioDragHover == null || this.el._katavorioDragHover == drag.el._katavorio) {
- this.params[val ? "addClass" : "removeClass"](this.el, this._hoverClass);
- //this.el._katavorioDragHover = val ? drag.el._katavorio : null;
- this.el._katavorioDragHover = val ? drag.el._katavorio : null;
- if (hover !== val)
- this.params.events[val ? "over" : "out"]({el:this.el, e:e, drag:drag, drop:this});
- hover = val;
- }
- };
-
- this.drop = function(drag, event) {
- return this.params.events["drop"]({ drag:drag, e:event, drop:this });
- };
-
- this.destroy = function() {
- this._class = null;
- this._activeClass = null;
- this._hoverClass = null;
- //this.params = null;
- hover = null;
- //this.el = null;
- };
- };
-
- var _uuid = function() {
- return ('xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
- var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
- return v.toString(16);
- }));
- };
-
- var _rankSort = function(a,b) {
- return a.rank < b.rank ? 1 : a.rank > b.rank ? -1 : 0;
- };
-
- var _gel = function(el) {
- if (el == null) return null;
- el = (typeof el === "string" || el.constructor == String) ? document.getElementById(el) : el;
- if (el == null) return null;
- el._katavorio = el._katavorio || _uuid();
- return el;
- };
-
- root.Katavorio = function(katavorioParams) {
-
- var _selection = [],
- _selectionMap = {};
-
- this._dragsByScope = {};
- this._dropsByScope = {};
- var _zoom = 1,
- _reg = function(obj, map) {
- _each(obj, function(_obj) {
- for(var i = 0; i < _obj.scopes.length; i++) {
- map[_obj.scopes[i]] = map[_obj.scopes[i]] || [];
- map[_obj.scopes[i]].push(_obj);
- }
- });
- },
- _unreg = function(obj, map) {
- var c = 0;
- _each(obj, function(_obj) {
- for(var i = 0; i < _obj.scopes.length; i++) {
- if (map[_obj.scopes[i]]) {
- var idx = katavorioParams.indexOf(map[_obj.scopes[i]], _obj);
- if (idx != -1) {
- map[_obj.scopes[i]].splice(idx, 1);
- c++;
- }
- }
- }
- });
-
- return c > 0 ;
- },
- _getMatchingDroppables = this.getMatchingDroppables = function(drag) {
- var dd = [], _m = {};
- for (var i = 0; i < drag.scopes.length; i++) {
- var _dd = this._dropsByScope[drag.scopes[i]];
- if (_dd) {
- for (var j = 0; j < _dd.length; j++) {
- if (_dd[j].canDrop(drag) && !_m[_dd[j].uuid] && (_dd[j].allowLoopback || _dd[j].el !== drag.el)) {
- _m[_dd[j].uuid] = true;
- dd.push(_dd[j]);
- }
- }
- }
- }
- dd.sort(_rankSort);
- return dd;
- },
- _prepareParams = function(p) {
- p = p || {};
- var _p = {
- events:{}
- }, i;
- for (i in katavorioParams) _p[i] = katavorioParams[i];
- for (i in p) _p[i] = p[i];
- // events
-
- for (i = 0; i < _events.length; i++) {
- _p.events[_events[i]] = p[_events[i]] || _devNull;
- }
- _p.katavorio = this;
- return _p;
- }.bind(this),
- _mistletoe = function(existingDrag, params) {
- for (var i = 0; i < _events.length; i++) {
- if (params[_events[i]]) {
- existingDrag.on(_events[i], params[_events[i]]);
- }
- }
- }.bind(this),
- _css = {},
- overrideCss = katavorioParams.css || {},
- _scope = katavorioParams.scope || _defaultScope;
-
- // prepare map of css classes based on defaults frst, then optional overrides
- for (var i in _classes) _css[i] = _classes[i];
- for (var i in overrideCss) _css[i] = overrideCss[i];
-
- var inputFilterSelector = katavorioParams.inputFilterSelector || _defaultInputFilterSelector;
- /**
- * Gets the selector identifying which input elements to filter from drag events.
- * @method getInputFilterSelector
- * @return {String} Current input filter selector.
- */
- this.getInputFilterSelector = function() { return inputFilterSelector; };
-
- /**
- * Sets the selector identifying which input elements to filter from drag events.
- * @method setInputFilterSelector
- * @param {String} selector Input filter selector to set.
- * @return {Katavorio} Current instance; method may be chained.
- */
- this.setInputFilterSelector = function(selector) {
- inputFilterSelector = selector;
- return this;
- };
-
- this.draggable = function(el, params) {
- var o = [];
- _each(el, function(_el) {
- _el = _gel(_el);
- if (_el != null) {
- if (_el._katavorioDrag == null) {
- var p = _prepareParams(params);
- _el._katavorioDrag = new Drag(_el, p, _css, _scope);
- _reg(_el._katavorioDrag, this._dragsByScope);
- o.push(_el._katavorioDrag);
- katavorioParams.addClass(_el, _css.draggable);
- }
- else {
- _mistletoe(_el._katavorioDrag, params);
- }
- }
- }.bind(this));
- return o;
-
- };
-
- this.droppable = function(el, params) {
- var o = [];
- _each(el, function(_el) {
- _el = _gel(_el);
- if (_el != null) {
- var drop = new Drop(_el, _prepareParams(params), _css, _scope);
- _el._katavorioDrop = _el._katavorioDrop || [];
- _el._katavorioDrop.push(drop);
- _reg(drop, this._dropsByScope);
- o.push(drop);
- katavorioParams.addClass(_el, _css.droppable);
- }
- }.bind(this));
- return o;
- };
-
- /**
- * @name Katavorio#select
- * @function
- * @desc Adds an element to the current selection (for multiple node drag)
- * @param {Element|String} DOM element - or id of the element - to add.
- */
- this.select = function(el) {
- _each(el, function() {
- var _el = _gel(this);
- if (_el && _el._katavorioDrag) {
- if (!_selectionMap[_el._katavorio]) {
- _selection.push(_el._katavorioDrag);
- _selectionMap[_el._katavorio] = [ _el, _selection.length - 1 ];
- katavorioParams.addClass(_el, _css.selected);
- }
- }
- });
- return this;
- };
-
- /**
- * @name Katavorio#deselect
- * @function
- * @desc Removes an element from the current selection (for multiple node drag)
- * @param {Element|String} DOM element - or id of the element - to remove.
- */
- this.deselect = function(el) {
- _each(el, function() {
- var _el = _gel(this);
- if (_el && _el._katavorio) {
- var e = _selectionMap[_el._katavorio];
- if (e) {
- var _s = [];
- for (var i = 0; i < _selection.length; i++)
- if (_selection[i].el !== _el) _s.push(_selection[i]);
- _selection = _s;
- delete _selectionMap[_el._katavorio];
- katavorioParams.removeClass(_el, _css.selected);
- }
- }
- });
- return this;
- };
-
- this.deselectAll = function() {
- for (var i in _selectionMap) {
- var d = _selectionMap[i];
- katavorioParams.removeClass(d[0], _css.selected);
- }
-
- _selection.length = 0;
- _selectionMap = {};
- };
-
- this.markSelection = function(drag) {
- _foreach(_selection, function(e) { e.mark(); }, drag);
- };
-
- this.markPosses = function(drag) {
- if (drag.posses) {
- _each(drag.posses, function(p) {
- if (drag.posseRoles[p] && _posses[p]) {
- _foreach(_posses[p].members, function (d) {
- d.mark();
- }, drag);
- }
- })
- }
- };
-
- this.unmarkSelection = function(drag, event) {
- _foreach(_selection, function(e) { e.unmark(event); }, drag);
- };
-
- this.unmarkPosses = function(drag, event) {
- if (drag.posses) {
- _each(drag.posses, function(p) {
- if (drag.posseRoles[p] && _posses[p]) {
- _foreach(_posses[p].members, function (d) {
- d.unmark(event, true);
- }, drag);
- }
- });
- }
- };
-
- this.getSelection = function() { return _selection.slice(0); };
-
- this.updateSelection = function(dx, dy, drag) {
- _foreach(_selection, function(e) { e.moveBy(dx, dy); }, drag);
- };
-
- var _posseAction = function(fn, drag) {
- if (drag.posses) {
- _each(drag.posses, function(p) {
- if (drag.posseRoles[p] && _posses[p]) {
- _foreach(_posses[p].members, function (e) {
- fn(e);
- }, drag);
- }
- });
- }
- };
-
- this.updatePosses = function(dx, dy, drag) {
- _posseAction(function(e) { e.moveBy(dx, dy); }, drag);
- };
-
- this.notifyPosseDragStop = function(drag, evt) {
- _posseAction(function(e) { e.stop(evt, true); }, drag);
- };
-
- this.notifySelectionDragStop = function(drag, evt) {
- _foreach(_selection, function(e) { e.stop(evt, true); }, drag);
- };
-
- this.notifySelectionDragStart = function(drag, evt) {
- _foreach(_selection, function(e) { e.notifyStart(evt);}, drag);
- };
-
- this.setZoom = function(z) { _zoom = z; };
- this.getZoom = function() { return _zoom; };
-
- // does the work of changing scopes
- var _scopeManip = function(kObj, scopes, map, fn) {
- _each(kObj, function(_kObj) {
- _unreg(_kObj, map); // deregister existing scopes
- _kObj[fn](scopes); // set scopes
- _reg(_kObj, map); // register new ones
- });
- };
-
- _each([ "set", "add", "remove", "toggle"], function(v) {
- this[v + "Scope"] = function(el, scopes) {
- _scopeManip(el._katavorioDrag, scopes, this._dragsByScope, v + "Scope");
- _scopeManip(el._katavorioDrop, scopes, this._dropsByScope, v + "Scope");
- }.bind(this);
- this[v + "DragScope"] = function(el, scopes) {
- _scopeManip(el.constructor === Drag ? el : el._katavorioDrag, scopes, this._dragsByScope, v + "Scope");
- }.bind(this);
- this[v + "DropScope"] = function(el, scopes) {
- _scopeManip(el.constructor === Drop ? el : el._katavorioDrop, scopes, this._dropsByScope, v + "Scope");
- }.bind(this);
- }.bind(this));
-
- this.snapToGrid = function(x, y) {
- for (var s in this._dragsByScope) {
- _foreach(this._dragsByScope[s], function(d) { d.snap(x, y); });
- }
- };
-
- this.getDragsForScope = function(s) { return this._dragsByScope[s]; };
- this.getDropsForScope = function(s) { return this._dropsByScope[s]; };
-
- var _destroy = function(el, type, map) {
- el = _gel(el);
- if (el[type]) {
-
- // remove from selection, if present.
- var selIdx = _selection.indexOf(el[type]);
- if (selIdx >= 0) {
- _selection.splice(selIdx, 1);
- }
-
- if (_unreg(el[type], map)) {
- _each(el[type], function(kObj) { kObj.destroy() });
- }
-
- delete el[type];
- }
- };
-
- this.elementRemoved = function(el) {
- this.destroyDraggable(el);
- this.destroyDroppable(el);
- };
-
- this.destroyDraggable = function(el) {
- _destroy(el, "_katavorioDrag", this._dragsByScope);
- };
-
- this.destroyDroppable = function(el) {
- _destroy(el, "_katavorioDrop", this._dropsByScope);
- };
-
- this.reset = function() {
- this._dragsByScope = {};
- this._dropsByScope = {};
- _selection = [];
- _selectionMap = {};
- _posses = {};
- };
-
- // ----- groups
- var _posses = {};
-
- var _processOneSpec = function(el, _spec, dontAddExisting) {
- var posseId = _isString(_spec) ? _spec : _spec.id;
- var active = _isString(_spec) ? true : _spec.active !== false;
- var posse = _posses[posseId] || (function() {
- var g = {name:posseId, members:[]};
- _posses[posseId] = g;
- return g;
- })();
- _each(el, function(_el) {
- if (_el._katavorioDrag) {
-
- if (dontAddExisting && _el._katavorioDrag.posseRoles[posse.name] != null) return;
-
- _suggest(posse.members, _el._katavorioDrag);
- _suggest(_el._katavorioDrag.posses, posse.name);
- _el._katavorioDrag.posseRoles[posse.name] = active;
- }
- });
- return posse;
- };
-
- /**
- * Add the given element to the posse with the given id, creating the group if it at first does not exist.
- * @method addToPosse
- * @param {Element} el Element to add.
- * @param {String...|Object...} spec Variable args parameters. Each argument can be a either a String, indicating
- * the ID of a Posse to which the element should be added as an active participant, or an Object containing
- * `{ id:"posseId", active:false/true}`. In the latter case, if `active` is not provided it is assumed to be
- * true.
- * @returns {Posse|Posse[]} The Posse(s) to which the element(s) was/were added.
- */
- this.addToPosse = function(el, spec) {
-
- var posses = [];
-
- for (var i = 1; i < arguments.length; i++) {
- posses.push(_processOneSpec(el, arguments[i]));
- }
-
- return posses.length == 1 ? posses[0] : posses;
- };
-
- /**
- * Sets the posse(s) for the element with the given id, creating those that do not yet exist, and removing from
- * the element any current Posses that are not specified by this method call. This method will not change the
- * active/passive state if it is given a posse in which the element is already a member.
- * @method setPosse
- * @param {Element} el Element to set posse(s) on.
- * @param {String...|Object...} spec Variable args parameters. Each argument can be a either a String, indicating
- * the ID of a Posse to which the element should be added as an active participant, or an Object containing
- * `{ id:"posseId", active:false/true}`. In the latter case, if `active` is not provided it is assumed to be
- * true.
- * @returns {Posse|Posse[]} The Posse(s) to which the element(s) now belongs.
- */
- this.setPosse = function(el, spec) {
-
- var posses = [];
-
- for (var i = 1; i < arguments.length; i++) {
- posses.push(_processOneSpec(el, arguments[i], true).name);
- }
-
- _each(el, function(_el) {
- if (_el._katavorioDrag) {
- var diff = _difference(_el._katavorioDrag.posses, posses);
- var p = [];
- Array.prototype.push.apply(p, _el._katavorioDrag.posses);
- for (var i = 0; i < diff.length; i++) {
- this.removeFromPosse(_el, diff[i]);
- }
- }
- }.bind(this));
-
- return posses.length == 1 ? posses[0] : posses;
- };
-
- /**
- * Remove the given element from the given posse(s).
- * @method removeFromPosse
- * @param {Element} el Element to remove.
- * @param {String...} posseId Varargs parameter: one value for each posse to remove the element from.
- */
- this.removeFromPosse = function(el, posseId) {
- if (arguments.length < 2) throw new TypeError("No posse id provided for remove operation");
- for(var i = 1; i < arguments.length; i++) {
- posseId = arguments[i];
- _each(el, function (_el) {
- if (_el._katavorioDrag && _el._katavorioDrag.posses) {
- var d = _el._katavorioDrag;
- _each(posseId, function (p) {
- _vanquish(_posses[p].members, d);
- _vanquish(d.posses, p);
- delete d.posseRoles[p];
- });
- }
- });
- }
- };
-
- /**
- * Remove the given element from all Posses to which it belongs.
- * @method removeFromAllPosses
- * @param {Element|Element[]} el Element to remove from Posses.
- */
- this.removeFromAllPosses = function(el) {
- _each(el, function(_el) {
- if (_el._katavorioDrag && _el._katavorioDrag.posses) {
- var d = _el._katavorioDrag;
- _each(d.posses, function(p) {
- _vanquish(_posses[p].members, d);
- });
- d.posses.length = 0;
- d.posseRoles = {};
- }
- });
- };
-
- /**
- * Changes the participation state for the element in the Posse with the given ID.
- * @param {Element|Element[]} el Element(s) to change state for.
- * @param {String} posseId ID of the Posse to change element state for.
- * @param {Boolean} state True to make active, false to make passive.
- */
- this.setPosseState = function(el, posseId, state) {
- var posse = _posses[posseId];
- if (posse) {
- _each(el, function(_el) {
- if (_el._katavorioDrag && _el._katavorioDrag.posses) {
- _el._katavorioDrag.posseRoles[posse.name] = state;
- }
- });
- }
- };
-
- };
-
- root.Katavorio.version = "0.19.2";
-
- if (true) {
- exports.Katavorio = root.Katavorio;
- }
-
-}).call(typeof window !== 'undefined' ? window : this);
-
-/*
- * jsPlumb
- *
- * Title:jsPlumb 2.3.0
- *
- * Provides a way to visually connect elements on an HTML page, using SVG.
- *
- * This file contains utility functions that run in both browsers and headless.
- *
- * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
- *
- * http://jsplumbtoolkit.com
- * http://github.com/sporritt/jsplumb
- *
- * Dual licensed under the MIT and GPL2 licenses.
- */
-
-;
-(function () {
-
- var _isa = function (a) {
- return Object.prototype.toString.call(a) === "[object Array]";
- },
- _isnum = function (n) {
- return Object.prototype.toString.call(n) === "[object Number]";
- },
- _iss = function (s) {
- return typeof s === "string";
- },
- _isb = function (s) {
- return typeof s === "boolean";
- },
- _isnull = function (s) {
- return s == null;
- },
- _iso = function (o) {
- return o == null ? false : Object.prototype.toString.call(o) === "[object Object]";
- },
- _isd = function (o) {
- return Object.prototype.toString.call(o) === "[object Date]";
- },
- _isf = function (o) {
- return Object.prototype.toString.call(o) === "[object Function]";
- },
- _isNamedFunction = function(o) {
- return _isf(o) && o.name != null && o.name.length > 0;
- },
- _ise = function (o) {
- for (var i in o) {
- if (o.hasOwnProperty(i)) {
- return false;
- }
- }
- return true;
- };
-
- var root = this;
- root.jsPlumbUtil = {
- isArray: _isa,
- isString: _iss,
- isBoolean: _isb,
- isNull: _isnull,
- isObject: _iso,
- isDate: _isd,
- isFunction: _isf,
- isEmpty: _ise,
- isNumber: _isnum,
- clone: function (a) {
- if (_iss(a)) {
- return "" + a;
- }
- else if (_isb(a)) {
- return !!a;
- }
- else if (_isd(a)) {
- return new Date(a.getTime());
- }
- else if (_isf(a)) {
- return a;
- }
- else if (_isa(a)) {
- var b = [];
- for (var i = 0; i < a.length; i++) {
- b.push(this.clone(a[i]));
- }
- return b;
- }
- else if (_iso(a)) {
- var c = {};
- for (var j in a) {
- c[j] = this.clone(a[j]);
- }
- return c;
- }
- else {
- return a;
- }
- },
- merge: function (a, b, collations) {
- // first change the collations array - if present - into a lookup table, because its faster.
- var cMap = {}, ar, i;
- collations = collations || [];
- for (i = 0; i < collations.length; i++) {
- cMap[collations[i]] = true;
- }
-
- var c = this.clone(a);
- for (i in b) {
- if (c[i] == null) {
- c[i] = b[i];
- }
- else if (_iss(b[i]) || _isb(b[i])) {
- if (!cMap[i]) {
- c[i] = b[i]; // if we dont want to collate, just copy it in.
- }
- else {
- ar = [];
- // if c's object is also an array we can keep its values.
- ar.push.apply(ar, _isa(c[i]) ? c[i] : [ c[i] ]);
- ar.push.apply(ar, _isa(b[i]) ? b[i] : [ b[i] ]);
- c[i] = ar;
- }
- }
- else {
- if (_isa(b[i])) {
- ar = [];
- // if c's object is also an array we can keep its values.
- if (_isa(c[i])) {
- ar.push.apply(ar, c[i]);
- }
- ar.push.apply(ar, b[i]);
- c[i] = ar;
- }
- else if (_iso(b[i])) {
- // overwite c's value with an object if it is not already one.
- if (!_iso(c[i])) {
- c[i] = {};
- }
- for (var j in b[i]) {
- c[i][j] = b[i][j];
- }
- }
- }
-
- }
- return c;
- },
- replace: function (inObj, path, value) {
- if (inObj == null) {
- return;
- }
- var q = inObj, t = q;
- path.replace(/([^\.])+/g, function (term, lc, pos, str) {
- var array = term.match(/([^\[0-9]+){1}(\[)([0-9+])/),
- last = pos + term.length >= str.length,
- _getArray = function () {
- return t[array[1]] || (function () {
- t[array[1]] = [];
- return t[array[1]];
- })();
- };
-
- if (last) {
- // set term = value on current t, creating term as array if necessary.
- if (array) {
- _getArray()[array[3]] = value;
- }
- else {
- t[term] = value;
- }
- }
- else {
- // set to current t[term], creating t[term] if necessary.
- if (array) {
- var a = _getArray();
- t = a[array[3]] || (function () {
- a[array[3]] = {};
- return a[array[3]];
- })();
- }
- else {
- t = t[term] || (function () {
- t[term] = {};
- return t[term];
- })();
- }
- }
- });
-
- return inObj;
- },
- //
- // chain a list of functions, supplied by [ object, method name, args ], and return on the first
- // one that returns the failValue. if none return the failValue, return the successValue.
- //
- functionChain: function (successValue, failValue, fns) {
- for (var i = 0; i < fns.length; i++) {
- var o = fns[i][0][fns[i][1]].apply(fns[i][0], fns[i][2]);
- if (o === failValue) {
- return o;
- }
- }
- return successValue;
- },
- // take the given model and expand out any parameters.
- // 'functionPrefix' is optional, and if present, helps jsplumb figure out what to do if a value is a Function.
- // if you do not provide it, jsplumb will run the given values through any functions it finds, and use the function's
- // output as the value in the result. if you do provide the prefix, only functions that are named and have this prefix
- // will be executed; other functions will be passed as values to the output.
- populate: function (model, values, functionPrefix) {
- // for a string, see if it has parameter matches, and if so, try to make the substitutions.
- var getValue = function (fromString) {
- var matches = fromString.match(/(\${.*?})/g);
- if (matches != null) {
- for (var i = 0; i < matches.length; i++) {
- var val = values[matches[i].substring(2, matches[i].length - 1)] || "";
- if (val != null) {
- fromString = fromString.replace(matches[i], val);
- }
- }
- }
- return fromString;
- },
- // process one entry.
- _one = function (d) {
- if (d != null) {
- if (_iss(d)) {
- return getValue(d);
- }
- else if (_isf(d) && (functionPrefix == null || (d.name || "").indexOf(functionPrefix) === 0)) {
- return d(values);
- }
- else if (_isa(d)) {
- var r = [];
- for (var i = 0; i < d.length; i++) {
- r.push(_one(d[i]));
- }
- return r;
- }
- else if (_iso(d)) {
- var s = {};
- for (var j in d) {
- s[j] = _one(d[j]);
- }
- return s;
- }
- else {
- return d;
- }
- }
- };
-
- return _one(model);
- },
- findWithFunction: function (a, f) {
- if (a) {
- for (var i = 0; i < a.length; i++) {
- if (f(a[i])) {
- return i;
- }
- }
- }
- return -1;
- },
- removeWithFunction: function (a, f) {
- var idx = root.jsPlumbUtil.findWithFunction(a, f);
- if (idx > -1) {
- a.splice(idx, 1);
- }
- return idx !== -1;
- },
- remove: function (l, v) {
- var idx = l.indexOf(v);
- if (idx > -1) {
- l.splice(idx, 1);
- }
- return idx !== -1;
- },
- // TODO support insert index
- addWithFunction: function (list, item, hashFunction) {
- if (root.jsPlumbUtil.findWithFunction(list, hashFunction) === -1) {
- list.push(item);
- }
- },
- addToList: function (map, key, value, insertAtStart) {
- var l = map[key];
- if (l == null) {
- l = [];
- map[key] = l;
- }
- l[insertAtStart ? "unshift" : "push"](value);
- return l;
- },
- suggest : function(list, item, insertAtHead) {
- if (list.indexOf(item) === -1) {
- if (insertAtHead) {
- list.unshift(item);
- } else {
- list.push(item);
- }
- return true;
- }
- return false;
- },
- //
- // extends the given obj (which can be an array) with the given constructor function, prototype functions, and
- // class members, any of which may be null.
- //
- extend: function (child, parent, _protoFn) {
- var i;
- parent = _isa(parent) ? parent : [ parent ];
-
- for (i = 0; i < parent.length; i++) {
- for (var j in parent[i].prototype) {
- if (parent[i].prototype.hasOwnProperty(j)) {
- child.prototype[j] = parent[i].prototype[j];
- }
- }
- }
-
- var _makeFn = function (name, protoFn) {
- return function () {
- for (i = 0; i < parent.length; i++) {
- if (parent[i].prototype[name]) {
- parent[i].prototype[name].apply(this, arguments);
- }
- }
- return protoFn.apply(this, arguments);
- };
- };
-
- var _oneSet = function (fns) {
- for (var k in fns) {
- child.prototype[k] = _makeFn(k, fns[k]);
- }
- };
-
- if (arguments.length > 2) {
- for (i = 2; i < arguments.length; i++) {
- _oneSet(arguments[i]);
- }
- }
-
- return child;
- },
- uuid: function () {
- return ('xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
- var r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8);
- return v.toString(16);
- }));
- },
- logEnabled: true,
- log: function () {
- if (root.jsPlumbUtil.logEnabled && typeof console !== "undefined") {
- try {
- var msg = arguments[arguments.length - 1];
- console.log(msg);
- }
- catch (e) {
- }
- }
- },
-
- /**
- * Wraps one function with another, creating a placeholder for the
- * wrapped function if it was null. this is used to wrap the various
- * drag/drop event functions - to allow jsPlumb to be notified of
- * important lifecycle events without imposing itself on the user's
- * drag/drop functionality.
- * @method jsPlumbUtil.wrap
- * @param {Function} wrappedFunction original function to wrap; may be null.
- * @param {Function} newFunction function to wrap the original with.
- * @param {Object} [returnOnThisValue] Optional. Indicates that the wrappedFunction should
- * not be executed if the newFunction returns a value matching 'returnOnThisValue'.
- * note that this is a simple comparison and only works for primitives right now.
- */
- wrap: function (wrappedFunction, newFunction, returnOnThisValue) {
- wrappedFunction = wrappedFunction || function () {
- };
- newFunction = newFunction || function () {
- };
- return function () {
- var r = null;
- try {
- r = newFunction.apply(this, arguments);
- } catch (e) {
- root.jsPlumbUtil.log("jsPlumb function failed : " + e);
- }
- if (returnOnThisValue == null || (r !== returnOnThisValue)) {
- try {
- r = wrappedFunction.apply(this, arguments);
- } catch (e) {
- root.jsPlumbUtil.log("wrapped function failed : " + e);
- }
- }
- return r;
- };
- }
- };
-
- root.jsPlumbUtil.EventGenerator = function () {
- var _listeners = {},
- eventsSuspended = false,
- tick = false,
- // this is a list of events that should re-throw any errors that occur during their dispatch. it is current private.
- eventsToDieOn = { "ready": true },
- queue = [];
-
- this.bind = function (event, listener, insertAtStart) {
- var _one = function(evt) {
- root.jsPlumbUtil.addToList(_listeners, evt, listener, insertAtStart);
- listener.__jsPlumb = listener.__jsPlumb || {};
- listener.__jsPlumb[root.jsPlumbUtil.uuid()] = evt;
- };
-
- if (typeof event === "string") {
- _one(event);
- }
- else if (event.length != null) {
- for (var i = 0; i < event.length; i++) {
- _one(event[i]);
- }
- }
-
- return this;
- };
-
- this.fire = function (event, value, originalEvent) {
- if (!tick) {
- tick = true;
- if (!eventsSuspended && _listeners[event]) {
- var l = _listeners[event].length, i = 0, _gone = false, ret = null;
- if (!this.shouldFireEvent || this.shouldFireEvent(event, value, originalEvent)) {
- while (!_gone && i < l && ret !== false) {
- // doing it this way rather than catching and then possibly re-throwing means that an error propagated by this
- // method will have the whole call stack available in the debugger.
- if (eventsToDieOn[event]) {
- _listeners[event][i].apply(this, [value, originalEvent]);
- }
- else {
- try {
- ret = _listeners[event][i].apply(this, [value, originalEvent]);
- } catch (e) {
- root.jsPlumbUtil.log("jsPlumb: fire failed for event " + event + " : " + e);
- }
- }
- i++;
- if (_listeners == null || _listeners[event] == null) {
- _gone = true;
- }
- }
- }
- }
- tick = false;
- _drain();
- } else {
- queue.unshift(arguments);
- }
- return this;
- };
-
- var _drain = function() {
- var n = queue.pop();
- if (n) {
- this.fire.apply(this, n);
- }
- }.bind(this);
-
- this.unbind = function (eventOrListener, listener) {
-
- if (arguments.length === 0) {
- _listeners = {};
- }
- else if (arguments.length === 1) {
- if (typeof eventOrListener === "string") {
- delete _listeners[eventOrListener];
- }
- else if (eventOrListener.__jsPlumb) {
- var evt;
- for (var i in eventOrListener.__jsPlumb) {
- evt = eventOrListener.__jsPlumb[i];
- root.jsPlumbUtil.remove(_listeners[evt] || [], eventOrListener);
- }
- }
- }
- else if (arguments.length === 2) {
- root.jsPlumbUtil.remove(_listeners[eventOrListener] || [], listener);
- }
-
- return this;
- };
-
- this.getListener = function (forEvent) {
- return _listeners[forEvent];
- };
- this.setSuspendEvents = function (val) {
- eventsSuspended = val;
- };
- this.isSuspendEvents = function () {
- return eventsSuspended;
- };
- this.silently = function(fn) {
- this.setSuspendEvents(true);
- try {
- fn();
- }
- catch (e) {
- root.jsPlumbUtil.log("Cannot execute silent function " + e);
- }
- this.setSuspendEvents(false);
- };
- this.cleanupListeners = function () {
- for (var i in _listeners) {
- _listeners[i] = null;
- }
- };
- };
-
- root.jsPlumbUtil.EventGenerator.prototype = {
- cleanup: function () {
- this.cleanupListeners();
- }
- };
-
- if (true) {
- exports.jsPlumbUtil = root.jsPlumbUtil;
- }
-
-}).call(typeof window !== 'undefined' ? window : this);
-
-/*
- * jsPlumb Community Edition
- *
- * Provides a way to visually connect elements on an HTML page, using SVG.
- *
- * This file contains utility functions that run in browsers only.
- *
- * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
- *
- * https://jsplumbtoolkit.com
- * https://github.com/jsplumb/jsplumb
- *
- * Dual licensed under the MIT and GPL2 licenses.
- */
- ;(function() {
-
- "use strict";
-
- var root = this;
-
- root.jsPlumbUtil.matchesSelector = function(el, selector, ctx) {
- ctx = ctx || el.parentNode;
- var possibles = ctx.querySelectorAll(selector);
- for (var i = 0; i < possibles.length; i++) {
- if (possibles[i] === el) {
- return true;
- }
- }
- return false;
- };
-
- root.jsPlumbUtil.consume = function(e, doNotPreventDefault) {
- if (e.stopPropagation) {
- e.stopPropagation();
- }
- else {
- e.returnValue = false;
- }
-
- if (!doNotPreventDefault && e.preventDefault){
- e.preventDefault();
- }
- };
-
- /*
- * Function: sizeElement
- * Helper to size and position an element. You would typically use
- * this when writing your own Connector or Endpoint implementation.
- *
- * Parameters:
- * x - [int] x position for the element origin
- * y - [int] y position for the element origin
- * w - [int] width of the element
- * h - [int] height of the element
- *
- */
- root.jsPlumbUtil.sizeElement = function(el, x, y, w, h) {
- if (el) {
- el.style.height = h + "px";
- el.height = h;
- el.style.width = w + "px";
- el.width = w;
- el.style.left = x + "px";
- el.style.top = y + "px";
- }
- };
-
- }).call(typeof window !== 'undefined' ? window : this);
-
-/*
- * jsPlumb
- *
- * Title:jsPlumb 2.3.0
- *
- * Provides a way to visually connect elements on an HTML page, using SVG.
- *
- * This file contains the core code.
- *
- * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
- *
- * http://jsplumbtoolkit.com
- * http://github.com/sporritt/jsplumb
- *
- * Dual licensed under the MIT and GPL2 licenses.
- */
-(function () {
-
- "use strict";
-
- var root = this;
- var connectorTypes = [], rendererTypes;
-
- var _ju = root.jsPlumbUtil,
-
- /**
- * creates a timestamp, using milliseconds since 1970, but as a string.
- */
- _timestamp = function () {
- return "" + (new Date()).getTime();
- },
-
- // helper method to update the hover style whenever it, or paintStyle, changes.
- // we use paintStyle as the foundation and merge hoverPaintStyle over the
- // top.
- _updateHoverStyle = function (component) {
- if (component._jsPlumb.paintStyle && component._jsPlumb.hoverPaintStyle) {
- var mergedHoverStyle = {};
- jsPlumb.extend(mergedHoverStyle, component._jsPlumb.paintStyle);
- jsPlumb.extend(mergedHoverStyle, component._jsPlumb.hoverPaintStyle);
- delete component._jsPlumb.hoverPaintStyle;
- // we want the fill of paintStyle to override a gradient, if possible.
- if (mergedHoverStyle.gradient && component._jsPlumb.paintStyle.fill) {
- delete mergedHoverStyle.gradient;
- }
- component._jsPlumb.hoverPaintStyle = mergedHoverStyle;
- }
- },
- events = ["tap", "dbltap", "click", "dblclick", "mouseover", "mouseout", "mousemove", "mousedown", "mouseup", "contextmenu" ],
- eventFilters = { "mouseout": "mouseleave", "mouseexit": "mouseleave" },
- _updateAttachedElements = function (component, state, timestamp, sourceElement) {
- var affectedElements = component.getAttachedElements();
- if (affectedElements) {
- for (var i = 0, j = affectedElements.length; i < j; i++) {
- if (!sourceElement || sourceElement !== affectedElements[i]) {
- affectedElements[i].setHover(state, true, timestamp); // tell the attached elements not to inform their own attached elements.
- }
- }
- }
- },
- _splitType = function (t) {
- return t == null ? null : t.split(" ");
- },
- _mapType = function(map, obj, typeId) {
- for (var i in obj) {
- map[i] = typeId;
- }
- },
- _each = function(fn, obj) {
- obj = _ju.isArray(obj) || (obj.length != null && !_ju.isString(obj)) ? obj : [ obj ];
- for (var i = 0; i < obj.length; i++) {
- try {
- fn.apply(obj[i], [ obj[i] ]);
- }
- catch (e) {
- _ju.log(".each iteration failed : " + e);
- }
- }
- },
- _applyTypes = function (component, params, doNotRepaint) {
- if (component.getDefaultType) {
- var td = component.getTypeDescriptor(), map = {};
- var defType = component.getDefaultType();
- var o = _ju.merge({}, defType);
- _mapType(map, defType, "__default");
- for (var i = 0, j = component._jsPlumb.types.length; i < j; i++) {
- var tid = component._jsPlumb.types[i];
- if (tid !== "__default") {
- var _t = component._jsPlumb.instance.getType(tid, td);
- if (_t != null) {
- o = _ju.merge(o, _t, [ "cssClass" ]);
- _mapType(map, _t, tid);
- }
- }
- }
-
- if (params) {
- o = _ju.populate(o, params, "_");
- }
-
- component.applyType(o, doNotRepaint, map);
- if (!doNotRepaint) {
- component.repaint();
- }
- }
- },
-
-// ------------------------------ BEGIN jsPlumbUIComponent --------------------------------------------
-
- jsPlumbUIComponent = root.jsPlumbUIComponent = function (params) {
-
- _ju.EventGenerator.apply(this, arguments);
-
- var self = this,
- a = arguments,
- idPrefix = self.idPrefix,
- id = idPrefix + (new Date()).getTime();
-
- this._jsPlumb = {
- instance: params._jsPlumb,
- parameters: params.parameters || {},
- paintStyle: null,
- hoverPaintStyle: null,
- paintStyleInUse: null,
- hover: false,
- beforeDetach: params.beforeDetach,
- beforeDrop: params.beforeDrop,
- overlayPlacements: [],
- hoverClass: params.hoverClass || params._jsPlumb.Defaults.HoverClass,
- types: [],
- typeCache:{}
- };
-
- this.cacheTypeItem = function(key, item, typeId) {
- this._jsPlumb.typeCache[typeId] = this._jsPlumb.typeCache[typeId] || {};
- this._jsPlumb.typeCache[typeId][key] = item;
- };
- this.getCachedTypeItem = function(key, typeId) {
- return this._jsPlumb.typeCache[typeId] ? this._jsPlumb.typeCache[typeId][key] : null;
- };
-
- this.getId = function () {
- return id;
- };
-
-// ----------------------------- default type --------------------------------------------
-
-
- var o = params.overlays || [], oo = {};
- if (this.defaultOverlayKeys) {
- for (var i = 0; i < this.defaultOverlayKeys.length; i++) {
- Array.prototype.push.apply(o, this._jsPlumb.instance.Defaults[this.defaultOverlayKeys[i]] || []);
- }
-
- for (i = 0; i < o.length; i++) {
- // if a string, convert to object representation so that we can store the typeid on it.
- // also assign an id.
- var fo = jsPlumb.convertToFullOverlaySpec(o[i]);
- oo[fo[1].id] = fo;
- }
- }
-
- var _defaultType = {
- overlays:oo,
- parameters: params.parameters || {},
- scope: params.scope || this._jsPlumb.instance.getDefaultScope()
- };
- this.getDefaultType = function() {
- return _defaultType;
- };
- this.appendToDefaultType = function(obj) {
- for (var i in obj) {
- _defaultType[i] = obj[i];
- }
- };
-
-// ----------------------------- end default type --------------------------------------------
-
- // all components can generate events
-
- if (params.events) {
- for (var evtName in params.events) {
- self.bind(evtName, params.events[evtName]);
- }
- }
-
- // all components get this clone function.
- // TODO issue 116 showed a problem with this - it seems 'a' that is in
- // the clone function's scope is shared by all invocations of it, the classic
- // JS closure problem. for now, jsPlumb does a version of this inline where
- // it used to call clone. but it would be nice to find some time to look
- // further at this.
- this.clone = function () {
- var o = Object.create(this.constructor.prototype);
- this.constructor.apply(o, a);
- return o;
- }.bind(this);
-
- // user can supply a beforeDetach callback, which will be executed before a detach
- // is performed; returning false prevents the detach.
- this.isDetachAllowed = function (connection) {
- var r = true;
- if (this._jsPlumb.beforeDetach) {
- try {
- r = this._jsPlumb.beforeDetach(connection);
- }
- catch (e) {
- _ju.log("jsPlumb: beforeDetach callback failed", e);
- }
- }
- return r;
- };
-
- // user can supply a beforeDrop callback, which will be executed before a dropped
- // connection is confirmed. user can return false to reject connection.
- this.isDropAllowed = function (sourceId, targetId, scope, connection, dropEndpoint, source, target) {
- var r = this._jsPlumb.instance.checkCondition("beforeDrop", {
- sourceId: sourceId,
- targetId: targetId,
- scope: scope,
- connection: connection,
- dropEndpoint: dropEndpoint,
- source: source, target: target
- });
- if (this._jsPlumb.beforeDrop) {
- try {
- r = this._jsPlumb.beforeDrop({
- sourceId: sourceId,
- targetId: targetId,
- scope: scope,
- connection: connection,
- dropEndpoint: dropEndpoint,
- source: source, target: target
- });
- }
- catch (e) {
- _ju.log("jsPlumb: beforeDrop callback failed", e);
- }
- }
- return r;
- };
-
- var domListeners = [];
-
- // sets the component associated with listener events. for instance, an overlay delegates
- // its events back to a connector. but if the connector is swapped on the underlying connection,
- // then this component must be changed. This is called by setConnector in the Connection class.
- this.setListenerComponent = function (c) {
- for (var i = 0; i < domListeners.length; i++) {
- domListeners[i][3] = c;
- }
- };
-
-
- };
-
- var _removeTypeCssHelper = function (component, typeIndex) {
- var typeId = component._jsPlumb.types[typeIndex],
- type = component._jsPlumb.instance.getType(typeId, component.getTypeDescriptor());
-
- if (type != null && type.cssClass && component.canvas) {
- component._jsPlumb.instance.removeClass(component.canvas, type.cssClass);
- }
- };
-
- _ju.extend(root.jsPlumbUIComponent, _ju.EventGenerator, {
-
- getParameter: function (name) {
- return this._jsPlumb.parameters[name];
- },
-
- setParameter: function (name, value) {
- this._jsPlumb.parameters[name] = value;
- },
-
- getParameters: function () {
- return this._jsPlumb.parameters;
- },
-
- setParameters: function (p) {
- this._jsPlumb.parameters = p;
- },
-
- getClass:function() {
- return jsPlumb.getClass(this.canvas);
- },
-
- hasClass:function(clazz) {
- return jsPlumb.hasClass(this.canvas, clazz);
- },
-
- addClass: function (clazz) {
- jsPlumb.addClass(this.canvas, clazz);
- },
-
- removeClass: function (clazz) {
- jsPlumb.removeClass(this.canvas, clazz);
- },
-
- updateClasses: function (classesToAdd, classesToRemove) {
- jsPlumb.updateClasses(this.canvas, classesToAdd, classesToRemove);
- },
-
- setType: function (typeId, params, doNotRepaint) {
- this.clearTypes();
- this._jsPlumb.types = _splitType(typeId) || [];
- _applyTypes(this, params, doNotRepaint);
- },
-
- getType: function () {
- return this._jsPlumb.types;
- },
-
- reapplyTypes: function (params, doNotRepaint) {
- _applyTypes(this, params, doNotRepaint);
- },
-
- hasType: function (typeId) {
- return this._jsPlumb.types.indexOf(typeId) !== -1;
- },
-
- addType: function (typeId, params, doNotRepaint) {
- var t = _splitType(typeId), _cont = false;
- if (t != null) {
- for (var i = 0, j = t.length; i < j; i++) {
- if (!this.hasType(t[i])) {
- this._jsPlumb.types.push(t[i]);
- _cont = true;
- }
- }
- if (_cont) {
- _applyTypes(this, params, doNotRepaint);
- }
- }
- },
-
- removeType: function (typeId, params, doNotRepaint) {
- var t = _splitType(typeId), _cont = false, _one = function (tt) {
- var idx = this._jsPlumb.types.indexOf(tt);
- if (idx !== -1) {
- // remove css class if necessary
- _removeTypeCssHelper(this, idx);
- this._jsPlumb.types.splice(idx, 1);
- return true;
- }
- return false;
- }.bind(this);
-
- if (t != null) {
- for (var i = 0, j = t.length; i < j; i++) {
- _cont = _one(t[i]) || _cont;
- }
- if (_cont) {
- _applyTypes(this, params, doNotRepaint);
- }
- }
- },
- clearTypes: function (params, doNotRepaint) {
- var i = this._jsPlumb.types.length;
- for (var j = 0; j < i; j++) {
- _removeTypeCssHelper(this, 0);
- this._jsPlumb.types.splice(0, 1);
- }
- _applyTypes(this, params, doNotRepaint);
- },
-
- toggleType: function (typeId, params, doNotRepaint) {
- var t = _splitType(typeId);
- if (t != null) {
- for (var i = 0, j = t.length; i < j; i++) {
- var idx = this._jsPlumb.types.indexOf(t[i]);
- if (idx !== -1) {
- _removeTypeCssHelper(this, idx);
- this._jsPlumb.types.splice(idx, 1);
- }
- else {
- this._jsPlumb.types.push(t[i]);
- }
- }
-
- _applyTypes(this, params, doNotRepaint);
- }
- },
- applyType: function (t, doNotRepaint) {
- this.setPaintStyle(t.paintStyle, doNotRepaint);
- this.setHoverPaintStyle(t.hoverPaintStyle, doNotRepaint);
- if (t.parameters) {
- for (var i in t.parameters) {
- this.setParameter(i, t.parameters[i]);
- }
- }
- this._jsPlumb.paintStyleInUse = this.getPaintStyle();
- },
- setPaintStyle: function (style, doNotRepaint) {
- // this._jsPlumb.paintStyle = jsPlumb.extend({}, style);
- // TODO figure out if we want components to clone paintStyle so as not to share it.
- this._jsPlumb.paintStyle = style;
- this._jsPlumb.paintStyleInUse = this._jsPlumb.paintStyle;
- _updateHoverStyle(this);
- if (!doNotRepaint) {
- this.repaint();
- }
- },
- getPaintStyle: function () {
- return this._jsPlumb.paintStyle;
- },
- setHoverPaintStyle: function (style, doNotRepaint) {
- //this._jsPlumb.hoverPaintStyle = jsPlumb.extend({}, style);
- // TODO figure out if we want components to clone paintStyle so as not to share it.
- this._jsPlumb.hoverPaintStyle = style;
- _updateHoverStyle(this);
- if (!doNotRepaint) {
- this.repaint();
- }
- },
- getHoverPaintStyle: function () {
- return this._jsPlumb.hoverPaintStyle;
- },
- destroy: function (force) {
- if (force || this.typeId == null) {
- this.cleanupListeners(); // this is on EventGenerator
- this.clone = null;
- this._jsPlumb = null;
- }
- },
-
- isHover: function () {
- return this._jsPlumb.hover;
- },
-
- setHover: function (hover, ignoreAttachedElements, timestamp) {
- // while dragging, we ignore these events. this keeps the UI from flashing and
- // swishing and whatevering.
- if (this._jsPlumb && !this._jsPlumb.instance.currentlyDragging && !this._jsPlumb.instance.isHoverSuspended()) {
-
- this._jsPlumb.hover = hover;
- var method = hover ? "addClass" : "removeClass";
-
- if (this.canvas != null) {
- if (this._jsPlumb.instance.hoverClass != null) {
- this._jsPlumb.instance[method](this.canvas, this._jsPlumb.instance.hoverClass);
- }
- if (this._jsPlumb.hoverClass != null) {
- this._jsPlumb.instance[method](this.canvas, this._jsPlumb.hoverClass);
- }
- }
- if (this._jsPlumb.hoverPaintStyle != null) {
- this._jsPlumb.paintStyleInUse = hover ? this._jsPlumb.hoverPaintStyle : this._jsPlumb.paintStyle;
- if (!this._jsPlumb.instance.isSuspendDrawing()) {
- timestamp = timestamp || _timestamp();
- this.repaint({timestamp: timestamp, recalc: false});
- }
- }
- // get the list of other affected elements, if supported by this component.
- // for a connection, its the endpoints. for an endpoint, its the connections! surprise.
- if (this.getAttachedElements && !ignoreAttachedElements) {
- _updateAttachedElements(this, hover, _timestamp(), this);
- }
- }
- }
- });
-
-// ------------------------------ END jsPlumbUIComponent --------------------------------------------
-
- var _jsPlumbInstanceIndex = 0,
- getInstanceIndex = function () {
- var i = _jsPlumbInstanceIndex + 1;
- _jsPlumbInstanceIndex++;
- return i;
- };
-
- var jsPlumbInstance = root.jsPlumbInstance = function (_defaults) {
-
- this.version = "2.5.1";
-
- if (_defaults) {
- jsPlumb.extend(this.Defaults, _defaults);
- }
-
- this.logEnabled = this.Defaults.LogEnabled;
- this._connectionTypes = {};
- this._endpointTypes = {};
-
- _ju.EventGenerator.apply(this);
-
- var _currentInstance = this,
- _instanceIndex = getInstanceIndex(),
- _bb = _currentInstance.bind,
- _initialDefaults = {},
- _zoom = 1,
- _info = function (el) {
- if (el == null) {
- return null;
- }
- else if (el.nodeType === 3 || el.nodeType === 8) {
- return { el:el, text:true };
- }
- else {
- var _el = _currentInstance.getElement(el);
- return { el: _el, id: (_ju.isString(el) && _el == null) ? el : _getId(_el) };
- }
- };
-
- this.getInstanceIndex = function () {
- return _instanceIndex;
- };
-
- this.setZoom = function (z, repaintEverything) {
- _zoom = z;
- _currentInstance.fire("zoom", _zoom);
- if (repaintEverything) {
- _currentInstance.repaintEverything();
- }
- return true;
- };
- this.getZoom = function () {
- return _zoom;
- };
-
- for (var i in this.Defaults) {
- _initialDefaults[i] = this.Defaults[i];
- }
-
- var _container, _containerDelegations = [];
- this.unbindContainer = function() {
- if (_container != null && _containerDelegations.length > 0) {
- for (var i = 0; i < _containerDelegations.length; i++) {
- _currentInstance.off(_container, _containerDelegations[i][0], _containerDelegations[i][1]);
- }
- }
- };
- this.setContainer = function (c) {
-
- this.unbindContainer();
-
- // get container as dom element.
- c = this.getElement(c);
- // move existing connections and endpoints, if any.
- this.select().each(function (conn) {
- conn.moveParent(c);
- });
- this.selectEndpoints().each(function (ep) {
- ep.moveParent(c);
- });
-
- // set container.
- var previousContainer = _container;
- _container = c;
- _containerDelegations.length = 0;
- var eventAliases = {
- "endpointclick":"endpointClick",
- "endpointdblclick":"endpointDblClick"
- };
-
- var _oneDelegateHandler = function (id, e, componentType) {
- var t = e.srcElement || e.target,
- jp = (t && t.parentNode ? t.parentNode._jsPlumb : null) || (t ? t._jsPlumb : null) || (t && t.parentNode && t.parentNode.parentNode ? t.parentNode.parentNode._jsPlumb : null);
- if (jp) {
- jp.fire(id, jp, e);
- var alias = componentType ? eventAliases[componentType + id] || id : id;
- // jsplumb also fires every event coming from components/overlays. That's what the test for `jp.component` is for.
- _currentInstance.fire(alias, jp.component || jp, e);
- }
- };
-
- var _addOneDelegate = function(eventId, selector, fn) {
- _containerDelegations.push([eventId, fn]);
- _currentInstance.on(_container, eventId, selector, fn);
- };
-
- // delegate one event on the container to jsplumb elements. it might be possible to
- // abstract this out: each of endpoint, connection and overlay could register themselves with
- // jsplumb as "component types" or whatever, and provide a suitable selector. this would be
- // done by the renderer (although admittedly from 2.0 onwards we're not supporting vml anymore)
- var _oneDelegate = function (id) {
- // connections.
- _addOneDelegate(id, ".jtk-connector", function (e) {
- _oneDelegateHandler(id, e);
- });
- // endpoints. note they can have an enclosing div, or not.
- _addOneDelegate(id, ".jtk-endpoint", function (e) {
- _oneDelegateHandler(id, e, "endpoint");
- });
- // overlays
- _addOneDelegate(id, ".jtk-overlay", function (e) {
- _oneDelegateHandler(id, e);
- });
- };
-
- for (var i = 0; i < events.length; i++) {
- _oneDelegate(events[i]);
- }
-
- // managed elements
- for (var elId in managedElements) {
- var el = managedElements[elId].el;
- if (el.parentNode === previousContainer) {
- previousContainer.removeChild(el);
- _container.appendChild(el);
- }
- }
-
- };
- this.getContainer = function () {
- return _container;
- };
-
- this.bind = function (event, fn) {
- if ("ready" === event && initialized) {
- fn();
- }
- else {
- _bb.apply(_currentInstance, [event, fn]);
- }
- };
-
- _currentInstance.importDefaults = function (d) {
- for (var i in d) {
- _currentInstance.Defaults[i] = d[i];
- }
- if (d.Container) {
- _currentInstance.setContainer(d.Container);
- }
-
- return _currentInstance;
- };
-
- _currentInstance.restoreDefaults = function () {
- _currentInstance.Defaults = jsPlumb.extend({}, _initialDefaults);
- return _currentInstance;
- };
-
- var log = null,
- initialized = false,
- // TODO remove from window scope
- connections = [],
- // map of element id -> endpoint lists. an element can have an arbitrary
- // number of endpoints on it, and not all of them have to be connected
- // to anything.
- endpointsByElement = {},
- endpointsByUUID = {},
- managedElements = {},
- offsets = {},
- offsetTimestamps = {},
- draggableStates = {},
- connectionBeingDragged = false,
- sizes = [],
- _suspendDrawing = false,
- _suspendedAt = null,
- DEFAULT_SCOPE = this.Defaults.Scope,
- _curIdStamp = 1,
- _idstamp = function () {
- return "" + _curIdStamp++;
- },
-
- //
- // appends an element to some other element, which is calculated as follows:
- //
- // 1. if Container exists, use that element.
- // 2. if the 'parent' parameter exists, use that.
- // 3. otherwise just use the root element.
- //
- //
- _appendElement = function (el, parent) {
- if (_container) {
- _container.appendChild(el);
- }
- else if (!parent) {
- this.appendToRoot(el);
- }
- else {
- this.getElement(parent).appendChild(el);
- }
- }.bind(this),
-
- //
- // Draws an endpoint and its connections. this is the main entry point into drawing connections as well
- // as endpoints, since jsPlumb is endpoint-centric under the hood.
- //
- // @param element element to draw (of type library specific element object)
- // @param ui UI object from current library's event system. optional.
- // @param timestamp timestamp for this paint cycle. used to speed things up a little by cutting down the amount of offset calculations we do.
- // @param clearEdits defaults to false; indicates that mouse edits for connectors should be cleared
- ///
- _draw = function (element, ui, timestamp, clearEdits) {
-
- if (!_suspendDrawing) {
- var id = _getId(element),
- repaintEls,
- dm = _currentInstance.getDragManager();
-
- if (dm) {
- repaintEls = dm.getElementsForDraggable(id);
- }
-
- if (timestamp == null) {
- timestamp = _timestamp();
- }
-
- // update the offset of everything _before_ we try to draw anything.
- var o = _updateOffset({ elId: id, offset: ui, recalc: false, timestamp: timestamp });
-
- if (repaintEls && o && o.o) {
- for (var i in repaintEls) {
- _updateOffset({
- elId: repaintEls[i].id,
- offset: {
- left: o.o.left + repaintEls[i].offset.left,
- top: o.o.top + repaintEls[i].offset.top
- },
- recalc: false,
- timestamp: timestamp
- });
- }
- }
-
- _currentInstance.anchorManager.redraw(id, ui, timestamp, null, clearEdits);
-
- if (repaintEls) {
- for (var j in repaintEls) {
- _currentInstance.anchorManager.redraw(repaintEls[j].id, ui, timestamp, repaintEls[j].offset, clearEdits, true);
- }
- }
- }
- },
-
- //
- // gets an Endpoint by uuid.
- //
- _getEndpoint = function (uuid) {
- return endpointsByUUID[uuid];
- },
-
- /**
- * inits a draggable if it's not already initialised.
- * TODO: somehow abstract this to the adapter, because the concept of "draggable" has no
- * place on the server.
- */
- _initDraggableIfNecessary = function (element, isDraggable, dragOptions, id, fireEvent) {
- // move to DragManager?
- if (!jsPlumb.headless) {
- var _draggable = isDraggable == null ? false : isDraggable;
- if (_draggable) {
- if (jsPlumb.isDragSupported(element, _currentInstance)) {
- var options = dragOptions || _currentInstance.Defaults.DragOptions;
- options = jsPlumb.extend({}, options); // make a copy.
- if (!jsPlumb.isAlreadyDraggable(element, _currentInstance)) {
- var dragEvent = jsPlumb.dragEvents.drag,
- stopEvent = jsPlumb.dragEvents.stop,
- startEvent = jsPlumb.dragEvents.start,
- _started = false;
-
- _manage(id, element);
-
- options[startEvent] = _ju.wrap(options[startEvent], function () {
- _currentInstance.setHoverSuspended(true);
- _currentInstance.select({source: element}).addClass(_currentInstance.elementDraggingClass + " " + _currentInstance.sourceElementDraggingClass, true);
- _currentInstance.select({target: element}).addClass(_currentInstance.elementDraggingClass + " " + _currentInstance.targetElementDraggingClass, true);
- _currentInstance.setConnectionBeingDragged(true);
- if (options.canDrag) {
- return dragOptions.canDrag();
- }
- }, false);
-
- options[dragEvent] = _ju.wrap(options[dragEvent], function () {
- // TODO: here we could actually use getDragObject, and then compute it ourselves,
- // since every adapter does the same thing. but i'm not sure why YUI's getDragObject
- // differs from getUIPosition so much
- var ui = _currentInstance.getUIPosition(arguments, _currentInstance.getZoom());
- if (ui != null) {
- _draw(element, ui, null, true);
- if (_started) {
- _currentInstance.addClass(element, "jtk-dragged");
- }
- _started = true;
- }
- });
- options[stopEvent] = _ju.wrap(options[stopEvent], function () {
- var elements = arguments[0].selection, uip;
-
- var _one = function (_e) {
- if (_e[1] != null) {
- // run the reported offset through the code that takes parent containers
- // into account, to adjust if necessary (issue 554)
- uip = _currentInstance.getUIPosition([{
- el:_e[2].el,
- pos:[_e[1].left, _e[1].top]
- }]);
- _draw(_e[2].el, uip);
- }
- _currentInstance.removeClass(_e[0], "jtk-dragged");
- _currentInstance.select({source: _e[2].el}).removeClass(_currentInstance.elementDraggingClass + " " + _currentInstance.sourceElementDraggingClass, true);
- _currentInstance.select({target: _e[2].el}).removeClass(_currentInstance.elementDraggingClass + " " + _currentInstance.targetElementDraggingClass, true);
- _currentInstance.getDragManager().dragEnded(_e[2].el);
- };
-
- for (var i = 0; i < elements.length; i++) {
- _one(elements[i]);
- }
-
- _started = false;
- _currentInstance.setHoverSuspended(false);
- _currentInstance.setConnectionBeingDragged(false);
- });
- var elId = _getId(element); // need ID
- draggableStates[elId] = true;
- var draggable = draggableStates[elId];
- options.disabled = draggable == null ? false : !draggable;
- _currentInstance.initDraggable(element, options);
- _currentInstance.getDragManager().register(element);
- if (fireEvent) {
- _currentInstance.fire("elementDraggable", {el:element, options:options});
- }
- }
- else {
- // already draggable. attach any start, drag or stop listeners to the current Drag.
- if (dragOptions.force) {
- _currentInstance.initDraggable(element, options);
- }
- }
- }
- }
- }
- },
-
- _scopeMatch = function (e1, e2) {
- var s1 = e1.scope.split(/\s/), s2 = e2.scope.split(/\s/);
- for (var i = 0; i < s1.length; i++) {
- for (var j = 0; j < s2.length; j++) {
- if (s2[j] === s1[i]) {
- return true;
- }
- }
- }
-
- return false;
- },
-
- _mergeOverrides = function (def, values) {
- var m = jsPlumb.extend({}, def);
- for (var i in values) {
- if (values[i]) {
- m[i] = values[i];
- }
- }
- return m;
- },
-
- /*
- * prepares a final params object that can be passed to _newConnection, taking into account defaults, events, etc.
- */
- _prepareConnectionParams = function (params, referenceParams) {
- var _p = jsPlumb.extend({ }, params);
- if (referenceParams) {
- jsPlumb.extend(_p, referenceParams);
- }
-
- // hotwire endpoints passed as source or target to sourceEndpoint/targetEndpoint, respectively.
- if (_p.source) {
- if (_p.source.endpoint) {
- _p.sourceEndpoint = _p.source;
- }
- else {
- _p.source = _currentInstance.getElement(_p.source);
- }
- }
- if (_p.target) {
- if (_p.target.endpoint) {
- _p.targetEndpoint = _p.target;
- }
- else {
- _p.target = _currentInstance.getElement(_p.target);
- }
- }
-
- // test for endpoint uuids to connect
- if (params.uuids) {
- _p.sourceEndpoint = _getEndpoint(params.uuids[0]);
- _p.targetEndpoint = _getEndpoint(params.uuids[1]);
- }
-
- // now ensure that if we do have Endpoints already, they're not full.
- // source:
- if (_p.sourceEndpoint && _p.sourceEndpoint.isFull()) {
- _ju.log(_currentInstance, "could not add connection; source endpoint is full");
- return;
- }
-
- // target:
- if (_p.targetEndpoint && _p.targetEndpoint.isFull()) {
- _ju.log(_currentInstance, "could not add connection; target endpoint is full");
- return;
- }
-
- // if source endpoint mandates connection type and nothing specified in our params, use it.
- if (!_p.type && _p.sourceEndpoint) {
- _p.type = _p.sourceEndpoint.connectionType;
- }
-
- // copy in any connectorOverlays that were specified on the source endpoint.
- // it doesnt copy target endpoint overlays. i'm not sure if we want it to or not.
- if (_p.sourceEndpoint && _p.sourceEndpoint.connectorOverlays) {
- _p.overlays = _p.overlays || [];
- for (var i = 0, j = _p.sourceEndpoint.connectorOverlays.length; i < j; i++) {
- _p.overlays.push(_p.sourceEndpoint.connectorOverlays[i]);
- }
- }
-
- // scope
- if (_p.sourceEndpoint && _p.sourceEndpoint.scope) {
- _p.scope = _p.sourceEndpoint.scope;
- }
-
- // pointer events
- if (!_p["pointer-events"] && _p.sourceEndpoint && _p.sourceEndpoint.connectorPointerEvents) {
- _p["pointer-events"] = _p.sourceEndpoint.connectorPointerEvents;
- }
-
-
- var _addEndpoint = function (el, def, idx) {
- return _currentInstance.addEndpoint(el, _mergeOverrides(def, {
- anchor: _p.anchors ? _p.anchors[idx] : _p.anchor,
- endpoint: _p.endpoints ? _p.endpoints[idx] : _p.endpoint,
- paintStyle: _p.endpointStyles ? _p.endpointStyles[idx] : _p.endpointStyle,
- hoverPaintStyle: _p.endpointHoverStyles ? _p.endpointHoverStyles[idx] : _p.endpointHoverStyle
- }));
- };
-
- // check for makeSource/makeTarget specs.
-
- var _oneElementDef = function (type, idx, defs, matchType) {
- if (_p[type] && !_p[type].endpoint && !_p[type + "Endpoint"] && !_p.newConnection) {
- var tid = _getId(_p[type]), tep = defs[tid];
-
- tep = tep ? tep[matchType] : null;
-
- if (tep) {
- // if not enabled, return.
- if (!tep.enabled) {
- return false;
- }
- var newEndpoint = tep.endpoint != null && tep.endpoint._jsPlumb ? tep.endpoint : _addEndpoint(_p[type], tep.def, idx);
- if (newEndpoint.isFull()) {
- return false;
- }
- _p[type + "Endpoint"] = newEndpoint;
- if (!_p.scope && tep.def.scope) {
- _p.scope = tep.def.scope;
- } // provide scope if not already provided and endpoint def has one.
- if (tep.uniqueEndpoint) {
- if (!tep.endpoint) {
- tep.endpoint = newEndpoint;
- newEndpoint.setDeleteOnEmpty(false);
- }
- else {
- newEndpoint.finalEndpoint = tep.endpoint;
- }
- } else {
- newEndpoint.setDeleteOnEmpty(true);
- }
- }
- }
- };
-
- if (_oneElementDef("source", 0, this.sourceEndpointDefinitions, _p.type || "default") === false) {
- return;
- }
- if (_oneElementDef("target", 1, this.targetEndpointDefinitions, _p.type || "default") === false) {
- return;
- }
-
- // last, ensure scopes match
- if (_p.sourceEndpoint && _p.targetEndpoint) {
- if (!_scopeMatch(_p.sourceEndpoint, _p.targetEndpoint)) {
- _p = null;
- }
- }
-
- return _p;
- }.bind(_currentInstance),
-
- _newConnection = function (params) {
- var connectionFunc = _currentInstance.Defaults.ConnectionType || _currentInstance.getDefaultConnectionType();
-
- params._jsPlumb = _currentInstance;
- params.newConnection = _newConnection;
- params.newEndpoint = _newEndpoint;
- params.endpointsByUUID = endpointsByUUID;
- params.endpointsByElement = endpointsByElement;
- params.finaliseConnection = _finaliseConnection;
- params.id = "con_" + _idstamp();
- var con = new connectionFunc(params);
-
- // if the connection is draggable, then maybe we need to tell the target endpoint to init the
- // dragging code. it won't run again if it already configured to be draggable.
- if (con.isDetachable()) {
- con.endpoints[0].initDraggable("_jsPlumbSource");
- con.endpoints[1].initDraggable("_jsPlumbTarget");
- }
-
- return con;
- },
-
- //
- // adds the connection to the backing model, fires an event if necessary and then redraws
- //
- _finaliseConnection = _currentInstance.finaliseConnection = function (jpc, params, originalEvent, doInformAnchorManager) {
- params = params || {};
- // add to list of connections (by scope).
- if (!jpc.suspendedEndpoint) {
- connections.push(jpc);
- }
-
- jpc.pending = null;
-
- // turn off isTemporarySource on the source endpoint (only viable on first draw)
- jpc.endpoints[0].isTemporarySource = false;
-
- // always inform the anchor manager
- // except that if jpc has a suspended endpoint it's not true to say the
- // connection is new; it has just (possibly) moved. the question is whether
- // to make that call here or in the anchor manager. i think perhaps here.
- if (doInformAnchorManager !== false) {
- _currentInstance.anchorManager.newConnection(jpc);
- }
-
- // force a paint
- _draw(jpc.source);
-
- // fire an event
- if (!params.doNotFireConnectionEvent && params.fireEvent !== false) {
-
- var eventArgs = {
- connection: jpc,
- source: jpc.source, target: jpc.target,
- sourceId: jpc.sourceId, targetId: jpc.targetId,
- sourceEndpoint: jpc.endpoints[0], targetEndpoint: jpc.endpoints[1]
- };
-
- _currentInstance.fire("connection", eventArgs, originalEvent);
- }
- },
-
- /*
- factory method to prepare a new endpoint. this should always be used instead of creating Endpoints
- manually, since this method attaches event listeners and an id.
- */
- _newEndpoint = function (params, id) {
- var endpointFunc = _currentInstance.Defaults.EndpointType || jsPlumb.Endpoint;
- var _p = jsPlumb.extend({}, params);
- _p._jsPlumb = _currentInstance;
- _p.newConnection = _newConnection;
- _p.newEndpoint = _newEndpoint;
- _p.endpointsByUUID = endpointsByUUID;
- _p.endpointsByElement = endpointsByElement;
- _p.fireDetachEvent = fireDetachEvent;
- _p.elementId = id || _getId(_p.source);
- var ep = new endpointFunc(_p);
- ep.id = "ep_" + _idstamp();
- _manage(_p.elementId, _p.source);
-
- if (!jsPlumb.headless) {
- _currentInstance.getDragManager().endpointAdded(_p.source, id);
- }
-
- return ep;
- },
-
- /*
- * performs the given function operation on all the connections found
- * for the given element id; this means we find all the endpoints for
- * the given element, and then for each endpoint find the connectors
- * connected to it. then we pass each connection in to the given
- * function.
- */
- _operation = function (elId, func, endpointFunc) {
- var endpoints = endpointsByElement[elId];
- if (endpoints && endpoints.length) {
- for (var i = 0, ii = endpoints.length; i < ii; i++) {
- for (var j = 0, jj = endpoints[i].connections.length; j < jj; j++) {
- var retVal = func(endpoints[i].connections[j]);
- // if the function passed in returns true, we exit.
- // most functions return false.
- if (retVal) {
- return;
- }
- }
- if (endpointFunc) {
- endpointFunc(endpoints[i]);
- }
- }
- }
- },
-
- _setDraggable = function (element, draggable) {
- return jsPlumb.each(element, function (el) {
- if (_currentInstance.isDragSupported(el)) {
- draggableStates[_currentInstance.getAttribute(el, "id")] = draggable;
- _currentInstance.setElementDraggable(el, draggable);
- }
- });
- },
- /*
- * private method to do the business of hiding/showing.
- *
- * @param el
- * either Id of the element in question or a library specific
- * object for the element.
- * @param state
- * String specifying a value for the css 'display' property
- * ('block' or 'none').
- */
- _setVisible = function (el, state, alsoChangeEndpoints) {
- state = state === "block";
- var endpointFunc = null;
- if (alsoChangeEndpoints) {
- endpointFunc = function (ep) {
- ep.setVisible(state, true, true);
- };
- }
- var info = _info(el);
- _operation(info.id, function (jpc) {
- if (state && alsoChangeEndpoints) {
- // this test is necessary because this functionality is new, and i wanted to maintain backwards compatibility.
- // this block will only set a connection to be visible if the other endpoint in the connection is also visible.
- var oidx = jpc.sourceId === info.id ? 1 : 0;
- if (jpc.endpoints[oidx].isVisible()) {
- jpc.setVisible(true);
- }
- }
- else { // the default behaviour for show, and what always happens for hide, is to just set the visibility without getting clever.
- jpc.setVisible(state);
- }
- }, endpointFunc);
- },
- /*
- * toggles the draggable state of the given element(s).
- * el is either an id, or an element object, or a list of ids/element objects.
- */
- _toggleDraggable = function (el) {
- var state;
- jsPlumb.each(el, function (el) {
- var elId = _currentInstance.getAttribute(el, "id");
- state = draggableStates[elId] == null ? false : draggableStates[elId];
- state = !state;
- draggableStates[elId] = state;
- _currentInstance.setDraggable(el, state);
- return state;
- }.bind(this));
- return state;
- },
- /**
- * private method to do the business of toggling hiding/showing.
- */
- _toggleVisible = function (elId, changeEndpoints) {
- var endpointFunc = null;
- if (changeEndpoints) {
- endpointFunc = function (ep) {
- var state = ep.isVisible();
- ep.setVisible(!state);
- };
- }
- _operation(elId, function (jpc) {
- var state = jpc.isVisible();
- jpc.setVisible(!state);
- }, endpointFunc);
- },
-
- // TODO comparison performance
- _getCachedData = function (elId) {
- var o = offsets[elId];
- if (!o) {
- return _updateOffset({elId: elId});
- }
- else {
- return {o: o, s: sizes[elId]};
- }
- },
-
- /**
- * gets an id for the given element, creating and setting one if
- * necessary. the id is of the form
- *
- * jsPlumb_
");
- }
- else {
- if (this.labelText == null) {
- this.labelText = this.label;
- this.getElement().innerHTML = this.labelText.replace(/\r\n/g, "
");
- }
- }
- },
- updateFrom:function(d) {
- if(d.label != null){
- this.setLabel(d.label);
- }
- }
- });
-
- // ********************************* END OF OVERLAY DEFINITIONS ***********************************************************************
-
-}).call(typeof window !== 'undefined' ? window : this);
-
-/*
- * jsPlumb Community Edition
- *
- * Provides a way to visually connect elements on an HTML page, using SVG.
- *
- * This file contains the base class for library adapters.
- *
- * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
- *
- * https://jsplumbtoolkit.com
- * https://github.com/jsplumb/jsplumb
- *
- * Dual licensed under the MIT and GPL2 licenses.
- */
-;(function() {
- "use strict";
- var root = this,
- _jp = root.jsPlumb;
-
- var _getEventManager = function(instance) {
- var e = instance._mottle;
- if (!e) {
- e = instance._mottle = new root.Mottle();
- }
- return e;
- };
-
- _jp.extend(root.jsPlumbInstance.prototype, {
- getEventManager:function() {
- return _getEventManager(this);
- },
- on : function(el, event, callback) {
- // TODO: here we would like to map the tap event if we know its
- // an internal bind to a click. we have to know its internal because only
- // then can we be sure that the UP event wont be consumed (tap is a synthesized
- // event from a mousedown followed by a mouseup).
- //event = { "click":"tap", "dblclick":"dbltap"}[event] || event;
- this.getEventManager().on.apply(this, arguments);
- return this;
- },
- off : function(el, event, callback) {
- this.getEventManager().off.apply(this, arguments);
- return this;
- }
- });
-
-
-}).call(typeof window !== 'undefined' ? window : this);
-/*
- * jsPlumb Community Edition
- *
- * Provides a way to visually connect elements on an HTML page, using SVG.
- *
- * This file contains the code for working with Groups.
- *
- * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
- *
- * https://jsplumbtoolkit.com
- * https://github.com/jsplumb/jsplumb
- *
- * Dual licensed under the MIT and GPL2 licenses.
- */
-;(function() {
- "use strict";
-
- var root = this,
- _ju = root.jsPlumbUtil,
- _jpi = root.jsPlumbInstance;
-
- var GROUP_COLLAPSED_CLASS = "jtk-group-collapsed";
- var GROUP_EXPANDED_CLASS = "jtk-group-expanded";
- var GROUP_CONTAINER_SELECTOR = "[jtk-group-content]";
- var ELEMENT_DRAGGABLE_EVENT = "elementDraggable";
- var STOP = "stop";
- var REVERT = "revert";
- var GROUP_MANAGER = "_groupManager";
- var GROUP = "_jsPlumbGroup";
- var GROUP_DRAG_SCOPE = "_jsPlumbGroupDrag";
- var EVT_CHILD_ADDED = "group:addMember";
- var EVT_CHILD_REMOVED = "group:removeMember";
- var EVT_GROUP_ADDED = "group:add";
- var EVT_GROUP_REMOVED = "group:remove";
- var EVT_EXPAND = "group:expand";
- var EVT_COLLAPSE = "group:collapse";
- var EVT_GROUP_DRAG_STOP = "groupDragStop";
- var EVT_CONNECTION_MOVED = "connectionMoved";
- var EVT_INTERNAL_CONNECTION_DETACHED = "internal.connectionDetached";
-
- var CMD_REMOVE_ALL = "removeAll";
- var CMD_ORPHAN_ALL = "orphanAll";
- var CMD_SHOW = "show";
- var CMD_HIDE = "hide";
-
- var GroupManager = function(_jsPlumb) {
- var _managedGroups = {}, _connectionSourceMap = {}, _connectionTargetMap = {}, self = this;
-
- _jsPlumb.bind("connection", function(p) {
- if (p.source[GROUP] != null && p.target[GROUP] != null && p.source[GROUP] === p.target[GROUP]) {
- _connectionSourceMap[p.connection.id] = p.source[GROUP];
- _connectionTargetMap[p.connection.id] = p.source[GROUP];
- }
- else {
- if (p.source[GROUP] != null) {
- _ju.suggest(p.source[GROUP].connections.source, p.connection);
- _connectionSourceMap[p.connection.id] = p.source[GROUP];
- }
- if (p.target[GROUP] != null) {
- _ju.suggest(p.target[GROUP].connections.target, p.connection);
- _connectionTargetMap[p.connection.id] = p.target[GROUP];
- }
- }
- });
-
- function _cleanupDetachedConnection(conn) {
- delete conn.proxies;
- var group = _connectionSourceMap[conn.id], f;
- if (group != null) {
- f = function(c) { return c.id === conn.id; };
- _ju.removeWithFunction(group.connections.source, f);
- _ju.removeWithFunction(group.connections.target, f);
- delete _connectionSourceMap[conn.id];
- }
-
- group = _connectionTargetMap[conn.id];
- if (group != null) {
- f = function(c) { return c.id === conn.id; };
- _ju.removeWithFunction(group.connections.source, f);
- _ju.removeWithFunction(group.connections.target, f);
- delete _connectionTargetMap[conn.id];
- }
- }
-
- _jsPlumb.bind(EVT_INTERNAL_CONNECTION_DETACHED, function(p) {
- _cleanupDetachedConnection(p.connection);
- });
-
- _jsPlumb.bind(EVT_CONNECTION_MOVED, function(p) {
- var connMap = p.index === 0 ? _connectionSourceMap : _connectionTargetMap;
- var group = connMap[p.connection.id];
- if (group) {
- var list = group.connections[p.index === 0 ? "source" : "target"];
- var idx = list.indexOf(p.connection);
- if (idx !== -1) {
- list.splice(idx, 1);
- }
- }
- });
-
- this.addGroup = function(group) {
- _jsPlumb.addClass(group.getEl(), GROUP_EXPANDED_CLASS);
- _managedGroups[group.id] = group;
- group.manager = this;
- _updateConnectionsForGroup(group);
- _jsPlumb.fire(EVT_GROUP_ADDED, { group:group });
- };
-
- this.addToGroup = function(group, el, doNotFireEvent) {
- group = this.getGroup(group);
- if (group) {
- //group.add(el, doNotFireEvent);
- var groupEl = group.getEl();
-
- if (el._isJsPlumbGroup) {
- return;
- }
- var currentGroup = el._jsPlumbGroup;
- // if already a member of this group, do nothing
- if (currentGroup !== group) {
- var elpos = _jsPlumb.getOffset(el, true);
- var cpos = group.collapsed ? _jsPlumb.getOffset(groupEl, true) : _jsPlumb.getOffset(group.getDragArea(), true);
-
- // otherwise, transfer to this group.
- if (currentGroup != null) {
- currentGroup.remove(el, doNotFireEvent);
- self.updateConnectionsForGroup(currentGroup);
- }
- group.add(el, doNotFireEvent);
-
- var handleDroppedConnections = function (list, index) {
- var oidx = index === 0 ? 1 : 0;
- list.each(function (c) {
- c.setVisible(false);
- if (c.endpoints[oidx].element._jsPlumbGroup === group) {
- c.endpoints[oidx].setVisible(false);
- self.expandConnection(c, oidx, group);
- }
- else {
- c.endpoints[index].setVisible(false);
- self.collapseConnection(c, index, group);
- }
- });
- };
-
- if (group.collapsed) {
- handleDroppedConnections(_jsPlumb.select({source: el}), 0);
- handleDroppedConnections(_jsPlumb.select({target: el}), 1);
- }
-
- var elId = _jsPlumb.getId(el);
- _jsPlumb.dragManager.setParent(el, elId, groupEl, _jsPlumb.getId(groupEl), elpos);
-
- var newPosition = { left: elpos.left - cpos.left, top: elpos.top - cpos.top };
-
- _jsPlumb.setPosition(el, newPosition);
-
- _jsPlumb.dragManager.revalidateParent(el, elId, elpos);
-
- self.updateConnectionsForGroup(group);
-
- _jsPlumb.revalidate(elId);
-
- setTimeout(function () {
- _jsPlumb.fire(EVT_CHILD_ADDED, {group: group, el: el});
- }, 0);
- }
- }
- };
-
- this.removeFromGroup = function(group, el, doNotFireEvent) {
- group = this.getGroup(group);
- if (group) {
- group.remove(el, null, doNotFireEvent);
- }
- };
-
- this.getGroup = function(groupId) {
- var group = groupId;
- if (_ju.isString(groupId)) {
- group = _managedGroups[groupId];
- if (group == null) {
- throw new TypeError("No such group [" + groupId + "]");
- }
- }
- return group;
- };
-
- this.getGroups = function() {
- var o = [];
- for (var g in _managedGroups) {
- o.push(_managedGroups[g]);
- }
- return o;
- };
-
- this.removeGroup = function(group, deleteMembers, manipulateDOM, doNotFireEvent) {
- group = this.getGroup(group);
- this.expandGroup(group, true); // this reinstates any original connections and removes all proxies, but does not fire an event.
- group[deleteMembers ? CMD_REMOVE_ALL : CMD_ORPHAN_ALL](manipulateDOM, doNotFireEvent);
- _jsPlumb.remove(group.getEl());
- delete _managedGroups[group.id];
- delete _jsPlumb._groups[group.id];
- _jsPlumb.fire(EVT_GROUP_REMOVED, { group:group });
- };
-
- this.removeAllGroups = function(deleteMembers, manipulateDOM, doNotFireEvent) {
- for (var g in _managedGroups) {
- this.removeGroup(_managedGroups[g], deleteMembers, manipulateDOM, doNotFireEvent);
- }
- };
-
- function _setVisible(group, state) {
- var m = group.getMembers();
- for (var i = 0; i < m.length; i++) {
- _jsPlumb[state ? CMD_SHOW : CMD_HIDE](m[i], true);
- }
- }
-
- var _collapseConnection = this.collapseConnection = function(c, index, group) {
-
- var proxyEp, groupEl = group.getEl(), groupElId = _jsPlumb.getId(groupEl),
- originalElementId = c.endpoints[index].elementId;
-
- var otherEl = c.endpoints[index === 0 ? 1 : 0].element;
- if (otherEl[GROUP] && (!otherEl[GROUP].shouldProxy() && otherEl[GROUP].collapsed)) {
- return;
- }
-
- c.proxies = c.proxies || [];
- if(c.proxies[index]) {
- proxyEp = c.proxies[index].ep;
- }else {
- proxyEp = _jsPlumb.addEndpoint(groupEl, {
- endpoint:group.getEndpoint(c, index),
- anchor:group.getAnchor(c, index),
- parameters:{
- isProxyEndpoint:true
- }
- });
- }
- proxyEp.setDeleteOnEmpty(true);
-
- // for this index, stash proxy info: the new EP, the original EP.
- c.proxies[index] = { ep:proxyEp, originalEp: c.endpoints[index] };
-
- // and advise the anchor manager
- if (index === 0) {
- // TODO why are there two differently named methods? Why is there not one method that says "some end of this
- // connection changed (you give the index), and here's the new element and element id."
- _jsPlumb.anchorManager.sourceChanged(originalElementId, groupElId, c, groupEl);
- }
- else {
- _jsPlumb.anchorManager.updateOtherEndpoint(c.endpoints[0].elementId, originalElementId, groupElId, c);
- c.target = groupEl;
- c.targetId = groupElId;
- }
-
-
- // detach the original EP from the connection.
- c.proxies[index].originalEp.detachFromConnection(c, null, true);
-
- // set the proxy as the new ep
- proxyEp.connections = [ c ];
- c.endpoints[index] = proxyEp;
-
- c.setVisible(true);
- };
-
- this.collapseGroup = function(group) {
- group = this.getGroup(group);
- if (group == null || group.collapsed) {
- return;
- }
- var groupEl = group.getEl();
-
- // todo remove old proxy endpoints first, just in case?
- //group.proxies.length = 0;
-
- // hide all connections
- _setVisible(group, false);
-
- if (group.shouldProxy()) {
- // collapses all connections in a group.
- var _collapseSet = function (conns, index) {
- for (var i = 0; i < conns.length; i++) {
- var c = conns[i];
- _collapseConnection(c, index, group);
- }
- };
-
- // setup proxies for sources and targets
- _collapseSet(group.connections.source, 0);
- _collapseSet(group.connections.target, 1);
- }
-
- group.collapsed = true;
- _jsPlumb.removeClass(groupEl, GROUP_EXPANDED_CLASS);
- _jsPlumb.addClass(groupEl, GROUP_COLLAPSED_CLASS);
- _jsPlumb.revalidate(groupEl);
- _jsPlumb.fire(EVT_COLLAPSE, { group:group });
- };
-
- var _expandConnection = this.expandConnection = function(c, index, group) {
-
- // if no proxies or none for this end of the connection, abort.
- if (c.proxies == null || c.proxies[index] == null) {
- return;
- }
-
- var groupElId = _jsPlumb.getId(group.getEl()),
- originalElement = c.proxies[index].originalEp.element,
- originalElementId = c.proxies[index].originalEp.elementId;
-
- c.endpoints[index] = c.proxies[index].originalEp;
- // and advise the anchor manager
- if (index === 0) {
- // TODO why are there two differently named methods? Why is there not one method that says "some end of this
- // connection changed (you give the index), and here's the new element and element id."
- _jsPlumb.anchorManager.sourceChanged(groupElId, originalElementId, c, originalElement);
- }
- else {
- _jsPlumb.anchorManager.updateOtherEndpoint(c.endpoints[0].elementId, groupElId, originalElementId, c);
- c.target = originalElement;
- c.targetId = originalElementId;
- }
-
- // detach the proxy EP from the connection (which will cause it to be removed as we no longer need it)
- c.proxies[index].ep.detachFromConnection(c, null);
-
- c.proxies[index].originalEp.addConnection(c);
-
- // cleanup
- delete c.proxies[index];
- };
-
- this.expandGroup = function(group, doNotFireEvent) {
-
- group = this.getGroup(group);
-
- if (group == null || !group.collapsed) {
- return;
- }
- var groupEl = group.getEl();
-
- _setVisible(group, true);
-
- if (group.shouldProxy()) {
- // collapses all connections in a group.
- var _expandSet = function (conns, index) {
- for (var i = 0; i < conns.length; i++) {
- var c = conns[i];
- _expandConnection(c, index, group);
- }
- };
-
- // setup proxies for sources and targets
- _expandSet(group.connections.source, 0);
- _expandSet(group.connections.target, 1);
- }
-
- group.collapsed = false;
- _jsPlumb.addClass(groupEl, GROUP_EXPANDED_CLASS);
- _jsPlumb.removeClass(groupEl, GROUP_COLLAPSED_CLASS);
- _jsPlumb.revalidate(groupEl);
- this.repaintGroup(group);
- if (!doNotFireEvent) {
- _jsPlumb.fire(EVT_EXPAND, { group: group});
- }
- };
-
- this.repaintGroup = function(group) {
- group = this.getGroup(group);
- var m = group.getMembers();
- for (var i = 0; i < m.length; i++) {
- _jsPlumb.revalidate(m[i]);
- }
- };
-
- // TODO refactor this with the code that responds to `connection` events.
- function _updateConnectionsForGroup(group) {
- var members = group.getMembers();
- var c1 = _jsPlumb.getConnections({source:members}, true);
- var c2 = _jsPlumb.getConnections({target:members}, true);
- var processed = {};
- group.connections.source.length = 0;
- group.connections.target.length = 0;
- var oneSet = function(c) {
- for (var i = 0; i < c.length; i++) {
- if (processed[c[i].id]) {
- continue;
- }
- processed[c[i].id] = true;
- if (c[i].source._jsPlumbGroup === group) {
- if (c[i].target._jsPlumbGroup !== group) {
- group.connections.source.push(c[i]);
- }
- _connectionSourceMap[c[i].id] = group;
- }
- else if (c[i].target._jsPlumbGroup === group) {
- group.connections.target.push(c[i]);
- _connectionTargetMap[c[i].id] = group;
- }
- }
- };
- oneSet(c1); oneSet(c2);
- }
-
- this.updateConnectionsForGroup = _updateConnectionsForGroup;
- this.refreshAllGroups = function() {
- for (var g in _managedGroups) {
- _updateConnectionsForGroup(_managedGroups[g]);
- _jsPlumb.dragManager.updateOffsets(_jsPlumb.getId(_managedGroups[g].getEl()));
- }
- };
- };
-
- /**
- *
- * @param {jsPlumbInstance} _jsPlumb Associated jsPlumb instance.
- * @param {Object} params
- * @param {Element} params.el The DOM element representing the Group.
- * @param {String} [params.id] Optional ID for the Group. A UUID will be assigned as the Group's ID if you do not provide one.
- * @param {Boolean} [params.constrain=false] If true, child elements will not be able to be dragged outside of the Group container.
- * @param {Boolean} [params.revert=true] By default, child elements revert to the container if dragged outside. You can change this by setting `revert:false`. This behaviour is also overridden if you set `orphan` or `prune`.
- * @param {Boolean} [params.orphan=false] If true, child elements dropped outside of the Group container will be removed from the Group (but not from the DOM).
- * @param {Boolean} [params.prune=false] If true, child elements dropped outside of the Group container will be removed from the Group and also from the DOM.
- * @param {Boolean} [params.dropOverride=false] If true, a child element that has been dropped onto some other Group will not be subject to the controls imposed by `prune`, `revert` or `orphan`.
- * @constructor
- */
- var Group = function(_jsPlumb, params) {
- var self = this;
- var el = params.el;
- this.getEl = function() { return el; };
- this.id = params.id || _ju.uuid();
- el._isJsPlumbGroup = true;
-
- var getDragArea = this.getDragArea = function() {
- var da = _jsPlumb.getSelector(el, GROUP_CONTAINER_SELECTOR);
- return da && da.length > 0 ? da[0] : el;
- };
-
- var ghost = params.ghost === true;
- var constrain = ghost || (params.constrain === true);
- var revert = params.revert !== false;
- var orphan = params.orphan === true;
- var prune = params.prune === true;
- var dropOverride = params.dropOverride === true;
- var proxied = params.proxied !== false;
- var elements = [];
- this.connections = { source:[], target:[], internal:[] };
-
- // this function, and getEndpoint below, are stubs for a future setup in which we can choose endpoint
- // and anchor based upon the connection and the index (source/target) of the endpoint to be proxied.
- this.getAnchor = function(conn, endpointIndex) {
- return params.anchor || "Continuous";
- };
-
- this.getEndpoint = function(conn, endpointIndex) {
- return params.endpoint || [ "Dot", { radius:10 }];
- };
-
- this.collapsed = false;
- if (params.draggable !== false) {
- var opts = {
- stop:function(params) {
- _jsPlumb.fire(EVT_GROUP_DRAG_STOP, jsPlumb.extend(params, {group:self}));
- },
- scope:GROUP_DRAG_SCOPE
- };
- if (params.dragOptions) {
- root.jsPlumb.extend(opts, params.dragOptions);
- }
- _jsPlumb.draggable(params.el, opts);
- }
- if (params.droppable !== false) {
- _jsPlumb.droppable(params.el, {
- drop:function(p) {
- var el = p.drag.el;
- if (el._isJsPlumbGroup) {
- return;
- }
- var currentGroup = el._jsPlumbGroup;
- if (currentGroup !== self) {
- if (currentGroup != null) {
- if (currentGroup.overrideDrop(el, self)) {
- return;
- }
- }
- _jsPlumb.getGroupManager().addToGroup(self, el, false);
- }
-
- }
- });
- }
- var _each = function(_el, fn) {
- var els = _el.nodeType == null ? _el : [ _el ];
- for (var i = 0; i < els.length; i++) {
- fn(els[i]);
- }
- };
-
- this.overrideDrop = function(_el, targetGroup) {
- return dropOverride && (revert || prune || orphan);
- };
-
- this.add = function(_el, doNotFireEvent) {
- var dragArea = getDragArea();
- _each(_el, function(__el) {
-
- if (__el._jsPlumbGroup != null) {
- if (__el._jsPlumbGroup === self) {
- return;
- } else {
- __el._jsPlumbGroup.remove(__el, true, doNotFireEvent, false);
- }
- }
-
- __el._jsPlumbGroup = self;
- elements.push(__el);
- // test if draggable and add handlers if so.
- if (_jsPlumb.isAlreadyDraggable(__el)) {
- _bindDragHandlers(__el);
- }
-
- if (__el.parentNode !== dragArea) {
- dragArea.appendChild(__el);
- }
-
- if (!doNotFireEvent) {
- _jsPlumb.fire(EVT_CHILD_ADDED, {group: self, el: __el});
- }
- });
-
- _jsPlumb.getGroupManager().updateConnectionsForGroup(self);
- };
-
- this.remove = function(el, manipulateDOM, doNotFireEvent, doNotUpdateConnections) {
-
- _each(el, function(__el) {
- delete __el._jsPlumbGroup;
- _ju.removeWithFunction(elements, function(e) {
- return e === __el;
- });
-
- if (manipulateDOM) {
- try { self.getDragArea().removeChild(__el); }
- catch (e) {
- jsPlumbUtil.log("Could not remove element from Group " + e);
- }
- }
- _unbindDragHandlers(__el);
- if (!doNotFireEvent) {
- _jsPlumb.fire(EVT_CHILD_REMOVED, {group: self, el: __el});
- }
- });
- if (!doNotUpdateConnections) {
- _jsPlumb.getGroupManager().updateConnectionsForGroup(self);
- }
- };
- this.removeAll = function(manipulateDOM, doNotFireEvent) {
- for (var i = 0, l = elements.length; i < l; i++) {
- self.remove(elements[0], manipulateDOM, doNotFireEvent, true);
- }
- elements.length = 0;
- _jsPlumb.getGroupManager().updateConnectionsForGroup(self);
- };
- this.orphanAll = function() {
- for (var i = 0; i < elements.length; i++) {
- _orphan(elements[i]);
- }
- elements.length = 0;
- };
- this.getMembers = function() { return elements; };
-
- el[GROUP] = this;
-
- _jsPlumb.bind(ELEMENT_DRAGGABLE_EVENT, function(dragParams) {
- // if its for the current group,
- if (dragParams.el._jsPlumbGroup === this) {
- _bindDragHandlers(dragParams.el);
- }
- }.bind(this));
-
- function _findParent(_el) {
- return _el.offsetParent;
- }
-
- function _isInsideParent(_el, pos) {
- var p = _findParent(_el),
- s = _jsPlumb.getSize(p),
- ss = _jsPlumb.getSize(_el),
- leftEdge = pos[0],
- rightEdge = leftEdge + ss[0],
- topEdge = pos[1],
- bottomEdge = topEdge + ss[1];
-
- return rightEdge > 0 && leftEdge < s[0] && bottomEdge > 0 && topEdge < s[1];
- }
-
- //
- // orphaning an element means taking it out of the group and adding it to the main jsplumb container.
- //
- function _orphan(_el) {
- var id = _jsPlumb.getId(_el);
- var pos = _jsPlumb.getOffset(_el);
- _el.parentNode.removeChild(_el);
- _jsPlumb.getContainer().appendChild(_el);
- _jsPlumb.setPosition(_el, pos);
- delete _el._jsPlumbGroup;
- _unbindDragHandlers(_el);
- _jsPlumb.dragManager.clearParent(_el, id);
- }
-
- //
- // remove an element from the group, then either prune it from the jsplumb instance, or just orphan it.
- //
- function _pruneOrOrphan(p) {
- if (!_isInsideParent(p.el, p.pos)) {
- var group = p.el._jsPlumbGroup;
- if (prune) {
- _jsPlumb.remove(p.el);
- } else {
- _orphan(p.el);
- }
-
- group.remove(p.el);
- }
- }
-
- //
- // redraws the element
- //
- function _revalidate(_el) {
- var id = _jsPlumb.getId(_el);
- _jsPlumb.revalidate(_el);
- _jsPlumb.dragManager.revalidateParent(_el, id);
- }
-
- //
- // unbind the group specific drag/revert handlers.
- //
- function _unbindDragHandlers(_el) {
- if (!_el._katavorioDrag) {
- return;
- }
- if (prune || orphan) {
- _el._katavorioDrag.off(STOP, _pruneOrOrphan);
- }
- if (!prune && !orphan && revert) {
- _el._katavorioDrag.off(REVERT, _revalidate);
- _el._katavorioDrag.setRevert(null);
- }
- }
-
- function _bindDragHandlers(_el) {
- if (!_el._katavorioDrag) {
- return;
- }
- if (prune || orphan) {
- _el._katavorioDrag.on(STOP, _pruneOrOrphan);
- }
-
- if (constrain) {
- _el._katavorioDrag.setConstrain(true);
- }
-
- if (ghost) {
- _el._katavorioDrag.setUseGhostProxy(true);
- }
-
- if (!prune && !orphan && revert) {
- _el._katavorioDrag.on(REVERT, _revalidate);
- _el._katavorioDrag.setRevert(function(__el, pos) {
- return !_isInsideParent(__el, pos);
- });
- }
- }
-
- this.shouldProxy = function() {
- return proxied;
- };
-
- _jsPlumb.getGroupManager().addGroup(this);
- };
-
- /**
- * Adds a group to the jsPlumb instance.
- * @method addGroup
- * @param {Object} params
- * @return {Group} The newly created Group.
- */
- _jpi.prototype.addGroup = function(params) {
- var j = this;
- j._groups = j._groups || {};
- if (j._groups[params.id] != null) {
- throw new TypeError("cannot create Group [" + params.id + "]; a Group with that ID exists");
- }
- if (params.el[GROUP] != null) {
- throw new TypeError("cannot create Group [" + params.id + "]; the given element is already a Group");
- }
- var group = new Group(j, params);
- j._groups[group.id] = group;
- if (params.collapsed) {
- this.collapseGroup(group);
- }
- return group;
- };
-
- /**
- * Add an element to a group.
- * @method addToGroup
- * @param {String} group Group, or ID of the group, to add the element to.
- * @param {Element} el Element to add to the group.
- */
- _jpi.prototype.addToGroup = function(group, el, doNotFireEvent) {
-
- var _one = function(_el) {
- var id = this.getId(_el);
- this.manage(id, _el);
- this.getGroupManager().addToGroup(group, _el, doNotFireEvent);
- }.bind(this);
-
- if (Array.isArray(el)) {
- for (var i = 0; i < el.length; i++) {
- _one(el[i]);
- }
- } else {
- _one(el);
- }
- };
-
- /**
- * Remove an element from a group.
- * @method removeFromGroup
- * @param {String} group Group, or ID of the group, to remove the element from.
- * @param {Element} el Element to add to the group.
- */
- _jpi.prototype.removeFromGroup = function(group, el, doNotFireEvent) {
- this.getGroupManager().removeFromGroup(group, el, doNotFireEvent);
- };
-
- /**
- * Remove a group, and optionally remove its members from the jsPlumb instance.
- * @method removeGroup
- * @param {String|Group} group Group to delete, or ID of Group to delete.
- * @param {Boolean} [deleteMembers=false] If true, group members will be removed along with the group. Otherwise they will
- * just be 'orphaned' (returned to the main container).
- */
- _jpi.prototype.removeGroup = function(group, deleteMembers, manipulateDOM, doNotFireEvent) {
- this.getGroupManager().removeGroup(group, deleteMembers, manipulateDOM, doNotFireEvent);
- };
-
- /**
- * Remove all groups, and optionally remove their members from the jsPlumb instance.
- * @method removeAllGroup
- * @param {Boolean} [deleteMembers=false] If true, group members will be removed along with the groups. Otherwise they will
- * just be 'orphaned' (returned to the main container).
- */
- _jpi.prototype.removeAllGroups = function(deleteMembers, manipulateDOM, doNotFireEvent) {
- this.getGroupManager().removeAllGroups(deleteMembers, manipulateDOM, doNotFireEvent);
- };
-
- /**
- * Get a Group
- * @method getGroup
- * @param {String} groupId ID of the group to get
- * @return {Group} Group with the given ID, null if not found.
- */
- _jpi.prototype.getGroup = function(groupId) {
- return this.getGroupManager().getGroup(groupId);
- };
-
- /**
- * Gets all the Groups managed by the jsPlumb instance.
- * @returns {Group[]} List of Groups. Empty if none.
- */
- _jpi.prototype.getGroups = function() {
- return this.getGroupManager().getGroups();
- };
-
- /**
- * Expands a group element. jsPlumb doesn't do "everything" for you here, because what it means to expand a Group
- * will vary from application to application. jsPlumb does these things:
- *
- * - Hides any connections that are internal to the group (connections between members, and connections from member of
- * the group to the group itself)
- * - Proxies all connections for which the source or target is a member of the group.
- * - Hides the proxied connections.
- * - Adds the jtk-group-expanded class to the group's element
- * - Removes the jtk-group-collapsed class from the group's element.
- *
- * @method expandGroup
- * @param {String|Group} group Group to expand, or ID of Group to expand.
- */
- _jpi.prototype.expandGroup = function(group) {
- this.getGroupManager().expandGroup(group);
- };
-
- /**
- * Collapses a group element. jsPlumb doesn't do "everything" for you here, because what it means to collapse a Group
- * will vary from application to application. jsPlumb does these things:
- *
- * - Shows any connections that are internal to the group (connections between members, and connections from member of
- * the group to the group itself)
- * - Removes proxies for all connections for which the source or target is a member of the group.
- * - Shows the previously proxied connections.
- * - Adds the jtk-group-collapsed class to the group's element
- * - Removes the jtk-group-expanded class from the group's element.
- *
- * @method expandGroup
- * @param {String|Group} group Group to expand, or ID of Group to expand.
- */
- _jpi.prototype.collapseGroup = function(groupId) {
- this.getGroupManager().collapseGroup(groupId);
- };
-
-
- _jpi.prototype.repaintGroup = function(group) {
- this.getGroupManager().repaintGroup(group);
- };
-
- /**
- * Collapses or expands a group element depending on its current state. See notes in the collapseGroup and expandGroup method.
- *
- * @method toggleGroup
- * @param {String|Group} group Group to expand/collapse, or ID of Group to expand/collapse.
- */
- _jpi.prototype.toggleGroup = function(group) {
- group = this.getGroupManager().getGroup(group);
- if (group != null) {
- this.getGroupManager()[group.collapsed ? "expandGroup" : "collapseGroup"](group);
- }
- };
-
- //
- // lazy init a group manager for the given jsplumb instance.
- //
- _jpi.prototype.getGroupManager = function() {
- var mgr = this[GROUP_MANAGER];
- if (mgr == null) {
- mgr = this[GROUP_MANAGER] = new GroupManager(this);
- }
- return mgr;
- };
-
- _jpi.prototype.removeGroupManager = function() {
- delete this[GROUP_MANAGER];
- };
-
- /**
- * Gets the Group that the given element belongs to, null if none.
- * @method getGroupFor
- * @param {String|Element} el Element, or element ID.
- * @returns {Group} A Group, if found, or null.
- */
- _jpi.prototype.getGroupFor = function(el) {
- el = this.getElement(el);
- if (el) {
- return el[GROUP];
- }
- };
-
-}).call(typeof window !== 'undefined' ? window : this);
-
-
-/*
- * jsPlumb Community Edition
- *
- * Provides a way to visually connect elements on an HTML page, using SVG.
- *
- * This file contains the 'flowchart' connectors, consisting of vertical and horizontal line segments.
- *
- * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
- *
- * https://jsplumbtoolkit.com
- * https://github.com/jsplumb/jsplumb
- *
- * Dual licensed under the MIT and GPL2 licenses.
- */
-;
-(function () {
-
- "use strict";
- var root = this, _jp = root.jsPlumb, _ju = root.jsPlumbUtil;
-
- var Flowchart = function (params) {
- this.type = "Flowchart";
- params = params || {};
- params.stub = params.stub == null ? 30 : params.stub;
- var segments,
- _super = _jp.Connectors.AbstractConnector.apply(this, arguments),
- midpoint = params.midpoint == null ? 0.5 : params.midpoint,
- alwaysRespectStubs = params.alwaysRespectStubs === true,
- lastx = null, lasty = null, lastOrientation,
- cornerRadius = params.cornerRadius != null ? params.cornerRadius : 0,
-
- // TODO now common between this and AbstractBezierEditor; refactor into superclass?
- loopbackRadius = params.loopbackRadius || 25,
- isLoopbackCurrently = false,
-
- sgn = function (n) {
- return n < 0 ? -1 : n === 0 ? 0 : 1;
- },
- /**
- * helper method to add a segment.
- */
- addSegment = function (segments, x, y, paintInfo) {
- if (lastx === x && lasty === y) {
- return;
- }
- var lx = lastx == null ? paintInfo.sx : lastx,
- ly = lasty == null ? paintInfo.sy : lasty,
- o = lx === x ? "v" : "h",
- sgnx = sgn(x - lx),
- sgny = sgn(y - ly);
-
- lastx = x;
- lasty = y;
- segments.push([lx, ly, x, y, o, sgnx, sgny]);
- },
- segLength = function (s) {
- return Math.sqrt(Math.pow(s[0] - s[2], 2) + Math.pow(s[1] - s[3], 2));
- },
- _cloneArray = function (a) {
- var _a = [];
- _a.push.apply(_a, a);
- return _a;
- },
- writeSegments = function (conn, segments, paintInfo) {
- var current = null, next;
- for (var i = 0; i < segments.length - 1; i++) {
-
- current = current || _cloneArray(segments[i]);
- next = _cloneArray(segments[i + 1]);
- if (cornerRadius > 0 && current[4] !== next[4]) {
- var radiusToUse = Math.min(cornerRadius, segLength(current), segLength(next));
- // right angle. adjust current segment's end point, and next segment's start point.
- current[2] -= current[5] * radiusToUse;
- current[3] -= current[6] * radiusToUse;
- next[0] += next[5] * radiusToUse;
- next[1] += next[6] * radiusToUse;
- var ac = (current[6] === next[5] && next[5] === 1) ||
- ((current[6] === next[5] && next[5] === 0) && current[5] !== next[6]) ||
- (current[6] === next[5] && next[5] === -1),
- sgny = next[1] > current[3] ? 1 : -1,
- sgnx = next[0] > current[2] ? 1 : -1,
- sgnEqual = sgny === sgnx,
- cx = (sgnEqual && ac || (!sgnEqual && !ac)) ? next[0] : current[2],
- cy = (sgnEqual && ac || (!sgnEqual && !ac)) ? current[3] : next[1];
-
- _super.addSegment(conn, "Straight", {
- x1: current[0], y1: current[1], x2: current[2], y2: current[3]
- });
-
- _super.addSegment(conn, "Arc", {
- r: radiusToUse,
- x1: current[2],
- y1: current[3],
- x2: next[0],
- y2: next[1],
- cx: cx,
- cy: cy,
- ac: ac
- });
- }
- else {
- // dx + dy are used to adjust for line width.
- var dx = (current[2] === current[0]) ? 0 : (current[2] > current[0]) ? (paintInfo.lw / 2) : -(paintInfo.lw / 2),
- dy = (current[3] === current[1]) ? 0 : (current[3] > current[1]) ? (paintInfo.lw / 2) : -(paintInfo.lw / 2);
- _super.addSegment(conn, "Straight", {
- x1: current[0] - dx, y1: current[1] - dy, x2: current[2] + dx, y2: current[3] + dy
- });
- }
- current = next;
- }
- if (next != null) {
- // last segment
- _super.addSegment(conn, "Straight", {
- x1: next[0], y1: next[1], x2: next[2], y2: next[3]
- });
- }
- };
-
- this._compute = function (paintInfo, params) {
-
- segments = [];
- lastx = null;
- lasty = null;
- lastOrientation = null;
-
- var commonStubCalculator = function () {
- return [ paintInfo.startStubX, paintInfo.startStubY, paintInfo.endStubX, paintInfo.endStubY ];
- },
- stubCalculators = {
- perpendicular: commonStubCalculator,
- orthogonal: commonStubCalculator,
- opposite: function (axis) {
- var pi = paintInfo,
- idx = axis === "x" ? 0 : 1,
- areInProximity = {
- "x": function () {
- return ( (pi.so[idx] === 1 && (
- ( (pi.startStubX > pi.endStubX) && (pi.tx > pi.startStubX) ) ||
- ( (pi.sx > pi.endStubX) && (pi.tx > pi.sx))))) ||
-
- ( (pi.so[idx] === -1 && (
- ( (pi.startStubX < pi.endStubX) && (pi.tx < pi.startStubX) ) ||
- ( (pi.sx < pi.endStubX) && (pi.tx < pi.sx)))));
- },
- "y": function () {
- return ( (pi.so[idx] === 1 && (
- ( (pi.startStubY > pi.endStubY) && (pi.ty > pi.startStubY) ) ||
- ( (pi.sy > pi.endStubY) && (pi.ty > pi.sy))))) ||
-
- ( (pi.so[idx] === -1 && (
- ( (pi.startStubY < pi.endStubY) && (pi.ty < pi.startStubY) ) ||
- ( (pi.sy < pi.endStubY) && (pi.ty < pi.sy)))));
- }
- };
-
- if (!alwaysRespectStubs && areInProximity[axis]()) {
- return {
- "x": [(paintInfo.sx + paintInfo.tx) / 2, paintInfo.startStubY, (paintInfo.sx + paintInfo.tx) / 2, paintInfo.endStubY],
- "y": [paintInfo.startStubX, (paintInfo.sy + paintInfo.ty) / 2, paintInfo.endStubX, (paintInfo.sy + paintInfo.ty) / 2]
- }[axis];
- }
- else {
- return [ paintInfo.startStubX, paintInfo.startStubY, paintInfo.endStubX, paintInfo.endStubY ];
- }
- }
- };
-
- // calculate Stubs.
- var stubs = stubCalculators[paintInfo.anchorOrientation](paintInfo.sourceAxis),
- idx = paintInfo.sourceAxis === "x" ? 0 : 1,
- oidx = paintInfo.sourceAxis === "x" ? 1 : 0,
- ss = stubs[idx],
- oss = stubs[oidx],
- es = stubs[idx + 2],
- oes = stubs[oidx + 2];
-
- // add the start stub segment. use stubs for loopback as it will look better, with the loop spaced
- // away from the element.
- addSegment(segments, stubs[0], stubs[1], paintInfo);
-
- // if its a loopback and we should treat it differently.
- if (false) {
-
- // we use loopbackRadius here, as statemachine connectors do.
- // so we go radius to the left from stubs[0], then upwards by 2*radius, to the right by 2*radius,
- // down by 2*radius, left by radius.
- addSegment(segments, stubs[0] - loopbackRadius, stubs[1], paintInfo);
- addSegment(segments, stubs[0] - loopbackRadius, stubs[1] - (2 * loopbackRadius), paintInfo);
- addSegment(segments, stubs[0] + loopbackRadius, stubs[1] - (2 * loopbackRadius), paintInfo);
- addSegment(segments, stubs[0] + loopbackRadius, stubs[1], paintInfo);
- addSegment(segments, stubs[0], stubs[1], paintInfo);
-
- }
- else {
-
-
- var midx = paintInfo.startStubX + ((paintInfo.endStubX - paintInfo.startStubX) * midpoint),
- midy = paintInfo.startStubY + ((paintInfo.endStubY - paintInfo.startStubY) * midpoint);
-
- var orientations = { x: [ 0, 1 ], y: [ 1, 0 ] },
- lineCalculators = {
- perpendicular: function (axis) {
- var pi = paintInfo,
- sis = {
- x: [
- [ [ 1, 2, 3, 4 ], null, [ 2, 1, 4, 3 ] ],
- null,
- [ [ 4, 3, 2, 1 ], null, [ 3, 4, 1, 2 ] ]
- ],
- y: [
- [ [ 3, 2, 1, 4 ], null, [ 2, 3, 4, 1 ] ],
- null,
- [ [ 4, 1, 2, 3 ], null, [ 1, 4, 3, 2 ] ]
- ]
- },
- stubs = {
- x: [ [ pi.startStubX, pi.endStubX ], null, [ pi.endStubX, pi.startStubX ] ],
- y: [ [ pi.startStubY, pi.endStubY ], null, [ pi.endStubY, pi.startStubY ] ]
- },
- midLines = {
- x: [ [ midx, pi.startStubY ], [ midx, pi.endStubY ] ],
- y: [ [ pi.startStubX, midy ], [ pi.endStubX, midy ] ]
- },
- linesToEnd = {
- x: [ [ pi.endStubX, pi.startStubY ] ],
- y: [ [ pi.startStubX, pi.endStubY ] ]
- },
- startToEnd = {
- x: [ [ pi.startStubX, pi.endStubY ], [ pi.endStubX, pi.endStubY ] ],
- y: [ [ pi.endStubX, pi.startStubY ], [ pi.endStubX, pi.endStubY ] ]
- },
- startToMidToEnd = {
- x: [ [ pi.startStubX, midy ], [ pi.endStubX, midy ], [ pi.endStubX, pi.endStubY ] ],
- y: [ [ midx, pi.startStubY ], [ midx, pi.endStubY ], [ pi.endStubX, pi.endStubY ] ]
- },
- otherStubs = {
- x: [ pi.startStubY, pi.endStubY ],
- y: [ pi.startStubX, pi.endStubX ]
- },
- soIdx = orientations[axis][0], toIdx = orientations[axis][1],
- _so = pi.so[soIdx] + 1,
- _to = pi.to[toIdx] + 1,
- otherFlipped = (pi.to[toIdx] === -1 && (otherStubs[axis][1] < otherStubs[axis][0])) || (pi.to[toIdx] === 1 && (otherStubs[axis][1] > otherStubs[axis][0])),
- stub1 = stubs[axis][_so][0],
- stub2 = stubs[axis][_so][1],
- segmentIndexes = sis[axis][_so][_to];
-
- if (pi.segment === segmentIndexes[3] || (pi.segment === segmentIndexes[2] && otherFlipped)) {
- return midLines[axis];
- }
- else if (pi.segment === segmentIndexes[2] && stub2 < stub1) {
- return linesToEnd[axis];
- }
- else if ((pi.segment === segmentIndexes[2] && stub2 >= stub1) || (pi.segment === segmentIndexes[1] && !otherFlipped)) {
- return startToMidToEnd[axis];
- }
- else if (pi.segment === segmentIndexes[0] || (pi.segment === segmentIndexes[1] && otherFlipped)) {
- return startToEnd[axis];
- }
- },
- orthogonal: function (axis, startStub, otherStartStub, endStub, otherEndStub) {
- var pi = paintInfo,
- extent = {
- "x": pi.so[0] === -1 ? Math.min(startStub, endStub) : Math.max(startStub, endStub),
- "y": pi.so[1] === -1 ? Math.min(startStub, endStub) : Math.max(startStub, endStub)
- }[axis];
-
- return {
- "x": [
- [ extent, otherStartStub ],
- [ extent, otherEndStub ],
- [ endStub, otherEndStub ]
- ],
- "y": [
- [ otherStartStub, extent ],
- [ otherEndStub, extent ],
- [ otherEndStub, endStub ]
- ]
- }[axis];
- },
- opposite: function (axis, ss, oss, es) {
- var pi = paintInfo,
- otherAxis = {"x": "y", "y": "x"}[axis],
- dim = {"x": "height", "y": "width"}[axis],
- comparator = pi["is" + axis.toUpperCase() + "GreaterThanStubTimes2"];
-
- if (params.sourceEndpoint.elementId === params.targetEndpoint.elementId) {
- var _val = oss + ((1 - params.sourceEndpoint.anchor[otherAxis]) * params.sourceInfo[dim]) + _super.maxStub;
- return {
- "x": [
- [ ss, _val ],
- [ es, _val ]
- ],
- "y": [
- [ _val, ss ],
- [ _val, es ]
- ]
- }[axis];
-
- }
- else if (!comparator || (pi.so[idx] === 1 && ss > es) || (pi.so[idx] === -1 && ss < es)) {
- return {
- "x": [
- [ ss, midy ],
- [ es, midy ]
- ],
- "y": [
- [ midx, ss ],
- [ midx, es ]
- ]
- }[axis];
- }
- else if ((pi.so[idx] === 1 && ss < es) || (pi.so[idx] === -1 && ss > es)) {
- return {
- "x": [
- [ midx, pi.sy ],
- [ midx, pi.ty ]
- ],
- "y": [
- [ pi.sx, midy ],
- [ pi.tx, midy ]
- ]
- }[axis];
- }
- }
- };
-
- // compute the rest of the line
- var p = lineCalculators[paintInfo.anchorOrientation](paintInfo.sourceAxis, ss, oss, es, oes);
- if (p) {
- for (var i = 0; i < p.length; i++) {
- addSegment(segments, p[i][0], p[i][1], paintInfo);
- }
- }
-
- // line to end stub
- addSegment(segments, stubs[2], stubs[3], paintInfo);
-
- }
-
- // end stub to end (common)
- addSegment(segments, paintInfo.tx, paintInfo.ty, paintInfo);
-
- // write out the segments.
- writeSegments(this, segments, paintInfo);
- };
-
- /*this.getPath = function () {
- var _last = null, _lastAxis = null, s = [], segs = segments;
- for (var i = 0; i < segs.length; i++) {
- var seg = segs[i], axis = seg[4], axisIndex = (axis == "v" ? 3 : 2);
- if (_last != null && _lastAxis === axis) {
- _last[axisIndex] = seg[axisIndex];
- }
- else {
- if (seg[0] != seg[2] || seg[1] != seg[3]) {
- s.push({
- start: [ seg[0], seg[1] ],
- end: [ seg[2], seg[3] ]
- });
- _last = seg;
- _lastAxis = seg[4];
- }
- }
- }
- return s;
- };*/
- };
-
- _ju.extend(Flowchart, _jp.Connectors.AbstractConnector);
- _jp.registerConnectorType(Flowchart, "Flowchart");
-}).call(typeof window !== 'undefined' ? window : this);
-/*
- * jsPlumb Community Edition
- *
- * Provides a way to visually connect elements on an HTML page, using SVG.
- *
- * This file contains the code for the Bezier connector type.
- *
- * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
- *
- * https://jsplumbtoolkit.com
- * https://github.com/jsplumb/jsplumb
- *
- * Dual licensed under the MIT and GPL2 licenses.
- */
-;
-(function () {
-
- "use strict";
- var root = this, _jp = root.jsPlumb, _ju = root.jsPlumbUtil;
-
- _jp.Connectors.AbstractBezierConnector = function(params) {
- params = params || {};
- var showLoopback = params.showLoopback !== false,
- curviness = params.curviness || 10,
- margin = params.margin || 5,
- proximityLimit = params.proximityLimit || 80,
- clockwise = params.orientation && params.orientation === "clockwise",
- loopbackRadius = params.loopbackRadius || 25,
- isLoopbackCurrently = false,
- _super;
-
- this.overrideSetEditable = function() { return !isLoopbackCurrently; };
-
- this._compute = function (paintInfo, p) {
-
- var sp = p.sourcePos,
- tp = p.targetPos,
- _w = Math.abs(sp[0] - tp[0]),
- _h = Math.abs(sp[1] - tp[1]);
-
- if (!showLoopback || (p.sourceEndpoint.elementId !== p.targetEndpoint.elementId)) {
- isLoopbackCurrently = false;
- this._computeBezier(paintInfo, p, sp, tp, _w, _h);
- } else {
- isLoopbackCurrently = true;
- // a loopback connector. draw an arc from one anchor to the other.
- var x1 = p.sourcePos[0], y1 = p.sourcePos[1] - margin,
- cx = x1, cy = y1 - loopbackRadius,
- // canvas sizing stuff, to ensure the whole painted area is visible.
- _x = cx - loopbackRadius,
- _y = cy - loopbackRadius;
-
- _w = 2 * loopbackRadius;
- _h = 2 * loopbackRadius;
-
- paintInfo.points[0] = _x;
- paintInfo.points[1] = _y;
- paintInfo.points[2] = _w;
- paintInfo.points[3] = _h;
-
- // ADD AN ARC SEGMENT.
- _super.addSegment(this, "Arc", {
- loopback: true,
- x1: (x1 - _x) + 4,
- y1: y1 - _y,
- startAngle: 0,
- endAngle: 2 * Math.PI,
- r: loopbackRadius,
- ac: !clockwise,
- x2: (x1 - _x) - 4,
- y2: y1 - _y,
- cx: cx - _x,
- cy: cy - _y
- });
- }
- };
-
- _super = _jp.Connectors.AbstractConnector.apply(this, arguments);
- return _super;
- };
- _ju.extend(_jp.Connectors.AbstractBezierConnector, _jp.Connectors.AbstractConnector);
-
- var Bezier = function (params) {
- params = params || {};
- this.type = "Bezier";
-
- var _super = _jp.Connectors.AbstractBezierConnector.apply(this, arguments),
- majorAnchor = params.curviness || 150,
- minorAnchor = 10;
-
- this.getCurviness = function () {
- return majorAnchor;
- };
-
- this._findControlPoint = function (point, sourceAnchorPosition, targetAnchorPosition, sourceEndpoint, targetEndpoint, soo, too) {
- // determine if the two anchors are perpendicular to each other in their orientation. we swap the control
- // points around if so (code could be tightened up)
- var perpendicular = soo[0] !== too[0] || soo[1] === too[1],
- p = [];
-
- if (!perpendicular) {
- if (soo[0] === 0) {
- p.push(sourceAnchorPosition[0] < targetAnchorPosition[0] ? point[0] + minorAnchor : point[0] - minorAnchor);
- }
- else {
- p.push(point[0] - (majorAnchor * soo[0]));
- }
-
- if (soo[1] === 0) {
- p.push(sourceAnchorPosition[1] < targetAnchorPosition[1] ? point[1] + minorAnchor : point[1] - minorAnchor);
- }
- else {
- p.push(point[1] + (majorAnchor * too[1]));
- }
- }
- else {
- if (too[0] === 0) {
- p.push(targetAnchorPosition[0] < sourceAnchorPosition[0] ? point[0] + minorAnchor : point[0] - minorAnchor);
- }
- else {
- p.push(point[0] + (majorAnchor * too[0]));
- }
-
- if (too[1] === 0) {
- p.push(targetAnchorPosition[1] < sourceAnchorPosition[1] ? point[1] + minorAnchor : point[1] - minorAnchor);
- }
- else {
- p.push(point[1] + (majorAnchor * soo[1]));
- }
- }
-
- return p;
- };
-
- this._computeBezier = function (paintInfo, p, sp, tp, _w, _h) {
-
- var geometry = this.getGeometry(), _CP, _CP2,
- _sx = sp[0] < tp[0] ? _w : 0,
- _sy = sp[1] < tp[1] ? _h : 0,
- _tx = sp[0] < tp[0] ? 0 : _w,
- _ty = sp[1] < tp[1] ? 0 : _h;
-
- if ((this.hasBeenEdited() || this.isEditing()) && geometry != null && geometry.controlPoints != null && geometry.controlPoints[0] != null && geometry.controlPoints[1] != null) {
- _CP = geometry.controlPoints[0];
- _CP2 = geometry.controlPoints[1];
- }
- else {
- _CP = this._findControlPoint([_sx, _sy], sp, tp, p.sourceEndpoint, p.targetEndpoint, paintInfo.so, paintInfo.to);
- _CP2 = this._findControlPoint([_tx, _ty], tp, sp, p.targetEndpoint, p.sourceEndpoint, paintInfo.to, paintInfo.so);
- }
-
- _super.setGeometry({controlPoints:[_CP, _CP2]}, true);
-
- _super.addSegment(this, "Bezier", {
- x1: _sx, y1: _sy, x2: _tx, y2: _ty,
- cp1x: _CP[0], cp1y: _CP[1], cp2x: _CP2[0], cp2y: _CP2[1]
- });
- };
-
-
- };
-
- _ju.extend(Bezier, _jp.Connectors.AbstractBezierConnector);
- _jp.registerConnectorType(Bezier, "Bezier");
-
-}).call(typeof window !== 'undefined' ? window : this);
-/*
- * jsPlumb Community Edition
- *
- * Provides a way to visually connect elements on an HTML page, using SVG.
- *
- * This file contains the state machine connectors, which extend AbstractBezierConnector.
- *
- * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
- *
- * https://jsplumbtoolkit.com
- * https://github.com/jsplumb/jsplumb
- *
- * Dual licensed under the MIT and GPL2 licenses.
- */
-;
-(function () {
-
- "use strict";
- var root = this, _jp = root.jsPlumb, _ju = root.jsPlumbUtil;
-
- var _segment = function (x1, y1, x2, y2) {
- if (x1 <= x2 && y2 <= y1) {
- return 1;
- }
- else if (x1 <= x2 && y1 <= y2) {
- return 2;
- }
- else if (x2 <= x1 && y2 >= y1) {
- return 3;
- }
- return 4;
- },
-
- // the control point we will use depends on the faces to which each end of the connection is assigned, specifically whether or not the
- // two faces are parallel or perpendicular. if they are parallel then the control point lies on the midpoint of the axis in which they
- // are parellel and varies only in the other axis; this variation is proportional to the distance that the anchor points lie from the
- // center of that face. if the two faces are perpendicular then the control point is at some distance from both the midpoints; the amount and
- // direction are dependent on the orientation of the two elements. 'seg', passed in to this method, tells you which segment the target element
- // lies in with respect to the source: 1 is top right, 2 is bottom right, 3 is bottom left, 4 is top left.
- //
- // sourcePos and targetPos are arrays of info about where on the source and target each anchor is located. their contents are:
- //
- // 0 - absolute x
- // 1 - absolute y
- // 2 - proportional x in element (0 is left edge, 1 is right edge)
- // 3 - proportional y in element (0 is top edge, 1 is bottom edge)
- //
- _findControlPoint = function (midx, midy, segment, sourceEdge, targetEdge, dx, dy, distance, proximityLimit) {
- // TODO (maybe)
- // - if anchor pos is 0.5, make the control point take into account the relative position of the elements.
- if (distance <= proximityLimit) {
- return [midx, midy];
- }
-
- if (segment === 1) {
- if (sourceEdge[3] <= 0 && targetEdge[3] >= 1) {
- return [ midx + (sourceEdge[2] < 0.5 ? -1 * dx : dx), midy ];
- }
- else if (sourceEdge[2] >= 1 && targetEdge[2] <= 0) {
- return [ midx, midy + (sourceEdge[3] < 0.5 ? -1 * dy : dy) ];
- }
- else {
- return [ midx + (-1 * dx) , midy + (-1 * dy) ];
- }
- }
- else if (segment === 2) {
- if (sourceEdge[3] >= 1 && targetEdge[3] <= 0) {
- return [ midx + (sourceEdge[2] < 0.5 ? -1 * dx : dx), midy ];
- }
- else if (sourceEdge[2] >= 1 && targetEdge[2] <= 0) {
- return [ midx, midy + (sourceEdge[3] < 0.5 ? -1 * dy : dy) ];
- }
- else {
- return [ midx + dx, midy + (-1 * dy) ];
- }
- }
- else if (segment === 3) {
- if (sourceEdge[3] >= 1 && targetEdge[3] <= 0) {
- return [ midx + (sourceEdge[2] < 0.5 ? -1 * dx : dx), midy ];
- }
- else if (sourceEdge[2] <= 0 && targetEdge[2] >= 1) {
- return [ midx, midy + (sourceEdge[3] < 0.5 ? -1 * dy : dy) ];
- }
- else {
- return [ midx + (-1 * dx) , midy + (-1 * dy) ];
- }
- }
- else if (segment === 4) {
- if (sourceEdge[3] <= 0 && targetEdge[3] >= 1) {
- return [ midx + (sourceEdge[2] < 0.5 ? -1 * dx : dx), midy ];
- }
- else if (sourceEdge[2] <= 0 && targetEdge[2] >= 1) {
- return [ midx, midy + (sourceEdge[3] < 0.5 ? -1 * dy : dy) ];
- }
- else {
- return [ midx + dx , midy + (-1 * dy) ];
- }
- }
-
- };
-
- var StateMachine = function (params) {
- params = params || {};
- this.type = "StateMachine";
-
- var _super = _jp.Connectors.AbstractBezierConnector.apply(this, arguments),
- curviness = params.curviness || 10,
- margin = params.margin || 5,
- proximityLimit = params.proximityLimit || 80,
- clockwise = params.orientation && params.orientation === "clockwise",
- _controlPoint;
-
- this._computeBezier = function(paintInfo, params, sp, tp, w, h) {
- var _sx = params.sourcePos[0] < params.targetPos[0] ? 0 : w,
- _sy = params.sourcePos[1] < params.targetPos[1] ? 0 : h,
- _tx = params.sourcePos[0] < params.targetPos[0] ? w : 0,
- _ty = params.sourcePos[1] < params.targetPos[1] ? h : 0;
-
- // now adjust for the margin
- if (params.sourcePos[2] === 0) {
- _sx -= margin;
- }
- if (params.sourcePos[2] === 1) {
- _sx += margin;
- }
- if (params.sourcePos[3] === 0) {
- _sy -= margin;
- }
- if (params.sourcePos[3] === 1) {
- _sy += margin;
- }
- if (params.targetPos[2] === 0) {
- _tx -= margin;
- }
- if (params.targetPos[2] === 1) {
- _tx += margin;
- }
- if (params.targetPos[3] === 0) {
- _ty -= margin;
- }
- if (params.targetPos[3] === 1) {
- _ty += margin;
- }
-
- //
- // these connectors are quadratic bezier curves, having a single control point. if both anchors
- // are located at 0.5 on their respective faces, the control point is set to the midpoint and you
- // get a straight line. this is also the case if the two anchors are within 'proximityLimit', since
- // it seems to make good aesthetic sense to do that. outside of that, the control point is positioned
- // at 'curviness' pixels away along the normal to the straight line connecting the two anchors.
- //
- // there may be two improvements to this. firstly, we might actually support the notion of avoiding nodes
- // in the UI, or at least making a good effort at doing so. if a connection would pass underneath some node,
- // for example, we might increase the distance the control point is away from the midpoint in a bid to
- // steer it around that node. this will work within limits, but i think those limits would also be the likely
- // limits for, once again, aesthetic good sense in the layout of a chart using these connectors.
- //
- // the second possible change is actually two possible changes: firstly, it is possible we should gradually
- // decrease the 'curviness' as the distance between the anchors decreases; start tailing it off to 0 at some
- // point (which should be configurable). secondly, we might slightly increase the 'curviness' for connectors
- // with respect to how far their anchor is from the center of its respective face. this could either look cool,
- // or stupid, and may indeed work only in a way that is so subtle as to have been a waste of time.
- //
-
- var _midx = (_sx + _tx) / 2,
- _midy = (_sy + _ty) / 2,
- segment = _segment(_sx, _sy, _tx, _ty),
- distance = Math.sqrt(Math.pow(_tx - _sx, 2) + Math.pow(_ty - _sy, 2)),
- cp1x, cp2x, cp1y, cp2y,
- geometry = _super.getGeometry();
-
- if ((this.hasBeenEdited() || this.isEditing()) && geometry != null) {
- cp1x = geometry.controlPoints[0][0];
- cp1y = geometry.controlPoints[0][1];
- cp2x = geometry.controlPoints[1][0];
- cp2y = geometry.controlPoints[1][1];
- }
- else {
- // calculate the control point. this code will be where we'll put in a rudimentary element avoidance scheme; it
- // will work by extending the control point to force the curve to be, um, curvier.
- _controlPoint = _findControlPoint(_midx,
- _midy,
- segment,
- params.sourcePos,
- params.targetPos,
- curviness, curviness,
- distance,
- proximityLimit);
-
- cp1x = _controlPoint[0];
- cp2x = _controlPoint[0];
- cp1y = _controlPoint[1];
- cp2y = _controlPoint[1];
-
- _super.setGeometry({controlPoints:[_controlPoint, _controlPoint]}, true);
- }
-
- _super.addSegment(this, "Bezier", {
- x1: _tx, y1: _ty, x2: _sx, y2: _sy,
- cp1x: cp1x, cp1y: cp1y,
- cp2x: cp2x, cp2y: cp2y
- });
- };
- };
-
- _ju.extend(StateMachine, _jp.Connectors.AbstractBezierConnector);
- _jp.registerConnectorType(StateMachine, "StateMachine");
-
-}).call(typeof window !== 'undefined' ? window : this);
-/*
- * jsPlumb Community Edition
- *
- * Provides a way to visually connect elements on an HTML page, using SVG.
- *
- * This file contains the 'flowchart' connectors, consisting of vertical and horizontal line segments.
- *
- * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
- *
- * https://jsplumbtoolkit.com
- * https://github.com/jsplumb/jsplumb
- *
- * Dual licensed under the MIT and GPL2 licenses.
- */
-;
-(function () {
-
- "use strict";
- var root = this, _jp = root.jsPlumb, _ju = root.jsPlumbUtil;
- var STRAIGHT = "Straight";
-
- var Straight = function (params) {
- this.type = STRAIGHT;
- var _super = _jp.Connectors.AbstractConnector.apply(this, arguments);
-
- this._compute = function (paintInfo, _) {
- _super.addSegment(this, STRAIGHT, {x1: paintInfo.sx, y1: paintInfo.sy, x2: paintInfo.startStubX, y2: paintInfo.startStubY});
- _super.addSegment(this, STRAIGHT, {x1: paintInfo.startStubX, y1: paintInfo.startStubY, x2: paintInfo.endStubX, y2: paintInfo.endStubY});
- _super.addSegment(this, STRAIGHT, {x1: paintInfo.endStubX, y1: paintInfo.endStubY, x2: paintInfo.tx, y2: paintInfo.ty});
- };
- };
-
- _ju.extend(Straight, _jp.Connectors.AbstractConnector);
- _jp.registerConnectorType(Straight, STRAIGHT);
-
-}).call(typeof window !== 'undefined' ? window : this);
-/*
- * jsPlumb Community Edition
- *
- * Provides a way to visually connect elements on an HTML page, using SVG.
- *
- * This file contains the SVG renderers.
- *
- * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
- *
- * https://jsplumbtoolkit.com
- * https://github.com/jsplumb/jsplumb
- *
- * Dual licensed under the MIT and GPL2 licenses.
- */
-;
-(function () {
-
-// ************************** SVG utility methods ********************************************
-
- "use strict";
- var root = this, _jp = root.jsPlumb, _ju = root.jsPlumbUtil;
-
- var svgAttributeMap = {
- "stroke-linejoin": "stroke-linejoin",
- "stroke-dashoffset": "stroke-dashoffset",
- "stroke-linecap": "stroke-linecap"
- },
- STROKE_DASHARRAY = "stroke-dasharray",
- DASHSTYLE = "dashstyle",
- LINEAR_GRADIENT = "linearGradient",
- RADIAL_GRADIENT = "radialGradient",
- DEFS = "defs",
- FILL = "fill",
- STOP = "stop",
- STROKE = "stroke",
- STROKE_WIDTH = "stroke-width",
- STYLE = "style",
- NONE = "none",
- JSPLUMB_GRADIENT = "jsplumb_gradient_",
- LINE_WIDTH = "strokeWidth",
- ns = {
- svg: "http://www.w3.org/2000/svg"
- },
- _attr = function (node, attributes) {
- for (var i in attributes) {
- node.setAttribute(i, "" + attributes[i]);
- }
- },
- _node = function (name, attributes) {
- attributes = attributes || {};
- attributes.version = "1.1";
- attributes.xmlns = ns.svg;
- return _jp.createElementNS(ns.svg, name, null, null, attributes);
- },
- _pos = function (d) {
- return "position:absolute;left:" + d[0] + "px;top:" + d[1] + "px";
- },
- _clearGradient = function (parent) {
- var els = parent.querySelectorAll(" defs,linearGradient,radialGradient");
- for (var i = 0; i < els.length; i++) {
- els[i].parentNode.removeChild(els[i]);
- }
- },
- _updateGradient = function (parent, node, style, dimensions, uiComponent) {
- var id = JSPLUMB_GRADIENT + uiComponent._jsPlumb.instance.idstamp();
- // first clear out any existing gradient
- _clearGradient(parent);
- // this checks for an 'offset' property in the gradient, and in the absence of it, assumes
- // we want a linear gradient. if it's there, we create a radial gradient.
- // it is possible that a more explicit means of defining the gradient type would be
- // better. relying on 'offset' means that we can never have a radial gradient that uses
- // some default offset, for instance.
- // issue 244 suggested the 'gradientUnits' attribute; without this, straight/flowchart connectors with gradients would
- // not show gradients when the line was perfectly horizontal or vertical.
- var g;
- if (!style.gradient.offset) {
- g = _node(LINEAR_GRADIENT, {id: id, gradientUnits: "userSpaceOnUse"});
- }
- else {
- g = _node(RADIAL_GRADIENT, { id: id });
- }
-
- var defs = _node(DEFS);
- parent.appendChild(defs);
- defs.appendChild(g);
-
- // the svg radial gradient seems to treat stops in the reverse
- // order to how canvas does it. so we want to keep all the maths the same, but
- // iterate the actual style declarations in reverse order, if the x indexes are not in order.
- for (var i = 0; i < style.gradient.stops.length; i++) {
- var styleToUse = uiComponent.segment === 1 || uiComponent.segment === 2 ? i : style.gradient.stops.length - 1 - i,
- stopColor = style.gradient.stops[styleToUse][1],
- s = _node(STOP, {"offset": Math.floor(style.gradient.stops[i][0] * 100) + "%", "stop-color": stopColor});
-
- g.appendChild(s);
- }
- var applyGradientTo = style.stroke ? STROKE : FILL;
- node.setAttribute(applyGradientTo, "url(#" + id + ")");
- },
- _applyStyles = function (parent, node, style, dimensions, uiComponent) {
-
- node.setAttribute(FILL, style.fill ? style.fill : NONE);
- node.setAttribute(STROKE, style.stroke ? style.stroke : NONE);
-
- if (style.gradient) {
- _updateGradient(parent, node, style, dimensions, uiComponent);
- }
- else {
- // make sure we clear any existing gradient
- _clearGradient(parent);
- node.setAttribute(STYLE, "");
- }
-
- if (style.strokeWidth) {
- node.setAttribute(STROKE_WIDTH, style.strokeWidth);
- }
-
- // in SVG there is a stroke-dasharray attribute we can set, and its syntax looks like
- // the syntax in VML but is actually kind of nasty: values are given in the pixel
- // coordinate space, whereas in VML they are multiples of the width of the stroked
- // line, which makes a lot more sense. for that reason, jsPlumb is supporting both
- // the native svg 'stroke-dasharray' attribute, and also the 'dashstyle' concept from
- // VML, which will be the preferred method. the code below this converts a dashstyle
- // attribute given in terms of stroke width into a pixel representation, by using the
- // stroke's lineWidth.
- if (style[DASHSTYLE] && style[LINE_WIDTH] && !style[STROKE_DASHARRAY]) {
- var sep = style[DASHSTYLE].indexOf(",") === -1 ? " " : ",",
- parts = style[DASHSTYLE].split(sep),
- styleToUse = "";
- parts.forEach(function (p) {
- styleToUse += (Math.floor(p * style.strokeWidth) + sep);
- });
- node.setAttribute(STROKE_DASHARRAY, styleToUse);
- }
- else if (style[STROKE_DASHARRAY]) {
- node.setAttribute(STROKE_DASHARRAY, style[STROKE_DASHARRAY]);
- }
-
- // extra attributes such as join type, dash offset.
- for (var i in svgAttributeMap) {
- if (style[i]) {
- node.setAttribute(svgAttributeMap[i], style[i]);
- }
- }
- },
- _appendAtIndex = function (svg, path, idx) {
- if (svg.childNodes.length > idx) {
- svg.insertBefore(path, svg.childNodes[idx]);
- }
- else {
- svg.appendChild(path);
- }
- };
-
- /**
- utility methods for other objects to use.
- */
- _ju.svg = {
- node: _node,
- attr: _attr,
- pos: _pos
- };
-
- // ************************** / SVG utility methods ********************************************
-
- /*
- * Base class for SVG components.
- */
- var SvgComponent = function (params) {
- var pointerEventsSpec = params.pointerEventsSpec || "all", renderer = {};
-
- _jp.jsPlumbUIComponent.apply(this, params.originalArgs);
- this.canvas = null;
- this.path = null;
- this.svg = null;
- this.bgCanvas = null;
-
- var clazz = params.cssClass + " " + (params.originalArgs[0].cssClass || ""),
- svgParams = {
- "style": "",
- "width": 0,
- "height": 0,
- "pointer-events": pointerEventsSpec,
- "position": "absolute"
- };
-
- this.svg = _node("svg", svgParams);
-
- if (params.useDivWrapper) {
- this.canvas = _jp.createElement("div", { position : "absolute" });
- _ju.sizeElement(this.canvas, 0, 0, 1, 1);
- this.canvas.className = clazz;
- }
- else {
- _attr(this.svg, { "class": clazz });
- this.canvas = this.svg;
- }
-
- params._jsPlumb.appendElement(this.canvas, params.originalArgs[0].parent);
- if (params.useDivWrapper) {
- this.canvas.appendChild(this.svg);
- }
-
- var displayElements = [ this.canvas ];
- this.getDisplayElements = function () {
- return displayElements;
- };
-
- this.appendDisplayElement = function (el) {
- displayElements.push(el);
- };
-
- this.paint = function (style, anchor, extents) {
- if (style != null) {
-
- var xy = [ this.x, this.y ], wh = [ this.w, this.h ], p;
- if (extents != null) {
- if (extents.xmin < 0) {
- xy[0] += extents.xmin;
- }
- if (extents.ymin < 0) {
- xy[1] += extents.ymin;
- }
- wh[0] = extents.xmax + ((extents.xmin < 0) ? -extents.xmin : 0);
- wh[1] = extents.ymax + ((extents.ymin < 0) ? -extents.ymin : 0);
- }
-
- if (params.useDivWrapper) {
- _ju.sizeElement(this.canvas, xy[0], xy[1], wh[0], wh[1]);
- xy[0] = 0;
- xy[1] = 0;
- p = _pos([ 0, 0 ]);
- }
- else {
- p = _pos([ xy[0], xy[1] ]);
- }
-
- renderer.paint.apply(this, arguments);
-
- _attr(this.svg, {
- "style": p,
- "width": wh[0] || 0,
- "height": wh[1] || 0
- });
- }
- };
-
- return {
- renderer: renderer
- };
- };
-
- _ju.extend(SvgComponent, _jp.jsPlumbUIComponent, {
- cleanup: function (force) {
- if (force || this.typeId == null) {
- if (this.canvas) {
- this.canvas._jsPlumb = null;
- }
- if (this.svg) {
- this.svg._jsPlumb = null;
- }
- if (this.bgCanvas) {
- this.bgCanvas._jsPlumb = null;
- }
-
- if (this.canvas && this.canvas.parentNode) {
- this.canvas.parentNode.removeChild(this.canvas);
- }
- if (this.bgCanvas && this.bgCanvas.parentNode) {
- this.canvas.parentNode.removeChild(this.canvas);
- }
-
- this.svg = null;
- this.canvas = null;
- this.path = null;
- this.group = null;
- }
- else {
- // if not a forced cleanup, just detach from DOM for now.
- if (this.canvas && this.canvas.parentNode) {
- this.canvas.parentNode.removeChild(this.canvas);
- }
- if (this.bgCanvas && this.bgCanvas.parentNode) {
- this.bgCanvas.parentNode.removeChild(this.bgCanvas);
- }
- }
- },
- reattach:function(instance) {
- var c = instance.getContainer();
- if (this.canvas && this.canvas.parentNode == null) {
- c.appendChild(this.canvas);
- }
- if (this.bgCanvas && this.bgCanvas.parentNode == null) {
- c.appendChild(this.bgCanvas);
- }
- },
- setVisible: function (v) {
- if (this.canvas) {
- this.canvas.style.display = v ? "block" : "none";
- }
- }
- });
-
- /*
- * Base class for SVG connectors.
- */
- _jp.ConnectorRenderers.svg = function (params) {
- var self = this,
- _super = SvgComponent.apply(this, [
- {
- cssClass: params._jsPlumb.connectorClass + (this.isEditable() ? " " + params._jsPlumb.editableConnectorClass : ""),
- originalArgs: arguments,
- pointerEventsSpec: "none",
- _jsPlumb: params._jsPlumb
- }
- ]);
-
- var _superSetEditable = this.setEditable;
- this.setEditable = function(e) {
- var result = _superSetEditable.apply(this, [e]);
- _jp[result ? "addClass" : "removeClass"](this.canvas, this._jsPlumb.instance.editableConnectorClass);
- };
-
- _super.renderer.paint = function (style, anchor, extents) {
-
- var segments = self.getSegments(), p = "", offset = [0, 0];
- if (extents.xmin < 0) {
- offset[0] = -extents.xmin;
- }
- if (extents.ymin < 0) {
- offset[1] = -extents.ymin;
- }
-
- if (segments.length > 0) {
-
- p = self.getPathData();
-
- var a = {
- d: p,
- transform: "translate(" + offset[0] + "," + offset[1] + ")",
- "pointer-events": params["pointer-events"] || "visibleStroke"
- },
- outlineStyle = null,
- d = [self.x, self.y, self.w, self.h];
-
- // outline style. actually means drawing an svg object underneath the main one.
- if (style.outlineStroke) {
- var outlineWidth = style.outlineWidth || 1,
- outlineStrokeWidth = style.strokeWidth + (2 * outlineWidth);
- outlineStyle = _jp.extend({}, style);
- delete outlineStyle.gradient;
- outlineStyle.stroke = style.outlineStroke;
- outlineStyle.strokeWidth = outlineStrokeWidth;
-
- if (self.bgPath == null) {
- self.bgPath = _node("path", a);
- _jp.addClass(self.bgPath, _jp.connectorOutlineClass);
- _appendAtIndex(self.svg, self.bgPath, 0);
- }
- else {
- _attr(self.bgPath, a);
- }
-
- _applyStyles(self.svg, self.bgPath, outlineStyle, d, self);
- }
-
- if (self.path == null) {
- self.path = _node("path", a);
- _appendAtIndex(self.svg, self.path, style.outlineStroke ? 1 : 0);
- }
- else {
- _attr(self.path, a);
- }
-
- _applyStyles(self.svg, self.path, style, d, self);
- }
- };
- };
- _ju.extend(_jp.ConnectorRenderers.svg, SvgComponent);
-
-// ******************************* svg segment renderer *****************************************************
-
-
-// ******************************* /svg segments *****************************************************
-
- /*
- * Base class for SVG endpoints.
- */
- var SvgEndpoint = _jp.SvgEndpoint = function (params) {
- var _super = SvgComponent.apply(this, [
- {
- cssClass: params._jsPlumb.endpointClass,
- originalArgs: arguments,
- pointerEventsSpec: "all",
- useDivWrapper: true,
- _jsPlumb: params._jsPlumb
- }
- ]);
-
- _super.renderer.paint = function (style) {
- var s = _jp.extend({}, style);
- if (s.outlineStroke) {
- s.stroke = s.outlineStroke;
- }
-
- if (this.node == null) {
- this.node = this.makeNode(s);
- this.svg.appendChild(this.node);
- }
- else if (this.updateNode != null) {
- this.updateNode(this.node);
- }
- _applyStyles(this.svg, this.node, s, [ this.x, this.y, this.w, this.h ], this);
- _pos(this.node, [ this.x, this.y ]);
- }.bind(this);
-
- };
- _ju.extend(SvgEndpoint, SvgComponent);
-
- /*
- * SVG Dot Endpoint
- */
- _jp.Endpoints.svg.Dot = function () {
- _jp.Endpoints.Dot.apply(this, arguments);
- SvgEndpoint.apply(this, arguments);
- this.makeNode = function (style) {
- return _node("circle", {
- "cx": this.w / 2,
- "cy": this.h / 2,
- "r": this.radius
- });
- };
- this.updateNode = function (node) {
- _attr(node, {
- "cx": this.w / 2,
- "cy": this.h / 2,
- "r": this.radius
- });
- };
- };
- _ju.extend(_jp.Endpoints.svg.Dot, [_jp.Endpoints.Dot, SvgEndpoint]);
-
- /*
- * SVG Rectangle Endpoint
- */
- _jp.Endpoints.svg.Rectangle = function () {
- _jp.Endpoints.Rectangle.apply(this, arguments);
- SvgEndpoint.apply(this, arguments);
- this.makeNode = function (style) {
- return _node("rect", {
- "width": this.w,
- "height": this.h
- });
- };
- this.updateNode = function (node) {
- _attr(node, {
- "width": this.w,
- "height": this.h
- });
- };
- };
- _ju.extend(_jp.Endpoints.svg.Rectangle, [_jp.Endpoints.Rectangle, SvgEndpoint]);
-
- /*
- * SVG Image Endpoint is the default image endpoint.
- */
- _jp.Endpoints.svg.Image = _jp.Endpoints.Image;
- /*
- * Blank endpoint in svg renderer is the default Blank endpoint.
- */
- _jp.Endpoints.svg.Blank = _jp.Endpoints.Blank;
- /*
- * Label overlay in svg renderer is the default Label overlay.
- */
- _jp.Overlays.svg.Label = _jp.Overlays.Label;
- /*
- * Custom overlay in svg renderer is the default Custom overlay.
- */
- _jp.Overlays.svg.Custom = _jp.Overlays.Custom;
-
- var AbstractSvgArrowOverlay = function (superclass, originalArgs) {
- superclass.apply(this, originalArgs);
- _jp.jsPlumbUIComponent.apply(this, originalArgs);
- this.isAppendedAtTopLevel = false;
- var self = this;
- this.path = null;
- this.paint = function (params, containerExtents) {
- // only draws on connections, not endpoints.
- if (params.component.svg && containerExtents) {
- if (this.path == null) {
- this.path = _node("path", {
- "pointer-events": "all"
- });
- params.component.svg.appendChild(this.path);
- if (this.elementCreated) {
- this.elementCreated(this.path, params.component);
- }
-
- this.canvas = params.component.svg; // for the sake of completeness; this behaves the same as other overlays
- }
- var clazz = originalArgs && (originalArgs.length === 1) ? (originalArgs[0].cssClass || "") : "",
- offset = [0, 0];
-
- if (containerExtents.xmin < 0) {
- offset[0] = -containerExtents.xmin;
- }
- if (containerExtents.ymin < 0) {
- offset[1] = -containerExtents.ymin;
- }
-
- _attr(this.path, {
- "d": makePath(params.d),
- "class": clazz,
- stroke: params.stroke ? params.stroke : null,
- fill: params.fill ? params.fill : null,
- transform: "translate(" + offset[0] + "," + offset[1] + ")"
- });
- }
- };
- var makePath = function (d) {
- return (isNaN(d.cxy.x) || isNaN(d.cxy.y)) ? "" : "M" + d.hxy.x + "," + d.hxy.y +
- " L" + d.tail[0].x + "," + d.tail[0].y +
- " L" + d.cxy.x + "," + d.cxy.y +
- " L" + d.tail[1].x + "," + d.tail[1].y +
- " L" + d.hxy.x + "," + d.hxy.y;
- };
- this.transfer = function(target) {
- if (target.canvas && this.path && this.path.parentNode) {
- this.path.parentNode.removeChild(this.path);
- target.canvas.appendChild(this.path);
- }
- };
- };
- _ju.extend(AbstractSvgArrowOverlay, [_jp.jsPlumbUIComponent, _jp.Overlays.AbstractOverlay], {
- cleanup: function (force) {
- if (this.path != null) {
- if (force) {
- this._jsPlumb.instance.removeElement(this.path);
- }
- else {
- if (this.path.parentNode) {
- this.path.parentNode.removeChild(this.path);
- }
- }
- }
- },
- reattach:function(instance, component) {
- if (this.path && component.canvas) {
- component.canvas.appendChild(this.path);
- }
- },
- setVisible: function (v) {
- if (this.path != null) {
- (this.path.style.display = (v ? "block" : "none"));
- }
- }
- });
-
- _jp.Overlays.svg.Arrow = function () {
- AbstractSvgArrowOverlay.apply(this, [_jp.Overlays.Arrow, arguments]);
- };
- _ju.extend(_jp.Overlays.svg.Arrow, [ _jp.Overlays.Arrow, AbstractSvgArrowOverlay ]);
-
- _jp.Overlays.svg.PlainArrow = function () {
- AbstractSvgArrowOverlay.apply(this, [_jp.Overlays.PlainArrow, arguments]);
- };
- _ju.extend(_jp.Overlays.svg.PlainArrow, [ _jp.Overlays.PlainArrow, AbstractSvgArrowOverlay ]);
-
- _jp.Overlays.svg.Diamond = function () {
- AbstractSvgArrowOverlay.apply(this, [_jp.Overlays.Diamond, arguments]);
- };
- _ju.extend(_jp.Overlays.svg.Diamond, [ _jp.Overlays.Diamond, AbstractSvgArrowOverlay ]);
-
- // a test
- _jp.Overlays.svg.GuideLines = function () {
- var path = null, self = this, p1_1, p1_2;
- _jp.Overlays.GuideLines.apply(this, arguments);
- this.paint = function (params, containerExtents) {
- if (path == null) {
- path = _node("path");
- params.connector.svg.appendChild(path);
- self.attachListeners(path, params.connector);
- self.attachListeners(path, self);
-
- p1_1 = _node("path");
- params.connector.svg.appendChild(p1_1);
- self.attachListeners(p1_1, params.connector);
- self.attachListeners(p1_1, self);
-
- p1_2 = _node("path");
- params.connector.svg.appendChild(p1_2);
- self.attachListeners(p1_2, params.connector);
- self.attachListeners(p1_2, self);
- }
-
- var offset = [0, 0];
- if (containerExtents.xmin < 0) {
- offset[0] = -containerExtents.xmin;
- }
- if (containerExtents.ymin < 0) {
- offset[1] = -containerExtents.ymin;
- }
-
- _attr(path, {
- "d": makePath(params.head, params.tail),
- stroke: "red",
- fill: null,
- transform: "translate(" + offset[0] + "," + offset[1] + ")"
- });
-
- _attr(p1_1, {
- "d": makePath(params.tailLine[0], params.tailLine[1]),
- stroke: "blue",
- fill: null,
- transform: "translate(" + offset[0] + "," + offset[1] + ")"
- });
-
- _attr(p1_2, {
- "d": makePath(params.headLine[0], params.headLine[1]),
- stroke: "green",
- fill: null,
- transform: "translate(" + offset[0] + "," + offset[1] + ")"
- });
- };
-
- var makePath = function (d1, d2) {
- return "M " + d1.x + "," + d1.y +
- " L" + d2.x + "," + d2.y;
- };
- };
- _ju.extend(_jp.Overlays.svg.GuideLines, _jp.Overlays.GuideLines);
-}).call(typeof window !== 'undefined' ? window : this);
-
-/*
- * jsPlumb Community Edition
- *
- * Provides a way to visually connect elements on an HTML page, using SVG.
- *
- * This file contains the 'vanilla' adapter - having no external dependencies other than bundled libs.
- *
- * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
- *
- * https://jsplumbtoolkit.com
- * https://github.com/jsplumb/jsplumb
- *
- * Dual licensed under the MIT and GPL2 licenses.
- */
-;
-(function () {
-
- "use strict";
- var root = this, _jp = root.jsPlumb, _ju = root.jsPlumbUtil,
- _jk = root.Katavorio, _jg = root.Biltong;
-
- var _getDragManager = function (instance, category) {
-
- category = category || "main";
- var key = "_katavorio_" + category;
- var k = instance[key],
- e = instance.getEventManager();
-
- if (!k) {
- k = new _jk({
- bind: e.on,
- unbind: e.off,
- getSize: _jp.getSize,
- getPosition: function (el, relativeToRoot) {
- // if this is a nested draggable then compute the offset against its own offsetParent, otherwise
- // compute against the Container's origin. see also the getUIPosition method below.
- var o = instance.getOffset(el, relativeToRoot, el._katavorioDrag ? el.offsetParent : null);
- return [o.left, o.top];
- },
- setPosition: function (el, xy) {
- el.style.left = xy[0] + "px";
- el.style.top = xy[1] + "px";
- },
- addClass: _jp.addClass,
- removeClass: _jp.removeClass,
- intersects: _jg.intersects,
- indexOf: function(l, i) { return l.indexOf(i); },
- scope:instance.getDefaultScope(),
- css: {
- noSelect: instance.dragSelectClass,
- droppable: "jtk-droppable",
- draggable: "jtk-draggable",
- drag: "jtk-drag",
- selected: "jtk-drag-selected",
- active: "jtk-drag-active",
- hover: "jtk-drag-hover",
- ghostProxy:"jtk-ghost-proxy"
- }
- });
- k.setZoom(instance.getZoom());
- instance[key] = k;
- instance.bind("zoom", k.setZoom);
- }
- return k;
- };
-
- var _animProps = function (o, p) {
- var _one = function (pName) {
- if (p[pName] != null) {
- if (_ju.isString(p[pName])) {
- var m = p[pName].match(/-=/) ? -1 : 1,
- v = p[pName].substring(2);
- return o[pName] + (m * v);
- }
- else {
- return p[pName];
- }
- }
- else {
- return o[pName];
- }
- };
- return [ _one("left"), _one("top") ];
- };
-
- _jp.extend(root.jsPlumbInstance.prototype, {
-
- animationSupported:true,
- getElement: function (el) {
- if (el == null) {
- return null;
- }
- // here we pluck the first entry if el was a list of entries.
- // this is not my favourite thing to do, but previous versions of
- // jsplumb supported jquery selectors, and it is possible a selector
- // will be passed in here.
- el = typeof el === "string" ? el : el.length != null && el.enctype == null ? el[0] : el;
- return typeof el === "string" ? document.getElementById(el) : el;
- },
- removeElement: function (element) {
- _getDragManager(this).elementRemoved(element);
- this.getEventManager().remove(element);
- },
- //
- // this adapter supports a rudimentary animation function. no easing is supported. only
- // left/top properties are supported. property delta args are expected to be in the form
- //
- // +=x.xxxx
- //
- // or
- //
- // -=x.xxxx
- //
- doAnimate: function (el, properties, options) {
- options = options || {};
- var o = this.getOffset(el),
- ap = _animProps(o, properties),
- ldist = ap[0] - o.left,
- tdist = ap[1] - o.top,
- d = options.duration || 250,
- step = 15, steps = d / step,
- linc = (step / d) * ldist,
- tinc = (step / d) * tdist,
- idx = 0,
- _int = setInterval(function () {
- _jp.setPosition(el, {
- left: o.left + (linc * (idx + 1)),
- top: o.top + (tinc * (idx + 1))
- });
- if (options.step != null) {
- options.step(idx, Math.ceil(steps));
- }
- idx++;
- if (idx >= steps) {
- window.clearInterval(_int);
- if (options.complete != null) {
- options.complete();
- }
- }
- }, step);
- },
- // DRAG/DROP
- destroyDraggable: function (el, category) {
- _getDragManager(this, category).destroyDraggable(el);
- },
- destroyDroppable: function (el, category) {
- _getDragManager(this, category).destroyDroppable(el);
- },
- initDraggable: function (el, options, category) {
- _getDragManager(this, category).draggable(el, options);
- },
- initDroppable: function (el, options, category) {
- _getDragManager(this, category).droppable(el, options);
- },
- isAlreadyDraggable: function (el) {
- return el._katavorioDrag != null;
- },
- isDragSupported: function (el, options) {
- return true;
- },
- isDropSupported: function (el, options) {
- return true;
- },
- isElementDraggable: function (el) {
- el = _jp.getElement(el);
- return el._katavorioDrag && el._katavorioDrag.isEnabled();
- },
- getDragObject: function (eventArgs) {
- return eventArgs[0].drag.getDragElement();
- },
- getDragScope: function (el) {
- return el._katavorioDrag && el._katavorioDrag.scopes.join(" ") || "";
- },
- getDropEvent: function (args) {
- return args[0].e;
- },
- getUIPosition: function (eventArgs, zoom) {
- // here the position reported to us by Katavorio is relative to the element's offsetParent. For top
- // level nodes that is fine, but if we have a nested draggable then its offsetParent is actually
- // not going to be the jsplumb container; it's going to be some child of that element. In that case
- // we want to adjust the UI position to account for the offsetParent's position relative to the Container
- // origin.
- var el = eventArgs[0].el;
- if (el.offsetParent == null) {
- return null;
- }
- var finalPos = eventArgs[0].finalPos || eventArgs[0].pos;
- var p = { left:finalPos[0], top:finalPos[1] };
- if (el._katavorioDrag && el.offsetParent !== this.getContainer()) {
- var oc = this.getOffset(el.offsetParent);
- p.left += oc.left;
- p.top += oc.top;
- }
- return p;
- },
- setDragFilter: function (el, filter, _exclude) {
- if (el._katavorioDrag) {
- el._katavorioDrag.setFilter(filter, _exclude);
- }
- },
- setElementDraggable: function (el, draggable) {
- el = _jp.getElement(el);
- if (el._katavorioDrag) {
- el._katavorioDrag.setEnabled(draggable);
- }
- },
- setDragScope: function (el, scope) {
- if (el._katavorioDrag) {
- el._katavorioDrag.k.setDragScope(el, scope);
- }
- },
- setDropScope:function(el, scope) {
- if (el._katavorioDrop && el._katavorioDrop.length > 0) {
- el._katavorioDrop[0].k.setDropScope(el, scope);
- }
- },
- addToPosse:function(el, spec) {
- var specs = Array.prototype.slice.call(arguments, 1);
- var dm = _getDragManager(this);
- _jp.each(el, function(_el) {
- _el = [ _jp.getElement(_el) ];
- _el.push.apply(_el, specs );
- dm.addToPosse.apply(dm, _el);
- });
- },
- setPosse:function(el, spec) {
- var specs = Array.prototype.slice.call(arguments, 1);
- var dm = _getDragManager(this);
- _jp.each(el, function(_el) {
- _el = [ _jp.getElement(_el) ];
- _el.push.apply(_el, specs );
- dm.setPosse.apply(dm, _el);
- });
- },
- removeFromPosse:function(el, posseId) {
- var specs = Array.prototype.slice.call(arguments, 1);
- var dm = _getDragManager(this);
- _jp.each(el, function(_el) {
- _el = [ _jp.getElement(_el) ];
- _el.push.apply(_el, specs );
- dm.removeFromPosse.apply(dm, _el);
- });
- },
- removeFromAllPosses:function(el) {
- var dm = _getDragManager(this);
- _jp.each(el, function(_el) { dm.removeFromAllPosses(_jp.getElement(_el)); });
- },
- setPosseState:function(el, posseId, state) {
- var dm = _getDragManager(this);
- _jp.each(el, function(_el) { dm.setPosseState(_jp.getElement(_el), posseId, state); });
- },
- dragEvents: {
- 'start': 'start', 'stop': 'stop', 'drag': 'drag', 'step': 'step',
- 'over': 'over', 'out': 'out', 'drop': 'drop', 'complete': 'complete',
- 'beforeStart':'beforeStart'
- },
- animEvents: {
- 'step': "step", 'complete': 'complete'
- },
- stopDrag: function (el) {
- if (el._katavorioDrag) {
- el._katavorioDrag.abort();
- }
- },
- addToDragSelection: function (spec) {
- _getDragManager(this).select(spec);
- },
- removeFromDragSelection: function (spec) {
- _getDragManager(this).deselect(spec);
- },
- clearDragSelection: function () {
- _getDragManager(this).deselectAll();
- },
- trigger: function (el, event, originalEvent, payload) {
- this.getEventManager().trigger(el, event, originalEvent, payload);
- },
- doReset:function() {
- // look for katavorio instances and reset each one if found.
- for (var key in this) {
- if (key.indexOf("_katavorio_") === 0) {
- this[key].reset();
- }
- }
- }
- });
-
- var ready = function (f) {
- var _do = function () {
- if (/complete|loaded|interactive/.test(document.readyState) && typeof(document.body) !== "undefined" && document.body != null) {
- f();
- }
- else {
- setTimeout(_do, 9);
- }
- };
-
- _do();
- };
- ready(_jp.init);
-
-}).call(typeof window !== 'undefined' ? window : this);
-
-
/***/ }),
/* 54 */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return factionInvitationBoxCreate; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_Faction_js__ = __webpack_require__(10);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__src_Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__HelperFunctions_js__ = __webpack_require__(2);
-
-
-
-
-/* Faction Invitation Pop-up box */
-function factionInvitationBoxClose() {
- var factionInvitationBox = document.getElementById("faction-invitation-box-container");
- factionInvitationBox.style.display = "none";
-}
-
-function factionInvitationBoxOpen() {
- var factionInvitationBox = document.getElementById("faction-invitation-box-container");
- factionInvitationBox.style.display = "block";
-}
-
-function factionInvitationSetText(txt) {
- var textBox = document.getElementById("faction-invitation-box-text");
- textBox.innerHTML = txt;
-}
-
-function factionInvitationSetMessage(msg) {
- var msgBox = document.getElementById("faction-invitation-box-message");
- msgBox.innerHTML = msg;
-}
-
-//ram argument is in GB
-function factionInvitationBoxCreate(faction) {
- factionInvitationSetText("You have received a faction invitation from " + faction.name);
- //TODO Faction invitation message
-
- var newYesButton = Object(__WEBPACK_IMPORTED_MODULE_2__HelperFunctions_js__["b" /* clearEventListeners */])("faction-invitation-box-yes");
- newYesButton.addEventListener("click", function() {
- Object(__WEBPACK_IMPORTED_MODULE_0__src_Faction_js__["h" /* joinFaction */])(faction);
- factionInvitationBoxClose();
- return false;
- });
-
- var noButton = Object(__WEBPACK_IMPORTED_MODULE_2__HelperFunctions_js__["b" /* clearEventListeners */])("faction-invitation-box-no");
- noButton.addEventListener("click", function() {
- factionInvitationBoxClose();
- faction.alreadyInvited = true;
- __WEBPACK_IMPORTED_MODULE_1__src_Player_js__["a" /* Player */].factionInvitations.push(faction.name);
- return false;
- });
-
- factionInvitationBoxOpen();
-}
-
-
-
-
-/***/ }),
-/* 55 */
/***/ (function(module, exports, __webpack_require__) {
/* ***** BEGIN LICENSE BLOCK *****
@@ -79252,7 +68444,7 @@ var WorkerClient = function(topLevelNamespaces, mod, classname, workerUrl) {
try {
var workerSrc = mod.src;
- var Blob = __webpack_require__(56);
+ var Blob = __webpack_require__(55);
var blob = new Blob([ workerSrc ], { type: 'application/javascript' });
var blobUrl = (window.URL || window.webkitURL).createObjectURL(blob);
@@ -81533,7 +70725,7 @@ exports.version = "1.2.6";
module.exports = window.ace.acequire("ace/ace");
/***/ }),
-/* 56 */
+/* 55 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(global) {module.exports = get_blob()
@@ -81568,7 +70760,7 @@ function get_blob() {
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(33)))
/***/ }),
-/* 57 */
+/* 56 */
/***/ (function(module, exports, __webpack_require__) {
ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(acequire, exports, module) {
@@ -82356,7 +71548,7 @@ exports.Mode = Mode;
/***/ }),
-/* 58 */
+/* 57 */
/***/ (function(module, exports, __webpack_require__) {
ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(acequire, exports, module) {
@@ -83166,7 +72358,7 @@ exports.Mode = Mode;
/***/ }),
-/* 59 */
+/* 58 */
/***/ (function(module, exports) {
ace.define("ace/theme/chaos",["require","exports","module","ace/lib/dom"], function(acequire, exports, module) {
@@ -83328,7 +72520,7 @@ dom.importCssString(exports.cssText, exports.cssClass);
/***/ }),
-/* 60 */
+/* 59 */
/***/ (function(module, exports) {
ace.define("ace/theme/chrome",["require","exports","module","ace/lib/dom"], function(acequire, exports, module) {
@@ -83462,7 +72654,7 @@ dom.importCssString(exports.cssText, exports.cssClass);
/***/ }),
-/* 61 */
+/* 60 */
/***/ (function(module, exports) {
ace.define("ace/theme/monokai",["require","exports","module","ace/lib/dom"], function(acequire, exports, module) {
@@ -83573,7 +72765,7 @@ dom.importCssString(exports.cssText, exports.cssClass);
/***/ }),
-/* 62 */
+/* 61 */
/***/ (function(module, exports) {
ace.define("ace/theme/solarized_dark",["require","exports","module","ace/lib/dom"], function(acequire, exports, module) {
@@ -83667,7 +72859,7 @@ dom.importCssString(exports.cssText, exports.cssClass);
/***/ }),
-/* 63 */
+/* 62 */
/***/ (function(module, exports) {
ace.define("ace/theme/solarized_light",["require","exports","module","ace/lib/dom"], function(acequire, exports, module) {
@@ -83764,7 +72956,7 @@ dom.importCssString(exports.cssText, exports.cssClass);
/***/ }),
-/* 64 */
+/* 63 */
/***/ (function(module, exports) {
ace.define("ace/theme/terminal",["require","exports","module","ace/lib/dom"], function(acequire, exports, module) {
@@ -83884,7 +73076,7 @@ dom.importCssString(exports.cssText, exports.cssClass);
/***/ }),
-/* 65 */
+/* 64 */
/***/ (function(module, exports) {
ace.define("ace/theme/twilight",["require","exports","module","ace/lib/dom"], function(acequire, exports, module) {
@@ -83999,7 +73191,7 @@ dom.importCssString(exports.cssText, exports.cssClass);
/***/ }),
-/* 66 */
+/* 65 */
/***/ (function(module, exports) {
ace.define("ace/theme/xcode",["require","exports","module","ace/lib/dom"], function(acequire, exports, module) {
@@ -84093,7 +73285,7 @@ dom.importCssString(exports.cssText, exports.cssClass);
/***/ }),
-/* 67 */
+/* 66 */
/***/ (function(module, exports) {
ace.define("ace/keyboard/vim",["require","exports","module","ace/range","ace/lib/event_emitter","ace/lib/dom","ace/lib/oop","ace/lib/keys","ace/lib/event","ace/search","ace/lib/useragent","ace/search_highlight","ace/commands/multi_select_commands","ace/mode/text","ace/multi_select"], function(acequire, exports, module) {
@@ -89692,7 +78884,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
/***/ }),
-/* 68 */
+/* 67 */
/***/ (function(module, exports) {
ace.define("ace/occur",["require","exports","module","ace/lib/oop","ace/range","ace/search","ace/edit_session","ace/search_highlight","ace/lib/dom"], function(acequire, exports, module) {
@@ -90879,7 +80071,7 @@ exports.killRing = {
/***/ }),
-/* 69 */
+/* 68 */
/***/ (function(module, exports) {
ace.define("ace/snippets",["require","exports","module","ace/lib/oop","ace/lib/event_emitter","ace/lib/lang","ace/range","ace/anchor","ace/keyboard/hash_handler","ace/tokenizer","ace/lib/dom","ace/editor"], function(acequire, exports, module) {
@@ -92830,88 +82022,7 @@ acequire("../config").defineOptions(Editor.prototype, "editor", {
/***/ }),
-/* 70 */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return purchaseServer; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return purchaseRamForHomeComputer; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Constants_js__ = __webpack_require__(3);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Server_js__ = __webpack_require__(6);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__ = __webpack_require__(1);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_IPAddress_js__ = __webpack_require__(17);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_YesNoBox_js__ = __webpack_require__(22);
-
-
-
-
-
-
-
-
-/* Functions to handle any server-related purchasing:
- * Purchasing new servers
- * Purchasing more RAM for home computer
- */
-function purchaseServer(ram, cost) {
- //Check if player has enough money
- if (__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.lt(cost)) {
- Object(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You don't have enough money to purchase this server!");
- return;
- }
-
- //Maximum server limit
- if (__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].purchasedServers.length >= __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].PurchasedServerLimit) {
- Object(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You have reached the maximum limit of " + __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].PurchasedServerLimit + " servers. " +
- "You cannot purchase any more. You can " +
- "delete some of your purchased servers using the deleteServer() Netscript function in a script");
- return;
- }
-
- var hostname = Object(__WEBPACK_IMPORTED_MODULE_5__utils_YesNoBox_js__["h" /* yesNoTxtInpBoxGetInput */])();
- if (hostname == "") {
- Object(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You must enter a hostname for your new server!");
- return;
- }
-
- //Create server
- var newServ = new __WEBPACK_IMPORTED_MODULE_2__Server_js__["d" /* Server */](Object(__WEBPACK_IMPORTED_MODULE_4__utils_IPAddress_js__["a" /* createRandomIp */])(), hostname, "", false, true, true, ram);
- Object(__WEBPACK_IMPORTED_MODULE_2__Server_js__["a" /* AddToAllServers */])(newServ);
-
- //Add to Player's purchasedServers array
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].purchasedServers.push(newServ.ip);
-
- //Connect new server to home computer
- var homeComputer = __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer();
- homeComputer.serversOnNetwork.push(newServ.ip);
- newServ.serversOnNetwork.push(homeComputer.ip);
-
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(cost);
-
- Object(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Server successfully purchased with hostname " + hostname);
-}
-
-
-function purchaseRamForHomeComputer(cost) {
- if (__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.lt(cost)) {
- Object(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You do not have enough money to purchase additional RAM for your home computer");
- return;
- }
-
- var homeComputer = __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer();
- homeComputer.maxRam *= 2;
-
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(cost);
-
- Object(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Purchased additional RAM for home computer! It now has " + homeComputer.maxRam + "GB of RAM.");
-}
-
-
-
-
-/***/ }),
-/* 71 */
+/* 69 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -93130,7 +82241,14564 @@ let HelpTexts = {
/***/ }),
-/* 72 */
+/* 70 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * jsBezier
+ *
+ * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
+ *
+ * licensed under the MIT license.
+ *
+ * a set of Bezier curve functions that deal with Beziers, used by jsPlumb, and perhaps useful for other people. These functions work with Bezier
+ * curves of arbitrary degree.
+ *
+ * - functions are all in the 'jsBezier' namespace.
+ *
+ * - all input points should be in the format {x:.., y:..}. all output points are in this format too.
+ *
+ * - all input curves should be in the format [ {x:.., y:..}, {x:.., y:..}, {x:.., y:..}, {x:.., y:..} ]
+ *
+ * - 'location' as used as an input here refers to a decimal in the range 0-1 inclusive, which indicates a point some proportion along the length
+ * of the curve. location as output has the same format and meaning.
+ *
+ *
+ * Function List:
+ * --------------
+ *
+ * distanceFromCurve(point, curve)
+ *
+ * Calculates the distance that the given point lies from the given Bezier. Note that it is computed relative to the center of the Bezier,
+ * so if you have stroked the curve with a wide pen you may wish to take that into account! The distance returned is relative to the values
+ * of the curve and the point - it will most likely be pixels.
+ *
+ * gradientAtPoint(curve, location)
+ *
+ * Calculates the gradient to the curve at the given location, as a decimal between 0 and 1 inclusive.
+ *
+ * gradientAtPointAlongCurveFrom (curve, location)
+ *
+ * Calculates the gradient at the point on the given curve that is 'distance' units from location.
+ *
+ * nearestPointOnCurve(point, curve)
+ *
+ * Calculates the nearest point to the given point on the given curve. The return value of this is a JS object literal, containing both the
+ *point's coordinates and also the 'location' of the point (see above), for example: { point:{x:551,y:150}, location:0.263365 }.
+ *
+ * pointOnCurve(curve, location)
+ *
+ * Calculates the coordinates of the point on the given Bezier curve at the given location.
+ *
+ * pointAlongCurveFrom(curve, location, distance)
+ *
+ * Calculates the coordinates of the point on the given curve that is 'distance' units from location. 'distance' should be in the same coordinate
+ * space as that used to construct the Bezier curve. For an HTML Canvas usage, for example, distance would be a measure of pixels.
+ *
+ * locationAlongCurveFrom(curve, location, distance)
+ *
+ * Calculates the location on the given curve that is 'distance' units from location. 'distance' should be in the same coordinate
+ * space as that used to construct the Bezier curve. For an HTML Canvas usage, for example, distance would be a measure of pixels.
+ *
+ * perpendicularToCurveAt(curve, location, length, distance)
+ *
+ * Calculates the perpendicular to the given curve at the given location. length is the length of the line you wish for (it will be centered
+ * on the point at 'location'). distance is optional, and allows you to specify a point along the path from the given location as the center of
+ * the perpendicular returned. The return value of this is an array of two points: [ {x:...,y:...}, {x:...,y:...} ].
+ *
+ *
+ */
+
+(function() {
+
+ var root = this;
+
+ if(typeof Math.sgn == "undefined") {
+ Math.sgn = function(x) { return x == 0 ? 0 : x > 0 ? 1 :-1; };
+ }
+
+ var Vectors = {
+ subtract : function(v1, v2) { return {x:v1.x - v2.x, y:v1.y - v2.y }; },
+ dotProduct : function(v1, v2) { return (v1.x * v2.x) + (v1.y * v2.y); },
+ square : function(v) { return Math.sqrt((v.x * v.x) + (v.y * v.y)); },
+ scale : function(v, s) { return {x:v.x * s, y:v.y * s }; }
+ },
+
+ maxRecursion = 64,
+ flatnessTolerance = Math.pow(2.0,-maxRecursion-1);
+
+ /**
+ * Calculates the distance that the point lies from the curve.
+ *
+ * @param point a point in the form {x:567, y:3342}
+ * @param curve a Bezier curve in the form [{x:..., y:...}, {x:..., y:...}, {x:..., y:...}, {x:..., y:...}]. note that this is currently
+ * hardcoded to assume cubiz beziers, but would be better off supporting any degree.
+ * @return a JS object literal containing location and distance, for example: {location:0.35, distance:10}. Location is analogous to the location
+ * argument you pass to the pointOnPath function: it is a ratio of distance travelled along the curve. Distance is the distance in pixels from
+ * the point to the curve.
+ */
+ var _distanceFromCurve = function(point, curve) {
+ var candidates = [],
+ w = _convertToBezier(point, curve),
+ degree = curve.length - 1, higherDegree = (2 * degree) - 1,
+ numSolutions = _findRoots(w, higherDegree, candidates, 0),
+ v = Vectors.subtract(point, curve[0]), dist = Vectors.square(v), t = 0.0;
+
+ for (var i = 0; i < numSolutions; i++) {
+ v = Vectors.subtract(point, _bezier(curve, degree, candidates[i], null, null));
+ var newDist = Vectors.square(v);
+ if (newDist < dist) {
+ dist = newDist;
+ t = candidates[i];
+ }
+ }
+ v = Vectors.subtract(point, curve[degree]);
+ newDist = Vectors.square(v);
+ if (newDist < dist) {
+ dist = newDist;
+ t = 1.0;
+ }
+ return {location:t, distance:dist};
+ };
+ /**
+ * finds the nearest point on the curve to the given point.
+ */
+ var _nearestPointOnCurve = function(point, curve) {
+ var td = _distanceFromCurve(point, curve);
+ return {point:_bezier(curve, curve.length - 1, td.location, null, null), location:td.location};
+ };
+ var _convertToBezier = function(point, curve) {
+ var degree = curve.length - 1, higherDegree = (2 * degree) - 1,
+ c = [], d = [], cdTable = [], w = [],
+ z = [ [1.0, 0.6, 0.3, 0.1], [0.4, 0.6, 0.6, 0.4], [0.1, 0.3, 0.6, 1.0] ];
+
+ for (var i = 0; i <= degree; i++) c[i] = Vectors.subtract(curve[i], point);
+ for (var i = 0; i <= degree - 1; i++) {
+ d[i] = Vectors.subtract(curve[i+1], curve[i]);
+ d[i] = Vectors.scale(d[i], 3.0);
+ }
+ for (var row = 0; row <= degree - 1; row++) {
+ for (var column = 0; column <= degree; column++) {
+ if (!cdTable[row]) cdTable[row] = [];
+ cdTable[row][column] = Vectors.dotProduct(d[row], c[column]);
+ }
+ }
+ for (i = 0; i <= higherDegree; i++) {
+ if (!w[i]) w[i] = [];
+ w[i].y = 0.0;
+ w[i].x = parseFloat(i) / higherDegree;
+ }
+ var n = degree, m = degree-1;
+ for (var k = 0; k <= n + m; k++) {
+ var lb = Math.max(0, k - m),
+ ub = Math.min(k, n);
+ for (i = lb; i <= ub; i++) {
+ j = k - i;
+ w[i+j].y += cdTable[j][i] * z[j][i];
+ }
+ }
+ return w;
+ };
+ /**
+ * counts how many roots there are.
+ */
+ var _findRoots = function(w, degree, t, depth) {
+ var left = [], right = [],
+ left_count, right_count,
+ left_t = [], right_t = [];
+
+ switch (_getCrossingCount(w, degree)) {
+ case 0 : {
+ return 0;
+ }
+ case 1 : {
+ if (depth >= maxRecursion) {
+ t[0] = (w[0].x + w[degree].x) / 2.0;
+ return 1;
+ }
+ if (_isFlatEnough(w, degree)) {
+ t[0] = _computeXIntercept(w, degree);
+ return 1;
+ }
+ break;
+ }
+ }
+ _bezier(w, degree, 0.5, left, right);
+ left_count = _findRoots(left, degree, left_t, depth+1);
+ right_count = _findRoots(right, degree, right_t, depth+1);
+ for (var i = 0; i < left_count; i++) t[i] = left_t[i];
+ for (var i = 0; i < right_count; i++) t[i+left_count] = right_t[i];
+ return (left_count+right_count);
+ };
+ var _getCrossingCount = function(curve, degree) {
+ var n_crossings = 0, sign, old_sign;
+ sign = old_sign = Math.sgn(curve[0].y);
+ for (var i = 1; i <= degree; i++) {
+ sign = Math.sgn(curve[i].y);
+ if (sign != old_sign) n_crossings++;
+ old_sign = sign;
+ }
+ return n_crossings;
+ };
+ var _isFlatEnough = function(curve, degree) {
+ var error,
+ intercept_1, intercept_2, left_intercept, right_intercept,
+ a, b, c, det, dInv, a1, b1, c1, a2, b2, c2;
+ a = curve[0].y - curve[degree].y;
+ b = curve[degree].x - curve[0].x;
+ c = curve[0].x * curve[degree].y - curve[degree].x * curve[0].y;
+
+ var max_distance_above = max_distance_below = 0.0;
+
+ for (var i = 1; i < degree; i++) {
+ var value = a * curve[i].x + b * curve[i].y + c;
+ if (value > max_distance_above)
+ max_distance_above = value;
+ else if (value < max_distance_below)
+ max_distance_below = value;
+ }
+
+ a1 = 0.0; b1 = 1.0; c1 = 0.0; a2 = a; b2 = b;
+ c2 = c - max_distance_above;
+ det = a1 * b2 - a2 * b1;
+ dInv = 1.0/det;
+ intercept_1 = (b1 * c2 - b2 * c1) * dInv;
+ a2 = a; b2 = b; c2 = c - max_distance_below;
+ det = a1 * b2 - a2 * b1;
+ dInv = 1.0/det;
+ intercept_2 = (b1 * c2 - b2 * c1) * dInv;
+ left_intercept = Math.min(intercept_1, intercept_2);
+ right_intercept = Math.max(intercept_1, intercept_2);
+ error = right_intercept - left_intercept;
+ return (error < flatnessTolerance)? 1 : 0;
+ };
+ var _computeXIntercept = function(curve, degree) {
+ var XLK = 1.0, YLK = 0.0,
+ XNM = curve[degree].x - curve[0].x, YNM = curve[degree].y - curve[0].y,
+ XMK = curve[0].x - 0.0, YMK = curve[0].y - 0.0,
+ det = XNM*YLK - YNM*XLK, detInv = 1.0/det,
+ S = (XNM*YMK - YNM*XMK) * detInv;
+ return 0.0 + XLK * S;
+ };
+ var _bezier = function(curve, degree, t, left, right) {
+ var temp = [[]];
+ for (var j =0; j <= degree; j++) temp[0][j] = curve[j];
+ for (var i = 1; i <= degree; i++) {
+ for (var j =0 ; j <= degree - i; j++) {
+ if (!temp[i]) temp[i] = [];
+ if (!temp[i][j]) temp[i][j] = {};
+ temp[i][j].x = (1.0 - t) * temp[i-1][j].x + t * temp[i-1][j+1].x;
+ temp[i][j].y = (1.0 - t) * temp[i-1][j].y + t * temp[i-1][j+1].y;
+ }
+ }
+ if (left != null)
+ for (j = 0; j <= degree; j++) left[j] = temp[j][0];
+ if (right != null)
+ for (j = 0; j <= degree; j++) right[j] = temp[degree-j][j];
+
+ return (temp[degree][0]);
+ };
+
+ var _curveFunctionCache = {};
+ var _getCurveFunctions = function(order) {
+ var fns = _curveFunctionCache[order];
+ if (!fns) {
+ fns = [];
+ var f_term = function() { return function(t) { return Math.pow(t, order); }; },
+ l_term = function() { return function(t) { return Math.pow((1-t), order); }; },
+ c_term = function(c) { return function(t) { return c; }; },
+ t_term = function() { return function(t) { return t; }; },
+ one_minus_t_term = function() { return function(t) { return 1-t; }; },
+ _termFunc = function(terms) {
+ return function(t) {
+ var p = 1;
+ for (var i = 0; i < terms.length; i++) p = p * terms[i](t);
+ return p;
+ };
+ };
+
+ fns.push(new f_term()); // first is t to the power of the curve order
+ for (var i = 1; i < order; i++) {
+ var terms = [new c_term(order)];
+ for (var j = 0 ; j < (order - i); j++) terms.push(new t_term());
+ for (var j = 0 ; j < i; j++) terms.push(new one_minus_t_term());
+ fns.push(new _termFunc(terms));
+ }
+ fns.push(new l_term()); // last is (1-t) to the power of the curve order
+
+ _curveFunctionCache[order] = fns;
+ }
+
+ return fns;
+ };
+
+
+ /**
+ * calculates a point on the curve, for a Bezier of arbitrary order.
+ * @param curve an array of control points, eg [{x:10,y:20}, {x:50,y:50}, {x:100,y:100}, {x:120,y:100}]. For a cubic bezier this should have four points.
+ * @param location a decimal indicating the distance along the curve the point should be located at. this is the distance along the curve as it travels, taking the way it bends into account. should be a number from 0 to 1, inclusive.
+ */
+ var _pointOnPath = function(curve, location) {
+ var cc = _getCurveFunctions(curve.length - 1),
+ _x = 0, _y = 0;
+ for (var i = 0; i < curve.length ; i++) {
+ _x = _x + (curve[i].x * cc[i](location));
+ _y = _y + (curve[i].y * cc[i](location));
+ }
+
+ return {x:_x, y:_y};
+ };
+
+ var _dist = function(p1,p2) {
+ return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2));
+ };
+
+ var _isPoint = function(curve) {
+ return curve[0].x == curve[1].x && curve[0].y == curve[1].y;
+ };
+
+ /**
+ * finds the point that is 'distance' along the path from 'location'. this method returns both the x,y location of the point and also
+ * its 'location' (proportion of travel along the path); the method below - _pointAlongPathFrom - calls this method and just returns the
+ * point.
+ */
+ var _pointAlongPath = function(curve, location, distance) {
+
+ if (_isPoint(curve)) {
+ return {
+ point:curve[0],
+ location:location
+ };
+ }
+
+ var prev = _pointOnPath(curve, location),
+ tally = 0,
+ curLoc = location,
+ direction = distance > 0 ? 1 : -1,
+ cur = null;
+
+ while (tally < Math.abs(distance)) {
+ curLoc += (0.005 * direction);
+ cur = _pointOnPath(curve, curLoc);
+ tally += _dist(cur, prev);
+ prev = cur;
+ }
+ return {point:cur, location:curLoc};
+ };
+
+ var _length = function(curve) {
+ if (_isPoint(curve)) return 0;
+
+ var prev = _pointOnPath(curve, 0),
+ tally = 0,
+ curLoc = 0,
+ direction = 1,
+ cur = null;
+
+ while (curLoc < 1) {
+ curLoc += (0.005 * direction);
+ cur = _pointOnPath(curve, curLoc);
+ tally += _dist(cur, prev);
+ prev = cur;
+ }
+ return tally;
+ };
+
+ /**
+ * finds the point that is 'distance' along the path from 'location'.
+ */
+ var _pointAlongPathFrom = function(curve, location, distance) {
+ return _pointAlongPath(curve, location, distance).point;
+ };
+
+ /**
+ * finds the location that is 'distance' along the path from 'location'.
+ */
+ var _locationAlongPathFrom = function(curve, location, distance) {
+ return _pointAlongPath(curve, location, distance).location;
+ };
+
+ /**
+ * returns the gradient of the curve at the given location, which is a decimal between 0 and 1 inclusive.
+ *
+ * thanks // http://bimixual.org/AnimationLibrary/beziertangents.html
+ */
+ var _gradientAtPoint = function(curve, location) {
+ var p1 = _pointOnPath(curve, location),
+ p2 = _pointOnPath(curve.slice(0, curve.length - 1), location),
+ dy = p2.y - p1.y, dx = p2.x - p1.x;
+ return dy == 0 ? Infinity : Math.atan(dy / dx);
+ };
+
+ /**
+ returns the gradient of the curve at the point which is 'distance' from the given location.
+ if this point is greater than location 1, the gradient at location 1 is returned.
+ if this point is less than location 0, the gradient at location 0 is returned.
+ */
+ var _gradientAtPointAlongPathFrom = function(curve, location, distance) {
+ var p = _pointAlongPath(curve, location, distance);
+ if (p.location > 1) p.location = 1;
+ if (p.location < 0) p.location = 0;
+ return _gradientAtPoint(curve, p.location);
+ };
+
+ /**
+ * calculates a line that is 'length' pixels long, perpendicular to, and centered on, the path at 'distance' pixels from the given location.
+ * if distance is not supplied, the perpendicular for the given location is computed (ie. we set distance to zero).
+ */
+ var _perpendicularToPathAt = function(curve, location, length, distance) {
+ distance = distance == null ? 0 : distance;
+ var p = _pointAlongPath(curve, location, distance),
+ m = _gradientAtPoint(curve, p.location),
+ _theta2 = Math.atan(-1 / m),
+ y = length / 2 * Math.sin(_theta2),
+ x = length / 2 * Math.cos(_theta2);
+ return [{x:p.point.x + x, y:p.point.y + y}, {x:p.point.x - x, y:p.point.y - y}];
+ };
+
+ var jsBezier = this.jsBezier = {
+ distanceFromCurve : _distanceFromCurve,
+ gradientAtPoint : _gradientAtPoint,
+ gradientAtPointAlongCurveFrom : _gradientAtPointAlongPathFrom,
+ nearestPointOnCurve : _nearestPointOnCurve,
+ pointOnCurve : _pointOnPath,
+ pointAlongCurveFrom : _pointAlongPathFrom,
+ perpendicularToCurveAt : _perpendicularToPathAt,
+ locationAlongCurveFrom:_locationAlongPathFrom,
+ getLength:_length,
+ version:"0.9.0"
+ };
+
+ if (true) {
+ exports.jsBezier = jsBezier;
+ }
+
+}).call(typeof window !== 'undefined' ? window : this);
+
+/**
+ * Biltong v0.4.0
+ *
+ * Various geometry functions written as part of jsPlumb and perhaps useful for others.
+ *
+ * Copyright (c) 2017 jsPlumb
+ * https://jsplumbtoolkit.com
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+;(function() {
+
+ "use strict";
+ var root = this;
+
+ var Biltong = root.Biltong = {
+ version:"0.4.0"
+ };
+
+ if (true) {
+ exports.Biltong = Biltong;
+ }
+
+ var _isa = function(a) { return Object.prototype.toString.call(a) === "[object Array]"; },
+ _pointHelper = function(p1, p2, fn) {
+ p1 = _isa(p1) ? p1 : [p1.x, p1.y];
+ p2 = _isa(p2) ? p2 : [p2.x, p2.y];
+ return fn(p1, p2);
+ },
+ /**
+ * @name Biltong.gradient
+ * @function
+ * @desc Calculates the gradient of a line between the two points.
+ * @param {Point} p1 First point, either as a 2 entry array or object with `left` and `top` properties.
+ * @param {Point} p2 Second point, either as a 2 entry array or object with `left` and `top` properties.
+ * @return {Float} The gradient of a line between the two points.
+ */
+ _gradient = Biltong.gradient = function(p1, p2) {
+ return _pointHelper(p1, p2, function(_p1, _p2) {
+ if (_p2[0] == _p1[0])
+ return _p2[1] > _p1[1] ? Infinity : -Infinity;
+ else if (_p2[1] == _p1[1])
+ return _p2[0] > _p1[0] ? 0 : -0;
+ else
+ return (_p2[1] - _p1[1]) / (_p2[0] - _p1[0]);
+ });
+ },
+ /**
+ * @name Biltong.normal
+ * @function
+ * @desc Calculates the gradient of a normal to a line between the two points.
+ * @param {Point} p1 First point, either as a 2 entry array or object with `left` and `top` properties.
+ * @param {Point} p2 Second point, either as a 2 entry array or object with `left` and `top` properties.
+ * @return {Float} The gradient of a normal to a line between the two points.
+ */
+ _normal = Biltong.normal = function(p1, p2) {
+ return -1 / _gradient(p1, p2);
+ },
+ /**
+ * @name Biltong.lineLength
+ * @function
+ * @desc Calculates the length of a line between the two points.
+ * @param {Point} p1 First point, either as a 2 entry array or object with `left` and `top` properties.
+ * @param {Point} p2 Second point, either as a 2 entry array or object with `left` and `top` properties.
+ * @return {Float} The length of a line between the two points.
+ */
+ _lineLength = Biltong.lineLength = function(p1, p2) {
+ return _pointHelper(p1, p2, function(_p1, _p2) {
+ return Math.sqrt(Math.pow(_p2[1] - _p1[1], 2) + Math.pow(_p2[0] - _p1[0], 2));
+ });
+ },
+ /**
+ * @name Biltong.quadrant
+ * @function
+ * @desc Calculates the quadrant in which the angle between the two points lies.
+ * @param {Point} p1 First point, either as a 2 entry array or object with `left` and `top` properties.
+ * @param {Point} p2 Second point, either as a 2 entry array or object with `left` and `top` properties.
+ * @return {Integer} The quadrant - 1 for upper right, 2 for lower right, 3 for lower left, 4 for upper left.
+ */
+ _quadrant = Biltong.quadrant = function(p1, p2) {
+ return _pointHelper(p1, p2, function(_p1, _p2) {
+ if (_p2[0] > _p1[0]) {
+ return (_p2[1] > _p1[1]) ? 2 : 1;
+ }
+ else if (_p2[0] == _p1[0]) {
+ return _p2[1] > _p1[1] ? 2 : 1;
+ }
+ else {
+ return (_p2[1] > _p1[1]) ? 3 : 4;
+ }
+ });
+ },
+ /**
+ * @name Biltong.theta
+ * @function
+ * @desc Calculates the angle between the two points.
+ * @param {Point} p1 First point, either as a 2 entry array or object with `left` and `top` properties.
+ * @param {Point} p2 Second point, either as a 2 entry array or object with `left` and `top` properties.
+ * @return {Float} The angle between the two points.
+ */
+ _theta = Biltong.theta = function(p1, p2) {
+ return _pointHelper(p1, p2, function(_p1, _p2) {
+ var m = _gradient(_p1, _p2),
+ t = Math.atan(m),
+ s = _quadrant(_p1, _p2);
+ if ((s == 4 || s== 3)) t += Math.PI;
+ if (t < 0) t += (2 * Math.PI);
+
+ return t;
+ });
+ },
+ /**
+ * @name Biltong.intersects
+ * @function
+ * @desc Calculates whether or not the two rectangles intersect.
+ * @param {Rectangle} r1 First rectangle, as a js object in the form `{x:.., y:.., w:.., h:..}`
+ * @param {Rectangle} r2 Second rectangle, as a js object in the form `{x:.., y:.., w:.., h:..}`
+ * @return {Boolean} True if the rectangles intersect, false otherwise.
+ */
+ _intersects = Biltong.intersects = function(r1, r2) {
+ var x1 = r1.x, x2 = r1.x + r1.w, y1 = r1.y, y2 = r1.y + r1.h,
+ a1 = r2.x, a2 = r2.x + r2.w, b1 = r2.y, b2 = r2.y + r2.h;
+
+ return ( (x1 <= a1 && a1 <= x2) && (y1 <= b1 && b1 <= y2) ) ||
+ ( (x1 <= a2 && a2 <= x2) && (y1 <= b1 && b1 <= y2) ) ||
+ ( (x1 <= a1 && a1 <= x2) && (y1 <= b2 && b2 <= y2) ) ||
+ ( (x1 <= a2 && a1 <= x2) && (y1 <= b2 && b2 <= y2) ) ||
+ ( (a1 <= x1 && x1 <= a2) && (b1 <= y1 && y1 <= b2) ) ||
+ ( (a1 <= x2 && x2 <= a2) && (b1 <= y1 && y1 <= b2) ) ||
+ ( (a1 <= x1 && x1 <= a2) && (b1 <= y2 && y2 <= b2) ) ||
+ ( (a1 <= x2 && x1 <= a2) && (b1 <= y2 && y2 <= b2) );
+ },
+ /**
+ * @name Biltong.encloses
+ * @function
+ * @desc Calculates whether or not r2 is completely enclosed by r1.
+ * @param {Rectangle} r1 First rectangle, as a js object in the form `{x:.., y:.., w:.., h:..}`
+ * @param {Rectangle} r2 Second rectangle, as a js object in the form `{x:.., y:.., w:.., h:..}`
+ * @param {Boolean} [allowSharedEdges=false] If true, the concept of enclosure allows for one or more edges to be shared by the two rectangles.
+ * @return {Boolean} True if r1 encloses r2, false otherwise.
+ */
+ _encloses = Biltong.encloses = function(r1, r2, allowSharedEdges) {
+ var x1 = r1.x, x2 = r1.x + r1.w, y1 = r1.y, y2 = r1.y + r1.h,
+ a1 = r2.x, a2 = r2.x + r2.w, b1 = r2.y, b2 = r2.y + r2.h,
+ c = function(v1, v2, v3, v4) { return allowSharedEdges ? v1 <= v2 && v3>= v4 : v1 < v2 && v3 > v4; };
+
+ return c(x1,a1,x2,a2) && c(y1,b1,y2,b2);
+ },
+ _segmentMultipliers = [null, [1, -1], [1, 1], [-1, 1], [-1, -1] ],
+ _inverseSegmentMultipliers = [null, [-1, -1], [-1, 1], [1, 1], [1, -1] ],
+ /**
+ * @name Biltong.pointOnLine
+ * @function
+ * @desc Calculates a point on the line from `fromPoint` to `toPoint` that is `distance` units along the length of the line.
+ * @param {Point} p1 First point, either as a 2 entry array or object with `left` and `top` properties.
+ * @param {Point} p2 Second point, either as a 2 entry array or object with `left` and `top` properties.
+ * @return {Point} Point on the line, in the form `{ x:..., y:... }`.
+ */
+ _pointOnLine = Biltong.pointOnLine = function(fromPoint, toPoint, distance) {
+ var m = _gradient(fromPoint, toPoint),
+ s = _quadrant(fromPoint, toPoint),
+ segmentMultiplier = distance > 0 ? _segmentMultipliers[s] : _inverseSegmentMultipliers[s],
+ theta = Math.atan(m),
+ y = Math.abs(distance * Math.sin(theta)) * segmentMultiplier[1],
+ x = Math.abs(distance * Math.cos(theta)) * segmentMultiplier[0];
+ return { x:fromPoint.x + x, y:fromPoint.y + y };
+ },
+ /**
+ * @name Biltong.perpendicularLineTo
+ * @function
+ * @desc Calculates a line of length `length` that is perpendicular to the line from `fromPoint` to `toPoint` and passes through `toPoint`.
+ * @param {Point} p1 First point, either as a 2 entry array or object with `left` and `top` properties.
+ * @param {Point} p2 Second point, either as a 2 entry array or object with `left` and `top` properties.
+ * @return {Line} Perpendicular line, in the form `[ { x:..., y:... }, { x:..., y:... } ]`.
+ */
+ _perpendicularLineTo = Biltong.perpendicularLineTo = function(fromPoint, toPoint, length) {
+ var m = _gradient(fromPoint, toPoint),
+ theta2 = Math.atan(-1 / m),
+ y = length / 2 * Math.sin(theta2),
+ x = length / 2 * Math.cos(theta2);
+ return [{x:toPoint.x + x, y:toPoint.y + y}, {x:toPoint.x - x, y:toPoint.y - y}];
+ };
+}).call(typeof window !== 'undefined' ? window : this);
+;
+(function () {
+
+ "use strict";
+
+ var root = this,
+ Sniff = {
+ android: navigator.userAgent.toLowerCase().indexOf("android") > -1
+ },
+ matchesSelector = function (el, selector, ctx) {
+ ctx = ctx || el.parentNode;
+ var possibles = ctx.querySelectorAll(selector);
+ for (var i = 0; i < possibles.length; i++) {
+ if (possibles[i] === el) {
+ return true;
+ }
+ }
+ return false;
+ },
+ _gel = function (el) {
+ return (typeof el == "string" || el.constructor === String) ? document.getElementById(el) : el;
+ },
+ _t = function (e) {
+ return e.srcElement || e.target;
+ },
+ //
+ // gets path info for the given event - the path from target to obj, in the event's bubble chain. if doCompute
+ // is false we just return target for the path.
+ //
+ _pi = function(e, target, obj, doCompute) {
+ if (!doCompute) return { path:[target], end:1 };
+ else if (typeof e.path !== "undefined" && e.path.indexOf) {
+ return { path: e.path, end: e.path.indexOf(obj) };
+ } else {
+ var out = { path:[], end:-1 }, _one = function(el) {
+ out.path.push(el);
+ if (el === obj) {
+ out.end = out.path.length - 1;
+ }
+ else if (el.parentNode != null) {
+ _one(el.parentNode)
+ }
+ };
+ _one(target);
+ return out;
+ }
+ },
+ _d = function (l, fn) {
+ for (var i = 0, j = l.length; i < j; i++) {
+ if (l[i] == fn) break;
+ }
+ if (i < l.length) l.splice(i, 1);
+ },
+ guid = 1,
+ //
+ // this function generates a guid for every handler, sets it on the handler, then adds
+ // it to the associated object's map of handlers for the given event. this is what enables us
+ // to unbind all events of some type, or all events (the second of which can be requested by the user,
+ // but it also used by Mottle when an element is removed.)
+ _store = function (obj, event, fn) {
+ var g = guid++;
+ obj.__ta = obj.__ta || {};
+ obj.__ta[event] = obj.__ta[event] || {};
+ // store each handler with a unique guid.
+ obj.__ta[event][g] = fn;
+ // set the guid on the handler.
+ fn.__tauid = g;
+ return g;
+ },
+ _unstore = function (obj, event, fn) {
+ obj.__ta && obj.__ta[event] && delete obj.__ta[event][fn.__tauid];
+ // a handler might have attached extra functions, so we unbind those too.
+ if (fn.__taExtra) {
+ for (var i = 0; i < fn.__taExtra.length; i++) {
+ _unbind(obj, fn.__taExtra[i][0], fn.__taExtra[i][1]);
+ }
+ fn.__taExtra.length = 0;
+ }
+ // a handler might have attached an unstore callback
+ fn.__taUnstore && fn.__taUnstore();
+ },
+ _curryChildFilter = function (children, obj, fn, evt) {
+ if (children == null) return fn;
+ else {
+ var c = children.split(","),
+ _fn = function (e) {
+ _fn.__tauid = fn.__tauid;
+ var t = _t(e), target = t; // t is the target element on which the event occurred. it is the
+ // element we will wish to pass to any callbacks.
+ var pathInfo = _pi(e, t, obj, children != null)
+ if (pathInfo.end != -1) {
+ for (var p = 0; p < pathInfo.end; p++) {
+ target = pathInfo.path[p];
+ for (var i = 0; i < c.length; i++) {
+ if (matchesSelector(target, c[i], obj)) {
+ fn.apply(target, arguments);
+ }
+ }
+ }
+ }
+ };
+ registerExtraFunction(fn, evt, _fn);
+ return _fn;
+ }
+ },
+ //
+ // registers an 'extra' function on some event listener function we were given - a function that we
+ // created and bound to the element as part of our housekeeping, and which we want to unbind and remove
+ // whenever the given function is unbound.
+ registerExtraFunction = function (fn, evt, newFn) {
+ fn.__taExtra = fn.__taExtra || [];
+ fn.__taExtra.push([evt, newFn]);
+ },
+ DefaultHandler = function (obj, evt, fn, children) {
+ if (isTouchDevice && touchMap[evt]) {
+ var tfn = _curryChildFilter(children, obj, fn, touchMap[evt]);
+ _bind(obj, touchMap[evt], tfn , fn);
+ }
+ if (evt === "focus" && obj.getAttribute("tabindex") == null) {
+ obj.setAttribute("tabindex", "1");
+ }
+ _bind(obj, evt, _curryChildFilter(children, obj, fn, evt), fn);
+ },
+ SmartClickHandler = function (obj, evt, fn, children) {
+ if (obj.__taSmartClicks == null) {
+ var down = function (e) {
+ obj.__tad = _pageLocation(e);
+ },
+ up = function (e) {
+ obj.__tau = _pageLocation(e);
+ },
+ click = function (e) {
+ if (obj.__tad && obj.__tau && obj.__tad[0] === obj.__tau[0] && obj.__tad[1] === obj.__tau[1]) {
+ for (var i = 0; i < obj.__taSmartClicks.length; i++)
+ obj.__taSmartClicks[i].apply(_t(e), [ e ]);
+ }
+ };
+ DefaultHandler(obj, "mousedown", down, children);
+ DefaultHandler(obj, "mouseup", up, children);
+ DefaultHandler(obj, "click", click, children);
+ obj.__taSmartClicks = [];
+ }
+
+ // store in the list of callbacks
+ obj.__taSmartClicks.push(fn);
+ // the unstore function removes this function from the object's listener list for this type.
+ fn.__taUnstore = function () {
+ _d(obj.__taSmartClicks, fn);
+ };
+ },
+ _tapProfiles = {
+ "tap": {touches: 1, taps: 1},
+ "dbltap": {touches: 1, taps: 2},
+ "contextmenu": {touches: 2, taps: 1}
+ },
+ TapHandler = function (clickThreshold, dblClickThreshold) {
+ return function (obj, evt, fn, children) {
+ // if event is contextmenu, for devices which are mouse only, we want to
+ // use the default bind.
+ if (evt == "contextmenu" && isMouseDevice)
+ DefaultHandler(obj, evt, fn, children);
+ else {
+ // the issue here is that this down handler gets registered only for the
+ // child nodes in the first registration. in fact it should be registered with
+ // no child selector and then on down we should cycle through the registered
+ // functions to see if one of them matches. on mouseup we should execute ALL of
+ // the functions whose children are either null or match the element.
+ if (obj.__taTapHandler == null) {
+ var tt = obj.__taTapHandler = {
+ tap: [],
+ dbltap: [],
+ contextmenu: [],
+ down: false,
+ taps: 0,
+ downSelectors: []
+ };
+ var down = function (e) {
+ var target = _t(e), pathInfo = _pi(e, target, obj, children != null), finished = false;
+ for (var p = 0; p < pathInfo.end; p++) {
+ if (finished) return;
+ target = pathInfo.path[p];
+ for (var i = 0; i < tt.downSelectors.length; i++) {
+ if (tt.downSelectors[i] == null || matchesSelector(target, tt.downSelectors[i], obj)) {
+ tt.down = true;
+ setTimeout(clearSingle, clickThreshold);
+ setTimeout(clearDouble, dblClickThreshold);
+ finished = true;
+ break; // we only need one match on mousedown
+ }
+ }
+ }
+ },
+ up = function (e) {
+ if (tt.down) {
+ var target = _t(e), currentTarget, pathInfo;
+ tt.taps++;
+ var tc = _touchCount(e);
+ for (var eventId in _tapProfiles) {
+ if (_tapProfiles.hasOwnProperty(eventId)) {
+ var p = _tapProfiles[eventId];
+ if (p.touches === tc && (p.taps === 1 || p.taps === tt.taps)) {
+ for (var i = 0; i < tt[eventId].length; i++) {
+ pathInfo = _pi(e, target, obj, tt[eventId][i][1] != null);
+ for (var pLoop = 0; pLoop < pathInfo.end; pLoop++) {
+ currentTarget = pathInfo.path[pLoop];
+ // this is a single event registration handler.
+ if (tt[eventId][i][1] == null || matchesSelector(currentTarget, tt[eventId][i][1], obj)) {
+ tt[eventId][i][0].apply(currentTarget, [ e ]);
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ clearSingle = function () {
+ tt.down = false;
+ },
+ clearDouble = function () {
+ tt.taps = 0;
+ };
+
+ DefaultHandler(obj, "mousedown", down);
+ DefaultHandler(obj, "mouseup", up);
+ }
+ // add this child selector (it can be null, that's fine).
+ obj.__taTapHandler.downSelectors.push(children);
+
+ obj.__taTapHandler[evt].push([fn, children]);
+ // the unstore function removes this function from the object's listener list for this type.
+ fn.__taUnstore = function () {
+ _d(obj.__taTapHandler[evt], fn);
+ };
+ }
+ };
+ },
+ meeHelper = function (type, evt, obj, target) {
+ for (var i in obj.__tamee[type]) {
+ if (obj.__tamee[type].hasOwnProperty(i)) {
+ obj.__tamee[type][i].apply(target, [ evt ]);
+ }
+ }
+ },
+ MouseEnterExitHandler = function () {
+ var activeElements = [];
+ return function (obj, evt, fn, children) {
+ if (!obj.__tamee) {
+ // __tamee holds a flag saying whether the mouse is currently "in" the element, and a list of
+ // both mouseenter and mouseexit functions.
+ obj.__tamee = { over: false, mouseenter: [], mouseexit: [] };
+ // register over and out functions
+ var over = function (e) {
+ var t = _t(e);
+ if ((children == null && (t == obj && !obj.__tamee.over)) || (matchesSelector(t, children, obj) && (t.__tamee == null || !t.__tamee.over))) {
+ meeHelper("mouseenter", e, obj, t);
+ t.__tamee = t.__tamee || {};
+ t.__tamee.over = true;
+ activeElements.push(t);
+ }
+ },
+ out = function (e) {
+ var t = _t(e);
+ // is the current target one of the activeElements? and is the
+ // related target NOT a descendant of it?
+ for (var i = 0; i < activeElements.length; i++) {
+ if (t == activeElements[i] && !matchesSelector((e.relatedTarget || e.toElement), "*", t)) {
+ t.__tamee.over = false;
+ activeElements.splice(i, 1);
+ meeHelper("mouseexit", e, obj, t);
+ }
+ }
+ };
+
+ _bind(obj, "mouseover", _curryChildFilter(children, obj, over, "mouseover"), over);
+ _bind(obj, "mouseout", _curryChildFilter(children, obj, out, "mouseout"), out);
+ }
+
+ fn.__taUnstore = function () {
+ delete obj.__tamee[evt][fn.__tauid];
+ };
+
+ _store(obj, evt, fn);
+ obj.__tamee[evt][fn.__tauid] = fn;
+ };
+ },
+ isTouchDevice = "ontouchstart" in document.documentElement,
+ isMouseDevice = "onmousedown" in document.documentElement,
+ touchMap = { "mousedown": "touchstart", "mouseup": "touchend", "mousemove": "touchmove" },
+ touchstart = "touchstart", touchend = "touchend", touchmove = "touchmove",
+ iev = (function () {
+ var rv = -1;
+ if (navigator.appName == 'Microsoft Internet Explorer') {
+ var ua = navigator.userAgent,
+ re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
+ if (re.exec(ua) != null)
+ rv = parseFloat(RegExp.$1);
+ }
+ return rv;
+ })(),
+ isIELT9 = iev > -1 && iev < 9,
+ _genLoc = function (e, prefix) {
+ if (e == null) return [ 0, 0 ];
+ var ts = _touches(e), t = _getTouch(ts, 0);
+ return [t[prefix + "X"], t[prefix + "Y"]];
+ },
+ _pageLocation = function (e) {
+ if (e == null) return [ 0, 0 ];
+ if (isIELT9) {
+ return [ e.clientX + document.documentElement.scrollLeft, e.clientY + document.documentElement.scrollTop ];
+ }
+ else {
+ return _genLoc(e, "page");
+ }
+ },
+ _screenLocation = function (e) {
+ return _genLoc(e, "screen");
+ },
+ _clientLocation = function (e) {
+ return _genLoc(e, "client");
+ },
+ _getTouch = function (touches, idx) {
+ return touches.item ? touches.item(idx) : touches[idx];
+ },
+ _touches = function (e) {
+ return e.touches && e.touches.length > 0 ? e.touches :
+ e.changedTouches && e.changedTouches.length > 0 ? e.changedTouches :
+ e.targetTouches && e.targetTouches.length > 0 ? e.targetTouches :
+ [ e ];
+ },
+ _touchCount = function (e) {
+ return _touches(e).length;
+ },
+ //http://www.quirksmode.org/blog/archives/2005/10/_and_the_winner_1.html
+ _bind = function (obj, type, fn, originalFn) {
+ _store(obj, type, fn);
+ originalFn.__tauid = fn.__tauid;
+ if (obj.addEventListener)
+ obj.addEventListener(type, fn, false);
+ else if (obj.attachEvent) {
+ var key = type + fn.__tauid;
+ obj["e" + key] = fn;
+ // TODO look at replacing with .call(..)
+ obj[key] = function () {
+ obj["e" + key] && obj["e" + key](window.event);
+ };
+ obj.attachEvent("on" + type, obj[key]);
+ }
+ },
+ _unbind = function (obj, type, fn) {
+ if (fn == null) return;
+ _each(obj, function () {
+ var _el = _gel(this);
+ _unstore(_el, type, fn);
+ // it has been bound if there is a tauid. otherwise it was not bound and we can ignore it.
+ if (fn.__tauid != null) {
+ if (_el.removeEventListener) {
+ _el.removeEventListener(type, fn, false);
+ if (isTouchDevice && touchMap[type]) _el.removeEventListener(touchMap[type], fn, false);
+ }
+ else if (this.detachEvent) {
+ var key = type + fn.__tauid;
+ _el[key] && _el.detachEvent("on" + type, _el[key]);
+ _el[key] = null;
+ _el["e" + key] = null;
+ }
+ }
+
+ // if a touch event was also registered, deregister now.
+ if (fn.__taTouchProxy) {
+ _unbind(obj, fn.__taTouchProxy[1], fn.__taTouchProxy[0]);
+ }
+ });
+ },
+ _each = function (obj, fn) {
+ if (obj == null) return;
+ // if a list (or list-like), use it. if a string, get a list
+ // by running the string through querySelectorAll. else, assume
+ // it's an Element.
+ // obj.top is "unknown" in IE8.
+ obj = (typeof Window !== "undefined" && (typeof obj.top !== "unknown" && obj == obj.top)) ? [ obj ] :
+ (typeof obj !== "string") && (obj.tagName == null && obj.length != null) ? obj :
+ typeof obj === "string" ? document.querySelectorAll(obj)
+ : [ obj ];
+
+ for (var i = 0; i < obj.length; i++)
+ fn.apply(obj[i]);
+ };
+
+ /**
+ * Mottle offers support for abstracting out the differences
+ * between touch and mouse devices, plus "smart click" functionality
+ * (don't fire click if the mouse has moved between mousedown and mouseup),
+ * and synthesized click/tap events.
+ * @class Mottle
+ * @constructor
+ * @param {Object} params Constructor params
+ * @param {Number} [params.clickThreshold=250] Threshold, in milliseconds beyond which a touchstart followed by a touchend is not considered to be a click.
+ * @param {Number} [params.dblClickThreshold=450] Threshold, in milliseconds beyond which two successive tap events are not considered to be a click.
+ * @param {Boolean} [params.smartClicks=false] If true, won't fire click events if the mouse has moved between mousedown and mouseup. Note that this functionality
+ * requires that Mottle consume the mousedown event, and so may not be viable in all use cases.
+ */
+ root.Mottle = function (params) {
+ params = params || {};
+ var clickThreshold = params.clickThreshold || 250,
+ dblClickThreshold = params.dblClickThreshold || 450,
+ mouseEnterExitHandler = new MouseEnterExitHandler(),
+ tapHandler = new TapHandler(clickThreshold, dblClickThreshold),
+ _smartClicks = params.smartClicks,
+ _doBind = function (obj, evt, fn, children) {
+ if (fn == null) return;
+ _each(obj, function () {
+ var _el = _gel(this);
+ if (_smartClicks && evt === "click")
+ SmartClickHandler(_el, evt, fn, children);
+ else if (evt === "tap" || evt === "dbltap" || evt === "contextmenu") {
+ tapHandler(_el, evt, fn, children);
+ }
+ else if (evt === "mouseenter" || evt == "mouseexit")
+ mouseEnterExitHandler(_el, evt, fn, children);
+ else
+ DefaultHandler(_el, evt, fn, children);
+ });
+ };
+
+ /**
+ * Removes an element from the DOM, and deregisters all event handlers for it. You should use this
+ * to ensure you don't leak memory.
+ * @method remove
+ * @param {String|Element} el Element, or id of the element, to remove.
+ * @return {Mottle} The current Mottle instance; you can chain this method.
+ */
+ this.remove = function (el) {
+ _each(el, function () {
+ var _el = _gel(this);
+ if (_el.__ta) {
+ for (var evt in _el.__ta) {
+ if (_el.__ta.hasOwnProperty(evt)) {
+ for (var h in _el.__ta[evt]) {
+ if (_el.__ta[evt].hasOwnProperty(h))
+ _unbind(_el, evt, _el.__ta[evt][h]);
+ }
+ }
+ }
+ }
+ _el.parentNode && _el.parentNode.removeChild(_el);
+ });
+ return this;
+ };
+
+ /**
+ * Register an event handler, optionally as a delegate for some set of descendant elements. Note
+ * that this method takes either 3 or 4 arguments - if you supply 3 arguments it is assumed you have
+ * omitted the `children` parameter, and that the event handler should be bound directly to the given element.
+ * @method on
+ * @param {Element[]|Element|String} el Either an Element, or a CSS spec for a list of elements, or an array of Elements.
+ * @param {String} [children] Comma-delimited list of selectors identifying allowed children.
+ * @param {String} event Event ID.
+ * @param {Function} fn Event handler function.
+ * @return {Mottle} The current Mottle instance; you can chain this method.
+ */
+ this.on = function (el, event, children, fn) {
+ var _el = arguments[0],
+ _c = arguments.length == 4 ? arguments[2] : null,
+ _e = arguments[1],
+ _f = arguments[arguments.length - 1];
+
+ _doBind(_el, _e, _f, _c);
+ return this;
+ };
+
+ /**
+ * Cancel delegate event handling for the given function. Note that unlike with 'on' you do not supply
+ * a list of child selectors here: it removes event delegation from all of the child selectors for which the
+ * given function was registered (if any).
+ * @method off
+ * @param {Element[]|Element|String} el Element - or ID of element - from which to remove event listener.
+ * @param {String} event Event ID.
+ * @param {Function} fn Event handler function.
+ * @return {Mottle} The current Mottle instance; you can chain this method.
+ */
+ this.off = function (el, event, fn) {
+ _unbind(el, event, fn);
+ return this;
+ };
+
+ /**
+ * Triggers some event for a given element.
+ * @method trigger
+ * @param {Element} el Element for which to trigger the event.
+ * @param {String} event Event ID.
+ * @param {Event} originalEvent The original event. Should be optional of course, but currently is not, due
+ * to the jsPlumb use case that caused this method to be added.
+ * @param {Object} [payload] Optional object to set as `payload` on the generated event; useful for message passing.
+ * @return {Mottle} The current Mottle instance; you can chain this method.
+ */
+ this.trigger = function (el, event, originalEvent, payload) {
+ // MouseEvent undefined in old IE; that's how we know it's a mouse event. A fine Microsoft paradox.
+ var originalIsMouse = isMouseDevice && (typeof MouseEvent === "undefined" || originalEvent == null || originalEvent.constructor === MouseEvent);
+
+ var eventToBind = (isTouchDevice && !isMouseDevice && touchMap[event]) ? touchMap[event] : event,
+ bindingAMouseEvent = !(isTouchDevice && !isMouseDevice && touchMap[event]);
+
+ var pl = _pageLocation(originalEvent), sl = _screenLocation(originalEvent), cl = _clientLocation(originalEvent);
+ _each(el, function () {
+ var _el = _gel(this), evt;
+ originalEvent = originalEvent || {
+ screenX: sl[0],
+ screenY: sl[1],
+ clientX: cl[0],
+ clientY: cl[1]
+ };
+
+ var _decorate = function (_evt) {
+ if (payload) _evt.payload = payload;
+ };
+
+ var eventGenerators = {
+ "TouchEvent": function (evt) {
+ var touch = document.createTouch(window, _el, 0, pl[0], pl[1],
+ sl[0], sl[1],
+ cl[0], cl[1],
+ 0, 0, 0, 0);
+
+ // https://gist.github.com/sstephenson/448808
+ var touches = document.createTouchList(touch);
+ var targetTouches = document.createTouchList(touch);
+ var changedTouches = document.createTouchList(touch);
+ evt.initTouchEvent(eventToBind, true, true, window, null, sl[0], sl[1],
+ cl[0], cl[1], false, false, false, false,
+ touches, targetTouches, changedTouches, 1, 0);
+ },
+ "MouseEvents": function (evt) {
+ evt.initMouseEvent(eventToBind, true, true, window, 0,
+ sl[0], sl[1],
+ cl[0], cl[1],
+ false, false, false, false, 1, _el);
+
+ if (Sniff.android) {
+ // Android's touch events are not standard.
+ var t = document.createTouch(window, _el, 0, pl[0], pl[1],
+ sl[0], sl[1],
+ cl[0], cl[1],
+ 0, 0, 0, 0);
+
+ evt.touches = evt.targetTouches = evt.changedTouches = document.createTouchList(t);
+ }
+ }
+ };
+
+ if (document.createEvent) {
+
+ var ite = !bindingAMouseEvent && !originalIsMouse && (isTouchDevice && touchMap[event] && !Sniff.android),
+ evtName = ite ? "TouchEvent" : "MouseEvents";
+
+ evt = document.createEvent(evtName);
+ eventGenerators[evtName](evt);
+ _decorate(evt);
+ _el.dispatchEvent(evt);
+ }
+ else if (document.createEventObject) {
+ evt = document.createEventObject();
+ evt.eventType = evt.eventName = eventToBind;
+ evt.screenX = sl[0];
+ evt.screenY = sl[1];
+ evt.clientX = cl[0];
+ evt.clientY = cl[1];
+ _decorate(evt);
+ _el.fireEvent('on' + eventToBind, evt);
+ }
+ });
+ return this;
+ }
+ };
+
+ /**
+ * Static method to assist in 'consuming' an element: uses `stopPropagation` where available, or sets
+ * `e.returnValue=false` where it is not.
+ * @method Mottle.consume
+ * @param {Event} e Event to consume
+ * @param {Boolean} [doNotPreventDefault=false] If true, does not call `preventDefault()` on the event.
+ */
+ root.Mottle.consume = function (e, doNotPreventDefault) {
+ if (e.stopPropagation)
+ e.stopPropagation();
+ else
+ e.returnValue = false;
+
+ if (!doNotPreventDefault && e.preventDefault)
+ e.preventDefault();
+ };
+
+ /**
+ * Gets the page location corresponding to the given event. For touch events this means get the page location of the first touch.
+ * @method Mottle.pageLocation
+ * @param {Event} e Event to get page location for.
+ * @return {Number[]} [left, top] for the given event.
+ */
+ root.Mottle.pageLocation = _pageLocation;
+
+ /**
+ * Forces touch events to be turned "on". Useful for testing: even if you don't have a touch device, you can still
+ * trigger a touch event when this is switched on and it will be captured and acted on.
+ * @method setForceTouchEvents
+ * @param {Boolean} value If true, force touch events to be on.
+ */
+ root.Mottle.setForceTouchEvents = function (value) {
+ isTouchDevice = value;
+ };
+
+ /**
+ * Forces mouse events to be turned "on". Useful for testing: even if you don't have a mouse, you can still
+ * trigger a mouse event when this is switched on and it will be captured and acted on.
+ * @method setForceMouseEvents
+ * @param {Boolean} value If true, force mouse events to be on.
+ */
+ root.Mottle.setForceMouseEvents = function (value) {
+ isMouseDevice = value;
+ };
+
+ root.Mottle.version = "0.8.0";
+
+ if (true) {
+ exports.Mottle = root.Mottle;
+ }
+
+}).call(typeof window === "undefined" ? this : window);
+
+/**
+ drag/drop functionality for use with jsPlumb but with
+ no knowledge of jsPlumb. supports multiple scopes (separated by whitespace), dragging
+ multiple elements, constrain to parent, drop filters, drag start filters, custom
+ css classes.
+
+ a lot of the functionality of this script is expected to be plugged in:
+
+ addClass
+ removeClass
+
+ addEvent
+ removeEvent
+
+ getPosition
+ setPosition
+ getSize
+
+ indexOf
+ intersects
+
+ the name came from here:
+
+ http://mrsharpoblunto.github.io/foswig.js/
+
+ copyright 2016 jsPlumb
+ */
+
+;(function() {
+
+ "use strict";
+ var root = this;
+
+ var _suggest = function(list, item, head) {
+ if (list.indexOf(item) === -1) {
+ head ? list.unshift(item) : list.push(item);
+ return true;
+ }
+ return false;
+ };
+
+ var _vanquish = function(list, item) {
+ var idx = list.indexOf(item);
+ if (idx != -1) list.splice(idx, 1);
+ };
+
+ var _difference = function(l1, l2) {
+ var d = [];
+ for (var i = 0; i < l1.length; i++) {
+ if (l2.indexOf(l1[i]) == -1)
+ d.push(l1[i]);
+ }
+ return d;
+ };
+
+ var _isString = function(f) {
+ return f == null ? false : (typeof f === "string" || f.constructor == String);
+ };
+
+ var getOffsetRect = function (elem) {
+ // (1)
+ var box = elem.getBoundingClientRect(),
+ body = document.body,
+ docElem = document.documentElement,
+ // (2)
+ scrollTop = window.pageYOffset || docElem.scrollTop || body.scrollTop,
+ scrollLeft = window.pageXOffset || docElem.scrollLeft || body.scrollLeft,
+ // (3)
+ clientTop = docElem.clientTop || body.clientTop || 0,
+ clientLeft = docElem.clientLeft || body.clientLeft || 0,
+ // (4)
+ top = box.top + scrollTop - clientTop,
+ left = box.left + scrollLeft - clientLeft;
+
+ return { top: Math.round(top), left: Math.round(left) };
+ };
+
+ var matchesSelector = function(el, selector, ctx) {
+ ctx = ctx || el.parentNode;
+ var possibles = ctx.querySelectorAll(selector);
+ for (var i = 0; i < possibles.length; i++) {
+ if (possibles[i] === el)
+ return true;
+ }
+ return false;
+ };
+
+ var iev = (function() {
+ var rv = -1;
+ if (navigator.appName == 'Microsoft Internet Explorer') {
+ var ua = navigator.userAgent,
+ re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
+ if (re.exec(ua) != null)
+ rv = parseFloat(RegExp.$1);
+ }
+ return rv;
+ })(),
+ DEFAULT_GRID_X = 50,
+ DEFAULT_GRID_Y = 50,
+ isIELT9 = iev > -1 && iev < 9,
+ isIE9 = iev == 9,
+ _pl = function(e) {
+ if (isIELT9) {
+ return [ e.clientX + document.documentElement.scrollLeft, e.clientY + document.documentElement.scrollTop ];
+ }
+ else {
+ var ts = _touches(e), t = _getTouch(ts, 0);
+ // for IE9 pageX might be null if the event was synthesized. We try for pageX/pageY first,
+ // falling back to clientX/clientY if necessary. In every other browser we want to use pageX/pageY.
+ return isIE9 ? [t.pageX || t.clientX, t.pageY || t.clientY] : [t.pageX, t.pageY];
+ }
+ },
+ _getTouch = function(touches, idx) { return touches.item ? touches.item(idx) : touches[idx]; },
+ _touches = function(e) {
+ return e.touches && e.touches.length > 0 ? e.touches :
+ e.changedTouches && e.changedTouches.length > 0 ? e.changedTouches :
+ e.targetTouches && e.targetTouches.length > 0 ? e.targetTouches :
+ [ e ];
+ },
+ _classes = {
+ draggable:"katavorio-draggable", // draggable elements
+ droppable:"katavorio-droppable", // droppable elements
+ drag : "katavorio-drag", // elements currently being dragged
+ selected:"katavorio-drag-selected", // elements in current drag selection
+ active : "katavorio-drag-active", // droppables that are targets of a currently dragged element
+ hover : "katavorio-drag-hover", // droppables over which a matching drag element is hovering
+ noSelect : "katavorio-drag-no-select", // added to the body to provide a hook to suppress text selection
+ ghostProxy:"katavorio-ghost-proxy" // added to a ghost proxy element in use when a drag has exited the bounds of its parent.
+ },
+ _defaultScope = "katavorio-drag-scope",
+ _events = [ "stop", "start", "drag", "drop", "over", "out", "beforeStart" ],
+ _devNull = function() {},
+ _true = function() { return true; },
+ _foreach = function(l, fn, from) {
+ for (var i = 0; i < l.length; i++) {
+ if (l[i] != from)
+ fn(l[i]);
+ }
+ },
+ _setDroppablesActive = function(dd, val, andHover, drag) {
+ _foreach(dd, function(e) {
+ e.setActive(val);
+ if (val) e.updatePosition();
+ if (andHover) e.setHover(drag, val);
+ });
+ },
+ _each = function(obj, fn) {
+ if (obj == null) return;
+ obj = !_isString(obj) && (obj.tagName == null && obj.length != null) ? obj : [ obj ];
+ for (var i = 0; i < obj.length; i++)
+ fn.apply(obj[i], [ obj[i] ]);
+ },
+ _consume = function(e) {
+ if (e.stopPropagation) {
+ e.stopPropagation();
+ e.preventDefault();
+ }
+ else {
+ e.returnValue = false;
+ }
+ },
+ _defaultInputFilterSelector = "input,textarea,select,button,option",
+ //
+ // filters out events on all input elements, like textarea, checkbox, input, select.
+ _inputFilter = function(e, el, _katavorio) {
+ var t = e.srcElement || e.target;
+ return !matchesSelector(t, _katavorio.getInputFilterSelector(), el);
+ };
+
+ var Super = function(el, params, css, scope) {
+ this.params = params || {};
+ this.el = el;
+ this.params.addClass(this.el, this._class);
+ this.uuid = _uuid();
+ var enabled = true;
+ this.setEnabled = function(e) { enabled = e; };
+ this.isEnabled = function() { return enabled; };
+ this.toggleEnabled = function() { enabled = !enabled; };
+ this.setScope = function(scopes) {
+ this.scopes = scopes ? scopes.split(/\s+/) : [ scope ];
+ };
+ this.addScope = function(scopes) {
+ var m = {};
+ _each(this.scopes, function(s) { m[s] = true;});
+ _each(scopes ? scopes.split(/\s+/) : [], function(s) { m[s] = true;});
+ this.scopes = [];
+ for (var i in m) this.scopes.push(i);
+ };
+ this.removeScope = function(scopes) {
+ var m = {};
+ _each(this.scopes, function(s) { m[s] = true;});
+ _each(scopes ? scopes.split(/\s+/) : [], function(s) { delete m[s];});
+ this.scopes = [];
+ for (var i in m) this.scopes.push(i);
+ };
+ this.toggleScope = function(scopes) {
+ var m = {};
+ _each(this.scopes, function(s) { m[s] = true;});
+ _each(scopes ? scopes.split(/\s+/) : [], function(s) {
+ if (m[s]) delete m[s];
+ else m[s] = true;
+ });
+ this.scopes = [];
+ for (var i in m) this.scopes.push(i);
+ };
+ this.setScope(params.scope);
+ this.k = params.katavorio;
+ return params.katavorio;
+ };
+
+ var TRUE = function() { return true; };
+ var FALSE = function() { return false; };
+
+ var Drag = function(el, params, css, scope) {
+ this._class = css.draggable;
+ var k = Super.apply(this, arguments);
+ this.rightButtonCanDrag = this.params.rightButtonCanDrag;
+ var downAt = [0,0], posAtDown = null, pagePosAtDown = null, pageDelta = [0,0], moving = false,
+ consumeStartEvent = this.params.consumeStartEvent !== false,
+ dragEl = this.el,
+ clone = this.params.clone,
+ scroll = this.params.scroll,
+ _multipleDrop = params.multipleDrop !== false,
+ isConstrained = false,
+ useGhostProxy = params.ghostProxy === true ? TRUE : params.ghostProxy && typeof params.ghostProxy === "function" ? params.ghostProxy : FALSE,
+ ghostProxy = function(el) { return el.cloneNode(true); };
+
+ var snapThreshold = params.snapThreshold || 5,
+ _snap = function(pos, x, y, thresholdX, thresholdY) {
+ thresholdX = thresholdX || snapThreshold;
+ thresholdY = thresholdY || snapThreshold;
+ var _dx = Math.floor(pos[0] / x),
+ _dxl = x * _dx,
+ _dxt = _dxl + x,
+ _x = Math.abs(pos[0] - _dxl) <= thresholdX ? _dxl : Math.abs(_dxt - pos[0]) <= thresholdX ? _dxt : pos[0];
+
+ var _dy = Math.floor(pos[1] / y),
+ _dyl = y * _dy,
+ _dyt = _dyl + y,
+ _y = Math.abs(pos[1] - _dyl) <= thresholdY ? _dyl : Math.abs(_dyt - pos[1]) <= thresholdY ? _dyt : pos[1];
+
+ return [ _x, _y];
+ };
+
+ this.posses = [];
+ this.posseRoles = {};
+
+ this.toGrid = function(pos) {
+ if (this.params.grid == null) {
+ return pos;
+ }
+ else {
+ return _snap(pos, this.params.grid[0], this.params.grid[1]);
+ }
+ };
+
+ this.snap = function(x, y) {
+ if (dragEl == null) return;
+ x = x || (this.params.grid ? this.params.grid[0] : DEFAULT_GRID_X);
+ y = y || (this.params.grid ? this.params.grid[1] : DEFAULT_GRID_Y);
+ var p = this.params.getPosition(dragEl);
+ this.params.setPosition(dragEl, _snap(p, x, y, x, y));
+ };
+
+ this.setUseGhostProxy = function(val) {
+ useGhostProxy = val ? TRUE : FALSE;
+ };
+
+ var constrain;
+ var negativeFilter = function(pos) {
+ return (params.allowNegative === false) ? [ Math.max (0, pos[0]), Math.max(0, pos[1]) ] : pos;
+ };
+
+ var _setConstrain = function(value) {
+ constrain = typeof value === "function" ? value : value ? function(pos) {
+ return negativeFilter([
+ Math.max(0, Math.min(constrainRect.w - this.size[0], pos[0])),
+ Math.max(0, Math.min(constrainRect.h - this.size[1], pos[1]))
+ ]);
+ }.bind(this) : function(pos) { return negativeFilter(pos); };
+ }.bind(this);
+
+ _setConstrain(typeof this.params.constrain === "function" ? this.params.constrain : (this.params.constrain || this.params.containment));
+
+
+ /**
+ * Sets whether or not the Drag is constrained. A value of 'true' means constrain to parent bounds; a function
+ * will be executed and returns true if the position is allowed.
+ * @param value
+ */
+ this.setConstrain = function(value) {
+ _setConstrain(value);
+ };
+
+ var revertFunction;
+ /**
+ * Sets a function to call on drag stop, which, if it returns true, indicates that the given element should
+ * revert to its position before the previous drag.
+ * @param fn
+ */
+ this.setRevert = function(fn) {
+ revertFunction = fn;
+ };
+
+ var _assignId = function(obj) {
+ if (typeof obj == "function") {
+ obj._katavorioId = _uuid();
+ return obj._katavorioId;
+ } else {
+ return obj;
+ }
+ },
+ // a map of { spec -> [ fn, exclusion ] } entries.
+ _filters = {},
+ _testFilter = function(e) {
+ for (var key in _filters) {
+ var f = _filters[key];
+ var rv = f[0](e);
+ if (f[1]) rv = !rv;
+ if (!rv) return false;
+ }
+ return true;
+ },
+ _setFilter = this.setFilter = function(f, _exclude) {
+ if (f) {
+ var key = _assignId(f);
+ _filters[key] = [
+ function(e) {
+ var t = e.srcElement || e.target, m;
+ if (_isString(f)) {
+ m = matchesSelector(t, f, el);
+ }
+ else if (typeof f === "function") {
+ m = f(e, el);
+ }
+ return m;
+ },
+ _exclude !== false
+ ];
+
+ }
+ },
+ _addFilter = this.addFilter = _setFilter,
+ _removeFilter = this.removeFilter = function(f) {
+ var key = typeof f == "function" ? f._katavorioId : f;
+ delete _filters[key];
+ };
+
+ this.clearAllFilters = function() {
+ _filters = {};
+ };
+
+ this.canDrag = this.params.canDrag || _true;
+
+ var constrainRect,
+ matchingDroppables = [], intersectingDroppables = [];
+
+ this.downListener = function(e) {
+ var isNotRightClick = this.rightButtonCanDrag || (e.which !== 3 && e.button !== 2);
+ if (isNotRightClick && this.isEnabled() && this.canDrag()) {
+ var _f = _testFilter(e) && _inputFilter(e, this.el, this.k);
+ if (_f) {
+ if (!clone)
+ dragEl = this.el;
+ else {
+ dragEl = this.el.cloneNode(true);
+ dragEl.setAttribute("id", null);
+ dragEl.style.position = "absolute";
+ // the clone node is added to the body; getOffsetRect gives us a value
+ // relative to the body.
+ var b = getOffsetRect(this.el);
+ dragEl.style.left = b.left + "px";
+ dragEl.style.top = b.top + "px";
+ document.body.appendChild(dragEl);
+ }
+ consumeStartEvent && _consume(e);
+ downAt = _pl(e);
+ //
+ this.params.bind(document, "mousemove", this.moveListener);
+ this.params.bind(document, "mouseup", this.upListener);
+ k.markSelection(this);
+ k.markPosses(this);
+ this.params.addClass(document.body, css.noSelect);
+ _dispatch("beforeStart", {el:this.el, pos:posAtDown, e:e, drag:this});
+ }
+ else if (this.params.consumeFilteredEvents) {
+ _consume(e);
+ }
+ }
+ }.bind(this);
+
+ this.moveListener = function(e) {
+ if (downAt) {
+ if (!moving) {
+ var _continue = _dispatch("start", {el:this.el, pos:posAtDown, e:e, drag:this});
+ if (_continue !== false) {
+ if (!downAt) return;
+ this.mark(true);
+ moving = true;
+ }
+ }
+
+ // it is possible that the start event caused the drag to be aborted. So we check
+ // again that we are currently dragging.
+ if (downAt) {
+ intersectingDroppables.length = 0;
+ var pos = _pl(e), dx = pos[0] - downAt[0], dy = pos[1] - downAt[1],
+ z = this.params.ignoreZoom ? 1 : k.getZoom();
+ dx /= z;
+ dy /= z;
+ this.moveBy(dx, dy, e);
+ k.updateSelection(dx, dy, this);
+ k.updatePosses(dx, dy, this);
+ }
+ }
+ }.bind(this);
+
+ this.upListener = function(e) {
+ if (downAt) {
+ downAt = null;
+ this.params.unbind(document, "mousemove", this.moveListener);
+ this.params.unbind(document, "mouseup", this.upListener);
+ this.params.removeClass(document.body, css.noSelect);
+ this.unmark(e);
+ k.unmarkSelection(this, e);
+ k.unmarkPosses(this, e);
+ this.stop(e);
+ k.notifySelectionDragStop(this, e);
+ k.notifyPosseDragStop(this, e);
+ moving = false;
+ if (clone) {
+ dragEl && dragEl.parentNode && dragEl.parentNode.removeChild(dragEl);
+ dragEl = null;
+ }
+
+ intersectingDroppables.length = 0;
+
+ if (revertFunction && revertFunction(this.el, this.params.getPosition(this.el)) === true) {
+ this.params.setPosition(this.el, posAtDown);
+ _dispatch("revert", this.el);
+ }
+ }
+ }.bind(this);
+
+ this.getFilters = function() { return _filters; };
+
+ this.abort = function() {
+ if (downAt != null)
+ this.upListener();
+ };
+
+ this.getDragElement = function() {
+ return dragEl || this.el;
+ };
+
+ var listeners = {"start":[], "drag":[], "stop":[], "over":[], "out":[], "beforeStart":[], "revert":[] };
+ if (params.events.start) listeners.start.push(params.events.start);
+ if (params.events.beforeStart) listeners.beforeStart.push(params.events.beforeStart);
+ if (params.events.stop) listeners.stop.push(params.events.stop);
+ if (params.events.drag) listeners.drag.push(params.events.drag);
+ if (params.events.revert) listeners.revert.push(params.events.revert);
+
+ this.on = function(evt, fn) {
+ if (listeners[evt]) listeners[evt].push(fn);
+ };
+
+ this.off = function(evt, fn) {
+ if (listeners[evt]) {
+ var l = [];
+ for (var i = 0; i < listeners[evt].length; i++) {
+ if (listeners[evt][i] !== fn) l.push(listeners[evt][i]);
+ }
+ listeners[evt] = l;
+ }
+ };
+
+ var _dispatch = function(evt, value) {
+ if (listeners[evt]) {
+ for (var i = 0; i < listeners[evt].length; i++) {
+ try {
+ listeners[evt][i](value);
+ }
+ catch (e) { }
+ }
+ }
+ };
+
+ this.notifyStart = function(e) {
+ _dispatch("start", {el:this.el, pos:this.params.getPosition(dragEl), e:e, drag:this});
+ };
+
+ this.stop = function(e, force) {
+ if (force || moving) {
+ var positions = [],
+ sel = k.getSelection(),
+ dPos = this.params.getPosition(dragEl);
+
+ if (sel.length > 1) {
+ for (var i = 0; i < sel.length; i++) {
+ var p = this.params.getPosition(sel[i].el);
+ positions.push([ sel[i].el, { left: p[0], top: p[1] }, sel[i] ]);
+ }
+ }
+ else {
+ positions.push([ dragEl, {left:dPos[0], top:dPos[1]}, this ]);
+ }
+
+ _dispatch("stop", {
+ el: dragEl,
+ pos: ghostProxyOffsets || dPos,
+ finalPos:dPos,
+ e: e,
+ drag: this,
+ selection:positions
+ });
+ }
+ };
+
+ this.mark = function(andNotify) {
+ posAtDown = this.params.getPosition(dragEl);
+ pagePosAtDown = this.params.getPosition(dragEl, true);
+ pageDelta = [pagePosAtDown[0] - posAtDown[0], pagePosAtDown[1] - posAtDown[1]];
+ this.size = this.params.getSize(dragEl);
+ matchingDroppables = k.getMatchingDroppables(this);
+ _setDroppablesActive(matchingDroppables, true, false, this);
+ this.params.addClass(dragEl, this.params.dragClass || css.drag);
+ //if (this.params.constrain || this.params.containment) {
+ var cs = this.params.getSize(dragEl.parentNode);
+ constrainRect = { w:cs[0], h:cs[1] };
+ //}
+ if (andNotify) {
+ k.notifySelectionDragStart(this);
+ }
+ };
+ var ghostProxyOffsets;
+ this.unmark = function(e, doNotCheckDroppables) {
+ _setDroppablesActive(matchingDroppables, false, true, this);
+
+
+ if (isConstrained && useGhostProxy(this.el)) {
+ ghostProxyOffsets = [dragEl.offsetLeft, dragEl.offsetTop];
+ this.el.parentNode.removeChild(dragEl);
+ dragEl = this.el;
+ }
+ else {
+ ghostProxyOffsets = null;
+ }
+
+ this.params.removeClass(dragEl, this.params.dragClass || css.drag);
+ matchingDroppables.length = 0;
+ isConstrained = false;
+ if (!doNotCheckDroppables) {
+ if (intersectingDroppables.length > 0 && ghostProxyOffsets) {
+ params.setPosition(this.el, ghostProxyOffsets);
+ }
+ intersectingDroppables.sort(_rankSort);
+ for (var i = 0; i < intersectingDroppables.length; i++) {
+ var retVal = intersectingDroppables[i].drop(this, e);
+ if (retVal === true) break;
+ }
+ }
+ };
+ this.moveBy = function(dx, dy, e) {
+ intersectingDroppables.length = 0;
+ var desiredLoc = this.toGrid([posAtDown[0] + dx, posAtDown[1] + dy]),
+ cPos = constrain(desiredLoc, dragEl);
+
+ if (useGhostProxy(this.el)) {
+ if (desiredLoc[0] != cPos[0] || desiredLoc[1] != cPos[1]) {
+ if (!isConstrained) {
+ var gp = ghostProxy(this.el);
+ params.addClass(gp, _classes.ghostProxy);
+ this.el.parentNode.appendChild(gp);
+ dragEl = gp;
+ isConstrained = true;
+ }
+ cPos = desiredLoc;
+ }
+ else {
+ if (isConstrained) {
+ this.el.parentNode.removeChild(dragEl);
+ dragEl = this.el;
+ isConstrained = false;
+ }
+ }
+ }
+
+ var rect = { x:cPos[0], y:cPos[1], w:this.size[0], h:this.size[1]},
+ pageRect = { x:rect.x + pageDelta[0], y:rect.y + pageDelta[1], w:rect.w, h:rect.h},
+ focusDropElement = null;
+
+
+
+ this.params.setPosition(dragEl, cPos);
+ for (var i = 0; i < matchingDroppables.length; i++) {
+ var r2 = { x:matchingDroppables[i].pagePosition[0], y:matchingDroppables[i].pagePosition[1], w:matchingDroppables[i].size[0], h:matchingDroppables[i].size[1]};
+ if (this.params.intersects(pageRect, r2) && (_multipleDrop || focusDropElement == null || focusDropElement == matchingDroppables[i].el) && matchingDroppables[i].canDrop(this)) {
+ if (!focusDropElement) focusDropElement = matchingDroppables[i].el;
+ intersectingDroppables.push(matchingDroppables[i]);
+ matchingDroppables[i].setHover(this, true, e);
+ }
+ else if (matchingDroppables[i].isHover()) {
+ matchingDroppables[i].setHover(this, false, e);
+ }
+ }
+
+ _dispatch("drag", {el:this.el, pos:cPos, e:e, drag:this});
+
+ /* test to see if the parent needs to be scrolled (future)
+ if (scroll) {
+ var pnsl = dragEl.parentNode.scrollLeft, pnst = dragEl.parentNode.scrollTop;
+ console.log("scroll!", pnsl, pnst);
+ }*/
+ };
+ this.destroy = function() {
+ this.params.unbind(this.el, "mousedown", this.downListener);
+ this.params.unbind(document, "mousemove", this.moveListener);
+ this.params.unbind(document, "mouseup", this.upListener);
+ this.downListener = null;
+ this.upListener = null;
+ this.moveListener = null;
+ };
+
+ // init:register mousedown, and perhaps set a filter
+ this.params.bind(this.el, "mousedown", this.downListener);
+
+ // if handle provded, use that. otherwise, try to set a filter.
+ // note that a `handle` selector always results in filterExclude being set to false, ie.
+ // the selector defines the handle element(s).
+ if (this.params.handle)
+ _setFilter(this.params.handle, false);
+ else
+ _setFilter(this.params.filter, this.params.filterExclude);
+ };
+
+ var Drop = function(el, params, css, scope) {
+ this._class = css.droppable;
+ this.params = params || {};
+ this.rank = params.rank || 0;
+ this._activeClass = this.params.activeClass || css.active;
+ this._hoverClass = this.params.hoverClass || css.hover;
+ Super.apply(this, arguments);
+ var hover = false;
+ this.allowLoopback = this.params.allowLoopback !== false;
+
+ this.setActive = function(val) {
+ this.params[val ? "addClass" : "removeClass"](this.el, this._activeClass);
+ };
+
+ this.updatePosition = function() {
+ this.position = this.params.getPosition(this.el);
+ this.pagePosition = this.params.getPosition(this.el, true);
+ this.size = this.params.getSize(this.el);
+ };
+
+ this.canDrop = this.params.canDrop || function(drag) {
+ return true;
+ };
+
+ this.isHover = function() { return hover; };
+
+ this.setHover = function(drag, val, e) {
+ // if turning off hover but this was not the drag that caused the hover, ignore.
+ if (val || this.el._katavorioDragHover == null || this.el._katavorioDragHover == drag.el._katavorio) {
+ this.params[val ? "addClass" : "removeClass"](this.el, this._hoverClass);
+ //this.el._katavorioDragHover = val ? drag.el._katavorio : null;
+ this.el._katavorioDragHover = val ? drag.el._katavorio : null;
+ if (hover !== val)
+ this.params.events[val ? "over" : "out"]({el:this.el, e:e, drag:drag, drop:this});
+ hover = val;
+ }
+ };
+
+ this.drop = function(drag, event) {
+ return this.params.events["drop"]({ drag:drag, e:event, drop:this });
+ };
+
+ this.destroy = function() {
+ this._class = null;
+ this._activeClass = null;
+ this._hoverClass = null;
+ //this.params = null;
+ hover = null;
+ //this.el = null;
+ };
+ };
+
+ var _uuid = function() {
+ return ('xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
+ var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
+ return v.toString(16);
+ }));
+ };
+
+ var _rankSort = function(a,b) {
+ return a.rank < b.rank ? 1 : a.rank > b.rank ? -1 : 0;
+ };
+
+ var _gel = function(el) {
+ if (el == null) return null;
+ el = (typeof el === "string" || el.constructor == String) ? document.getElementById(el) : el;
+ if (el == null) return null;
+ el._katavorio = el._katavorio || _uuid();
+ return el;
+ };
+
+ root.Katavorio = function(katavorioParams) {
+
+ var _selection = [],
+ _selectionMap = {};
+
+ this._dragsByScope = {};
+ this._dropsByScope = {};
+ var _zoom = 1,
+ _reg = function(obj, map) {
+ _each(obj, function(_obj) {
+ for(var i = 0; i < _obj.scopes.length; i++) {
+ map[_obj.scopes[i]] = map[_obj.scopes[i]] || [];
+ map[_obj.scopes[i]].push(_obj);
+ }
+ });
+ },
+ _unreg = function(obj, map) {
+ var c = 0;
+ _each(obj, function(_obj) {
+ for(var i = 0; i < _obj.scopes.length; i++) {
+ if (map[_obj.scopes[i]]) {
+ var idx = katavorioParams.indexOf(map[_obj.scopes[i]], _obj);
+ if (idx != -1) {
+ map[_obj.scopes[i]].splice(idx, 1);
+ c++;
+ }
+ }
+ }
+ });
+
+ return c > 0 ;
+ },
+ _getMatchingDroppables = this.getMatchingDroppables = function(drag) {
+ var dd = [], _m = {};
+ for (var i = 0; i < drag.scopes.length; i++) {
+ var _dd = this._dropsByScope[drag.scopes[i]];
+ if (_dd) {
+ for (var j = 0; j < _dd.length; j++) {
+ if (_dd[j].canDrop(drag) && !_m[_dd[j].uuid] && (_dd[j].allowLoopback || _dd[j].el !== drag.el)) {
+ _m[_dd[j].uuid] = true;
+ dd.push(_dd[j]);
+ }
+ }
+ }
+ }
+ dd.sort(_rankSort);
+ return dd;
+ },
+ _prepareParams = function(p) {
+ p = p || {};
+ var _p = {
+ events:{}
+ }, i;
+ for (i in katavorioParams) _p[i] = katavorioParams[i];
+ for (i in p) _p[i] = p[i];
+ // events
+
+ for (i = 0; i < _events.length; i++) {
+ _p.events[_events[i]] = p[_events[i]] || _devNull;
+ }
+ _p.katavorio = this;
+ return _p;
+ }.bind(this),
+ _mistletoe = function(existingDrag, params) {
+ for (var i = 0; i < _events.length; i++) {
+ if (params[_events[i]]) {
+ existingDrag.on(_events[i], params[_events[i]]);
+ }
+ }
+ }.bind(this),
+ _css = {},
+ overrideCss = katavorioParams.css || {},
+ _scope = katavorioParams.scope || _defaultScope;
+
+ // prepare map of css classes based on defaults frst, then optional overrides
+ for (var i in _classes) _css[i] = _classes[i];
+ for (var i in overrideCss) _css[i] = overrideCss[i];
+
+ var inputFilterSelector = katavorioParams.inputFilterSelector || _defaultInputFilterSelector;
+ /**
+ * Gets the selector identifying which input elements to filter from drag events.
+ * @method getInputFilterSelector
+ * @return {String} Current input filter selector.
+ */
+ this.getInputFilterSelector = function() { return inputFilterSelector; };
+
+ /**
+ * Sets the selector identifying which input elements to filter from drag events.
+ * @method setInputFilterSelector
+ * @param {String} selector Input filter selector to set.
+ * @return {Katavorio} Current instance; method may be chained.
+ */
+ this.setInputFilterSelector = function(selector) {
+ inputFilterSelector = selector;
+ return this;
+ };
+
+ this.draggable = function(el, params) {
+ var o = [];
+ _each(el, function(_el) {
+ _el = _gel(_el);
+ if (_el != null) {
+ if (_el._katavorioDrag == null) {
+ var p = _prepareParams(params);
+ _el._katavorioDrag = new Drag(_el, p, _css, _scope);
+ _reg(_el._katavorioDrag, this._dragsByScope);
+ o.push(_el._katavorioDrag);
+ katavorioParams.addClass(_el, _css.draggable);
+ }
+ else {
+ _mistletoe(_el._katavorioDrag, params);
+ }
+ }
+ }.bind(this));
+ return o;
+
+ };
+
+ this.droppable = function(el, params) {
+ var o = [];
+ _each(el, function(_el) {
+ _el = _gel(_el);
+ if (_el != null) {
+ var drop = new Drop(_el, _prepareParams(params), _css, _scope);
+ _el._katavorioDrop = _el._katavorioDrop || [];
+ _el._katavorioDrop.push(drop);
+ _reg(drop, this._dropsByScope);
+ o.push(drop);
+ katavorioParams.addClass(_el, _css.droppable);
+ }
+ }.bind(this));
+ return o;
+ };
+
+ /**
+ * @name Katavorio#select
+ * @function
+ * @desc Adds an element to the current selection (for multiple node drag)
+ * @param {Element|String} DOM element - or id of the element - to add.
+ */
+ this.select = function(el) {
+ _each(el, function() {
+ var _el = _gel(this);
+ if (_el && _el._katavorioDrag) {
+ if (!_selectionMap[_el._katavorio]) {
+ _selection.push(_el._katavorioDrag);
+ _selectionMap[_el._katavorio] = [ _el, _selection.length - 1 ];
+ katavorioParams.addClass(_el, _css.selected);
+ }
+ }
+ });
+ return this;
+ };
+
+ /**
+ * @name Katavorio#deselect
+ * @function
+ * @desc Removes an element from the current selection (for multiple node drag)
+ * @param {Element|String} DOM element - or id of the element - to remove.
+ */
+ this.deselect = function(el) {
+ _each(el, function() {
+ var _el = _gel(this);
+ if (_el && _el._katavorio) {
+ var e = _selectionMap[_el._katavorio];
+ if (e) {
+ var _s = [];
+ for (var i = 0; i < _selection.length; i++)
+ if (_selection[i].el !== _el) _s.push(_selection[i]);
+ _selection = _s;
+ delete _selectionMap[_el._katavorio];
+ katavorioParams.removeClass(_el, _css.selected);
+ }
+ }
+ });
+ return this;
+ };
+
+ this.deselectAll = function() {
+ for (var i in _selectionMap) {
+ var d = _selectionMap[i];
+ katavorioParams.removeClass(d[0], _css.selected);
+ }
+
+ _selection.length = 0;
+ _selectionMap = {};
+ };
+
+ this.markSelection = function(drag) {
+ _foreach(_selection, function(e) { e.mark(); }, drag);
+ };
+
+ this.markPosses = function(drag) {
+ if (drag.posses) {
+ _each(drag.posses, function(p) {
+ if (drag.posseRoles[p] && _posses[p]) {
+ _foreach(_posses[p].members, function (d) {
+ d.mark();
+ }, drag);
+ }
+ })
+ }
+ };
+
+ this.unmarkSelection = function(drag, event) {
+ _foreach(_selection, function(e) { e.unmark(event); }, drag);
+ };
+
+ this.unmarkPosses = function(drag, event) {
+ if (drag.posses) {
+ _each(drag.posses, function(p) {
+ if (drag.posseRoles[p] && _posses[p]) {
+ _foreach(_posses[p].members, function (d) {
+ d.unmark(event, true);
+ }, drag);
+ }
+ });
+ }
+ };
+
+ this.getSelection = function() { return _selection.slice(0); };
+
+ this.updateSelection = function(dx, dy, drag) {
+ _foreach(_selection, function(e) { e.moveBy(dx, dy); }, drag);
+ };
+
+ var _posseAction = function(fn, drag) {
+ if (drag.posses) {
+ _each(drag.posses, function(p) {
+ if (drag.posseRoles[p] && _posses[p]) {
+ _foreach(_posses[p].members, function (e) {
+ fn(e);
+ }, drag);
+ }
+ });
+ }
+ };
+
+ this.updatePosses = function(dx, dy, drag) {
+ _posseAction(function(e) { e.moveBy(dx, dy); }, drag);
+ };
+
+ this.notifyPosseDragStop = function(drag, evt) {
+ _posseAction(function(e) { e.stop(evt, true); }, drag);
+ };
+
+ this.notifySelectionDragStop = function(drag, evt) {
+ _foreach(_selection, function(e) { e.stop(evt, true); }, drag);
+ };
+
+ this.notifySelectionDragStart = function(drag, evt) {
+ _foreach(_selection, function(e) { e.notifyStart(evt);}, drag);
+ };
+
+ this.setZoom = function(z) { _zoom = z; };
+ this.getZoom = function() { return _zoom; };
+
+ // does the work of changing scopes
+ var _scopeManip = function(kObj, scopes, map, fn) {
+ _each(kObj, function(_kObj) {
+ _unreg(_kObj, map); // deregister existing scopes
+ _kObj[fn](scopes); // set scopes
+ _reg(_kObj, map); // register new ones
+ });
+ };
+
+ _each([ "set", "add", "remove", "toggle"], function(v) {
+ this[v + "Scope"] = function(el, scopes) {
+ _scopeManip(el._katavorioDrag, scopes, this._dragsByScope, v + "Scope");
+ _scopeManip(el._katavorioDrop, scopes, this._dropsByScope, v + "Scope");
+ }.bind(this);
+ this[v + "DragScope"] = function(el, scopes) {
+ _scopeManip(el.constructor === Drag ? el : el._katavorioDrag, scopes, this._dragsByScope, v + "Scope");
+ }.bind(this);
+ this[v + "DropScope"] = function(el, scopes) {
+ _scopeManip(el.constructor === Drop ? el : el._katavorioDrop, scopes, this._dropsByScope, v + "Scope");
+ }.bind(this);
+ }.bind(this));
+
+ this.snapToGrid = function(x, y) {
+ for (var s in this._dragsByScope) {
+ _foreach(this._dragsByScope[s], function(d) { d.snap(x, y); });
+ }
+ };
+
+ this.getDragsForScope = function(s) { return this._dragsByScope[s]; };
+ this.getDropsForScope = function(s) { return this._dropsByScope[s]; };
+
+ var _destroy = function(el, type, map) {
+ el = _gel(el);
+ if (el[type]) {
+
+ // remove from selection, if present.
+ var selIdx = _selection.indexOf(el[type]);
+ if (selIdx >= 0) {
+ _selection.splice(selIdx, 1);
+ }
+
+ if (_unreg(el[type], map)) {
+ _each(el[type], function(kObj) { kObj.destroy() });
+ }
+
+ delete el[type];
+ }
+ };
+
+ this.elementRemoved = function(el) {
+ this.destroyDraggable(el);
+ this.destroyDroppable(el);
+ };
+
+ this.destroyDraggable = function(el) {
+ _destroy(el, "_katavorioDrag", this._dragsByScope);
+ };
+
+ this.destroyDroppable = function(el) {
+ _destroy(el, "_katavorioDrop", this._dropsByScope);
+ };
+
+ this.reset = function() {
+ this._dragsByScope = {};
+ this._dropsByScope = {};
+ _selection = [];
+ _selectionMap = {};
+ _posses = {};
+ };
+
+ // ----- groups
+ var _posses = {};
+
+ var _processOneSpec = function(el, _spec, dontAddExisting) {
+ var posseId = _isString(_spec) ? _spec : _spec.id;
+ var active = _isString(_spec) ? true : _spec.active !== false;
+ var posse = _posses[posseId] || (function() {
+ var g = {name:posseId, members:[]};
+ _posses[posseId] = g;
+ return g;
+ })();
+ _each(el, function(_el) {
+ if (_el._katavorioDrag) {
+
+ if (dontAddExisting && _el._katavorioDrag.posseRoles[posse.name] != null) return;
+
+ _suggest(posse.members, _el._katavorioDrag);
+ _suggest(_el._katavorioDrag.posses, posse.name);
+ _el._katavorioDrag.posseRoles[posse.name] = active;
+ }
+ });
+ return posse;
+ };
+
+ /**
+ * Add the given element to the posse with the given id, creating the group if it at first does not exist.
+ * @method addToPosse
+ * @param {Element} el Element to add.
+ * @param {String...|Object...} spec Variable args parameters. Each argument can be a either a String, indicating
+ * the ID of a Posse to which the element should be added as an active participant, or an Object containing
+ * `{ id:"posseId", active:false/true}`. In the latter case, if `active` is not provided it is assumed to be
+ * true.
+ * @returns {Posse|Posse[]} The Posse(s) to which the element(s) was/were added.
+ */
+ this.addToPosse = function(el, spec) {
+
+ var posses = [];
+
+ for (var i = 1; i < arguments.length; i++) {
+ posses.push(_processOneSpec(el, arguments[i]));
+ }
+
+ return posses.length == 1 ? posses[0] : posses;
+ };
+
+ /**
+ * Sets the posse(s) for the element with the given id, creating those that do not yet exist, and removing from
+ * the element any current Posses that are not specified by this method call. This method will not change the
+ * active/passive state if it is given a posse in which the element is already a member.
+ * @method setPosse
+ * @param {Element} el Element to set posse(s) on.
+ * @param {String...|Object...} spec Variable args parameters. Each argument can be a either a String, indicating
+ * the ID of a Posse to which the element should be added as an active participant, or an Object containing
+ * `{ id:"posseId", active:false/true}`. In the latter case, if `active` is not provided it is assumed to be
+ * true.
+ * @returns {Posse|Posse[]} The Posse(s) to which the element(s) now belongs.
+ */
+ this.setPosse = function(el, spec) {
+
+ var posses = [];
+
+ for (var i = 1; i < arguments.length; i++) {
+ posses.push(_processOneSpec(el, arguments[i], true).name);
+ }
+
+ _each(el, function(_el) {
+ if (_el._katavorioDrag) {
+ var diff = _difference(_el._katavorioDrag.posses, posses);
+ var p = [];
+ Array.prototype.push.apply(p, _el._katavorioDrag.posses);
+ for (var i = 0; i < diff.length; i++) {
+ this.removeFromPosse(_el, diff[i]);
+ }
+ }
+ }.bind(this));
+
+ return posses.length == 1 ? posses[0] : posses;
+ };
+
+ /**
+ * Remove the given element from the given posse(s).
+ * @method removeFromPosse
+ * @param {Element} el Element to remove.
+ * @param {String...} posseId Varargs parameter: one value for each posse to remove the element from.
+ */
+ this.removeFromPosse = function(el, posseId) {
+ if (arguments.length < 2) throw new TypeError("No posse id provided for remove operation");
+ for(var i = 1; i < arguments.length; i++) {
+ posseId = arguments[i];
+ _each(el, function (_el) {
+ if (_el._katavorioDrag && _el._katavorioDrag.posses) {
+ var d = _el._katavorioDrag;
+ _each(posseId, function (p) {
+ _vanquish(_posses[p].members, d);
+ _vanquish(d.posses, p);
+ delete d.posseRoles[p];
+ });
+ }
+ });
+ }
+ };
+
+ /**
+ * Remove the given element from all Posses to which it belongs.
+ * @method removeFromAllPosses
+ * @param {Element|Element[]} el Element to remove from Posses.
+ */
+ this.removeFromAllPosses = function(el) {
+ _each(el, function(_el) {
+ if (_el._katavorioDrag && _el._katavorioDrag.posses) {
+ var d = _el._katavorioDrag;
+ _each(d.posses, function(p) {
+ _vanquish(_posses[p].members, d);
+ });
+ d.posses.length = 0;
+ d.posseRoles = {};
+ }
+ });
+ };
+
+ /**
+ * Changes the participation state for the element in the Posse with the given ID.
+ * @param {Element|Element[]} el Element(s) to change state for.
+ * @param {String} posseId ID of the Posse to change element state for.
+ * @param {Boolean} state True to make active, false to make passive.
+ */
+ this.setPosseState = function(el, posseId, state) {
+ var posse = _posses[posseId];
+ if (posse) {
+ _each(el, function(_el) {
+ if (_el._katavorioDrag && _el._katavorioDrag.posses) {
+ _el._katavorioDrag.posseRoles[posse.name] = state;
+ }
+ });
+ }
+ };
+
+ };
+
+ root.Katavorio.version = "0.19.2";
+
+ if (true) {
+ exports.Katavorio = root.Katavorio;
+ }
+
+}).call(typeof window !== 'undefined' ? window : this);
+
+/*
+ * jsPlumb
+ *
+ * Title:jsPlumb 2.3.0
+ *
+ * Provides a way to visually connect elements on an HTML page, using SVG.
+ *
+ * This file contains utility functions that run in both browsers and headless.
+ *
+ * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
+ *
+ * http://jsplumbtoolkit.com
+ * http://github.com/sporritt/jsplumb
+ *
+ * Dual licensed under the MIT and GPL2 licenses.
+ */
+
+;
+(function () {
+
+ var _isa = function (a) {
+ return Object.prototype.toString.call(a) === "[object Array]";
+ },
+ _isnum = function (n) {
+ return Object.prototype.toString.call(n) === "[object Number]";
+ },
+ _iss = function (s) {
+ return typeof s === "string";
+ },
+ _isb = function (s) {
+ return typeof s === "boolean";
+ },
+ _isnull = function (s) {
+ return s == null;
+ },
+ _iso = function (o) {
+ return o == null ? false : Object.prototype.toString.call(o) === "[object Object]";
+ },
+ _isd = function (o) {
+ return Object.prototype.toString.call(o) === "[object Date]";
+ },
+ _isf = function (o) {
+ return Object.prototype.toString.call(o) === "[object Function]";
+ },
+ _isNamedFunction = function(o) {
+ return _isf(o) && o.name != null && o.name.length > 0;
+ },
+ _ise = function (o) {
+ for (var i in o) {
+ if (o.hasOwnProperty(i)) {
+ return false;
+ }
+ }
+ return true;
+ };
+
+ var root = this;
+ root.jsPlumbUtil = {
+ isArray: _isa,
+ isString: _iss,
+ isBoolean: _isb,
+ isNull: _isnull,
+ isObject: _iso,
+ isDate: _isd,
+ isFunction: _isf,
+ isEmpty: _ise,
+ isNumber: _isnum,
+ clone: function (a) {
+ if (_iss(a)) {
+ return "" + a;
+ }
+ else if (_isb(a)) {
+ return !!a;
+ }
+ else if (_isd(a)) {
+ return new Date(a.getTime());
+ }
+ else if (_isf(a)) {
+ return a;
+ }
+ else if (_isa(a)) {
+ var b = [];
+ for (var i = 0; i < a.length; i++) {
+ b.push(this.clone(a[i]));
+ }
+ return b;
+ }
+ else if (_iso(a)) {
+ var c = {};
+ for (var j in a) {
+ c[j] = this.clone(a[j]);
+ }
+ return c;
+ }
+ else {
+ return a;
+ }
+ },
+ merge: function (a, b, collations) {
+ // first change the collations array - if present - into a lookup table, because its faster.
+ var cMap = {}, ar, i;
+ collations = collations || [];
+ for (i = 0; i < collations.length; i++) {
+ cMap[collations[i]] = true;
+ }
+
+ var c = this.clone(a);
+ for (i in b) {
+ if (c[i] == null) {
+ c[i] = b[i];
+ }
+ else if (_iss(b[i]) || _isb(b[i])) {
+ if (!cMap[i]) {
+ c[i] = b[i]; // if we dont want to collate, just copy it in.
+ }
+ else {
+ ar = [];
+ // if c's object is also an array we can keep its values.
+ ar.push.apply(ar, _isa(c[i]) ? c[i] : [ c[i] ]);
+ ar.push.apply(ar, _isa(b[i]) ? b[i] : [ b[i] ]);
+ c[i] = ar;
+ }
+ }
+ else {
+ if (_isa(b[i])) {
+ ar = [];
+ // if c's object is also an array we can keep its values.
+ if (_isa(c[i])) {
+ ar.push.apply(ar, c[i]);
+ }
+ ar.push.apply(ar, b[i]);
+ c[i] = ar;
+ }
+ else if (_iso(b[i])) {
+ // overwite c's value with an object if it is not already one.
+ if (!_iso(c[i])) {
+ c[i] = {};
+ }
+ for (var j in b[i]) {
+ c[i][j] = b[i][j];
+ }
+ }
+ }
+
+ }
+ return c;
+ },
+ replace: function (inObj, path, value) {
+ if (inObj == null) {
+ return;
+ }
+ var q = inObj, t = q;
+ path.replace(/([^\.])+/g, function (term, lc, pos, str) {
+ var array = term.match(/([^\[0-9]+){1}(\[)([0-9+])/),
+ last = pos + term.length >= str.length,
+ _getArray = function () {
+ return t[array[1]] || (function () {
+ t[array[1]] = [];
+ return t[array[1]];
+ })();
+ };
+
+ if (last) {
+ // set term = value on current t, creating term as array if necessary.
+ if (array) {
+ _getArray()[array[3]] = value;
+ }
+ else {
+ t[term] = value;
+ }
+ }
+ else {
+ // set to current t[term], creating t[term] if necessary.
+ if (array) {
+ var a = _getArray();
+ t = a[array[3]] || (function () {
+ a[array[3]] = {};
+ return a[array[3]];
+ })();
+ }
+ else {
+ t = t[term] || (function () {
+ t[term] = {};
+ return t[term];
+ })();
+ }
+ }
+ });
+
+ return inObj;
+ },
+ //
+ // chain a list of functions, supplied by [ object, method name, args ], and return on the first
+ // one that returns the failValue. if none return the failValue, return the successValue.
+ //
+ functionChain: function (successValue, failValue, fns) {
+ for (var i = 0; i < fns.length; i++) {
+ var o = fns[i][0][fns[i][1]].apply(fns[i][0], fns[i][2]);
+ if (o === failValue) {
+ return o;
+ }
+ }
+ return successValue;
+ },
+ // take the given model and expand out any parameters.
+ // 'functionPrefix' is optional, and if present, helps jsplumb figure out what to do if a value is a Function.
+ // if you do not provide it, jsplumb will run the given values through any functions it finds, and use the function's
+ // output as the value in the result. if you do provide the prefix, only functions that are named and have this prefix
+ // will be executed; other functions will be passed as values to the output.
+ populate: function (model, values, functionPrefix) {
+ // for a string, see if it has parameter matches, and if so, try to make the substitutions.
+ var getValue = function (fromString) {
+ var matches = fromString.match(/(\${.*?})/g);
+ if (matches != null) {
+ for (var i = 0; i < matches.length; i++) {
+ var val = values[matches[i].substring(2, matches[i].length - 1)] || "";
+ if (val != null) {
+ fromString = fromString.replace(matches[i], val);
+ }
+ }
+ }
+ return fromString;
+ },
+ // process one entry.
+ _one = function (d) {
+ if (d != null) {
+ if (_iss(d)) {
+ return getValue(d);
+ }
+ else if (_isf(d) && (functionPrefix == null || (d.name || "").indexOf(functionPrefix) === 0)) {
+ return d(values);
+ }
+ else if (_isa(d)) {
+ var r = [];
+ for (var i = 0; i < d.length; i++) {
+ r.push(_one(d[i]));
+ }
+ return r;
+ }
+ else if (_iso(d)) {
+ var s = {};
+ for (var j in d) {
+ s[j] = _one(d[j]);
+ }
+ return s;
+ }
+ else {
+ return d;
+ }
+ }
+ };
+
+ return _one(model);
+ },
+ findWithFunction: function (a, f) {
+ if (a) {
+ for (var i = 0; i < a.length; i++) {
+ if (f(a[i])) {
+ return i;
+ }
+ }
+ }
+ return -1;
+ },
+ removeWithFunction: function (a, f) {
+ var idx = root.jsPlumbUtil.findWithFunction(a, f);
+ if (idx > -1) {
+ a.splice(idx, 1);
+ }
+ return idx !== -1;
+ },
+ remove: function (l, v) {
+ var idx = l.indexOf(v);
+ if (idx > -1) {
+ l.splice(idx, 1);
+ }
+ return idx !== -1;
+ },
+ // TODO support insert index
+ addWithFunction: function (list, item, hashFunction) {
+ if (root.jsPlumbUtil.findWithFunction(list, hashFunction) === -1) {
+ list.push(item);
+ }
+ },
+ addToList: function (map, key, value, insertAtStart) {
+ var l = map[key];
+ if (l == null) {
+ l = [];
+ map[key] = l;
+ }
+ l[insertAtStart ? "unshift" : "push"](value);
+ return l;
+ },
+ suggest : function(list, item, insertAtHead) {
+ if (list.indexOf(item) === -1) {
+ if (insertAtHead) {
+ list.unshift(item);
+ } else {
+ list.push(item);
+ }
+ return true;
+ }
+ return false;
+ },
+ //
+ // extends the given obj (which can be an array) with the given constructor function, prototype functions, and
+ // class members, any of which may be null.
+ //
+ extend: function (child, parent, _protoFn) {
+ var i;
+ parent = _isa(parent) ? parent : [ parent ];
+
+ for (i = 0; i < parent.length; i++) {
+ for (var j in parent[i].prototype) {
+ if (parent[i].prototype.hasOwnProperty(j)) {
+ child.prototype[j] = parent[i].prototype[j];
+ }
+ }
+ }
+
+ var _makeFn = function (name, protoFn) {
+ return function () {
+ for (i = 0; i < parent.length; i++) {
+ if (parent[i].prototype[name]) {
+ parent[i].prototype[name].apply(this, arguments);
+ }
+ }
+ return protoFn.apply(this, arguments);
+ };
+ };
+
+ var _oneSet = function (fns) {
+ for (var k in fns) {
+ child.prototype[k] = _makeFn(k, fns[k]);
+ }
+ };
+
+ if (arguments.length > 2) {
+ for (i = 2; i < arguments.length; i++) {
+ _oneSet(arguments[i]);
+ }
+ }
+
+ return child;
+ },
+ uuid: function () {
+ return ('xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
+ var r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8);
+ return v.toString(16);
+ }));
+ },
+ logEnabled: true,
+ log: function () {
+ if (root.jsPlumbUtil.logEnabled && typeof console !== "undefined") {
+ try {
+ var msg = arguments[arguments.length - 1];
+ console.log(msg);
+ }
+ catch (e) {
+ }
+ }
+ },
+
+ /**
+ * Wraps one function with another, creating a placeholder for the
+ * wrapped function if it was null. this is used to wrap the various
+ * drag/drop event functions - to allow jsPlumb to be notified of
+ * important lifecycle events without imposing itself on the user's
+ * drag/drop functionality.
+ * @method jsPlumbUtil.wrap
+ * @param {Function} wrappedFunction original function to wrap; may be null.
+ * @param {Function} newFunction function to wrap the original with.
+ * @param {Object} [returnOnThisValue] Optional. Indicates that the wrappedFunction should
+ * not be executed if the newFunction returns a value matching 'returnOnThisValue'.
+ * note that this is a simple comparison and only works for primitives right now.
+ */
+ wrap: function (wrappedFunction, newFunction, returnOnThisValue) {
+ wrappedFunction = wrappedFunction || function () {
+ };
+ newFunction = newFunction || function () {
+ };
+ return function () {
+ var r = null;
+ try {
+ r = newFunction.apply(this, arguments);
+ } catch (e) {
+ root.jsPlumbUtil.log("jsPlumb function failed : " + e);
+ }
+ if (returnOnThisValue == null || (r !== returnOnThisValue)) {
+ try {
+ r = wrappedFunction.apply(this, arguments);
+ } catch (e) {
+ root.jsPlumbUtil.log("wrapped function failed : " + e);
+ }
+ }
+ return r;
+ };
+ }
+ };
+
+ root.jsPlumbUtil.EventGenerator = function () {
+ var _listeners = {},
+ eventsSuspended = false,
+ tick = false,
+ // this is a list of events that should re-throw any errors that occur during their dispatch. it is current private.
+ eventsToDieOn = { "ready": true },
+ queue = [];
+
+ this.bind = function (event, listener, insertAtStart) {
+ var _one = function(evt) {
+ root.jsPlumbUtil.addToList(_listeners, evt, listener, insertAtStart);
+ listener.__jsPlumb = listener.__jsPlumb || {};
+ listener.__jsPlumb[root.jsPlumbUtil.uuid()] = evt;
+ };
+
+ if (typeof event === "string") {
+ _one(event);
+ }
+ else if (event.length != null) {
+ for (var i = 0; i < event.length; i++) {
+ _one(event[i]);
+ }
+ }
+
+ return this;
+ };
+
+ this.fire = function (event, value, originalEvent) {
+ if (!tick) {
+ tick = true;
+ if (!eventsSuspended && _listeners[event]) {
+ var l = _listeners[event].length, i = 0, _gone = false, ret = null;
+ if (!this.shouldFireEvent || this.shouldFireEvent(event, value, originalEvent)) {
+ while (!_gone && i < l && ret !== false) {
+ // doing it this way rather than catching and then possibly re-throwing means that an error propagated by this
+ // method will have the whole call stack available in the debugger.
+ if (eventsToDieOn[event]) {
+ _listeners[event][i].apply(this, [value, originalEvent]);
+ }
+ else {
+ try {
+ ret = _listeners[event][i].apply(this, [value, originalEvent]);
+ } catch (e) {
+ root.jsPlumbUtil.log("jsPlumb: fire failed for event " + event + " : " + e);
+ }
+ }
+ i++;
+ if (_listeners == null || _listeners[event] == null) {
+ _gone = true;
+ }
+ }
+ }
+ }
+ tick = false;
+ _drain();
+ } else {
+ queue.unshift(arguments);
+ }
+ return this;
+ };
+
+ var _drain = function() {
+ var n = queue.pop();
+ if (n) {
+ this.fire.apply(this, n);
+ }
+ }.bind(this);
+
+ this.unbind = function (eventOrListener, listener) {
+
+ if (arguments.length === 0) {
+ _listeners = {};
+ }
+ else if (arguments.length === 1) {
+ if (typeof eventOrListener === "string") {
+ delete _listeners[eventOrListener];
+ }
+ else if (eventOrListener.__jsPlumb) {
+ var evt;
+ for (var i in eventOrListener.__jsPlumb) {
+ evt = eventOrListener.__jsPlumb[i];
+ root.jsPlumbUtil.remove(_listeners[evt] || [], eventOrListener);
+ }
+ }
+ }
+ else if (arguments.length === 2) {
+ root.jsPlumbUtil.remove(_listeners[eventOrListener] || [], listener);
+ }
+
+ return this;
+ };
+
+ this.getListener = function (forEvent) {
+ return _listeners[forEvent];
+ };
+ this.setSuspendEvents = function (val) {
+ eventsSuspended = val;
+ };
+ this.isSuspendEvents = function () {
+ return eventsSuspended;
+ };
+ this.silently = function(fn) {
+ this.setSuspendEvents(true);
+ try {
+ fn();
+ }
+ catch (e) {
+ root.jsPlumbUtil.log("Cannot execute silent function " + e);
+ }
+ this.setSuspendEvents(false);
+ };
+ this.cleanupListeners = function () {
+ for (var i in _listeners) {
+ _listeners[i] = null;
+ }
+ };
+ };
+
+ root.jsPlumbUtil.EventGenerator.prototype = {
+ cleanup: function () {
+ this.cleanupListeners();
+ }
+ };
+
+ if (true) {
+ exports.jsPlumbUtil = root.jsPlumbUtil;
+ }
+
+}).call(typeof window !== 'undefined' ? window : this);
+
+/*
+ * jsPlumb Community Edition
+ *
+ * Provides a way to visually connect elements on an HTML page, using SVG.
+ *
+ * This file contains utility functions that run in browsers only.
+ *
+ * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
+ *
+ * https://jsplumbtoolkit.com
+ * https://github.com/jsplumb/jsplumb
+ *
+ * Dual licensed under the MIT and GPL2 licenses.
+ */
+ ;(function() {
+
+ "use strict";
+
+ var root = this;
+
+ root.jsPlumbUtil.matchesSelector = function(el, selector, ctx) {
+ ctx = ctx || el.parentNode;
+ var possibles = ctx.querySelectorAll(selector);
+ for (var i = 0; i < possibles.length; i++) {
+ if (possibles[i] === el) {
+ return true;
+ }
+ }
+ return false;
+ };
+
+ root.jsPlumbUtil.consume = function(e, doNotPreventDefault) {
+ if (e.stopPropagation) {
+ e.stopPropagation();
+ }
+ else {
+ e.returnValue = false;
+ }
+
+ if (!doNotPreventDefault && e.preventDefault){
+ e.preventDefault();
+ }
+ };
+
+ /*
+ * Function: sizeElement
+ * Helper to size and position an element. You would typically use
+ * this when writing your own Connector or Endpoint implementation.
+ *
+ * Parameters:
+ * x - [int] x position for the element origin
+ * y - [int] y position for the element origin
+ * w - [int] width of the element
+ * h - [int] height of the element
+ *
+ */
+ root.jsPlumbUtil.sizeElement = function(el, x, y, w, h) {
+ if (el) {
+ el.style.height = h + "px";
+ el.height = h;
+ el.style.width = w + "px";
+ el.width = w;
+ el.style.left = x + "px";
+ el.style.top = y + "px";
+ }
+ };
+
+ }).call(typeof window !== 'undefined' ? window : this);
+
+/*
+ * jsPlumb
+ *
+ * Title:jsPlumb 2.3.0
+ *
+ * Provides a way to visually connect elements on an HTML page, using SVG.
+ *
+ * This file contains the core code.
+ *
+ * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
+ *
+ * http://jsplumbtoolkit.com
+ * http://github.com/sporritt/jsplumb
+ *
+ * Dual licensed under the MIT and GPL2 licenses.
+ */
+(function () {
+
+ "use strict";
+
+ var root = this;
+ var connectorTypes = [], rendererTypes;
+
+ var _ju = root.jsPlumbUtil,
+
+ /**
+ * creates a timestamp, using milliseconds since 1970, but as a string.
+ */
+ _timestamp = function () {
+ return "" + (new Date()).getTime();
+ },
+
+ // helper method to update the hover style whenever it, or paintStyle, changes.
+ // we use paintStyle as the foundation and merge hoverPaintStyle over the
+ // top.
+ _updateHoverStyle = function (component) {
+ if (component._jsPlumb.paintStyle && component._jsPlumb.hoverPaintStyle) {
+ var mergedHoverStyle = {};
+ jsPlumb.extend(mergedHoverStyle, component._jsPlumb.paintStyle);
+ jsPlumb.extend(mergedHoverStyle, component._jsPlumb.hoverPaintStyle);
+ delete component._jsPlumb.hoverPaintStyle;
+ // we want the fill of paintStyle to override a gradient, if possible.
+ if (mergedHoverStyle.gradient && component._jsPlumb.paintStyle.fill) {
+ delete mergedHoverStyle.gradient;
+ }
+ component._jsPlumb.hoverPaintStyle = mergedHoverStyle;
+ }
+ },
+ events = ["tap", "dbltap", "click", "dblclick", "mouseover", "mouseout", "mousemove", "mousedown", "mouseup", "contextmenu" ],
+ eventFilters = { "mouseout": "mouseleave", "mouseexit": "mouseleave" },
+ _updateAttachedElements = function (component, state, timestamp, sourceElement) {
+ var affectedElements = component.getAttachedElements();
+ if (affectedElements) {
+ for (var i = 0, j = affectedElements.length; i < j; i++) {
+ if (!sourceElement || sourceElement !== affectedElements[i]) {
+ affectedElements[i].setHover(state, true, timestamp); // tell the attached elements not to inform their own attached elements.
+ }
+ }
+ }
+ },
+ _splitType = function (t) {
+ return t == null ? null : t.split(" ");
+ },
+ _mapType = function(map, obj, typeId) {
+ for (var i in obj) {
+ map[i] = typeId;
+ }
+ },
+ _each = function(fn, obj) {
+ obj = _ju.isArray(obj) || (obj.length != null && !_ju.isString(obj)) ? obj : [ obj ];
+ for (var i = 0; i < obj.length; i++) {
+ try {
+ fn.apply(obj[i], [ obj[i] ]);
+ }
+ catch (e) {
+ _ju.log(".each iteration failed : " + e);
+ }
+ }
+ },
+ _applyTypes = function (component, params, doNotRepaint) {
+ if (component.getDefaultType) {
+ var td = component.getTypeDescriptor(), map = {};
+ var defType = component.getDefaultType();
+ var o = _ju.merge({}, defType);
+ _mapType(map, defType, "__default");
+ for (var i = 0, j = component._jsPlumb.types.length; i < j; i++) {
+ var tid = component._jsPlumb.types[i];
+ if (tid !== "__default") {
+ var _t = component._jsPlumb.instance.getType(tid, td);
+ if (_t != null) {
+ o = _ju.merge(o, _t, [ "cssClass" ]);
+ _mapType(map, _t, tid);
+ }
+ }
+ }
+
+ if (params) {
+ o = _ju.populate(o, params, "_");
+ }
+
+ component.applyType(o, doNotRepaint, map);
+ if (!doNotRepaint) {
+ component.repaint();
+ }
+ }
+ },
+
+// ------------------------------ BEGIN jsPlumbUIComponent --------------------------------------------
+
+ jsPlumbUIComponent = root.jsPlumbUIComponent = function (params) {
+
+ _ju.EventGenerator.apply(this, arguments);
+
+ var self = this,
+ a = arguments,
+ idPrefix = self.idPrefix,
+ id = idPrefix + (new Date()).getTime();
+
+ this._jsPlumb = {
+ instance: params._jsPlumb,
+ parameters: params.parameters || {},
+ paintStyle: null,
+ hoverPaintStyle: null,
+ paintStyleInUse: null,
+ hover: false,
+ beforeDetach: params.beforeDetach,
+ beforeDrop: params.beforeDrop,
+ overlayPlacements: [],
+ hoverClass: params.hoverClass || params._jsPlumb.Defaults.HoverClass,
+ types: [],
+ typeCache:{}
+ };
+
+ this.cacheTypeItem = function(key, item, typeId) {
+ this._jsPlumb.typeCache[typeId] = this._jsPlumb.typeCache[typeId] || {};
+ this._jsPlumb.typeCache[typeId][key] = item;
+ };
+ this.getCachedTypeItem = function(key, typeId) {
+ return this._jsPlumb.typeCache[typeId] ? this._jsPlumb.typeCache[typeId][key] : null;
+ };
+
+ this.getId = function () {
+ return id;
+ };
+
+// ----------------------------- default type --------------------------------------------
+
+
+ var o = params.overlays || [], oo = {};
+ if (this.defaultOverlayKeys) {
+ for (var i = 0; i < this.defaultOverlayKeys.length; i++) {
+ Array.prototype.push.apply(o, this._jsPlumb.instance.Defaults[this.defaultOverlayKeys[i]] || []);
+ }
+
+ for (i = 0; i < o.length; i++) {
+ // if a string, convert to object representation so that we can store the typeid on it.
+ // also assign an id.
+ var fo = jsPlumb.convertToFullOverlaySpec(o[i]);
+ oo[fo[1].id] = fo;
+ }
+ }
+
+ var _defaultType = {
+ overlays:oo,
+ parameters: params.parameters || {},
+ scope: params.scope || this._jsPlumb.instance.getDefaultScope()
+ };
+ this.getDefaultType = function() {
+ return _defaultType;
+ };
+ this.appendToDefaultType = function(obj) {
+ for (var i in obj) {
+ _defaultType[i] = obj[i];
+ }
+ };
+
+// ----------------------------- end default type --------------------------------------------
+
+ // all components can generate events
+
+ if (params.events) {
+ for (var evtName in params.events) {
+ self.bind(evtName, params.events[evtName]);
+ }
+ }
+
+ // all components get this clone function.
+ // TODO issue 116 showed a problem with this - it seems 'a' that is in
+ // the clone function's scope is shared by all invocations of it, the classic
+ // JS closure problem. for now, jsPlumb does a version of this inline where
+ // it used to call clone. but it would be nice to find some time to look
+ // further at this.
+ this.clone = function () {
+ var o = Object.create(this.constructor.prototype);
+ this.constructor.apply(o, a);
+ return o;
+ }.bind(this);
+
+ // user can supply a beforeDetach callback, which will be executed before a detach
+ // is performed; returning false prevents the detach.
+ this.isDetachAllowed = function (connection) {
+ var r = true;
+ if (this._jsPlumb.beforeDetach) {
+ try {
+ r = this._jsPlumb.beforeDetach(connection);
+ }
+ catch (e) {
+ _ju.log("jsPlumb: beforeDetach callback failed", e);
+ }
+ }
+ return r;
+ };
+
+ // user can supply a beforeDrop callback, which will be executed before a dropped
+ // connection is confirmed. user can return false to reject connection.
+ this.isDropAllowed = function (sourceId, targetId, scope, connection, dropEndpoint, source, target) {
+ var r = this._jsPlumb.instance.checkCondition("beforeDrop", {
+ sourceId: sourceId,
+ targetId: targetId,
+ scope: scope,
+ connection: connection,
+ dropEndpoint: dropEndpoint,
+ source: source, target: target
+ });
+ if (this._jsPlumb.beforeDrop) {
+ try {
+ r = this._jsPlumb.beforeDrop({
+ sourceId: sourceId,
+ targetId: targetId,
+ scope: scope,
+ connection: connection,
+ dropEndpoint: dropEndpoint,
+ source: source, target: target
+ });
+ }
+ catch (e) {
+ _ju.log("jsPlumb: beforeDrop callback failed", e);
+ }
+ }
+ return r;
+ };
+
+ var domListeners = [];
+
+ // sets the component associated with listener events. for instance, an overlay delegates
+ // its events back to a connector. but if the connector is swapped on the underlying connection,
+ // then this component must be changed. This is called by setConnector in the Connection class.
+ this.setListenerComponent = function (c) {
+ for (var i = 0; i < domListeners.length; i++) {
+ domListeners[i][3] = c;
+ }
+ };
+
+
+ };
+
+ var _removeTypeCssHelper = function (component, typeIndex) {
+ var typeId = component._jsPlumb.types[typeIndex],
+ type = component._jsPlumb.instance.getType(typeId, component.getTypeDescriptor());
+
+ if (type != null && type.cssClass && component.canvas) {
+ component._jsPlumb.instance.removeClass(component.canvas, type.cssClass);
+ }
+ };
+
+ _ju.extend(root.jsPlumbUIComponent, _ju.EventGenerator, {
+
+ getParameter: function (name) {
+ return this._jsPlumb.parameters[name];
+ },
+
+ setParameter: function (name, value) {
+ this._jsPlumb.parameters[name] = value;
+ },
+
+ getParameters: function () {
+ return this._jsPlumb.parameters;
+ },
+
+ setParameters: function (p) {
+ this._jsPlumb.parameters = p;
+ },
+
+ getClass:function() {
+ return jsPlumb.getClass(this.canvas);
+ },
+
+ hasClass:function(clazz) {
+ return jsPlumb.hasClass(this.canvas, clazz);
+ },
+
+ addClass: function (clazz) {
+ jsPlumb.addClass(this.canvas, clazz);
+ },
+
+ removeClass: function (clazz) {
+ jsPlumb.removeClass(this.canvas, clazz);
+ },
+
+ updateClasses: function (classesToAdd, classesToRemove) {
+ jsPlumb.updateClasses(this.canvas, classesToAdd, classesToRemove);
+ },
+
+ setType: function (typeId, params, doNotRepaint) {
+ this.clearTypes();
+ this._jsPlumb.types = _splitType(typeId) || [];
+ _applyTypes(this, params, doNotRepaint);
+ },
+
+ getType: function () {
+ return this._jsPlumb.types;
+ },
+
+ reapplyTypes: function (params, doNotRepaint) {
+ _applyTypes(this, params, doNotRepaint);
+ },
+
+ hasType: function (typeId) {
+ return this._jsPlumb.types.indexOf(typeId) !== -1;
+ },
+
+ addType: function (typeId, params, doNotRepaint) {
+ var t = _splitType(typeId), _cont = false;
+ if (t != null) {
+ for (var i = 0, j = t.length; i < j; i++) {
+ if (!this.hasType(t[i])) {
+ this._jsPlumb.types.push(t[i]);
+ _cont = true;
+ }
+ }
+ if (_cont) {
+ _applyTypes(this, params, doNotRepaint);
+ }
+ }
+ },
+
+ removeType: function (typeId, params, doNotRepaint) {
+ var t = _splitType(typeId), _cont = false, _one = function (tt) {
+ var idx = this._jsPlumb.types.indexOf(tt);
+ if (idx !== -1) {
+ // remove css class if necessary
+ _removeTypeCssHelper(this, idx);
+ this._jsPlumb.types.splice(idx, 1);
+ return true;
+ }
+ return false;
+ }.bind(this);
+
+ if (t != null) {
+ for (var i = 0, j = t.length; i < j; i++) {
+ _cont = _one(t[i]) || _cont;
+ }
+ if (_cont) {
+ _applyTypes(this, params, doNotRepaint);
+ }
+ }
+ },
+ clearTypes: function (params, doNotRepaint) {
+ var i = this._jsPlumb.types.length;
+ for (var j = 0; j < i; j++) {
+ _removeTypeCssHelper(this, 0);
+ this._jsPlumb.types.splice(0, 1);
+ }
+ _applyTypes(this, params, doNotRepaint);
+ },
+
+ toggleType: function (typeId, params, doNotRepaint) {
+ var t = _splitType(typeId);
+ if (t != null) {
+ for (var i = 0, j = t.length; i < j; i++) {
+ var idx = this._jsPlumb.types.indexOf(t[i]);
+ if (idx !== -1) {
+ _removeTypeCssHelper(this, idx);
+ this._jsPlumb.types.splice(idx, 1);
+ }
+ else {
+ this._jsPlumb.types.push(t[i]);
+ }
+ }
+
+ _applyTypes(this, params, doNotRepaint);
+ }
+ },
+ applyType: function (t, doNotRepaint) {
+ this.setPaintStyle(t.paintStyle, doNotRepaint);
+ this.setHoverPaintStyle(t.hoverPaintStyle, doNotRepaint);
+ if (t.parameters) {
+ for (var i in t.parameters) {
+ this.setParameter(i, t.parameters[i]);
+ }
+ }
+ this._jsPlumb.paintStyleInUse = this.getPaintStyle();
+ },
+ setPaintStyle: function (style, doNotRepaint) {
+ // this._jsPlumb.paintStyle = jsPlumb.extend({}, style);
+ // TODO figure out if we want components to clone paintStyle so as not to share it.
+ this._jsPlumb.paintStyle = style;
+ this._jsPlumb.paintStyleInUse = this._jsPlumb.paintStyle;
+ _updateHoverStyle(this);
+ if (!doNotRepaint) {
+ this.repaint();
+ }
+ },
+ getPaintStyle: function () {
+ return this._jsPlumb.paintStyle;
+ },
+ setHoverPaintStyle: function (style, doNotRepaint) {
+ //this._jsPlumb.hoverPaintStyle = jsPlumb.extend({}, style);
+ // TODO figure out if we want components to clone paintStyle so as not to share it.
+ this._jsPlumb.hoverPaintStyle = style;
+ _updateHoverStyle(this);
+ if (!doNotRepaint) {
+ this.repaint();
+ }
+ },
+ getHoverPaintStyle: function () {
+ return this._jsPlumb.hoverPaintStyle;
+ },
+ destroy: function (force) {
+ if (force || this.typeId == null) {
+ this.cleanupListeners(); // this is on EventGenerator
+ this.clone = null;
+ this._jsPlumb = null;
+ }
+ },
+
+ isHover: function () {
+ return this._jsPlumb.hover;
+ },
+
+ setHover: function (hover, ignoreAttachedElements, timestamp) {
+ // while dragging, we ignore these events. this keeps the UI from flashing and
+ // swishing and whatevering.
+ if (this._jsPlumb && !this._jsPlumb.instance.currentlyDragging && !this._jsPlumb.instance.isHoverSuspended()) {
+
+ this._jsPlumb.hover = hover;
+ var method = hover ? "addClass" : "removeClass";
+
+ if (this.canvas != null) {
+ if (this._jsPlumb.instance.hoverClass != null) {
+ this._jsPlumb.instance[method](this.canvas, this._jsPlumb.instance.hoverClass);
+ }
+ if (this._jsPlumb.hoverClass != null) {
+ this._jsPlumb.instance[method](this.canvas, this._jsPlumb.hoverClass);
+ }
+ }
+ if (this._jsPlumb.hoverPaintStyle != null) {
+ this._jsPlumb.paintStyleInUse = hover ? this._jsPlumb.hoverPaintStyle : this._jsPlumb.paintStyle;
+ if (!this._jsPlumb.instance.isSuspendDrawing()) {
+ timestamp = timestamp || _timestamp();
+ this.repaint({timestamp: timestamp, recalc: false});
+ }
+ }
+ // get the list of other affected elements, if supported by this component.
+ // for a connection, its the endpoints. for an endpoint, its the connections! surprise.
+ if (this.getAttachedElements && !ignoreAttachedElements) {
+ _updateAttachedElements(this, hover, _timestamp(), this);
+ }
+ }
+ }
+ });
+
+// ------------------------------ END jsPlumbUIComponent --------------------------------------------
+
+ var _jsPlumbInstanceIndex = 0,
+ getInstanceIndex = function () {
+ var i = _jsPlumbInstanceIndex + 1;
+ _jsPlumbInstanceIndex++;
+ return i;
+ };
+
+ var jsPlumbInstance = root.jsPlumbInstance = function (_defaults) {
+
+ this.version = "2.5.1";
+
+ if (_defaults) {
+ jsPlumb.extend(this.Defaults, _defaults);
+ }
+
+ this.logEnabled = this.Defaults.LogEnabled;
+ this._connectionTypes = {};
+ this._endpointTypes = {};
+
+ _ju.EventGenerator.apply(this);
+
+ var _currentInstance = this,
+ _instanceIndex = getInstanceIndex(),
+ _bb = _currentInstance.bind,
+ _initialDefaults = {},
+ _zoom = 1,
+ _info = function (el) {
+ if (el == null) {
+ return null;
+ }
+ else if (el.nodeType === 3 || el.nodeType === 8) {
+ return { el:el, text:true };
+ }
+ else {
+ var _el = _currentInstance.getElement(el);
+ return { el: _el, id: (_ju.isString(el) && _el == null) ? el : _getId(_el) };
+ }
+ };
+
+ this.getInstanceIndex = function () {
+ return _instanceIndex;
+ };
+
+ this.setZoom = function (z, repaintEverything) {
+ _zoom = z;
+ _currentInstance.fire("zoom", _zoom);
+ if (repaintEverything) {
+ _currentInstance.repaintEverything();
+ }
+ return true;
+ };
+ this.getZoom = function () {
+ return _zoom;
+ };
+
+ for (var i in this.Defaults) {
+ _initialDefaults[i] = this.Defaults[i];
+ }
+
+ var _container, _containerDelegations = [];
+ this.unbindContainer = function() {
+ if (_container != null && _containerDelegations.length > 0) {
+ for (var i = 0; i < _containerDelegations.length; i++) {
+ _currentInstance.off(_container, _containerDelegations[i][0], _containerDelegations[i][1]);
+ }
+ }
+ };
+ this.setContainer = function (c) {
+
+ this.unbindContainer();
+
+ // get container as dom element.
+ c = this.getElement(c);
+ // move existing connections and endpoints, if any.
+ this.select().each(function (conn) {
+ conn.moveParent(c);
+ });
+ this.selectEndpoints().each(function (ep) {
+ ep.moveParent(c);
+ });
+
+ // set container.
+ var previousContainer = _container;
+ _container = c;
+ _containerDelegations.length = 0;
+ var eventAliases = {
+ "endpointclick":"endpointClick",
+ "endpointdblclick":"endpointDblClick"
+ };
+
+ var _oneDelegateHandler = function (id, e, componentType) {
+ var t = e.srcElement || e.target,
+ jp = (t && t.parentNode ? t.parentNode._jsPlumb : null) || (t ? t._jsPlumb : null) || (t && t.parentNode && t.parentNode.parentNode ? t.parentNode.parentNode._jsPlumb : null);
+ if (jp) {
+ jp.fire(id, jp, e);
+ var alias = componentType ? eventAliases[componentType + id] || id : id;
+ // jsplumb also fires every event coming from components/overlays. That's what the test for `jp.component` is for.
+ _currentInstance.fire(alias, jp.component || jp, e);
+ }
+ };
+
+ var _addOneDelegate = function(eventId, selector, fn) {
+ _containerDelegations.push([eventId, fn]);
+ _currentInstance.on(_container, eventId, selector, fn);
+ };
+
+ // delegate one event on the container to jsplumb elements. it might be possible to
+ // abstract this out: each of endpoint, connection and overlay could register themselves with
+ // jsplumb as "component types" or whatever, and provide a suitable selector. this would be
+ // done by the renderer (although admittedly from 2.0 onwards we're not supporting vml anymore)
+ var _oneDelegate = function (id) {
+ // connections.
+ _addOneDelegate(id, ".jtk-connector", function (e) {
+ _oneDelegateHandler(id, e);
+ });
+ // endpoints. note they can have an enclosing div, or not.
+ _addOneDelegate(id, ".jtk-endpoint", function (e) {
+ _oneDelegateHandler(id, e, "endpoint");
+ });
+ // overlays
+ _addOneDelegate(id, ".jtk-overlay", function (e) {
+ _oneDelegateHandler(id, e);
+ });
+ };
+
+ for (var i = 0; i < events.length; i++) {
+ _oneDelegate(events[i]);
+ }
+
+ // managed elements
+ for (var elId in managedElements) {
+ var el = managedElements[elId].el;
+ if (el.parentNode === previousContainer) {
+ previousContainer.removeChild(el);
+ _container.appendChild(el);
+ }
+ }
+
+ };
+ this.getContainer = function () {
+ return _container;
+ };
+
+ this.bind = function (event, fn) {
+ if ("ready" === event && initialized) {
+ fn();
+ }
+ else {
+ _bb.apply(_currentInstance, [event, fn]);
+ }
+ };
+
+ _currentInstance.importDefaults = function (d) {
+ for (var i in d) {
+ _currentInstance.Defaults[i] = d[i];
+ }
+ if (d.Container) {
+ _currentInstance.setContainer(d.Container);
+ }
+
+ return _currentInstance;
+ };
+
+ _currentInstance.restoreDefaults = function () {
+ _currentInstance.Defaults = jsPlumb.extend({}, _initialDefaults);
+ return _currentInstance;
+ };
+
+ var log = null,
+ initialized = false,
+ // TODO remove from window scope
+ connections = [],
+ // map of element id -> endpoint lists. an element can have an arbitrary
+ // number of endpoints on it, and not all of them have to be connected
+ // to anything.
+ endpointsByElement = {},
+ endpointsByUUID = {},
+ managedElements = {},
+ offsets = {},
+ offsetTimestamps = {},
+ draggableStates = {},
+ connectionBeingDragged = false,
+ sizes = [],
+ _suspendDrawing = false,
+ _suspendedAt = null,
+ DEFAULT_SCOPE = this.Defaults.Scope,
+ _curIdStamp = 1,
+ _idstamp = function () {
+ return "" + _curIdStamp++;
+ },
+
+ //
+ // appends an element to some other element, which is calculated as follows:
+ //
+ // 1. if Container exists, use that element.
+ // 2. if the 'parent' parameter exists, use that.
+ // 3. otherwise just use the root element.
+ //
+ //
+ _appendElement = function (el, parent) {
+ if (_container) {
+ _container.appendChild(el);
+ }
+ else if (!parent) {
+ this.appendToRoot(el);
+ }
+ else {
+ this.getElement(parent).appendChild(el);
+ }
+ }.bind(this),
+
+ //
+ // Draws an endpoint and its connections. this is the main entry point into drawing connections as well
+ // as endpoints, since jsPlumb is endpoint-centric under the hood.
+ //
+ // @param element element to draw (of type library specific element object)
+ // @param ui UI object from current library's event system. optional.
+ // @param timestamp timestamp for this paint cycle. used to speed things up a little by cutting down the amount of offset calculations we do.
+ // @param clearEdits defaults to false; indicates that mouse edits for connectors should be cleared
+ ///
+ _draw = function (element, ui, timestamp, clearEdits) {
+
+ if (!_suspendDrawing) {
+ var id = _getId(element),
+ repaintEls,
+ dm = _currentInstance.getDragManager();
+
+ if (dm) {
+ repaintEls = dm.getElementsForDraggable(id);
+ }
+
+ if (timestamp == null) {
+ timestamp = _timestamp();
+ }
+
+ // update the offset of everything _before_ we try to draw anything.
+ var o = _updateOffset({ elId: id, offset: ui, recalc: false, timestamp: timestamp });
+
+ if (repaintEls && o && o.o) {
+ for (var i in repaintEls) {
+ _updateOffset({
+ elId: repaintEls[i].id,
+ offset: {
+ left: o.o.left + repaintEls[i].offset.left,
+ top: o.o.top + repaintEls[i].offset.top
+ },
+ recalc: false,
+ timestamp: timestamp
+ });
+ }
+ }
+
+ _currentInstance.anchorManager.redraw(id, ui, timestamp, null, clearEdits);
+
+ if (repaintEls) {
+ for (var j in repaintEls) {
+ _currentInstance.anchorManager.redraw(repaintEls[j].id, ui, timestamp, repaintEls[j].offset, clearEdits, true);
+ }
+ }
+ }
+ },
+
+ //
+ // gets an Endpoint by uuid.
+ //
+ _getEndpoint = function (uuid) {
+ return endpointsByUUID[uuid];
+ },
+
+ /**
+ * inits a draggable if it's not already initialised.
+ * TODO: somehow abstract this to the adapter, because the concept of "draggable" has no
+ * place on the server.
+ */
+ _initDraggableIfNecessary = function (element, isDraggable, dragOptions, id, fireEvent) {
+ // move to DragManager?
+ if (!jsPlumb.headless) {
+ var _draggable = isDraggable == null ? false : isDraggable;
+ if (_draggable) {
+ if (jsPlumb.isDragSupported(element, _currentInstance)) {
+ var options = dragOptions || _currentInstance.Defaults.DragOptions;
+ options = jsPlumb.extend({}, options); // make a copy.
+ if (!jsPlumb.isAlreadyDraggable(element, _currentInstance)) {
+ var dragEvent = jsPlumb.dragEvents.drag,
+ stopEvent = jsPlumb.dragEvents.stop,
+ startEvent = jsPlumb.dragEvents.start,
+ _started = false;
+
+ _manage(id, element);
+
+ options[startEvent] = _ju.wrap(options[startEvent], function () {
+ _currentInstance.setHoverSuspended(true);
+ _currentInstance.select({source: element}).addClass(_currentInstance.elementDraggingClass + " " + _currentInstance.sourceElementDraggingClass, true);
+ _currentInstance.select({target: element}).addClass(_currentInstance.elementDraggingClass + " " + _currentInstance.targetElementDraggingClass, true);
+ _currentInstance.setConnectionBeingDragged(true);
+ if (options.canDrag) {
+ return dragOptions.canDrag();
+ }
+ }, false);
+
+ options[dragEvent] = _ju.wrap(options[dragEvent], function () {
+ // TODO: here we could actually use getDragObject, and then compute it ourselves,
+ // since every adapter does the same thing. but i'm not sure why YUI's getDragObject
+ // differs from getUIPosition so much
+ var ui = _currentInstance.getUIPosition(arguments, _currentInstance.getZoom());
+ if (ui != null) {
+ _draw(element, ui, null, true);
+ if (_started) {
+ _currentInstance.addClass(element, "jtk-dragged");
+ }
+ _started = true;
+ }
+ });
+ options[stopEvent] = _ju.wrap(options[stopEvent], function () {
+ var elements = arguments[0].selection, uip;
+
+ var _one = function (_e) {
+ if (_e[1] != null) {
+ // run the reported offset through the code that takes parent containers
+ // into account, to adjust if necessary (issue 554)
+ uip = _currentInstance.getUIPosition([{
+ el:_e[2].el,
+ pos:[_e[1].left, _e[1].top]
+ }]);
+ _draw(_e[2].el, uip);
+ }
+ _currentInstance.removeClass(_e[0], "jtk-dragged");
+ _currentInstance.select({source: _e[2].el}).removeClass(_currentInstance.elementDraggingClass + " " + _currentInstance.sourceElementDraggingClass, true);
+ _currentInstance.select({target: _e[2].el}).removeClass(_currentInstance.elementDraggingClass + " " + _currentInstance.targetElementDraggingClass, true);
+ _currentInstance.getDragManager().dragEnded(_e[2].el);
+ };
+
+ for (var i = 0; i < elements.length; i++) {
+ _one(elements[i]);
+ }
+
+ _started = false;
+ _currentInstance.setHoverSuspended(false);
+ _currentInstance.setConnectionBeingDragged(false);
+ });
+ var elId = _getId(element); // need ID
+ draggableStates[elId] = true;
+ var draggable = draggableStates[elId];
+ options.disabled = draggable == null ? false : !draggable;
+ _currentInstance.initDraggable(element, options);
+ _currentInstance.getDragManager().register(element);
+ if (fireEvent) {
+ _currentInstance.fire("elementDraggable", {el:element, options:options});
+ }
+ }
+ else {
+ // already draggable. attach any start, drag or stop listeners to the current Drag.
+ if (dragOptions.force) {
+ _currentInstance.initDraggable(element, options);
+ }
+ }
+ }
+ }
+ }
+ },
+
+ _scopeMatch = function (e1, e2) {
+ var s1 = e1.scope.split(/\s/), s2 = e2.scope.split(/\s/);
+ for (var i = 0; i < s1.length; i++) {
+ for (var j = 0; j < s2.length; j++) {
+ if (s2[j] === s1[i]) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ },
+
+ _mergeOverrides = function (def, values) {
+ var m = jsPlumb.extend({}, def);
+ for (var i in values) {
+ if (values[i]) {
+ m[i] = values[i];
+ }
+ }
+ return m;
+ },
+
+ /*
+ * prepares a final params object that can be passed to _newConnection, taking into account defaults, events, etc.
+ */
+ _prepareConnectionParams = function (params, referenceParams) {
+ var _p = jsPlumb.extend({ }, params);
+ if (referenceParams) {
+ jsPlumb.extend(_p, referenceParams);
+ }
+
+ // hotwire endpoints passed as source or target to sourceEndpoint/targetEndpoint, respectively.
+ if (_p.source) {
+ if (_p.source.endpoint) {
+ _p.sourceEndpoint = _p.source;
+ }
+ else {
+ _p.source = _currentInstance.getElement(_p.source);
+ }
+ }
+ if (_p.target) {
+ if (_p.target.endpoint) {
+ _p.targetEndpoint = _p.target;
+ }
+ else {
+ _p.target = _currentInstance.getElement(_p.target);
+ }
+ }
+
+ // test for endpoint uuids to connect
+ if (params.uuids) {
+ _p.sourceEndpoint = _getEndpoint(params.uuids[0]);
+ _p.targetEndpoint = _getEndpoint(params.uuids[1]);
+ }
+
+ // now ensure that if we do have Endpoints already, they're not full.
+ // source:
+ if (_p.sourceEndpoint && _p.sourceEndpoint.isFull()) {
+ _ju.log(_currentInstance, "could not add connection; source endpoint is full");
+ return;
+ }
+
+ // target:
+ if (_p.targetEndpoint && _p.targetEndpoint.isFull()) {
+ _ju.log(_currentInstance, "could not add connection; target endpoint is full");
+ return;
+ }
+
+ // if source endpoint mandates connection type and nothing specified in our params, use it.
+ if (!_p.type && _p.sourceEndpoint) {
+ _p.type = _p.sourceEndpoint.connectionType;
+ }
+
+ // copy in any connectorOverlays that were specified on the source endpoint.
+ // it doesnt copy target endpoint overlays. i'm not sure if we want it to or not.
+ if (_p.sourceEndpoint && _p.sourceEndpoint.connectorOverlays) {
+ _p.overlays = _p.overlays || [];
+ for (var i = 0, j = _p.sourceEndpoint.connectorOverlays.length; i < j; i++) {
+ _p.overlays.push(_p.sourceEndpoint.connectorOverlays[i]);
+ }
+ }
+
+ // scope
+ if (_p.sourceEndpoint && _p.sourceEndpoint.scope) {
+ _p.scope = _p.sourceEndpoint.scope;
+ }
+
+ // pointer events
+ if (!_p["pointer-events"] && _p.sourceEndpoint && _p.sourceEndpoint.connectorPointerEvents) {
+ _p["pointer-events"] = _p.sourceEndpoint.connectorPointerEvents;
+ }
+
+
+ var _addEndpoint = function (el, def, idx) {
+ return _currentInstance.addEndpoint(el, _mergeOverrides(def, {
+ anchor: _p.anchors ? _p.anchors[idx] : _p.anchor,
+ endpoint: _p.endpoints ? _p.endpoints[idx] : _p.endpoint,
+ paintStyle: _p.endpointStyles ? _p.endpointStyles[idx] : _p.endpointStyle,
+ hoverPaintStyle: _p.endpointHoverStyles ? _p.endpointHoverStyles[idx] : _p.endpointHoverStyle
+ }));
+ };
+
+ // check for makeSource/makeTarget specs.
+
+ var _oneElementDef = function (type, idx, defs, matchType) {
+ if (_p[type] && !_p[type].endpoint && !_p[type + "Endpoint"] && !_p.newConnection) {
+ var tid = _getId(_p[type]), tep = defs[tid];
+
+ tep = tep ? tep[matchType] : null;
+
+ if (tep) {
+ // if not enabled, return.
+ if (!tep.enabled) {
+ return false;
+ }
+ var newEndpoint = tep.endpoint != null && tep.endpoint._jsPlumb ? tep.endpoint : _addEndpoint(_p[type], tep.def, idx);
+ if (newEndpoint.isFull()) {
+ return false;
+ }
+ _p[type + "Endpoint"] = newEndpoint;
+ if (!_p.scope && tep.def.scope) {
+ _p.scope = tep.def.scope;
+ } // provide scope if not already provided and endpoint def has one.
+ if (tep.uniqueEndpoint) {
+ if (!tep.endpoint) {
+ tep.endpoint = newEndpoint;
+ newEndpoint.setDeleteOnEmpty(false);
+ }
+ else {
+ newEndpoint.finalEndpoint = tep.endpoint;
+ }
+ } else {
+ newEndpoint.setDeleteOnEmpty(true);
+ }
+ }
+ }
+ };
+
+ if (_oneElementDef("source", 0, this.sourceEndpointDefinitions, _p.type || "default") === false) {
+ return;
+ }
+ if (_oneElementDef("target", 1, this.targetEndpointDefinitions, _p.type || "default") === false) {
+ return;
+ }
+
+ // last, ensure scopes match
+ if (_p.sourceEndpoint && _p.targetEndpoint) {
+ if (!_scopeMatch(_p.sourceEndpoint, _p.targetEndpoint)) {
+ _p = null;
+ }
+ }
+
+ return _p;
+ }.bind(_currentInstance),
+
+ _newConnection = function (params) {
+ var connectionFunc = _currentInstance.Defaults.ConnectionType || _currentInstance.getDefaultConnectionType();
+
+ params._jsPlumb = _currentInstance;
+ params.newConnection = _newConnection;
+ params.newEndpoint = _newEndpoint;
+ params.endpointsByUUID = endpointsByUUID;
+ params.endpointsByElement = endpointsByElement;
+ params.finaliseConnection = _finaliseConnection;
+ params.id = "con_" + _idstamp();
+ var con = new connectionFunc(params);
+
+ // if the connection is draggable, then maybe we need to tell the target endpoint to init the
+ // dragging code. it won't run again if it already configured to be draggable.
+ if (con.isDetachable()) {
+ con.endpoints[0].initDraggable("_jsPlumbSource");
+ con.endpoints[1].initDraggable("_jsPlumbTarget");
+ }
+
+ return con;
+ },
+
+ //
+ // adds the connection to the backing model, fires an event if necessary and then redraws
+ //
+ _finaliseConnection = _currentInstance.finaliseConnection = function (jpc, params, originalEvent, doInformAnchorManager) {
+ params = params || {};
+ // add to list of connections (by scope).
+ if (!jpc.suspendedEndpoint) {
+ connections.push(jpc);
+ }
+
+ jpc.pending = null;
+
+ // turn off isTemporarySource on the source endpoint (only viable on first draw)
+ jpc.endpoints[0].isTemporarySource = false;
+
+ // always inform the anchor manager
+ // except that if jpc has a suspended endpoint it's not true to say the
+ // connection is new; it has just (possibly) moved. the question is whether
+ // to make that call here or in the anchor manager. i think perhaps here.
+ if (doInformAnchorManager !== false) {
+ _currentInstance.anchorManager.newConnection(jpc);
+ }
+
+ // force a paint
+ _draw(jpc.source);
+
+ // fire an event
+ if (!params.doNotFireConnectionEvent && params.fireEvent !== false) {
+
+ var eventArgs = {
+ connection: jpc,
+ source: jpc.source, target: jpc.target,
+ sourceId: jpc.sourceId, targetId: jpc.targetId,
+ sourceEndpoint: jpc.endpoints[0], targetEndpoint: jpc.endpoints[1]
+ };
+
+ _currentInstance.fire("connection", eventArgs, originalEvent);
+ }
+ },
+
+ /*
+ factory method to prepare a new endpoint. this should always be used instead of creating Endpoints
+ manually, since this method attaches event listeners and an id.
+ */
+ _newEndpoint = function (params, id) {
+ var endpointFunc = _currentInstance.Defaults.EndpointType || jsPlumb.Endpoint;
+ var _p = jsPlumb.extend({}, params);
+ _p._jsPlumb = _currentInstance;
+ _p.newConnection = _newConnection;
+ _p.newEndpoint = _newEndpoint;
+ _p.endpointsByUUID = endpointsByUUID;
+ _p.endpointsByElement = endpointsByElement;
+ _p.fireDetachEvent = fireDetachEvent;
+ _p.elementId = id || _getId(_p.source);
+ var ep = new endpointFunc(_p);
+ ep.id = "ep_" + _idstamp();
+ _manage(_p.elementId, _p.source);
+
+ if (!jsPlumb.headless) {
+ _currentInstance.getDragManager().endpointAdded(_p.source, id);
+ }
+
+ return ep;
+ },
+
+ /*
+ * performs the given function operation on all the connections found
+ * for the given element id; this means we find all the endpoints for
+ * the given element, and then for each endpoint find the connectors
+ * connected to it. then we pass each connection in to the given
+ * function.
+ */
+ _operation = function (elId, func, endpointFunc) {
+ var endpoints = endpointsByElement[elId];
+ if (endpoints && endpoints.length) {
+ for (var i = 0, ii = endpoints.length; i < ii; i++) {
+ for (var j = 0, jj = endpoints[i].connections.length; j < jj; j++) {
+ var retVal = func(endpoints[i].connections[j]);
+ // if the function passed in returns true, we exit.
+ // most functions return false.
+ if (retVal) {
+ return;
+ }
+ }
+ if (endpointFunc) {
+ endpointFunc(endpoints[i]);
+ }
+ }
+ }
+ },
+
+ _setDraggable = function (element, draggable) {
+ return jsPlumb.each(element, function (el) {
+ if (_currentInstance.isDragSupported(el)) {
+ draggableStates[_currentInstance.getAttribute(el, "id")] = draggable;
+ _currentInstance.setElementDraggable(el, draggable);
+ }
+ });
+ },
+ /*
+ * private method to do the business of hiding/showing.
+ *
+ * @param el
+ * either Id of the element in question or a library specific
+ * object for the element.
+ * @param state
+ * String specifying a value for the css 'display' property
+ * ('block' or 'none').
+ */
+ _setVisible = function (el, state, alsoChangeEndpoints) {
+ state = state === "block";
+ var endpointFunc = null;
+ if (alsoChangeEndpoints) {
+ endpointFunc = function (ep) {
+ ep.setVisible(state, true, true);
+ };
+ }
+ var info = _info(el);
+ _operation(info.id, function (jpc) {
+ if (state && alsoChangeEndpoints) {
+ // this test is necessary because this functionality is new, and i wanted to maintain backwards compatibility.
+ // this block will only set a connection to be visible if the other endpoint in the connection is also visible.
+ var oidx = jpc.sourceId === info.id ? 1 : 0;
+ if (jpc.endpoints[oidx].isVisible()) {
+ jpc.setVisible(true);
+ }
+ }
+ else { // the default behaviour for show, and what always happens for hide, is to just set the visibility without getting clever.
+ jpc.setVisible(state);
+ }
+ }, endpointFunc);
+ },
+ /*
+ * toggles the draggable state of the given element(s).
+ * el is either an id, or an element object, or a list of ids/element objects.
+ */
+ _toggleDraggable = function (el) {
+ var state;
+ jsPlumb.each(el, function (el) {
+ var elId = _currentInstance.getAttribute(el, "id");
+ state = draggableStates[elId] == null ? false : draggableStates[elId];
+ state = !state;
+ draggableStates[elId] = state;
+ _currentInstance.setDraggable(el, state);
+ return state;
+ }.bind(this));
+ return state;
+ },
+ /**
+ * private method to do the business of toggling hiding/showing.
+ */
+ _toggleVisible = function (elId, changeEndpoints) {
+ var endpointFunc = null;
+ if (changeEndpoints) {
+ endpointFunc = function (ep) {
+ var state = ep.isVisible();
+ ep.setVisible(!state);
+ };
+ }
+ _operation(elId, function (jpc) {
+ var state = jpc.isVisible();
+ jpc.setVisible(!state);
+ }, endpointFunc);
+ },
+
+ // TODO comparison performance
+ _getCachedData = function (elId) {
+ var o = offsets[elId];
+ if (!o) {
+ return _updateOffset({elId: elId});
+ }
+ else {
+ return {o: o, s: sizes[elId]};
+ }
+ },
+
+ /**
+ * gets an id for the given element, creating and setting one if
+ * necessary. the id is of the form
+ *
+ * jsPlumb_
");
+ }
+ else {
+ if (this.labelText == null) {
+ this.labelText = this.label;
+ this.getElement().innerHTML = this.labelText.replace(/\r\n/g, "
");
+ }
+ }
+ },
+ updateFrom:function(d) {
+ if(d.label != null){
+ this.setLabel(d.label);
+ }
+ }
+ });
+
+ // ********************************* END OF OVERLAY DEFINITIONS ***********************************************************************
+
+}).call(typeof window !== 'undefined' ? window : this);
+
+/*
+ * jsPlumb Community Edition
+ *
+ * Provides a way to visually connect elements on an HTML page, using SVG.
+ *
+ * This file contains the base class for library adapters.
+ *
+ * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
+ *
+ * https://jsplumbtoolkit.com
+ * https://github.com/jsplumb/jsplumb
+ *
+ * Dual licensed under the MIT and GPL2 licenses.
+ */
+;(function() {
+ "use strict";
+ var root = this,
+ _jp = root.jsPlumb;
+
+ var _getEventManager = function(instance) {
+ var e = instance._mottle;
+ if (!e) {
+ e = instance._mottle = new root.Mottle();
+ }
+ return e;
+ };
+
+ _jp.extend(root.jsPlumbInstance.prototype, {
+ getEventManager:function() {
+ return _getEventManager(this);
+ },
+ on : function(el, event, callback) {
+ // TODO: here we would like to map the tap event if we know its
+ // an internal bind to a click. we have to know its internal because only
+ // then can we be sure that the UP event wont be consumed (tap is a synthesized
+ // event from a mousedown followed by a mouseup).
+ //event = { "click":"tap", "dblclick":"dbltap"}[event] || event;
+ this.getEventManager().on.apply(this, arguments);
+ return this;
+ },
+ off : function(el, event, callback) {
+ this.getEventManager().off.apply(this, arguments);
+ return this;
+ }
+ });
+
+
+}).call(typeof window !== 'undefined' ? window : this);
+/*
+ * jsPlumb Community Edition
+ *
+ * Provides a way to visually connect elements on an HTML page, using SVG.
+ *
+ * This file contains the code for working with Groups.
+ *
+ * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
+ *
+ * https://jsplumbtoolkit.com
+ * https://github.com/jsplumb/jsplumb
+ *
+ * Dual licensed under the MIT and GPL2 licenses.
+ */
+;(function() {
+ "use strict";
+
+ var root = this,
+ _ju = root.jsPlumbUtil,
+ _jpi = root.jsPlumbInstance;
+
+ var GROUP_COLLAPSED_CLASS = "jtk-group-collapsed";
+ var GROUP_EXPANDED_CLASS = "jtk-group-expanded";
+ var GROUP_CONTAINER_SELECTOR = "[jtk-group-content]";
+ var ELEMENT_DRAGGABLE_EVENT = "elementDraggable";
+ var STOP = "stop";
+ var REVERT = "revert";
+ var GROUP_MANAGER = "_groupManager";
+ var GROUP = "_jsPlumbGroup";
+ var GROUP_DRAG_SCOPE = "_jsPlumbGroupDrag";
+ var EVT_CHILD_ADDED = "group:addMember";
+ var EVT_CHILD_REMOVED = "group:removeMember";
+ var EVT_GROUP_ADDED = "group:add";
+ var EVT_GROUP_REMOVED = "group:remove";
+ var EVT_EXPAND = "group:expand";
+ var EVT_COLLAPSE = "group:collapse";
+ var EVT_GROUP_DRAG_STOP = "groupDragStop";
+ var EVT_CONNECTION_MOVED = "connectionMoved";
+ var EVT_INTERNAL_CONNECTION_DETACHED = "internal.connectionDetached";
+
+ var CMD_REMOVE_ALL = "removeAll";
+ var CMD_ORPHAN_ALL = "orphanAll";
+ var CMD_SHOW = "show";
+ var CMD_HIDE = "hide";
+
+ var GroupManager = function(_jsPlumb) {
+ var _managedGroups = {}, _connectionSourceMap = {}, _connectionTargetMap = {}, self = this;
+
+ _jsPlumb.bind("connection", function(p) {
+ if (p.source[GROUP] != null && p.target[GROUP] != null && p.source[GROUP] === p.target[GROUP]) {
+ _connectionSourceMap[p.connection.id] = p.source[GROUP];
+ _connectionTargetMap[p.connection.id] = p.source[GROUP];
+ }
+ else {
+ if (p.source[GROUP] != null) {
+ _ju.suggest(p.source[GROUP].connections.source, p.connection);
+ _connectionSourceMap[p.connection.id] = p.source[GROUP];
+ }
+ if (p.target[GROUP] != null) {
+ _ju.suggest(p.target[GROUP].connections.target, p.connection);
+ _connectionTargetMap[p.connection.id] = p.target[GROUP];
+ }
+ }
+ });
+
+ function _cleanupDetachedConnection(conn) {
+ delete conn.proxies;
+ var group = _connectionSourceMap[conn.id], f;
+ if (group != null) {
+ f = function(c) { return c.id === conn.id; };
+ _ju.removeWithFunction(group.connections.source, f);
+ _ju.removeWithFunction(group.connections.target, f);
+ delete _connectionSourceMap[conn.id];
+ }
+
+ group = _connectionTargetMap[conn.id];
+ if (group != null) {
+ f = function(c) { return c.id === conn.id; };
+ _ju.removeWithFunction(group.connections.source, f);
+ _ju.removeWithFunction(group.connections.target, f);
+ delete _connectionTargetMap[conn.id];
+ }
+ }
+
+ _jsPlumb.bind(EVT_INTERNAL_CONNECTION_DETACHED, function(p) {
+ _cleanupDetachedConnection(p.connection);
+ });
+
+ _jsPlumb.bind(EVT_CONNECTION_MOVED, function(p) {
+ var connMap = p.index === 0 ? _connectionSourceMap : _connectionTargetMap;
+ var group = connMap[p.connection.id];
+ if (group) {
+ var list = group.connections[p.index === 0 ? "source" : "target"];
+ var idx = list.indexOf(p.connection);
+ if (idx !== -1) {
+ list.splice(idx, 1);
+ }
+ }
+ });
+
+ this.addGroup = function(group) {
+ _jsPlumb.addClass(group.getEl(), GROUP_EXPANDED_CLASS);
+ _managedGroups[group.id] = group;
+ group.manager = this;
+ _updateConnectionsForGroup(group);
+ _jsPlumb.fire(EVT_GROUP_ADDED, { group:group });
+ };
+
+ this.addToGroup = function(group, el, doNotFireEvent) {
+ group = this.getGroup(group);
+ if (group) {
+ //group.add(el, doNotFireEvent);
+ var groupEl = group.getEl();
+
+ if (el._isJsPlumbGroup) {
+ return;
+ }
+ var currentGroup = el._jsPlumbGroup;
+ // if already a member of this group, do nothing
+ if (currentGroup !== group) {
+ var elpos = _jsPlumb.getOffset(el, true);
+ var cpos = group.collapsed ? _jsPlumb.getOffset(groupEl, true) : _jsPlumb.getOffset(group.getDragArea(), true);
+
+ // otherwise, transfer to this group.
+ if (currentGroup != null) {
+ currentGroup.remove(el, doNotFireEvent);
+ self.updateConnectionsForGroup(currentGroup);
+ }
+ group.add(el, doNotFireEvent);
+
+ var handleDroppedConnections = function (list, index) {
+ var oidx = index === 0 ? 1 : 0;
+ list.each(function (c) {
+ c.setVisible(false);
+ if (c.endpoints[oidx].element._jsPlumbGroup === group) {
+ c.endpoints[oidx].setVisible(false);
+ self.expandConnection(c, oidx, group);
+ }
+ else {
+ c.endpoints[index].setVisible(false);
+ self.collapseConnection(c, index, group);
+ }
+ });
+ };
+
+ if (group.collapsed) {
+ handleDroppedConnections(_jsPlumb.select({source: el}), 0);
+ handleDroppedConnections(_jsPlumb.select({target: el}), 1);
+ }
+
+ var elId = _jsPlumb.getId(el);
+ _jsPlumb.dragManager.setParent(el, elId, groupEl, _jsPlumb.getId(groupEl), elpos);
+
+ var newPosition = { left: elpos.left - cpos.left, top: elpos.top - cpos.top };
+
+ _jsPlumb.setPosition(el, newPosition);
+
+ _jsPlumb.dragManager.revalidateParent(el, elId, elpos);
+
+ self.updateConnectionsForGroup(group);
+
+ _jsPlumb.revalidate(elId);
+
+ setTimeout(function () {
+ _jsPlumb.fire(EVT_CHILD_ADDED, {group: group, el: el});
+ }, 0);
+ }
+ }
+ };
+
+ this.removeFromGroup = function(group, el, doNotFireEvent) {
+ group = this.getGroup(group);
+ if (group) {
+ group.remove(el, null, doNotFireEvent);
+ }
+ };
+
+ this.getGroup = function(groupId) {
+ var group = groupId;
+ if (_ju.isString(groupId)) {
+ group = _managedGroups[groupId];
+ if (group == null) {
+ throw new TypeError("No such group [" + groupId + "]");
+ }
+ }
+ return group;
+ };
+
+ this.getGroups = function() {
+ var o = [];
+ for (var g in _managedGroups) {
+ o.push(_managedGroups[g]);
+ }
+ return o;
+ };
+
+ this.removeGroup = function(group, deleteMembers, manipulateDOM, doNotFireEvent) {
+ group = this.getGroup(group);
+ this.expandGroup(group, true); // this reinstates any original connections and removes all proxies, but does not fire an event.
+ group[deleteMembers ? CMD_REMOVE_ALL : CMD_ORPHAN_ALL](manipulateDOM, doNotFireEvent);
+ _jsPlumb.remove(group.getEl());
+ delete _managedGroups[group.id];
+ delete _jsPlumb._groups[group.id];
+ _jsPlumb.fire(EVT_GROUP_REMOVED, { group:group });
+ };
+
+ this.removeAllGroups = function(deleteMembers, manipulateDOM, doNotFireEvent) {
+ for (var g in _managedGroups) {
+ this.removeGroup(_managedGroups[g], deleteMembers, manipulateDOM, doNotFireEvent);
+ }
+ };
+
+ function _setVisible(group, state) {
+ var m = group.getMembers();
+ for (var i = 0; i < m.length; i++) {
+ _jsPlumb[state ? CMD_SHOW : CMD_HIDE](m[i], true);
+ }
+ }
+
+ var _collapseConnection = this.collapseConnection = function(c, index, group) {
+
+ var proxyEp, groupEl = group.getEl(), groupElId = _jsPlumb.getId(groupEl),
+ originalElementId = c.endpoints[index].elementId;
+
+ var otherEl = c.endpoints[index === 0 ? 1 : 0].element;
+ if (otherEl[GROUP] && (!otherEl[GROUP].shouldProxy() && otherEl[GROUP].collapsed)) {
+ return;
+ }
+
+ c.proxies = c.proxies || [];
+ if(c.proxies[index]) {
+ proxyEp = c.proxies[index].ep;
+ }else {
+ proxyEp = _jsPlumb.addEndpoint(groupEl, {
+ endpoint:group.getEndpoint(c, index),
+ anchor:group.getAnchor(c, index),
+ parameters:{
+ isProxyEndpoint:true
+ }
+ });
+ }
+ proxyEp.setDeleteOnEmpty(true);
+
+ // for this index, stash proxy info: the new EP, the original EP.
+ c.proxies[index] = { ep:proxyEp, originalEp: c.endpoints[index] };
+
+ // and advise the anchor manager
+ if (index === 0) {
+ // TODO why are there two differently named methods? Why is there not one method that says "some end of this
+ // connection changed (you give the index), and here's the new element and element id."
+ _jsPlumb.anchorManager.sourceChanged(originalElementId, groupElId, c, groupEl);
+ }
+ else {
+ _jsPlumb.anchorManager.updateOtherEndpoint(c.endpoints[0].elementId, originalElementId, groupElId, c);
+ c.target = groupEl;
+ c.targetId = groupElId;
+ }
+
+
+ // detach the original EP from the connection.
+ c.proxies[index].originalEp.detachFromConnection(c, null, true);
+
+ // set the proxy as the new ep
+ proxyEp.connections = [ c ];
+ c.endpoints[index] = proxyEp;
+
+ c.setVisible(true);
+ };
+
+ this.collapseGroup = function(group) {
+ group = this.getGroup(group);
+ if (group == null || group.collapsed) {
+ return;
+ }
+ var groupEl = group.getEl();
+
+ // todo remove old proxy endpoints first, just in case?
+ //group.proxies.length = 0;
+
+ // hide all connections
+ _setVisible(group, false);
+
+ if (group.shouldProxy()) {
+ // collapses all connections in a group.
+ var _collapseSet = function (conns, index) {
+ for (var i = 0; i < conns.length; i++) {
+ var c = conns[i];
+ _collapseConnection(c, index, group);
+ }
+ };
+
+ // setup proxies for sources and targets
+ _collapseSet(group.connections.source, 0);
+ _collapseSet(group.connections.target, 1);
+ }
+
+ group.collapsed = true;
+ _jsPlumb.removeClass(groupEl, GROUP_EXPANDED_CLASS);
+ _jsPlumb.addClass(groupEl, GROUP_COLLAPSED_CLASS);
+ _jsPlumb.revalidate(groupEl);
+ _jsPlumb.fire(EVT_COLLAPSE, { group:group });
+ };
+
+ var _expandConnection = this.expandConnection = function(c, index, group) {
+
+ // if no proxies or none for this end of the connection, abort.
+ if (c.proxies == null || c.proxies[index] == null) {
+ return;
+ }
+
+ var groupElId = _jsPlumb.getId(group.getEl()),
+ originalElement = c.proxies[index].originalEp.element,
+ originalElementId = c.proxies[index].originalEp.elementId;
+
+ c.endpoints[index] = c.proxies[index].originalEp;
+ // and advise the anchor manager
+ if (index === 0) {
+ // TODO why are there two differently named methods? Why is there not one method that says "some end of this
+ // connection changed (you give the index), and here's the new element and element id."
+ _jsPlumb.anchorManager.sourceChanged(groupElId, originalElementId, c, originalElement);
+ }
+ else {
+ _jsPlumb.anchorManager.updateOtherEndpoint(c.endpoints[0].elementId, groupElId, originalElementId, c);
+ c.target = originalElement;
+ c.targetId = originalElementId;
+ }
+
+ // detach the proxy EP from the connection (which will cause it to be removed as we no longer need it)
+ c.proxies[index].ep.detachFromConnection(c, null);
+
+ c.proxies[index].originalEp.addConnection(c);
+
+ // cleanup
+ delete c.proxies[index];
+ };
+
+ this.expandGroup = function(group, doNotFireEvent) {
+
+ group = this.getGroup(group);
+
+ if (group == null || !group.collapsed) {
+ return;
+ }
+ var groupEl = group.getEl();
+
+ _setVisible(group, true);
+
+ if (group.shouldProxy()) {
+ // collapses all connections in a group.
+ var _expandSet = function (conns, index) {
+ for (var i = 0; i < conns.length; i++) {
+ var c = conns[i];
+ _expandConnection(c, index, group);
+ }
+ };
+
+ // setup proxies for sources and targets
+ _expandSet(group.connections.source, 0);
+ _expandSet(group.connections.target, 1);
+ }
+
+ group.collapsed = false;
+ _jsPlumb.addClass(groupEl, GROUP_EXPANDED_CLASS);
+ _jsPlumb.removeClass(groupEl, GROUP_COLLAPSED_CLASS);
+ _jsPlumb.revalidate(groupEl);
+ this.repaintGroup(group);
+ if (!doNotFireEvent) {
+ _jsPlumb.fire(EVT_EXPAND, { group: group});
+ }
+ };
+
+ this.repaintGroup = function(group) {
+ group = this.getGroup(group);
+ var m = group.getMembers();
+ for (var i = 0; i < m.length; i++) {
+ _jsPlumb.revalidate(m[i]);
+ }
+ };
+
+ // TODO refactor this with the code that responds to `connection` events.
+ function _updateConnectionsForGroup(group) {
+ var members = group.getMembers();
+ var c1 = _jsPlumb.getConnections({source:members}, true);
+ var c2 = _jsPlumb.getConnections({target:members}, true);
+ var processed = {};
+ group.connections.source.length = 0;
+ group.connections.target.length = 0;
+ var oneSet = function(c) {
+ for (var i = 0; i < c.length; i++) {
+ if (processed[c[i].id]) {
+ continue;
+ }
+ processed[c[i].id] = true;
+ if (c[i].source._jsPlumbGroup === group) {
+ if (c[i].target._jsPlumbGroup !== group) {
+ group.connections.source.push(c[i]);
+ }
+ _connectionSourceMap[c[i].id] = group;
+ }
+ else if (c[i].target._jsPlumbGroup === group) {
+ group.connections.target.push(c[i]);
+ _connectionTargetMap[c[i].id] = group;
+ }
+ }
+ };
+ oneSet(c1); oneSet(c2);
+ }
+
+ this.updateConnectionsForGroup = _updateConnectionsForGroup;
+ this.refreshAllGroups = function() {
+ for (var g in _managedGroups) {
+ _updateConnectionsForGroup(_managedGroups[g]);
+ _jsPlumb.dragManager.updateOffsets(_jsPlumb.getId(_managedGroups[g].getEl()));
+ }
+ };
+ };
+
+ /**
+ *
+ * @param {jsPlumbInstance} _jsPlumb Associated jsPlumb instance.
+ * @param {Object} params
+ * @param {Element} params.el The DOM element representing the Group.
+ * @param {String} [params.id] Optional ID for the Group. A UUID will be assigned as the Group's ID if you do not provide one.
+ * @param {Boolean} [params.constrain=false] If true, child elements will not be able to be dragged outside of the Group container.
+ * @param {Boolean} [params.revert=true] By default, child elements revert to the container if dragged outside. You can change this by setting `revert:false`. This behaviour is also overridden if you set `orphan` or `prune`.
+ * @param {Boolean} [params.orphan=false] If true, child elements dropped outside of the Group container will be removed from the Group (but not from the DOM).
+ * @param {Boolean} [params.prune=false] If true, child elements dropped outside of the Group container will be removed from the Group and also from the DOM.
+ * @param {Boolean} [params.dropOverride=false] If true, a child element that has been dropped onto some other Group will not be subject to the controls imposed by `prune`, `revert` or `orphan`.
+ * @constructor
+ */
+ var Group = function(_jsPlumb, params) {
+ var self = this;
+ var el = params.el;
+ this.getEl = function() { return el; };
+ this.id = params.id || _ju.uuid();
+ el._isJsPlumbGroup = true;
+
+ var getDragArea = this.getDragArea = function() {
+ var da = _jsPlumb.getSelector(el, GROUP_CONTAINER_SELECTOR);
+ return da && da.length > 0 ? da[0] : el;
+ };
+
+ var ghost = params.ghost === true;
+ var constrain = ghost || (params.constrain === true);
+ var revert = params.revert !== false;
+ var orphan = params.orphan === true;
+ var prune = params.prune === true;
+ var dropOverride = params.dropOverride === true;
+ var proxied = params.proxied !== false;
+ var elements = [];
+ this.connections = { source:[], target:[], internal:[] };
+
+ // this function, and getEndpoint below, are stubs for a future setup in which we can choose endpoint
+ // and anchor based upon the connection and the index (source/target) of the endpoint to be proxied.
+ this.getAnchor = function(conn, endpointIndex) {
+ return params.anchor || "Continuous";
+ };
+
+ this.getEndpoint = function(conn, endpointIndex) {
+ return params.endpoint || [ "Dot", { radius:10 }];
+ };
+
+ this.collapsed = false;
+ if (params.draggable !== false) {
+ var opts = {
+ stop:function(params) {
+ _jsPlumb.fire(EVT_GROUP_DRAG_STOP, jsPlumb.extend(params, {group:self}));
+ },
+ scope:GROUP_DRAG_SCOPE
+ };
+ if (params.dragOptions) {
+ root.jsPlumb.extend(opts, params.dragOptions);
+ }
+ _jsPlumb.draggable(params.el, opts);
+ }
+ if (params.droppable !== false) {
+ _jsPlumb.droppable(params.el, {
+ drop:function(p) {
+ var el = p.drag.el;
+ if (el._isJsPlumbGroup) {
+ return;
+ }
+ var currentGroup = el._jsPlumbGroup;
+ if (currentGroup !== self) {
+ if (currentGroup != null) {
+ if (currentGroup.overrideDrop(el, self)) {
+ return;
+ }
+ }
+ _jsPlumb.getGroupManager().addToGroup(self, el, false);
+ }
+
+ }
+ });
+ }
+ var _each = function(_el, fn) {
+ var els = _el.nodeType == null ? _el : [ _el ];
+ for (var i = 0; i < els.length; i++) {
+ fn(els[i]);
+ }
+ };
+
+ this.overrideDrop = function(_el, targetGroup) {
+ return dropOverride && (revert || prune || orphan);
+ };
+
+ this.add = function(_el, doNotFireEvent) {
+ var dragArea = getDragArea();
+ _each(_el, function(__el) {
+
+ if (__el._jsPlumbGroup != null) {
+ if (__el._jsPlumbGroup === self) {
+ return;
+ } else {
+ __el._jsPlumbGroup.remove(__el, true, doNotFireEvent, false);
+ }
+ }
+
+ __el._jsPlumbGroup = self;
+ elements.push(__el);
+ // test if draggable and add handlers if so.
+ if (_jsPlumb.isAlreadyDraggable(__el)) {
+ _bindDragHandlers(__el);
+ }
+
+ if (__el.parentNode !== dragArea) {
+ dragArea.appendChild(__el);
+ }
+
+ if (!doNotFireEvent) {
+ _jsPlumb.fire(EVT_CHILD_ADDED, {group: self, el: __el});
+ }
+ });
+
+ _jsPlumb.getGroupManager().updateConnectionsForGroup(self);
+ };
+
+ this.remove = function(el, manipulateDOM, doNotFireEvent, doNotUpdateConnections) {
+
+ _each(el, function(__el) {
+ delete __el._jsPlumbGroup;
+ _ju.removeWithFunction(elements, function(e) {
+ return e === __el;
+ });
+
+ if (manipulateDOM) {
+ try { self.getDragArea().removeChild(__el); }
+ catch (e) {
+ jsPlumbUtil.log("Could not remove element from Group " + e);
+ }
+ }
+ _unbindDragHandlers(__el);
+ if (!doNotFireEvent) {
+ _jsPlumb.fire(EVT_CHILD_REMOVED, {group: self, el: __el});
+ }
+ });
+ if (!doNotUpdateConnections) {
+ _jsPlumb.getGroupManager().updateConnectionsForGroup(self);
+ }
+ };
+ this.removeAll = function(manipulateDOM, doNotFireEvent) {
+ for (var i = 0, l = elements.length; i < l; i++) {
+ self.remove(elements[0], manipulateDOM, doNotFireEvent, true);
+ }
+ elements.length = 0;
+ _jsPlumb.getGroupManager().updateConnectionsForGroup(self);
+ };
+ this.orphanAll = function() {
+ for (var i = 0; i < elements.length; i++) {
+ _orphan(elements[i]);
+ }
+ elements.length = 0;
+ };
+ this.getMembers = function() { return elements; };
+
+ el[GROUP] = this;
+
+ _jsPlumb.bind(ELEMENT_DRAGGABLE_EVENT, function(dragParams) {
+ // if its for the current group,
+ if (dragParams.el._jsPlumbGroup === this) {
+ _bindDragHandlers(dragParams.el);
+ }
+ }.bind(this));
+
+ function _findParent(_el) {
+ return _el.offsetParent;
+ }
+
+ function _isInsideParent(_el, pos) {
+ var p = _findParent(_el),
+ s = _jsPlumb.getSize(p),
+ ss = _jsPlumb.getSize(_el),
+ leftEdge = pos[0],
+ rightEdge = leftEdge + ss[0],
+ topEdge = pos[1],
+ bottomEdge = topEdge + ss[1];
+
+ return rightEdge > 0 && leftEdge < s[0] && bottomEdge > 0 && topEdge < s[1];
+ }
+
+ //
+ // orphaning an element means taking it out of the group and adding it to the main jsplumb container.
+ //
+ function _orphan(_el) {
+ var id = _jsPlumb.getId(_el);
+ var pos = _jsPlumb.getOffset(_el);
+ _el.parentNode.removeChild(_el);
+ _jsPlumb.getContainer().appendChild(_el);
+ _jsPlumb.setPosition(_el, pos);
+ delete _el._jsPlumbGroup;
+ _unbindDragHandlers(_el);
+ _jsPlumb.dragManager.clearParent(_el, id);
+ }
+
+ //
+ // remove an element from the group, then either prune it from the jsplumb instance, or just orphan it.
+ //
+ function _pruneOrOrphan(p) {
+ if (!_isInsideParent(p.el, p.pos)) {
+ var group = p.el._jsPlumbGroup;
+ if (prune) {
+ _jsPlumb.remove(p.el);
+ } else {
+ _orphan(p.el);
+ }
+
+ group.remove(p.el);
+ }
+ }
+
+ //
+ // redraws the element
+ //
+ function _revalidate(_el) {
+ var id = _jsPlumb.getId(_el);
+ _jsPlumb.revalidate(_el);
+ _jsPlumb.dragManager.revalidateParent(_el, id);
+ }
+
+ //
+ // unbind the group specific drag/revert handlers.
+ //
+ function _unbindDragHandlers(_el) {
+ if (!_el._katavorioDrag) {
+ return;
+ }
+ if (prune || orphan) {
+ _el._katavorioDrag.off(STOP, _pruneOrOrphan);
+ }
+ if (!prune && !orphan && revert) {
+ _el._katavorioDrag.off(REVERT, _revalidate);
+ _el._katavorioDrag.setRevert(null);
+ }
+ }
+
+ function _bindDragHandlers(_el) {
+ if (!_el._katavorioDrag) {
+ return;
+ }
+ if (prune || orphan) {
+ _el._katavorioDrag.on(STOP, _pruneOrOrphan);
+ }
+
+ if (constrain) {
+ _el._katavorioDrag.setConstrain(true);
+ }
+
+ if (ghost) {
+ _el._katavorioDrag.setUseGhostProxy(true);
+ }
+
+ if (!prune && !orphan && revert) {
+ _el._katavorioDrag.on(REVERT, _revalidate);
+ _el._katavorioDrag.setRevert(function(__el, pos) {
+ return !_isInsideParent(__el, pos);
+ });
+ }
+ }
+
+ this.shouldProxy = function() {
+ return proxied;
+ };
+
+ _jsPlumb.getGroupManager().addGroup(this);
+ };
+
+ /**
+ * Adds a group to the jsPlumb instance.
+ * @method addGroup
+ * @param {Object} params
+ * @return {Group} The newly created Group.
+ */
+ _jpi.prototype.addGroup = function(params) {
+ var j = this;
+ j._groups = j._groups || {};
+ if (j._groups[params.id] != null) {
+ throw new TypeError("cannot create Group [" + params.id + "]; a Group with that ID exists");
+ }
+ if (params.el[GROUP] != null) {
+ throw new TypeError("cannot create Group [" + params.id + "]; the given element is already a Group");
+ }
+ var group = new Group(j, params);
+ j._groups[group.id] = group;
+ if (params.collapsed) {
+ this.collapseGroup(group);
+ }
+ return group;
+ };
+
+ /**
+ * Add an element to a group.
+ * @method addToGroup
+ * @param {String} group Group, or ID of the group, to add the element to.
+ * @param {Element} el Element to add to the group.
+ */
+ _jpi.prototype.addToGroup = function(group, el, doNotFireEvent) {
+
+ var _one = function(_el) {
+ var id = this.getId(_el);
+ this.manage(id, _el);
+ this.getGroupManager().addToGroup(group, _el, doNotFireEvent);
+ }.bind(this);
+
+ if (Array.isArray(el)) {
+ for (var i = 0; i < el.length; i++) {
+ _one(el[i]);
+ }
+ } else {
+ _one(el);
+ }
+ };
+
+ /**
+ * Remove an element from a group.
+ * @method removeFromGroup
+ * @param {String} group Group, or ID of the group, to remove the element from.
+ * @param {Element} el Element to add to the group.
+ */
+ _jpi.prototype.removeFromGroup = function(group, el, doNotFireEvent) {
+ this.getGroupManager().removeFromGroup(group, el, doNotFireEvent);
+ };
+
+ /**
+ * Remove a group, and optionally remove its members from the jsPlumb instance.
+ * @method removeGroup
+ * @param {String|Group} group Group to delete, or ID of Group to delete.
+ * @param {Boolean} [deleteMembers=false] If true, group members will be removed along with the group. Otherwise they will
+ * just be 'orphaned' (returned to the main container).
+ */
+ _jpi.prototype.removeGroup = function(group, deleteMembers, manipulateDOM, doNotFireEvent) {
+ this.getGroupManager().removeGroup(group, deleteMembers, manipulateDOM, doNotFireEvent);
+ };
+
+ /**
+ * Remove all groups, and optionally remove their members from the jsPlumb instance.
+ * @method removeAllGroup
+ * @param {Boolean} [deleteMembers=false] If true, group members will be removed along with the groups. Otherwise they will
+ * just be 'orphaned' (returned to the main container).
+ */
+ _jpi.prototype.removeAllGroups = function(deleteMembers, manipulateDOM, doNotFireEvent) {
+ this.getGroupManager().removeAllGroups(deleteMembers, manipulateDOM, doNotFireEvent);
+ };
+
+ /**
+ * Get a Group
+ * @method getGroup
+ * @param {String} groupId ID of the group to get
+ * @return {Group} Group with the given ID, null if not found.
+ */
+ _jpi.prototype.getGroup = function(groupId) {
+ return this.getGroupManager().getGroup(groupId);
+ };
+
+ /**
+ * Gets all the Groups managed by the jsPlumb instance.
+ * @returns {Group[]} List of Groups. Empty if none.
+ */
+ _jpi.prototype.getGroups = function() {
+ return this.getGroupManager().getGroups();
+ };
+
+ /**
+ * Expands a group element. jsPlumb doesn't do "everything" for you here, because what it means to expand a Group
+ * will vary from application to application. jsPlumb does these things:
+ *
+ * - Hides any connections that are internal to the group (connections between members, and connections from member of
+ * the group to the group itself)
+ * - Proxies all connections for which the source or target is a member of the group.
+ * - Hides the proxied connections.
+ * - Adds the jtk-group-expanded class to the group's element
+ * - Removes the jtk-group-collapsed class from the group's element.
+ *
+ * @method expandGroup
+ * @param {String|Group} group Group to expand, or ID of Group to expand.
+ */
+ _jpi.prototype.expandGroup = function(group) {
+ this.getGroupManager().expandGroup(group);
+ };
+
+ /**
+ * Collapses a group element. jsPlumb doesn't do "everything" for you here, because what it means to collapse a Group
+ * will vary from application to application. jsPlumb does these things:
+ *
+ * - Shows any connections that are internal to the group (connections between members, and connections from member of
+ * the group to the group itself)
+ * - Removes proxies for all connections for which the source or target is a member of the group.
+ * - Shows the previously proxied connections.
+ * - Adds the jtk-group-collapsed class to the group's element
+ * - Removes the jtk-group-expanded class from the group's element.
+ *
+ * @method expandGroup
+ * @param {String|Group} group Group to expand, or ID of Group to expand.
+ */
+ _jpi.prototype.collapseGroup = function(groupId) {
+ this.getGroupManager().collapseGroup(groupId);
+ };
+
+
+ _jpi.prototype.repaintGroup = function(group) {
+ this.getGroupManager().repaintGroup(group);
+ };
+
+ /**
+ * Collapses or expands a group element depending on its current state. See notes in the collapseGroup and expandGroup method.
+ *
+ * @method toggleGroup
+ * @param {String|Group} group Group to expand/collapse, or ID of Group to expand/collapse.
+ */
+ _jpi.prototype.toggleGroup = function(group) {
+ group = this.getGroupManager().getGroup(group);
+ if (group != null) {
+ this.getGroupManager()[group.collapsed ? "expandGroup" : "collapseGroup"](group);
+ }
+ };
+
+ //
+ // lazy init a group manager for the given jsplumb instance.
+ //
+ _jpi.prototype.getGroupManager = function() {
+ var mgr = this[GROUP_MANAGER];
+ if (mgr == null) {
+ mgr = this[GROUP_MANAGER] = new GroupManager(this);
+ }
+ return mgr;
+ };
+
+ _jpi.prototype.removeGroupManager = function() {
+ delete this[GROUP_MANAGER];
+ };
+
+ /**
+ * Gets the Group that the given element belongs to, null if none.
+ * @method getGroupFor
+ * @param {String|Element} el Element, or element ID.
+ * @returns {Group} A Group, if found, or null.
+ */
+ _jpi.prototype.getGroupFor = function(el) {
+ el = this.getElement(el);
+ if (el) {
+ return el[GROUP];
+ }
+ };
+
+}).call(typeof window !== 'undefined' ? window : this);
+
+
+/*
+ * jsPlumb Community Edition
+ *
+ * Provides a way to visually connect elements on an HTML page, using SVG.
+ *
+ * This file contains the 'flowchart' connectors, consisting of vertical and horizontal line segments.
+ *
+ * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
+ *
+ * https://jsplumbtoolkit.com
+ * https://github.com/jsplumb/jsplumb
+ *
+ * Dual licensed under the MIT and GPL2 licenses.
+ */
+;
+(function () {
+
+ "use strict";
+ var root = this, _jp = root.jsPlumb, _ju = root.jsPlumbUtil;
+
+ var Flowchart = function (params) {
+ this.type = "Flowchart";
+ params = params || {};
+ params.stub = params.stub == null ? 30 : params.stub;
+ var segments,
+ _super = _jp.Connectors.AbstractConnector.apply(this, arguments),
+ midpoint = params.midpoint == null ? 0.5 : params.midpoint,
+ alwaysRespectStubs = params.alwaysRespectStubs === true,
+ lastx = null, lasty = null, lastOrientation,
+ cornerRadius = params.cornerRadius != null ? params.cornerRadius : 0,
+
+ // TODO now common between this and AbstractBezierEditor; refactor into superclass?
+ loopbackRadius = params.loopbackRadius || 25,
+ isLoopbackCurrently = false,
+
+ sgn = function (n) {
+ return n < 0 ? -1 : n === 0 ? 0 : 1;
+ },
+ /**
+ * helper method to add a segment.
+ */
+ addSegment = function (segments, x, y, paintInfo) {
+ if (lastx === x && lasty === y) {
+ return;
+ }
+ var lx = lastx == null ? paintInfo.sx : lastx,
+ ly = lasty == null ? paintInfo.sy : lasty,
+ o = lx === x ? "v" : "h",
+ sgnx = sgn(x - lx),
+ sgny = sgn(y - ly);
+
+ lastx = x;
+ lasty = y;
+ segments.push([lx, ly, x, y, o, sgnx, sgny]);
+ },
+ segLength = function (s) {
+ return Math.sqrt(Math.pow(s[0] - s[2], 2) + Math.pow(s[1] - s[3], 2));
+ },
+ _cloneArray = function (a) {
+ var _a = [];
+ _a.push.apply(_a, a);
+ return _a;
+ },
+ writeSegments = function (conn, segments, paintInfo) {
+ var current = null, next;
+ for (var i = 0; i < segments.length - 1; i++) {
+
+ current = current || _cloneArray(segments[i]);
+ next = _cloneArray(segments[i + 1]);
+ if (cornerRadius > 0 && current[4] !== next[4]) {
+ var radiusToUse = Math.min(cornerRadius, segLength(current), segLength(next));
+ // right angle. adjust current segment's end point, and next segment's start point.
+ current[2] -= current[5] * radiusToUse;
+ current[3] -= current[6] * radiusToUse;
+ next[0] += next[5] * radiusToUse;
+ next[1] += next[6] * radiusToUse;
+ var ac = (current[6] === next[5] && next[5] === 1) ||
+ ((current[6] === next[5] && next[5] === 0) && current[5] !== next[6]) ||
+ (current[6] === next[5] && next[5] === -1),
+ sgny = next[1] > current[3] ? 1 : -1,
+ sgnx = next[0] > current[2] ? 1 : -1,
+ sgnEqual = sgny === sgnx,
+ cx = (sgnEqual && ac || (!sgnEqual && !ac)) ? next[0] : current[2],
+ cy = (sgnEqual && ac || (!sgnEqual && !ac)) ? current[3] : next[1];
+
+ _super.addSegment(conn, "Straight", {
+ x1: current[0], y1: current[1], x2: current[2], y2: current[3]
+ });
+
+ _super.addSegment(conn, "Arc", {
+ r: radiusToUse,
+ x1: current[2],
+ y1: current[3],
+ x2: next[0],
+ y2: next[1],
+ cx: cx,
+ cy: cy,
+ ac: ac
+ });
+ }
+ else {
+ // dx + dy are used to adjust for line width.
+ var dx = (current[2] === current[0]) ? 0 : (current[2] > current[0]) ? (paintInfo.lw / 2) : -(paintInfo.lw / 2),
+ dy = (current[3] === current[1]) ? 0 : (current[3] > current[1]) ? (paintInfo.lw / 2) : -(paintInfo.lw / 2);
+ _super.addSegment(conn, "Straight", {
+ x1: current[0] - dx, y1: current[1] - dy, x2: current[2] + dx, y2: current[3] + dy
+ });
+ }
+ current = next;
+ }
+ if (next != null) {
+ // last segment
+ _super.addSegment(conn, "Straight", {
+ x1: next[0], y1: next[1], x2: next[2], y2: next[3]
+ });
+ }
+ };
+
+ this._compute = function (paintInfo, params) {
+
+ segments = [];
+ lastx = null;
+ lasty = null;
+ lastOrientation = null;
+
+ var commonStubCalculator = function () {
+ return [ paintInfo.startStubX, paintInfo.startStubY, paintInfo.endStubX, paintInfo.endStubY ];
+ },
+ stubCalculators = {
+ perpendicular: commonStubCalculator,
+ orthogonal: commonStubCalculator,
+ opposite: function (axis) {
+ var pi = paintInfo,
+ idx = axis === "x" ? 0 : 1,
+ areInProximity = {
+ "x": function () {
+ return ( (pi.so[idx] === 1 && (
+ ( (pi.startStubX > pi.endStubX) && (pi.tx > pi.startStubX) ) ||
+ ( (pi.sx > pi.endStubX) && (pi.tx > pi.sx))))) ||
+
+ ( (pi.so[idx] === -1 && (
+ ( (pi.startStubX < pi.endStubX) && (pi.tx < pi.startStubX) ) ||
+ ( (pi.sx < pi.endStubX) && (pi.tx < pi.sx)))));
+ },
+ "y": function () {
+ return ( (pi.so[idx] === 1 && (
+ ( (pi.startStubY > pi.endStubY) && (pi.ty > pi.startStubY) ) ||
+ ( (pi.sy > pi.endStubY) && (pi.ty > pi.sy))))) ||
+
+ ( (pi.so[idx] === -1 && (
+ ( (pi.startStubY < pi.endStubY) && (pi.ty < pi.startStubY) ) ||
+ ( (pi.sy < pi.endStubY) && (pi.ty < pi.sy)))));
+ }
+ };
+
+ if (!alwaysRespectStubs && areInProximity[axis]()) {
+ return {
+ "x": [(paintInfo.sx + paintInfo.tx) / 2, paintInfo.startStubY, (paintInfo.sx + paintInfo.tx) / 2, paintInfo.endStubY],
+ "y": [paintInfo.startStubX, (paintInfo.sy + paintInfo.ty) / 2, paintInfo.endStubX, (paintInfo.sy + paintInfo.ty) / 2]
+ }[axis];
+ }
+ else {
+ return [ paintInfo.startStubX, paintInfo.startStubY, paintInfo.endStubX, paintInfo.endStubY ];
+ }
+ }
+ };
+
+ // calculate Stubs.
+ var stubs = stubCalculators[paintInfo.anchorOrientation](paintInfo.sourceAxis),
+ idx = paintInfo.sourceAxis === "x" ? 0 : 1,
+ oidx = paintInfo.sourceAxis === "x" ? 1 : 0,
+ ss = stubs[idx],
+ oss = stubs[oidx],
+ es = stubs[idx + 2],
+ oes = stubs[oidx + 2];
+
+ // add the start stub segment. use stubs for loopback as it will look better, with the loop spaced
+ // away from the element.
+ addSegment(segments, stubs[0], stubs[1], paintInfo);
+
+ // if its a loopback and we should treat it differently.
+ if (false) {
+
+ // we use loopbackRadius here, as statemachine connectors do.
+ // so we go radius to the left from stubs[0], then upwards by 2*radius, to the right by 2*radius,
+ // down by 2*radius, left by radius.
+ addSegment(segments, stubs[0] - loopbackRadius, stubs[1], paintInfo);
+ addSegment(segments, stubs[0] - loopbackRadius, stubs[1] - (2 * loopbackRadius), paintInfo);
+ addSegment(segments, stubs[0] + loopbackRadius, stubs[1] - (2 * loopbackRadius), paintInfo);
+ addSegment(segments, stubs[0] + loopbackRadius, stubs[1], paintInfo);
+ addSegment(segments, stubs[0], stubs[1], paintInfo);
+
+ }
+ else {
+
+
+ var midx = paintInfo.startStubX + ((paintInfo.endStubX - paintInfo.startStubX) * midpoint),
+ midy = paintInfo.startStubY + ((paintInfo.endStubY - paintInfo.startStubY) * midpoint);
+
+ var orientations = { x: [ 0, 1 ], y: [ 1, 0 ] },
+ lineCalculators = {
+ perpendicular: function (axis) {
+ var pi = paintInfo,
+ sis = {
+ x: [
+ [ [ 1, 2, 3, 4 ], null, [ 2, 1, 4, 3 ] ],
+ null,
+ [ [ 4, 3, 2, 1 ], null, [ 3, 4, 1, 2 ] ]
+ ],
+ y: [
+ [ [ 3, 2, 1, 4 ], null, [ 2, 3, 4, 1 ] ],
+ null,
+ [ [ 4, 1, 2, 3 ], null, [ 1, 4, 3, 2 ] ]
+ ]
+ },
+ stubs = {
+ x: [ [ pi.startStubX, pi.endStubX ], null, [ pi.endStubX, pi.startStubX ] ],
+ y: [ [ pi.startStubY, pi.endStubY ], null, [ pi.endStubY, pi.startStubY ] ]
+ },
+ midLines = {
+ x: [ [ midx, pi.startStubY ], [ midx, pi.endStubY ] ],
+ y: [ [ pi.startStubX, midy ], [ pi.endStubX, midy ] ]
+ },
+ linesToEnd = {
+ x: [ [ pi.endStubX, pi.startStubY ] ],
+ y: [ [ pi.startStubX, pi.endStubY ] ]
+ },
+ startToEnd = {
+ x: [ [ pi.startStubX, pi.endStubY ], [ pi.endStubX, pi.endStubY ] ],
+ y: [ [ pi.endStubX, pi.startStubY ], [ pi.endStubX, pi.endStubY ] ]
+ },
+ startToMidToEnd = {
+ x: [ [ pi.startStubX, midy ], [ pi.endStubX, midy ], [ pi.endStubX, pi.endStubY ] ],
+ y: [ [ midx, pi.startStubY ], [ midx, pi.endStubY ], [ pi.endStubX, pi.endStubY ] ]
+ },
+ otherStubs = {
+ x: [ pi.startStubY, pi.endStubY ],
+ y: [ pi.startStubX, pi.endStubX ]
+ },
+ soIdx = orientations[axis][0], toIdx = orientations[axis][1],
+ _so = pi.so[soIdx] + 1,
+ _to = pi.to[toIdx] + 1,
+ otherFlipped = (pi.to[toIdx] === -1 && (otherStubs[axis][1] < otherStubs[axis][0])) || (pi.to[toIdx] === 1 && (otherStubs[axis][1] > otherStubs[axis][0])),
+ stub1 = stubs[axis][_so][0],
+ stub2 = stubs[axis][_so][1],
+ segmentIndexes = sis[axis][_so][_to];
+
+ if (pi.segment === segmentIndexes[3] || (pi.segment === segmentIndexes[2] && otherFlipped)) {
+ return midLines[axis];
+ }
+ else if (pi.segment === segmentIndexes[2] && stub2 < stub1) {
+ return linesToEnd[axis];
+ }
+ else if ((pi.segment === segmentIndexes[2] && stub2 >= stub1) || (pi.segment === segmentIndexes[1] && !otherFlipped)) {
+ return startToMidToEnd[axis];
+ }
+ else if (pi.segment === segmentIndexes[0] || (pi.segment === segmentIndexes[1] && otherFlipped)) {
+ return startToEnd[axis];
+ }
+ },
+ orthogonal: function (axis, startStub, otherStartStub, endStub, otherEndStub) {
+ var pi = paintInfo,
+ extent = {
+ "x": pi.so[0] === -1 ? Math.min(startStub, endStub) : Math.max(startStub, endStub),
+ "y": pi.so[1] === -1 ? Math.min(startStub, endStub) : Math.max(startStub, endStub)
+ }[axis];
+
+ return {
+ "x": [
+ [ extent, otherStartStub ],
+ [ extent, otherEndStub ],
+ [ endStub, otherEndStub ]
+ ],
+ "y": [
+ [ otherStartStub, extent ],
+ [ otherEndStub, extent ],
+ [ otherEndStub, endStub ]
+ ]
+ }[axis];
+ },
+ opposite: function (axis, ss, oss, es) {
+ var pi = paintInfo,
+ otherAxis = {"x": "y", "y": "x"}[axis],
+ dim = {"x": "height", "y": "width"}[axis],
+ comparator = pi["is" + axis.toUpperCase() + "GreaterThanStubTimes2"];
+
+ if (params.sourceEndpoint.elementId === params.targetEndpoint.elementId) {
+ var _val = oss + ((1 - params.sourceEndpoint.anchor[otherAxis]) * params.sourceInfo[dim]) + _super.maxStub;
+ return {
+ "x": [
+ [ ss, _val ],
+ [ es, _val ]
+ ],
+ "y": [
+ [ _val, ss ],
+ [ _val, es ]
+ ]
+ }[axis];
+
+ }
+ else if (!comparator || (pi.so[idx] === 1 && ss > es) || (pi.so[idx] === -1 && ss < es)) {
+ return {
+ "x": [
+ [ ss, midy ],
+ [ es, midy ]
+ ],
+ "y": [
+ [ midx, ss ],
+ [ midx, es ]
+ ]
+ }[axis];
+ }
+ else if ((pi.so[idx] === 1 && ss < es) || (pi.so[idx] === -1 && ss > es)) {
+ return {
+ "x": [
+ [ midx, pi.sy ],
+ [ midx, pi.ty ]
+ ],
+ "y": [
+ [ pi.sx, midy ],
+ [ pi.tx, midy ]
+ ]
+ }[axis];
+ }
+ }
+ };
+
+ // compute the rest of the line
+ var p = lineCalculators[paintInfo.anchorOrientation](paintInfo.sourceAxis, ss, oss, es, oes);
+ if (p) {
+ for (var i = 0; i < p.length; i++) {
+ addSegment(segments, p[i][0], p[i][1], paintInfo);
+ }
+ }
+
+ // line to end stub
+ addSegment(segments, stubs[2], stubs[3], paintInfo);
+
+ }
+
+ // end stub to end (common)
+ addSegment(segments, paintInfo.tx, paintInfo.ty, paintInfo);
+
+ // write out the segments.
+ writeSegments(this, segments, paintInfo);
+ };
+
+ /*this.getPath = function () {
+ var _last = null, _lastAxis = null, s = [], segs = segments;
+ for (var i = 0; i < segs.length; i++) {
+ var seg = segs[i], axis = seg[4], axisIndex = (axis == "v" ? 3 : 2);
+ if (_last != null && _lastAxis === axis) {
+ _last[axisIndex] = seg[axisIndex];
+ }
+ else {
+ if (seg[0] != seg[2] || seg[1] != seg[3]) {
+ s.push({
+ start: [ seg[0], seg[1] ],
+ end: [ seg[2], seg[3] ]
+ });
+ _last = seg;
+ _lastAxis = seg[4];
+ }
+ }
+ }
+ return s;
+ };*/
+ };
+
+ _ju.extend(Flowchart, _jp.Connectors.AbstractConnector);
+ _jp.registerConnectorType(Flowchart, "Flowchart");
+}).call(typeof window !== 'undefined' ? window : this);
+/*
+ * jsPlumb Community Edition
+ *
+ * Provides a way to visually connect elements on an HTML page, using SVG.
+ *
+ * This file contains the code for the Bezier connector type.
+ *
+ * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
+ *
+ * https://jsplumbtoolkit.com
+ * https://github.com/jsplumb/jsplumb
+ *
+ * Dual licensed under the MIT and GPL2 licenses.
+ */
+;
+(function () {
+
+ "use strict";
+ var root = this, _jp = root.jsPlumb, _ju = root.jsPlumbUtil;
+
+ _jp.Connectors.AbstractBezierConnector = function(params) {
+ params = params || {};
+ var showLoopback = params.showLoopback !== false,
+ curviness = params.curviness || 10,
+ margin = params.margin || 5,
+ proximityLimit = params.proximityLimit || 80,
+ clockwise = params.orientation && params.orientation === "clockwise",
+ loopbackRadius = params.loopbackRadius || 25,
+ isLoopbackCurrently = false,
+ _super;
+
+ this.overrideSetEditable = function() { return !isLoopbackCurrently; };
+
+ this._compute = function (paintInfo, p) {
+
+ var sp = p.sourcePos,
+ tp = p.targetPos,
+ _w = Math.abs(sp[0] - tp[0]),
+ _h = Math.abs(sp[1] - tp[1]);
+
+ if (!showLoopback || (p.sourceEndpoint.elementId !== p.targetEndpoint.elementId)) {
+ isLoopbackCurrently = false;
+ this._computeBezier(paintInfo, p, sp, tp, _w, _h);
+ } else {
+ isLoopbackCurrently = true;
+ // a loopback connector. draw an arc from one anchor to the other.
+ var x1 = p.sourcePos[0], y1 = p.sourcePos[1] - margin,
+ cx = x1, cy = y1 - loopbackRadius,
+ // canvas sizing stuff, to ensure the whole painted area is visible.
+ _x = cx - loopbackRadius,
+ _y = cy - loopbackRadius;
+
+ _w = 2 * loopbackRadius;
+ _h = 2 * loopbackRadius;
+
+ paintInfo.points[0] = _x;
+ paintInfo.points[1] = _y;
+ paintInfo.points[2] = _w;
+ paintInfo.points[3] = _h;
+
+ // ADD AN ARC SEGMENT.
+ _super.addSegment(this, "Arc", {
+ loopback: true,
+ x1: (x1 - _x) + 4,
+ y1: y1 - _y,
+ startAngle: 0,
+ endAngle: 2 * Math.PI,
+ r: loopbackRadius,
+ ac: !clockwise,
+ x2: (x1 - _x) - 4,
+ y2: y1 - _y,
+ cx: cx - _x,
+ cy: cy - _y
+ });
+ }
+ };
+
+ _super = _jp.Connectors.AbstractConnector.apply(this, arguments);
+ return _super;
+ };
+ _ju.extend(_jp.Connectors.AbstractBezierConnector, _jp.Connectors.AbstractConnector);
+
+ var Bezier = function (params) {
+ params = params || {};
+ this.type = "Bezier";
+
+ var _super = _jp.Connectors.AbstractBezierConnector.apply(this, arguments),
+ majorAnchor = params.curviness || 150,
+ minorAnchor = 10;
+
+ this.getCurviness = function () {
+ return majorAnchor;
+ };
+
+ this._findControlPoint = function (point, sourceAnchorPosition, targetAnchorPosition, sourceEndpoint, targetEndpoint, soo, too) {
+ // determine if the two anchors are perpendicular to each other in their orientation. we swap the control
+ // points around if so (code could be tightened up)
+ var perpendicular = soo[0] !== too[0] || soo[1] === too[1],
+ p = [];
+
+ if (!perpendicular) {
+ if (soo[0] === 0) {
+ p.push(sourceAnchorPosition[0] < targetAnchorPosition[0] ? point[0] + minorAnchor : point[0] - minorAnchor);
+ }
+ else {
+ p.push(point[0] - (majorAnchor * soo[0]));
+ }
+
+ if (soo[1] === 0) {
+ p.push(sourceAnchorPosition[1] < targetAnchorPosition[1] ? point[1] + minorAnchor : point[1] - minorAnchor);
+ }
+ else {
+ p.push(point[1] + (majorAnchor * too[1]));
+ }
+ }
+ else {
+ if (too[0] === 0) {
+ p.push(targetAnchorPosition[0] < sourceAnchorPosition[0] ? point[0] + minorAnchor : point[0] - minorAnchor);
+ }
+ else {
+ p.push(point[0] + (majorAnchor * too[0]));
+ }
+
+ if (too[1] === 0) {
+ p.push(targetAnchorPosition[1] < sourceAnchorPosition[1] ? point[1] + minorAnchor : point[1] - minorAnchor);
+ }
+ else {
+ p.push(point[1] + (majorAnchor * soo[1]));
+ }
+ }
+
+ return p;
+ };
+
+ this._computeBezier = function (paintInfo, p, sp, tp, _w, _h) {
+
+ var geometry = this.getGeometry(), _CP, _CP2,
+ _sx = sp[0] < tp[0] ? _w : 0,
+ _sy = sp[1] < tp[1] ? _h : 0,
+ _tx = sp[0] < tp[0] ? 0 : _w,
+ _ty = sp[1] < tp[1] ? 0 : _h;
+
+ if ((this.hasBeenEdited() || this.isEditing()) && geometry != null && geometry.controlPoints != null && geometry.controlPoints[0] != null && geometry.controlPoints[1] != null) {
+ _CP = geometry.controlPoints[0];
+ _CP2 = geometry.controlPoints[1];
+ }
+ else {
+ _CP = this._findControlPoint([_sx, _sy], sp, tp, p.sourceEndpoint, p.targetEndpoint, paintInfo.so, paintInfo.to);
+ _CP2 = this._findControlPoint([_tx, _ty], tp, sp, p.targetEndpoint, p.sourceEndpoint, paintInfo.to, paintInfo.so);
+ }
+
+ _super.setGeometry({controlPoints:[_CP, _CP2]}, true);
+
+ _super.addSegment(this, "Bezier", {
+ x1: _sx, y1: _sy, x2: _tx, y2: _ty,
+ cp1x: _CP[0], cp1y: _CP[1], cp2x: _CP2[0], cp2y: _CP2[1]
+ });
+ };
+
+
+ };
+
+ _ju.extend(Bezier, _jp.Connectors.AbstractBezierConnector);
+ _jp.registerConnectorType(Bezier, "Bezier");
+
+}).call(typeof window !== 'undefined' ? window : this);
+/*
+ * jsPlumb Community Edition
+ *
+ * Provides a way to visually connect elements on an HTML page, using SVG.
+ *
+ * This file contains the state machine connectors, which extend AbstractBezierConnector.
+ *
+ * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
+ *
+ * https://jsplumbtoolkit.com
+ * https://github.com/jsplumb/jsplumb
+ *
+ * Dual licensed under the MIT and GPL2 licenses.
+ */
+;
+(function () {
+
+ "use strict";
+ var root = this, _jp = root.jsPlumb, _ju = root.jsPlumbUtil;
+
+ var _segment = function (x1, y1, x2, y2) {
+ if (x1 <= x2 && y2 <= y1) {
+ return 1;
+ }
+ else if (x1 <= x2 && y1 <= y2) {
+ return 2;
+ }
+ else if (x2 <= x1 && y2 >= y1) {
+ return 3;
+ }
+ return 4;
+ },
+
+ // the control point we will use depends on the faces to which each end of the connection is assigned, specifically whether or not the
+ // two faces are parallel or perpendicular. if they are parallel then the control point lies on the midpoint of the axis in which they
+ // are parellel and varies only in the other axis; this variation is proportional to the distance that the anchor points lie from the
+ // center of that face. if the two faces are perpendicular then the control point is at some distance from both the midpoints; the amount and
+ // direction are dependent on the orientation of the two elements. 'seg', passed in to this method, tells you which segment the target element
+ // lies in with respect to the source: 1 is top right, 2 is bottom right, 3 is bottom left, 4 is top left.
+ //
+ // sourcePos and targetPos are arrays of info about where on the source and target each anchor is located. their contents are:
+ //
+ // 0 - absolute x
+ // 1 - absolute y
+ // 2 - proportional x in element (0 is left edge, 1 is right edge)
+ // 3 - proportional y in element (0 is top edge, 1 is bottom edge)
+ //
+ _findControlPoint = function (midx, midy, segment, sourceEdge, targetEdge, dx, dy, distance, proximityLimit) {
+ // TODO (maybe)
+ // - if anchor pos is 0.5, make the control point take into account the relative position of the elements.
+ if (distance <= proximityLimit) {
+ return [midx, midy];
+ }
+
+ if (segment === 1) {
+ if (sourceEdge[3] <= 0 && targetEdge[3] >= 1) {
+ return [ midx + (sourceEdge[2] < 0.5 ? -1 * dx : dx), midy ];
+ }
+ else if (sourceEdge[2] >= 1 && targetEdge[2] <= 0) {
+ return [ midx, midy + (sourceEdge[3] < 0.5 ? -1 * dy : dy) ];
+ }
+ else {
+ return [ midx + (-1 * dx) , midy + (-1 * dy) ];
+ }
+ }
+ else if (segment === 2) {
+ if (sourceEdge[3] >= 1 && targetEdge[3] <= 0) {
+ return [ midx + (sourceEdge[2] < 0.5 ? -1 * dx : dx), midy ];
+ }
+ else if (sourceEdge[2] >= 1 && targetEdge[2] <= 0) {
+ return [ midx, midy + (sourceEdge[3] < 0.5 ? -1 * dy : dy) ];
+ }
+ else {
+ return [ midx + dx, midy + (-1 * dy) ];
+ }
+ }
+ else if (segment === 3) {
+ if (sourceEdge[3] >= 1 && targetEdge[3] <= 0) {
+ return [ midx + (sourceEdge[2] < 0.5 ? -1 * dx : dx), midy ];
+ }
+ else if (sourceEdge[2] <= 0 && targetEdge[2] >= 1) {
+ return [ midx, midy + (sourceEdge[3] < 0.5 ? -1 * dy : dy) ];
+ }
+ else {
+ return [ midx + (-1 * dx) , midy + (-1 * dy) ];
+ }
+ }
+ else if (segment === 4) {
+ if (sourceEdge[3] <= 0 && targetEdge[3] >= 1) {
+ return [ midx + (sourceEdge[2] < 0.5 ? -1 * dx : dx), midy ];
+ }
+ else if (sourceEdge[2] <= 0 && targetEdge[2] >= 1) {
+ return [ midx, midy + (sourceEdge[3] < 0.5 ? -1 * dy : dy) ];
+ }
+ else {
+ return [ midx + dx , midy + (-1 * dy) ];
+ }
+ }
+
+ };
+
+ var StateMachine = function (params) {
+ params = params || {};
+ this.type = "StateMachine";
+
+ var _super = _jp.Connectors.AbstractBezierConnector.apply(this, arguments),
+ curviness = params.curviness || 10,
+ margin = params.margin || 5,
+ proximityLimit = params.proximityLimit || 80,
+ clockwise = params.orientation && params.orientation === "clockwise",
+ _controlPoint;
+
+ this._computeBezier = function(paintInfo, params, sp, tp, w, h) {
+ var _sx = params.sourcePos[0] < params.targetPos[0] ? 0 : w,
+ _sy = params.sourcePos[1] < params.targetPos[1] ? 0 : h,
+ _tx = params.sourcePos[0] < params.targetPos[0] ? w : 0,
+ _ty = params.sourcePos[1] < params.targetPos[1] ? h : 0;
+
+ // now adjust for the margin
+ if (params.sourcePos[2] === 0) {
+ _sx -= margin;
+ }
+ if (params.sourcePos[2] === 1) {
+ _sx += margin;
+ }
+ if (params.sourcePos[3] === 0) {
+ _sy -= margin;
+ }
+ if (params.sourcePos[3] === 1) {
+ _sy += margin;
+ }
+ if (params.targetPos[2] === 0) {
+ _tx -= margin;
+ }
+ if (params.targetPos[2] === 1) {
+ _tx += margin;
+ }
+ if (params.targetPos[3] === 0) {
+ _ty -= margin;
+ }
+ if (params.targetPos[3] === 1) {
+ _ty += margin;
+ }
+
+ //
+ // these connectors are quadratic bezier curves, having a single control point. if both anchors
+ // are located at 0.5 on their respective faces, the control point is set to the midpoint and you
+ // get a straight line. this is also the case if the two anchors are within 'proximityLimit', since
+ // it seems to make good aesthetic sense to do that. outside of that, the control point is positioned
+ // at 'curviness' pixels away along the normal to the straight line connecting the two anchors.
+ //
+ // there may be two improvements to this. firstly, we might actually support the notion of avoiding nodes
+ // in the UI, or at least making a good effort at doing so. if a connection would pass underneath some node,
+ // for example, we might increase the distance the control point is away from the midpoint in a bid to
+ // steer it around that node. this will work within limits, but i think those limits would also be the likely
+ // limits for, once again, aesthetic good sense in the layout of a chart using these connectors.
+ //
+ // the second possible change is actually two possible changes: firstly, it is possible we should gradually
+ // decrease the 'curviness' as the distance between the anchors decreases; start tailing it off to 0 at some
+ // point (which should be configurable). secondly, we might slightly increase the 'curviness' for connectors
+ // with respect to how far their anchor is from the center of its respective face. this could either look cool,
+ // or stupid, and may indeed work only in a way that is so subtle as to have been a waste of time.
+ //
+
+ var _midx = (_sx + _tx) / 2,
+ _midy = (_sy + _ty) / 2,
+ segment = _segment(_sx, _sy, _tx, _ty),
+ distance = Math.sqrt(Math.pow(_tx - _sx, 2) + Math.pow(_ty - _sy, 2)),
+ cp1x, cp2x, cp1y, cp2y,
+ geometry = _super.getGeometry();
+
+ if ((this.hasBeenEdited() || this.isEditing()) && geometry != null) {
+ cp1x = geometry.controlPoints[0][0];
+ cp1y = geometry.controlPoints[0][1];
+ cp2x = geometry.controlPoints[1][0];
+ cp2y = geometry.controlPoints[1][1];
+ }
+ else {
+ // calculate the control point. this code will be where we'll put in a rudimentary element avoidance scheme; it
+ // will work by extending the control point to force the curve to be, um, curvier.
+ _controlPoint = _findControlPoint(_midx,
+ _midy,
+ segment,
+ params.sourcePos,
+ params.targetPos,
+ curviness, curviness,
+ distance,
+ proximityLimit);
+
+ cp1x = _controlPoint[0];
+ cp2x = _controlPoint[0];
+ cp1y = _controlPoint[1];
+ cp2y = _controlPoint[1];
+
+ _super.setGeometry({controlPoints:[_controlPoint, _controlPoint]}, true);
+ }
+
+ _super.addSegment(this, "Bezier", {
+ x1: _tx, y1: _ty, x2: _sx, y2: _sy,
+ cp1x: cp1x, cp1y: cp1y,
+ cp2x: cp2x, cp2y: cp2y
+ });
+ };
+ };
+
+ _ju.extend(StateMachine, _jp.Connectors.AbstractBezierConnector);
+ _jp.registerConnectorType(StateMachine, "StateMachine");
+
+}).call(typeof window !== 'undefined' ? window : this);
+/*
+ * jsPlumb Community Edition
+ *
+ * Provides a way to visually connect elements on an HTML page, using SVG.
+ *
+ * This file contains the 'flowchart' connectors, consisting of vertical and horizontal line segments.
+ *
+ * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
+ *
+ * https://jsplumbtoolkit.com
+ * https://github.com/jsplumb/jsplumb
+ *
+ * Dual licensed under the MIT and GPL2 licenses.
+ */
+;
+(function () {
+
+ "use strict";
+ var root = this, _jp = root.jsPlumb, _ju = root.jsPlumbUtil;
+ var STRAIGHT = "Straight";
+
+ var Straight = function (params) {
+ this.type = STRAIGHT;
+ var _super = _jp.Connectors.AbstractConnector.apply(this, arguments);
+
+ this._compute = function (paintInfo, _) {
+ _super.addSegment(this, STRAIGHT, {x1: paintInfo.sx, y1: paintInfo.sy, x2: paintInfo.startStubX, y2: paintInfo.startStubY});
+ _super.addSegment(this, STRAIGHT, {x1: paintInfo.startStubX, y1: paintInfo.startStubY, x2: paintInfo.endStubX, y2: paintInfo.endStubY});
+ _super.addSegment(this, STRAIGHT, {x1: paintInfo.endStubX, y1: paintInfo.endStubY, x2: paintInfo.tx, y2: paintInfo.ty});
+ };
+ };
+
+ _ju.extend(Straight, _jp.Connectors.AbstractConnector);
+ _jp.registerConnectorType(Straight, STRAIGHT);
+
+}).call(typeof window !== 'undefined' ? window : this);
+/*
+ * jsPlumb Community Edition
+ *
+ * Provides a way to visually connect elements on an HTML page, using SVG.
+ *
+ * This file contains the SVG renderers.
+ *
+ * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
+ *
+ * https://jsplumbtoolkit.com
+ * https://github.com/jsplumb/jsplumb
+ *
+ * Dual licensed under the MIT and GPL2 licenses.
+ */
+;
+(function () {
+
+// ************************** SVG utility methods ********************************************
+
+ "use strict";
+ var root = this, _jp = root.jsPlumb, _ju = root.jsPlumbUtil;
+
+ var svgAttributeMap = {
+ "stroke-linejoin": "stroke-linejoin",
+ "stroke-dashoffset": "stroke-dashoffset",
+ "stroke-linecap": "stroke-linecap"
+ },
+ STROKE_DASHARRAY = "stroke-dasharray",
+ DASHSTYLE = "dashstyle",
+ LINEAR_GRADIENT = "linearGradient",
+ RADIAL_GRADIENT = "radialGradient",
+ DEFS = "defs",
+ FILL = "fill",
+ STOP = "stop",
+ STROKE = "stroke",
+ STROKE_WIDTH = "stroke-width",
+ STYLE = "style",
+ NONE = "none",
+ JSPLUMB_GRADIENT = "jsplumb_gradient_",
+ LINE_WIDTH = "strokeWidth",
+ ns = {
+ svg: "http://www.w3.org/2000/svg"
+ },
+ _attr = function (node, attributes) {
+ for (var i in attributes) {
+ node.setAttribute(i, "" + attributes[i]);
+ }
+ },
+ _node = function (name, attributes) {
+ attributes = attributes || {};
+ attributes.version = "1.1";
+ attributes.xmlns = ns.svg;
+ return _jp.createElementNS(ns.svg, name, null, null, attributes);
+ },
+ _pos = function (d) {
+ return "position:absolute;left:" + d[0] + "px;top:" + d[1] + "px";
+ },
+ _clearGradient = function (parent) {
+ var els = parent.querySelectorAll(" defs,linearGradient,radialGradient");
+ for (var i = 0; i < els.length; i++) {
+ els[i].parentNode.removeChild(els[i]);
+ }
+ },
+ _updateGradient = function (parent, node, style, dimensions, uiComponent) {
+ var id = JSPLUMB_GRADIENT + uiComponent._jsPlumb.instance.idstamp();
+ // first clear out any existing gradient
+ _clearGradient(parent);
+ // this checks for an 'offset' property in the gradient, and in the absence of it, assumes
+ // we want a linear gradient. if it's there, we create a radial gradient.
+ // it is possible that a more explicit means of defining the gradient type would be
+ // better. relying on 'offset' means that we can never have a radial gradient that uses
+ // some default offset, for instance.
+ // issue 244 suggested the 'gradientUnits' attribute; without this, straight/flowchart connectors with gradients would
+ // not show gradients when the line was perfectly horizontal or vertical.
+ var g;
+ if (!style.gradient.offset) {
+ g = _node(LINEAR_GRADIENT, {id: id, gradientUnits: "userSpaceOnUse"});
+ }
+ else {
+ g = _node(RADIAL_GRADIENT, { id: id });
+ }
+
+ var defs = _node(DEFS);
+ parent.appendChild(defs);
+ defs.appendChild(g);
+
+ // the svg radial gradient seems to treat stops in the reverse
+ // order to how canvas does it. so we want to keep all the maths the same, but
+ // iterate the actual style declarations in reverse order, if the x indexes are not in order.
+ for (var i = 0; i < style.gradient.stops.length; i++) {
+ var styleToUse = uiComponent.segment === 1 || uiComponent.segment === 2 ? i : style.gradient.stops.length - 1 - i,
+ stopColor = style.gradient.stops[styleToUse][1],
+ s = _node(STOP, {"offset": Math.floor(style.gradient.stops[i][0] * 100) + "%", "stop-color": stopColor});
+
+ g.appendChild(s);
+ }
+ var applyGradientTo = style.stroke ? STROKE : FILL;
+ node.setAttribute(applyGradientTo, "url(#" + id + ")");
+ },
+ _applyStyles = function (parent, node, style, dimensions, uiComponent) {
+
+ node.setAttribute(FILL, style.fill ? style.fill : NONE);
+ node.setAttribute(STROKE, style.stroke ? style.stroke : NONE);
+
+ if (style.gradient) {
+ _updateGradient(parent, node, style, dimensions, uiComponent);
+ }
+ else {
+ // make sure we clear any existing gradient
+ _clearGradient(parent);
+ node.setAttribute(STYLE, "");
+ }
+
+ if (style.strokeWidth) {
+ node.setAttribute(STROKE_WIDTH, style.strokeWidth);
+ }
+
+ // in SVG there is a stroke-dasharray attribute we can set, and its syntax looks like
+ // the syntax in VML but is actually kind of nasty: values are given in the pixel
+ // coordinate space, whereas in VML they are multiples of the width of the stroked
+ // line, which makes a lot more sense. for that reason, jsPlumb is supporting both
+ // the native svg 'stroke-dasharray' attribute, and also the 'dashstyle' concept from
+ // VML, which will be the preferred method. the code below this converts a dashstyle
+ // attribute given in terms of stroke width into a pixel representation, by using the
+ // stroke's lineWidth.
+ if (style[DASHSTYLE] && style[LINE_WIDTH] && !style[STROKE_DASHARRAY]) {
+ var sep = style[DASHSTYLE].indexOf(",") === -1 ? " " : ",",
+ parts = style[DASHSTYLE].split(sep),
+ styleToUse = "";
+ parts.forEach(function (p) {
+ styleToUse += (Math.floor(p * style.strokeWidth) + sep);
+ });
+ node.setAttribute(STROKE_DASHARRAY, styleToUse);
+ }
+ else if (style[STROKE_DASHARRAY]) {
+ node.setAttribute(STROKE_DASHARRAY, style[STROKE_DASHARRAY]);
+ }
+
+ // extra attributes such as join type, dash offset.
+ for (var i in svgAttributeMap) {
+ if (style[i]) {
+ node.setAttribute(svgAttributeMap[i], style[i]);
+ }
+ }
+ },
+ _appendAtIndex = function (svg, path, idx) {
+ if (svg.childNodes.length > idx) {
+ svg.insertBefore(path, svg.childNodes[idx]);
+ }
+ else {
+ svg.appendChild(path);
+ }
+ };
+
+ /**
+ utility methods for other objects to use.
+ */
+ _ju.svg = {
+ node: _node,
+ attr: _attr,
+ pos: _pos
+ };
+
+ // ************************** / SVG utility methods ********************************************
+
+ /*
+ * Base class for SVG components.
+ */
+ var SvgComponent = function (params) {
+ var pointerEventsSpec = params.pointerEventsSpec || "all", renderer = {};
+
+ _jp.jsPlumbUIComponent.apply(this, params.originalArgs);
+ this.canvas = null;
+ this.path = null;
+ this.svg = null;
+ this.bgCanvas = null;
+
+ var clazz = params.cssClass + " " + (params.originalArgs[0].cssClass || ""),
+ svgParams = {
+ "style": "",
+ "width": 0,
+ "height": 0,
+ "pointer-events": pointerEventsSpec,
+ "position": "absolute"
+ };
+
+ this.svg = _node("svg", svgParams);
+
+ if (params.useDivWrapper) {
+ this.canvas = _jp.createElement("div", { position : "absolute" });
+ _ju.sizeElement(this.canvas, 0, 0, 1, 1);
+ this.canvas.className = clazz;
+ }
+ else {
+ _attr(this.svg, { "class": clazz });
+ this.canvas = this.svg;
+ }
+
+ params._jsPlumb.appendElement(this.canvas, params.originalArgs[0].parent);
+ if (params.useDivWrapper) {
+ this.canvas.appendChild(this.svg);
+ }
+
+ var displayElements = [ this.canvas ];
+ this.getDisplayElements = function () {
+ return displayElements;
+ };
+
+ this.appendDisplayElement = function (el) {
+ displayElements.push(el);
+ };
+
+ this.paint = function (style, anchor, extents) {
+ if (style != null) {
+
+ var xy = [ this.x, this.y ], wh = [ this.w, this.h ], p;
+ if (extents != null) {
+ if (extents.xmin < 0) {
+ xy[0] += extents.xmin;
+ }
+ if (extents.ymin < 0) {
+ xy[1] += extents.ymin;
+ }
+ wh[0] = extents.xmax + ((extents.xmin < 0) ? -extents.xmin : 0);
+ wh[1] = extents.ymax + ((extents.ymin < 0) ? -extents.ymin : 0);
+ }
+
+ if (params.useDivWrapper) {
+ _ju.sizeElement(this.canvas, xy[0], xy[1], wh[0], wh[1]);
+ xy[0] = 0;
+ xy[1] = 0;
+ p = _pos([ 0, 0 ]);
+ }
+ else {
+ p = _pos([ xy[0], xy[1] ]);
+ }
+
+ renderer.paint.apply(this, arguments);
+
+ _attr(this.svg, {
+ "style": p,
+ "width": wh[0] || 0,
+ "height": wh[1] || 0
+ });
+ }
+ };
+
+ return {
+ renderer: renderer
+ };
+ };
+
+ _ju.extend(SvgComponent, _jp.jsPlumbUIComponent, {
+ cleanup: function (force) {
+ if (force || this.typeId == null) {
+ if (this.canvas) {
+ this.canvas._jsPlumb = null;
+ }
+ if (this.svg) {
+ this.svg._jsPlumb = null;
+ }
+ if (this.bgCanvas) {
+ this.bgCanvas._jsPlumb = null;
+ }
+
+ if (this.canvas && this.canvas.parentNode) {
+ this.canvas.parentNode.removeChild(this.canvas);
+ }
+ if (this.bgCanvas && this.bgCanvas.parentNode) {
+ this.canvas.parentNode.removeChild(this.canvas);
+ }
+
+ this.svg = null;
+ this.canvas = null;
+ this.path = null;
+ this.group = null;
+ }
+ else {
+ // if not a forced cleanup, just detach from DOM for now.
+ if (this.canvas && this.canvas.parentNode) {
+ this.canvas.parentNode.removeChild(this.canvas);
+ }
+ if (this.bgCanvas && this.bgCanvas.parentNode) {
+ this.bgCanvas.parentNode.removeChild(this.bgCanvas);
+ }
+ }
+ },
+ reattach:function(instance) {
+ var c = instance.getContainer();
+ if (this.canvas && this.canvas.parentNode == null) {
+ c.appendChild(this.canvas);
+ }
+ if (this.bgCanvas && this.bgCanvas.parentNode == null) {
+ c.appendChild(this.bgCanvas);
+ }
+ },
+ setVisible: function (v) {
+ if (this.canvas) {
+ this.canvas.style.display = v ? "block" : "none";
+ }
+ }
+ });
+
+ /*
+ * Base class for SVG connectors.
+ */
+ _jp.ConnectorRenderers.svg = function (params) {
+ var self = this,
+ _super = SvgComponent.apply(this, [
+ {
+ cssClass: params._jsPlumb.connectorClass + (this.isEditable() ? " " + params._jsPlumb.editableConnectorClass : ""),
+ originalArgs: arguments,
+ pointerEventsSpec: "none",
+ _jsPlumb: params._jsPlumb
+ }
+ ]);
+
+ var _superSetEditable = this.setEditable;
+ this.setEditable = function(e) {
+ var result = _superSetEditable.apply(this, [e]);
+ _jp[result ? "addClass" : "removeClass"](this.canvas, this._jsPlumb.instance.editableConnectorClass);
+ };
+
+ _super.renderer.paint = function (style, anchor, extents) {
+
+ var segments = self.getSegments(), p = "", offset = [0, 0];
+ if (extents.xmin < 0) {
+ offset[0] = -extents.xmin;
+ }
+ if (extents.ymin < 0) {
+ offset[1] = -extents.ymin;
+ }
+
+ if (segments.length > 0) {
+
+ p = self.getPathData();
+
+ var a = {
+ d: p,
+ transform: "translate(" + offset[0] + "," + offset[1] + ")",
+ "pointer-events": params["pointer-events"] || "visibleStroke"
+ },
+ outlineStyle = null,
+ d = [self.x, self.y, self.w, self.h];
+
+ // outline style. actually means drawing an svg object underneath the main one.
+ if (style.outlineStroke) {
+ var outlineWidth = style.outlineWidth || 1,
+ outlineStrokeWidth = style.strokeWidth + (2 * outlineWidth);
+ outlineStyle = _jp.extend({}, style);
+ delete outlineStyle.gradient;
+ outlineStyle.stroke = style.outlineStroke;
+ outlineStyle.strokeWidth = outlineStrokeWidth;
+
+ if (self.bgPath == null) {
+ self.bgPath = _node("path", a);
+ _jp.addClass(self.bgPath, _jp.connectorOutlineClass);
+ _appendAtIndex(self.svg, self.bgPath, 0);
+ }
+ else {
+ _attr(self.bgPath, a);
+ }
+
+ _applyStyles(self.svg, self.bgPath, outlineStyle, d, self);
+ }
+
+ if (self.path == null) {
+ self.path = _node("path", a);
+ _appendAtIndex(self.svg, self.path, style.outlineStroke ? 1 : 0);
+ }
+ else {
+ _attr(self.path, a);
+ }
+
+ _applyStyles(self.svg, self.path, style, d, self);
+ }
+ };
+ };
+ _ju.extend(_jp.ConnectorRenderers.svg, SvgComponent);
+
+// ******************************* svg segment renderer *****************************************************
+
+
+// ******************************* /svg segments *****************************************************
+
+ /*
+ * Base class for SVG endpoints.
+ */
+ var SvgEndpoint = _jp.SvgEndpoint = function (params) {
+ var _super = SvgComponent.apply(this, [
+ {
+ cssClass: params._jsPlumb.endpointClass,
+ originalArgs: arguments,
+ pointerEventsSpec: "all",
+ useDivWrapper: true,
+ _jsPlumb: params._jsPlumb
+ }
+ ]);
+
+ _super.renderer.paint = function (style) {
+ var s = _jp.extend({}, style);
+ if (s.outlineStroke) {
+ s.stroke = s.outlineStroke;
+ }
+
+ if (this.node == null) {
+ this.node = this.makeNode(s);
+ this.svg.appendChild(this.node);
+ }
+ else if (this.updateNode != null) {
+ this.updateNode(this.node);
+ }
+ _applyStyles(this.svg, this.node, s, [ this.x, this.y, this.w, this.h ], this);
+ _pos(this.node, [ this.x, this.y ]);
+ }.bind(this);
+
+ };
+ _ju.extend(SvgEndpoint, SvgComponent);
+
+ /*
+ * SVG Dot Endpoint
+ */
+ _jp.Endpoints.svg.Dot = function () {
+ _jp.Endpoints.Dot.apply(this, arguments);
+ SvgEndpoint.apply(this, arguments);
+ this.makeNode = function (style) {
+ return _node("circle", {
+ "cx": this.w / 2,
+ "cy": this.h / 2,
+ "r": this.radius
+ });
+ };
+ this.updateNode = function (node) {
+ _attr(node, {
+ "cx": this.w / 2,
+ "cy": this.h / 2,
+ "r": this.radius
+ });
+ };
+ };
+ _ju.extend(_jp.Endpoints.svg.Dot, [_jp.Endpoints.Dot, SvgEndpoint]);
+
+ /*
+ * SVG Rectangle Endpoint
+ */
+ _jp.Endpoints.svg.Rectangle = function () {
+ _jp.Endpoints.Rectangle.apply(this, arguments);
+ SvgEndpoint.apply(this, arguments);
+ this.makeNode = function (style) {
+ return _node("rect", {
+ "width": this.w,
+ "height": this.h
+ });
+ };
+ this.updateNode = function (node) {
+ _attr(node, {
+ "width": this.w,
+ "height": this.h
+ });
+ };
+ };
+ _ju.extend(_jp.Endpoints.svg.Rectangle, [_jp.Endpoints.Rectangle, SvgEndpoint]);
+
+ /*
+ * SVG Image Endpoint is the default image endpoint.
+ */
+ _jp.Endpoints.svg.Image = _jp.Endpoints.Image;
+ /*
+ * Blank endpoint in svg renderer is the default Blank endpoint.
+ */
+ _jp.Endpoints.svg.Blank = _jp.Endpoints.Blank;
+ /*
+ * Label overlay in svg renderer is the default Label overlay.
+ */
+ _jp.Overlays.svg.Label = _jp.Overlays.Label;
+ /*
+ * Custom overlay in svg renderer is the default Custom overlay.
+ */
+ _jp.Overlays.svg.Custom = _jp.Overlays.Custom;
+
+ var AbstractSvgArrowOverlay = function (superclass, originalArgs) {
+ superclass.apply(this, originalArgs);
+ _jp.jsPlumbUIComponent.apply(this, originalArgs);
+ this.isAppendedAtTopLevel = false;
+ var self = this;
+ this.path = null;
+ this.paint = function (params, containerExtents) {
+ // only draws on connections, not endpoints.
+ if (params.component.svg && containerExtents) {
+ if (this.path == null) {
+ this.path = _node("path", {
+ "pointer-events": "all"
+ });
+ params.component.svg.appendChild(this.path);
+ if (this.elementCreated) {
+ this.elementCreated(this.path, params.component);
+ }
+
+ this.canvas = params.component.svg; // for the sake of completeness; this behaves the same as other overlays
+ }
+ var clazz = originalArgs && (originalArgs.length === 1) ? (originalArgs[0].cssClass || "") : "",
+ offset = [0, 0];
+
+ if (containerExtents.xmin < 0) {
+ offset[0] = -containerExtents.xmin;
+ }
+ if (containerExtents.ymin < 0) {
+ offset[1] = -containerExtents.ymin;
+ }
+
+ _attr(this.path, {
+ "d": makePath(params.d),
+ "class": clazz,
+ stroke: params.stroke ? params.stroke : null,
+ fill: params.fill ? params.fill : null,
+ transform: "translate(" + offset[0] + "," + offset[1] + ")"
+ });
+ }
+ };
+ var makePath = function (d) {
+ return (isNaN(d.cxy.x) || isNaN(d.cxy.y)) ? "" : "M" + d.hxy.x + "," + d.hxy.y +
+ " L" + d.tail[0].x + "," + d.tail[0].y +
+ " L" + d.cxy.x + "," + d.cxy.y +
+ " L" + d.tail[1].x + "," + d.tail[1].y +
+ " L" + d.hxy.x + "," + d.hxy.y;
+ };
+ this.transfer = function(target) {
+ if (target.canvas && this.path && this.path.parentNode) {
+ this.path.parentNode.removeChild(this.path);
+ target.canvas.appendChild(this.path);
+ }
+ };
+ };
+ _ju.extend(AbstractSvgArrowOverlay, [_jp.jsPlumbUIComponent, _jp.Overlays.AbstractOverlay], {
+ cleanup: function (force) {
+ if (this.path != null) {
+ if (force) {
+ this._jsPlumb.instance.removeElement(this.path);
+ }
+ else {
+ if (this.path.parentNode) {
+ this.path.parentNode.removeChild(this.path);
+ }
+ }
+ }
+ },
+ reattach:function(instance, component) {
+ if (this.path && component.canvas) {
+ component.canvas.appendChild(this.path);
+ }
+ },
+ setVisible: function (v) {
+ if (this.path != null) {
+ (this.path.style.display = (v ? "block" : "none"));
+ }
+ }
+ });
+
+ _jp.Overlays.svg.Arrow = function () {
+ AbstractSvgArrowOverlay.apply(this, [_jp.Overlays.Arrow, arguments]);
+ };
+ _ju.extend(_jp.Overlays.svg.Arrow, [ _jp.Overlays.Arrow, AbstractSvgArrowOverlay ]);
+
+ _jp.Overlays.svg.PlainArrow = function () {
+ AbstractSvgArrowOverlay.apply(this, [_jp.Overlays.PlainArrow, arguments]);
+ };
+ _ju.extend(_jp.Overlays.svg.PlainArrow, [ _jp.Overlays.PlainArrow, AbstractSvgArrowOverlay ]);
+
+ _jp.Overlays.svg.Diamond = function () {
+ AbstractSvgArrowOverlay.apply(this, [_jp.Overlays.Diamond, arguments]);
+ };
+ _ju.extend(_jp.Overlays.svg.Diamond, [ _jp.Overlays.Diamond, AbstractSvgArrowOverlay ]);
+
+ // a test
+ _jp.Overlays.svg.GuideLines = function () {
+ var path = null, self = this, p1_1, p1_2;
+ _jp.Overlays.GuideLines.apply(this, arguments);
+ this.paint = function (params, containerExtents) {
+ if (path == null) {
+ path = _node("path");
+ params.connector.svg.appendChild(path);
+ self.attachListeners(path, params.connector);
+ self.attachListeners(path, self);
+
+ p1_1 = _node("path");
+ params.connector.svg.appendChild(p1_1);
+ self.attachListeners(p1_1, params.connector);
+ self.attachListeners(p1_1, self);
+
+ p1_2 = _node("path");
+ params.connector.svg.appendChild(p1_2);
+ self.attachListeners(p1_2, params.connector);
+ self.attachListeners(p1_2, self);
+ }
+
+ var offset = [0, 0];
+ if (containerExtents.xmin < 0) {
+ offset[0] = -containerExtents.xmin;
+ }
+ if (containerExtents.ymin < 0) {
+ offset[1] = -containerExtents.ymin;
+ }
+
+ _attr(path, {
+ "d": makePath(params.head, params.tail),
+ stroke: "red",
+ fill: null,
+ transform: "translate(" + offset[0] + "," + offset[1] + ")"
+ });
+
+ _attr(p1_1, {
+ "d": makePath(params.tailLine[0], params.tailLine[1]),
+ stroke: "blue",
+ fill: null,
+ transform: "translate(" + offset[0] + "," + offset[1] + ")"
+ });
+
+ _attr(p1_2, {
+ "d": makePath(params.headLine[0], params.headLine[1]),
+ stroke: "green",
+ fill: null,
+ transform: "translate(" + offset[0] + "," + offset[1] + ")"
+ });
+ };
+
+ var makePath = function (d1, d2) {
+ return "M " + d1.x + "," + d1.y +
+ " L" + d2.x + "," + d2.y;
+ };
+ };
+ _ju.extend(_jp.Overlays.svg.GuideLines, _jp.Overlays.GuideLines);
+}).call(typeof window !== 'undefined' ? window : this);
+
+/*
+ * jsPlumb Community Edition
+ *
+ * Provides a way to visually connect elements on an HTML page, using SVG.
+ *
+ * This file contains the 'vanilla' adapter - having no external dependencies other than bundled libs.
+ *
+ * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com)
+ *
+ * https://jsplumbtoolkit.com
+ * https://github.com/jsplumb/jsplumb
+ *
+ * Dual licensed under the MIT and GPL2 licenses.
+ */
+;
+(function () {
+
+ "use strict";
+ var root = this, _jp = root.jsPlumb, _ju = root.jsPlumbUtil,
+ _jk = root.Katavorio, _jg = root.Biltong;
+
+ var _getDragManager = function (instance, category) {
+
+ category = category || "main";
+ var key = "_katavorio_" + category;
+ var k = instance[key],
+ e = instance.getEventManager();
+
+ if (!k) {
+ k = new _jk({
+ bind: e.on,
+ unbind: e.off,
+ getSize: _jp.getSize,
+ getPosition: function (el, relativeToRoot) {
+ // if this is a nested draggable then compute the offset against its own offsetParent, otherwise
+ // compute against the Container's origin. see also the getUIPosition method below.
+ var o = instance.getOffset(el, relativeToRoot, el._katavorioDrag ? el.offsetParent : null);
+ return [o.left, o.top];
+ },
+ setPosition: function (el, xy) {
+ el.style.left = xy[0] + "px";
+ el.style.top = xy[1] + "px";
+ },
+ addClass: _jp.addClass,
+ removeClass: _jp.removeClass,
+ intersects: _jg.intersects,
+ indexOf: function(l, i) { return l.indexOf(i); },
+ scope:instance.getDefaultScope(),
+ css: {
+ noSelect: instance.dragSelectClass,
+ droppable: "jtk-droppable",
+ draggable: "jtk-draggable",
+ drag: "jtk-drag",
+ selected: "jtk-drag-selected",
+ active: "jtk-drag-active",
+ hover: "jtk-drag-hover",
+ ghostProxy:"jtk-ghost-proxy"
+ }
+ });
+ k.setZoom(instance.getZoom());
+ instance[key] = k;
+ instance.bind("zoom", k.setZoom);
+ }
+ return k;
+ };
+
+ var _animProps = function (o, p) {
+ var _one = function (pName) {
+ if (p[pName] != null) {
+ if (_ju.isString(p[pName])) {
+ var m = p[pName].match(/-=/) ? -1 : 1,
+ v = p[pName].substring(2);
+ return o[pName] + (m * v);
+ }
+ else {
+ return p[pName];
+ }
+ }
+ else {
+ return o[pName];
+ }
+ };
+ return [ _one("left"), _one("top") ];
+ };
+
+ _jp.extend(root.jsPlumbInstance.prototype, {
+
+ animationSupported:true,
+ getElement: function (el) {
+ if (el == null) {
+ return null;
+ }
+ // here we pluck the first entry if el was a list of entries.
+ // this is not my favourite thing to do, but previous versions of
+ // jsplumb supported jquery selectors, and it is possible a selector
+ // will be passed in here.
+ el = typeof el === "string" ? el : el.length != null && el.enctype == null ? el[0] : el;
+ return typeof el === "string" ? document.getElementById(el) : el;
+ },
+ removeElement: function (element) {
+ _getDragManager(this).elementRemoved(element);
+ this.getEventManager().remove(element);
+ },
+ //
+ // this adapter supports a rudimentary animation function. no easing is supported. only
+ // left/top properties are supported. property delta args are expected to be in the form
+ //
+ // +=x.xxxx
+ //
+ // or
+ //
+ // -=x.xxxx
+ //
+ doAnimate: function (el, properties, options) {
+ options = options || {};
+ var o = this.getOffset(el),
+ ap = _animProps(o, properties),
+ ldist = ap[0] - o.left,
+ tdist = ap[1] - o.top,
+ d = options.duration || 250,
+ step = 15, steps = d / step,
+ linc = (step / d) * ldist,
+ tinc = (step / d) * tdist,
+ idx = 0,
+ _int = setInterval(function () {
+ _jp.setPosition(el, {
+ left: o.left + (linc * (idx + 1)),
+ top: o.top + (tinc * (idx + 1))
+ });
+ if (options.step != null) {
+ options.step(idx, Math.ceil(steps));
+ }
+ idx++;
+ if (idx >= steps) {
+ window.clearInterval(_int);
+ if (options.complete != null) {
+ options.complete();
+ }
+ }
+ }, step);
+ },
+ // DRAG/DROP
+ destroyDraggable: function (el, category) {
+ _getDragManager(this, category).destroyDraggable(el);
+ },
+ destroyDroppable: function (el, category) {
+ _getDragManager(this, category).destroyDroppable(el);
+ },
+ initDraggable: function (el, options, category) {
+ _getDragManager(this, category).draggable(el, options);
+ },
+ initDroppable: function (el, options, category) {
+ _getDragManager(this, category).droppable(el, options);
+ },
+ isAlreadyDraggable: function (el) {
+ return el._katavorioDrag != null;
+ },
+ isDragSupported: function (el, options) {
+ return true;
+ },
+ isDropSupported: function (el, options) {
+ return true;
+ },
+ isElementDraggable: function (el) {
+ el = _jp.getElement(el);
+ return el._katavorioDrag && el._katavorioDrag.isEnabled();
+ },
+ getDragObject: function (eventArgs) {
+ return eventArgs[0].drag.getDragElement();
+ },
+ getDragScope: function (el) {
+ return el._katavorioDrag && el._katavorioDrag.scopes.join(" ") || "";
+ },
+ getDropEvent: function (args) {
+ return args[0].e;
+ },
+ getUIPosition: function (eventArgs, zoom) {
+ // here the position reported to us by Katavorio is relative to the element's offsetParent. For top
+ // level nodes that is fine, but if we have a nested draggable then its offsetParent is actually
+ // not going to be the jsplumb container; it's going to be some child of that element. In that case
+ // we want to adjust the UI position to account for the offsetParent's position relative to the Container
+ // origin.
+ var el = eventArgs[0].el;
+ if (el.offsetParent == null) {
+ return null;
+ }
+ var finalPos = eventArgs[0].finalPos || eventArgs[0].pos;
+ var p = { left:finalPos[0], top:finalPos[1] };
+ if (el._katavorioDrag && el.offsetParent !== this.getContainer()) {
+ var oc = this.getOffset(el.offsetParent);
+ p.left += oc.left;
+ p.top += oc.top;
+ }
+ return p;
+ },
+ setDragFilter: function (el, filter, _exclude) {
+ if (el._katavorioDrag) {
+ el._katavorioDrag.setFilter(filter, _exclude);
+ }
+ },
+ setElementDraggable: function (el, draggable) {
+ el = _jp.getElement(el);
+ if (el._katavorioDrag) {
+ el._katavorioDrag.setEnabled(draggable);
+ }
+ },
+ setDragScope: function (el, scope) {
+ if (el._katavorioDrag) {
+ el._katavorioDrag.k.setDragScope(el, scope);
+ }
+ },
+ setDropScope:function(el, scope) {
+ if (el._katavorioDrop && el._katavorioDrop.length > 0) {
+ el._katavorioDrop[0].k.setDropScope(el, scope);
+ }
+ },
+ addToPosse:function(el, spec) {
+ var specs = Array.prototype.slice.call(arguments, 1);
+ var dm = _getDragManager(this);
+ _jp.each(el, function(_el) {
+ _el = [ _jp.getElement(_el) ];
+ _el.push.apply(_el, specs );
+ dm.addToPosse.apply(dm, _el);
+ });
+ },
+ setPosse:function(el, spec) {
+ var specs = Array.prototype.slice.call(arguments, 1);
+ var dm = _getDragManager(this);
+ _jp.each(el, function(_el) {
+ _el = [ _jp.getElement(_el) ];
+ _el.push.apply(_el, specs );
+ dm.setPosse.apply(dm, _el);
+ });
+ },
+ removeFromPosse:function(el, posseId) {
+ var specs = Array.prototype.slice.call(arguments, 1);
+ var dm = _getDragManager(this);
+ _jp.each(el, function(_el) {
+ _el = [ _jp.getElement(_el) ];
+ _el.push.apply(_el, specs );
+ dm.removeFromPosse.apply(dm, _el);
+ });
+ },
+ removeFromAllPosses:function(el) {
+ var dm = _getDragManager(this);
+ _jp.each(el, function(_el) { dm.removeFromAllPosses(_jp.getElement(_el)); });
+ },
+ setPosseState:function(el, posseId, state) {
+ var dm = _getDragManager(this);
+ _jp.each(el, function(_el) { dm.setPosseState(_jp.getElement(_el), posseId, state); });
+ },
+ dragEvents: {
+ 'start': 'start', 'stop': 'stop', 'drag': 'drag', 'step': 'step',
+ 'over': 'over', 'out': 'out', 'drop': 'drop', 'complete': 'complete',
+ 'beforeStart':'beforeStart'
+ },
+ animEvents: {
+ 'step': "step", 'complete': 'complete'
+ },
+ stopDrag: function (el) {
+ if (el._katavorioDrag) {
+ el._katavorioDrag.abort();
+ }
+ },
+ addToDragSelection: function (spec) {
+ _getDragManager(this).select(spec);
+ },
+ removeFromDragSelection: function (spec) {
+ _getDragManager(this).deselect(spec);
+ },
+ clearDragSelection: function () {
+ _getDragManager(this).deselectAll();
+ },
+ trigger: function (el, event, originalEvent, payload) {
+ this.getEventManager().trigger(el, event, originalEvent, payload);
+ },
+ doReset:function() {
+ // look for katavorio instances and reset each one if found.
+ for (var key in this) {
+ if (key.indexOf("_katavorio_") === 0) {
+ this[key].reset();
+ }
+ }
+ }
+ });
+
+ var ready = function (f) {
+ var _do = function () {
+ if (/complete|loaded|interactive/.test(document.readyState) && typeof(document.body) !== "undefined" && document.body != null) {
+ f();
+ }
+ else {
+ setTimeout(_do, 9);
+ }
+ };
+
+ _do();
+ };
+ ready(_jp.init);
+
+}).call(typeof window !== 'undefined' ? window : this);
+
+
+/***/ }),
+/* 71 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process, global, setImmediate) {/* @preserve
@@ -98756,10 +102424,10 @@ module.exports = ret;
},{"./es5":13}]},{},[4])(4)
}); ;if (typeof window !== 'undefined' && window !== null) { window.P = window.Promise; } else if (typeof self !== 'undefined' && self !== null) { self.P = self.Promise; }
-/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(48), __webpack_require__(33), __webpack_require__(73).setImmediate))
+/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(49), __webpack_require__(33), __webpack_require__(72).setImmediate))
/***/ }),
-/* 73 */
+/* 72 */
/***/ (function(module, exports, __webpack_require__) {
var apply = Function.prototype.apply;
@@ -98812,13 +102480,13 @@ exports._unrefActive = exports.active = function(item) {
};
// setimmediate attaches itself to the global object
-__webpack_require__(74);
+__webpack_require__(73);
exports.setImmediate = setImmediate;
exports.clearImmediate = clearImmediate;
/***/ }),
-/* 74 */
+/* 73 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
@@ -99008,35 +102676,176 @@ exports.clearImmediate = clearImmediate;
attachTo.clearImmediate = clearImmediate;
}(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
-/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(33), __webpack_require__(48)))
+/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(33), __webpack_require__(49)))
+
+/***/ }),
+/* 74 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return purchaseServer; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return purchaseRamForHomeComputer; });
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Constants_js__ = __webpack_require__(3);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Player_js__ = __webpack_require__(0);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Server_js__ = __webpack_require__(6);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__ = __webpack_require__(1);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_IPAddress_js__ = __webpack_require__(19);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_YesNoBox_js__ = __webpack_require__(14);
+
+
+
+
+
+
+
+
+/* Functions to handle any server-related purchasing:
+ * Purchasing new servers
+ * Purchasing more RAM for home computer
+ */
+function purchaseServer(ram, cost) {
+ //Check if player has enough money
+ if (__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.lt(cost)) {
+ Object(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You don't have enough money to purchase this server!");
+ return;
+ }
+
+ //Maximum server limit
+ if (__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].purchasedServers.length >= __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].PurchasedServerLimit) {
+ Object(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You have reached the maximum limit of " + __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].PurchasedServerLimit + " servers. " +
+ "You cannot purchase any more. You can " +
+ "delete some of your purchased servers using the deleteServer() Netscript function in a script");
+ return;
+ }
+
+ var hostname = Object(__WEBPACK_IMPORTED_MODULE_5__utils_YesNoBox_js__["h" /* yesNoTxtInpBoxGetInput */])();
+ if (hostname == "") {
+ Object(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You must enter a hostname for your new server!");
+ return;
+ }
+
+ //Create server
+ var newServ = new __WEBPACK_IMPORTED_MODULE_2__Server_js__["d" /* Server */](Object(__WEBPACK_IMPORTED_MODULE_4__utils_IPAddress_js__["a" /* createRandomIp */])(), hostname, "", false, true, true, ram);
+ Object(__WEBPACK_IMPORTED_MODULE_2__Server_js__["a" /* AddToAllServers */])(newServ);
+
+ //Add to Player's purchasedServers array
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].purchasedServers.push(newServ.ip);
+
+ //Connect new server to home computer
+ var homeComputer = __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer();
+ homeComputer.serversOnNetwork.push(newServ.ip);
+ newServ.serversOnNetwork.push(homeComputer.ip);
+
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(cost);
+
+ Object(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Server successfully purchased with hostname " + hostname);
+}
+
+
+function purchaseRamForHomeComputer(cost) {
+ if (__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.lt(cost)) {
+ Object(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You do not have enough money to purchase additional RAM for your home computer");
+ return;
+ }
+
+ var homeComputer = __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer();
+ homeComputer.maxRam *= 2;
+
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(cost);
+
+ Object(__WEBPACK_IMPORTED_MODULE_3__utils_DialogBox_js__["a" /* dialogBoxCreate */])("Purchased additional RAM for home computer! It now has " + homeComputer.maxRam + "GB of RAM.");
+}
+
+
+
/***/ }),
/* 75 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
+"use strict";
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return factionInvitationBoxCreate; });
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_Faction_js__ = __webpack_require__(11);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__src_Player_js__ = __webpack_require__(0);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__HelperFunctions_js__ = __webpack_require__(2);
+
+
+
+
+/* Faction Invitation Pop-up box */
+function factionInvitationBoxClose() {
+ var factionInvitationBox = document.getElementById("faction-invitation-box-container");
+ factionInvitationBox.style.display = "none";
+}
+
+function factionInvitationBoxOpen() {
+ var factionInvitationBox = document.getElementById("faction-invitation-box-container");
+ factionInvitationBox.style.display = "block";
+}
+
+function factionInvitationSetText(txt) {
+ var textBox = document.getElementById("faction-invitation-box-text");
+ textBox.innerHTML = txt;
+}
+
+function factionInvitationSetMessage(msg) {
+ var msgBox = document.getElementById("faction-invitation-box-message");
+ msgBox.innerHTML = msg;
+}
+
+//ram argument is in GB
+function factionInvitationBoxCreate(faction) {
+ factionInvitationSetText("You have received a faction invitation from " + faction.name);
+ //TODO Faction invitation message
+
+ var newYesButton = Object(__WEBPACK_IMPORTED_MODULE_2__HelperFunctions_js__["b" /* clearEventListeners */])("faction-invitation-box-yes");
+ newYesButton.addEventListener("click", function() {
+ Object(__WEBPACK_IMPORTED_MODULE_0__src_Faction_js__["h" /* joinFaction */])(faction);
+ factionInvitationBoxClose();
+ return false;
+ });
+
+ var noButton = Object(__WEBPACK_IMPORTED_MODULE_2__HelperFunctions_js__["b" /* clearEventListeners */])("faction-invitation-box-no");
+ noButton.addEventListener("click", function() {
+ factionInvitationBoxClose();
+ faction.alreadyInvited = true;
+ __WEBPACK_IMPORTED_MODULE_1__src_Player_js__["a" /* Player */].factionInvitations.push(faction.name);
+ return false;
+ });
+
+ factionInvitationBoxOpen();
+}
+
+
+
+
+/***/ }),
+/* 76 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
"use strict";
/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return saveObject; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return loadGame; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Alias_js__ = __webpack_require__(44);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Alias_js__ = __webpack_require__(46);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Company_js__ = __webpack_require__(21);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Constants_js__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__engine_js__ = __webpack_require__(5);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Faction_js__ = __webpack_require__(10);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Gang_js__ = __webpack_require__(34);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Faction_js__ = __webpack_require__(11);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Gang_js__ = __webpack_require__(40);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__HacknetNode_js__ = __webpack_require__(39);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Message_js__ = __webpack_require__(24);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Message_js__ = __webpack_require__(25);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__Script_js__ = __webpack_require__(16);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__Script_js__ = __webpack_require__(18);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__Server_js__ = __webpack_require__(6);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__Settings_js__ = __webpack_require__(14);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__SpecialServerIps_js__ = __webpack_require__(12);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__Settings_js__ = __webpack_require__(16);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__SpecialServerIps_js__ = __webpack_require__(13);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__StockMarket_js__ = __webpack_require__(29);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__utils_DialogBox_js__ = __webpack_require__(1);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__utils_GameOptions_js__ = __webpack_require__(40);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__utils_GameOptions_js__ = __webpack_require__(41);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__utils_HelperFunctions_js__ = __webpack_require__(2);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__utils_JSONReviver_js__ = __webpack_require__(8);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__utils_JSONReviver_js__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__utils_StringHelperFunctions_js__ = __webpack_require__(4);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__utils_decimal_js__ = __webpack_require__(28);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__utils_decimal_js__ = __webpack_require__(24);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__utils_decimal_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_19__utils_decimal_js__);
diff --git a/index.html b/index.html
index 52dc0d425..6c85667e2 100644
--- a/index.html
+++ b/index.html
@@ -11,6 +11,7 @@
+