" +
" Would you like to purchase the " + aug.name + " Augmentation for $" +
Object(__WEBPACK_IMPORTED_MODULE_12__utils_StringHelperFunctions_js__["c" /* formatNumber */])(aug.baseCost * fac.augmentationPriceMult, 2) + "?");
@@ -17551,12 +17538,12 @@ function initSpecialServerIps() {
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return initLocationButtons; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Company_js__ = __webpack_require__(17);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Constants_js__ = __webpack_require__(3);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Crimes_js__ = __webpack_require__(40);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Crimes_js__ = __webpack_require__(36);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__engine_js__ = __webpack_require__(4);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Infiltration_js__ = __webpack_require__(51);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Infiltration_js__ = __webpack_require__(43);
/* 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__(55);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__ServerPurchases_js__ = __webpack_require__(62);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__SpecialServerIps_js__ = __webpack_require__(11);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_DialogBox_js__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_HelperFunctions_js__ = __webpack_require__(1);
@@ -19899,10 +19886,10 @@ function initCreateProgramButtons() {
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Constants_js__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__engine_js__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__NetscriptEnvironment_js__ = __webpack_require__(28);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__NetscriptEvaluator_js__ = __webpack_require__(45);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__NetscriptEvaluator_js__ = __webpack_require__(42);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Server_js__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Settings_js__ = __webpack_require__(13);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_acorn_js__ = __webpack_require__(57);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_acorn_js__ = __webpack_require__(64);
/* 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__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_HelperFunctions_js__ = __webpack_require__(1);
@@ -23270,9 +23257,18 @@ function getJobRequirementText(company, pos, tooltiptext=false) {
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_JSONReviver_js__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_HelperFunctions_js__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_StringHelperFunctions_js__ = __webpack_require__(5);
-var ace = __webpack_require__(33);
-__webpack_require__(35);
-__webpack_require__(36);
+var ace = __webpack_require__(47);
+__webpack_require__(50);
+__webpack_require__(52);
+__webpack_require__(53);
+__webpack_require__(54);
+__webpack_require__(55);
+__webpack_require__(56);
+__webpack_require__(57);
+__webpack_require__(58);
+__webpack_require__(59);
+__webpack_require__(60);
+__webpack_require__(61);
@@ -23287,6 +23283,12 @@ __webpack_require__(36);
+var keybindings = {
+ ace: null,
+ vim: "ace/keyboard/vim",
+ emacs: "ace/keyboard/emacs",
+};
+
function scriptEditorInit() {
//Initialize save and close button
var closeButton = document.getElementById("script-editor-save-and-close-button");
@@ -23296,25 +23298,48 @@ function scriptEditorInit() {
return false;
});
- //Allow tabs (four spaces) in all textareas
- var textareas = document.getElementsByTagName('textarea');
- var count = textareas.length;
- for(var i=0;ia?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;g--)switch(f=i.after[g]){case"$":e=g===i.after.length-1?e+h.currency.symbol:b._.insert(e,h.currency.symbol,-(i.after.length-(1+g)));break;case" ":e=g===i.after.length-1?e+" ":b._.insert(e," ",-(i.after.length-(1+g)+h.currency.symbol.length-1))}return e}})}(),function(){b.register("format","exponential",{regexps:{format:/(e\+|e-)/,unformat:/(e\+|e-)/},format:function(a,c,d){var e,f="number"!=typeof a||b._.isNaN(a)?"0e+0":a.toExponential(),g=f.split("e");return c=c.replace(/e[\+|\-]{1}0/,""),e=b._.numberToFormat(Number(g[0]),c,d),e+"e"+g[1]},unformat:function(a){function c(a,c,d,e){var f=b._.correctionFactor(a,c),g=a*f*(c*f)/(f*f);return g}var d=b._.includes(a,"e+")?a.split("e+"):a.split("e-"),e=Number(d[0]),f=Number(d[1]);return f=b._.includes(a,"e-")?f*=-1:f,b._.reduce([e,Math.pow(10,f)],c,1)}})}(),function(){b.register("format","ordinal",{regexps:{format:/(o)/},format:function(a,c,d){var e,f=b.locales[b.options.currentLocale],g=b._.includes(c," o")?" ":"";return c=c.replace(/\s?o/,""),g+=f.ordinal(a),e=b._.numberToFormat(a,c,d),e+g}})}(),function(){b.register("format","percentage",{regexps:{format:/(%)/,unformat:/(%)/},format:function(a,c,d){var e,f=b._.includes(c," %")?" ":"";return b.options.scalePercentBy100&&(a=100*a),c=c.replace(/\s?\%/,""),e=b._.numberToFormat(a,c,d),b._.includes(e,")")?(e=e.split(""),e.splice(-1,0,f+"%"),e=e.join("")):e=e+f+"%",e},unformat:function(a){var c=b._.stringToNumber(a);return b.options.scalePercentBy100?.01*c:c}})}(),function(){b.register("format","time",{regexps:{format:/(:)/,unformat:/(:)/},format:function(a,b,c){var d=Math.floor(a/60/60),e=Math.floor((a-60*d*60)/60),f=Math.round(a-60*d*60-60*e);return d+":"+(10>e?"0"+e:e)+":"+(10>f?"0"+f:f)},unformat:function(a){var b=a.split(":"),c=0;return 3===b.length?(c+=60*Number(b[0])*60,c+=60*Number(b[1]),c+=Number(b[2])):2===b.length&&(c+=60*Number(b[0]),c+=Number(b[1])),Number(c)}})}(),b});
+
+/***/ }),
+/* 35 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NetscriptFunctions; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return initSingularitySFFlags; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return hasSingularitySF; });
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__ = __webpack_require__(16);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Company_js__ = __webpack_require__(17);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Constants_js__ = __webpack_require__(3);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__ = __webpack_require__(14);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__ = __webpack_require__(39);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__engine_js__ = __webpack_require__(4);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Faction_js__ = __webpack_require__(10);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__HacknetNode_js__ = __webpack_require__(32);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Location_js__ = __webpack_require__(12);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__Player_js__ = __webpack_require__(0);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__Script_js__ = __webpack_require__(18);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__Server_js__ = __webpack_require__(6);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__Settings_js__ = __webpack_require__(13);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__ = __webpack_require__(11);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__StockMarket_js__ = __webpack_require__(25);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__Terminal_js__ = __webpack_require__(20);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__NetscriptWorker_js__ = __webpack_require__(15);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__ = __webpack_require__(42);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__NetscriptEnvironment_js__ = __webpack_require__(28);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__utils_decimal_js__ = __webpack_require__(23);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__utils_decimal_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_19__utils_decimal_js__);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__utils_HelperFunctions_js__ = __webpack_require__(1);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__utils_IPAddress_js__ = __webpack_require__(19);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__ = __webpack_require__(5);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+var hasSingularitySF = false;
+var singularitySFLvl = 1;
+
+function initSingularitySFFlags() {
+ for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].sourceFiles.length; ++i) {
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].sourceFiles[i].n === 4) {
+ hasSingularitySF = true;
+ singularitySFLvl = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].sourceFiles[i].lvl;
+ }
+ }
+}
+
+function NetscriptFunctions(workerScript) {
+ return {
+ hacknetnodes : __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hacknetNodes,
+ scan : function(ip=workerScript.serverIp){
+ var server = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(ip);
+ if (server == null) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, 'Invalid IP or hostname passed into scan() command');
+ }
+ var out = [];
+ for (var i = 0; i < server.serversOnNetwork.length; i++) {
+ var entry = server.getServerOnNetwork(i).hostname;
+ 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_17__NetscriptEvaluator_js__["c" /* 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_11__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "hack() error. Invalid IP or hostname passed in: " + ip + ". Stopping...");
+ }
+
+ //Calculate the hacking time
+ var hackingTime = Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["i" /* scriptCalculateHackingTime */])(server); //This is in seconds
+
+ //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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot hack this server (" + server.hostname + ") because user does not have root access");
+ }
+
+ if (server.requiredHackingSkill > __WEBPACK_IMPORTED_MODULE_9__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot hack this server (" + server.hostname + ") because user's hacking skill is not high enough");
+ }
+
+ 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_17__NetscriptEvaluator_js__["d" /* netscriptDelay */])(hackingTime* 1000).then(function() {
+ if (workerScript.env.stopFlag) {return Promise.reject(workerScript);}
+ var hackChance = Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["h" /* scriptCalculateHackingChance */])(server);
+ var rand = Math.random();
+ var expGainedOnSuccess = Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["f" /* scriptCalculateExpGain */])(server) * threads;
+ var expGainedOnFailure = (expGainedOnSuccess / 4);
+ if (rand < hackChance) { //Success!
+ var moneyGained = Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["j" /* scriptCalculatePercentMoneyHacked */])(server);
+ moneyGained = Math.floor(server.moneyAvailable * moneyGained) * threads;
+
+ //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;}
+
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].gainMoney(moneyGained);
+ workerScript.scriptRef.onlineMoneyMade += moneyGained;
+ workerScript.scriptRef.recordHack(server.ip, moneyGained, threads);
+ __WEBPACK_IMPORTED_MODULE_9__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_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(moneyGained, 2) + " and " + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(expGainedOnSuccess, 4) + " exp (t=" + threads + ")");
+ server.fortify(__WEBPACK_IMPORTED_MODULE_2__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_9__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_22__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_17__NetscriptEvaluator_js__["c" /* 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_17__NetscriptEvaluator_js__["d" /* netscriptDelay */])(time).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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "grow() call has incorrect number of arguments. Takes 1 argument");
+ }
+ var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot grow(). Invalid IP or hostname passed in: " + ip);
+ }
+
+ //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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot grow this server (" + server.hostname + ") because user does not have root access");
+ }
+
+ var growTime = Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["g" /* 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_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(growTime/1000, 3) + " seconds (t=" + threads + ")");
+ return Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["d" /* netscriptDelay */])(growTime).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_11__Server_js__["j" /* processSingleServerGrowth */])(server, 450 * threads);
+ workerScript.scriptRef.recordGrow(server.ip, threads);
+ var expGain = Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["f" /* scriptCalculateExpGain */])(server) * threads;
+ if (growthPercentage == 1) {
+ expGain = 0;
+ }
+ workerScript.scriptRef.log("Available money on " + server.hostname + " grown by "
+ + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(growthPercentage*100 - 100, 6) + "%. Gained " +
+ Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(expGain, 4) + " hacking exp (t=" + threads +")");
+ workerScript.scriptRef.onlineExpGained += expGain;
+ __WEBPACK_IMPORTED_MODULE_9__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "weaken() call has incorrect number of arguments. Takes 1 argument");
+ }
+ var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot weaken(). Invalid IP or hostname passed in: " + ip);
+ }
+
+ //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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot weaken this server (" + server.hostname + ") because user does not have root access");
+ }
+
+ var weakenTime = Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["k" /* scriptCalculateWeakenTime */])(server);
+ //console.log("Executing weaken() on server " + server.hostname + " in " + formatNumber(weakenTime/1000, 3) + " seconds")
+ workerScript.scriptRef.log("Executing weaken() on server " + server.hostname + " in " +
+ Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(weakenTime/1000, 3) + " seconds (t=" + threads + ")");
+ return Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["d" /* netscriptDelay */])(weakenTime).then(function() {
+ if (workerScript.env.stopFlag) {return Promise.reject(workerScript);}
+ server.weaken(__WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ServerWeakenAmount * threads);
+ workerScript.scriptRef.recordWeaken(server.ip, threads);
+ var expGain = Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["f" /* scriptCalculateExpGain */])(server) * threads;
+ workerScript.scriptRef.log("Server security level on " + server.hostname + " weakened to " + server.hackDifficulty +
+ ". Gained " + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(expGain, 4) + " hacking exp (t=" + threads + ")");
+ workerScript.scriptRef.onlineExpGained += expGain;
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].gainHackingExp(expGain);
+ return Promise.resolve(__WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ServerWeakenAmount * threads);
+ });
+ },
+ print : function(args){
+ if (args === undefined) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "tprint() call has incorrect number of arguments. Takes 1 argument");
+ }
+ Object(__WEBPACK_IMPORTED_MODULE_15__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument");
+ }
+ var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call nuke(). Invalid IP or hostname passed in: " + ip);
+ }
+ if (!__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].NukeProgram)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "You do not have the NUKE.exe virus!");
+ }
+ if (server.openPortCount < server.numOpenPortsRequired) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument");
+ }
+ var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call brutessh(). Invalid IP or hostname passed in: " + ip);
+ }
+ if (!__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].BruteSSHProgram)) {
+ workerScript.scriptRef.log("You do not have the BruteSSH.exe program!");
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument");
+ }
+ var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call ftpcrack(). Invalid IP or hostname passed in: " + ip);
+ }
+ if (!__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].FTPCrackProgram)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument");
+ }
+ var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call relaysmtp(). Invalid IP or hostname passed in: " + ip);
+ }
+ if (!__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument");
+ }
+ var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call httpworm(). Invalid IP or hostname passed in: " + ip);
+ }
+ if (!__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].HTTPWormProgram)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument");
+ }
+ var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call sqlinject(). Invalid IP or hostname passed in: " + ip);
+ }
+ if (!__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].SQLInjectProgram)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_17__NetscriptEvaluator_js__["c" /* 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_17__NetscriptEvaluator_js__["c" /* 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_11__Server_js__["e" /* getServer */])(workerScript.serverIp);
+ if (scriptServer == null) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Could not find server. This is a bug in the game. Report to game dev");
+ }
+
+ return Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["e" /* runScriptFromScript */])(scriptServer, scriptname, argsForNewScript, workerScript, threads);
+ },
+ exec : function(scriptname,ip,threads = 1){
+ if (scriptname === undefined || ip === undefined) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_17__NetscriptEvaluator_js__["c" /* 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_11__Server_js__["e" /* getServer */])(ip);
+ if (server == null) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Invalid hostname/ip passed into exec() command: " + ip);
+ }
+ return Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["e" /* runScriptFromScript */])(server, scriptname, argsForNewScript, workerScript, threads);
+ },
+ kill : function(filename,ip){
+ if (filename === undefined || ip === undefined) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "kill() call has incorrect number of arguments. Usage: kill(scriptname, server, [arg1], [arg2]...)");
+ }
+ var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* 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_10__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_20__utils_HelperFunctions_js__["f" /* printArray */])(argsForKillTarget));
+ return false;
+ }
+ var res = Object(__WEBPACK_IMPORTED_MODULE_16__NetscriptWorker_js__["d" /* killWorkerScript */])(runningScriptObj, server.ip);
+ if (res) {
+ workerScript.scriptRef.log("Killing " + filename + " on " + server.hostname + " with args: " + Object(__WEBPACK_IMPORTED_MODULE_20__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_20__utils_HelperFunctions_js__["f" /* printArray */])(argsForKillTarget));
+ return false;
+ }
+ },
+ killall : function(ip){
+ if (ip === undefined) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "killall() call has incorrect number of arguments. Takes 1 argument");
+ }
+ var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* 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_16__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,ip){
+ if (scriptname === undefined || ip === undefined) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "scp() call has incorrect number of arguments. Takes 2 arguments");
+ }
+ var destServer = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(ip);
+ if (destServer == null) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Invalid hostname/ip passed into scp() command: " + ip);
+ }
+
+ var currServ = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(workerScript.serverIp);
+ if (currServ == null) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Could not find server ip for this script. This is a bug please contact game developer");
+ }
+
+ 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_10__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;
+ },
+ hasRootAccess : function(ip){
+ if (ip===undefined){
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "hasRootAccess() call has incorrect number of arguments. Takes 1 argument");
+ }
+ var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "hasRootAccess() failed. Invalid IP or hostname passed in: " + ip);
+ }
+ return server.hasAdminRights;
+ },
+ getHostname : function(){
+ var scriptServer = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(workerScript.serverIp);
+ if (scriptServer == null) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_9__Player_js__["a" /* Player */].updateSkillLevels();
+ workerScript.scriptRef.log("getHackingLevel() returned " + __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hacking_skill);
+ return __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hacking_skill;
+ },
+ getServerMoneyAvailable : function(ip){
+ var server = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(ip);
+ if (server == null) {
+ workerScript.scriptRef.log("Cannot getServerMoneyAvailable(). Invalid IP or hostname passed in: " + ip);
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot getServerMoneyAvailable(). 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_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].money.toNumber(), 2));
+ return __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].money.toNumber();
+ }
+ workerScript.scriptRef.log("getServerMoneyAvailable() returned " + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.moneyAvailable, 2) + " for " + server.hostname);
+ return server.moneyAvailable;
+ },
+ getServerSecurityLevel : function(ip){
+ var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getServerSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
+ }
+ workerScript.scriptRef.log("getServerSecurityLevel() returned " + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.hackDifficulty, 3) + " for " + server.hostname);
+ return server.hackDifficulty;
+ },
+ getServerBaseSecurityLevel : function(ip){
+ var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getServerBaseSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
+ }
+ workerScript.scriptRef.log("getServerBaseSecurityLevel() returned " + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.baseDifficulty, 3) + " for " + server.hostname);
+ return server.baseDifficulty;
+ },
+ getServerRequiredHackingLevel : function(ip){
+ var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getServerRequiredHackingLevel() failed. Invalid IP or hostname passed in: " + ip);
+ }
+ workerScript.scriptRef.log("getServerRequiredHackingLevel returned " + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.requiredHackingSkill, 0) + " for " + server.hostname);
+ return server.requiredHackingSkill;
+ },
+ getServerMaxMoney : function(ip){
+ var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getServerMaxMoney() failed. Invalid IP or hostname passed in: " + ip);
+ }
+ workerScript.scriptRef.log("getServerMaxMoney() returned " + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.moneyMax, 0) + " for " + server.hostname);
+ return server.moneyMax;
+ },
+ getServerGrowth : function(ip) {
+ var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getServerGrowth() failed. Invalid IP or hostname passed in: " + ip);
+ }
+ workerScript.scriptRef.log("getServerGrowth() returned " + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.serverGrowth, 0) + " for " + server.hostname);
+ return server.serverGrowth;
+ },
+ getServerNumPortsRequired : function(ip){
+ var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getServerNumPortsRequired() failed. Invalid IP or hostname passed in: " + ip);
+ }
+ workerScript.scriptRef.log("getServerNumPortsRequired() returned " + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.numOpenPortsRequired, 0) + " for " + server.hostname);
+ return server.numOpenPortsRequired;
+ },
+ getServerRam : function(ip) {
+ var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getServerRam() failed. Invalid IP or hostname passed in: " + ip);
+ }
+ workerScript.scriptRef.log("getServerRam() returned [" + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.maxRam, 2) + "GB, " + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.ramUsed, 2) + "GB]");
+ return [server.maxRam, server.ramUsed];
+ },
+ fileExists : function(filename,ip=workerScript.serverIp){
+ if (filename === undefined) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "fileExists() call has incorrect number of arguments. Usage: fileExists(scriptname, [server])");
+ }
+ var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* 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;
+ }
+ }
+ return false;
+ },
+ isRunning : function(filename,ip){
+ if (filename === undefined || ip === undefined) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "isRunning() call has incorrect number of arguments. Usage: isRunning(scriptname, server, [arg1], [arg2]...)");
+ }
+ var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* 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_10__Script_js__["d" /* findRunningScript */])(filename, argsForTargetScript, server) != null);
+ },
+ getNextHacknetNodeCost : __WEBPACK_IMPORTED_MODULE_7__HacknetNode_js__["b" /* getCostOfNextHacknetNode */],
+ purchaseHacknetNode : __WEBPACK_IMPORTED_MODULE_7__HacknetNode_js__["d" /* purchaseHacknet */],
+ getStockPrice : function(symbol) {
+ if (!__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hasTixApiAccess) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use getStockPrice()");
+ }
+ var stock = __WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["b" /* SymbolToStockMap */][symbol];
+ if (stock == null) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Invalid stock symbol passed into getStockPrice()");
+ }
+ return parseFloat(stock.price.toFixed(3));
+ },
+ getStockPosition : function(symbol) {
+ if (!__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hasTixApiAccess) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use getStockPosition()");
+ }
+ var stock = __WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["b" /* SymbolToStockMap */][symbol];
+ if (stock == null) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Invalid stock symbol passed into getStockPrice()");
+ }
+ return [stock.playerShares, stock.playerAvgPx];
+ },
+ buyStock : function(symbol, shares) {
+ if (!__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hasTixApiAccess) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use buyStock()");
+ }
+ var stock = __WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["b" /* SymbolToStockMap */][symbol];
+ if (stock == null) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Invalid stock symbol passed into getStockPrice()");
+ }
+ if (shares == 0) {return false;}
+ if (stock == null || shares < 0 || isNaN(shares)) {
+ workerScript.scriptRef.log("Error: Invalid 'shares' argument passed to buyStock()");
+ return false;
+ }
+ shares = Math.round(shares);
+
+ var totalPrice = stock.price * shares;
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].money.lt(totalPrice + __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].StockMarketCommission)) {
+ workerScript.scriptRef.log("Not enough money to purchase " + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(shares, 0) + " shares of " +
+ symbol + ". Need $" +
+ Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(totalPrice + __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].StockMarketCommission, 2).toString());
+ return false;
+ }
+
+ var origTotal = stock.playerShares * stock.playerAvgPx;
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].loseMoney(totalPrice + __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].StockMarketCommission);
+ var newTotal = origTotal + totalPrice;
+ stock.playerShares += shares;
+ stock.playerAvgPx = newTotal / stock.playerShares;
+ if (__WEBPACK_IMPORTED_MODULE_5__engine_js__["Engine"].currentPage == __WEBPACK_IMPORTED_MODULE_5__engine_js__["Engine"].Page.StockMarket) {
+ Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["j" /* updateStockPlayerPosition */])(stock);
+ }
+ workerScript.scriptRef.log("Bought " + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(shares, 0) + " shares of " + stock.symbol + " at $" +
+ Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(stock.price, 2) + " per share");
+ return true;
+ },
+ sellStock : function(symbol, shares) {
+ if (!__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hasTixApiAccess) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use sellStock()");
+ }
+ var stock = __WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["b" /* SymbolToStockMap */][symbol];
+ if (stock == null) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Invalid stock symbol passed into getStockPrice()");
+ }
+ if (shares == 0) {return false;}
+ if (stock == null || shares < 0 || isNaN(shares)) {
+ workerScript.scriptRef.log("Error: Invalid 'shares' argument passed to sellStock()");
+ return false;
+ }
+ if (shares > stock.playerShares) {shares = stock.playerShares;}
+ if (shares == 0) {return false;}
+ var gains = stock.price * shares - __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].StockMarketCommission;
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].gainMoney(gains);
+
+ //Calculate net profit and add to script stats
+ var netProfit = ((stock.price - stock.playerAvgPx) * shares) - __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].StockMarketCommission;
+ if (isNaN(netProfit)) {netProfit = 0;}
+ workerScript.scriptRef.onlineMoneyMade += netProfit;
+
+ stock.playerShares -= shares;
+ if (stock.playerShares == 0) {
+ stock.playerAvgPx = 0;
+ }
+ if (__WEBPACK_IMPORTED_MODULE_5__engine_js__["Engine"].currentPage == __WEBPACK_IMPORTED_MODULE_5__engine_js__["Engine"].Page.StockMarket) {
+ Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["j" /* updateStockPlayerPosition */])(stock);
+ }
+ workerScript.scriptRef.log("Sold " + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(shares, 0) + " shares of " + stock.symbol + " at $" +
+ Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(stock.price, 2) + " per share. Gained " +
+ "$" + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(gains, 2));
+ return true;
+ },
+ 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_9__Player_js__["a" /* Player */].purchasedServers.length >= __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].PurchasedServerLimit) {
+ workerScript.scriptRef.log("Error: You have reached the maximum limit of " + __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].PurchasedServerLimit +
+ " servers. You cannot purchase any more.");
+ return "";
+ }
+
+ ram = Math.round(ram);
+ if (isNaN(ram) || !Object(__WEBPACK_IMPORTED_MODULE_20__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_2__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer;
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].money.lt(cost)) {
+ workerScript.scriptRef.log("Error: Not enough money to purchase server. Need $" + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(cost, 2));
+ return "";
+ }
+ var newServ = new __WEBPACK_IMPORTED_MODULE_11__Server_js__["d" /* Server */](Object(__WEBPACK_IMPORTED_MODULE_21__utils_IPAddress_js__["a" /* createRandomIp */])(), hostnameStr, "", false, true, true, ram);
+ Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["a" /* AddToAllServers */])(newServ);
+
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].purchasedServers.push(newServ.ip);
+ var homeComputer = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].getHomeComputer();
+ homeComputer.serversOnNetwork.push(newServ.ip);
+ newServ.serversOnNetwork.push(homeComputer.ip);
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].loseMoney(cost);
+ workerScript.scriptRef.log("Purchased new server with hostname " + newServ.hostname + " for $" + Object(__WEBPACK_IMPORTED_MODULE_22__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_11__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_9__Player_js__["a" /* Player */].purchasedServers.length; ++i) {
+ if (ip == __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].purchasedServers[i]) {
+ found = true;
+ __WEBPACK_IMPORTED_MODULE_9__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_11__Server_js__["b" /* AllServers */][ip];
+
+ //Delete from home computer
+ found = false;
+ var homeComputer = __WEBPACK_IMPORTED_MODULE_9__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;
+ },
+ round : function(n) {
+ if (isNaN(n)) {return 0;}
+ return Math.round(n);
+ },
+ write : function(port, data="") {
+ if (!isNaN(port)) {
+ //Port 1-10
+ if (port < 1 || port > 10) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_16__NetscriptWorker_js__["a" /* NetscriptPorts */][portName];
+ if (port == null) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Could not find port: " + port + ". This is a bug contact the game developer");
+ }
+ port.push(data);
+ if (port.length > __WEBPACK_IMPORTED_MODULE_12__Settings_js__["a" /* Settings */].MaxPortCapacity) {
+ port.shift();
+ return true;
+ }
+ return false;
+ } else {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Invalid argument passed in for port: " + port + ". Must be a number between 1 and 10");
+ }
+ },
+ read : function(port) {
+ if (!isNaN(port)) {
+ //Port 1-10
+ if (port < 1 || port > 10) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_16__NetscriptWorker_js__["a" /* NetscriptPorts */][portName];
+ if (port == null) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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 {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_11__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_17__NetscriptEvaluator_js__["c" /* 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_11__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_17__NetscriptEvaluator_js__["c" /* 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_16__NetscriptWorker_js__["d" /* killWorkerScript */])(server.runningScripts[i], server.ip);
+ suc = true;
+ }
+ }
+ return suc;
+ },
+ getScriptRam : function (scriptname, ip) {
+ var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* 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_11__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getHackTime() failed. Invalid IP or hostname passed in: " + ip);
+ }
+ return Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["i" /* scriptCalculateHackingTime */])(server); //Returns seconds
+ },
+ getGrowTime : function(ip) {
+ var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getGrowTime() failed. Invalid IP or hostname passed in: " + ip);
+ }
+ return Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["g" /* scriptCalculateGrowTime */])(server) / 1000; //Returns seconds
+ },
+ getWeakenTime : function(ip) {
+ var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getWeakenTime() failed. Invalid IP or hostname passed in: " + ip);
+ }
+ return Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["k" /* scriptCalculateWeakenTime */])(server) / 1000; //Returns seconds
+ },
+
+ /* Singularity Functions */
+ universityCourse(universityName, className) {
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 1)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run universityCourse(). It is a Singularity Function and requires SourceFile-4 (level 1) to run.");
+ return false;
+ }
+ }
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].isWorking) {
+ var txt = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].singularityStopWork();
+ workerScript.scriptRef.log(txt);
+ }
+
+ var costMult, expMult;
+ switch(universityName.toLowerCase()) {
+ case __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].AevumSummitUniversity.toLowerCase():
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_8__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;
+ }
+ costMult = 4;
+ expMult = 3;
+ break;
+ case __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].Sector12RothmanUniversity.toLowerCase():
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_8__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;
+ }
+ costMult = 3;
+ expMult = 2;
+ break;
+ case __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].VolhavenZBInstituteOfTechnology.toLowerCase():
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_8__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;
+ }
+ 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_2__Constants_js__["a" /* CONSTANTS */].ClassStudyComputerScience;
+ break;
+ case "Data Structures".toLowerCase():
+ task = __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassDataStructures;
+ break;
+ case "Networks".toLowerCase():
+ task = __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassNetworks;
+ break;
+ case "Algorithms".toLowerCase():
+ task = __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassAlgorithms;
+ break;
+ case "Management".toLowerCase():
+ task = __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassManagement;
+ break;
+ case "Leadership".toLowerCase():
+ task = __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassLeadership;
+ break;
+ default:
+ workerScript.scriptRef.log("Invalid class name: " + className + ". universityCourse() failed");
+ return false;
+ }
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].startClass(costMult, expMult, task);
+ workerScript.scriptRef.log("Started " + task + " at " + universityName);
+ return true;
+ },
+
+ gymWorkout(gymName, stat) {
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 1)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run gymWorkout(). It is a Singularity Function and requires SourceFile-4 (level 1) to run.");
+ return false;
+ }
+ }
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].isWorking) {
+ var txt = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].singularityStopWork();
+ workerScript.scriptRef.log(txt);
+ }
+ var costMult, expMult;
+ switch(gymName.toLowerCase()) {
+ case __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].AevumCrushFitnessGym.toLowerCase():
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_8__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;
+ }
+ costMult = 2;
+ expMult = 1.5;
+ break;
+ case __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].AevumSnapFitnessGym.toLowerCase():
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_8__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;
+ }
+ costMult = 6;
+ expMult = 4;
+ break;
+ case __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].Sector12IronGym.toLowerCase():
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_8__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;
+ }
+ costMult = 1;
+ expMult = 1;
+ break;
+ case __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].Sector12PowerhouseGym.toLowerCase():
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_8__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;
+ }
+ costMult = 10;
+ expMult = 7.5;
+ break;
+ case __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].VolhavenMilleniumFitnessGym:
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_8__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;
+ }
+ 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_9__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassGymStrength);
+ break;
+ case "defense".toLowerCase():
+ case "def".toLowerCase():
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassGymDefense);
+ break;
+ case "dexterity".toLowerCase():
+ case "dex".toLowerCase():
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassGymDexterity);
+ break;
+ case "agility".toLowerCase():
+ case "agi".toLowerCase():
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_2__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_9__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 1)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_8__Location_js__["a" /* Locations */].Aevum:
+ case __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].Chongqing:
+ case __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].Sector12:
+ case __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].NewTokyo:
+ case __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].Ishima:
+ case __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].Volhaven:
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].loseMoney(200000);
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].city = cityname;
+ 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_9__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 1)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run purchaseTor(). It is a Singularity Function and requires SourceFile-4 (level 1) to run.");
+ return false;
+ }
+ }
+
+ if (__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["a" /* SpecialServerIps */]["Darkweb Server"] != null) {
+ workerScript.scriptRef.log("You already have a TOR router! purchaseTor() failed");
+ return false;
+ }
+
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].money.lt(__WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].TorRouterCost)) {
+ workerScript.scriptRef.log("ERROR: You cannot afford to purchase a Tor router. purchaseTor() failed");
+ return false;
+ }
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].loseMoney(__WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].TorRouterCost);
+
+ var darkweb = new __WEBPACK_IMPORTED_MODULE_11__Server_js__["d" /* Server */](Object(__WEBPACK_IMPORTED_MODULE_21__utils_IPAddress_js__["a" /* createRandomIp */])(), "darkweb", "", false, false, false, 1);
+ Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["a" /* AddToAllServers */])(darkweb);
+ __WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["a" /* SpecialServerIps */].addIp("Darkweb Server", darkweb.ip);
+
+ document.getElementById("location-purchase-tor").setAttribute("class", "a-link-button-inactive");
+
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].getHomeComputer().serversOnNetwork.push(darkweb.ip);
+ darkweb.serversOnNetwork.push(__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].getHomeComputer().ip);
+ workerScript.scriptRef.log("You have purchased a Tor router!");
+ return true;
+ },
+ purchaseProgram(programName) {
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 1)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run purchaseProgram(). It is a Singularity Function and requires SourceFile-4 (level 1) to run.");
+ return false;
+ }
+ }
+
+ if (__WEBPACK_IMPORTED_MODULE_13__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_3__CreateProgram_js__["a" /* Programs */].BruteSSHProgram.toLowerCase():
+ var price = Object(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["a" /* DarkWebItems */].BruteSSHProgram);
+ if (price > 0 && __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].money.gt(price)) {
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].loseMoney(price);
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_3__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 true;
+ case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].FTPCrackProgram.toLowerCase():
+ var price = Object(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["a" /* DarkWebItems */].FTPCrackProgram);
+ if (price > 0 && __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].money.gt(price)) {
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].loseMoney(price);
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_3__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 " + itemName);
+ }
+ return true;
+ case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram.toLowerCase():
+ var price = Object(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["a" /* DarkWebItems */].RelaySMTPProgram);
+ if (price > 0 && __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].money.gt(price)) {
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].loseMoney(price);
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_3__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 " + itemName);
+ }
+ return true;
+ case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].HTTPWormProgram.toLowerCase():
+ var price = Object(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["a" /* DarkWebItems */].HTTPWormProgram);
+ if (price > 0 && __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].money.gt(price)) {
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].loseMoney(price);
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_3__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 " + itemName);
+ }
+ return true;
+ case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].SQLInjectProgram.toLowerCase():
+ var price = Object(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["a" /* DarkWebItems */].SQLInjectProgram);
+ if (price > 0 && __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].money.gt(price)) {
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].loseMoney(price);
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_3__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 " + itemName);
+ }
+ return true;
+ case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].DeepscanV1.toLowerCase():
+ var price = Object(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["a" /* DarkWebItems */].DeepScanV1Program);
+ if (price > 0 && __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].money.gt(price)) {
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].loseMoney(price);
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_3__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 " + itemName);
+ }
+ return true;
+ case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].DeepscanV2.toLowerCase():
+ var price = Object(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["a" /* DarkWebItems */].DeepScanV2Program);
+ if (price > 0 && __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].money.gt(price)) {
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].loseMoney(price);
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_3__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 " + itemName);
+ }
+ return true;
+ default:
+ workerScript.scriptRef.log("ERROR: Invalid program passed into purchaseProgram().");
+ return false;
+ }
+ return true;
+ },
+ upgradeHomeRam() {
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 2)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_9__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_2__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamHome;
+ var mult = Math.pow(1.55, numUpgrades);
+ cost = cost * mult;
+
+ if (__WEBPACK_IMPORTED_MODULE_9__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_9__Player_js__["a" /* Player */].getHomeComputer();
+ homeComputer.maxRam *= 2;
+
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].loseMoney(cost);
+
+ workerScript.scriptRef.log("Purchased additional RAM for home computer! It now has " + homeComputer.maxRam + "GB of RAM.");
+ return true;
+ },
+ getUpgradeHomeRamCost() {
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 2)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_9__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_2__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamHome;
+ var mult = Math.pow(1.55, numUpgrades);
+ return cost * mult;
+ },
+ workForCompany() {
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 2)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run workForCompany(). It is a Singularity Function and requires SourceFile-4 (level 2) to run.");
+ return false;
+ }
+ }
+
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].companyPosition == "" || !(__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].companyPosition instanceof __WEBPACK_IMPORTED_MODULE_1__Company_js__["c" /* CompanyPosition */])) {
+ workerScript.scriptRef.log("ERROR: workForCompany() failed because you do not have a job");
+ return false;
+ }
+
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].isWorking) {
+ var txt = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].singularityStopWork();
+ workerScript.scriptRef.log(txt);
+ }
+
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].companyPosition.isPartTimeJob()) {
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].startWorkPartTime();
+ } else {
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].startWork();
+ }
+ workerScript.scriptRef.log("Began working at " + __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].companyName + " as a " + __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].companyPosition.positionName);
+ return true;
+ },
+ applyToCompany(companyName, field) {
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 2)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_1__Company_js__["e" /* companyExists */])(companyName)) {
+ workerScript.scriptRef.log("ERROR: applyToCompany() failed because specified company " + companyName + " does not exist.");
+ return false;
+ }
+
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].location = companyName;
+ var res;
+ switch (field.toLowerCase()) {
+ case "software":
+ res = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].applyForSoftwareJob(true);
+ break;
+ case "software consultant":
+ res = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].applyForSoftwareConsultantJob(true);
+ break;
+ case "it":
+ res = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].applyForItJob(true);
+ break;
+ case "security engineer":
+ res = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].applyForSecurityEngineerJob(true);
+ break;
+ case "network engineer":
+ res = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].applyForNetworkEngineerJob(true);
+ break;
+ case "business":
+ res = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].applyForBusinessJob(true);
+ break;
+ case "business consultant":
+ res = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].applyForBusinessConsultantJob(true);
+ break;
+ case "security":
+ res = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].applyForSecurityJob(true);
+ break;
+ case "agent":
+ res = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].applyForAgentJob(true);
+ break;
+ case "employee":
+ res = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].applyForEmployeeJob(true);
+ break;
+ case "part-time employee":
+ res = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].applyForPartTimeEmployeeJob(true);
+ break;
+ case "waiter":
+ res = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].applyForWaiterJob(true);
+ break;
+ case "part-time waiter":
+ res = __WEBPACK_IMPORTED_MODULE_9__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_22__utils_StringHelperFunctions_js__["e" /* 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_9__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_9__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 2)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_1__Company_js__["a" /* Companies */][companyName];
+ if (company === null || !(company instanceof __WEBPACK_IMPORTED_MODULE_1__Company_js__["b" /* Company */])) {
+ workerScript.scriptRef.log("ERROR: Invalid companyName passed into getCompanyRep(): " + companyName);
+ return -1;
+ }
+ return company.playerReputation;
+ },
+ checkFactionInvitations() {
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 2)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_9__Player_js__["a" /* Player */].factionInvitations.slice();
+ },
+ joinFaction(name) {
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 2)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_6__Faction_js__["d" /* factionExists */])(name)) {
+ workerScript.scriptRef.log("ERROR: Faction specified in joinFaction() does not exist.");
+ return false;
+ }
+
+ if (!__WEBPACK_IMPORTED_MODULE_9__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_9__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_9__Player_js__["a" /* Player */].factionInvitations.splice(index, 1);
+ var fac = __WEBPACK_IMPORTED_MODULE_6__Faction_js__["b" /* Factions */][name];
+ Object(__WEBPACK_IMPORTED_MODULE_6__Faction_js__["h" /* joinFaction */])(fac);
+ workerScript.scriptRef.log("Joined the " + name + " faction.");
+ return true;
+ },
+ workForFaction(name, type) {
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 2)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run workForFaction(). It is a Singularity Function and requires SourceFile-4 (level 2) to run.");
+ return false;
+ }
+ }
+
+ if (!Object(__WEBPACK_IMPORTED_MODULE_6__Faction_js__["d" /* factionExists */])(name)) {
+ workerScript.scriptRef.log("ERROR: Faction specified in workForFaction() does not exist.");
+ return false;
+ }
+
+ if (!__WEBPACK_IMPORTED_MODULE_9__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_9__Player_js__["a" /* Player */].isWorking) {
+ var txt = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].singularityStopWork();
+ workerScript.scriptRef.log(txt);
+ }
+
+ var fac = __WEBPACK_IMPORTED_MODULE_6__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_9__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_9__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_9__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_9__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 2)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_6__Faction_js__["d" /* factionExists */])(name)) {
+ workerScript.scriptRef.log("ERROR: Faction specified in getFactionRep() does not exist.");
+ return -1;
+ }
+
+ return __WEBPACK_IMPORTED_MODULE_6__Faction_js__["b" /* Factions */][name].playerReputation;
+ },
+ createProgram(name) {
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 3)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run createProgram(). It is a Singularity Function and requires SourceFile-4 (level 3) to run.");
+ return false;
+ }
+ }
+
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].isWorking) {
+ var txt = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].singularityStopWork();
+ workerScript.scriptRef.log(txt);
+ }
+
+ switch(name.toLowerCase()) {
+ case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].NukeProgram.toLowerCase():
+ __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].NukeProgram, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].MillisecondsPerFiveMinutes, 1);
+ break;
+ case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].BruteSSHProgram.toLowerCase():
+ if (__WEBPACK_IMPORTED_MODULE_9__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_9__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].BruteSSHProgram, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].MillisecondsPerFiveMinutes * 2, 50);
+ break;
+ case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].FTPCrackProgram.toLowerCase():
+ if (__WEBPACK_IMPORTED_MODULE_9__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_9__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].FTPCrackProgram, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].MillisecondsPerHalfHour, 100);
+ break;
+ case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram.toLowerCase():
+ if (__WEBPACK_IMPORTED_MODULE_9__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_9__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].MillisecondsPer2Hours, 250);
+ break;
+ case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].HTTPWormProgram.toLowerCase():
+ if (__WEBPACK_IMPORTED_MODULE_9__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_9__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].HTTPWormProgram, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].MillisecondsPer4Hours, 500);
+ break;
+ case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].SQLInjectProgram.toLowerCase():
+ if (__WEBPACK_IMPORTED_MODULE_9__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_9__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].SQLInjectProgram, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].MillisecondsPer8Hours, 750);
+ break;
+ case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].DeepscanV1.toLowerCase():
+ if (__WEBPACK_IMPORTED_MODULE_9__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_9__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].DeepscanV1, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].MillisecondsPerQuarterHour, 75);
+ break;
+ case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].DeepscanV2.toLowerCase():
+ if (__WEBPACK_IMPORTED_MODULE_9__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_9__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].DeepscanV2, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].MillisecondsPer2Hours, 400);
+ break;
+ case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].ServerProfiler.toLowerCase():
+ if (__WEBPACK_IMPORTED_MODULE_9__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_9__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].ServerProfiler, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].MillisecondsPerHalfHour, 75);
+ break;
+ case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].AutoLink.toLowerCase():
+ if (__WEBPACK_IMPORTED_MODULE_9__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_9__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].AutoLink, __WEBPACK_IMPORTED_MODULE_2__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;
+ },
+ getAugmentationCost(name) {
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 3)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_0__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_0__Augmentations_js__["c" /* Augmentations */][name];
+ return [aug.baseRepRequirement, aug.baseCost];
+ },
+ purchaseAugmentation(faction, name) {
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 3)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_6__Faction_js__["b" /* Factions */][faction];
+ if (fac === null || !(fac instanceof __WEBPACK_IMPORTED_MODULE_6__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_0__Augmentations_js__["c" /* Augmentations */][name];
+ if (aug === null || !(aug instanceof __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["a" /* Augmentation */])) {
+ workerScript.scriptRef.log("ERROR: purchaseAugmentation() failed because of invalid augmentation name: " + name);
+ return false;
+ }
+
+ for (var j = 0; j < __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].queuedAugmentations.length; ++j) {
+ if (__WEBPACK_IMPORTED_MODULE_9__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_9__Player_js__["a" /* Player */].augmentations.length; ++j) {
+ if (__WEBPACK_IMPORTED_MODULE_9__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_6__Faction_js__["k" /* purchaseAugmentation */])(aug, fac, true);
+ workerScript.scriptRef.log(res);
+ if (Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["e" /* isString */])(res) && res.startsWith("You purchased")) {
+ return true;
+ } else {
+ return false;
+ }
+ },
+ installAugmentations() {
+ if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) {
+ if (!(hasSingularitySF && singularitySFLvl >= 3)) {
+ throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run installAugmentations(). It is a Singularity Function and requires SourceFile-4 (level 3) to run.");
+ return false;
+ }
+ }
+
+ if (__WEBPACK_IMPORTED_MODULE_9__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;
+ }
+ workerScript.scriptRef.log("Installing Augmentations. This will cause this script to be killed");
+ Object(__WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["h" /* installAugmentations */])();
+ return true;
+ }
+ }
+}
+
+
+
+
+/***/ }),
+/* 36 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return commitShopliftCrime; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return commitRobStoreCrime; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return commitMugCrime; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return commitLarcenyCrime; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return commitDealDrugsCrime; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return commitTraffickArmsCrime; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return commitHomicideCrime; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return commitGrandTheftAutoCrime; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return commitKidnapCrime; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return commitAssassinationCrime; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return commitHeistCrime; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "w", function() { return determineCrimeSuccess; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "u", function() { return determineCrimeChanceShoplift; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return determineCrimeChanceRobStore; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return determineCrimeChanceMug; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return determineCrimeChanceLarceny; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return determineCrimeChanceDealDrugs; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "v", function() { return determineCrimeChanceTraffickArms; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return determineCrimeChanceHomicide; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return determineCrimeChanceGrandTheftAuto; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return determineCrimeChanceKidnap; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return determineCrimeChanceAssassination; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return determineCrimeChanceHeist; });
+/* 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__utils_DialogBox_js__ = __webpack_require__(2);
+
+
+
+
+/* Crimes.js */
+function commitShopliftCrime() {
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeShoplift;
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(0, 0, 0, 2, 2, 0, 15000, 2000); //$7500/s, 1 exp/s
+}
+
+function commitRobStoreCrime() {
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeRobStore;
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(30, 0, 0, 45, 45, 0, 400000, 60000); //$6666,6/2, 0.5exp/s, 0.75exp/s
+}
+
+function commitMugCrime() {
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeMug;
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(0, 3, 3, 3, 3, 0, 36000, 4000); //$9000/s, .66 exp/s
+}
+
+function commitLarcenyCrime() {
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeLarceny;
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(45, 0, 0, 60, 60, 0, 800000, 90000) // $8888.88/s, .5 exp/s, .66 exp/s
+}
+
+function commitDealDrugsCrime() {
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeDrugs;
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(0, 0, 0, 5, 5, 10, 120000, 10000); //$12000/s, .5 exp/s, 1 exp/s
+}
+
+function commitTraffickArmsCrime() {
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeTraffickArms;
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(0, 20, 20, 20, 20, 40, 600000, 40000); //$15000/s, .5 combat exp/s, 1 cha exp/s
+}
+
+function commitHomicideCrime() {
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeHomicide;
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(0, 2, 2, 2, 2, 0, 45000, 3000); //$15000/s, 0.66 combat exp/s
+}
+
+function commitGrandTheftAutoCrime() {
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeGrandTheftAuto;
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(0, 20, 20, 20, 80, 40, 1600000, 80000); //$20000/s, .25 exp/s, 1 exp/s, .5 exp/s
+}
+
+function commitKidnapCrime() {
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeKidnap;
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(0, 80, 80, 80, 80, 80, 3600000, 120000); //$30000/s. .66 exp/s
+}
+
+function commitAssassinationCrime() {
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeAssassination;
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(0, 300, 300, 300, 300, 0, 12000000, 300000); //$40000/s, 1 exp/s
+}
+
+function commitHeistCrime() {
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeHeist;
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(450, 450, 450, 450, 450, 450, 120000000, 600000); //$200000/s, .75exp/s
+}
+
+function determineCrimeSuccess(crime, moneyGained) {
+ var chance = 0;
+ switch (crime) {
+ case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeShoplift:
+ chance = determineCrimeChanceShoplift();
+ break;
+ case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeRobStore:
+ chance = determineCrimeChanceRobStore();
+ break;
+ case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeMug:
+ chance = determineCrimeChanceMug();
+ break;
+ case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeLarceny:
+ chance = determineCrimeChanceLarceny();
+ break;
+ case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeDrugs:
+ chance = determineCrimeChanceDealDrugs();
+ break;
+ case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeTraffickArms:
+ chance = determineCrimeChanceTraffickArms();
+ break;
+ case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeHomicide:
+ chance = determineCrimeChanceHomicide();
+ break;
+ case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeGrandTheftAuto:
+ chance = determineCrimeChanceGrandTheftAuto();
+ break;
+ case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeKidnap:
+ chance = determineCrimeChanceKidnap();
+ break;
+ case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeAssassination:
+ chance = determineCrimeChanceAssassination();
+ break;
+ case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeHeist:
+ chance = determineCrimeChanceHeist();
+ break;
+ default:
+ console.log(crime);
+ Object(__WEBPACK_IMPORTED_MODULE_2__utils_DialogBox_js__["a" /* dialogBoxCreate */])("ERR: Unrecognized crime type. This is probably a bug please contact the developer");
+ return;
+ }
+
+ if (Math.random() <= chance) {
+ //Success
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].gainMoney(moneyGained);
+ return true;
+ } else {
+ //Failure
+ return false;
+ }
+}
+
+function determineCrimeChanceShoplift() {
+ var chance = ((__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel)) * 20;
+ chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult;
+ return Math.min(chance, 1);
+}
+
+function determineCrimeChanceRobStore() {
+ var chance = ((0.5 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].hacking_skill / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
+ 2 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
+ 1 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel)) * 5;
+ chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult;
+ return Math.min(chance, 1);
+}
+
+function determineCrimeChanceMug() {
+ var chance = ((1.5 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].strength / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
+ 0.5 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].defense / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
+ 1.5 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
+ 0.5 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel)) * 5;
+ chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult;
+ return Math.min(chance, 1);
+}
+
+function determineCrimeChanceLarceny() {
+ var chance = ((0.5 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].hacking_skill / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel)) * 3;
+ chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult;
+ return Math.min(chance, 1);
+}
+
+function determineCrimeChanceDealDrugs() {
+ var chance = ((3*__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].charisma / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
+ 2*__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel));
+ chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult;
+ return Math.min(chance, 1);
+}
+
+function determineCrimeChanceTraffickArms() {
+ var chance = ((__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].charisma / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].strength / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].defense / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel)) / 2;
+ chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult;
+ return Math.min(chance, 1);
+}
+
+function determineCrimeChanceHomicide() {
+ var chance = ((2 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].strength / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
+ 2 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].defense / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
+ 0.5 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
+ 0.5 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel));
+ chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult;
+ return Math.min(chance, 1);
+}
+
+function determineCrimeChanceGrandTheftAuto() {
+ var chance = ((__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].hacking_skill / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].strength / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
+ 4 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
+ 2 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
+ 2 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].charisma / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel)) / 8;
+ chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult;
+ return Math.min(chance, 1);
+}
+
+function determineCrimeChanceKidnap() {
+ var chance = ((__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].charisma / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].strength / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel)) / 5;
+ chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult;
+ return Math.min(chance, 1);
+}
+
+function determineCrimeChanceAssassination() {
+ var chance = ((__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].strength / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
+ 2 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel)) / 8;
+ chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult;
+ return Math.min(chance, 1);
+}
+
+function determineCrimeChanceHeist() {
+ var chance = ((__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].hacking_skill / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].strength / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].defense / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].charisma / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel)) / 18;
+ chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult;
+ return Math.min(chance, 1);
+}
+
+
+
+
+/***/ }),
+/* 37 */
+/***/ (function(module, exports) {
+
+module.exports = function() {
+ throw new Error("define cannot be used indirect");
+};
+
+
+/***/ }),
+/* 38 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Aliases; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return GlobalAliases; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return printAliases; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return parseAliasDeclaration; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return removeAlias; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return substituteAliases; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return loadAliases; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return loadGlobalAliases; });
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Terminal_js__ = __webpack_require__(20);
+
+
+let Aliases = {};
+let GlobalAliases = {};
+
+function loadAliases(saveString) {
+ if (saveString === "") {
+ Aliases = {};
+ } else {
+ Aliases = JSON.parse(saveString);
+ }
+}
+
+function loadGlobalAliases(saveString) {
+ if (saveString === "") {
+ GlobalAliases = {};
+ } else {
+ GlobalAliases = JSON.parse(saveString);
+ }
+}
+
+//Print all aliases to terminal
+function printAliases() {
+ for (var name in Aliases) {
+ if (Aliases.hasOwnProperty(name)) {
+ Object(__WEBPACK_IMPORTED_MODULE_0__Terminal_js__["b" /* post */])("alias " + name + "=" + Aliases[name]);
+ }
+ }
+ for (var name in GlobalAliases) {
+ if (GlobalAliases.hasOwnProperty(name)) {
+ Object(__WEBPACK_IMPORTED_MODULE_0__Terminal_js__["b" /* post */])("global alias " + name + "=" + GlobalAliases[name]);
+ }
+ }
+}
+
+//True if successful, false otherwise
+function parseAliasDeclaration(dec,global=false) {
+ var re = /^([_|\w|!|%|,|@]+)="(.+)"$/;
+ var matches = dec.match(re);
+ if (matches == null || matches.length != 3) {return false;}
+ if (global){
+ addGlobalAlias(matches[1],matches[2]);
+ } else {
+ addAlias(matches[1], matches[2]);
+ }
+ return true;
+}
+
+function addAlias(name, value) {
+ if (name in GlobalAliases){
+ delete GlobalAliases[name];
+ }
+ Aliases[name] = value;
+}
+
+function addGlobalAlias(name, value) {
+ if (name in Aliases){
+ delete Aliases[name];
+ }
+ GlobalAliases[name] = value;
+}
+
+function getAlias(name) {
+ if (Aliases.hasOwnProperty(name)) {
+ return Aliases[name];
+ }
+ return null;
+}
+
+function getGlobalAlias(name) {
+ if (GlobalAliases.hasOwnProperty(name)) {
+ return GlobalAliases[name];
+ }
+ return null;
+}
+
+function removeAlias(name) {
+ if (Aliases.hasOwnProperty(name)) {
+ delete Aliases[name];
+ return true;
+ }
+ if (GlobalAliases.hasOwnProperty(name)) {
+ delete GlobalAliases[name];
+ return true;
+ }
+ return false;
+}
+
+//Returns the original string with any aliases substituted in
+//Aliases only applied to "whole words", one level deep
+function substituteAliases(origCommand) {
+ var commandArray = origCommand.split(" ");
+ if (commandArray.length>0){
+ var alias = getAlias(commandArray[0]);
+ if (alias != null) {
+ commandArray[0] = alias;
+ } else {
+ var alias = getGlobalAlias(commandArray[0]);
+ if (alias != null) {
+ commandArray[0] = alias;
+ }
+ }
+ for (var i = 0; i < commandArray.length; ++i) {
+ var alias = getGlobalAlias(commandArray[i]);
+ if (alias != null) {
+ commandArray[i] = alias;
+ }
+ }
+ }
+ return commandArray.join(" ");
+}
+
+
+
+
+/***/ }),
+/* 39 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return checkIfConnectedToDarkweb; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return executeDarkwebTerminalCommand; });
+/* unused harmony export listAllDarkwebItems */
+/* unused harmony export buyDarkwebItem */
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return parseDarkwebItemPrice; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return DarkWebItems; });
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__ = __webpack_require__(14);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Player_js__ = __webpack_require__(0);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__SpecialServerIps_js__ = __webpack_require__(11);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Terminal_js__ = __webpack_require__(20);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_IPAddress_js__ = __webpack_require__(19);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__ = __webpack_require__(5);
+
+
+
+
+
+
+
+
+
+/* DarkWeb.js */
+//Posts a "help" message if connected to DarkWeb
+function checkIfConnectedToDarkweb() {
+ if (__WEBPACK_IMPORTED_MODULE_2__SpecialServerIps_js__["a" /* SpecialServerIps */].hasOwnProperty("Darkweb Server")) {
+ var darkwebIp = __WEBPACK_IMPORTED_MODULE_2__SpecialServerIps_js__["a" /* SpecialServerIps */]["Darkweb Server"];
+ if (!Object(__WEBPACK_IMPORTED_MODULE_4__utils_IPAddress_js__["c" /* isValidIPAddress */])(darkwebIp)) {return;}
+ if (darkwebIp == __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getCurrentServer().ip) {
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You are now connected to the dark web. From the dark web you can purchase illegal items. " +
+ "Use the 'buy -l' command to display a list of all the items you can buy. Use 'buy [item-name] " +
+ "to purchase an item");
+ }
+ }
+
+}
+
+//Handler for dark web commands. The terminal's executeCommand() function will pass
+//dark web-specific commands into this. It will pass in the raw split command array
+//rather than the command string
+function executeDarkwebTerminalCommand(commandArray) {
+ if (commandArray.length == 0) {return;}
+ switch (commandArray[0]) {
+ case "buy":
+ if (commandArray.length != 2) {
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Incorrect number of arguments. Usage: ");
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("buy -l");
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("buy [item name]");
+ return;
+ }
+ var arg = commandArray[1];
+ if (arg == "-l") {
+ listAllDarkwebItems();
+ } else {
+ buyDarkwebItem(arg);
+ }
+ break;
+ default:
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Command not found");
+ break;
+ }
+}
+
+function listAllDarkwebItems() {
+ for (var item in DarkWebItems) {
+ if (DarkWebItems.hasOwnProperty(item)) {
+ var item = DarkWebItems[item];
+ //Convert string using toLocaleString
+ var split = item.split(" - ");
+ if (split.length == 3 && split[1].charAt(0) == '$') {
+ split[1] = split[1].slice(1);
+ split[1] = split[1].replace(/,/g, '');
+ var price = parseFloat(split[1]);
+ if (isNaN(price)) {
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])(item);
+ return;
+ }
+ price = Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(price, 0);
+ split[1] = "$" + price.toString();
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])(split.join(" - "));
+ } else {
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])(item);
+ }
+ }
+ }
+
+ var priceString = split[1];
+ //Check for errors
+ if (priceString.length == 0 || priceString.charAt(0) != '$') {
+ return -1;
+ }
+ //Remove dollar sign and commas
+ priceString = priceString.slice(1);
+ priceString = priceString.replace(/,/g, '');
+
+ //Convert string to numeric
+ var price = parseFloat(priceString);
+ if (isNaN(price)) {return -1;}
+ else {return price;}
+}
+
+function buyDarkwebItem(itemName) {
+ if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].BruteSSHProgram.toLowerCase()) {
+ var price = parseDarkwebItemPrice(DarkWebItems.BruteSSHProgram);
+ if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) {
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price);
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].BruteSSHProgram);
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the BruteSSH.exe program. The new program " +
+ "can be found on your home computer.");
+ } else {
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName);
+ }
+ } else if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].FTPCrackProgram.toLowerCase()) {
+ var price = parseDarkwebItemPrice(DarkWebItems.FTPCrackProgram);
+ if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) {
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price);
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].FTPCrackProgram);
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the FTPCrack.exe program. The new program " +
+ "can be found on your home computer.");
+ } else {
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName);
+ }
+ } else if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram.toLowerCase()) {
+ var price = parseDarkwebItemPrice(DarkWebItems.RelaySMTPProgram);
+ if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) {
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price);
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram);
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the relaySMTP.exe program. The new program " +
+ "can be found on your home computer.");
+ } else {
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName);
+ }
+ } else if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].HTTPWormProgram.toLowerCase()) {
+ var price = parseDarkwebItemPrice(DarkWebItems.HTTPWormProgram);
+ if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) {
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price);
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].HTTPWormProgram);
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the HTTPWorm.exe program. The new program " +
+ "can be found on your home computer.");
+ } else {
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName);
+ }
+ } else if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].SQLInjectProgram.toLowerCase()) {
+ var price = parseDarkwebItemPrice(DarkWebItems.SQLInjectProgram);
+ if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) {
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price);
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].SQLInjectProgram);
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the SQLInject.exe program. The new program " +
+ "can be found on your home computer.");
+ } else {
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName);
+ }
+ } else if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].DeepscanV1.toLowerCase()) {
+ var price = parseDarkwebItemPrice(DarkWebItems.DeepScanV1Program);
+ if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) {
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price);
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].DeepscanV1);
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the DeepscanV1.exe program. The new program " +
+ "can be found on your home computer.");
+ } else {
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName);
+ }
+ } else if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].DeepscanV2.toLowerCase()) {
+ var price = parseDarkwebItemPrice(DarkWebItems.DeepScanV2Program);
+ if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) {
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price);
+ __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].DeepscanV2);
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the DeepscanV2.exe program. The new program " +
+ "can be found on your home computer.");
+ } else {
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName);
+ }
+ } else {
+ Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Unrecognized item");
+ }
+}
+
+function parseDarkwebItemPrice(itemDesc) {
+ var split = itemDesc.split(" - ");
+ if (split.length == 3) {
+ var priceString = split[1];
+ //Check for errors
+ if (priceString.length == 0 || priceString.charAt(0) != '$') {
+ return -1;
+ }
+ //Remove dollar sign and commas
+ priceString = priceString.slice(1);
+ priceString = priceString.replace(/,/g, '');
+
+ //Convert string to numeric
+ var price = parseFloat(priceString);
+ if (isNaN(price)) {return -1;}
+ else {return price;}
+ } else {
+ return -1;
+ }
+}
+
+let DarkWebItems = {
+ BruteSSHProgram: "BruteSSH.exe - $500,000 - Opens up SSH Ports",
+ FTPCrackProgram: "FTPCrack.exe - $1,500,000 - Opens up FTP Ports",
+ RelaySMTPProgram: "relaySMTP.exe - $5,000,000 - Opens up SMTP Ports",
+ HTTPWormProgram: "HTTPWorm.exe - $30,000,000 - Opens up HTTP Ports",
+ SQLInjectProgram: "SQLInject.exe - $250,000,000 - Opens up SQL Ports",
+ DeepScanV1Program: "DeepscanV1.exe - $500,000 - Enables 'scan-analyze' with a depth up to 5",
+ DeepScanV2Program: "DeepscanV2.exe - $25,000,000 - Enables 'scan-analyze' with a depth up to 10",
+}
+
+
+
+
+/***/ }),
+/* 40 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* unused harmony export Literatures */
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return initLiterature; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return showLiterature; });
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_DialogBox_js__ = __webpack_require__(2);
+
+
+/* Literature.js
+ * Lore / world building literature that can be found on servers
+ */
+function Literature(title, filename, txt) {
+ this.title = title;
+ this.fn = filename;
+ this.txt = txt;
+}
+
+function showLiterature(fn) {
+ var litObj = Literatures[fn];
+ if (litObj == null) {return;}
+ var txt = litObj.title + "
" +
+ "" + litObj.txt + "";
+ Object(__WEBPACK_IMPORTED_MODULE_0__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);
+}
+
+let Literatures = {}
+
+function initLiterature() {
+ var title, fn, txt;
+ title = "A Green Tomorrow";
+ fn = "A-Green-Tomorrow.lit";
+ txt = "Starting a few decades ago, there was a massive global movement towards the generation of renewable energy in an effort to " +
+ "combat global warming and climate change. The shift towards renewable energy was a big success, or so it seemed. In 2045 " +
+ "a staggering 80% of the world's energy came from non-renewable fossil fuels. Now, about three decades later, that " +
+ "number is down to only 15%. Most of the world's energy now comes from nuclear power and renwable sources such as " +
+ "solar and geothermal. Unfortunately, these efforts were not the huge success that they seem to be.
" +
+ "Since 2045 primary energy use has soared almost tenfold. This was mainly due to growing urban populations and " +
+ "the rise of increasingly advanced (and power-hungry) technology that has become ubiquitous in our lives. So, " +
+ "despite the fact that the percentage of our energy that comes from fossil fuels has drastically decreased, " +
+ "the total amount of energy we are producing from fossil fuels has actually increased.
" +
+ "The grim effects of our species' irresponsible use of energy and neglect of our mother world have become increasingly apparent. " +
+ "Last year a temperature of 190F was recorded in the Death Valley desert, which is over 50% higher than the highest " +
+ "recorded temperature at the beginning of the century. In the last two decades numerous major cities such as Manhattan, Boston, and " +
+ "Los Angeles have been partially or fully submerged by rising sea levels. In the present day, over 75% of the world's agriculture is " +
+ "done in climate-controlled vertical farms, as most traditional farmland has become unusable due to severe climate conditions.
" +
+ "Despite all of this, the greedy and corrupt corporations that rule the world have done nothing to address these problems that " +
+ "threaten our species. And so it's up to us, the common people. Each and every one of us can make a difference by doing what " +
+ "these corporations won't: taking responsibility. If we don't, pretty soon there won't be an Earth left to save. We are " +
+ "the last hope for a green tomorrow.";
+ Literatures[fn] = new Literature(title, fn, txt);
+
+ title = "Alpha and Omega";
+ fn = "alpha-omega.lit";
+ txt = "Then we saw a new heaven and a new earth, for our first heaven and earth had gone away, and our sea was no more. " +
+ "And we saw a new holy city, new Aeria, coming down out of this new heaven, prepared as a bride adorned for her husband. " +
+ "And we heard a loud voice saying, 'Behold, the new dwelling place of the Gods. We will dwell with them, and they " +
+ "will be our people, and we will be with them as their Gods. We will wipe away every tear from their eyes, and death " +
+ "shall be no more, neither shall there be mourning, nor crying, nor pain anymore, for the former things " +
+ "have passed away.'
" +
+ "And once were were seated on the throne we said 'Behold, I am making all things new.' " +
+ "Also we said, 'Write this down, for these words are trustworthy and true.' And we said to you, " +
+ "'It is done! I am the Alpha and the Omega, the beginning and the end. To the thirsty I will give from the spring " +
+ "of the water of life without payment. The one who conquers will have this heritage, and we will be his God and " +
+ "he will be our son. But as for the cowardly, the faithless, the detestable, as for murderers, " +
+ "the sexually immoral, sorcerers, idolaters, and all liars, their portion will be in the lake that " +
+ "burns with fire and sulfur, for it is the second true death.'";
+ Literatures[fn] = new Literature(title, fn, txt);
+
+ title = "Are We Living in a Computer Simulation?";
+ fn = "simulated-reality.lit";
+ txt = "The idea that we are living in a virtual world is not new. It's a trope that has " +
+ "been explored constantly in literature and pop culture. However, it is also a legitimate " +
+ "scientific hypothesis that many notable physicists and philosophers have debated for years.
" +
+ "Proponents for this simulated reality theory often point to how advanced our technology has become, " +
+ "as well as the incredibly fast pace at which it has advanced over the past decades. The amount of computing " +
+ "power available to us has increased over 100-fold since 2060 due to the development of nanoprocessors and " +
+ "quantum computers. Artifical Intelligence has advanced to the point where our entire lives are controlled " +
+ "by robots and machines that handle our day-to-day activities such as autonomous transportation and scheduling. " +
+ "If we consider the pace at which this technology has advanced and assume that these developments continue, it's " +
+ "reasonable to assume that at some point in the future our technology would be advanced enough that " +
+ "we could create simulations that are indistinguishable from reality. However, if this is a reasonable outcome " +
+ "of continued technological advancement, then it is very likely that such a scenario has already happened.
" +
+ "Statistically speaking, somewhere out there in the infinite universe there is an advanced, intelligent species " +
+ "that already has such technology. Who's to say that they haven't already created such a virtual reality: our own?";
+ Literatures[fn] = new Literature(title, fn, txt);
+
+ title = "Beyond Man";
+ fn = "beyond-man.lit";
+ txt = "Humanity entered a 'transhuman' era a long time ago. And despite the protests and criticisms of many who cried out against " +
+ "human augmentation at the time, the transhuman movement continued and prospered. Proponents of the movement ignored the critics, " +
+ "arguing that it was in our inherent nature to better ourselves. To improve. To be more than we were. They claimed that " +
+ "not doing so would be to go against every living organism's biological purpose: evolution and survival of the fittest.
" +
+ "And here we are today, with technology that is advanced enough to augment humans to a state that " +
+ "can only be described as posthuman. But what do we have to show for it when this augmentation " +
+ "technology is only available to the so-called 'elite'? Are we really better off than before when only 5% of the " +
+ "world's population has access to this technology? When the powerful corporations and organizations of the world " +
+ "keep it all to themselves, have we really evolved?
" +
+ "Augmentation technology has only further increased the divide between the rich and the poor, between the powerful and " +
+ "the oppressed. We have not become 'more than human'. We have not evolved from nature's original design. We are still the greedy, " +
+ "corrupted, and evil men that we always were.";
+ Literatures[fn] = new Literature(title, fn, txt);
+
+
+ title = "Brighter than the Sun";
+ fn = "brighter-than-the-sun.lit";
+ txt = "When people think about the corporations that dominate the East, they typically think of KuaiGong International, which " +
+ "holds a complete monopoly for manufacturing and commerce in Asia, or Global Pharmaceuticals, the world's largest " +
+ "drug company, or OmniTek Incorporated, the global leader in intelligent and autonomous robots. But there's one company " +
+ "that has seen a rapid rise in the last year and is poised to dominate not only the East, but the entire world: TaiYang Digital.
" +
+ "TaiYang Digital is a Chinese internet-technology corporation that provides services such as " +
+ "online advertising, search, gaming, media, entertainment, and cloud computing/storage. Its name TaiYang comes from the Chinese word " +
+ "for 'sun'. In Chinese culture, the sun is a 'yang' symbol " +
+ "associated with life, heat, masculinity, and heaven.
" +
+ "The company was founded " +
+ "less than 5 years ago and is already the third highest valued company in all of Asia. In 2076 it generated a total revenue of " +
+ "over 10 trillion yuan. It's services are used daily by over a billion people worldwide.
" +
+ "TaiYang Digital's meteoric rise is extremely surprising in modern society. This sort of growth is " +
+ "something you'd commonly see in the first half of the century, especially for tech companies. However in " +
+ "the last two decades the number of corporations has significantly declined as the largest entities " +
+ "quickly took over the economy. Corporations such as ECorp, MegaCorp, and KuaiGong have established " +
+ "such strong monopolies in their market sectors that they have effectively killed off all " +
+ "of the smaller and new corporations that have tried to start up over the years. This is what makes " +
+ "the rise of TaiYang Digital so impressive. And if TaiYang continues down this path, then they have " +
+ "a bright future ahead of them.";
+ Literatures[fn] = new Literature(title, fn, txt);
+
+ title = "Democracy is Dead: The Fall of an Empire";
+ fn = "democracy-is-dead.lit";
+ txt = "They rose from the shadows in the street From the places where the oppressed meet " +
+ "Their cries echoed loudly through the air As they once did in Tiananmen Square " +
+ "Loudness in the silence, Darkness in the light They came forth with power and might " +
+ "Once the beacon of democracy, America was first Its pillars of society destroyed and dispersed " +
+ "Soon the cries rose everywhere, with revolt and riot Until one day, finally, all was quiet " +
+ "From the ashes rose a new order, corporatocracy was its name " +
+ "Rome, Mongol, Byzantine, all of history is just the same " +
+ "For man will never change in a fundamental way " +
+ "And now democracy is dead, in the USA";
+ Literatures[fn] = new Literature(title, fn, txt);
+
+ title = "Figures Show Rising Crime Rates in Sector-12";
+ fn = "sector-12-crime.lit";
+ txt = "A recent study by analytics company Wilson Inc. shows a significant rise " +
+ "in criminal activity in Sector-12. Perhaps the most alarming part of the statistic " +
+ "is that most of the rise is in violent crime such as homicide and assault. According " +
+ "to the study, the city saw a total of 21,406 reported homicides in 2076, which is over " +
+ "a 20% increase compared to 2075.
" +
+ "CIA director David Glarow says its too early to know " +
+ "whether these figures indicate the beginning of a sustained increase in crime rates, or whether " +
+ "the year was just an unfortunate outlier. He states that many intelligence and law enforcement " +
+ "agents have noticed an increase in organized crime activites, and believes that these figures may " +
+ "be the result of an uprising from criminal organizations such as The Syndicate or the Slum Snakes.";
+ Literatures[fn] = new Literature(title, fn, txt);
+
+ title = "Man and the Machine";
+ fn = "man-and-machine.lit";
+ txt = "In 2005 Ray Kurzweil popularized his theory of the Singularity. He predicted that the rate " +
+ "of technological advancement would continue to accelerate faster and faster until one day " +
+ "machines would be become infinitely more intelligent than humans. This point, called the " +
+ "Singularity, would result in a drastic transformation of the world as we know it. He predicted " +
+ "that the Singularity would arrive by 2045. " +
+ "And yet here we are, more than three decades later, where most would agree that we have not " +
+ "yet reached a point where computers and machines are vastly more intelligent than we are. So what gives?
" +
+ "The answer is that we have reached the Singularity, just not in the way we expected. The artifical superintelligence " +
+ "that was predicted by Kurzweil and others exists in the world today - in the form of Augmentations. " +
+ "Yes, those Augmentations that the rich and powerful keep to themselves enable humans " +
+ "to become superintelligent beings. The Singularity did not lead to a world where " +
+ "our machines are infinitely more intelligent than us, it led to a world " +
+ "where man and machine can merge to become something greater. Most of the world just doesn't " +
+ "know it yet."
+ Literatures[fn] = new Literature(title, fn, txt);
+
+ title = "Secret Societies";
+ fn = "secret-societies.lit";
+ txt = "The idea of secret societies has long intrigued the general public by inspiring curiosity, fascination, and " +
+ "distrust. People have long wondered about who these secret society members are and what they do, with the " +
+ "most radical of conspiracy theorists claiming that they control everything in the entire world. And while the world " +
+ "may never know for sure, it is likely that many secret societies do actually exist, even today.
" +
+ "However, the secret societies of the modern world are nothing like those that (supposedly) existed " +
+ "decades and centuries ago. The Freemasons, Knights Templar, and Illuminati, while they may have been around " +
+ "at the turn of the 21st century, almost assuredly do not exist today. The dominance of the Web in " +
+ "our everyday lives and the fact that so much of the world is now digital has given rise to a new breed " +
+ "of secret societies: Internet-based ones.
" +
+ "Commonly called 'hacker groups', Internet-based secret societies have become well-known in today's " +
+ "world. Some of these, such as The Black Hand, are black hat groups that claim they are trying to " +
+ "help the oppressed by attacking the elite and powerful. Others, such as NiteSec, are hacktivist groups " +
+ "that try to push political and social agendas. Perhaps the most intriguing hacker group " +
+ "is the mysterious Bitrunners, whose purpose still remains unknown.";
+ Literatures[fn] = new Literature(title, fn, txt);
+
+ title = "Space: The Failed Frontier";
+ fn = "the-failed-frontier.lit";
+ txt = "Humans have long dreamed about spaceflight. With enduring interest, we were driven to explore " +
+ "the unknown and discover new worlds. We dreamed about conquering the stars. And in our quest, " +
+ "we pushed the boundaries of our scientific limits, and then pushed further. Space exploration " +
+ "lead to the development of many important technologies and new industries.
" +
+ "But sometime in the middle of the 21st century, all of that changed. Humanity lost its ambitions and " +
+ "aspirations of exploring the cosmos. The once-large funding for agencies like NASA and the European " +
+ "Space Agency gradually whittled away until their eventual disbanding in the 2060's. Not even " +
+ "militaries are fielding flights into space nowadays. The only remnants of the once great mission for cosmic " +
+ "conquest are the countless satellites in near-earth orbit, used for communications, espionage, " +
+ "and other corporate interests.
" +
+ "And as we continue to look at the state of space technology, it becomes more and " +
+ "more apparent that we will never return to that golden age of space exploration, that " +
+ "age where everyone dreamed of going beyond earth for the sake of discovery.";
+ Literatures[fn] = new Literature(title, fn, txt);
+
+ title = "Coded Intelligence: Myth or Reality?";
+ fn = "coded-intelligence.lit";
+ txt = "Tremendous progress has been made in the field of Artificial Intelligence over the past few decades. " +
+ "Our autonomous vehicles and transporation systems. The electronic personal assistants that control our everyday lives. " +
+ "Medical, service, and manufacturing robots. All of these are examples of how far AI has come and how much it has " +
+ "improved our daily lives. However, the question still remains of whether AI will ever be advanced enough to re-create " +
+ "human intelligence.
" +
+ "We've certainly come close to artificial intelligence that is similar to humans. For example OmniTek Incorporated's " +
+ "CompanionBot, a robot meant to act as a comforting friend for lonely and grieving people, is eerily human-like " +
+ "in its appearance, speech, mannerisms, and even movement. However its artificial intelligence isn't the same as " +
+ "that of humans. Not yet. It doesn't have sentience or self-awareness or consciousness.
" +
+ "Many neuroscientists believe that we won't ever reach the point of creating artificial human intelligence. 'At the end of the " +
+ "the day, AI comes down to 1's and 0's, while the human brain does not. We'll never see AI that is identical to that of " +
+ "humans.'";
+ Literatures[fn] = new Literature(title, fn, txt);
+
+ title = "Synthetic Muscles";
+ fn = "synthetic-muscles.lit";
+ txt = "Initial versions of synthetic muscles weren't made of anything organic but were actually " +
+ "crude devices made to mimic human muscle function. Some of the early iterations were actually made of " +
+ "common materials such as fishing lines and sewing threads due to their high strength for " +
+ "a cheap cost.
" +
+ "As technology progressed, however, advances in biomedical engineering paved the way for a new method of " +
+ "creating synthetic muscles. Instead of creating something that closely imitated the functionality " +
+ "of human muscle, scientists discovered a way of forcing the human body itself to augment its own " +
+ "muscle tissue using both synthetic and organic materials. This is typically done using gene therapy " +
+ "or chemical injections.";
+ Literatures[fn] = new Literature(title, fn, txt);
+
+ title = "Tensions rise in global tech race";
+ fn = "tensions-in-tech-race.lit";
+ txt = "Have we entered a new Cold War? Is WWIII just beyond the horizon?
" +
+ "After rumors came out that OmniTek Incorporated had begun developing advanced robotic supersoldiers, " +
+ "geopolitical tensions quickly flared between the USA, Russia, and several Asian superpowers. " +
+ "In a rare show of cooperation between corporations, MegaCorp and ECorp have " +
+ "reportedly launched hundreds of new surveillance and espionage satellites. " +
+ "Defense contractors such as " +
+ "DeltaOne and AeroCorp have been working with the CIA and NSA to prepare " +
+ "for conflict. Meanwhile, the rest of the world sits in earnest " +
+ "hoping that it never reaches full-scale war. With today's technology " +
+ "and firepower, a World War would assuredly mean the end of human civilization.";
+ Literatures[fn] = new Literature(title, fn, txt);
+
+ title = "The Cost of Immortality";
+ fn = "cost-of-immortality.lit";
+ txt = "Evolution and advances in medical and augmentation technology has lead to drastic improvements " +
+ "in human mortality rates. Recent figures show that the life expectancy for humans " +
+ "that live in a first-world country is about 130 years of age, almost double of what it was " +
+ "at the turn of the century. However, this increase in average lifespan has had some " +
+ "significant effects on society and culture.
" +
+ "Due to longer lifespans and a better quality of life, many adults are holding " +
+ "off on having kids until much later. As a result, the percentage of youth in " +
+ "first-world countries has been decreasing, while the number " +
+ "of senior citizens is significantly increasing.
" +
+ "Perhaps the most alarming result of all of this is the rapidly shrinking workforce. " +
+ "Despite the increase in life expectancy, the typical retirement age for " +
+ "workers in America has remained about the same, meaning a larger and larger " +
+ "percentage of people in America are retirees. Furthermore, many " +
+ "young adults are holding off on joining the workforce because they feel that " +
+ "they have plenty of time left in their lives for employment, and want to " +
+ "'enjoy life while they're young.' For most industries, this shrinking workforce " +
+ "is not a major issue as most things are handled by robots anyways. However, " +
+ "there are still several key industries such as engineering and education " +
+ "that have not been automated, and these remain in danger to this cultural " +
+ "phenomenon.";
+ Literatures[fn] = new Literature(title, fn, txt);
+
+ title = "The Hidden World";
+ fn = "the-hidden-world.lit";
+ txt = "WAKE UP SHEEPLE
" +
+ "THE GOVERNMENT DOES NOT EXIST. CORPORATIONS DO NOT RUN SOCIETY
" +
+ "THE ILLUMINATI ARE THE SECRET RULERS OF THE WORLD!
" +
+ "Yes, the Illuminati of legends. The ancient secret society that controls the entire " +
+ "world from the shadows with their invisible hand. The group of the rich and wealthy " +
+ "that have penetrated every major government, financial agency, and corporation in the last " +
+ "three hundred years.
" +
+ "OPEN YOUR EYES
" +
+ "It was the Illuminati that brought an end to democracy in the world. They are the driving force " +
+ "behind everything that happens.
" +
+ "THEY ARE ALL AROUND YOU
" +
+ "After destabilizing the world's governments, they are now entering the final stage of their master plan. " +
+ "They will secretly initiate global crises. Terrorism. Pandemics. World War. And out of the chaos " +
+ "that ensues they will build their New World Order.";
+ Literatures[fn] = new Literature(title, fn, txt);
+
+ title = "The New God";
+ fn = "the-new-god.lit";
+ txt = "Everyone has that moment in their life where they wonder about the bigger questions
" +
+ "What's the point of all of this? What is my purpose?
" +
+ "Some people dare to think even bigger
" +
+ "What will be the fate of the human race?
" +
+ "We live in an era vastly different from that of even 15 or 20 years ago. We have gone " +
+ "where no man has gone before. We have stripped ourselves of the tyranny of flesh.
" +
+ "The Singularity is here. The merging of man and machine. This is where humanity evolves into " +
+ "something greater. This is our future
" +
+ "Embrace it, and you will obey a new god. The God in the Machine";
+ Literatures[fn] = new Literature(title, fn, txt);
+
+ title = "The New Triads";
+ fn = "new-triads.lit";
+ txt = "The Triads were an ancient transnational crime syndicate based in China, Hong Kong, and other Asian " +
+ "territories. They were often considered one of the first and biggest criminal secret societies. " +
+ "While most of the branches of the Triads have been destroyed over the past few decades, the " +
+ "crime faction has spawned and inspired a number of other Asian crime organizations over the past few years. " +
+ "The most notable of these is the Tetrads.
" +
+ "It is widely believed that the Tetrads are a rogue group that splintered off from the Triads sometime in the " +
+ "mid 21st century. The founders of the Tetrads, all of whom were ex-Triad members, believed that the " +
+ "Triads were losing their purpose and direction. The Tetrads started off as a small group that mainly engaged " +
+ "in fraud and extortion. They were largely unknown until just a few years ago when they took over the illegal " +
+ "drug trade in all of the major Asian cities. They quickly became the most powerful crime syndicate in the " +
+ "continent.
" +
+ "Not much else is known about the Tetrads, or about the efforts the Asian governments and corporations are making " +
+ "to take down this large new crime organization. Many believe that the Tetrads have infiltrated the governments " +
+ "and powerful corporations in Asia, which has helped faciliate their recent rapid rise.";
+ Literatures[fn] = new Literature(title, fn, txt);
+
+ title = "The Secret War";
+ fn = "the-secret-war.lit";
+ txt = ""
+ Literatures[fn] = new Literature(title, fn, txt);
+}
+
+
+
+
+/***/ }),
+/* 41 */
+/***/ (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__(9);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__engine_js__ = __webpack_require__(4);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Player_js__ = __webpack_require__(0);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Prestige_js__ = __webpack_require__(31);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__SourceFile_js__ = __webpack_require__(30);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Terminal_js__ = __webpack_require__(20);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_DialogBox_js__ = __webpack_require__(2);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__ = __webpack_require__(1);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__ = __webpack_require__(21);
+
+
+
+
+
+
+
+
+
+
+
+/* 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);
+ Object(__WEBPACK_IMPORTED_MODULE_6__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You received a Source-File for destroying a Bit Node!
" +
+ "You gained: " +
+ Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.hackingExpGained, 3) + " hacking exp " +
+ Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.strExpGained, 3) + " str exp " +
+ Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.defExpGained, 3) + " def exp " +
+ Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.dexExpGained, 3) + " dex exp " +
+ Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.agiExpGained, 3) + " agi exp " +
+ Object(__WEBPACK_IMPORTED_MODULE_5__StringHelperFunctions_js__["c" /* formatNumber */])(inst.chaExpGained, 3) + " cha exp ");
+ infiltrationBoxClose();
+ return false;
+ });
+ }, 750);
+ infiltrationBoxOpen();
+}
+
+
+
+
+/***/ }),
+/* 45 */
+/***/ (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.
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;g--)switch(f=i.after[g]){case"$":e=g===i.after.length-1?e+h.currency.symbol:b._.insert(e,h.currency.symbol,-(i.after.length-(1+g)));break;case" ":e=g===i.after.length-1?e+" ":b._.insert(e," ",-(i.after.length-(1+g)+h.currency.symbol.length-1))}return e}})}(),function(){b.register("format","exponential",{regexps:{format:/(e\+|e-)/,unformat:/(e\+|e-)/},format:function(a,c,d){var e,f="number"!=typeof a||b._.isNaN(a)?"0e+0":a.toExponential(),g=f.split("e");return c=c.replace(/e[\+|\-]{1}0/,""),e=b._.numberToFormat(Number(g[0]),c,d),e+"e"+g[1]},unformat:function(a){function c(a,c,d,e){var f=b._.correctionFactor(a,c),g=a*f*(c*f)/(f*f);return g}var d=b._.includes(a,"e+")?a.split("e+"):a.split("e-"),e=Number(d[0]),f=Number(d[1]);return f=b._.includes(a,"e-")?f*=-1:f,b._.reduce([e,Math.pow(10,f)],c,1)}})}(),function(){b.register("format","ordinal",{regexps:{format:/(o)/},format:function(a,c,d){var e,f=b.locales[b.options.currentLocale],g=b._.includes(c," o")?" ":"";return c=c.replace(/\s?o/,""),g+=f.ordinal(a),e=b._.numberToFormat(a,c,d),e+g}})}(),function(){b.register("format","percentage",{regexps:{format:/(%)/,unformat:/(%)/},format:function(a,c,d){var e,f=b._.includes(c," %")?" ":"";return b.options.scalePercentBy100&&(a=100*a),c=c.replace(/\s?\%/,""),e=b._.numberToFormat(a,c,d),b._.includes(e,")")?(e=e.split(""),e.splice(-1,0,f+"%"),e=e.join("")):e=e+f+"%",e},unformat:function(a){var c=b._.stringToNumber(a);return b.options.scalePercentBy100?.01*c:c}})}(),function(){b.register("format","time",{regexps:{format:/(:)/,unformat:/(:)/},format:function(a,b,c){var d=Math.floor(a/60/60),e=Math.floor((a-60*d*60)/60),f=Math.round(a-60*d*60-60*e);return d+":"+(10>e?"0"+e:e)+":"+(10>f?"0"+f:f)},unformat:function(a){var b=a.split(":"),c=0;return 3===b.length?(c+=60*Number(b[0])*60,c+=60*Number(b[1]),c+=Number(b[2])):2===b.length&&(c+=60*Number(b[0]),c+=Number(b[1])),Number(c)}})}(),b});
-
-/***/ }),
-/* 39 */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NetscriptFunctions; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return initSingularitySFFlags; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return hasSingularitySF; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__ = __webpack_require__(16);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Company_js__ = __webpack_require__(17);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Constants_js__ = __webpack_require__(3);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__ = __webpack_require__(14);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__ = __webpack_require__(42);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__engine_js__ = __webpack_require__(4);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Faction_js__ = __webpack_require__(10);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__HacknetNode_js__ = __webpack_require__(32);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Location_js__ = __webpack_require__(12);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__Script_js__ = __webpack_require__(18);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__Server_js__ = __webpack_require__(6);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__Settings_js__ = __webpack_require__(13);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__ = __webpack_require__(11);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__StockMarket_js__ = __webpack_require__(25);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__Terminal_js__ = __webpack_require__(20);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__NetscriptWorker_js__ = __webpack_require__(15);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__ = __webpack_require__(45);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__NetscriptEnvironment_js__ = __webpack_require__(28);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__utils_decimal_js__ = __webpack_require__(23);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__utils_decimal_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_19__utils_decimal_js__);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__utils_HelperFunctions_js__ = __webpack_require__(1);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__utils_IPAddress_js__ = __webpack_require__(19);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__ = __webpack_require__(5);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-var hasSingularitySF = false;
-var singularitySFLvl = 1;
-
-function initSingularitySFFlags() {
- for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].sourceFiles.length; ++i) {
- if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].sourceFiles[i].n === 4) {
- hasSingularitySF = true;
- singularitySFLvl = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].sourceFiles[i].lvl;
- }
- }
-}
-
-function NetscriptFunctions(workerScript) {
- return {
- hacknetnodes : __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hacknetNodes,
- scan : function(ip=workerScript.serverIp){
- var server = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(ip);
- if (server == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, 'Invalid IP or hostname passed into scan() command');
- }
- var out = [];
- for (var i = 0; i < server.serversOnNetwork.length; i++) {
- var entry = server.getServerOnNetwork(i).hostname;
- 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_17__NetscriptEvaluator_js__["c" /* 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_11__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "hack() error. Invalid IP or hostname passed in: " + ip + ". Stopping...");
- }
-
- //Calculate the hacking time
- var hackingTime = Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["i" /* scriptCalculateHackingTime */])(server); //This is in seconds
-
- //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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot hack this server (" + server.hostname + ") because user does not have root access");
- }
-
- if (server.requiredHackingSkill > __WEBPACK_IMPORTED_MODULE_9__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot hack this server (" + server.hostname + ") because user's hacking skill is not high enough");
- }
-
- 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_17__NetscriptEvaluator_js__["d" /* netscriptDelay */])(hackingTime* 1000).then(function() {
- if (workerScript.env.stopFlag) {return Promise.reject(workerScript);}
- var hackChance = Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["h" /* scriptCalculateHackingChance */])(server);
- var rand = Math.random();
- var expGainedOnSuccess = Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["f" /* scriptCalculateExpGain */])(server) * threads;
- var expGainedOnFailure = (expGainedOnSuccess / 4);
- if (rand < hackChance) { //Success!
- var moneyGained = Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["j" /* scriptCalculatePercentMoneyHacked */])(server);
- moneyGained = Math.floor(server.moneyAvailable * moneyGained) * threads;
-
- //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;}
-
- __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].gainMoney(moneyGained);
- workerScript.scriptRef.onlineMoneyMade += moneyGained;
- workerScript.scriptRef.recordHack(server.ip, moneyGained, threads);
- __WEBPACK_IMPORTED_MODULE_9__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_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(moneyGained, 2) + " and " + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(expGainedOnSuccess, 4) + " exp (t=" + threads + ")");
- server.fortify(__WEBPACK_IMPORTED_MODULE_2__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_9__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_22__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_17__NetscriptEvaluator_js__["c" /* 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_17__NetscriptEvaluator_js__["d" /* netscriptDelay */])(time).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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "grow() call has incorrect number of arguments. Takes 1 argument");
- }
- var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot grow(). Invalid IP or hostname passed in: " + ip);
- }
-
- //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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot grow this server (" + server.hostname + ") because user does not have root access");
- }
-
- var growTime = Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["g" /* 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_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(growTime/1000, 3) + " seconds (t=" + threads + ")");
- return Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["d" /* netscriptDelay */])(growTime).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_11__Server_js__["j" /* processSingleServerGrowth */])(server, 450 * threads);
- workerScript.scriptRef.recordGrow(server.ip, threads);
- var expGain = Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["f" /* scriptCalculateExpGain */])(server) * threads;
- if (growthPercentage == 1) {
- expGain = 0;
- }
- workerScript.scriptRef.log("Available money on " + server.hostname + " grown by "
- + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(growthPercentage*100 - 100, 6) + "%. Gained " +
- Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(expGain, 4) + " hacking exp (t=" + threads +")");
- workerScript.scriptRef.onlineExpGained += expGain;
- __WEBPACK_IMPORTED_MODULE_9__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "weaken() call has incorrect number of arguments. Takes 1 argument");
- }
- var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot weaken(). Invalid IP or hostname passed in: " + ip);
- }
-
- //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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot weaken this server (" + server.hostname + ") because user does not have root access");
- }
-
- var weakenTime = Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["k" /* scriptCalculateWeakenTime */])(server);
- //console.log("Executing weaken() on server " + server.hostname + " in " + formatNumber(weakenTime/1000, 3) + " seconds")
- workerScript.scriptRef.log("Executing weaken() on server " + server.hostname + " in " +
- Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(weakenTime/1000, 3) + " seconds (t=" + threads + ")");
- return Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["d" /* netscriptDelay */])(weakenTime).then(function() {
- if (workerScript.env.stopFlag) {return Promise.reject(workerScript);}
- server.weaken(__WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ServerWeakenAmount * threads);
- workerScript.scriptRef.recordWeaken(server.ip, threads);
- var expGain = Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["f" /* scriptCalculateExpGain */])(server) * threads;
- workerScript.scriptRef.log("Server security level on " + server.hostname + " weakened to " + server.hackDifficulty +
- ". Gained " + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(expGain, 4) + " hacking exp (t=" + threads + ")");
- workerScript.scriptRef.onlineExpGained += expGain;
- __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].gainHackingExp(expGain);
- return Promise.resolve(__WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ServerWeakenAmount * threads);
- });
- },
- print : function(args){
- if (args === undefined) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "tprint() call has incorrect number of arguments. Takes 1 argument");
- }
- Object(__WEBPACK_IMPORTED_MODULE_15__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument");
- }
- var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call nuke(). Invalid IP or hostname passed in: " + ip);
- }
- if (!__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].NukeProgram)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "You do not have the NUKE.exe virus!");
- }
- if (server.openPortCount < server.numOpenPortsRequired) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument");
- }
- var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call brutessh(). Invalid IP or hostname passed in: " + ip);
- }
- if (!__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].BruteSSHProgram)) {
- workerScript.scriptRef.log("You do not have the BruteSSH.exe program!");
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument");
- }
- var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call ftpcrack(). Invalid IP or hostname passed in: " + ip);
- }
- if (!__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].FTPCrackProgram)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument");
- }
- var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call relaysmtp(). Invalid IP or hostname passed in: " + ip);
- }
- if (!__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument");
- }
- var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call httpworm(). Invalid IP or hostname passed in: " + ip);
- }
- if (!__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].HTTPWormProgram)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument");
- }
- var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call sqlinject(). Invalid IP or hostname passed in: " + ip);
- }
- if (!__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].SQLInjectProgram)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_17__NetscriptEvaluator_js__["c" /* 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_17__NetscriptEvaluator_js__["c" /* 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_11__Server_js__["e" /* getServer */])(workerScript.serverIp);
- if (scriptServer == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Could not find server. This is a bug in the game. Report to game dev");
- }
-
- return Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["e" /* runScriptFromScript */])(scriptServer, scriptname, argsForNewScript, workerScript, threads);
- },
- exec : function(scriptname,ip,threads = 1){
- if (scriptname === undefined || ip === undefined) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_17__NetscriptEvaluator_js__["c" /* 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_11__Server_js__["e" /* getServer */])(ip);
- if (server == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Invalid hostname/ip passed into exec() command: " + ip);
- }
- return Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["e" /* runScriptFromScript */])(server, scriptname, argsForNewScript, workerScript, threads);
- },
- kill : function(filename,ip){
- if (filename === undefined || ip === undefined) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "kill() call has incorrect number of arguments. Usage: kill(scriptname, server, [arg1], [arg2]...)");
- }
- var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* 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_10__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_20__utils_HelperFunctions_js__["f" /* printArray */])(argsForKillTarget));
- return false;
- }
- var res = Object(__WEBPACK_IMPORTED_MODULE_16__NetscriptWorker_js__["d" /* killWorkerScript */])(runningScriptObj, server.ip);
- if (res) {
- workerScript.scriptRef.log("Killing " + filename + " on " + server.hostname + " with args: " + Object(__WEBPACK_IMPORTED_MODULE_20__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_20__utils_HelperFunctions_js__["f" /* printArray */])(argsForKillTarget));
- return false;
- }
- },
- killall : function(ip){
- if (ip === undefined) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "killall() call has incorrect number of arguments. Takes 1 argument");
- }
- var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* 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_16__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,ip){
- if (scriptname === undefined || ip === undefined) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "scp() call has incorrect number of arguments. Takes 2 arguments");
- }
- var destServer = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(ip);
- if (destServer == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Invalid hostname/ip passed into scp() command: " + ip);
- }
-
- var currServ = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(workerScript.serverIp);
- if (currServ == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Could not find server ip for this script. This is a bug please contact game developer");
- }
-
- 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_10__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;
- },
- hasRootAccess : function(ip){
- if (ip===undefined){
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "hasRootAccess() call has incorrect number of arguments. Takes 1 argument");
- }
- var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "hasRootAccess() failed. Invalid IP or hostname passed in: " + ip);
- }
- return server.hasAdminRights;
- },
- getHostname : function(){
- var scriptServer = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(workerScript.serverIp);
- if (scriptServer == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_9__Player_js__["a" /* Player */].updateSkillLevels();
- workerScript.scriptRef.log("getHackingLevel() returned " + __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hacking_skill);
- return __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hacking_skill;
- },
- getServerMoneyAvailable : function(ip){
- var server = Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["e" /* getServer */])(ip);
- if (server == null) {
- workerScript.scriptRef.log("Cannot getServerMoneyAvailable(). Invalid IP or hostname passed in: " + ip);
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot getServerMoneyAvailable(). 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_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].money.toNumber(), 2));
- return __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].money.toNumber();
- }
- workerScript.scriptRef.log("getServerMoneyAvailable() returned " + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.moneyAvailable, 2) + " for " + server.hostname);
- return server.moneyAvailable;
- },
- getServerSecurityLevel : function(ip){
- var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getServerSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
- }
- workerScript.scriptRef.log("getServerSecurityLevel() returned " + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.hackDifficulty, 3) + " for " + server.hostname);
- return server.hackDifficulty;
- },
- getServerBaseSecurityLevel : function(ip){
- var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getServerBaseSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
- }
- workerScript.scriptRef.log("getServerBaseSecurityLevel() returned " + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.baseDifficulty, 3) + " for " + server.hostname);
- return server.baseDifficulty;
- },
- getServerRequiredHackingLevel : function(ip){
- var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getServerRequiredHackingLevel() failed. Invalid IP or hostname passed in: " + ip);
- }
- workerScript.scriptRef.log("getServerRequiredHackingLevel returned " + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.requiredHackingSkill, 0) + " for " + server.hostname);
- return server.requiredHackingSkill;
- },
- getServerMaxMoney : function(ip){
- var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getServerMaxMoney() failed. Invalid IP or hostname passed in: " + ip);
- }
- workerScript.scriptRef.log("getServerMaxMoney() returned " + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.moneyMax, 0) + " for " + server.hostname);
- return server.moneyMax;
- },
- getServerGrowth : function(ip) {
- var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getServerGrowth() failed. Invalid IP or hostname passed in: " + ip);
- }
- workerScript.scriptRef.log("getServerGrowth() returned " + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.serverGrowth, 0) + " for " + server.hostname);
- return server.serverGrowth;
- },
- getServerNumPortsRequired : function(ip){
- var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getServerNumPortsRequired() failed. Invalid IP or hostname passed in: " + ip);
- }
- workerScript.scriptRef.log("getServerNumPortsRequired() returned " + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.numOpenPortsRequired, 0) + " for " + server.hostname);
- return server.numOpenPortsRequired;
- },
- getServerRam : function(ip) {
- var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getServerRam() failed. Invalid IP or hostname passed in: " + ip);
- }
- workerScript.scriptRef.log("getServerRam() returned [" + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.maxRam, 2) + "GB, " + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.ramUsed, 2) + "GB]");
- return [server.maxRam, server.ramUsed];
- },
- fileExists : function(filename,ip=workerScript.serverIp){
- if (filename === undefined) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "fileExists() call has incorrect number of arguments. Usage: fileExists(scriptname, [server])");
- }
- var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* 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;
- }
- }
- return false;
- },
- isRunning : function(filename,ip){
- if (filename === undefined || ip === undefined) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "isRunning() call has incorrect number of arguments. Usage: isRunning(scriptname, server, [arg1], [arg2]...)");
- }
- var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* 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_10__Script_js__["d" /* findRunningScript */])(filename, argsForTargetScript, server) != null);
- },
- getNextHacknetNodeCost : __WEBPACK_IMPORTED_MODULE_7__HacknetNode_js__["b" /* getCostOfNextHacknetNode */],
- purchaseHacknetNode : __WEBPACK_IMPORTED_MODULE_7__HacknetNode_js__["d" /* purchaseHacknet */],
- getStockPrice : function(symbol) {
- if (!__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hasTixApiAccess) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use getStockPrice()");
- }
- var stock = __WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["b" /* SymbolToStockMap */][symbol];
- if (stock == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Invalid stock symbol passed into getStockPrice()");
- }
- return parseFloat(stock.price.toFixed(3));
- },
- getStockPosition : function(symbol) {
- if (!__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hasTixApiAccess) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use getStockPosition()");
- }
- var stock = __WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["b" /* SymbolToStockMap */][symbol];
- if (stock == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Invalid stock symbol passed into getStockPrice()");
- }
- return [stock.playerShares, stock.playerAvgPx];
- },
- buyStock : function(symbol, shares) {
- if (!__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hasTixApiAccess) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use buyStock()");
- }
- var stock = __WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["b" /* SymbolToStockMap */][symbol];
- if (stock == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Invalid stock symbol passed into getStockPrice()");
- }
- if (shares == 0) {return false;}
- if (stock == null || shares < 0 || isNaN(shares)) {
- workerScript.scriptRef.log("Error: Invalid 'shares' argument passed to buyStock()");
- return false;
- }
- shares = Math.round(shares);
-
- var totalPrice = stock.price * shares;
- if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].money.lt(totalPrice + __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].StockMarketCommission)) {
- workerScript.scriptRef.log("Not enough money to purchase " + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(shares, 0) + " shares of " +
- symbol + ". Need $" +
- Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(totalPrice + __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].StockMarketCommission, 2).toString());
- return false;
- }
-
- var origTotal = stock.playerShares * stock.playerAvgPx;
- __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].loseMoney(totalPrice + __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].StockMarketCommission);
- var newTotal = origTotal + totalPrice;
- stock.playerShares += shares;
- stock.playerAvgPx = newTotal / stock.playerShares;
- if (__WEBPACK_IMPORTED_MODULE_5__engine_js__["Engine"].currentPage == __WEBPACK_IMPORTED_MODULE_5__engine_js__["Engine"].Page.StockMarket) {
- Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["j" /* updateStockPlayerPosition */])(stock);
- }
- workerScript.scriptRef.log("Bought " + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(shares, 0) + " shares of " + stock.symbol + " at $" +
- Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(stock.price, 2) + " per share");
- return true;
- },
- sellStock : function(symbol, shares) {
- if (!__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].hasTixApiAccess) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use sellStock()");
- }
- var stock = __WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["b" /* SymbolToStockMap */][symbol];
- if (stock == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Invalid stock symbol passed into getStockPrice()");
- }
- if (shares == 0) {return false;}
- if (stock == null || shares < 0 || isNaN(shares)) {
- workerScript.scriptRef.log("Error: Invalid 'shares' argument passed to sellStock()");
- return false;
- }
- if (shares > stock.playerShares) {shares = stock.playerShares;}
- if (shares == 0) {return false;}
- var gains = stock.price * shares - __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].StockMarketCommission;
- __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].gainMoney(gains);
-
- //Calculate net profit and add to script stats
- var netProfit = ((stock.price - stock.playerAvgPx) * shares) - __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].StockMarketCommission;
- if (isNaN(netProfit)) {netProfit = 0;}
- workerScript.scriptRef.onlineMoneyMade += netProfit;
-
- stock.playerShares -= shares;
- if (stock.playerShares == 0) {
- stock.playerAvgPx = 0;
- }
- if (__WEBPACK_IMPORTED_MODULE_5__engine_js__["Engine"].currentPage == __WEBPACK_IMPORTED_MODULE_5__engine_js__["Engine"].Page.StockMarket) {
- Object(__WEBPACK_IMPORTED_MODULE_14__StockMarket_js__["j" /* updateStockPlayerPosition */])(stock);
- }
- workerScript.scriptRef.log("Sold " + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(shares, 0) + " shares of " + stock.symbol + " at $" +
- Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(stock.price, 2) + " per share. Gained " +
- "$" + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(gains, 2));
- return true;
- },
- 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_9__Player_js__["a" /* Player */].purchasedServers.length >= __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].PurchasedServerLimit) {
- workerScript.scriptRef.log("Error: You have reached the maximum limit of " + __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].PurchasedServerLimit +
- " servers. You cannot purchase any more.");
- return "";
- }
-
- ram = Math.round(ram);
- if (isNaN(ram) || !Object(__WEBPACK_IMPORTED_MODULE_20__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_2__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer;
- if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].money.lt(cost)) {
- workerScript.scriptRef.log("Error: Not enough money to purchase server. Need $" + Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["c" /* formatNumber */])(cost, 2));
- return "";
- }
- var newServ = new __WEBPACK_IMPORTED_MODULE_11__Server_js__["d" /* Server */](Object(__WEBPACK_IMPORTED_MODULE_21__utils_IPAddress_js__["a" /* createRandomIp */])(), hostnameStr, "", false, true, true, ram);
- Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["a" /* AddToAllServers */])(newServ);
-
- __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].purchasedServers.push(newServ.ip);
- var homeComputer = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].getHomeComputer();
- homeComputer.serversOnNetwork.push(newServ.ip);
- newServ.serversOnNetwork.push(homeComputer.ip);
- __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].loseMoney(cost);
- workerScript.scriptRef.log("Purchased new server with hostname " + newServ.hostname + " for $" + Object(__WEBPACK_IMPORTED_MODULE_22__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_11__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_9__Player_js__["a" /* Player */].purchasedServers.length; ++i) {
- if (ip == __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].purchasedServers[i]) {
- found = true;
- __WEBPACK_IMPORTED_MODULE_9__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_11__Server_js__["b" /* AllServers */][ip];
-
- //Delete from home computer
- found = false;
- var homeComputer = __WEBPACK_IMPORTED_MODULE_9__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;
- },
- round : function(n) {
- if (isNaN(n)) {return 0;}
- return Math.round(n);
- },
- write : function(port, data="") {
- if (!isNaN(port)) {
- //Port 1-10
- if (port < 1 || port > 10) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_16__NetscriptWorker_js__["a" /* NetscriptPorts */][portName];
- if (port == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Could not find port: " + port + ". This is a bug contact the game developer");
- }
- port.push(data);
- if (port.length > __WEBPACK_IMPORTED_MODULE_12__Settings_js__["a" /* Settings */].MaxPortCapacity) {
- port.shift();
- return true;
- }
- return false;
- } else {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Invalid argument passed in for port: " + port + ". Must be a number between 1 and 10");
- }
- },
- read : function(port) {
- if (!isNaN(port)) {
- //Port 1-10
- if (port < 1 || port > 10) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_16__NetscriptWorker_js__["a" /* NetscriptPorts */][portName];
- if (port == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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 {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_11__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_17__NetscriptEvaluator_js__["c" /* 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_11__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_17__NetscriptEvaluator_js__["c" /* 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_16__NetscriptWorker_js__["d" /* killWorkerScript */])(server.runningScripts[i], server.ip);
- suc = true;
- }
- }
- return suc;
- },
- getScriptRam : function (scriptname, ip) {
- var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* 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_11__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getHackTime() failed. Invalid IP or hostname passed in: " + ip);
- }
- return Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["i" /* scriptCalculateHackingTime */])(server); //Returns seconds
- },
- getGrowTime : function(ip) {
- var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getGrowTime() failed. Invalid IP or hostname passed in: " + ip);
- }
- return Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["g" /* scriptCalculateGrowTime */])(server) / 1000; //Returns seconds
- },
- getWeakenTime : function(ip) {
- var server = Object(__WEBPACK_IMPORTED_MODULE_11__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_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getWeakenTime() failed. Invalid IP or hostname passed in: " + ip);
- }
- return Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["k" /* scriptCalculateWeakenTime */])(server) / 1000; //Returns seconds
- },
-
- /* Singularity Functions */
- universityCourse(universityName, className) {
- if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 1)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run universityCourse(). It is a Singularity Function and requires SourceFile-4 (level 1) to run.");
- return false;
- }
- }
- if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].isWorking) {
- var txt = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].singularityStopWork();
- workerScript.scriptRef.log(txt);
- }
-
- var costMult, expMult;
- switch(universityName.toLowerCase()) {
- case __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].AevumSummitUniversity.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_8__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;
- }
- costMult = 4;
- expMult = 3;
- break;
- case __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].Sector12RothmanUniversity.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_8__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;
- }
- costMult = 3;
- expMult = 2;
- break;
- case __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].VolhavenZBInstituteOfTechnology.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_8__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;
- }
- 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_2__Constants_js__["a" /* CONSTANTS */].ClassStudyComputerScience;
- break;
- case "Data Structures".toLowerCase():
- task = __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassDataStructures;
- break;
- case "Networks".toLowerCase():
- task = __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassNetworks;
- break;
- case "Algorithms".toLowerCase():
- task = __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassAlgorithms;
- break;
- case "Management".toLowerCase():
- task = __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassManagement;
- break;
- case "Leadership".toLowerCase():
- task = __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassLeadership;
- break;
- default:
- workerScript.scriptRef.log("Invalid class name: " + className + ". universityCourse() failed");
- return false;
- }
- __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].startClass(costMult, expMult, task);
- workerScript.scriptRef.log("Started " + task + " at " + universityName);
- return true;
- },
-
- gymWorkout(gymName, stat) {
- if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 1)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run gymWorkout(). It is a Singularity Function and requires SourceFile-4 (level 1) to run.");
- return false;
- }
- }
- if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].isWorking) {
- var txt = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].singularityStopWork();
- workerScript.scriptRef.log(txt);
- }
- var costMult, expMult;
- switch(gymName.toLowerCase()) {
- case __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].AevumCrushFitnessGym.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_8__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;
- }
- costMult = 2;
- expMult = 1.5;
- break;
- case __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].AevumSnapFitnessGym.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_8__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;
- }
- costMult = 6;
- expMult = 4;
- break;
- case __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].Sector12IronGym.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_8__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;
- }
- costMult = 1;
- expMult = 1;
- break;
- case __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].Sector12PowerhouseGym.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_8__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;
- }
- costMult = 10;
- expMult = 7.5;
- break;
- case __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].VolhavenMilleniumFitnessGym:
- if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_8__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;
- }
- 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_9__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassGymStrength);
- break;
- case "defense".toLowerCase():
- case "def".toLowerCase():
- __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassGymDefense);
- break;
- case "dexterity".toLowerCase():
- case "dex".toLowerCase():
- __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].ClassGymDexterity);
- break;
- case "agility".toLowerCase():
- case "agi".toLowerCase():
- __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_2__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_9__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 1)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_8__Location_js__["a" /* Locations */].Aevum:
- case __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].Chongqing:
- case __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].Sector12:
- case __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].NewTokyo:
- case __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].Ishima:
- case __WEBPACK_IMPORTED_MODULE_8__Location_js__["a" /* Locations */].Volhaven:
- __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].loseMoney(200000);
- __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].city = cityname;
- 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_9__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 1)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run purchaseTor(). It is a Singularity Function and requires SourceFile-4 (level 1) to run.");
- return false;
- }
- }
-
- if (__WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["a" /* SpecialServerIps */]["Darkweb Server"] != null) {
- workerScript.scriptRef.log("You already have a TOR router! purchaseTor() failed");
- return false;
- }
-
- if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].money.lt(__WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].TorRouterCost)) {
- workerScript.scriptRef.log("ERROR: You cannot afford to purchase a Tor router. purchaseTor() failed");
- return false;
- }
- __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].loseMoney(__WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].TorRouterCost);
-
- var darkweb = new __WEBPACK_IMPORTED_MODULE_11__Server_js__["d" /* Server */](Object(__WEBPACK_IMPORTED_MODULE_21__utils_IPAddress_js__["a" /* createRandomIp */])(), "darkweb", "", false, false, false, 1);
- Object(__WEBPACK_IMPORTED_MODULE_11__Server_js__["a" /* AddToAllServers */])(darkweb);
- __WEBPACK_IMPORTED_MODULE_13__SpecialServerIps_js__["a" /* SpecialServerIps */].addIp("Darkweb Server", darkweb.ip);
-
- document.getElementById("location-purchase-tor").setAttribute("class", "a-link-button-inactive");
-
- __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].getHomeComputer().serversOnNetwork.push(darkweb.ip);
- darkweb.serversOnNetwork.push(__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].getHomeComputer().ip);
- workerScript.scriptRef.log("You have purchased a Tor router!");
- return true;
- },
- purchaseProgram(programName) {
- if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 1)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run purchaseProgram(). It is a Singularity Function and requires SourceFile-4 (level 1) to run.");
- return false;
- }
- }
-
- if (__WEBPACK_IMPORTED_MODULE_13__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_3__CreateProgram_js__["a" /* Programs */].BruteSSHProgram.toLowerCase():
- var price = Object(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["a" /* DarkWebItems */].BruteSSHProgram);
- if (price > 0 && __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].money.gt(price)) {
- __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].loseMoney(price);
- __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_3__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 true;
- case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].FTPCrackProgram.toLowerCase():
- var price = Object(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["a" /* DarkWebItems */].FTPCrackProgram);
- if (price > 0 && __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].money.gt(price)) {
- __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].loseMoney(price);
- __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_3__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 " + itemName);
- }
- return true;
- case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram.toLowerCase():
- var price = Object(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["a" /* DarkWebItems */].RelaySMTPProgram);
- if (price > 0 && __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].money.gt(price)) {
- __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].loseMoney(price);
- __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_3__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 " + itemName);
- }
- return true;
- case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].HTTPWormProgram.toLowerCase():
- var price = Object(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["a" /* DarkWebItems */].HTTPWormProgram);
- if (price > 0 && __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].money.gt(price)) {
- __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].loseMoney(price);
- __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_3__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 " + itemName);
- }
- return true;
- case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].SQLInjectProgram.toLowerCase():
- var price = Object(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["a" /* DarkWebItems */].SQLInjectProgram);
- if (price > 0 && __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].money.gt(price)) {
- __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].loseMoney(price);
- __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_3__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 " + itemName);
- }
- return true;
- case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].DeepscanV1.toLowerCase():
- var price = Object(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["a" /* DarkWebItems */].DeepScanV1Program);
- if (price > 0 && __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].money.gt(price)) {
- __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].loseMoney(price);
- __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_3__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 " + itemName);
- }
- return true;
- case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].DeepscanV2.toLowerCase():
- var price = Object(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_4__DarkWeb_js__["a" /* DarkWebItems */].DeepScanV2Program);
- if (price > 0 && __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].money.gt(price)) {
- __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].loseMoney(price);
- __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_3__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 " + itemName);
- }
- return true;
- default:
- workerScript.scriptRef.log("ERROR: Invalid program passed into purchaseProgram().");
- return false;
- }
- return true;
- },
- upgradeHomeRam() {
- if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 2)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_9__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_2__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamHome;
- var mult = Math.pow(1.55, numUpgrades);
- cost = cost * mult;
-
- if (__WEBPACK_IMPORTED_MODULE_9__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_9__Player_js__["a" /* Player */].getHomeComputer();
- homeComputer.maxRam *= 2;
-
- __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].loseMoney(cost);
-
- workerScript.scriptRef.log("Purchased additional RAM for home computer! It now has " + homeComputer.maxRam + "GB of RAM.");
- return true;
- },
- getUpgradeHomeRamCost() {
- if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 2)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_9__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_2__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamHome;
- var mult = Math.pow(1.55, numUpgrades);
- return cost * mult;
- },
- workForCompany() {
- if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 2)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run workForCompany(). It is a Singularity Function and requires SourceFile-4 (level 2) to run.");
- return false;
- }
- }
-
- if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].companyPosition == "" || !(__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].companyPosition instanceof __WEBPACK_IMPORTED_MODULE_1__Company_js__["c" /* CompanyPosition */])) {
- workerScript.scriptRef.log("ERROR: workForCompany() failed because you do not have a job");
- return false;
- }
-
- if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].isWorking) {
- var txt = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].singularityStopWork();
- workerScript.scriptRef.log(txt);
- }
-
- if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].companyPosition.isPartTimeJob()) {
- __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].startWorkPartTime();
- } else {
- __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].startWork();
- }
- workerScript.scriptRef.log("Began working at " + __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].companyName + " as a " + __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].companyPosition.positionName);
- return true;
- },
- applyToCompany(companyName, field) {
- if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 2)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_1__Company_js__["e" /* companyExists */])(companyName)) {
- workerScript.scriptRef.log("ERROR: applyToCompany() failed because specified company " + companyName + " does not exist.");
- return false;
- }
-
- __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].location = companyName;
- var res;
- switch (field.toLowerCase()) {
- case "software":
- res = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].applyForSoftwareJob(true);
- break;
- case "software consultant":
- res = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].applyForSoftwareConsultantJob(true);
- break;
- case "it":
- res = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].applyForItJob(true);
- break;
- case "security engineer":
- res = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].applyForSecurityEngineerJob(true);
- break;
- case "network engineer":
- res = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].applyForNetworkEngineerJob(true);
- break;
- case "business":
- res = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].applyForBusinessJob(true);
- break;
- case "business consultant":
- res = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].applyForBusinessConsultantJob(true);
- break;
- case "security":
- res = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].applyForSecurityJob(true);
- break;
- case "agent":
- res = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].applyForAgentJob(true);
- break;
- case "employee":
- res = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].applyForEmployeeJob(true);
- break;
- case "part-time employee":
- res = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].applyForPartTimeEmployeeJob(true);
- break;
- case "waiter":
- res = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].applyForWaiterJob(true);
- break;
- case "part-time waiter":
- res = __WEBPACK_IMPORTED_MODULE_9__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_22__utils_StringHelperFunctions_js__["e" /* 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_9__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_9__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 2)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_1__Company_js__["a" /* Companies */][companyName];
- if (company === null || !(company instanceof __WEBPACK_IMPORTED_MODULE_1__Company_js__["b" /* Company */])) {
- workerScript.scriptRef.log("ERROR: Invalid companyName passed into getCompanyRep(): " + companyName);
- return -1;
- }
- return company.playerReputation;
- },
- checkFactionInvitations() {
- if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 2)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_9__Player_js__["a" /* Player */].factionInvitations.slice();
- },
- joinFaction(name) {
- if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 2)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_6__Faction_js__["d" /* factionExists */])(name)) {
- workerScript.scriptRef.log("ERROR: Faction specified in joinFaction() does not exist.");
- return false;
- }
-
- if (!__WEBPACK_IMPORTED_MODULE_9__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_9__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_9__Player_js__["a" /* Player */].factionInvitations.splice(index, 1);
- var fac = __WEBPACK_IMPORTED_MODULE_6__Faction_js__["b" /* Factions */][name];
- Object(__WEBPACK_IMPORTED_MODULE_6__Faction_js__["h" /* joinFaction */])(fac);
- workerScript.scriptRef.log("Joined the " + name + " faction.");
- return true;
- },
- workForFaction(name, type) {
- if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 2)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run workForFaction(). It is a Singularity Function and requires SourceFile-4 (level 2) to run.");
- return false;
- }
- }
-
- if (!Object(__WEBPACK_IMPORTED_MODULE_6__Faction_js__["d" /* factionExists */])(name)) {
- workerScript.scriptRef.log("ERROR: Faction specified in workForFaction() does not exist.");
- return false;
- }
-
- if (!__WEBPACK_IMPORTED_MODULE_9__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_9__Player_js__["a" /* Player */].isWorking) {
- var txt = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].singularityStopWork();
- workerScript.scriptRef.log(txt);
- }
-
- var fac = __WEBPACK_IMPORTED_MODULE_6__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_9__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_9__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_9__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_9__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 2)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_6__Faction_js__["d" /* factionExists */])(name)) {
- workerScript.scriptRef.log("ERROR: Faction specified in getFactionRep() does not exist.");
- return -1;
- }
-
- return __WEBPACK_IMPORTED_MODULE_6__Faction_js__["b" /* Factions */][name].playerReputation;
- },
- createProgram(name) {
- if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 3)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run createProgram(). It is a Singularity Function and requires SourceFile-4 (level 3) to run.");
- return false;
- }
- }
-
- if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].isWorking) {
- var txt = __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].singularityStopWork();
- workerScript.scriptRef.log(txt);
- }
-
- switch(name.toLowerCase()) {
- case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].NukeProgram.toLowerCase():
- __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].NukeProgram, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].MillisecondsPerFiveMinutes, 1);
- break;
- case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].BruteSSHProgram.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_9__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_9__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].BruteSSHProgram, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].MillisecondsPerFiveMinutes * 2, 50);
- break;
- case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].FTPCrackProgram.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_9__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_9__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].FTPCrackProgram, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].MillisecondsPerHalfHour, 100);
- break;
- case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_9__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_9__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].MillisecondsPer2Hours, 250);
- break;
- case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].HTTPWormProgram.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_9__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_9__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].HTTPWormProgram, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].MillisecondsPer4Hours, 500);
- break;
- case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].SQLInjectProgram.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_9__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_9__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].SQLInjectProgram, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].MillisecondsPer8Hours, 750);
- break;
- case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].DeepscanV1.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_9__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_9__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].DeepscanV1, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].MillisecondsPerQuarterHour, 75);
- break;
- case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].DeepscanV2.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_9__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_9__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].DeepscanV2, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].MillisecondsPer2Hours, 400);
- break;
- case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].ServerProfiler.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_9__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_9__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].ServerProfiler, __WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].MillisecondsPerHalfHour, 75);
- break;
- case __WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].AutoLink.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_9__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_9__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_3__CreateProgram_js__["a" /* Programs */].AutoLink, __WEBPACK_IMPORTED_MODULE_2__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;
- },
- getAugmentationCost(name) {
- if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 3)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_0__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_0__Augmentations_js__["c" /* Augmentations */][name];
- return [aug.baseRepRequirement, aug.baseCost];
- },
- purchaseAugmentation(faction, name) {
- if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 3)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* 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_6__Faction_js__["b" /* Factions */][faction];
- if (fac === null || !(fac instanceof __WEBPACK_IMPORTED_MODULE_6__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_0__Augmentations_js__["c" /* Augmentations */][name];
- if (aug === null || !(aug instanceof __WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["a" /* Augmentation */])) {
- workerScript.scriptRef.log("ERROR: purchaseAugmentation() failed because of invalid augmentation name: " + name);
- return false;
- }
-
- for (var j = 0; j < __WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].queuedAugmentations.length; ++j) {
- if (__WEBPACK_IMPORTED_MODULE_9__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_9__Player_js__["a" /* Player */].augmentations.length; ++j) {
- if (__WEBPACK_IMPORTED_MODULE_9__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_6__Faction_js__["k" /* purchaseAugmentation */])(aug, fac, true);
- workerScript.scriptRef.log(res);
- if (Object(__WEBPACK_IMPORTED_MODULE_22__utils_StringHelperFunctions_js__["e" /* isString */])(res) && res.startsWith("You purchased")) {
- return true;
- } else {
- return false;
- }
- },
- installAugmentations() {
- if (__WEBPACK_IMPORTED_MODULE_9__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 3)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_17__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot run installAugmentations(). It is a Singularity Function and requires SourceFile-4 (level 3) to run.");
- return false;
- }
- }
-
- if (__WEBPACK_IMPORTED_MODULE_9__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;
- }
- workerScript.scriptRef.log("Installing Augmentations. This will cause this script to be killed");
- Object(__WEBPACK_IMPORTED_MODULE_0__Augmentations_js__["h" /* installAugmentations */])();
- return true;
- }
- }
-}
-
-
-
-
-/***/ }),
-/* 40 */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return commitShopliftCrime; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return commitRobStoreCrime; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return commitMugCrime; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return commitLarcenyCrime; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return commitDealDrugsCrime; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return commitTraffickArmsCrime; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return commitHomicideCrime; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return commitGrandTheftAutoCrime; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return commitKidnapCrime; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return commitAssassinationCrime; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return commitHeistCrime; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "w", function() { return determineCrimeSuccess; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "u", function() { return determineCrimeChanceShoplift; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return determineCrimeChanceRobStore; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return determineCrimeChanceMug; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return determineCrimeChanceLarceny; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return determineCrimeChanceDealDrugs; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "v", function() { return determineCrimeChanceTraffickArms; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return determineCrimeChanceHomicide; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return determineCrimeChanceGrandTheftAuto; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return determineCrimeChanceKidnap; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return determineCrimeChanceAssassination; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return determineCrimeChanceHeist; });
-/* 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__utils_DialogBox_js__ = __webpack_require__(2);
-
-
-
-
-/* Crimes.js */
-function commitShopliftCrime() {
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeShoplift;
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(0, 0, 0, 2, 2, 0, 15000, 2000); //$7500/s, 1 exp/s
-}
-
-function commitRobStoreCrime() {
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeRobStore;
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(30, 0, 0, 45, 45, 0, 400000, 60000); //$6666,6/2, 0.5exp/s, 0.75exp/s
-}
-
-function commitMugCrime() {
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeMug;
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(0, 3, 3, 3, 3, 0, 36000, 4000); //$9000/s, .66 exp/s
-}
-
-function commitLarcenyCrime() {
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeLarceny;
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(45, 0, 0, 60, 60, 0, 800000, 90000) // $8888.88/s, .5 exp/s, .66 exp/s
-}
-
-function commitDealDrugsCrime() {
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeDrugs;
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(0, 0, 0, 5, 5, 10, 120000, 10000); //$12000/s, .5 exp/s, 1 exp/s
-}
-
-function commitTraffickArmsCrime() {
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeTraffickArms;
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(0, 20, 20, 20, 20, 40, 600000, 40000); //$15000/s, .5 combat exp/s, 1 cha exp/s
-}
-
-function commitHomicideCrime() {
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeHomicide;
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(0, 2, 2, 2, 2, 0, 45000, 3000); //$15000/s, 0.66 combat exp/s
-}
-
-function commitGrandTheftAutoCrime() {
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeGrandTheftAuto;
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(0, 20, 20, 20, 80, 40, 1600000, 80000); //$20000/s, .25 exp/s, 1 exp/s, .5 exp/s
-}
-
-function commitKidnapCrime() {
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeKidnap;
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(0, 80, 80, 80, 80, 80, 3600000, 120000); //$30000/s. .66 exp/s
-}
-
-function commitAssassinationCrime() {
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeAssassination;
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(0, 300, 300, 300, 300, 0, 12000000, 300000); //$40000/s, 1 exp/s
-}
-
-function commitHeistCrime() {
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crimeType = __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeHeist;
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].startCrime(450, 450, 450, 450, 450, 450, 120000000, 600000); //$200000/s, .75exp/s
-}
-
-function determineCrimeSuccess(crime, moneyGained) {
- var chance = 0;
- switch (crime) {
- case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeShoplift:
- chance = determineCrimeChanceShoplift();
- break;
- case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeRobStore:
- chance = determineCrimeChanceRobStore();
- break;
- case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeMug:
- chance = determineCrimeChanceMug();
- break;
- case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeLarceny:
- chance = determineCrimeChanceLarceny();
- break;
- case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeDrugs:
- chance = determineCrimeChanceDealDrugs();
- break;
- case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeTraffickArms:
- chance = determineCrimeChanceTraffickArms();
- break;
- case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeHomicide:
- chance = determineCrimeChanceHomicide();
- break;
- case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeGrandTheftAuto:
- chance = determineCrimeChanceGrandTheftAuto();
- break;
- case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeKidnap:
- chance = determineCrimeChanceKidnap();
- break;
- case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeAssassination:
- chance = determineCrimeChanceAssassination();
- break;
- case __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].CrimeHeist:
- chance = determineCrimeChanceHeist();
- break;
- default:
- console.log(crime);
- Object(__WEBPACK_IMPORTED_MODULE_2__utils_DialogBox_js__["a" /* dialogBoxCreate */])("ERR: Unrecognized crime type. This is probably a bug please contact the developer");
- return;
- }
-
- if (Math.random() <= chance) {
- //Success
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].gainMoney(moneyGained);
- return true;
- } else {
- //Failure
- return false;
- }
-}
-
-function determineCrimeChanceShoplift() {
- var chance = ((__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel)) * 20;
- chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult;
- return Math.min(chance, 1);
-}
-
-function determineCrimeChanceRobStore() {
- var chance = ((0.5 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].hacking_skill / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
- 2 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
- 1 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel)) * 5;
- chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult;
- return Math.min(chance, 1);
-}
-
-function determineCrimeChanceMug() {
- var chance = ((1.5 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].strength / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
- 0.5 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].defense / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
- 1.5 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
- 0.5 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel)) * 5;
- chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult;
- return Math.min(chance, 1);
-}
-
-function determineCrimeChanceLarceny() {
- var chance = ((0.5 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].hacking_skill / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel)) * 3;
- chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult;
- return Math.min(chance, 1);
-}
-
-function determineCrimeChanceDealDrugs() {
- var chance = ((3*__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].charisma / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
- 2*__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel));
- chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult;
- return Math.min(chance, 1);
-}
-
-function determineCrimeChanceTraffickArms() {
- var chance = ((__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].charisma / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].strength / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].defense / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel)) / 2;
- chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult;
- return Math.min(chance, 1);
-}
-
-function determineCrimeChanceHomicide() {
- var chance = ((2 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].strength / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
- 2 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].defense / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
- 0.5 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
- 0.5 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel));
- chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult;
- return Math.min(chance, 1);
-}
-
-function determineCrimeChanceGrandTheftAuto() {
- var chance = ((__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].hacking_skill / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].strength / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
- 4 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
- 2 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
- 2 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].charisma / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel)) / 8;
- chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult;
- return Math.min(chance, 1);
-}
-
-function determineCrimeChanceKidnap() {
- var chance = ((__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].charisma / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].strength / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel)) / 5;
- chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult;
- return Math.min(chance, 1);
-}
-
-function determineCrimeChanceAssassination() {
- var chance = ((__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].strength / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
- 2 * __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel)) / 8;
- chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult;
- return Math.min(chance, 1);
-}
-
-function determineCrimeChanceHeist() {
- var chance = ((__WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].hacking_skill / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].strength / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].defense / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].dexterity / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].agility / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel +
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].charisma / __WEBPACK_IMPORTED_MODULE_0__Constants_js__["a" /* CONSTANTS */].MaxSkillLevel)) / 18;
- chance *= __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].crime_success_mult;
- return Math.min(chance, 1);
-}
-
-
-
-
-/***/ }),
-/* 41 */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Aliases; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return GlobalAliases; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return printAliases; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return parseAliasDeclaration; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return removeAlias; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return substituteAliases; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return loadAliases; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return loadGlobalAliases; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Terminal_js__ = __webpack_require__(20);
-
-
-let Aliases = {};
-let GlobalAliases = {};
-
-function loadAliases(saveString) {
- if (saveString === "") {
- Aliases = {};
- } else {
- Aliases = JSON.parse(saveString);
- }
-}
-
-function loadGlobalAliases(saveString) {
- if (saveString === "") {
- GlobalAliases = {};
- } else {
- GlobalAliases = JSON.parse(saveString);
- }
-}
-
-//Print all aliases to terminal
-function printAliases() {
- for (var name in Aliases) {
- if (Aliases.hasOwnProperty(name)) {
- Object(__WEBPACK_IMPORTED_MODULE_0__Terminal_js__["b" /* post */])("alias " + name + "=" + Aliases[name]);
- }
- }
- for (var name in GlobalAliases) {
- if (GlobalAliases.hasOwnProperty(name)) {
- Object(__WEBPACK_IMPORTED_MODULE_0__Terminal_js__["b" /* post */])("global alias " + name + "=" + GlobalAliases[name]);
- }
- }
-}
-
-//True if successful, false otherwise
-function parseAliasDeclaration(dec,global=false) {
- var re = /^([_|\w|!|%|,|@]+)="(.+)"$/;
- var matches = dec.match(re);
- if (matches == null || matches.length != 3) {return false;}
- if (global){
- addGlobalAlias(matches[1],matches[2]);
- } else {
- addAlias(matches[1], matches[2]);
- }
- return true;
-}
-
-function addAlias(name, value) {
- if (name in GlobalAliases){
- delete GlobalAliases[name];
- }
- Aliases[name] = value;
-}
-
-function addGlobalAlias(name, value) {
- if (name in Aliases){
- delete Aliases[name];
- }
- GlobalAliases[name] = value;
-}
-
-function getAlias(name) {
- if (Aliases.hasOwnProperty(name)) {
- return Aliases[name];
- }
- return null;
-}
-
-function getGlobalAlias(name) {
- if (GlobalAliases.hasOwnProperty(name)) {
- return GlobalAliases[name];
- }
- return null;
-}
-
-function removeAlias(name) {
- if (Aliases.hasOwnProperty(name)) {
- delete Aliases[name];
- return true;
- }
- if (GlobalAliases.hasOwnProperty(name)) {
- delete GlobalAliases[name];
- return true;
- }
- return false;
-}
-
-//Returns the original string with any aliases substituted in
-//Aliases only applied to "whole words", one level deep
-function substituteAliases(origCommand) {
- var commandArray = origCommand.split(" ");
- if (commandArray.length>0){
- var alias = getAlias(commandArray[0]);
- if (alias != null) {
- commandArray[0] = alias;
- } else {
- var alias = getGlobalAlias(commandArray[0]);
- if (alias != null) {
- commandArray[0] = alias;
- }
- }
- for (var i = 0; i < commandArray.length; ++i) {
- var alias = getGlobalAlias(commandArray[i]);
- if (alias != null) {
- commandArray[i] = alias;
- }
- }
- }
- return commandArray.join(" ");
-}
-
-
-
-
-/***/ }),
-/* 42 */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return checkIfConnectedToDarkweb; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return executeDarkwebTerminalCommand; });
-/* unused harmony export listAllDarkwebItems */
-/* unused harmony export buyDarkwebItem */
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return parseDarkwebItemPrice; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return DarkWebItems; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__ = __webpack_require__(14);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__SpecialServerIps_js__ = __webpack_require__(11);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Terminal_js__ = __webpack_require__(20);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_IPAddress_js__ = __webpack_require__(19);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__ = __webpack_require__(5);
-
-
-
-
-
-
-
-
-
-/* DarkWeb.js */
-//Posts a "help" message if connected to DarkWeb
-function checkIfConnectedToDarkweb() {
- if (__WEBPACK_IMPORTED_MODULE_2__SpecialServerIps_js__["a" /* SpecialServerIps */].hasOwnProperty("Darkweb Server")) {
- var darkwebIp = __WEBPACK_IMPORTED_MODULE_2__SpecialServerIps_js__["a" /* SpecialServerIps */]["Darkweb Server"];
- if (!Object(__WEBPACK_IMPORTED_MODULE_4__utils_IPAddress_js__["c" /* isValidIPAddress */])(darkwebIp)) {return;}
- if (darkwebIp == __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getCurrentServer().ip) {
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You are now connected to the dark web. From the dark web you can purchase illegal items. " +
- "Use the 'buy -l' command to display a list of all the items you can buy. Use 'buy [item-name] " +
- "to purchase an item");
- }
- }
-
-}
-
-//Handler for dark web commands. The terminal's executeCommand() function will pass
-//dark web-specific commands into this. It will pass in the raw split command array
-//rather than the command string
-function executeDarkwebTerminalCommand(commandArray) {
- if (commandArray.length == 0) {return;}
- switch (commandArray[0]) {
- case "buy":
- if (commandArray.length != 2) {
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Incorrect number of arguments. Usage: ");
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("buy -l");
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("buy [item name]");
- return;
- }
- var arg = commandArray[1];
- if (arg == "-l") {
- listAllDarkwebItems();
- } else {
- buyDarkwebItem(arg);
- }
- break;
- default:
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Command not found");
- break;
- }
-}
-
-function listAllDarkwebItems() {
- for (var item in DarkWebItems) {
- if (DarkWebItems.hasOwnProperty(item)) {
- var item = DarkWebItems[item];
- //Convert string using toLocaleString
- var split = item.split(" - ");
- if (split.length == 3 && split[1].charAt(0) == '$') {
- split[1] = split[1].slice(1);
- split[1] = split[1].replace(/,/g, '');
- var price = parseFloat(split[1]);
- if (isNaN(price)) {
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])(item);
- return;
- }
- price = Object(__WEBPACK_IMPORTED_MODULE_5__utils_StringHelperFunctions_js__["c" /* formatNumber */])(price, 0);
- split[1] = "$" + price.toString();
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])(split.join(" - "));
- } else {
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])(item);
- }
- }
- }
-
- var priceString = split[1];
- //Check for errors
- if (priceString.length == 0 || priceString.charAt(0) != '$') {
- return -1;
- }
- //Remove dollar sign and commas
- priceString = priceString.slice(1);
- priceString = priceString.replace(/,/g, '');
-
- //Convert string to numeric
- var price = parseFloat(priceString);
- if (isNaN(price)) {return -1;}
- else {return price;}
-}
-
-function buyDarkwebItem(itemName) {
- if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].BruteSSHProgram.toLowerCase()) {
- var price = parseDarkwebItemPrice(DarkWebItems.BruteSSHProgram);
- if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) {
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price);
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].BruteSSHProgram);
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the BruteSSH.exe program. The new program " +
- "can be found on your home computer.");
- } else {
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName);
- }
- } else if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].FTPCrackProgram.toLowerCase()) {
- var price = parseDarkwebItemPrice(DarkWebItems.FTPCrackProgram);
- if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) {
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price);
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].FTPCrackProgram);
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the FTPCrack.exe program. The new program " +
- "can be found on your home computer.");
- } else {
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName);
- }
- } else if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram.toLowerCase()) {
- var price = parseDarkwebItemPrice(DarkWebItems.RelaySMTPProgram);
- if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) {
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price);
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram);
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the relaySMTP.exe program. The new program " +
- "can be found on your home computer.");
- } else {
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName);
- }
- } else if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].HTTPWormProgram.toLowerCase()) {
- var price = parseDarkwebItemPrice(DarkWebItems.HTTPWormProgram);
- if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) {
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price);
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].HTTPWormProgram);
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the HTTPWorm.exe program. The new program " +
- "can be found on your home computer.");
- } else {
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName);
- }
- } else if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].SQLInjectProgram.toLowerCase()) {
- var price = parseDarkwebItemPrice(DarkWebItems.SQLInjectProgram);
- if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) {
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price);
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].SQLInjectProgram);
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the SQLInject.exe program. The new program " +
- "can be found on your home computer.");
- } else {
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName);
- }
- } else if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].DeepscanV1.toLowerCase()) {
- var price = parseDarkwebItemPrice(DarkWebItems.DeepScanV1Program);
- if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) {
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price);
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].DeepscanV1);
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the DeepscanV1.exe program. The new program " +
- "can be found on your home computer.");
- } else {
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName);
- }
- } else if (itemName.toLowerCase() == __WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].DeepscanV2.toLowerCase()) {
- var price = parseDarkwebItemPrice(DarkWebItems.DeepScanV2Program);
- if (price > 0 && __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].money.gt(price)) {
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].loseMoney(price);
- __WEBPACK_IMPORTED_MODULE_1__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_0__CreateProgram_js__["a" /* Programs */].DeepscanV2);
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("You have purchased the DeepscanV2.exe program. The new program " +
- "can be found on your home computer.");
- } else {
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Not enough money to purchase " + itemName);
- }
- } else {
- Object(__WEBPACK_IMPORTED_MODULE_3__Terminal_js__["b" /* post */])("Unrecognized item");
- }
-}
-
-function parseDarkwebItemPrice(itemDesc) {
- var split = itemDesc.split(" - ");
- if (split.length == 3) {
- var priceString = split[1];
- //Check for errors
- if (priceString.length == 0 || priceString.charAt(0) != '$') {
- return -1;
- }
- //Remove dollar sign and commas
- priceString = priceString.slice(1);
- priceString = priceString.replace(/,/g, '');
-
- //Convert string to numeric
- var price = parseFloat(priceString);
- if (isNaN(price)) {return -1;}
- else {return price;}
- } else {
- return -1;
- }
-}
-
-let DarkWebItems = {
- BruteSSHProgram: "BruteSSH.exe - $500,000 - Opens up SSH Ports",
- FTPCrackProgram: "FTPCrack.exe - $1,500,000 - Opens up FTP Ports",
- RelaySMTPProgram: "relaySMTP.exe - $5,000,000 - Opens up SMTP Ports",
- HTTPWormProgram: "HTTPWorm.exe - $30,000,000 - Opens up HTTP Ports",
- SQLInjectProgram: "SQLInject.exe - $250,000,000 - Opens up SQL Ports",
- DeepScanV1Program: "DeepscanV1.exe - $500,000 - Enables 'scan-analyze' with a depth up to 5",
- DeepScanV2Program: "DeepscanV2.exe - $25,000,000 - Enables 'scan-analyze' with a depth up to 10",
-}
-
-
-
-
-/***/ }),
-/* 43 */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* unused harmony export Literatures */
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return initLiterature; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return showLiterature; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_DialogBox_js__ = __webpack_require__(2);
-
-
-/* Literature.js
- * Lore / world building literature that can be found on servers
- */
-function Literature(title, filename, txt) {
- this.title = title;
- this.fn = filename;
- this.txt = txt;
-}
-
-function showLiterature(fn) {
- var litObj = Literatures[fn];
- if (litObj == null) {return;}
- var txt = litObj.title + "
" +
- "" + litObj.txt + "";
- Object(__WEBPACK_IMPORTED_MODULE_0__utils_DialogBox_js__["a" /* dialogBoxCreate */])(txt);
-}
-
-let Literatures = {}
-
-function initLiterature() {
- var title, fn, txt;
- title = "A Green Tomorrow";
- fn = "A-Green-Tomorrow.lit";
- txt = "Starting a few decades ago, there was a massive global movement towards the generation of renewable energy in an effort to " +
- "combat global warming and climate change. The shift towards renewable energy was a big success, or so it seemed. In 2045 " +
- "a staggering 80% of the world's energy came from non-renewable fossil fuels. Now, about three decades later, that " +
- "number is down to only 15%. Most of the world's energy now comes from nuclear power and renwable sources such as " +
- "solar and geothermal. Unfortunately, these efforts were not the huge success that they seem to be.
" +
- "Since 2045 primary energy use has soared almost tenfold. This was mainly due to growing urban populations and " +
- "the rise of increasingly advanced (and power-hungry) technology that has become ubiquitous in our lives. So, " +
- "despite the fact that the percentage of our energy that comes from fossil fuels has drastically decreased, " +
- "the total amount of energy we are producing from fossil fuels has actually increased.
" +
- "The grim effects of our species' irresponsible use of energy and neglect of our mother world have become increasingly apparent. " +
- "Last year a temperature of 190F was recorded in the Death Valley desert, which is over 50% higher than the highest " +
- "recorded temperature at the beginning of the century. In the last two decades numerous major cities such as Manhattan, Boston, and " +
- "Los Angeles have been partially or fully submerged by rising sea levels. In the present day, over 75% of the world's agriculture is " +
- "done in climate-controlled vertical farms, as most traditional farmland has become unusable due to severe climate conditions.
" +
- "Despite all of this, the greedy and corrupt corporations that rule the world have done nothing to address these problems that " +
- "threaten our species. And so it's up to us, the common people. Each and every one of us can make a difference by doing what " +
- "these corporations won't: taking responsibility. If we don't, pretty soon there won't be an Earth left to save. We are " +
- "the last hope for a green tomorrow.";
- Literatures[fn] = new Literature(title, fn, txt);
-
- title = "Alpha and Omega";
- fn = "alpha-omega.lit";
- txt = "Then we saw a new heaven and a new earth, for our first heaven and earth had gone away, and our sea was no more. " +
- "And we saw a new holy city, new Aeria, coming down out of this new heaven, prepared as a bride adorned for her husband. " +
- "And we heard a loud voice saying, 'Behold, the new dwelling place of the Gods. We will dwell with them, and they " +
- "will be our people, and we will be with them as their Gods. We will wipe away every tear from their eyes, and death " +
- "shall be no more, neither shall there be mourning, nor crying, nor pain anymore, for the former things " +
- "have passed away.'
" +
- "And once were were seated on the throne we said 'Behold, I am making all things new.' " +
- "Also we said, 'Write this down, for these words are trustworthy and true.' And we said to you, " +
- "'It is done! I am the Alpha and the Omega, the beginning and the end. To the thirsty I will give from the spring " +
- "of the water of life without payment. The one who conquers will have this heritage, and we will be his God and " +
- "he will be our son. But as for the cowardly, the faithless, the detestable, as for murderers, " +
- "the sexually immoral, sorcerers, idolaters, and all liars, their portion will be in the lake that " +
- "burns with fire and sulfur, for it is the second true death.'";
- Literatures[fn] = new Literature(title, fn, txt);
-
- title = "Are We Living in a Computer Simulation?";
- fn = "simulated-reality.lit";
- txt = "The idea that we are living in a virtual world is not new. It's a trope that has " +
- "been explored constantly in literature and pop culture. However, it is also a legitimate " +
- "scientific hypothesis that many notable physicists and philosophers have debated for years.
" +
- "Proponents for this simulated reality theory often point to how advanced our technology has become, " +
- "as well as the incredibly fast pace at which it has advanced over the past decades. The amount of computing " +
- "power available to us has increased over 100-fold since 2060 due to the development of nanoprocessors and " +
- "quantum computers. Artifical Intelligence has advanced to the point where our entire lives are controlled " +
- "by robots and machines that handle our day-to-day activities such as autonomous transportation and scheduling. " +
- "If we consider the pace at which this technology has advanced and assume that these developments continue, it's " +
- "reasonable to assume that at some point in the future our technology would be advanced enough that " +
- "we could create simulations that are indistinguishable from reality. However, if this is a reasonable outcome " +
- "of continued technological advancement, then it is very likely that such a scenario has already happened.
" +
- "Statistically speaking, somewhere out there in the infinite universe there is an advanced, intelligent species " +
- "that already has such technology. Who's to say that they haven't already created such a virtual reality: our own?";
- Literatures[fn] = new Literature(title, fn, txt);
-
- title = "Beyond Man";
- fn = "beyond-man.lit";
- txt = "Humanity entered a 'transhuman' era a long time ago. And despite the protests and criticisms of many who cried out against " +
- "human augmentation at the time, the transhuman movement continued and prospered. Proponents of the movement ignored the critics, " +
- "arguing that it was in our inherent nature to better ourselves. To improve. To be more than we were. They claimed that " +
- "not doing so would be to go against every living organism's biological purpose: evolution and survival of the fittest.
" +
- "And here we are today, with technology that is advanced enough to augment humans to a state that " +
- "can only be described as posthuman. But what do we have to show for it when this augmentation " +
- "technology is only available to the so-called 'elite'? Are we really better off than before when only 5% of the " +
- "world's population has access to this technology? When the powerful corporations and organizations of the world " +
- "keep it all to themselves, have we really evolved?
" +
- "Augmentation technology has only further increased the divide between the rich and the poor, between the powerful and " +
- "the oppressed. We have not become 'more than human'. We have not evolved from nature's original design. We are still the greedy, " +
- "corrupted, and evil men that we always were.";
- Literatures[fn] = new Literature(title, fn, txt);
-
-
- title = "Brighter than the Sun";
- fn = "brighter-than-the-sun.lit";
- txt = "When people think about the corporations that dominate the East, they typically think of KuaiGong International, which " +
- "holds a complete monopoly for manufacturing and commerce in Asia, or Global Pharmaceuticals, the world's largest " +
- "drug company, or OmniTek Incorporated, the global leader in intelligent and autonomous robots. But there's one company " +
- "that has seen a rapid rise in the last year and is poised to dominate not only the East, but the entire world: TaiYang Digital.
" +
- "TaiYang Digital is a Chinese internet-technology corporation that provides services such as " +
- "online advertising, search, gaming, media, entertainment, and cloud computing/storage. Its name TaiYang comes from the Chinese word " +
- "for 'sun'. In Chinese culture, the sun is a 'yang' symbol " +
- "associated with life, heat, masculinity, and heaven.
" +
- "The company was founded " +
- "less than 5 years ago and is already the third highest valued company in all of Asia. In 2076 it generated a total revenue of " +
- "over 10 trillion yuan. It's services are used daily by over a billion people worldwide.
" +
- "TaiYang Digital's meteoric rise is extremely surprising in modern society. This sort of growth is " +
- "something you'd commonly see in the first half of the century, especially for tech companies. However in " +
- "the last two decades the number of corporations has significantly declined as the largest entities " +
- "quickly took over the economy. Corporations such as ECorp, MegaCorp, and KuaiGong have established " +
- "such strong monopolies in their market sectors that they have effectively killed off all " +
- "of the smaller and new corporations that have tried to start up over the years. This is what makes " +
- "the rise of TaiYang Digital so impressive. And if TaiYang continues down this path, then they have " +
- "a bright future ahead of them.";
- Literatures[fn] = new Literature(title, fn, txt);
-
- title = "Democracy is Dead: The Fall of an Empire";
- fn = "democracy-is-dead.lit";
- txt = "They rose from the shadows in the street From the places where the oppressed meet " +
- "Their cries echoed loudly through the air As they once did in Tiananmen Square " +
- "Loudness in the silence, Darkness in the light They came forth with power and might " +
- "Once the beacon of democracy, America was first Its pillars of society destroyed and dispersed " +
- "Soon the cries rose everywhere, with revolt and riot Until one day, finally, all was quiet " +
- "From the ashes rose a new order, corporatocracy was its name " +
- "Rome, Mongol, Byzantine, all of history is just the same " +
- "For man will never change in a fundamental way " +
- "And now democracy is dead, in the USA";
- Literatures[fn] = new Literature(title, fn, txt);
-
- title = "Figures Show Rising Crime Rates in Sector-12";
- fn = "sector-12-crime.lit";
- txt = "A recent study by analytics company Wilson Inc. shows a significant rise " +
- "in criminal activity in Sector-12. Perhaps the most alarming part of the statistic " +
- "is that most of the rise is in violent crime such as homicide and assault. According " +
- "to the study, the city saw a total of 21,406 reported homicides in 2076, which is over " +
- "a 20% increase compared to 2075.
" +
- "CIA director David Glarow says its too early to know " +
- "whether these figures indicate the beginning of a sustained increase in crime rates, or whether " +
- "the year was just an unfortunate outlier. He states that many intelligence and law enforcement " +
- "agents have noticed an increase in organized crime activites, and believes that these figures may " +
- "be the result of an uprising from criminal organizations such as The Syndicate or the Slum Snakes.";
- Literatures[fn] = new Literature(title, fn, txt);
-
- title = "Man and the Machine";
- fn = "man-and-machine.lit";
- txt = "In 2005 Ray Kurzweil popularized his theory of the Singularity. He predicted that the rate " +
- "of technological advancement would continue to accelerate faster and faster until one day " +
- "machines would be become infinitely more intelligent than humans. This point, called the " +
- "Singularity, would result in a drastic transformation of the world as we know it. He predicted " +
- "that the Singularity would arrive by 2045. " +
- "And yet here we are, more than three decades later, where most would agree that we have not " +
- "yet reached a point where computers and machines are vastly more intelligent than we are. So what gives?
" +
- "The answer is that we have reached the Singularity, just not in the way we expected. The artifical superintelligence " +
- "that was predicted by Kurzweil and others exists in the world today - in the form of Augmentations. " +
- "Yes, those Augmentations that the rich and powerful keep to themselves enable humans " +
- "to become superintelligent beings. The Singularity did not lead to a world where " +
- "our machines are infinitely more intelligent than us, it led to a world " +
- "where man and machine can merge to become something greater. Most of the world just doesn't " +
- "know it yet."
- Literatures[fn] = new Literature(title, fn, txt);
-
- title = "Secret Societies";
- fn = "secret-societies.lit";
- txt = "The idea of secret societies has long intrigued the general public by inspiring curiosity, fascination, and " +
- "distrust. People have long wondered about who these secret society members are and what they do, with the " +
- "most radical of conspiracy theorists claiming that they control everything in the entire world. And while the world " +
- "may never know for sure, it is likely that many secret societies do actually exist, even today.
" +
- "However, the secret societies of the modern world are nothing like those that (supposedly) existed " +
- "decades and centuries ago. The Freemasons, Knights Templar, and Illuminati, while they may have been around " +
- "at the turn of the 21st century, almost assuredly do not exist today. The dominance of the Web in " +
- "our everyday lives and the fact that so much of the world is now digital has given rise to a new breed " +
- "of secret societies: Internet-based ones.
" +
- "Commonly called 'hacker groups', Internet-based secret societies have become well-known in today's " +
- "world. Some of these, such as The Black Hand, are black hat groups that claim they are trying to " +
- "help the oppressed by attacking the elite and powerful. Others, such as NiteSec, are hacktivist groups " +
- "that try to push political and social agendas. Perhaps the most intriguing hacker group " +
- "is the mysterious Bitrunners, whose purpose still remains unknown.";
- Literatures[fn] = new Literature(title, fn, txt);
-
- title = "Space: The Failed Frontier";
- fn = "the-failed-frontier.lit";
- txt = "Humans have long dreamed about spaceflight. With enduring interest, we were driven to explore " +
- "the unknown and discover new worlds. We dreamed about conquering the stars. And in our quest, " +
- "we pushed the boundaries of our scientific limits, and then pushed further. Space exploration " +
- "lead to the development of many important technologies and new industries.
" +
- "But sometime in the middle of the 21st century, all of that changed. Humanity lost its ambitions and " +
- "aspirations of exploring the cosmos. The once-large funding for agencies like NASA and the European " +
- "Space Agency gradually whittled away until their eventual disbanding in the 2060's. Not even " +
- "militaries are fielding flights into space nowadays. The only remnants of the once great mission for cosmic " +
- "conquest are the countless satellites in near-earth orbit, used for communications, espionage, " +
- "and other corporate interests.
" +
- "And as we continue to look at the state of space technology, it becomes more and " +
- "more apparent that we will never return to that golden age of space exploration, that " +
- "age where everyone dreamed of going beyond earth for the sake of discovery.";
- Literatures[fn] = new Literature(title, fn, txt);
-
- title = "Coded Intelligence: Myth or Reality?";
- fn = "coded-intelligence.lit";
- txt = "Tremendous progress has been made in the field of Artificial Intelligence over the past few decades. " +
- "Our autonomous vehicles and transporation systems. The electronic personal assistants that control our everyday lives. " +
- "Medical, service, and manufacturing robots. All of these are examples of how far AI has come and how much it has " +
- "improved our daily lives. However, the question still remains of whether AI will ever be advanced enough to re-create " +
- "human intelligence.
" +
- "We've certainly come close to artificial intelligence that is similar to humans. For example OmniTek Incorporated's " +
- "CompanionBot, a robot meant to act as a comforting friend for lonely and grieving people, is eerily human-like " +
- "in its appearance, speech, mannerisms, and even movement. However its artificial intelligence isn't the same as " +
- "that of humans. Not yet. It doesn't have sentience or self-awareness or consciousness.
" +
- "Many neuroscientists believe that we won't ever reach the point of creating artificial human intelligence. 'At the end of the " +
- "the day, AI comes down to 1's and 0's, while the human brain does not. We'll never see AI that is identical to that of " +
- "humans.'";
- Literatures[fn] = new Literature(title, fn, txt);
-
- title = "Synthetic Muscles";
- fn = "synthetic-muscles.lit";
- txt = "Initial versions of synthetic muscles weren't made of anything organic but were actually " +
- "crude devices made to mimic human muscle function. Some of the early iterations were actually made of " +
- "common materials such as fishing lines and sewing threads due to their high strength for " +
- "a cheap cost.
" +
- "As technology progressed, however, advances in biomedical engineering paved the way for a new method of " +
- "creating synthetic muscles. Instead of creating something that closely imitated the functionality " +
- "of human muscle, scientists discovered a way of forcing the human body itself to augment its own " +
- "muscle tissue using both synthetic and organic materials. This is typically done using gene therapy " +
- "or chemical injections.";
- Literatures[fn] = new Literature(title, fn, txt);
-
- title = "Tensions rise in global tech race";
- fn = "tensions-in-tech-race.lit";
- txt = "Have we entered a new Cold War? Is WWIII just beyond the horizon?
" +
- "After rumors came out that OmniTek Incorporated had begun developing advanced robotic supersoldiers, " +
- "geopolitical tensions quickly flared between the USA, Russia, and several Asian superpowers. " +
- "In a rare show of cooperation between corporations, MegaCorp and ECorp have " +
- "reportedly launched hundreds of new surveillance and espionage satellites. " +
- "Defense contractors such as " +
- "DeltaOne and AeroCorp have been working with the CIA and NSA to prepare " +
- "for conflict. Meanwhile, the rest of the world sits in earnest " +
- "hoping that it never reaches full-scale war. With today's technology " +
- "and firepower, a World War would assuredly mean the end of human civilization.";
- Literatures[fn] = new Literature(title, fn, txt);
-
- title = "The Cost of Immortality";
- fn = "cost-of-immortality.lit";
- txt = "Evolution and advances in medical and augmentation technology has lead to drastic improvements " +
- "in human mortality rates. Recent figures show that the life expectancy for humans " +
- "that live in a first-world country is about 130 years of age, almost double of what it was " +
- "at the turn of the century. However, this increase in average lifespan has had some " +
- "significant effects on society and culture.
" +
- "Due to longer lifespans and a better quality of life, many adults are holding " +
- "off on having kids until much later. As a result, the percentage of youth in " +
- "first-world countries has been decreasing, while the number " +
- "of senior citizens is significantly increasing.
" +
- "Perhaps the most alarming result of all of this is the rapidly shrinking workforce. " +
- "Despite the increase in life expectancy, the typical retirement age for " +
- "workers in America has remained about the same, meaning a larger and larger " +
- "percentage of people in America are retirees. Furthermore, many " +
- "young adults are holding off on joining the workforce because they feel that " +
- "they have plenty of time left in their lives for employment, and want to " +
- "'enjoy life while they're young.' For most industries, this shrinking workforce " +
- "is not a major issue as most things are handled by robots anyways. However, " +
- "there are still several key industries such as engineering and education " +
- "that have not been automated, and these remain in danger to this cultural " +
- "phenomenon.";
- Literatures[fn] = new Literature(title, fn, txt);
-
- title = "The Hidden World";
- fn = "the-hidden-world.lit";
- txt = "WAKE UP SHEEPLE
" +
- "THE GOVERNMENT DOES NOT EXIST. CORPORATIONS DO NOT RUN SOCIETY
" +
- "THE ILLUMINATI ARE THE SECRET RULERS OF THE WORLD!
" +
- "Yes, the Illuminati of legends. The ancient secret society that controls the entire " +
- "world from the shadows with their invisible hand. The group of the rich and wealthy " +
- "that have penetrated every major government, financial agency, and corporation in the last " +
- "three hundred years.
" +
- "OPEN YOUR EYES
" +
- "It was the Illuminati that brought an end to democracy in the world. They are the driving force " +
- "behind everything that happens.
" +
- "THEY ARE ALL AROUND YOU
" +
- "After destabilizing the world's governments, they are now entering the final stage of their master plan. " +
- "They will secretly initiate global crises. Terrorism. Pandemics. World War. And out of the chaos " +
- "that ensues they will build their New World Order.";
- Literatures[fn] = new Literature(title, fn, txt);
-
- title = "The New God";
- fn = "the-new-god.lit";
- txt = "Everyone has that moment in their life where they wonder about the bigger questions
" +
- "What's the point of all of this? What is my purpose?
" +
- "Some people dare to think even bigger
" +
- "What will be the fate of the human race?
" +
- "We live in an era vastly different from that of even 15 or 20 years ago. We have gone " +
- "where no man has gone before. We have stripped ourselves of the tyranny of flesh.
" +
- "The Singularity is here. The merging of man and machine. This is where humanity evolves into " +
- "something greater. This is our future
" +
- "Embrace it, and you will obey a new god. The God in the Machine";
- Literatures[fn] = new Literature(title, fn, txt);
-
- title = "The New Triads";
- fn = "new-triads.lit";
- txt = "The Triads were an ancient transnational crime syndicate based in China, Hong Kong, and other Asian " +
- "territories. They were often considered one of the first and biggest criminal secret societies. " +
- "While most of the branches of the Triads have been destroyed over the past few decades, the " +
- "crime faction has spawned and inspired a number of other Asian crime organizations over the past few years. " +
- "The most notable of these is the Tetrads.
" +
- "It is widely believed that the Tetrads are a rogue group that splintered off from the Triads sometime in the " +
- "mid 21st century. The founders of the Tetrads, all of whom were ex-Triad members, believed that the " +
- "Triads were losing their purpose and direction. The Tetrads started off as a small group that mainly engaged " +
- "in fraud and extortion. They were largely unknown until just a few years ago when they took over the illegal " +
- "drug trade in all of the major Asian cities. They quickly became the most powerful crime syndicate in the " +
- "continent.
" +
- "Not much else is known about the Tetrads, or about the efforts the Asian governments and corporations are making " +
- "to take down this large new crime organization. Many believe that the Tetrads have infiltrated the governments " +
- "and powerful corporations in Asia, which has helped faciliate their recent rapid rise.";
- Literatures[fn] = new Literature(title, fn, txt);
-
- title = "The Secret War";
- fn = "the-secret-war.lit";
- txt = ""
- Literatures[fn] = new Literature(title, fn, txt);
-}
-
-
-
-
-/***/ }),
-/* 44 */
-/***/ (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__(9);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__engine_js__ = __webpack_require__(4);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Prestige_js__ = __webpack_require__(31);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__SourceFile_js__ = __webpack_require__(30);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Terminal_js__ = __webpack_require__(20);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_DialogBox_js__ = __webpack_require__(2);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__ = __webpack_require__(1);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_YesNoBox_js__ = __webpack_require__(21);
-
-
-
-
-
-
-
-
-
-
-
-/* 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);
- Object(__WEBPACK_IMPORTED_MODULE_6__utils_DialogBox_js__["a" /* dialogBoxCreate */])("You received a Source-File for destroying a Bit Node!
';
+ if (!regArgs) {
+ for (var registerName in registers) {
+ var text = registers[registerName].toString();
+ if (text.length) {
+ regInfo += '"' + registerName + ' ' + text + ' ';
+ }
+ }
+ } else {
+ var registerName;
+ regArgs = regArgs.join('');
+ for (var i = 0; i < regArgs.length; i++) {
+ registerName = regArgs.charAt(i);
+ if (!vimGlobalState.registerController.isValidRegister(registerName)) {
+ continue;
+ }
+ var register = registers[registerName] || new Register();
+ regInfo += '"' + registerName + ' ' + register.toString() + ' ';
+ }
+ }
+ showConfirm(cm, regInfo);
+ },
+ sort: function(cm, params) {
+ var reverse, ignoreCase, unique, number;
+ function parseArgs() {
+ if (params.argString) {
+ var args = new CodeMirror.StringStream(params.argString);
+ if (args.eat('!')) { reverse = true; }
+ if (args.eol()) { return; }
+ if (!args.eatSpace()) { return 'Invalid arguments'; }
+ var opts = args.match(/[a-z]+/);
+ if (opts) {
+ opts = opts[0];
+ ignoreCase = opts.indexOf('i') != -1;
+ unique = opts.indexOf('u') != -1;
+ var decimal = opts.indexOf('d') != -1 && 1;
+ var hex = opts.indexOf('x') != -1 && 1;
+ var octal = opts.indexOf('o') != -1 && 1;
+ if (decimal + hex + octal > 1) { return 'Invalid arguments'; }
+ number = decimal && 'decimal' || hex && 'hex' || octal && 'octal';
+ }
+ if (args.match(/\/.*\//)) { return 'patterns not supported'; }
+ }
+ }
+ var err = parseArgs();
+ if (err) {
+ showConfirm(cm, err + ': ' + params.argString);
+ return;
+ }
+ var lineStart = params.line || cm.firstLine();
+ var lineEnd = params.lineEnd || params.line || cm.lastLine();
+ if (lineStart == lineEnd) { return; }
+ var curStart = Pos(lineStart, 0);
+ var curEnd = Pos(lineEnd, lineLength(cm, lineEnd));
+ var text = cm.getRange(curStart, curEnd).split('\n');
+ var numberRegex = (number == 'decimal') ? /(-?)([\d]+)/ :
+ (number == 'hex') ? /(-?)(?:0x)?([0-9a-f]+)/i :
+ (number == 'octal') ? /([0-7]+)/ : null;
+ var radix = (number == 'decimal') ? 10 : (number == 'hex') ? 16 : (number == 'octal') ? 8 : null;
+ var numPart = [], textPart = [];
+ if (number) {
+ for (var i = 0; i < text.length; i++) {
+ if (numberRegex.exec(text[i])) {
+ numPart.push(text[i]);
+ } else {
+ textPart.push(text[i]);
+ }
+ }
+ } else {
+ textPart = text;
+ }
+ function compareFn(a, b) {
+ if (reverse) { var tmp; tmp = a; a = b; b = tmp; }
+ if (ignoreCase) { a = a.toLowerCase(); b = b.toLowerCase(); }
+ var anum = number && numberRegex.exec(a);
+ var bnum = number && numberRegex.exec(b);
+ if (!anum) { return a < b ? -1 : 1; }
+ anum = parseInt((anum[1] + anum[2]).toLowerCase(), radix);
+ bnum = parseInt((bnum[1] + bnum[2]).toLowerCase(), radix);
+ return anum - bnum;
+ }
+ numPart.sort(compareFn);
+ textPart.sort(compareFn);
+ text = (!reverse) ? textPart.concat(numPart) : numPart.concat(textPart);
+ if (unique) { // Remove duplicate lines
+ var textOld = text;
+ var lastLine;
+ text = [];
+ for (var i = 0; i < textOld.length; i++) {
+ if (textOld[i] != lastLine) {
+ text.push(textOld[i]);
+ }
+ lastLine = textOld[i];
+ }
+ }
+ cm.replaceRange(text.join('\n'), curStart, curEnd);
+ },
+ global: function(cm, params) {
+ var argString = params.argString;
+ if (!argString) {
+ showConfirm(cm, 'Regular Expression missing from global');
+ return;
+ }
+ var lineStart = (params.line !== undefined) ? params.line : cm.firstLine();
+ var lineEnd = params.lineEnd || params.line || cm.lastLine();
+ var tokens = splitBySlash(argString);
+ var regexPart = argString, cmd;
+ if (tokens.length) {
+ regexPart = tokens[0];
+ cmd = tokens.slice(1, tokens.length).join('/');
+ }
+ if (regexPart) {
+ try {
+ updateSearchQuery(cm, regexPart, true /** ignoreCase */,
+ true /** smartCase */);
+ } catch (e) {
+ showConfirm(cm, 'Invalid regex: ' + regexPart);
+ return;
+ }
+ }
+ var query = getSearchState(cm).getQuery();
+ var matchedLines = [], content = '';
+ for (var i = lineStart; i <= lineEnd; i++) {
+ var matched = query.test(cm.getLine(i));
+ if (matched) {
+ matchedLines.push(i+1);
+ content+= cm.getLine(i) + ' ';
+ }
+ }
+ if (!cmd) {
+ showConfirm(cm, content);
+ return;
+ }
+ var index = 0;
+ var nextCommand = function() {
+ if (index < matchedLines.length) {
+ var command = matchedLines[index] + cmd;
+ exCommandDispatcher.processCommand(cm, command, {
+ callback: nextCommand
+ });
+ }
+ index++;
+ };
+ nextCommand();
+ },
+ substitute: function(cm, params) {
+ if (!cm.getSearchCursor) {
+ throw new Error('Search feature not available. Requires searchcursor.js or ' +
+ 'any other getSearchCursor implementation.');
+ }
+ var argString = params.argString;
+ var tokens = argString ? splitBySlash(argString) : [];
+ var regexPart, replacePart = '', trailing, flagsPart, count;
+ var confirm = false; // Whether to confirm each replace.
+ var global = false; // True to replace all instances on a line, false to replace only 1.
+ if (tokens.length) {
+ regexPart = tokens[0];
+ replacePart = tokens[1];
+ if (replacePart !== undefined) {
+ if (getOption('pcre')) {
+ replacePart = unescapeRegexReplace(replacePart);
+ } else {
+ replacePart = translateRegexReplace(replacePart);
+ }
+ vimGlobalState.lastSubstituteReplacePart = replacePart;
+ }
+ trailing = tokens[2] ? tokens[2].split(' ') : [];
+ } else {
+ if (argString && argString.length) {
+ showConfirm(cm, 'Substitutions should be of the form ' +
+ ':s/pattern/replace/');
+ return;
+ }
+ }
+ if (trailing) {
+ flagsPart = trailing[0];
+ count = parseInt(trailing[1]);
+ if (flagsPart) {
+ if (flagsPart.indexOf('c') != -1) {
+ confirm = true;
+ flagsPart.replace('c', '');
+ }
+ if (flagsPart.indexOf('g') != -1) {
+ global = true;
+ flagsPart.replace('g', '');
+ }
+ regexPart = regexPart + '/' + flagsPart;
+ }
+ }
+ if (regexPart) {
+ try {
+ updateSearchQuery(cm, regexPart, true /** ignoreCase */,
+ true /** smartCase */);
+ } catch (e) {
+ showConfirm(cm, 'Invalid regex: ' + regexPart);
+ return;
+ }
+ }
+ replacePart = replacePart || vimGlobalState.lastSubstituteReplacePart;
+ if (replacePart === undefined) {
+ showConfirm(cm, 'No previous substitute regular expression');
+ return;
+ }
+ var state = getSearchState(cm);
+ var query = state.getQuery();
+ var lineStart = (params.line !== undefined) ? params.line : cm.getCursor().line;
+ var lineEnd = params.lineEnd || lineStart;
+ if (lineStart == cm.firstLine() && lineEnd == cm.lastLine()) {
+ lineEnd = Infinity;
+ }
+ if (count) {
+ lineStart = lineEnd;
+ lineEnd = lineStart + count - 1;
+ }
+ var startPos = clipCursorToContent(cm, Pos(lineStart, 0));
+ var cursor = cm.getSearchCursor(query, startPos);
+ doReplace(cm, confirm, global, lineStart, lineEnd, cursor, query, replacePart, params.callback);
+ },
+ redo: CodeMirror.commands.redo,
+ undo: CodeMirror.commands.undo,
+ write: function(cm) {
+ if (CodeMirror.commands.save) {
+ CodeMirror.commands.save(cm);
+ } else {
+ cm.save();
+ }
+ },
+ nohlsearch: function(cm) {
+ clearSearchHighlight(cm);
+ },
+ delmarks: function(cm, params) {
+ if (!params.argString || !trim(params.argString)) {
+ showConfirm(cm, 'Argument acequired');
+ return;
+ }
+
+ var state = cm.state.vim;
+ var stream = new CodeMirror.StringStream(trim(params.argString));
+ while (!stream.eol()) {
+ stream.eatSpace();
+ var count = stream.pos;
+
+ if (!stream.match(/[a-zA-Z]/, false)) {
+ showConfirm(cm, 'Invalid argument: ' + params.argString.substring(count));
+ return;
+ }
+
+ var sym = stream.next();
+ if (stream.match('-', true)) {
+ if (!stream.match(/[a-zA-Z]/, false)) {
+ showConfirm(cm, 'Invalid argument: ' + params.argString.substring(count));
+ return;
+ }
+
+ var startMark = sym;
+ var finishMark = stream.next();
+ if (isLowerCase(startMark) && isLowerCase(finishMark) ||
+ isUpperCase(startMark) && isUpperCase(finishMark)) {
+ var start = startMark.charCodeAt(0);
+ var finish = finishMark.charCodeAt(0);
+ if (start >= finish) {
+ showConfirm(cm, 'Invalid argument: ' + params.argString.substring(count));
+ return;
+ }
+ for (var j = 0; j <= finish - start; j++) {
+ var mark = String.fromCharCode(start + j);
+ delete state.marks[mark];
+ }
+ } else {
+ showConfirm(cm, 'Invalid argument: ' + startMark + '-');
+ return;
+ }
+ } else {
+ delete state.marks[sym];
+ }
+ }
+ }
+ };
+
+ var exCommandDispatcher = new ExCommandDispatcher();
+ function doReplace(cm, confirm, global, lineStart, lineEnd, searchCursor, query,
+ replaceWith, callback) {
+ cm.state.vim.exMode = true;
+ var done = false;
+ var lastPos = searchCursor.from();
+ function replaceAll() {
+ cm.operation(function() {
+ while (!done) {
+ replace();
+ next();
+ }
+ stop();
+ });
+ }
+ function replace() {
+ var text = cm.getRange(searchCursor.from(), searchCursor.to());
+ var newText = text.replace(query, replaceWith);
+ searchCursor.replace(newText);
+ }
+ function next() {
+ while(searchCursor.findNext() &&
+ isInRange(searchCursor.from(), lineStart, lineEnd)) {
+ if (!global && lastPos && searchCursor.from().line == lastPos.line) {
+ continue;
+ }
+ cm.scrollIntoView(searchCursor.from(), 30);
+ cm.setSelection(searchCursor.from(), searchCursor.to());
+ lastPos = searchCursor.from();
+ done = false;
+ return;
+ }
+ done = true;
+ }
+ function stop(close) {
+ if (close) { close(); }
+ cm.focus();
+ if (lastPos) {
+ cm.setCursor(lastPos);
+ var vim = cm.state.vim;
+ vim.exMode = false;
+ vim.lastHPos = vim.lastHSPos = lastPos.ch;
+ }
+ if (callback) { callback(); }
+ }
+ function onPromptKeyDown(e, _value, close) {
+ CodeMirror.e_stop(e);
+ var keyName = CodeMirror.keyName(e);
+ switch (keyName) {
+ case 'Y':
+ replace(); next(); break;
+ case 'N':
+ next(); break;
+ case 'A':
+ var savedCallback = callback;
+ callback = undefined;
+ cm.operation(replaceAll);
+ callback = savedCallback;
+ break;
+ case 'L':
+ replace();
+ case 'Q':
+ case 'Esc':
+ case 'Ctrl-C':
+ case 'Ctrl-[':
+ stop(close);
+ break;
+ }
+ if (done) { stop(close); }
+ return true;
+ }
+ next();
+ if (done) {
+ showConfirm(cm, 'No matches for ' + query.source);
+ return;
+ }
+ if (!confirm) {
+ replaceAll();
+ if (callback) { callback(); }
+ return;
+ }
+ showPrompt(cm, {
+ prefix: 'replace with ' + replaceWith + ' (y/n/a/q/l)',
+ onKeyDown: onPromptKeyDown
+ });
+ }
+
+ CodeMirror.keyMap.vim = {
+ attach: attachVimMap,
+ detach: detachVimMap,
+ call: cmKey
+ };
+
+ function exitInsertMode(cm) {
+ var vim = cm.state.vim;
+ var macroModeState = vimGlobalState.macroModeState;
+ var insertModeChangeRegister = vimGlobalState.registerController.getRegister('.');
+ var isPlaying = macroModeState.isPlaying;
+ var lastChange = macroModeState.lastInsertModeChanges;
+ var text = [];
+ if (!isPlaying) {
+ var selLength = lastChange.inVisualBlock ? vim.lastSelection.visualBlock.height : 1;
+ var changes = lastChange.changes;
+ var text = [];
+ var i = 0;
+ while (i < changes.length) {
+ text.push(changes[i]);
+ if (changes[i] instanceof InsertModeKey) {
+ i++;
+ } else {
+ i+= selLength;
+ }
+ }
+ lastChange.changes = text;
+ cm.off('change', onChange);
+ CodeMirror.off(cm.getInputField(), 'keydown', onKeyEventTargetKeyDown);
+ }
+ if (!isPlaying && vim.insertModeRepeat > 1) {
+ repeatLastEdit(cm, vim, vim.insertModeRepeat - 1,
+ true /** repeatForInsert */);
+ vim.lastEditInputState.repeatOverride = vim.insertModeRepeat;
+ }
+ delete vim.insertModeRepeat;
+ vim.insertMode = false;
+ cm.setCursor(cm.getCursor().line, cm.getCursor().ch-1);
+ cm.setOption('keyMap', 'vim');
+ cm.setOption('disableInput', true);
+ cm.toggleOverwrite(false); // exit replace mode if we were in it.
+ insertModeChangeRegister.setText(lastChange.changes.join(''));
+ CodeMirror.signal(cm, "vim-mode-change", {mode: "normal"});
+ if (macroModeState.isRecording) {
+ logInsertModeChange(macroModeState);
+ }
+ }
+
+ function _mapCommand(command) {
+ defaultKeymap.unshift(command);
+ }
+
+ function mapCommand(keys, type, name, args, extra) {
+ var command = {keys: keys, type: type};
+ command[type] = name;
+ command[type + "Args"] = args;
+ for (var key in extra)
+ command[key] = extra[key];
+ _mapCommand(command);
+ }
+ defineOption('insertModeEscKeysTimeout', 200, 'number');
+
+ CodeMirror.keyMap['vim-insert'] = {
+ 'Ctrl-N': 'autocomplete',
+ 'Ctrl-P': 'autocomplete',
+ 'Enter': function(cm) {
+ var fn = CodeMirror.commands.newlineAndIndentContinueComment ||
+ CodeMirror.commands.newlineAndIndent;
+ fn(cm);
+ },
+ fallthrough: ['default'],
+ attach: attachVimMap,
+ detach: detachVimMap,
+ call: cmKey
+ };
+
+ CodeMirror.keyMap['vim-replace'] = {
+ 'Backspace': 'goCharLeft',
+ fallthrough: ['vim-insert'],
+ attach: attachVimMap,
+ detach: detachVimMap,
+ call: cmKey
+ };
+
+ function executeMacroRegister(cm, vim, macroModeState, registerName) {
+ var register = vimGlobalState.registerController.getRegister(registerName);
+ if (registerName == ':') {
+ if (register.keyBuffer[0]) {
+ exCommandDispatcher.processCommand(cm, register.keyBuffer[0]);
+ }
+ macroModeState.isPlaying = false;
+ return;
+ }
+ var keyBuffer = register.keyBuffer;
+ var imc = 0;
+ macroModeState.isPlaying = true;
+ macroModeState.replaySearchQueries = register.searchQueries.slice(0);
+ for (var i = 0; i < keyBuffer.length; i++) {
+ var text = keyBuffer[i];
+ var match, key;
+ while (text) {
+ match = (/<\w+-.+?>|<\w+>|./).exec(text);
+ key = match[0];
+ text = text.substring(match.index + key.length);
+ CodeMirror.Vim.handleKey(cm, key, 'macro');
+ if (vim.insertMode) {
+ var changes = register.insertModeChanges[imc++].changes;
+ vimGlobalState.macroModeState.lastInsertModeChanges.changes =
+ changes;
+ repeatInsertModeChanges(cm, changes, 1);
+ exitInsertMode(cm);
+ }
+ }
+ }
+ macroModeState.isPlaying = false;
+ }
+
+ function logKey(macroModeState, key) {
+ if (macroModeState.isPlaying) { return; }
+ var registerName = macroModeState.latestRegister;
+ var register = vimGlobalState.registerController.getRegister(registerName);
+ if (register) {
+ register.pushText(key);
+ }
+ }
+
+ function logInsertModeChange(macroModeState) {
+ if (macroModeState.isPlaying) { return; }
+ var registerName = macroModeState.latestRegister;
+ var register = vimGlobalState.registerController.getRegister(registerName);
+ if (register && register.pushInsertModeChanges) {
+ register.pushInsertModeChanges(macroModeState.lastInsertModeChanges);
+ }
+ }
+
+ function logSearchQuery(macroModeState, query) {
+ if (macroModeState.isPlaying) { return; }
+ var registerName = macroModeState.latestRegister;
+ var register = vimGlobalState.registerController.getRegister(registerName);
+ if (register && register.pushSearchQuery) {
+ register.pushSearchQuery(query);
+ }
+ }
+ function onChange(_cm, changeObj) {
+ var macroModeState = vimGlobalState.macroModeState;
+ var lastChange = macroModeState.lastInsertModeChanges;
+ if (!macroModeState.isPlaying) {
+ while(changeObj) {
+ lastChange.expectCursorActivityForChange = true;
+ if (changeObj.origin == '+input' || changeObj.origin == 'paste'
+ || changeObj.origin === undefined /* only in testing */) {
+ var text = changeObj.text.join('\n');
+ if (lastChange.maybeReset) {
+ lastChange.changes = [];
+ lastChange.maybeReset = false;
+ }
+ lastChange.changes.push(text);
+ }
+ changeObj = changeObj.next;
+ }
+ }
+ }
+ function onCursorActivity(cm) {
+ var vim = cm.state.vim;
+ if (vim.insertMode) {
+ var macroModeState = vimGlobalState.macroModeState;
+ if (macroModeState.isPlaying) { return; }
+ var lastChange = macroModeState.lastInsertModeChanges;
+ if (lastChange.expectCursorActivityForChange) {
+ lastChange.expectCursorActivityForChange = false;
+ } else {
+ lastChange.maybeReset = true;
+ }
+ } else if (!cm.curOp.isVimOp) {
+ handleExternalSelection(cm, vim);
+ }
+ if (vim.visualMode) {
+ updateFakeCursor(cm);
+ }
+ }
+ function updateFakeCursor(cm) {
+ var vim = cm.state.vim;
+ var from = clipCursorToContent(cm, copyCursor(vim.sel.head));
+ var to = offsetCursor(from, 0, 1);
+ if (vim.fakeCursor) {
+ vim.fakeCursor.clear();
+ }
+ vim.fakeCursor = cm.markText(from, to, {className: 'cm-animate-fat-cursor'});
+ }
+ function handleExternalSelection(cm, vim) {
+ var anchor = cm.getCursor('anchor');
+ var head = cm.getCursor('head');
+ if (vim.visualMode && !cm.somethingSelected()) {
+ exitVisualMode(cm, false);
+ } else if (!vim.visualMode && !vim.insertMode && cm.somethingSelected()) {
+ vim.visualMode = true;
+ vim.visualLine = false;
+ CodeMirror.signal(cm, "vim-mode-change", {mode: "visual"});
+ }
+ if (vim.visualMode) {
+ var headOffset = !cursorIsBefore(head, anchor) ? -1 : 0;
+ var anchorOffset = cursorIsBefore(head, anchor) ? -1 : 0;
+ head = offsetCursor(head, 0, headOffset);
+ anchor = offsetCursor(anchor, 0, anchorOffset);
+ vim.sel = {
+ anchor: anchor,
+ head: head
+ };
+ updateMark(cm, vim, '<', cursorMin(head, anchor));
+ updateMark(cm, vim, '>', cursorMax(head, anchor));
+ } else if (!vim.insertMode) {
+ vim.lastHPos = cm.getCursor().ch;
+ }
+ }
+ function InsertModeKey(keyName) {
+ this.keyName = keyName;
+ }
+ function onKeyEventTargetKeyDown(e) {
+ var macroModeState = vimGlobalState.macroModeState;
+ var lastChange = macroModeState.lastInsertModeChanges;
+ var keyName = CodeMirror.keyName(e);
+ if (!keyName) { return; }
+ function onKeyFound() {
+ if (lastChange.maybeReset) {
+ lastChange.changes = [];
+ lastChange.maybeReset = false;
+ }
+ lastChange.changes.push(new InsertModeKey(keyName));
+ return true;
+ }
+ if (keyName.indexOf('Delete') != -1 || keyName.indexOf('Backspace') != -1) {
+ CodeMirror.lookupKey(keyName, 'vim-insert', onKeyFound);
+ }
+ }
+ function repeatLastEdit(cm, vim, repeat, repeatForInsert) {
+ var macroModeState = vimGlobalState.macroModeState;
+ macroModeState.isPlaying = true;
+ var isAction = !!vim.lastEditActionCommand;
+ var cachedInputState = vim.inputState;
+ function repeatCommand() {
+ if (isAction) {
+ commandDispatcher.processAction(cm, vim, vim.lastEditActionCommand);
+ } else {
+ commandDispatcher.evalInput(cm, vim);
+ }
+ }
+ function repeatInsert(repeat) {
+ if (macroModeState.lastInsertModeChanges.changes.length > 0) {
+ repeat = !vim.lastEditActionCommand ? 1 : repeat;
+ var changeObject = macroModeState.lastInsertModeChanges;
+ repeatInsertModeChanges(cm, changeObject.changes, repeat);
+ }
+ }
+ vim.inputState = vim.lastEditInputState;
+ if (isAction && vim.lastEditActionCommand.interlaceInsertRepeat) {
+ for (var i = 0; i < repeat; i++) {
+ repeatCommand();
+ repeatInsert(1);
+ }
+ } else {
+ if (!repeatForInsert) {
+ repeatCommand();
+ }
+ repeatInsert(repeat);
+ }
+ vim.inputState = cachedInputState;
+ if (vim.insertMode && !repeatForInsert) {
+ exitInsertMode(cm);
+ }
+ macroModeState.isPlaying = false;
+ }
+
+ function repeatInsertModeChanges(cm, changes, repeat) {
+ function keyHandler(binding) {
+ if (typeof binding == 'string') {
+ CodeMirror.commands[binding](cm);
+ } else {
+ binding(cm);
+ }
+ return true;
+ }
+ var head = cm.getCursor('head');
+ var inVisualBlock = vimGlobalState.macroModeState.lastInsertModeChanges.inVisualBlock;
+ if (inVisualBlock) {
+ var vim = cm.state.vim;
+ var lastSel = vim.lastSelection;
+ var offset = getOffset(lastSel.anchor, lastSel.head);
+ selectForInsert(cm, head, offset.line + 1);
+ repeat = cm.listSelections().length;
+ cm.setCursor(head);
+ }
+ for (var i = 0; i < repeat; i++) {
+ if (inVisualBlock) {
+ cm.setCursor(offsetCursor(head, i, 0));
+ }
+ for (var j = 0; j < changes.length; j++) {
+ var change = changes[j];
+ if (change instanceof InsertModeKey) {
+ CodeMirror.lookupKey(change.keyName, 'vim-insert', keyHandler);
+ } else {
+ var cur = cm.getCursor();
+ cm.replaceRange(change, cur, cur);
+ }
+ }
+ }
+ if (inVisualBlock) {
+ cm.setCursor(offsetCursor(head, 0, 1));
+ }
+ }
+
+ resetVimGlobalState();
+ CodeMirror.Vim = Vim();
+
+ Vim = CodeMirror.Vim;
+
+ var specialKey = {'return':'CR',backspace:'BS','delete':'Del',esc:'Esc',
+ left:'Left',right:'Right',up:'Up',down:'Down',space: 'Space',
+ home:'Home',end:'End',pageup:'PageUp',pagedown:'PageDown', enter: 'CR'
+ };
+ function lookupKey(hashId, key, e) {
+ if (key.length > 1 && key[0] == "n") {
+ key = key.replace("numpad", "");
+ }
+ key = specialKey[key] || key;
+ var name = '';
+ if (e.ctrlKey) { name += 'C-'; }
+ if (e.altKey) { name += 'A-'; }
+ if (e.shiftKey) { name += 'S-'; }
+
+ name += key;
+ if (name.length > 1) { name = '<' + name + '>'; }
+ return name;
+ }
+ var handleKey = Vim.handleKey.bind(Vim);
+ Vim.handleKey = function(cm, key, origin) {
+ return cm.operation(function() {
+ return handleKey(cm, key, origin);
+ }, true);
+ }
+ function cloneVimState(state) {
+ var n = new state.constructor();
+ Object.keys(state).forEach(function(key) {
+ var o = state[key];
+ if (Array.isArray(o))
+ o = o.slice();
+ else if (o && typeof o == "object" && o.constructor != Object)
+ o = cloneVimState(o);
+ n[key] = o;
+ });
+ if (state.sel) {
+ n.sel = {
+ head: state.sel.head && copyCursor(state.sel.head),
+ anchor: state.sel.anchor && copyCursor(state.sel.anchor)
+ };
+ }
+ return n;
+ }
+ function multiSelectHandleKey(cm, key, origin) {
+ var isHandled = false;
+ var vim = Vim.maybeInitVimState_(cm);
+ var visualBlock = vim.visualBlock || vim.wasInVisualBlock;
+ if (vim.wasInVisualBlock && !cm.ace.inMultiSelectMode) {
+ vim.wasInVisualBlock = false;
+ } else if (cm.ace.inMultiSelectMode && vim.visualBlock) {
+ vim.wasInVisualBlock = true;
+ }
+
+ if (key == '' && !vim.insertMode && !vim.visualMode && cm.ace.inMultiSelectMode) {
+ cm.ace.exitMultiSelectMode();
+ } else if (visualBlock || !cm.ace.inMultiSelectMode || cm.ace.inVirtualSelectionMode) {
+ isHandled = Vim.handleKey(cm, key, origin);
+ } else {
+ var old = cloneVimState(vim);
+ cm.operation(function() {
+ cm.ace.forEachSelection(function() {
+ var sel = cm.ace.selection;
+ cm.state.vim.lastHPos = sel.$desiredColumn == null ? sel.lead.column : sel.$desiredColumn;
+ var head = cm.getCursor("head");
+ var anchor = cm.getCursor("anchor");
+ var headOffset = !cursorIsBefore(head, anchor) ? -1 : 0;
+ var anchorOffset = cursorIsBefore(head, anchor) ? -1 : 0;
+ head = offsetCursor(head, 0, headOffset);
+ anchor = offsetCursor(anchor, 0, anchorOffset);
+ cm.state.vim.sel.head = head;
+ cm.state.vim.sel.anchor = anchor;
+
+ isHandled = handleKey(cm, key, origin);
+ sel.$desiredColumn = cm.state.vim.lastHPos == -1 ? null : cm.state.vim.lastHPos;
+ if (cm.virtualSelectionMode()) {
+ cm.state.vim = cloneVimState(old);
+ }
+ });
+ if (cm.curOp.cursorActivity && !isHandled)
+ cm.curOp.cursorActivity = false;
+ }, true);
+ }
+ return isHandled;
+ }
+ exports.CodeMirror = CodeMirror;
+ var getVim = Vim.maybeInitVimState_;
+ exports.handler = {
+ $id: "ace/keyboard/vim",
+ drawCursor: function(style, pixelPos, config, sel, session) {
+ var vim = this.state.vim || {};
+ var w = config.characterWidth;
+ var h = config.lineHeight;
+ var top = pixelPos.top;
+ var left = pixelPos.left;
+ if (!vim.insertMode) {
+ var isbackwards = !sel.cursor
+ ? session.selection.isBackwards() || session.selection.isEmpty()
+ : Range.comparePoints(sel.cursor, sel.start) <= 0;
+ if (!isbackwards && left > w)
+ left -= w;
+ }
+ if (!vim.insertMode && vim.status) {
+ h = h / 2;
+ top += h;
+ }
+ style.left = left + "px";
+ style.top = top + "px";
+ style.width = w + "px";
+ style.height = h + "px";
+ },
+ handleKeyboard: function(data, hashId, key, keyCode, e) {
+ var editor = data.editor;
+ var cm = editor.state.cm;
+ var vim = getVim(cm);
+ if (keyCode == -1) return;
+
+ if (key == "c" && hashId == 1) { // key == "ctrl-c"
+ if (!useragent.isMac && editor.getCopyText()) {
+ editor.once("copy", function() {
+ editor.selection.clearSelection();
+ });
+ return {command: "null", passEvent: true};
+ }
+ } else if (!vim.insertMode) {
+ if (useragent.isMac && this.handleMacRepeat(data, hashId, key)) {
+ hashId = -1;
+ key = data.inputChar;
+ }
+ }
+
+ if (hashId == -1 || hashId & 1 || hashId === 0 && key.length > 1) {
+ var insertMode = vim.insertMode;
+ var name = lookupKey(hashId, key, e || {});
+ if (vim.status == null)
+ vim.status = "";
+ var isHandled = multiSelectHandleKey(cm, name, 'user');
+ vim = getVim(cm); // may be changed by multiSelectHandleKey
+ if (isHandled && vim.status != null)
+ vim.status += name;
+ else if (vim.status == null)
+ vim.status = "";
+ cm._signal("changeStatus");
+ if (!isHandled && (hashId != -1 || insertMode))
+ return;
+ return {command: "null", passEvent: !isHandled};
+ }
+ },
+ attach: function(editor) {
+ if (!editor.state) editor.state = {};
+ var cm = new CodeMirror(editor);
+ editor.state.cm = cm;
+ editor.$vimModeHandler = this;
+ CodeMirror.keyMap.vim.attach(cm);
+ getVim(cm).status = null;
+ cm.on('vim-command-done', function() {
+ if (cm.virtualSelectionMode()) return;
+ getVim(cm).status = null;
+ cm.ace._signal("changeStatus");
+ cm.ace.session.markUndoGroup();
+ });
+ cm.on("changeStatus", function() {
+ cm.ace.renderer.updateCursor();
+ cm.ace._signal("changeStatus");
+ });
+ cm.on("vim-mode-change", function() {
+ if (cm.virtualSelectionMode()) return;
+ cm.ace.renderer.setStyle("normal-mode", !getVim(cm).insertMode);
+ cm._signal("changeStatus");
+ });
+ cm.ace.renderer.setStyle("normal-mode", !getVim(cm).insertMode);
+ editor.renderer.$cursorLayer.drawCursor = this.drawCursor.bind(cm);
+ this.updateMacCompositionHandlers(editor, true);
+ },
+ detach: function(editor) {
+ var cm = editor.state.cm;
+ CodeMirror.keyMap.vim.detach(cm);
+ cm.destroy();
+ editor.state.cm = null;
+ editor.$vimModeHandler = null;
+ editor.renderer.$cursorLayer.drawCursor = null;
+ editor.renderer.setStyle("normal-mode", false);
+ this.updateMacCompositionHandlers(editor, false);
+ },
+ getStatusText: function(editor) {
+ var cm = editor.state.cm;
+ var vim = getVim(cm);
+ if (vim.insertMode)
+ return "INSERT";
+ var status = "";
+ if (vim.visualMode) {
+ status += "VISUAL";
+ if (vim.visualLine)
+ status += " LINE";
+ if (vim.visualBlock)
+ status += " BLOCK";
+ }
+ if (vim.status)
+ status += (status ? " " : "") + vim.status;
+ return status;
+ },
+ handleMacRepeat: function(data, hashId, key) {
+ if (hashId == -1) {
+ data.inputChar = key;
+ data.lastEvent = "input";
+ } else if (data.inputChar && data.$lastHash == hashId && data.$lastKey == key) {
+ if (data.lastEvent == "input") {
+ data.lastEvent = "input1";
+ } else if (data.lastEvent == "input1") {
+ return true;
+ }
+ } else {
+ data.$lastHash = hashId;
+ data.$lastKey = key;
+ data.lastEvent = "keypress";
+ }
+ },
+ updateMacCompositionHandlers: function(editor, enable) {
+ var onCompositionUpdateOverride = function(text) {
+ var cm = editor.state.cm;
+ var vim = getVim(cm);
+ if (!vim.insertMode) {
+ var el = this.textInput.getElement();
+ el.blur();
+ el.focus();
+ el.value = text;
+ } else {
+ this.onCompositionUpdateOrig(text);
+ }
+ };
+ var onCompositionStartOverride = function(text) {
+ var cm = editor.state.cm;
+ var vim = getVim(cm);
+ if (!vim.insertMode) {
+ this.onCompositionStartOrig(text);
+ }
+ };
+ if (enable) {
+ if (!editor.onCompositionUpdateOrig) {
+ editor.onCompositionUpdateOrig = editor.onCompositionUpdate;
+ editor.onCompositionUpdate = onCompositionUpdateOverride;
+ editor.onCompositionStartOrig = editor.onCompositionStart;
+ editor.onCompositionStart = onCompositionStartOverride;
+ }
+ } else {
+ if (editor.onCompositionUpdateOrig) {
+ editor.onCompositionUpdate = editor.onCompositionUpdateOrig;
+ editor.onCompositionUpdateOrig = null;
+ editor.onCompositionStart = editor.onCompositionStartOrig;
+ editor.onCompositionStartOrig = null;
+ }
+ }
+ }
+ };
+ var renderVirtualNumbers = {
+ getText: function(session, row) {
+ return (Math.abs(session.selection.lead.row - row) || (row + 1 + (row < 9? "\xb7" : "" ))) + "";
+ },
+ getWidth: function(session, lastLineNumber, config) {
+ return session.getLength().toString().length * config.characterWidth;
+ },
+ update: function(e, editor) {
+ editor.renderer.$loop.schedule(editor.renderer.CHANGE_GUTTER);
+ },
+ attach: function(editor) {
+ editor.renderer.$gutterLayer.$renderer = this;
+ editor.on("changeSelection", this.update);
+ },
+ detach: function(editor) {
+ editor.renderer.$gutterLayer.$renderer = null;
+ editor.off("changeSelection", this.update);
+ }
+ };
+ Vim.defineOption({
+ name: "wrap",
+ set: function(value, cm) {
+ if (cm) {cm.ace.setOption("wrap", value)}
+ },
+ type: "boolean"
+ }, false);
+ Vim.defineEx('write', 'w', function() {
+ console.log(':write is not implemented')
+ });
+ defaultKeymap.push(
+ { keys: 'zc', type: 'action', action: 'fold', actionArgs: { open: false } },
+ { keys: 'zC', type: 'action', action: 'fold', actionArgs: { open: false, all: true } },
+ { keys: 'zo', type: 'action', action: 'fold', actionArgs: { open: true } },
+ { keys: 'zO', type: 'action', action: 'fold', actionArgs: { open: true, all: true } },
+ { keys: 'za', type: 'action', action: 'fold', actionArgs: { toggle: true } },
+ { keys: 'zA', type: 'action', action: 'fold', actionArgs: { toggle: true, all: true } },
+ { keys: 'zf', type: 'action', action: 'fold', actionArgs: { open: true, all: true } },
+ { keys: 'zd', type: 'action', action: 'fold', actionArgs: { open: true, all: true } },
+
+ { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: "addCursorAbove" } },
+ { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: "addCursorBelow" } },
+ { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: "addCursorAboveSkipCurrent" } },
+ { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: "addCursorBelowSkipCurrent" } },
+ { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: "selectMoreBefore" } },
+ { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: "selectMoreAfter" } },
+ { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: "selectNextBefore" } },
+ { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: "selectNextAfter" } }
+ );
+ actions.aceCommand = function(cm, actionArgs, vim) {
+ cm.vimCmd = actionArgs;
+ if (cm.ace.inVirtualSelectionMode)
+ cm.ace.on("beforeEndOperation", delayedExecAceCommand);
+ else
+ delayedExecAceCommand(null, cm.ace);
+ };
+ function delayedExecAceCommand(op, ace) {
+ ace.off("beforeEndOperation", delayedExecAceCommand);
+ var cmd = ace.state.cm.vimCmd;
+ if (cmd) {
+ ace.execCommand(cmd.exec ? cmd : cmd.name, cmd.args);
+ }
+ ace.curOp = ace.prevOp;
+ }
+ actions.fold = function(cm, actionArgs, vim) {
+ cm.ace.execCommand(['toggleFoldWidget', 'toggleFoldWidget', 'foldOther', 'unfoldall'
+ ][(actionArgs.all ? 2 : 0) + (actionArgs.open ? 1 : 0)]);
+ };
+
+ exports.handler.defaultKeymap = defaultKeymap;
+ exports.handler.actions = actions;
+ exports.Vim = Vim;
+
+ Vim.map("Y", "yy", "normal");
+});
/***/ }),
-/* 53 */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
+/* 61 */
+/***/ (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) {
"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.",
+var oop = acequire("./lib/oop");
+var Range = acequire("./range").Range;
+var Search = acequire("./search").Search;
+var EditSession = acequire("./edit_session").EditSession;
+var SearchHighlight = acequire("./search_highlight").SearchHighlight;
+function Occur() {}
- 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.",
+oop.inherits(Occur, Search);
- //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.",
+(function() {
+ this.enter = function(editor, options) {
+ if (!options.needle) return false;
+ var pos = editor.getCursorPosition();
+ this.displayOccurContent(editor, options);
+ var translatedPos = this.originalToOccurPosition(editor.session, pos);
+ editor.moveCursorToPosition(translatedPos);
+ return true;
+ }
+ this.exit = function(editor, options) {
+ var pos = options.translatePosition && editor.getCursorPosition();
+ var translatedPos = pos && this.occurToOriginalPosition(editor.session, pos);
+ this.displayOriginalContent(editor);
+ if (translatedPos)
+ editor.moveCursorToPosition(translatedPos);
+ return true;
+ }
- 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.",
+ this.highlight = function(sess, regexp) {
+ var hl = sess.$occurHighlight = sess.$occurHighlight || sess.addDynamicMarker(
+ new SearchHighlight(null, "ace_occur-highlight", "text"));
+ hl.setRegexp(regexp);
+ sess._emit("changeBackMarker"); // force highlight layer redraw
+ }
- BachmanAndAssociatesInfo: "Where Law and Business meet - thats where we are.
" +
- "Legal Insight - Business Instinct - Experience Innovation",
+ this.displayOccurContent = function(editor, options) {
+ this.$originalSession = editor.session;
+ var found = this.matchingLines(editor.session, options);
+ var lines = found.map(function(foundLine) { return foundLine.content; });
+ var occurSession = new EditSession(lines.join('\n'));
+ occurSession.$occur = this;
+ occurSession.$occurMatchingLines = found;
+ editor.setSession(occurSession);
+ this.$useEmacsStyleLineStart = this.$originalSession.$useEmacsStyleLineStart;
+ occurSession.$useEmacsStyleLineStart = this.$useEmacsStyleLineStart;
+ this.highlight(occurSession, options.re);
+ occurSession._emit('changeBackMarker');
+ }
- BladeIndustriesInfo: "Augmentation is salvation",
+ this.displayOriginalContent = function(editor) {
+ editor.setSession(this.$originalSession);
+ this.$originalSession.$useEmacsStyleLineStart = this.$useEmacsStyleLineStart;
+ }
+ this.originalToOccurPosition = function(session, pos) {
+ var lines = session.$occurMatchingLines;
+ var nullPos = {row: 0, column: 0};
+ if (!lines) return nullPos;
+ for (var i = 0; i < lines.length; i++) {
+ if (lines[i].row === pos.row)
+ return {row: i, column: pos.column};
+ }
+ return nullPos;
+ }
+ this.occurToOriginalPosition = function(session, pos) {
+ var lines = session.$occurMatchingLines;
+ if (!lines || !lines[pos.row])
+ return pos;
+ return {row: lines[pos.row].row, column: pos.column};
+ }
- NWOInfo: "The human being created civilization not because of willingness but of a need to be assimilated into higher orders of structure and meaning.",
+ this.matchingLines = function(session, options) {
+ options = oop.mixin({}, options);
+ if (!session || !options.needle) return [];
+ var search = new Search();
+ search.set(options);
+ return search.findAll(session).reduce(function(lines, range) {
+ var row = range.start.row;
+ var last = lines[lines.length-1];
+ return last && last.row === row ?
+ lines :
+ lines.concat({row: row, content: session.getLine(row)});
+ }, []);
+ }
- ClarkeIncorporatedInfo: "Unlocking the power of the genome",
+}).call(Occur.prototype);
- OmniTekIncorporatedInfo: "Simply put, our mission is to design and build robots that make a difference",
+var dom = acequire('./lib/dom');
+dom.importCssString(".ace_occur-highlight {\n\
+ border-radius: 4px;\n\
+ background-color: rgba(87, 255, 8, 0.25);\n\
+ position: absolute;\n\
+ z-index: 4;\n\
+ -moz-box-sizing: border-box;\n\
+ -webkit-box-sizing: border-box;\n\
+ box-sizing: border-box;\n\
+ box-shadow: 0 0 4px rgb(91, 255, 50);\n\
+}\n\
+.ace_dark .ace_occur-highlight {\n\
+ background-color: rgb(80, 140, 85);\n\
+ box-shadow: 0 0 4px rgb(60, 120, 70);\n\
+}\n", "incremental-occur-highlighting");
- 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.",
+exports.Occur = Occur;
- KuaiGongInternationalInfo: "Dream big. Work hard. Make history.",
+});
- //Other Corporations
- FulcrumSecretTechnologiesInfo: "TODO",
+ace.define("ace/commands/occur_commands",["require","exports","module","ace/config","ace/occur","ace/keyboard/hash_handler","ace/lib/oop"], function(acequire, exports, module) {
- //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",
+var config = acequire("../config"),
+ Occur = acequire("../occur").Occur;
+var occurStartCommand = {
+ name: "occur",
+ exec: function(editor, options) {
+ var alreadyInOccur = !!editor.session.$occur;
+ var occurSessionActive = new Occur().enter(editor, options);
+ if (occurSessionActive && !alreadyInOccur)
+ OccurKeyboardHandler.installIn(editor);
+ },
+ readOnly: true
+};
+
+var occurCommands = [{
+ name: "occurexit",
+ bindKey: 'esc|Ctrl-G',
+ exec: function(editor) {
+ var occur = editor.session.$occur;
+ if (!occur) return;
+ occur.exit(editor, {});
+ if (!editor.session.$occur) OccurKeyboardHandler.uninstallFrom(editor);
+ },
+ readOnly: true
+}, {
+ name: "occuraccept",
+ bindKey: 'enter',
+ exec: function(editor) {
+ var occur = editor.session.$occur;
+ if (!occur) return;
+ occur.exit(editor, {translatePosition: true});
+ if (!editor.session.$occur) OccurKeyboardHandler.uninstallFrom(editor);
+ },
+ readOnly: true
+}];
+
+var HashHandler = acequire("../keyboard/hash_handler").HashHandler;
+var oop = acequire("../lib/oop");
- 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.",
+function OccurKeyboardHandler() {}
- 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 : ",
+oop.inherits(OccurKeyboardHandler, HashHandler);
- //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",
+(function() {
- //Criminal Organizations/Gangs
- SpeakersForTheDeadInfo: "It is better to reign in hell than to serve in heaven.",
+ this.isOccurHandler = true;
- DarkArmyInfo: "The World doesn't care about right or wrong. It's all about power.",
+ this.attach = function(editor) {
+ HashHandler.call(this, occurCommands, editor.commands.platform);
+ this.$editor = editor;
+ }
- TheSyndicateInfo: "Honor holds you back",
+ var handleKeyboard$super = this.handleKeyboard;
+ this.handleKeyboard = function(data, hashId, key, keyCode) {
+ var cmd = handleKeyboard$super.call(this, data, hashId, key, keyCode);
+ return (cmd && cmd.command) ? cmd : undefined;
+ }
- 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.