diff --git a/css/styles.css b/css/styles.css
index 564b9522c..7a2d26478 100644
--- a/css/styles.css
+++ b/css/styles.css
@@ -321,7 +321,7 @@ a:link, a:visited {
position: absolute; /* Stay in place */
right: 0;
top: 0;
- height: 195px; /* Full height */
+ height: 205px; /* Full height */
/*margin: 50% auto;*/
padding: 5px;
border: 2px solid var(--my-highlight-color);
diff --git a/dist/bundle.js b/dist/bundle.js
index 1b2a77dc0..725e20fa0 100644
--- a/dist/bundle.js
+++ b/dist/bundle.js
@@ -75,14 +75,14 @@
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Company_js__ = __webpack_require__(18);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Constants_js__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__ = __webpack_require__(14);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Crimes_js__ = __webpack_require__(36);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Crimes_js__ = __webpack_require__(37);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__engine_js__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Faction_js__ = __webpack_require__(10);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Gang_js__ = __webpack_require__(29);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Gang_js__ = __webpack_require__(30);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__Location_js__ = __webpack_require__(12);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__Server_js__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__SpecialServerIps_js__ = __webpack_require__(11);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__SourceFile_js__ = __webpack_require__(30);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__SourceFile_js__ = __webpack_require__(31);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__utils_decimal_js__ = __webpack_require__(25);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__utils_decimal_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_13__utils_decimal_js__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__utils_DialogBox_js__ = __webpack_require__(1);
@@ -2349,6 +2349,7 @@ let Player = new PlayerObject();
"use strict";
/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return dialogBoxCreate; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return dialogBoxOpened; });
/* Pop up Dialog Box */
let dialogBoxes = [];
@@ -2498,7 +2499,7 @@ function powerOfTwo(n) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CONSTANTS; });
let CONSTANTS = {
- Version: "0.28.6",
+ Version: "0.29.0",
//Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience
//and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then
@@ -2557,8 +2558,9 @@ let CONSTANTS = {
ScriptScpRamCost: 0.5,
ScriptKillRamCost: 0.5, //Kill and killall
ScriptHasRootAccessRamCost: 0.05,
- ScriptGetHostnameRamCost: 0.05,
- ScriptGetHackingLevelRamCost: 0.05,
+ ScriptGetHostnameRamCost: 0.05, //getHostname() and getIp()
+ ScriptGetHackingLevelRamCost: 0.05, //getHackingLevel() and getIntelligence()
+ ScriptGetMultipliersRamCost: 4.0, //getHackingMultipliers() and getBitNodeMultipliers()
ScriptGetServerCost: 0.1,
ScriptFileExistsRamCost: 0.1,
ScriptIsRunningRamCost: 0.1,
@@ -2614,9 +2616,14 @@ let CONSTANTS = {
//Intelligence-related constants
IntelligenceCrimeWeight: 0.05, //Weight for how much int affects crime success rates
IntelligenceInfiltrationWeight: 0.1, //Weight for how much int affects infiltration success rates
- IntelligenceCrimeBaseExpGain: 0.0001,
+ IntelligenceCrimeBaseExpGain: 0.0002,
IntelligenceProgramBaseExpGain: 1000, //Program required hack level divided by this to determine int exp gain
IntelligenceTerminalHackBaseExpGain: 200, //Hacking exp divided by this to determine int exp gain
+ IntelligenceSingFnBaseExpGain: 0.0005,
+
+ //Hacking Missions
+ HackingMissionRepToDiffConversion: 5000, //Faction rep is divided by this to get mission difficulty
+ HackingMissionRepToRewardConversion: 20, //Faction rep divided byt his to get mission rep reward
//Gang constants
GangRespectToReputationRatio: 2, //Respect is divided by this to get rep gain
@@ -2737,9 +2744,10 @@ let CONSTANTS = {
"encounter diminishing returns in your hacking (since you are only hacking a certain percentage). You can " +
"increase the amount of money on a server using a script and the grow() function in Netscript.
" +
"
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
" +
- "DON'T USE TPRINT() TO OUTPUT HTML ELEMENTS TO YOUR TERMINAL!!!!
" +
- "(You lost 1 HP)");
- return;
- }
- Object(__WEBPACK_IMPORTED_MODULE_17__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_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument");
- }
- var server = Object(__WEBPACK_IMPORTED_MODULE_13__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_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call nuke(). Invalid IP or hostname passed in: " + ip);
- }
- if (!__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].NukeProgram)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "You do not have the NUKE.exe virus!");
- }
- if (server.openPortCount < server.numOpenPortsRequired) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__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_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument");
- }
- var server = Object(__WEBPACK_IMPORTED_MODULE_13__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_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call brutessh(). Invalid IP or hostname passed in: " + ip);
- }
- if (!__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].BruteSSHProgram)) {
- workerScript.scriptRef.log("You do not have the BruteSSH.exe program!");
- throw Object(__WEBPACK_IMPORTED_MODULE_19__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_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument");
- }
- var server = Object(__WEBPACK_IMPORTED_MODULE_13__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_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call ftpcrack(). Invalid IP or hostname passed in: " + ip);
- }
- if (!__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].FTPCrackProgram)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__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_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument");
- }
- var server = Object(__WEBPACK_IMPORTED_MODULE_13__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_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call relaysmtp(). Invalid IP or hostname passed in: " + ip);
- }
- if (!__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__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_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument");
- }
- var server = Object(__WEBPACK_IMPORTED_MODULE_13__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_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call httpworm(). Invalid IP or hostname passed in: " + ip);
- }
- if (!__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].HTTPWormProgram)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__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_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Program call has incorrect number of arguments. Takes 1 argument");
- }
- var server = Object(__WEBPACK_IMPORTED_MODULE_13__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_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Cannot call sqlinject(). Invalid IP or hostname passed in: " + ip);
- }
- if (!__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hasProgram(__WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].SQLInjectProgram)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__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_19__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_19__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_13__Server_js__["e" /* getServer */])(workerScript.serverIp);
- if (scriptServer == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__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_19__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_19__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_19__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_13__Server_js__["e" /* getServer */])(ip);
- if (server == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Invalid hostname/ip passed into exec() command: " + ip);
- }
- return Object(__WEBPACK_IMPORTED_MODULE_19__NetscriptEvaluator_js__["e" /* runScriptFromScript */])(server, scriptname, argsForNewScript, workerScript, threads);
- },
- kill : function(filename,ip){
- if (filename === undefined || ip === undefined) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "kill() call has incorrect number of arguments. Usage: kill(scriptname, server, [arg1], [arg2]...)");
- }
- var server = Object(__WEBPACK_IMPORTED_MODULE_13__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_19__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_12__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_23__utils_HelperFunctions_js__["f" /* printArray */])(argsForKillTarget));
- return false;
- }
- var res = Object(__WEBPACK_IMPORTED_MODULE_18__NetscriptWorker_js__["d" /* killWorkerScript */])(runningScriptObj, server.ip);
- if (res) {
- workerScript.scriptRef.log("Killing " + filename + " on " + server.hostname + " with args: " + Object(__WEBPACK_IMPORTED_MODULE_23__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_23__utils_HelperFunctions_js__["f" /* printArray */])(argsForKillTarget));
- return false;
- }
- },
- killall : function(ip){
- if (ip === undefined) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "killall() call has incorrect number of arguments. Takes 1 argument");
- }
- var server = Object(__WEBPACK_IMPORTED_MODULE_13__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_19__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_18__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 || arguments.length != 2) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Error: scp() call has incorrect number of arguments. Takes 2 arguments");
- }
- var destServer = Object(__WEBPACK_IMPORTED_MODULE_13__Server_js__["e" /* getServer */])(ip);
- if (destServer == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Error: Invalid hostname/ip passed into scp() command: " + ip);
- }
- if (!scriptname.endsWith(".lit") && !scriptname.endsWith(".script")) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Error: scp() only works for .script and .lit files");
- }
-
- var currServ = Object(__WEBPACK_IMPORTED_MODULE_13__Server_js__["e" /* getServer */])(workerScript.serverIp);
- if (currServ == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Could not find server ip for this script. This is a bug please contact game developer");
- }
-
- //Scp for lit files
- if (scriptname.endsWith(".lit")) {
- var found = false;
- for (var i = 0; i < currServ.messages.length; ++i) {
- if (!(currServ.messages[i] instanceof __WEBPACK_IMPORTED_MODULE_10__Message_js__["a" /* Message */]) && currServ.messages[i] == scriptname) {
- found = true;
- }
- }
-
- if (!found) {
- workerScript.scriptRef.log(scriptname + " does not exist. scp() failed");
- return false;
- }
-
- for (var i = 0; i < destServer.messages.length; ++i) {
- if (destServer.messages[i] === scriptname) {
- workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname);
- return true; //Already exists
- }
- }
- destServer.messages.push(scriptname);
- workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname);
- return true;
- }
-
- //Scp for script files
- var sourceScript = null;
- for (var i = 0; i < currServ.scripts.length; ++i) {
- if (scriptname == currServ.scripts[i].filename) {
- sourceScript = currServ.scripts[i];
- break;
- }
- }
- if (sourceScript == null) {
- workerScript.scriptRef.log(scriptname + " does not exist. scp() failed");
- return false;
- }
-
- //Overwrite script if it already exists
- for (var i = 0; i < destServer.scripts.length; ++i) {
- if (scriptname == destServer.scripts[i].filename) {
- workerScript.scriptRef.log("WARNING: " + scriptname + " already exists on " + destServer.hostname + " and it will be overwritten.");
- workerScript.scriptRef.log(scriptname + " overwritten on " + destServer.hostname);
- var oldScript = destServer.scripts[i];
- oldScript.code = sourceScript.code;
- oldScript.ramUsage = sourceScript.ramUsage;
- return true;
- }
- }
-
- //Create new script if it does not already exist
- var newScript = new __WEBPACK_IMPORTED_MODULE_12__Script_js__["c" /* Script */]();
- newScript.filename = scriptname;
- newScript.code = sourceScript.code;
- newScript.ramUsage = sourceScript.ramUsage;
- newScript.server = destServer.ip;
- destServer.scripts.push(newScript);
- workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname);
- return true;
- },
- ls : function(ip, grep) {
- if (ip === undefined) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "ls() failed because of invalid arguments. Usage: ls(ip/hostname, [grep filter])");
- }
- var server = Object(__WEBPACK_IMPORTED_MODULE_13__Server_js__["e" /* getServer */])(ip);
- if (server === null) {
- workerScript.scriptRef.log("ls() failed. Invalid IP or hostname passed in: " + ip);
- throw Object(__WEBPACK_IMPORTED_MODULE_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "ls() failed. Invalid IP or hostname passed in: " + ip);
- }
-
- //Get the grep filter, if one exists
- var filter = false;
- if (arguments.length >= 2) {
- filter = grep.toString();
- }
-
- var allFiles = [];
- for (var i = 0; i < server.programs.length; i++) {
- if (filter) {
- if (server.programs[i].includes(filter)) {
- allFiles.push(server.programs[i]);
- }
- } else {
- allFiles.push(server.programs[i]);
- }
- }
- for (var i = 0; i < server.scripts.length; i++) {
- if (filter) {
- if (server.scripts[i].filename.includes(filter)) {
- allFiles.push(server.scripts[i].filename);
- }
- } else {
- allFiles.push(server.scripts[i].filename);
- }
-
- }
- for (var i = 0; i < server.messages.length; i++) {
- if (filter) {
- if (server.messages[i] instanceof __WEBPACK_IMPORTED_MODULE_10__Message_js__["a" /* Message */]) {
- if (server.messages[i].filename.includes(filter)) {
- allFiles.push(server.messages[i].filename);
- }
- } else if (server.messages[i].includes(filter)) {
- allFiles.push(server.messages[i]);
- }
- } else {
- if (server.messages[i] instanceof __WEBPACK_IMPORTED_MODULE_10__Message_js__["a" /* Message */]) {
- allFiles.push(server.messages[i].filename);
- } else {
- allFiles.push(server.messages[i]);
- }
- }
- }
-
- //Sort the files alphabetically then print each
- allFiles.sort();
- return allFiles;
- },
- hasRootAccess : function(ip){
- if (ip===undefined){
- throw Object(__WEBPACK_IMPORTED_MODULE_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "hasRootAccess() call has incorrect number of arguments. Takes 1 argument");
- }
- var server = Object(__WEBPACK_IMPORTED_MODULE_13__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_19__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_13__Server_js__["e" /* getServer */])(workerScript.serverIp);
- if (scriptServer == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__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_11__Player_js__["a" /* Player */].updateSkillLevels();
- workerScript.scriptRef.log("getHackingLevel() returned " + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hacking_skill);
- return __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hacking_skill;
- },
- getServerMoneyAvailable : function(ip){
- var server = Object(__WEBPACK_IMPORTED_MODULE_13__Server_js__["e" /* getServer */])(ip);
- if (server == null) {
- workerScript.scriptRef.log("getServerMoneyAvailable() failed. Invalid IP or hostname passed in: " + ip);
- throw Object(__WEBPACK_IMPORTED_MODULE_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getServerMoneyAvailable() failed. Invalid IP or hostname passed in: " + ip);
- }
- if (server.hostname == "home") {
- //Return player's money
- workerScript.scriptRef.log("getServerMoneyAvailable('home') returned player's money: $" + Object(__WEBPACK_IMPORTED_MODULE_25__utils_StringHelperFunctions_js__["c" /* formatNumber */])(__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].money.toNumber(), 2));
- return __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].money.toNumber();
- }
- workerScript.scriptRef.log("getServerMoneyAvailable() returned " + Object(__WEBPACK_IMPORTED_MODULE_25__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.moneyAvailable, 2) + " for " + server.hostname);
- return server.moneyAvailable;
- },
- getServerSecurityLevel : function(ip){
- var server = Object(__WEBPACK_IMPORTED_MODULE_13__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_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getServerSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
- }
- workerScript.scriptRef.log("getServerSecurityLevel() returned " + Object(__WEBPACK_IMPORTED_MODULE_25__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.hackDifficulty, 3) + " for " + server.hostname);
- return server.hackDifficulty;
- },
- getServerBaseSecurityLevel : function(ip){
- var server = Object(__WEBPACK_IMPORTED_MODULE_13__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_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getServerBaseSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
- }
- workerScript.scriptRef.log("getServerBaseSecurityLevel() returned " + Object(__WEBPACK_IMPORTED_MODULE_25__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.baseDifficulty, 3) + " for " + server.hostname);
- return server.baseDifficulty;
- },
- getServerRequiredHackingLevel : function(ip){
- var server = Object(__WEBPACK_IMPORTED_MODULE_13__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_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getServerRequiredHackingLevel() failed. Invalid IP or hostname passed in: " + ip);
- }
- workerScript.scriptRef.log("getServerRequiredHackingLevel returned " + Object(__WEBPACK_IMPORTED_MODULE_25__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.requiredHackingSkill, 0) + " for " + server.hostname);
- return server.requiredHackingSkill;
- },
- getServerMaxMoney : function(ip){
- var server = Object(__WEBPACK_IMPORTED_MODULE_13__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_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getServerMaxMoney() failed. Invalid IP or hostname passed in: " + ip);
- }
- workerScript.scriptRef.log("getServerMaxMoney() returned " + Object(__WEBPACK_IMPORTED_MODULE_25__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.moneyMax, 0) + " for " + server.hostname);
- return server.moneyMax;
- },
- getServerGrowth : function(ip) {
- var server = Object(__WEBPACK_IMPORTED_MODULE_13__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_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getServerGrowth() failed. Invalid IP or hostname passed in: " + ip);
- }
- workerScript.scriptRef.log("getServerGrowth() returned " + Object(__WEBPACK_IMPORTED_MODULE_25__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.serverGrowth, 0) + " for " + server.hostname);
- return server.serverGrowth;
- },
- getServerNumPortsRequired : function(ip){
- var server = Object(__WEBPACK_IMPORTED_MODULE_13__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_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getServerNumPortsRequired() failed. Invalid IP or hostname passed in: " + ip);
- }
- workerScript.scriptRef.log("getServerNumPortsRequired() returned " + Object(__WEBPACK_IMPORTED_MODULE_25__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.numOpenPortsRequired, 0) + " for " + server.hostname);
- return server.numOpenPortsRequired;
- },
- getServerRam : function(ip) {
- var server = Object(__WEBPACK_IMPORTED_MODULE_13__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_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getServerRam() failed. Invalid IP or hostname passed in: " + ip);
- }
- workerScript.scriptRef.log("getServerRam() returned [" + Object(__WEBPACK_IMPORTED_MODULE_25__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.maxRam, 2) + "GB, " + Object(__WEBPACK_IMPORTED_MODULE_25__utils_StringHelperFunctions_js__["c" /* formatNumber */])(server.ramUsed, 2) + "GB]");
- return [server.maxRam, server.ramUsed];
- },
- serverExists : function(ip) {
- return (Object(__WEBPACK_IMPORTED_MODULE_13__Server_js__["e" /* getServer */])(ip) !== null);
- },
- fileExists : function(filename,ip=workerScript.serverIp){
- if (filename === undefined) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "fileExists() call has incorrect number of arguments. Usage: fileExists(scriptname, [server])");
- }
- var server = Object(__WEBPACK_IMPORTED_MODULE_13__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_19__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_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "isRunning() call has incorrect number of arguments. Usage: isRunning(scriptname, server, [arg1], [arg2]...)");
- }
- var server = Object(__WEBPACK_IMPORTED_MODULE_13__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_19__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_12__Script_js__["d" /* findRunningScript */])(filename, argsForTargetScript, server) != null);
- },
- getNextHacknetNodeCost : __WEBPACK_IMPORTED_MODULE_8__HacknetNode_js__["b" /* getCostOfNextHacknetNode */],
- purchaseHacknetNode : __WEBPACK_IMPORTED_MODULE_8__HacknetNode_js__["d" /* purchaseHacknet */],
- getStockPrice : function(symbol) {
- if (!__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hasTixApiAccess) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use getStockPrice()");
- }
- var stock = __WEBPACK_IMPORTED_MODULE_16__StockMarket_js__["b" /* SymbolToStockMap */][symbol];
- if (stock == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Invalid stock symbol passed into getStockPrice()");
- }
- return parseFloat(stock.price.toFixed(3));
- },
- getStockPosition : function(symbol) {
- if (!__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hasTixApiAccess) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use getStockPosition()");
- }
- var stock = __WEBPACK_IMPORTED_MODULE_16__StockMarket_js__["b" /* SymbolToStockMap */][symbol];
- if (stock == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "Invalid stock symbol passed into getStockPrice()");
- }
- return [stock.playerShares, stock.playerAvgPx];
- },
- buyStock : function(symbol, shares) {
- if (!__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hasTixApiAccess) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use buyStock()");
- }
- var stock = __WEBPACK_IMPORTED_MODULE_16__StockMarket_js__["b" /* SymbolToStockMap */][symbol];
- if (stock == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__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_11__Player_js__["a" /* Player */].money.lt(totalPrice + __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].StockMarketCommission)) {
- workerScript.scriptRef.log("Not enough money to purchase " + Object(__WEBPACK_IMPORTED_MODULE_25__utils_StringHelperFunctions_js__["c" /* formatNumber */])(shares, 0) + " shares of " +
- symbol + ". Need $" +
- Object(__WEBPACK_IMPORTED_MODULE_25__utils_StringHelperFunctions_js__["c" /* formatNumber */])(totalPrice + __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].StockMarketCommission, 2).toString());
- return false;
- }
-
- var origTotal = stock.playerShares * stock.playerAvgPx;
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].loseMoney(totalPrice + __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].StockMarketCommission);
- var newTotal = origTotal + totalPrice;
- stock.playerShares += shares;
- stock.playerAvgPx = newTotal / stock.playerShares;
- if (__WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"].currentPage == __WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"].Page.StockMarket) {
- Object(__WEBPACK_IMPORTED_MODULE_16__StockMarket_js__["j" /* updateStockPlayerPosition */])(stock);
- }
- workerScript.scriptRef.log("Bought " + Object(__WEBPACK_IMPORTED_MODULE_25__utils_StringHelperFunctions_js__["c" /* formatNumber */])(shares, 0) + " shares of " + stock.symbol + " at $" +
- Object(__WEBPACK_IMPORTED_MODULE_25__utils_StringHelperFunctions_js__["c" /* formatNumber */])(stock.price, 2) + " per share");
- return true;
- },
- sellStock : function(symbol, shares) {
- if (!__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].hasTixApiAccess) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "You don't have TIX API Access! Cannot use sellStock()");
- }
- var stock = __WEBPACK_IMPORTED_MODULE_16__StockMarket_js__["b" /* SymbolToStockMap */][symbol];
- if (stock == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__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_3__Constants_js__["a" /* CONSTANTS */].StockMarketCommission;
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].gainMoney(gains);
-
- //Calculate net profit and add to script stats
- var netProfit = ((stock.price - stock.playerAvgPx) * shares) - __WEBPACK_IMPORTED_MODULE_3__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_6__engine_js__["Engine"].currentPage == __WEBPACK_IMPORTED_MODULE_6__engine_js__["Engine"].Page.StockMarket) {
- Object(__WEBPACK_IMPORTED_MODULE_16__StockMarket_js__["j" /* updateStockPlayerPosition */])(stock);
- }
- workerScript.scriptRef.log("Sold " + Object(__WEBPACK_IMPORTED_MODULE_25__utils_StringHelperFunctions_js__["c" /* formatNumber */])(shares, 0) + " shares of " + stock.symbol + " at $" +
- Object(__WEBPACK_IMPORTED_MODULE_25__utils_StringHelperFunctions_js__["c" /* formatNumber */])(stock.price, 2) + " per share. Gained " +
- "$" + Object(__WEBPACK_IMPORTED_MODULE_25__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_11__Player_js__["a" /* Player */].purchasedServers.length >= __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].PurchasedServerLimit) {
- workerScript.scriptRef.log("Error: You have reached the maximum limit of " + __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].PurchasedServerLimit +
- " servers. You cannot purchase any more.");
- return "";
- }
-
- ram = Math.round(ram);
- if (isNaN(ram) || !Object(__WEBPACK_IMPORTED_MODULE_23__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_3__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamServer;
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].money.lt(cost)) {
- workerScript.scriptRef.log("Error: Not enough money to purchase server. Need $" + Object(__WEBPACK_IMPORTED_MODULE_25__utils_StringHelperFunctions_js__["c" /* formatNumber */])(cost, 2));
- return "";
- }
- var newServ = new __WEBPACK_IMPORTED_MODULE_13__Server_js__["d" /* Server */](Object(__WEBPACK_IMPORTED_MODULE_24__utils_IPAddress_js__["a" /* createRandomIp */])(), hostnameStr, "", false, true, true, ram);
- Object(__WEBPACK_IMPORTED_MODULE_13__Server_js__["a" /* AddToAllServers */])(newServ);
-
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].purchasedServers.push(newServ.ip);
- var homeComputer = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getHomeComputer();
- homeComputer.serversOnNetwork.push(newServ.ip);
- newServ.serversOnNetwork.push(homeComputer.ip);
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].loseMoney(cost);
- workerScript.scriptRef.log("Purchased new server with hostname " + newServ.hostname + " for $" + Object(__WEBPACK_IMPORTED_MODULE_25__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_13__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_11__Player_js__["a" /* Player */].purchasedServers.length; ++i) {
- if (ip == __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].purchasedServers[i]) {
- found = true;
- __WEBPACK_IMPORTED_MODULE_11__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_13__Server_js__["b" /* AllServers */][ip];
-
- //Delete from home computer
- found = false;
- var homeComputer = __WEBPACK_IMPORTED_MODULE_11__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_19__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_18__NetscriptWorker_js__["a" /* NetscriptPorts */][portName];
- if (port == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__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_14__Settings_js__["a" /* Settings */].MaxPortCapacity) {
- port.shift();
- return true;
- }
- return false;
- } else {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__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_19__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_18__NetscriptWorker_js__["a" /* NetscriptPorts */][portName];
- if (port == null) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__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_19__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_13__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_19__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_13__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_19__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_18__NetscriptWorker_js__["d" /* killWorkerScript */])(server.runningScripts[i], server.ip);
- suc = true;
- }
- }
- return suc;
- },
- getScriptRam : function (scriptname, ip) {
- var server = Object(__WEBPACK_IMPORTED_MODULE_13__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_19__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_13__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_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getHackTime() failed. Invalid IP or hostname passed in: " + ip);
- }
- return Object(__WEBPACK_IMPORTED_MODULE_19__NetscriptEvaluator_js__["i" /* scriptCalculateHackingTime */])(server); //Returns seconds
- },
- getGrowTime : function(ip) {
- var server = Object(__WEBPACK_IMPORTED_MODULE_13__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_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getGrowTime() failed. Invalid IP or hostname passed in: " + ip);
- }
- return Object(__WEBPACK_IMPORTED_MODULE_19__NetscriptEvaluator_js__["g" /* scriptCalculateGrowTime */])(server) / 1000; //Returns seconds
- },
- getWeakenTime : function(ip) {
- var server = Object(__WEBPACK_IMPORTED_MODULE_13__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_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getWeakenTime() failed. Invalid IP or hostname passed in: " + ip);
- }
- return Object(__WEBPACK_IMPORTED_MODULE_19__NetscriptEvaluator_js__["k" /* scriptCalculateWeakenTime */])(server) / 1000; //Returns seconds
- },
- getScriptIncome : function(scriptname, ip) {
- if (arguments.length === 0) {
- //Get total script income
- return Object(__WEBPACK_IMPORTED_MODULE_0__ActiveScriptsUI_js__["d" /* updateActiveScriptsItems */])();
- } else {
- //Get income for a particular script
- var server = Object(__WEBPACK_IMPORTED_MODULE_13__Server_js__["e" /* getServer */])(ip);
- if (server === null) {
- workerScript.scriptRef.log("getScriptIncome() failed. Invalid IP or hostnamed passed in: " + ip);
- throw Object(__WEBPACK_IMPORTED_MODULE_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getScriptIncome() failed. Invalid IP or hostnamed passed in: " + ip);
- }
- var argsForScript = [];
- for (var i = 2; i < arguments.length; ++i) {
- argsForScript.push(arguments[i]);
- }
- var runningScriptObj = Object(__WEBPACK_IMPORTED_MODULE_12__Script_js__["d" /* findRunningScript */])(scriptname, argsForScript, server);
- if (runningScriptObj == null) {
- workerScript.scriptRef.log("getScriptIncome() failed. No such script "+ scriptname + " on " + server.hostname + " with args: " + Object(__WEBPACK_IMPORTED_MODULE_23__utils_HelperFunctions_js__["f" /* printArray */])(argsForScript));
- return -1;
- }
- return runningScriptObj.onlineMoneyMade / runningScriptObj.onlineRunningTime;
- }
- },
- getScriptExpGain : function(scriptname, ip) {
- if (arguments.length === 0) {
- var total = 0;
- for (var i = 0; i < __WEBPACK_IMPORTED_MODULE_18__NetscriptWorker_js__["h" /* workerScripts */].length; ++i) {
- total += (__WEBPACK_IMPORTED_MODULE_18__NetscriptWorker_js__["h" /* workerScripts */][i].scriptRef.onlineExpGained / __WEBPACK_IMPORTED_MODULE_18__NetscriptWorker_js__["h" /* workerScripts */][i].scriptRef.onlineRunningTime);
- }
- return total;
- } else {
- //Get income for a particular script
- var server = Object(__WEBPACK_IMPORTED_MODULE_13__Server_js__["e" /* getServer */])(ip);
- if (server === null) {
- workerScript.scriptRef.log("getScriptExpGain() failed. Invalid IP or hostnamed passed in: " + ip);
- throw Object(__WEBPACK_IMPORTED_MODULE_19__NetscriptEvaluator_js__["c" /* makeRuntimeRejectMsg */])(workerScript, "getScriptExpGain() failed. Invalid IP or hostnamed passed in: " + ip);
- }
- var argsForScript = [];
- for (var i = 2; i < arguments.length; ++i) {
- argsForScript.push(arguments[i]);
- }
- var runningScriptObj = Object(__WEBPACK_IMPORTED_MODULE_12__Script_js__["d" /* findRunningScript */])(scriptname, argsForScript, server);
- if (runningScriptObj == null) {
- workerScript.scriptRef.log("getScriptExpGain() failed. No such script "+ scriptname + " on " + server.hostname + " with args: " + Object(__WEBPACK_IMPORTED_MODULE_23__utils_HelperFunctions_js__["f" /* printArray */])(argsForScript));
- return -1;
- }
- return runningScriptObj.onlineExpGained / runningScriptObj.onlineRunningTime;
- }
- },
-
- /* Singularity Functions */
- universityCourse(universityName, className) {
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 1)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__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_11__Player_js__["a" /* Player */].isWorking) {
- var txt = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].singularityStopWork();
- workerScript.scriptRef.log(txt);
- }
-
- var costMult, expMult;
- switch(universityName.toLowerCase()) {
- case __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].AevumSummitUniversity.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Aevum) {
- workerScript.scriptRef.log("ERROR: You cannot study at Summit University because you are not in Aevum. universityCourse() failed");
- return false;
- }
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].AevumSummitUniversity;
- costMult = 4;
- expMult = 3;
- break;
- case __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Sector12RothmanUniversity.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Sector12) {
- workerScript.scriptRef.log("ERROR: You cannot study at Rothman University because you are not in Sector-12. universityCourse() failed");
- return false;
- }
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Sector12RothmanUniversity;
- costMult = 3;
- expMult = 2;
- break;
- case __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].VolhavenZBInstituteOfTechnology.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Volhaven) {
- workerScript.scriptRef.log("ERROR: You cannot study at ZB Institute of Technology because you are not in Volhaven. universityCourse() failed");
- return false;
- }
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].VolhavenZBInstituteOfTechnology;
- costMult = 5;
- expMult = 4;
- break;
- default:
- workerScript.scriptRef.log("Invalid university name: " + universityName + ". universityCourse() failed");
- return false;
- }
-
- var task;
- switch(className.toLowerCase()) {
- case "Study Computer Science".toLowerCase():
- task = __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].ClassStudyComputerScience;
- break;
- case "Data Structures".toLowerCase():
- task = __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].ClassDataStructures;
- break;
- case "Networks".toLowerCase():
- task = __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].ClassNetworks;
- break;
- case "Algorithms".toLowerCase():
- task = __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].ClassAlgorithms;
- break;
- case "Management".toLowerCase():
- task = __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].ClassManagement;
- break;
- case "Leadership".toLowerCase():
- task = __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].ClassLeadership;
- break;
- default:
- workerScript.scriptRef.log("Invalid class name: " + className + ". universityCourse() failed");
- return false;
- }
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].startClass(costMult, expMult, task);
- workerScript.scriptRef.log("Started " + task + " at " + universityName);
- return true;
- },
-
- gymWorkout(gymName, stat) {
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 1)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__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_11__Player_js__["a" /* Player */].isWorking) {
- var txt = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].singularityStopWork();
- workerScript.scriptRef.log(txt);
- }
- var costMult, expMult;
- switch(gymName.toLowerCase()) {
- case __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].AevumCrushFitnessGym.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Aevum) {
- workerScript.scriptRef.log("ERROR: You cannot workout at Crush Fitness because you are not in Aevum. gymWorkout() failed");
- return false;
- }
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].AevumCrushFitnessGym;
- costMult = 2;
- expMult = 1.5;
- break;
- case __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].AevumSnapFitnessGym.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Aevum) {
- workerScript.scriptRef.log("ERROR: You cannot workout at Snap Fitness because you are not in Aevum. gymWorkout() failed");
- return false;
- }
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].AevumSnapFitnessGym;
- costMult = 6;
- expMult = 4;
- break;
- case __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Sector12IronGym.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Sector12) {
- workerScript.scriptRef.log("ERROR: You cannot workout at Iron Gym because you are not in Sector-12. gymWorkout() failed");
- return false;
- }
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Sector12IronGym;
- costMult = 1;
- expMult = 1;
- break;
- case __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Sector12PowerhouseGym.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Sector12) {
- workerScript.scriptRef.log("ERROR: You cannot workout at Powerhouse Gym because you are not in Sector-12. gymWorkout() failed");
- return false;
- }
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Sector12PowerhouseGym;
- costMult = 10;
- expMult = 7.5;
- break;
- case __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].VolhavenMilleniumFitnessGym:
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].city != __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Volhaven) {
- workerScript.scriptRef.log("ERROR: You cannot workout at Millenium Fitness Gym because you are not in Volhaven. gymWorkout() failed");
- return false;
- }
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].location = __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].VolhavenMilleniumFitnessGym;
- costMult = 3;
- expMult = 2.5;
- break;
- default:
- workerScript.scriptRef.log("Invalid gym name: " + gymName + ". gymWorkout() failed");
- return false;
- }
-
- switch(stat.toLowerCase()) {
- case "strength".toLowerCase():
- case "str".toLowerCase():
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].ClassGymStrength);
- break;
- case "defense".toLowerCase():
- case "def".toLowerCase():
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].ClassGymDefense);
- break;
- case "dexterity".toLowerCase():
- case "dex".toLowerCase():
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].ClassGymDexterity);
- break;
- case "agility".toLowerCase():
- case "agi".toLowerCase():
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].startClass(costMult, expMult, __WEBPACK_IMPORTED_MODULE_3__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_11__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 1)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__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_9__Location_js__["a" /* Locations */].Aevum:
- case __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Chongqing:
- case __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Sector12:
- case __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].NewTokyo:
- case __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Ishima:
- case __WEBPACK_IMPORTED_MODULE_9__Location_js__["a" /* Locations */].Volhaven:
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].loseMoney(200000);
- __WEBPACK_IMPORTED_MODULE_11__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_11__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 1)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__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_15__SpecialServerIps_js__["a" /* SpecialServerIps */]["Darkweb Server"] != null) {
- workerScript.scriptRef.log("You already have a TOR router! purchaseTor() failed");
- return false;
- }
-
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].money.lt(__WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].TorRouterCost)) {
- workerScript.scriptRef.log("ERROR: You cannot afford to purchase a Tor router. purchaseTor() failed");
- return false;
- }
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].loseMoney(__WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].TorRouterCost);
-
- var darkweb = new __WEBPACK_IMPORTED_MODULE_13__Server_js__["d" /* Server */](Object(__WEBPACK_IMPORTED_MODULE_24__utils_IPAddress_js__["a" /* createRandomIp */])(), "darkweb", "", false, false, false, 1);
- Object(__WEBPACK_IMPORTED_MODULE_13__Server_js__["a" /* AddToAllServers */])(darkweb);
- __WEBPACK_IMPORTED_MODULE_15__SpecialServerIps_js__["a" /* SpecialServerIps */].addIp("Darkweb Server", darkweb.ip);
-
- document.getElementById("location-purchase-tor").setAttribute("class", "a-link-button-inactive");
-
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getHomeComputer().serversOnNetwork.push(darkweb.ip);
- darkweb.serversOnNetwork.push(__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getHomeComputer().ip);
- workerScript.scriptRef.log("You have purchased a Tor router!");
- return true;
- },
- purchaseProgram(programName) {
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 1)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__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_15__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_4__CreateProgram_js__["a" /* Programs */].BruteSSHProgram.toLowerCase():
- var price = Object(__WEBPACK_IMPORTED_MODULE_5__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_5__DarkWeb_js__["a" /* DarkWebItems */].BruteSSHProgram);
- if (price > 0 && __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].money.gt(price)) {
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].loseMoney(price);
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].BruteSSHProgram);
- workerScript.scriptRef.log("You have purchased the BruteSSH.exe program. The new program " +
- "can be found on your home computer.");
- } else {
- workerScript.scriptRef.log("Not enough money to purchase " + programName);
- return false;
- }
- return true;
- case __WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].FTPCrackProgram.toLowerCase():
- var price = Object(__WEBPACK_IMPORTED_MODULE_5__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_5__DarkWeb_js__["a" /* DarkWebItems */].FTPCrackProgram);
- if (price > 0 && __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].money.gt(price)) {
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].loseMoney(price);
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].FTPCrackProgram);
- workerScript.scriptRef.log("You have purchased the FTPCrack.exe program. The new program " +
- "can be found on your home computer.");
- } else {
- workerScript.scriptRef.log("Not enough money to purchase " + programName);
- return false;
- }
- return true;
- case __WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram.toLowerCase():
- var price = Object(__WEBPACK_IMPORTED_MODULE_5__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_5__DarkWeb_js__["a" /* DarkWebItems */].RelaySMTPProgram);
- if (price > 0 && __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].money.gt(price)) {
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].loseMoney(price);
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram);
- workerScript.scriptRef.log("You have purchased the relaySMTP.exe program. The new program " +
- "can be found on your home computer.");
- } else {
- workerScript.scriptRef.log("Not enough money to purchase " + programName);
- return false;
- }
- return true;
- case __WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].HTTPWormProgram.toLowerCase():
- var price = Object(__WEBPACK_IMPORTED_MODULE_5__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_5__DarkWeb_js__["a" /* DarkWebItems */].HTTPWormProgram);
- if (price > 0 && __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].money.gt(price)) {
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].loseMoney(price);
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].HTTPWormProgram);
- workerScript.scriptRef.log("You have purchased the HTTPWorm.exe program. The new program " +
- "can be found on your home computer.");
- } else {
- workerScript.scriptRef.log("Not enough money to purchase " + programName);
- return false;
- }
- return true;
- case __WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].SQLInjectProgram.toLowerCase():
- var price = Object(__WEBPACK_IMPORTED_MODULE_5__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_5__DarkWeb_js__["a" /* DarkWebItems */].SQLInjectProgram);
- if (price > 0 && __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].money.gt(price)) {
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].loseMoney(price);
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].SQLInjectProgram);
- workerScript.scriptRef.log("You have purchased the SQLInject.exe program. The new program " +
- "can be found on your home computer.");
- } else {
- workerScript.scriptRef.log("Not enough money to purchase " + programName);
- return false;
- }
- return true;
- case __WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].DeepscanV1.toLowerCase():
- var price = Object(__WEBPACK_IMPORTED_MODULE_5__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_5__DarkWeb_js__["a" /* DarkWebItems */].DeepScanV1Program);
- if (price > 0 && __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].money.gt(price)) {
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].loseMoney(price);
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].DeepscanV1);
- workerScript.scriptRef.log("You have purchased the DeepscanV1.exe program. The new program " +
- "can be found on your home computer.");
- } else {
- workerScript.scriptRef.log("Not enough money to purchase " + programName);
- return false;
- }
- return true;
- case __WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].DeepscanV2.toLowerCase():
- var price = Object(__WEBPACK_IMPORTED_MODULE_5__DarkWeb_js__["d" /* parseDarkwebItemPrice */])(__WEBPACK_IMPORTED_MODULE_5__DarkWeb_js__["a" /* DarkWebItems */].DeepScanV2Program);
- if (price > 0 && __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].money.gt(price)) {
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].loseMoney(price);
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].getHomeComputer().programs.push(__WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].DeepscanV2);
- workerScript.scriptRef.log("You have purchased the DeepscanV2.exe program. The new program " +
- "can be found on your home computer.");
- } else {
- workerScript.scriptRef.log("Not enough money to purchase " + programName);
- return false;
- }
- return true;
- default:
- workerScript.scriptRef.log("ERROR: Invalid program passed into purchaseProgram().");
- return false;
- }
- return true;
- },
- upgradeHomeRam() {
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 2)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__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_11__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_3__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamHome;
- var mult = Math.pow(1.55, numUpgrades);
- cost = cost * mult;
-
- if (__WEBPACK_IMPORTED_MODULE_11__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_11__Player_js__["a" /* Player */].getHomeComputer();
- homeComputer.maxRam *= 2;
-
- __WEBPACK_IMPORTED_MODULE_11__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_11__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 2)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__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_11__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_3__Constants_js__["a" /* CONSTANTS */].BaseCostFor1GBOfRamHome;
- var mult = Math.pow(1.55, numUpgrades);
- return cost * mult;
- },
- workForCompany() {
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 2)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__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_11__Player_js__["a" /* Player */].companyPosition == "" || !(__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].companyPosition instanceof __WEBPACK_IMPORTED_MODULE_2__Company_js__["c" /* CompanyPosition */])) {
- workerScript.scriptRef.log("ERROR: workForCompany() failed because you do not have a job");
- return false;
- }
-
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].isWorking) {
- var txt = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].singularityStopWork();
- workerScript.scriptRef.log(txt);
- }
-
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].companyPosition.isPartTimeJob()) {
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].startWorkPartTime();
- } else {
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].startWork();
- }
- workerScript.scriptRef.log("Began working at " + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].companyName + " as a " + __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].companyPosition.positionName);
- return true;
- },
- applyToCompany(companyName, field) {
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 2)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__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_2__Company_js__["e" /* companyExists */])(companyName)) {
- workerScript.scriptRef.log("ERROR: applyToCompany() failed because specified company " + companyName + " does not exist.");
- return false;
- }
-
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].location = companyName;
- var res;
- switch (field.toLowerCase()) {
- case "software":
- res = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].applyForSoftwareJob(true);
- break;
- case "software consultant":
- res = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].applyForSoftwareConsultantJob(true);
- break;
- case "it":
- res = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].applyForItJob(true);
- break;
- case "security engineer":
- res = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].applyForSecurityEngineerJob(true);
- break;
- case "network engineer":
- res = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].applyForNetworkEngineerJob(true);
- break;
- case "business":
- res = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].applyForBusinessJob(true);
- break;
- case "business consultant":
- res = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].applyForBusinessConsultantJob(true);
- break;
- case "security":
- res = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].applyForSecurityJob(true);
- break;
- case "agent":
- res = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].applyForAgentJob(true);
- break;
- case "employee":
- res = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].applyForEmployeeJob(true);
- break;
- case "part-time employee":
- res = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].applyForPartTimeEmployeeJob(true);
- break;
- case "waiter":
- res = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].applyForWaiterJob(true);
- break;
- case "part-time waiter":
- res = __WEBPACK_IMPORTED_MODULE_11__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_25__utils_StringHelperFunctions_js__["f" /* isString */])(res)) {
- workerScript.scriptRef.log(res);
- return false;
- }
- if (res) {
- workerScript.scriptRef.log("You were offered a new job at " + companyName + " as a " + __WEBPACK_IMPORTED_MODULE_11__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_11__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 2)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__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_2__Company_js__["a" /* Companies */][companyName];
- if (company === null || !(company instanceof __WEBPACK_IMPORTED_MODULE_2__Company_js__["b" /* Company */])) {
- workerScript.scriptRef.log("ERROR: Invalid companyName passed into getCompanyRep(): " + companyName);
- return -1;
- }
- return company.playerReputation;
- },
- checkFactionInvitations() {
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 2)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__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_11__Player_js__["a" /* Player */].factionInvitations.slice();
- },
- joinFaction(name) {
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 2)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__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_7__Faction_js__["d" /* factionExists */])(name)) {
- workerScript.scriptRef.log("ERROR: Faction specified in joinFaction() does not exist.");
- return false;
- }
-
- if (!__WEBPACK_IMPORTED_MODULE_11__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_11__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_11__Player_js__["a" /* Player */].factionInvitations.splice(index, 1);
- var fac = __WEBPACK_IMPORTED_MODULE_7__Faction_js__["b" /* Factions */][name];
- Object(__WEBPACK_IMPORTED_MODULE_7__Faction_js__["h" /* joinFaction */])(fac);
- workerScript.scriptRef.log("Joined the " + name + " faction.");
- return true;
- },
- workForFaction(name, type) {
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 2)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__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_7__Faction_js__["d" /* factionExists */])(name)) {
- workerScript.scriptRef.log("ERROR: Faction specified in workForFaction() does not exist.");
- return false;
- }
-
- if (!__WEBPACK_IMPORTED_MODULE_11__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_11__Player_js__["a" /* Player */].isWorking) {
- var txt = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].singularityStopWork();
- workerScript.scriptRef.log(txt);
- }
-
- var fac = __WEBPACK_IMPORTED_MODULE_7__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_11__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_11__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_11__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_11__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 2)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__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_7__Faction_js__["d" /* factionExists */])(name)) {
- workerScript.scriptRef.log("ERROR: Faction specified in getFactionRep() does not exist.");
- return -1;
- }
-
- return __WEBPACK_IMPORTED_MODULE_7__Faction_js__["b" /* Factions */][name].playerReputation;
- },
- createProgram(name) {
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 3)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__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_11__Player_js__["a" /* Player */].isWorking) {
- var txt = __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].singularityStopWork();
- workerScript.scriptRef.log(txt);
- }
-
- switch(name.toLowerCase()) {
- case __WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].NukeProgram.toLowerCase():
- __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].NukeProgram, __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].MillisecondsPerFiveMinutes, 1);
- break;
- case __WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].BruteSSHProgram.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_11__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_11__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].BruteSSHProgram, __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].MillisecondsPerFiveMinutes * 2, 50);
- break;
- case __WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].FTPCrackProgram.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_11__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_11__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].FTPCrackProgram, __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].MillisecondsPerHalfHour, 100);
- break;
- case __WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_11__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_11__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].RelaySMTPProgram, __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].MillisecondsPer2Hours, 250);
- break;
- case __WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].HTTPWormProgram.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_11__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_11__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].HTTPWormProgram, __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].MillisecondsPer4Hours, 500);
- break;
- case __WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].SQLInjectProgram.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_11__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_11__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].SQLInjectProgram, __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].MillisecondsPer8Hours, 750);
- break;
- case __WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].DeepscanV1.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_11__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_11__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].DeepscanV1, __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].MillisecondsPerQuarterHour, 75);
- break;
- case __WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].DeepscanV2.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_11__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_11__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].DeepscanV2, __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].MillisecondsPer2Hours, 400);
- break;
- case __WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].ServerProfiler.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_11__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_11__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].ServerProfiler, __WEBPACK_IMPORTED_MODULE_3__Constants_js__["a" /* CONSTANTS */].MillisecondsPerHalfHour, 75);
- break;
- case __WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].AutoLink.toLowerCase():
- if (__WEBPACK_IMPORTED_MODULE_11__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_11__Player_js__["a" /* Player */].startCreateProgramWork(__WEBPACK_IMPORTED_MODULE_4__CreateProgram_js__["a" /* Programs */].AutoLink, __WEBPACK_IMPORTED_MODULE_3__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_11__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 3)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__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_1__Augmentations_js__["f" /* augmentationExists */])(name)) {
- workerScript.scriptRef.log("ERROR: getAugmentationCost() failed. Invalid Augmentation name passed in (note: this is case-sensitive): " + name);
- return [-1, -1];
- }
-
- var aug = __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["c" /* Augmentations */][name];
- return [aug.baseRepRequirement, aug.baseCost];
- },
- purchaseAugmentation(faction, name) {
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 3)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__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_7__Faction_js__["b" /* Factions */][faction];
- if (fac === null || !(fac instanceof __WEBPACK_IMPORTED_MODULE_7__Faction_js__["a" /* Faction */])) {
- workerScript.scriptRef.log("ERROR: purchaseAugmentation() failed because of invalid faction name: " + faction);
- return false;
- }
-
- if (!fac.augmentations.includes(name)) {
- workerScript.scriptRef.log("ERROR: purchaseAugmentation() failed because the faction " + faction + " does not contain the " + name + " augmentation");
- return false;
- }
-
- var aug = __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["c" /* Augmentations */][name];
- if (aug === null || !(aug instanceof __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["a" /* Augmentation */])) {
- workerScript.scriptRef.log("ERROR: purchaseAugmentation() failed because of invalid augmentation name: " + name);
- return false;
- }
-
- var isNeuroflux = false;
- if (aug.name === __WEBPACK_IMPORTED_MODULE_1__Augmentations_js__["b" /* AugmentationNames */].NeuroFluxGovernor) {
- isNeuroflux = true;
- }
-
- if (!isNeuroflux) {
- for (var j = 0; j < __WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].queuedAugmentations.length; ++j) {
- if (__WEBPACK_IMPORTED_MODULE_11__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_11__Player_js__["a" /* Player */].augmentations.length; ++j) {
- if (__WEBPACK_IMPORTED_MODULE_11__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_7__Faction_js__["k" /* purchaseAugmentation */])(aug, fac, true);
- workerScript.scriptRef.log(res);
- if (Object(__WEBPACK_IMPORTED_MODULE_25__utils_StringHelperFunctions_js__["f" /* isString */])(res) && res.startsWith("You purchased")) {
- return true;
- } else {
- return false;
- }
- },
- installAugmentations() {
- if (__WEBPACK_IMPORTED_MODULE_11__Player_js__["a" /* Player */].bitNodeN != 4) {
- if (!(hasSingularitySF && singularitySFLvl >= 3)) {
- throw Object(__WEBPACK_IMPORTED_MODULE_19__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_11__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_1__Augmentations_js__["h" /* installAugmentations */])();
- return true;
- }
- }
-}
-
-
-
-
-/***/ }),
-/* 36 */
+/* 37 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -37054,7 +38068,7 @@ function determineCrimeChanceHeist() {
/***/ }),
-/* 37 */
+/* 38 */
/***/ (function(module, exports) {
module.exports = function() {
@@ -37063,14 +38077,14 @@ module.exports = function() {
/***/ }),
-/* 38 */
+/* 39 */
/***/ (function(module, exports) {
module.exports.id = 'ace/mode/javascript_worker';
module.exports.src = "\"no use strict\";(function(window){function resolveModuleId(id,paths){for(var testPath=id,tail=\"\";testPath;){var alias=paths[testPath];if(\"string\"==typeof alias)return alias+tail;if(alias)return alias.location.replace(/\\/*$/,\"/\")+(tail||alias.main||alias.name);if(alias===!1)return\"\";var i=testPath.lastIndexOf(\"/\");if(-1===i)break;tail=testPath.substr(i)+tail,testPath=testPath.slice(0,i)}return id}if(!(void 0!==window.window&&window.document||window.acequire&&window.define)){window.console||(window.console=function(){var msgs=Array.prototype.slice.call(arguments,0);postMessage({type:\"log\",data:msgs})},window.console.error=window.console.warn=window.console.log=window.console.trace=window.console),window.window=window,window.ace=window,window.onerror=function(message,file,line,col,err){postMessage({type:\"error\",data:{message:message,data:err.data,file:file,line:line,col:col,stack:err.stack}})},window.normalizeModule=function(parentId,moduleName){if(-1!==moduleName.indexOf(\"!\")){var chunks=moduleName.split(\"!\");return window.normalizeModule(parentId,chunks[0])+\"!\"+window.normalizeModule(parentId,chunks[1])}if(\".\"==moduleName.charAt(0)){var base=parentId.split(\"/\").slice(0,-1).join(\"/\");for(moduleName=(base?base+\"/\":\"\")+moduleName;-1!==moduleName.indexOf(\".\")&&previous!=moduleName;){var previous=moduleName;moduleName=moduleName.replace(/^\\.\\//,\"\").replace(/\\/\\.\\//,\"/\").replace(/[^\\/]+\\/\\.\\.\\//,\"\")}}return moduleName},window.acequire=function acequire(parentId,id){if(id||(id=parentId,parentId=null),!id.charAt)throw Error(\"worker.js acequire() accepts only (parentId, id) as arguments\");id=window.normalizeModule(parentId,id);var module=window.acequire.modules[id];if(module)return module.initialized||(module.initialized=!0,module.exports=module.factory().exports),module.exports;if(!window.acequire.tlns)return console.log(\"unable to load \"+id);var path=resolveModuleId(id,window.acequire.tlns);return\".js\"!=path.slice(-3)&&(path+=\".js\"),window.acequire.id=id,window.acequire.modules[id]={},importScripts(path),window.acequire(parentId,id)},window.acequire.modules={},window.acequire.tlns={},window.define=function(id,deps,factory){if(2==arguments.length?(factory=deps,\"string\"!=typeof id&&(deps=id,id=window.acequire.id)):1==arguments.length&&(factory=id,deps=[],id=window.acequire.id),\"function\"!=typeof factory)return window.acequire.modules[id]={exports:factory,initialized:!0},void 0;deps.length||(deps=[\"require\",\"exports\",\"module\"]);var req=function(childId){return window.acequire(id,childId)};window.acequire.modules[id]={exports:{},factory:function(){var module=this,returnExports=factory.apply(this,deps.map(function(dep){switch(dep){case\"require\":return req;case\"exports\":return module.exports;case\"module\":return module;default:return req(dep)}}));return returnExports&&(module.exports=returnExports),module}}},window.define.amd={},acequire.tlns={},window.initBaseUrls=function(topLevelNamespaces){for(var i in topLevelNamespaces)acequire.tlns[i]=topLevelNamespaces[i]},window.initSender=function(){var EventEmitter=window.acequire(\"ace/lib/event_emitter\").EventEmitter,oop=window.acequire(\"ace/lib/oop\"),Sender=function(){};return function(){oop.implement(this,EventEmitter),this.callback=function(data,callbackId){postMessage({type:\"call\",id:callbackId,data:data})},this.emit=function(name,data){postMessage({type:\"event\",name:name,data:data})}}.call(Sender.prototype),new Sender};var main=window.main=null,sender=window.sender=null;window.onmessage=function(e){var msg=e.data;if(msg.event&&sender)sender._signal(msg.event,msg.data);else if(msg.command)if(main[msg.command])main[msg.command].apply(main,msg.args);else{if(!window[msg.command])throw Error(\"Unknown command:\"+msg.command);window[msg.command].apply(window,msg.args)}else if(msg.init){window.initBaseUrls(msg.tlns),acequire(\"ace/lib/es5-shim\"),sender=window.sender=window.initSender();var clazz=acequire(msg.module)[msg.classname];main=window.main=new clazz(sender)}}}})(this),ace.define(\"ace/lib/oop\",[\"require\",\"exports\",\"module\"],function(acequire,exports){\"use strict\";exports.inherits=function(ctor,superCtor){ctor.super_=superCtor,ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:!1,writable:!0,configurable:!0}})},exports.mixin=function(obj,mixin){for(var key in mixin)obj[key]=mixin[key];return obj},exports.implement=function(proto,mixin){exports.mixin(proto,mixin)}}),ace.define(\"ace/range\",[\"require\",\"exports\",\"module\"],function(acequire,exports){\"use strict\";var comparePoints=function(p1,p2){return p1.row-p2.row||p1.column-p2.column},Range=function(startRow,startColumn,endRow,endColumn){this.start={row:startRow,column:startColumn},this.end={row:endRow,column:endColumn}};(function(){this.isEqual=function(range){return this.start.row===range.start.row&&this.end.row===range.end.row&&this.start.column===range.start.column&&this.end.column===range.end.column},this.toString=function(){return\"Range: [\"+this.start.row+\"/\"+this.start.column+\"] -> [\"+this.end.row+\"/\"+this.end.column+\"]\"},this.contains=function(row,column){return 0==this.compare(row,column)},this.compareRange=function(range){var cmp,end=range.end,start=range.start;return cmp=this.compare(end.row,end.column),1==cmp?(cmp=this.compare(start.row,start.column),1==cmp?2:0==cmp?1:0):-1==cmp?-2:(cmp=this.compare(start.row,start.column),-1==cmp?-1:1==cmp?42:0)},this.comparePoint=function(p){return this.compare(p.row,p.column)},this.containsRange=function(range){return 0==this.comparePoint(range.start)&&0==this.comparePoint(range.end)},this.intersects=function(range){var cmp=this.compareRange(range);return-1==cmp||0==cmp||1==cmp},this.isEnd=function(row,column){return this.end.row==row&&this.end.column==column},this.isStart=function(row,column){return this.start.row==row&&this.start.column==column},this.setStart=function(row,column){\"object\"==typeof row?(this.start.column=row.column,this.start.row=row.row):(this.start.row=row,this.start.column=column)},this.setEnd=function(row,column){\"object\"==typeof row?(this.end.column=row.column,this.end.row=row.row):(this.end.row=row,this.end.column=column)},this.inside=function(row,column){return 0==this.compare(row,column)?this.isEnd(row,column)||this.isStart(row,column)?!1:!0:!1},this.insideStart=function(row,column){return 0==this.compare(row,column)?this.isEnd(row,column)?!1:!0:!1},this.insideEnd=function(row,column){return 0==this.compare(row,column)?this.isStart(row,column)?!1:!0:!1},this.compare=function(row,column){return this.isMultiLine()||row!==this.start.row?this.start.row>row?-1:row>this.end.row?1:this.start.row===row?column>=this.start.column?0:-1:this.end.row===row?this.end.column>=column?0:1:0:this.start.column>column?-1:column>this.end.column?1:0},this.compareStart=function(row,column){return this.start.row==row&&this.start.column==column?-1:this.compare(row,column)},this.compareEnd=function(row,column){return this.end.row==row&&this.end.column==column?1:this.compare(row,column)},this.compareInside=function(row,column){return this.end.row==row&&this.end.column==column?1:this.start.row==row&&this.start.column==column?-1:this.compare(row,column)},this.clipRows=function(firstRow,lastRow){if(this.end.row>lastRow)var end={row:lastRow+1,column:0};else if(firstRow>this.end.row)var end={row:firstRow,column:0};if(this.start.row>lastRow)var start={row:lastRow+1,column:0};else if(firstRow>this.start.row)var start={row:firstRow,column:0};return Range.fromPoints(start||this.start,end||this.end)},this.extend=function(row,column){var cmp=this.compare(row,column);if(0==cmp)return this;if(-1==cmp)var start={row:row,column:column};else var end={row:row,column:column};return Range.fromPoints(start||this.start,end||this.end)},this.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},this.isMultiLine=function(){return this.start.row!==this.end.row},this.clone=function(){return Range.fromPoints(this.start,this.end)},this.collapseRows=function(){return 0==this.end.column?new Range(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new Range(this.start.row,0,this.end.row,0)},this.toScreenRange=function(session){var screenPosStart=session.documentToScreenPosition(this.start),screenPosEnd=session.documentToScreenPosition(this.end);return new Range(screenPosStart.row,screenPosStart.column,screenPosEnd.row,screenPosEnd.column)},this.moveBy=function(row,column){this.start.row+=row,this.start.column+=column,this.end.row+=row,this.end.column+=column}}).call(Range.prototype),Range.fromPoints=function(start,end){return new Range(start.row,start.column,end.row,end.column)},Range.comparePoints=comparePoints,Range.comparePoints=function(p1,p2){return p1.row-p2.row||p1.column-p2.column},exports.Range=Range}),ace.define(\"ace/apply_delta\",[\"require\",\"exports\",\"module\"],function(acequire,exports){\"use strict\";exports.applyDelta=function(docLines,delta){var row=delta.start.row,startColumn=delta.start.column,line=docLines[row]||\"\";switch(delta.action){case\"insert\":var lines=delta.lines;if(1===lines.length)docLines[row]=line.substring(0,startColumn)+delta.lines[0]+line.substring(startColumn);else{var args=[row,1].concat(delta.lines);docLines.splice.apply(docLines,args),docLines[row]=line.substring(0,startColumn)+docLines[row],docLines[row+delta.lines.length-1]+=line.substring(startColumn)}break;case\"remove\":var endColumn=delta.end.column,endRow=delta.end.row;row===endRow?docLines[row]=line.substring(0,startColumn)+line.substring(endColumn):docLines.splice(row,endRow-row+1,line.substring(0,startColumn)+docLines[endRow].substring(endColumn))}}}),ace.define(\"ace/lib/event_emitter\",[\"require\",\"exports\",\"module\"],function(acequire,exports){\"use strict\";var EventEmitter={},stopPropagation=function(){this.propagationStopped=!0},preventDefault=function(){this.defaultPrevented=!0};EventEmitter._emit=EventEmitter._dispatchEvent=function(eventName,e){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var listeners=this._eventRegistry[eventName]||[],defaultHandler=this._defaultHandlers[eventName];if(listeners.length||defaultHandler){\"object\"==typeof e&&e||(e={}),e.type||(e.type=eventName),e.stopPropagation||(e.stopPropagation=stopPropagation),e.preventDefault||(e.preventDefault=preventDefault),listeners=listeners.slice();for(var i=0;listeners.length>i&&(listeners[i](e,this),!e.propagationStopped);i++);return defaultHandler&&!e.defaultPrevented?defaultHandler(e,this):void 0}},EventEmitter._signal=function(eventName,e){var listeners=(this._eventRegistry||{})[eventName];if(listeners){listeners=listeners.slice();for(var i=0;listeners.length>i;i++)listeners[i](e,this)}},EventEmitter.once=function(eventName,callback){var _self=this;callback&&this.addEventListener(eventName,function newCallback(){_self.removeEventListener(eventName,newCallback),callback.apply(null,arguments)})},EventEmitter.setDefaultHandler=function(eventName,callback){var handlers=this._defaultHandlers;if(handlers||(handlers=this._defaultHandlers={_disabled_:{}}),handlers[eventName]){var old=handlers[eventName],disabled=handlers._disabled_[eventName];disabled||(handlers._disabled_[eventName]=disabled=[]),disabled.push(old);var i=disabled.indexOf(callback);-1!=i&&disabled.splice(i,1)}handlers[eventName]=callback},EventEmitter.removeDefaultHandler=function(eventName,callback){var handlers=this._defaultHandlers;if(handlers){var disabled=handlers._disabled_[eventName];if(handlers[eventName]==callback)handlers[eventName],disabled&&this.setDefaultHandler(eventName,disabled.pop());else if(disabled){var i=disabled.indexOf(callback);-1!=i&&disabled.splice(i,1)}}},EventEmitter.on=EventEmitter.addEventListener=function(eventName,callback,capturing){this._eventRegistry=this._eventRegistry||{};var listeners=this._eventRegistry[eventName];return listeners||(listeners=this._eventRegistry[eventName]=[]),-1==listeners.indexOf(callback)&&listeners[capturing?\"unshift\":\"push\"](callback),callback},EventEmitter.off=EventEmitter.removeListener=EventEmitter.removeEventListener=function(eventName,callback){this._eventRegistry=this._eventRegistry||{};var listeners=this._eventRegistry[eventName];if(listeners){var index=listeners.indexOf(callback);-1!==index&&listeners.splice(index,1)}},EventEmitter.removeAllListeners=function(eventName){this._eventRegistry&&(this._eventRegistry[eventName]=[])},exports.EventEmitter=EventEmitter}),ace.define(\"ace/anchor\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/event_emitter\"],function(acequire,exports){\"use strict\";var oop=acequire(\"./lib/oop\"),EventEmitter=acequire(\"./lib/event_emitter\").EventEmitter,Anchor=exports.Anchor=function(doc,row,column){this.$onChange=this.onChange.bind(this),this.attach(doc),column===void 0?this.setPosition(row.row,row.column):this.setPosition(row,column)};(function(){function $pointsInOrder(point1,point2,equalPointsInOrder){var bColIsAfter=equalPointsInOrder?point1.column<=point2.column:point1.column
" +
sourceFile.name + "
" + sourceFile.info);
}
@@ -37969,7 +38986,7 @@ function loadBitVerse(destroyedBitNodeNum) {
var elemId = "bitnode-" + i.toString();
var elem = Object(__WEBPACK_IMPORTED_MODULE_7__utils_HelperFunctions_js__["b" /* clearEventListeners */])(elemId);
if (elem == null) {return;}
- if (i === 1 || i === 2 || i === 4 || i === 11) {
+ if (i === 1 || i === 2 || i === 4 || i === 5 || i === 11) {
elem.addEventListener("click", function() {
var bitNodeKey = "BitNode" + i;
var bitNode = __WEBPACK_IMPORTED_MODULE_0__BitNode_js__["b" /* BitNodes */][bitNodeKey];
@@ -38083,821 +39100,6 @@ function createBitNodeYesNoEventListeners(newBitNode, destroyedBitNode) {
/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(8)))
-/***/ }),
-/* 43 */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return makeRuntimeRejectMsg; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return netscriptDelay; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return runScriptFromScript; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return scriptCalculateHackingChance; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return scriptCalculateHackingTime; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return scriptCalculateExpGain; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return scriptCalculatePercentMoneyHacked; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return scriptCalculateGrowTime; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return scriptCalculateWeakenTime; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return evaluate; });
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return isScriptErrorMessage; });
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__BitNode_js__ = __webpack_require__(9);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Constants_js__ = __webpack_require__(3);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Player_js__ = __webpack_require__(0);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__NetscriptEnvironment_js__ = __webpack_require__(28);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__ = __webpack_require__(15);
-/* 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__Script_js__ = __webpack_require__(19);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_HelperFunctions_js__ = __webpack_require__(2);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_IPAddress_js__ = __webpack_require__(16);
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_StringHelperFunctions_js__ = __webpack_require__(5);
-
-
-
-
-
-
-
-
-
-
-
-
-
-/* Evaluator
- * Evaluates/Interprets the Abstract Syntax Tree generated by Acorns parser
- *
- * Returns a promise
- */
-function evaluate(exp, workerScript) {
- return new Promise(function(resolve, reject) {
- var env = workerScript.env;
- if (env.stopFlag) {return reject(workerScript);}
- if (exp == null) {
- return reject(makeRuntimeRejectMsg(workerScript, "Error: NULL expression"));
- }
- setTimeout(function() {
- if (env.stopFlag) {return reject(workerScript);}
- switch (exp.type) {
- case "BlockStatement":
- case "Program":
- var evaluateProgPromise = evaluateProg(exp, workerScript, 0); //TODO: make every block/program use individual enviroment
- evaluateProgPromise.then(function(w) {
- resolve(workerScript);
- }, function(e) {
- if (Object(__WEBPACK_IMPORTED_MODULE_10__utils_StringHelperFunctions_js__["f" /* isString */])(e)) {
- workerScript.errorMessage = e;
- reject(workerScript);
- } else if (e instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */]) {
- reject(e);
- } else {
- reject(workerScript);
- }
- });
- break;
- case "Literal":
- resolve(exp.value);
- break;
- case "Identifier":
- if (!(exp.name in env.vars)){
- reject(makeRuntimeRejectMsg(workerScript, "variable " + exp.name + " not defined"));
- }
- resolve(env.get(exp.name))
- break;
- case "ExpressionStatement":
- var e = evaluate(exp.expression, workerScript);
- e.then(function(res) {
- resolve("expression done");
- }, function(e) {
- reject(e);
- });
- break;
- case "ArrayExpression":
- var argPromises = exp.elements.map(function(arg) {
- return evaluate(arg, workerScript);
- });
- Promise.all(argPromises).then(function(array) {
- resolve(array)
- }).catch(function(e) {
- reject(e);
- });
- break;
- case "CallExpression":
- evaluate(exp.callee, workerScript).then(function(func) {
- var argPromises = exp.arguments.map(function(arg) {
- return evaluate(arg, workerScript);
- });
- Promise.all(argPromises).then(function(args) {
- if (exp.callee.type == "MemberExpression"){
- evaluate(exp.callee.object, workerScript).then(function(object) {
- try {
- var res = func.apply(object,args);
- resolve(res);
- } catch (e) {
- reject(makeRuntimeRejectMsg(workerScript, e));
- }
- }).catch(function(e) {
- reject(e);
- });
- } else {
- try {
- var out = func.apply(null,args);
- if (out instanceof Promise){
- out.then(function(res) {
- resolve(res)
- }).catch(function(e) {
- reject(e);
- });
- } else {
- resolve(out);
- }
- } catch (e) {
- if (isScriptErrorMessage(e)) {
- reject(e);
- } else {
- reject(makeRuntimeRejectMsg(workerScript, e));
- }
- }
- }
- }).catch(function(e) {
- reject(e);
- });
- }).catch(function(e) {
- reject(e);
- });
- break;
- case "MemberExpression":
- var pObject = evaluate(exp.object, workerScript);
- pObject.then(function(object) {
- if (exp.computed){
- var p = evaluate(exp.property, workerScript);
- p.then(function(index) {
- if (index >= object.length) {
- return reject(makeRuntimeRejectMsg(workerScript, "Invalid index for arrays"));
- }
- resolve(object[index]);
- }).catch(function(e) {
- console.log("here");
- reject(makeRuntimeRejectMsg(workerScript, "Invalid MemberExpression"));
- });
- } else {
- try {
- resolve(object[exp.property.name])
- } catch (e) {
- return reject(makeRuntimeRejectMsg(workerScript, "Failed to get property: " + e.toString()));
- }
- }
- }).catch(function(e) {
- reject(e);
- });
- break;
- case "LogicalExpression":
- case "BinaryExpression":
- var p = evalBinary(exp, workerScript, resolve, reject);
- p.then(function(res) {
- resolve(res);
- }).catch(function(e) {
- reject(e);
- });
- break;
- case "UnaryExpression":
- var p = evalUnary(exp, workerScript, resolve, reject);
- p.then(function(res) {
- resolve(res);
- }).catch(function(e) {
- reject(e);
- });
- break;
- case "AssignmentExpression":
- var p = evalAssignment(exp, workerScript);
- p.then(function(res) {
- resolve(res);
- }).catch(function(e) {
- reject(e);
- });
- break;
- case "UpdateExpression":
- if (exp.argument.type==="Identifier"){
- if (exp.argument.name in env.vars){
- if (exp.prefix){
- resolve(env.get(exp.argument.name))
- }
- switch (exp.operator){
- case "++":
- env.set(exp.argument.name,env.get(exp.argument.name)+1);
- break;
- case "--":
- env.set(exp.argument.name,env.get(exp.argument.name)-1);
- break;
- default:
- reject(makeRuntimeRejectMsg(workerScript, "Unrecognized token: " + exp.type + ". You are trying to use code that is currently unsupported"));
- }
- if (env.prefix){
- return;
- }
- resolve(env.get(exp.argument.name))
- } else {
- reject(makeRuntimeRejectMsg(workerScript, "variable " + exp.argument.name + " not defined"));
- }
- } else {
- reject(makeRuntimeRejectMsg(workerScript, "argument must be an identifier"));
- }
- break;
- case "EmptyStatement":
- resolve(false);
- break;
- case "ReturnStatement":
- var lineNum = getErrorLineNumber(exp, workerScript);
- reject(makeRuntimeRejectMsg(workerScript, "Return statements are not yet implemented in Netscript (line " + (lineNum+1) + ")"));
- break;
- case "BreakStatement":
- reject("BREAKSTATEMENT");
- break;
- case "IfStatement":
- evaluateIf(exp, workerScript).then(function(forLoopRes) {
- resolve("forLoopDone");
- }).catch(function(e) {
- reject(e);
- });
- break;
- case "SwitchStatement":
- var lineNum = getErrorLineNumber(exp, workerScript);
- reject(makeRuntimeRejectMsg(workerScript, "Switch statements are not yet implemented in Netscript (line " + (lineNum+1) + ")"));
- break;e
- case "WhileStatement":
- evaluateWhile(exp, workerScript).then(function(forLoopRes) {
- resolve("forLoopDone");
- }).catch(function(e) {
- if (e == "BREAKSTATEMENT" ||
- (e instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */] && e.errorMessage == "BREAKSTATEMENT")) {
- return resolve("whileLoopBroken");
- } else {
- reject(e);
- }
- });
- break;
- case "ForStatement":
- evaluate(exp.init, workerScript).then(function(expInit) {
- return evaluateFor(exp, workerScript);
- }).then(function(forLoopRes) {
- resolve("forLoopDone");
- }).catch(function(e) {
- if (e == "BREAKSTATEMENT" ||
- (e instanceof __WEBPACK_IMPORTED_MODULE_4__NetscriptWorker_js__["b" /* WorkerScript */] && e.errorMessage == "BREAKSTATEMENT")) {
- return resolve("forLoopBroken");
- } else {
- reject(e);
- }
- });
- break;
- default:
- var lineNum = getErrorLineNumber(exp, workerScript);
- reject(makeRuntimeRejectMsg(workerScript, "Unrecognized token: " + exp.type + " (line " + (lineNum+1) + "). This is currently unsupported in Netscript"));
- break;
- } //End switch
- }, __WEBPACK_IMPORTED_MODULE_6__Settings_js__["a" /* Settings */].CodeInstructionRunTime); //End setTimeout, the Netscript operation run time
-
- }); // End Promise
-}
-
-function evalBinary(exp, workerScript){
- return new Promise(function(resolve, reject) {
- var expLeftPromise = evaluate(exp.left, workerScript);
- expLeftPromise.then(function(expLeft) {
- if (expLeft == true && exp.operator === "||") {
- return resolve(true);
- }
- if (expLeft == false && exp.operator === "&&") {
- return resolve(false);
- }
- var expRightPromise = evaluate(exp.right, workerScript);
- expRightPromise.then(function(expRight) {
- switch (exp.operator){
- case "===":
- case "==":
- resolve(expLeft===expRight);
- break;
- case "!==":
- case "!=":
- resolve(expLeft!==expRight);
- break;
- case "<":
- resolve(expLeft
" +
- "In this BitNode
" +
+ "In this BitNode:
" +
+ "The base security level of servers is doubled
" +
+ "The starting money on servers is halved, but the maximum money is doubled
" +
+ "Most methods of earning money now give significantly less
" +
+ "Augmentations are more expensive
" +
+ "Hacking experience gain rates are reduced
" +
"Destroying this BitNode will give you Source-File 5, or if you already have this Source-File it will " +
"upgrade its level up to a maximum of 3. This Source-File grants you a special new stat called Intelligence. " +
"Intelligence is unique because it is permanent and persistent (it never gets reset back to 1). However " +
"gaining Intelligence experience is much slower than other stats, and it is also hidden (you won't know " +
"when you gain experience and how much). Higher Intelligence levels will boost your production for many actions " +
- "in the game. This source file will also raise all of your hacking-related multipliers by:
" +
+ "in the game.
" +
+ "In addition, this Source-File will unlock the getBitNodeMultipliers() Netscript function, " +
+ "and will also raise all of your hacking-related multipliers by:
" +
"Level 1: 4%
" +
"Level 2: 6%
" +
"Level 3: 7%");
@@ -100,6 +107,7 @@ let BitNodeMultipliers = {
ServerStartingMoney: 1,
ServerGrowthRate: 1,
ServerWeakenRate: 1,
+ ServerStartingSecurity: 1,
ManualHackMoney: 1,
ScriptHackMoney: 1,
@@ -131,7 +139,7 @@ function initBitNodeMultipliers() {
}
switch (Player.bitNodeN) {
- case 1:
+ case 1: //Source Genesis (every multiplier is 1)
break;
case 2: //Rise of the Underworld
BitNodeMultipliers.ServerMaxMoney = 0.2;
@@ -152,6 +160,16 @@ function initBitNodeMultipliers() {
BitNodeMultipliers.CrimeExpGain = 0.5;
BitNodeMultipliers.FactionWorkRepGain = 0.75;
break;
+ case 5: //Artificial intelligence
+ BitNodeMultipliers.ServerMaxMoney = 2;
+ BitNodeMultipliers.ServerStartingSecurity = 2;
+ BitNodeMultipliers.ServerStartingMoney = 0.5;
+ BitNodeMultipliers.ScriptHackMoney = 0.25;
+ BitNodeMultipliers.HacknetNodeMoney = 0.2;
+ BitNodeMultipliers.CrimeMoney = 0.5;
+ BitNodeMultipliers.AugmentationMoneyCost = 2;
+ BitNodeMultipliers.HackExpGain = 0.5;
+ break;
case 11: //The Big Crash
BitNodeMultipliers.ServerMaxMoney = 0.1;
BitNodeMultipliers.ServerStartingMoney = 0.25;
diff --git a/src/Constants.js b/src/Constants.js
index fb34c7db0..ebf1edc2f 100644
--- a/src/Constants.js
+++ b/src/Constants.js
@@ -1,5 +1,5 @@
let CONSTANTS = {
- Version: "0.28.6",
+ Version: "0.29.0",
//Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience
//and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then
@@ -58,8 +58,9 @@ let CONSTANTS = {
ScriptScpRamCost: 0.5,
ScriptKillRamCost: 0.5, //Kill and killall
ScriptHasRootAccessRamCost: 0.05,
- ScriptGetHostnameRamCost: 0.05,
- ScriptGetHackingLevelRamCost: 0.05,
+ ScriptGetHostnameRamCost: 0.05, //getHostname() and getIp()
+ ScriptGetHackingLevelRamCost: 0.05, //getHackingLevel() and getIntelligence()
+ ScriptGetMultipliersRamCost: 4.0, //getHackingMultipliers() and getBitNodeMultipliers()
ScriptGetServerCost: 0.1,
ScriptFileExistsRamCost: 0.1,
ScriptIsRunningRamCost: 0.1,
@@ -115,9 +116,14 @@ let CONSTANTS = {
//Intelligence-related constants
IntelligenceCrimeWeight: 0.05, //Weight for how much int affects crime success rates
IntelligenceInfiltrationWeight: 0.1, //Weight for how much int affects infiltration success rates
- IntelligenceCrimeBaseExpGain: 0.0001,
+ IntelligenceCrimeBaseExpGain: 0.0002,
IntelligenceProgramBaseExpGain: 1000, //Program required hack level divided by this to determine int exp gain
IntelligenceTerminalHackBaseExpGain: 200, //Hacking exp divided by this to determine int exp gain
+ IntelligenceSingFnBaseExpGain: 0.0005,
+
+ //Hacking Missions
+ HackingMissionRepToDiffConversion: 5000, //Faction rep is divided by this to get mission difficulty
+ HackingMissionRepToRewardConversion: 20, //Faction rep divided byt his to get mission rep reward
//Gang constants
GangRespectToReputationRatio: 2, //Respect is divided by this to get rep gain
@@ -238,9 +244,10 @@ let CONSTANTS = {
"encounter diminishing returns in your hacking (since you are only hacking a certain percentage). You can " +
"increase the amount of money on a server using a script and the grow() function in Netscript.
" +
"Server Security
" +
- "Each server has a security level, typically between 1 and 100. It is possible for a server to have a security " +
- "level 100 or higher, in which case hacking a server will become impossible. A higher number means " +
- "the server has stronger security. As mentioned above, a server's security level is an important factor " +
+ "Each server has a security level, typically between 1 and 100. A higher number means the server has stronger security. " +
+ "It is possible for a server to have a security level of 100 or higher, in which case hacking that server " +
+ "will become impossible (0% chance to hack).
" +
+ "As mentioned above, a server's security level is an important factor " +
"to consider when hacking. You can check a server's security level using the 'analyze' command, although this " +
"only gives an estimate (with 5% uncertainty). You can also check a server's security in a script, using the " +
"getServerSecurityLevel(server) function in Netscript. See the Netscript documentation for more details. " +
@@ -406,8 +413,11 @@ let CONSTANTS = {
"print(x)
Prints a value or a variable to the scripts logs (which can be viewed with the 'tail [script]' terminal command ).
" +
"tprint(x)
Prints a value or a variable to the Terminal
" +
"clearLog()
Clears the script's logs.
" +
- "scan(hostname/ip)
Returns an array containing the hostnames of all servers that are one node away from the specified server. " +
- "The argument must be a string containing the IP or hostname of the target server. The hostnames in the returned array are strings.
" +
+ "scan(hostname/ip, [hostnames=true])
Returns an array containing the hostnames or IPs of all servers that are one node away from the specified server. " +
+ "The argument must be a string containing the IP or hostname of the target server. The second argument is a boolean that specifies whether " +
+ "the hostnames or IPs of the scanned servers should be output. If it is true then hostnames will be returned, and if false then IP addresses will. " +
+ "This second argument is optional and, if ommitted, the function will output " +
+ "the hostnames of the scanned servers. The hostnames/IPs in the returned array are strings.
" +
"nuke(hostname/ip)
Run NUKE.exe on the target server. NUKE.exe must exist on your home computer. Does NOT work while offline
Example: nuke('foodnstuff');
" +
"brutessh(hostname/ip)
Run BruteSSH.exe on the target server. BruteSSH.exe must exist on your home computer. Does NOT work while offline
Example: brutessh('foodnstuff');
" +
"ftpcrack(hostname/ip)
Run FTPCrack.exe on the target server. FTPCrack.exe must exist on your home computer. Does NOT work while offline
Example: ftpcrack('foodnstuff');
" +
@@ -457,17 +467,66 @@ let CONSTANTS = {
"kill('foo.script', getHostname(), 1, 'foodnstuff');
" +
"killall(hostname/ip)
Kills all running scripts on the specified server. This function takes a single argument which " +
"must be a string containing the hostname or IP of the target server. This function will always return true.
" +
- "scp(script, hostname/ip)
Copies a script or literature (.lit) file to another server. The first argument is a string with " +
+ "scp(script, [source], destination)
Copies a script or literature (.lit) file to another server. The first argument is a string with " +
"the filename of the script or literature file " +
- "to be copied. The second argument is a string with the hostname or IP of the destination server. Returns true if the script is successfully " +
- "copied over and false otherwise.
Example: scp('hack-template.script', 'foodnstuff');
" +
+ "to be copied. The next two arguments are strings containing the hostname/IPs of the source and target server. " +
+ "The source refers to the server from which the script/literature file will be copied, while the destination " +
+ "refers to the server to which it will be copied. The source server argument is optional, and if ommitted the source " +
+ "will be the current server (the server on which the script is running). Returns true if the script/literature file is " +
+ "successfully copied over and false otherwise.
" +
+ "Example: scp('hack-template.script', 'foodnstuff'); //Copies hack-template.script from the current server to foodnstuff
" +
+ "Example: scp('foo.lit', 'helios', 'home'); //Copies foo.lit from the helios server to the home computer
" +
"ls(hostname/ip)
Returns an array containing the names of all files on the specified server. The argument must be a " +
"string with the hostname or IP of the target server.
" +
"hasRootAccess(hostname/ip)
Returns a boolean (true or false) indicating whether or not the Player has root access to a server. " +
"The argument passed in must be a string with either the hostname or IP of the target server. Does NOT work while offline.
" +
"Example:
if (hasRootAccess('foodnstuff') == false) {
nuke('foodnstuff');
}
" +
+ "getIp()
Returns a string with the IP Address of the server that the script is running on
" +
"getHostname()
Returns a string with the hostname of the server that the script is running on
" +
- "getHackingLevel()
Returns the Player's current hacking level. Does NOT work while offline
" +
+ "getHackingLevel()
Returns the Player's current hacking level. Does NOT work while offline
" +
+ "getIntelligence()
Returns the Player's current intelligence level. Requires Source-File 5 to run
" +
+ "getHackingMultipliers()
Returns an object containing the Player's hacking related multipliers. " +
+ "These multipliers are returned in integer forms, not percentages (e.g. 1.5 instead of 150%). " +
+ "The object has the following structure:
" +
+ "{
" +
+ "chance: Player's hacking chance multiplier
" +
+ "speed: Player's hacking speed multiplier
" +
+ "money: Player's hacking money stolen multiplier
" +
+ "growth: Player's hacking growth multiplier
" +
+ "}
Example:
" +
+ "mults = getHackingMultipliers();
" +
+ "print(mults.chance);
" +
+ "print(mults.growth);
" +
+ "getBitNodeMultipliers()
Returns an object containing the current BitNode multipliers. " +
+ "This function requires Source-File 5 in order to run. The multipliers are returned in integer forms, not percentages " +
+ "(e.g. 1.5 instead of 150%). The multipliers represent the difference between the current BitNode and the " +
+ "original BitNode (BitNode-1). For example, if the 'CrimeMoney' multiplier has a value of 0.1 then that means " +
+ "that committing crimes in the current BitNode will only give 10% of the money you would have received in " +
+ "BitNode-1. The object has the following structure (subject to change in the future):
" +
+ "{
" +
+ "ServerMaxMoney: 1,
" +
+ "ServerStartingMoney: 1,
" +
+ "ServerGrowthRate: 1,
" +
+ "ServerWeakenRate: 1,
" +
+ "ServerStartingSecurity: 1,
" +
+ "ManualHackMoney: 1,
" +
+ "ScriptHackMoney: 1,
" +
+ "CompanyWorkMoney: 1,
" +
+ "CrimeMoney: 1,
" +
+ "HacknetNodeMoney: 1,
" +
+ "CompanyWorkExpGain: 1,
" +
+ "ClassGymExpGain: 1,
" +
+ "FactionWorkExpGain: 1,
" +
+ "HackExpGain: 1,
" +
+ "CrimeExpGain: 1,
" +
+ "FactionWorkRepGain: 1,
" +
+ "FactionPassiveRepGain: 1,
" +
+ "AugmentationRepCost: 1,
" +
+ "AugmentationMoneyCost: 1,
" +
+ "}
Example:
" +
+ "mults = getBitNodeMultipliers();
" +
+ "print(mults.ServerMaxMoney);
" +
+ "print(mults.HackExpGain);
" +
"getServerMoneyAvailable(hostname/ip)
Returns the amount of money available on a server. The argument passed in must be a string with either the " +
"hostname or IP of the target server. Does NOT work while offline
Example: getServerMoneyAvailable('foodnstuff');
" +
"getServerMaxMoney(hostname/ip)
Returns the maximum amount of money that can be available on a server. The argument passed in must be a string with " +
@@ -523,6 +582,8 @@ let CONSTANTS = {
"(2, 4, 8, etc...).
" +
"This function returns the hostname of the newly purchased server as a string. If the function fails to purchase a server, then it will return " +
"an empty string. The function will fail if the arguments passed in are invalid or if the player does not have enough money to purchase the specified server.
" +
+ "deleteServer(hostname)
Deletes one of the servers you've purchased with the specified hostname. The function will fail if " +
+ "there are any scripts running on the specified server. Returns true if successful and false otherwise
" +
"round(n)
Rounds the number n to the nearest integer. If the argument passed in is not a number, then the function will return 0.
" +
"write(port, data)
Writes data to a port. The first argument must be a number between 1 and 10 that specifies the port. The second " +
"argument defines the data to write to the port. If the second argument is not specified then it will write an empty string to the port.
" +
@@ -896,16 +957,19 @@ let CONSTANTS = {
"World Stock Exchange account and TIX API Access
",
LatestUpdate:
- "v0.28.6
" +
- "-Time required to create programs now scales better with hacking level, and should generally be much faster
" +
- "-Added serverExists(hostname/ip) and getScriptExpGain(scriptname, ip, args...) Netscript functions
" +
- "-Short circuiting && and || logical operators should now work
" +
- "-Assigning to multidimensional arrays should now work
" +
- "-Scripts will no longer wait for hack/grow/weaken functions to finish if they are killed. They will die immediately
" +
- "-The script loop that checks whether any scripts need to be started/stopped now runs every 6 seconds rather than 10 " +
- "(resulting in less delays when stopping/starting scripts)
" +
- "-Fixed several bugs/exploits
" +
- "-Added some description for BitNode-5 (not implemented yet, should be soon though)
",
+ "v0.29.0
" +
+ "-Added BitNode-5: Artificial Intelligence
" +
+ "-Added getIp(), getIntelligence(), getHackingMultipliers(), and getBitNodeMultipliers() Netscript functions (requires Source-File 5)
" +
+ "-Updated scan() Netscript function so that you can choose to have it print IPs rather than hostnames
" +
+ "-Refactored scp() Netscript function so that it takes an optional 'source server' argument
" +
+ "-For Infiltration, decreased the percentage by which the security level increases by " +
+ "about 10% for every location
" +
+ "-Using :w in the script editor's Vim keybinding mode should now save and quit to Terminal
" +
+ "-Some minor optimizations that should reduce the size of the save file
" +
+ "-scan-analyze Terminal command will no longer show your purchased servers, unless you pass a '-a' flag into the command
" +
+ "-After installing the Red Pill augmentation from Daedalus, the message telling you to find 'The-Cave' " +
+ "will now repeatedly pop up regardless of whether or not you have messages suppressed
" +
+ "-Various bugfixes",
}
diff --git a/src/Location.js b/src/Location.js
index ba2f2b06a..76616c991 100644
--- a/src/Location.js
+++ b/src/Location.js
@@ -420,7 +420,7 @@ function displayLocationContent() {
purchaseTor.style.display = "block";
purchaseHomeRam.style.display = "block";
setInfiltrateButton(infiltrate, Locations.AevumECorp,
- 6000, 116, 150, 9.5);
+ 6000, 116, 150, 8.5);
break;
case Locations.AevumBachmanAndAssociates:
@@ -433,7 +433,7 @@ function displayLocationContent() {
businessJob.style.display = "block";
securityJob.style.display = "block";
setInfiltrateButton(infiltrate, Locations.AevumBachmanAndAssociates,
- 1500, 42, 60, 6.5);
+ 1500, 42, 60, 5.75);
break;
case Locations.AevumClarkeIncorporated:
@@ -446,7 +446,7 @@ function displayLocationContent() {
businessJob.style.display = "block";
securityJob.style.display = "block";
setInfiltrateButton(infiltrate, Locations.AevumClarkeIncorporated,
- 2400, 34, 75, 6);
+ 2400, 34, 75, 5.4);
break;
case Locations.AevumFulcrumTechnologies:
@@ -465,7 +465,7 @@ function displayLocationContent() {
purchaseTor.style.display = "block";
purchaseHomeRam.style.display = "block";
setInfiltrateButton(infiltrate, Locations.AevumFulcrumTechnologies,
- 6000, 96, 100, 10);
+ 6000, 96, 100, 9);
break;
case Locations.AevumAeroCorp:
@@ -477,7 +477,7 @@ function displayLocationContent() {
networkEngineerJob.style.display = "block";
securityJob.style.display = "block";
setInfiltrateButton(infiltrate, Locations.AevumAeroCorp,
- 2000, 32, 50, 7);
+ 2000, 32, 50, 6.3);
break;
case Locations.AevumGalacticCybersystems:
@@ -490,7 +490,7 @@ function displayLocationContent() {
networkEngineerJob.style.display = "block";
businessJob.style.display = "block";
setInfiltrateButton(infiltrate, Locations.AevumGalacticCybersystems,
- 1400, 30, 50, 6);
+ 1400, 30, 50, 5.3);
break;
case Locations.AevumWatchdogSecurity:
@@ -504,7 +504,7 @@ function displayLocationContent() {
securityJob.style.display = "block";
agentJob.style.display = "block";
setInfiltrateButton(infiltrate, Locations.AevumWatchdogSecurity,
- 850, 16, 30, 5);
+ 850, 16, 30, 4.5);
break;
case Locations.AevumRhoConstruction:
@@ -513,7 +513,7 @@ function displayLocationContent() {
softwareJob.style.display = "block";
businessJob.style.display = "block";
setInfiltrateButton(infiltrate, Locations.AevumRhoConstruction,
- 600, 12, 20, 3);
+ 600, 12, 20, 2.7);
break;
case Locations.AevumPolice:
@@ -522,7 +522,7 @@ function displayLocationContent() {
softwareJob.style.display = "block";
securityJob.style.display = "block";
setInfiltrateButton(infiltrate, Locations.AevumPolice,
- 700, 14, 25, 3.5);
+ 700, 14, 25, 3.2);
break;
case Locations.AevumNetLinkTechnologies:
@@ -540,7 +540,7 @@ function displayLocationContent() {
purchaseTor.style.display = "block";
purchaseHomeRam.style.display = "block";
setInfiltrateButton(infiltrate, Locations.AevumNetLinkTechnologies,
- 160, 10, 15, 2);
+ 160, 10, 15, 1.8);
break;
case Locations.AevumCrushFitnessGym:
@@ -574,7 +574,7 @@ function displayLocationContent() {
businessJob.style.display = "block";
securityJob.style.display = "block";
setInfiltrateButton(infiltrate, Locations.ChongqingKuaiGongInternational,
- 5500, 48, 100, 10);
+ 5500, 48, 100, 9);
break;
case Locations.ChongqingSolarisSpaceSystems:
@@ -586,7 +586,7 @@ function displayLocationContent() {
networkEngineerJob.style.display = "block";
securityJob.style.display = "block";
setInfiltrateButton(infiltrate, Locations.ChongqingSolarisSpaceSystems,
- 3600, 26, 75, 9.5);
+ 3600, 26, 75, 8.6);
break;
@@ -615,7 +615,7 @@ function displayLocationContent() {
businessJob.style.display = "block";
securityJob.style.display = "block";
setInfiltrateButton(infiltrate, Locations.Sector12MegaCorp,
- 6000, 114, 125, 11);
+ 6000, 114, 125, 9.8);
break;
case Locations.Sector12BladeIndustries:
@@ -628,7 +628,7 @@ function displayLocationContent() {
businessJob.style.display = "block";
securityJob.style.display = "block";
setInfiltrateButton(infiltrate, Locations.Sector12BladeIndustries,
- 3000, 46, 100, 7.5);
+ 3000, 46, 100, 6.7);
break;
case Locations.Sector12FourSigma:
@@ -641,7 +641,7 @@ function displayLocationContent() {
businessJob.style.display = "block";
securityJob.style.display = "block";
setInfiltrateButton(infiltrate, Locations.Sector12FourSigma,
- 1500, 58, 100, 11.5);
+ 1500, 58, 100, 10.2);
break;
case Locations.Sector12IcarusMicrosystems:
@@ -654,7 +654,7 @@ function displayLocationContent() {
networkEngineerJob.style.display = "block";
businessJob.style.display = "block";
setInfiltrateButton(infiltrate, Locations.Sector12IcarusMicrosystems,
- 900, 32, 70, 8.5);
+ 900, 32, 70, 7.8);
break;
case Locations.Sector12UniversalEnergy:
@@ -667,7 +667,7 @@ function displayLocationContent() {
networkEngineerJob.style.display = "block";
businessJob.style.display = "block";
setInfiltrateButton(infiltrate, Locations.Sector12UniversalEnergy,
- 775, 24, 50, 7);
+ 775, 24, 50, 6.3);
break;
case Locations.Sector12DeltaOne:
@@ -679,7 +679,7 @@ function displayLocationContent() {
networkEngineerJob.style.display = "block";
securityJob.style.display = "block";
setInfiltrateButton(infiltrate, Locations.Sector12DeltaOne,
- 1200, 38, 75, 7);
+ 1200, 38, 75, 6.3);
break;
case Locations.Sector12CIA:
@@ -692,7 +692,7 @@ function displayLocationContent() {
securityJob.style.display = "block";
agentJob.style.display = "block";
setInfiltrateButton(infiltrate, Locations.Sector12CIA,
- 1450, 44, 80, 8.5);
+ 1450, 44, 80, 7.6);
break;
case Locations.Sector12NSA:
@@ -705,7 +705,7 @@ function displayLocationContent() {
securityJob.style.display = "block";
agentJob.style.display = "block";
setInfiltrateButton(infiltrate, Locations.Sector12NSA,
- 1400, 40, 80, 8);
+ 1400, 40, 80, 7.2);
break;
case Locations.Sector12AlphaEnterprises:
@@ -719,7 +719,7 @@ function displayLocationContent() {
purchaseTor.style.display = "block";
purchaseHomeRam.style.display = "block";
setInfiltrateButton(infiltrate, Locations.Sector12AlphaEnterprises,
- 250, 14, 40, 3);
+ 250, 14, 40, 2.7);
break;
case Locations.Sector12CarmichaelSecurity:
@@ -733,7 +733,7 @@ function displayLocationContent() {
securityJob.style.display = "block";
agentJob.style.display = "block";
setInfiltrateButton(infiltrate, Locations.Sector12CarmichaelSecurity,
- 500, 18, 60, 3);
+ 500, 18, 60, 2.7);
break;
case Locations.Sector12FoodNStuff:
@@ -749,7 +749,7 @@ function displayLocationContent() {
employeeJob.style.display = "block";
employeePartTimeJob.style.display = "block";
setInfiltrateButton(infiltrate, Locations.Sector12JoesGuns,
- 120, 8, 20, 2.5);
+ 120, 8, 20, 2.2);
break;
case Locations.Sector12IronGym:
@@ -782,7 +782,7 @@ function displayLocationContent() {
securityEngineerJob.style.display = "block";
networkEngineerJob.style.display = "block";
setInfiltrateButton(infiltrate, Locations.NewTokyoDefComm,
- 1300, 28, 70, 6);
+ 1300, 28, 70, 5.4);
break;
case Locations.NewTokyoVitaLife:
@@ -795,7 +795,7 @@ function displayLocationContent() {
networkEngineerJob.style.display = "block";
businessJob.style.display = "block";
setInfiltrateButton(infiltrate, Locations.NewTokyoVitaLife,
- 750, 22, 100, 5.5);
+ 750, 22, 100, 5);
break;
case Locations.NewTokyoGlobalPharmaceuticals:
@@ -809,7 +809,7 @@ function displayLocationContent() {
businessJob.style.display = "block";
securityJob.style.display = "block";
setInfiltrateButton(infiltrate, Locations.NewTokyoGlobalPharmaceuticals,
- 900, 24, 80, 6);
+ 900, 24, 80, 5.4);
break;
case Locations.NewTokyoNoodleBar:
@@ -848,7 +848,7 @@ function displayLocationContent() {
purchase256gb.style.display = "block";
purchaseHomeRam.style.display = "block";
setInfiltrateButton(infiltrate, Locations.IshimaStormTechnologies,
- 700, 24, 100, 6.5);
+ 700, 24, 100, 5.9);
break;
case Locations.IshimaNovaMedical:
@@ -861,7 +861,7 @@ function displayLocationContent() {
networkEngineerJob.style.display = "block";
businessJob.style.display = "block";
setInfiltrateButton(infiltrate, Locations.IshimaNovaMedical,
- 600, 20, 50, 5);
+ 600, 20, 50, 4.5);
break;
case Locations.IshimaOmegaSoftware:
@@ -879,7 +879,7 @@ function displayLocationContent() {
purchaseTor.style.display = "block";
purchaseHomeRam.style.display = "block";
setInfiltrateButton(infiltrate, Locations.IshimaOmegaSoftware,
- 200, 10, 40, 2.5);
+ 200, 10, 40, 2.3);
break;
case Locations.VolhavenTravelAgency:
@@ -912,7 +912,7 @@ function displayLocationContent() {
purchase512gb.style.display = "block";
purchase1tb.style.display = "block";
setInfiltrateButton(infiltrate, Locations.VolhavenOmniTekIncorporated,
- 1500, 44, 100, 7);
+ 1500, 44, 100, 6.3);
break;
case Locations.VolhavenNWO:
@@ -925,7 +925,7 @@ function displayLocationContent() {
businessJob.style.display = "block";
securityJob.style.display = "block";
setInfiltrateButton(infiltrate, Locations.VolhavenNWO,
- 1800, 56, 200, 8);
+ 1800, 56, 200, 7.2);
break;
case Locations.VolhavenHeliosLabs:
@@ -937,7 +937,7 @@ function displayLocationContent() {
securityEngineerJob.style.display = "block";
networkEngineerJob.style.display = "block";
setInfiltrateButton(infiltrate, Locations.VolhavenHeliosLabs,
- 1200, 28, 75, 6);
+ 1200, 28, 75, 5.4);
break;
case Locations.VolhavenOmniaCybersystems:
@@ -949,7 +949,7 @@ function displayLocationContent() {
networkEngineerJob.style.display = "block";
securityJob.style.display = "block";
setInfiltrateButton(infiltrate, Locations.VolhavenOmniaCybersystems,
- 900, 28, 90, 6.5);
+ 900, 28, 90, 5.8);
break;
case Locations.VolhavenLexoCorp:
@@ -963,7 +963,7 @@ function displayLocationContent() {
businessJob.style.display = "block";
securityJob.style.display = "block";
setInfiltrateButton(infiltrate, Locations.VolhavenLexoCorp,
- 500, 14, 40, 3.5);
+ 500, 14, 40, 3.1);
break;
case Locations.VolhavenSysCoreSecurities:
@@ -974,7 +974,7 @@ function displayLocationContent() {
securityEngineerJob.style.display = "block";
networkEngineerJob.style.display = "block";
setInfiltrateButton(infiltrate, Locations.VolhavenSysCoreSecurities,
- 600, 16, 50, 4);
+ 600, 16, 50, 3.6);
break;
case Locations.VolhavenCompuTek:
@@ -995,7 +995,7 @@ function displayLocationContent() {
purchaseTor.style.display = "block";
purchaseHomeRam.style.display = "block";
setInfiltrateButton(infiltrate, Locations.VolhavenCompuTek,
- 300, 12, 35, 3.5);
+ 300, 12, 35, 3.1);
break;
case Locations.VolhavenMilleniumFitnessGym:
diff --git a/src/Message.js b/src/Message.js
index 7b87ae3e7..9ed99d3b4 100644
--- a/src/Message.js
+++ b/src/Message.js
@@ -4,7 +4,7 @@ import {Programs} from "./CreateProgram.js";
import {Player} from "./Player.js";
import {GetServerByHostname} from "./Server.js";
import {Settings} from "./Settings.js";
-import {dialogBoxCreate} from "../utils/DialogBox.js";
+import {dialogBoxCreate, dialogBoxOpened} from "../utils/DialogBox.js";
import {Reviver, Generic_toJSON,
Generic_fromJSON} from "../utils/JSONReviver.js";
@@ -27,10 +27,10 @@ Message.fromJSON = function(value) {
Reviver.constructors.Message = Message;
//Sends message to player, including a pop up
-function sendMessage(msg) {
+function sendMessage(msg, forced=false) {
console.log("sending message: " + msg.filename);
msg.recvd = true;
- if (!Settings.SuppressMessages) {
+ if (forced || !Settings.SuppressMessages) {
showMessage(msg);
}
addMessageToServer(msg, "home");
@@ -50,6 +50,11 @@ function addMessageToServer(msg, serverHostname) {
console.log("WARNING: Did not locate " + serverHostname);
return;
}
+ for (var i = 0; i < server.messages.length; ++i) {
+ if (server.messages[i].filename === msg.filename) {
+ return; //Already exists
+ }
+ }
server.messages.push(msg);
}
@@ -70,7 +75,11 @@ function checkForMessagesToSend() {
redpillOwned = true;
}
- if (jumper0 && !jumper0.recvd && Player.hacking_skill >= 25) {
+ if (redpill && redpillOwned) {
+ if (!dialogBoxOpened) {
+ sendMessage(redpill, true);
+ }
+ } else if (jumper0 && !jumper0.recvd && Player.hacking_skill >= 25) {
sendMessage(jumper0);
Player.getHomeComputer().programs.push(Programs.Flight);
} else if (jumper1 && !jumper1.recvd && Player.hacking_skill >= 40) {
@@ -87,8 +96,6 @@ function checkForMessagesToSend() {
sendMessage(jumper4);
} else if (bitrunnersTest && !bitrunnersTest.recvd && Player.hacking_skill >= 500) {
sendMessage(bitrunnersTest);
- } else if (redpill && !redpill.recvd && Player.hacking_skill >= 2000 && redpillOwned) {
- sendMessage(redpill);
}
}
diff --git a/src/NetscriptEvaluator.js b/src/NetscriptEvaluator.js
index b58134627..33b2e4be4 100644
--- a/src/NetscriptEvaluator.js
+++ b/src/NetscriptEvaluator.js
@@ -474,8 +474,6 @@ function evalAssignment(exp, workerScript) {
});
}
-//Returns true if any of the if statements evaluated, false otherwise. Therefore, the else statement
-//should evaluate if this returns false
function evaluateIf(exp, workerScript, i) {
var env = workerScript.env;
return new Promise(function(resolve, reject) {
diff --git a/src/NetscriptFunctions.js b/src/NetscriptFunctions.js
index ebb4a5fce..69b8133b0 100644
--- a/src/NetscriptFunctions.js
+++ b/src/NetscriptFunctions.js
@@ -2,6 +2,7 @@ import {updateActiveScriptsItems} from "./ActiveScriptsUI.js";
import {Augmentations, Augmentation,
augmentationExists, installAugmentations,
AugmentationNames} from "./Augmentations.js";
+import {BitNodeMultipliers} from "./BitNode.js";
import {Companies, Company, CompanyPosition,
CompanyPositions, companyExists} from "./Company.js";
import {CONSTANTS} from "./Constants.js";
@@ -43,14 +44,20 @@ import {createRandomIp} from "../utils/IPAddress.js"
import {formatNumber, isString, isHTML} from "../utils/StringHelperFunctions.js";
var hasSingularitySF = false;
+var hasAISF = false;
var singularitySFLvl = 1;
+//Also used to check for Artificial Intelligence Source File, don't want to change
+//name though
function initSingularitySFFlags() {
for (var i = 0; i < Player.sourceFiles.length; ++i) {
if (Player.sourceFiles[i].n === 4) {
hasSingularitySF = true;
singularitySFLvl = Player.sourceFiles[i].lvl;
}
+ if (Player.sourceFiles[i].n === 5) {
+ hasAISF = true;
+ }
}
}
@@ -58,14 +65,19 @@ function NetscriptFunctions(workerScript) {
return {
Math : Math,
hacknetnodes : Player.hacknetNodes,
- scan : function(ip=workerScript.serverIp){
+ scan : function(ip=workerScript.serverIp, hostnames=true){
var server = getServer(ip);
if (server == null) {
throw 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;
+ var entry;
+ if (hostnames) {
+ entry = server.getServerOnNetwork(i).hostname;
+ } else {
+ entry = server.getServerOnNetwork(i).ip;
+ }
if (entry == null) {
continue;
}
@@ -451,21 +463,42 @@ function NetscriptFunctions(workerScript) {
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 || arguments.length != 2) {
- throw makeRuntimeRejectMsg(workerScript, "Error: scp() call has incorrect number of arguments. Takes 2 arguments");
- }
- var destServer = getServer(ip);
- if (destServer == null) {
- throw makeRuntimeRejectMsg(workerScript, "Error: Invalid hostname/ip passed into scp() command: " + ip);
+ scp : function(scriptname, ip1, ip2){
+ if (arguments.length !== 2 && arguments.length !== 3) {
+ throw makeRuntimeRejectMsg(workerScript, "Error: scp() call has incorrect number of arguments. Takes 2 or 3 arguments");
}
if (!scriptname.endsWith(".lit") && !scriptname.endsWith(".script")) {
throw makeRuntimeRejectMsg(workerScript, "Error: scp() only works for .script and .lit files");
}
- var currServ = getServer(workerScript.serverIp);
- if (currServ == null) {
- throw makeRuntimeRejectMsg(workerScript, "Could not find server ip for this script. This is a bug please contact game developer");
+ var destServer, currServ;
+
+ if (arguments.length === 3) { //scriptname, source, destination
+ if (scriptname === undefined || ip1 === undefined || ip2 === undefined) {
+ throw makeRuntimeRejectMsg(workerScript, "Error: scp() call has incorrect number of arguments. Takes 2 or 3 arguments");
+ }
+ destServer = getServer(ip2);
+ if (destServer == null) {
+ throw makeRuntimeRejectMsg(workerScript, "Error: Invalid hostname/ip passed into scp() command: " + ip);
+ }
+
+ currServ = getServer(ip1);
+ if (currServ == null) {
+ throw makeRuntimeRejectMsg(workerScript, "Could not find server ip for this script. This is a bug please contact game developer");
+ }
+ } else if (arguments.length === 2) { //scriptname, destination
+ if (scriptname === undefined || ip1 === undefined) {
+ throw makeRuntimeRejectMsg(workerScript, "Error: scp() call has incorrect number of arguments. Takes 2 or 3 arguments");
+ }
+ destServer = getServer(ip1);
+ if (destServer == null) {
+ throw makeRuntimeRejectMsg(workerScript, "Error: Invalid hostname/ip passed into scp() command: " + ip);
+ }
+
+ currServ = getServer(workerScript.serverIp);
+ if (currServ == null) {
+ throw makeRuntimeRejectMsg(workerScript, "Could not find server ip for this script. This is a bug please contact game developer");
+ }
}
//Scp for lit files
@@ -597,6 +630,13 @@ function NetscriptFunctions(workerScript) {
}
return server.hasAdminRights;
},
+ getIp : function() {
+ var scriptServer = getServer(workerScript.serverIp);
+ if (scriptServer == null) {
+ throw makeRuntimeRejectMsg(workerScript, "Could not find server. This is a bug in the game. Report to game dev");
+ }
+ return scriptServer.ip;
+ },
getHostname : function(){
var scriptServer = getServer(workerScript.serverIp);
if (scriptServer == null) {
@@ -609,6 +649,28 @@ function NetscriptFunctions(workerScript) {
workerScript.scriptRef.log("getHackingLevel() returned " + Player.hacking_skill);
return Player.hacking_skill;
},
+ getIntelligence : function () {
+ if (!hasAISF) {
+ throw makeRuntimeRejectMsg(workerScript, "Cannot run getIntelligence(). It requires Source-File 5 to run.");
+ }
+ Player.updateSkillLevels();
+ workerScript.scriptRef.log("getHackingLevel() returned " + Player.intelligence);
+ return Player.intelligence;
+ },
+ getHackingMultipliers : function() {
+ return {
+ chance: Player.hacking_chance_mult,
+ speed: Player.hacking_speed_mult,
+ money: Player.hacking_money_mult,
+ growth: Player.hacking_grow_mult,
+ };
+ },
+ getBitNodeMultipliers: function() {
+ if (!hasAISF) {
+ throw makeRuntimeRejectMsg(workerScript, "Cannot run getBitNodeMultipliers(). It requires Source-File 5 to run.");
+ }
+ return BitNodeMultipliers;
+ },
getServerMoneyAvailable : function(ip){
var server = getServer(ip);
if (server == null) {
@@ -1257,6 +1319,7 @@ function NetscriptFunctions(workerScript) {
case Locations.Volhaven:
Player.loseMoney(200000);
Player.city = cityname;
+ Player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain);
workerScript.scriptRef.log("Traveled to " + cityname);
return true;
default:
@@ -1292,6 +1355,7 @@ function NetscriptFunctions(workerScript) {
Player.getHomeComputer().serversOnNetwork.push(darkweb.ip);
darkweb.serversOnNetwork.push(Player.getHomeComputer().ip);
+ Player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain);
workerScript.scriptRef.log("You have purchased a Tor router!");
return true;
},
@@ -1427,6 +1491,7 @@ function NetscriptFunctions(workerScript) {
Player.loseMoney(cost);
+ Player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain);
workerScript.scriptRef.log("Purchased additional RAM for home computer! It now has " + homeComputer.maxRam + "GB of RAM.");
return true;
},
@@ -1597,6 +1662,7 @@ function NetscriptFunctions(workerScript) {
Player.factionInvitations.splice(index, 1);
var fac = Factions[name];
joinFaction(fac);
+ Player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain);
workerScript.scriptRef.log("Joined the " + name + " faction.");
return true;
},
@@ -1852,6 +1918,7 @@ function NetscriptFunctions(workerScript) {
var res = purchaseAugmentation(aug, fac, true);
workerScript.scriptRef.log(res);
if (isString(res) && res.startsWith("You purchased")) {
+ Player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain);
return true;
} else {
return false;
@@ -1869,6 +1936,7 @@ function NetscriptFunctions(workerScript) {
workerScript.scriptRef.log("ERROR: installAugmentations() failed because you do not have any Augmentations to be installed");
return false;
}
+ Player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain);
workerScript.scriptRef.log("Installing Augmentations. This will cause this script to be killed");
installAugmentations();
return true;
diff --git a/src/Prestige.js b/src/Prestige.js
index b31368aea..f2c76443a 100644
--- a/src/Prestige.js
+++ b/src/Prestige.js
@@ -9,6 +9,7 @@ import {Factions, Faction, initFactions,
joinFaction} from "./Faction.js";
import {Locations} from "./Location.js";
import {initMessages, Messages, Message} from "./Message.js";
+import {initSingularitySFFlags} from "./NetscriptFunctions.js";
import {WorkerScript, workerScripts,
prestigeWorkerScripts} from "./NetscriptWorker.js";
import {Player} from "./Player.js";
@@ -219,6 +220,9 @@ function prestigeSourceFile() {
Terminal.resetTerminalInput();
Engine.loadTerminalContent();
+ //Reinitialize flags in case you just finished BN-4
+ initSingularitySFFlags();
+
//Gain int exp
Player.gainIntelligenceExp(5);
}
diff --git a/src/RedPill.js b/src/RedPill.js
index 2948749b4..3ce2e5cc5 100644
--- a/src/RedPill.js
+++ b/src/RedPill.js
@@ -123,6 +123,9 @@ function giveSourceFile(bitNodeNumber) {
} else {
var playerSrcFile = new PlayerOwnedSourceFile(bitNodeNumber, 1);
Player.sourceFiles.push(playerSrcFile);
+ if (bitNodeNumber === 5) { //Artificial Intelligence
+ Player.intelligence = 1;
+ }
dialogBoxCreate("You received a Source-File for destroying a Bit Node!
" +
sourceFile.name + "
" + sourceFile.info);
}
@@ -206,7 +209,7 @@ function loadBitVerse(destroyedBitNodeNum) {
var elemId = "bitnode-" + i.toString();
var elem = clearEventListeners(elemId);
if (elem == null) {return;}
- if (i === 1 || i === 2 || i === 4 || i === 11) {
+ if (i === 1 || i === 2 || i === 4 || i === 5 || i === 11) {
elem.addEventListener("click", function() {
var bitNodeKey = "BitNode" + i;
var bitNode = BitNodes[bitNodeKey];
diff --git a/src/SaveObject.js b/src/SaveObject.js
index 81a85aaa4..61d266f58 100644
--- a/src/SaveObject.js
+++ b/src/SaveObject.js
@@ -73,7 +73,16 @@ BitburnerSaveObject.prototype.saveGame = function() {
this.AllGangsSave = JSON.stringify(AllGangs);
}
var saveString = btoa(unescape(encodeURIComponent(JSON.stringify(this))));
- window.localStorage.setItem("bitburnerSave", saveString);
+ try {
+ window.localStorage.setItem("bitburnerSave", saveString);
+ } catch(e) {
+ if (e.code == 22) {
+ dialogBoxCreate("Failed to save game because the size of the save file " +
+ "is too large. Consider killing several of your scripts to " +
+ "fix this, or increasing the size of your browsers localStorage");
+ }
+ }
+
console.log("Game saved!");
Engine.createStatusText("Game saved!");
diff --git a/src/Script.js b/src/Script.js
index 006c7ae99..c3d690f1b 100644
--- a/src/Script.js
+++ b/src/Script.js
@@ -12,6 +12,8 @@ require('brace/theme/xcode');
require("brace/keybinding/vim");
require("brace/keybinding/emacs");
+
+
import {CONSTANTS} from "./Constants.js";
import {Engine} from "./engine.js";
import {iTutorialSteps, iTutorialNextStep,
@@ -85,7 +87,17 @@ function scriptEditorInit() {
editor.getSession().setUseSoftTabs(softTabChkBox.checked);
};
-};
+ //Configure some of the VIM keybindings
+ ace.config.loadModule('ace/keyboard/vim', function(module) {
+ var VimApi = module.CodeMirror.Vim;
+ VimApi.defineEx('write', 'w', function(cm, input) {
+ saveAndCloseScriptEditor();
+ });
+ VimApi.defineEx('quit', 'q', function(cm, input) {
+ Engine.loadTerminalContent();
+ });
+ });
+}
document.addEventListener("DOMContentLoaded", scriptEditorInit, false);
//Updates line number and RAM usage in script
@@ -223,8 +235,12 @@ function calculateRamUsage(codeCopy) {
var killCount = numOccurrences(codeCopy, "kill(") + numOccurrences(codeCopy, "killall(");
var scpCount = numOccurrences(codeCopy, "scp(");
var hasRootAccessCount = numOccurrences(codeCopy, "hasRootAccess(");
- var getHostnameCount = numOccurrences(codeCopy, "getHostname(");
- var getHackingLevelCount = numOccurrences(codeCopy, "getHackingLevel(");
+ var getHostnameCount = numOccurrences(codeCopy, "getHostname(") +
+ numOccurrences(codeCopy, "getIp(");
+ var getHackingLevelCount = numOccurrences(codeCopy, "getHackingLevel(") +
+ numOccurrences(codeCopy, "getIntelligence(");
+ var getMultipliersCount = numOccurrences(codeCopy, "getHackingMultipliers(") +
+ numOccurrences(codeCopy, "getBitNodeMultipliers(");
var getServerCount = numOccurrences(codeCopy, "getServerMoneyAvailable(") +
numOccurrences(codeCopy, "getServerMaxMoney(") +
numOccurrences(codeCopy, "getServerSecurityLevel(") +
@@ -304,6 +320,7 @@ function calculateRamUsage(codeCopy) {
(hasRootAccessCount * CONSTANTS.ScriptHasRootAccessRamCost) +
(getHostnameCount * CONSTANTS.ScriptGetHostnameRamCost) +
(getHackingLevelCount * CONSTANTS.ScriptGetHackingLevelRamCost) +
+ (getMultipliersCount * CONSTANTS.ScriptGetMultipliersRamCost) +
(getServerCount * CONSTANTS.ScriptGetServerCost) +
(fileExistsCount * CONSTANTS.ScriptFileExistsRamCost) +
(isRunningCount * CONSTANTS.ScriptIsRunningRamCost) +
@@ -485,19 +502,7 @@ function RunningScript(script, args) {
this.threads = 1;
//[MoneyStolen, NumTimesHacked, NumTimesGrown, NumTimesWeaken]
- this.dataMap = new AllServersMap([0, 0, 0, 0]);
-}
-
-RunningScript.prototype.reset = function() {
- this.scriptRef.updateRamUsage();
-
- this.offlineRunningTime = 0.01; //Seconds
- this.offlineMoneyMade = 0;
- this.offlineExpGained = 0;
- this.onlineRunningTime = 0.01; //Seconds
- this.onlineMoneyMade = 0;
- this.onlineExpGained = 0;
- this.logs = [];
+ this.dataMap = new AllServersMap([0, 0, 0, 0], true);
}
RunningScript.prototype.log = function(txt) {
@@ -524,7 +529,7 @@ RunningScript.prototype.clearLog = function() {
RunningScript.prototype.recordHack = function(serverIp, moneyGained, n=1) {
if (this.dataMap == null) {
//[MoneyStolen, NumTimesHacked, NumTimesGrown, NumTimesWeaken]
- this.dataMap = new AllServersMap([0, 0, 0, 0]);
+ this.dataMap = new AllServersMap([0, 0, 0, 0], true);
}
this.dataMap[serverIp][0] += moneyGained;
this.dataMap[serverIp][1] += n;
@@ -534,7 +539,7 @@ RunningScript.prototype.recordHack = function(serverIp, moneyGained, n=1) {
RunningScript.prototype.recordGrow = function(serverIp, n=1) {
if (this.dataMap == null) {
//[MoneyStolen, NumTimesHacked, NumTimesGrown, NumTimesWeaken]
- this.dataMap = new AllServersMap([0, 0, 0, 0]);
+ this.dataMap = new AllServersMap([0, 0, 0, 0], true);
}
this.dataMap[serverIp][2] += n;
}
@@ -543,7 +548,7 @@ RunningScript.prototype.recordGrow = function(serverIp, n=1) {
RunningScript.prototype.recordWeaken = function(serverIp, n=1) {
if (this.dataMap == null) {
//[MoneyStolen, NumTimesHacked, NumTimesGrown, NumTimesWeaken]
- this.dataMap = new AllServersMap([0, 0, 0, 0]);
+ this.dataMap = new AllServersMap([0, 0, 0, 0], true);
}
this.dataMap[serverIp][3] += n;
}
@@ -561,9 +566,12 @@ Reviver.constructors.RunningScript = RunningScript;
//Creates an object that creates a map/dictionary with the IP of each existing server as
//a key. Initializes every key with a specified value that can either by a number or an array
-function AllServersMap(arr=false) {
+function AllServersMap(arr=false, filterOwned=false) {
for (var ip in AllServers) {
if (AllServers.hasOwnProperty(ip)) {
+ if (filterOwned && (AllServers[ip].purchasedByPlayer || AllServers[ip].hostname === "home")) {
+ continue;
+ }
if (arr) {
this[ip] = [0, 0, 0, 0];
} else {
@@ -573,14 +581,6 @@ function AllServersMap(arr=false) {
}
}
-AllServersMap.prototype.reset = function() {
- for (var ip in this) {
- if (this.hasOwnProperty(ip)) {
- this[ip] = 0;
- }
- }
-}
-
AllServersMap.prototype.printConsole = function() {
for (var ip in this) {
if (this.hasOwnProperty(ip)) {
diff --git a/src/Server.js b/src/Server.js
index c4aa6d21d..40ec51bc4 100644
--- a/src/Server.js
+++ b/src/Server.js
@@ -32,7 +32,7 @@ function Server(ip=createRandomIp(), hostname="", organizationName="",
//RAM, CPU speed and Scripts
this.maxRam = maxRam; //GB
this.ramUsed = 0;
- this.cpuSpeed = 1; //MHz
+ this.cpuCores = 1; //Max of 8, affects hacking times and Hacking MIssion starting Cores
this.scripts = [];
this.runningScripts = []; //Stores RunningScript objects
@@ -78,8 +78,8 @@ Server.prototype.setHackingParameters = function(requiredHackingSkill, moneyAvai
this.moneyAvailable = moneyAvailable * BitNodeMultipliers.ServerStartingMoney;
}
this.moneyMax = 25 * this.moneyAvailable * BitNodeMultipliers.ServerMaxMoney;
- this.hackDifficulty = hackDifficulty;
- this.baseDifficulty = hackDifficulty;
+ this.hackDifficulty = hackDifficulty * BitNodeMultipliers.ServerStartingSecurity;
+ this.baseDifficulty = hackDifficulty * BitNodeMultipliers.ServerStartingSecurity;
this.minDifficulty = Math.max(1, Math.round(hackDifficulty / 3));
this.serverGrowth = serverGrowth;
}
@@ -118,7 +118,9 @@ Server.prototype.getScript = function(scriptName) {
//Strengthens a server's security level (difficulty) by the specified amount
Server.prototype.fortify = function(amt) {
this.hackDifficulty += amt;
- if (this.hackDifficulty > 99) {this.hackDifficulty = 99;}
+ //Place some arbitrarily limit that realistically should never happen unless someone is
+ //screwing around with the game
+ if (this.hackDifficulty > 1000000) {this.hackDifficulty = 1000000;}
}
Server.prototype.weaken = function(amt) {
diff --git a/src/Terminal.js b/src/Terminal.js
index 8971304a6..b2930eb0b 100644
--- a/src/Terminal.js
+++ b/src/Terminal.js
@@ -13,6 +13,9 @@ import {iTutorialNextStep, iTutorialSteps,
currITutorialStep} from "./InteractiveTutorial.js";
import {showLiterature} from "./Literature.js";
import {showMessage, Message} from "./Message.js";
+import {scriptCalculateHackingTime,
+ scriptCalculateGrowTime,
+ scriptCalculateWeakenTime} from "./NetscriptEvaluator.js";
import {killWorkerScript, addWorkerScript} from "./NetscriptWorker.js";
import {Player} from "./Player.js";
import {hackWorldDaemon} from "./RedPill.js";
@@ -1028,7 +1031,17 @@ let Terminal = {
if (commandArray.length == 1) {
Terminal.executeScanAnalyzeCommand(1);
} else if (commandArray.length == 2) {
- var depth = Number(commandArray[1]);
+ var all = false;
+ if (commandArray[1].endsWith("-a")) {
+ all = true;
+ commandArray[1] = commandArray[1].replace("-a", "");
+ }
+ var depth;
+ if (commandArray[1].length === 0) {
+ depth = 1;
+ } else {
+ depth = Number(commandArray[1]);
+ }
if (isNaN(depth) || depth < 0) {
post("Incorrect usage of scan-analyze command. depth argument must be positive numeric");
return;
@@ -1044,7 +1057,7 @@ let Terminal = {
post("You cannot scan-analyze with that high of a depth. Maximum depth is 10");
return;
}
- Terminal.executeScanAnalyzeCommand(depth);
+ Terminal.executeScanAnalyzeCommand(depth, all);
} else {
post("Incorrect usage of scan-analyze command. usage: scan-analyze [depth]");
}
@@ -1372,12 +1385,13 @@ let Terminal = {
}
},
- executeScanAnalyzeCommand: function(depth=1) {
+ executeScanAnalyzeCommand: function(depth=1, all=false) {
//We'll use the AllServersMap as a visited() array
//TODO Using array as stack for now, can make more efficient
post("~~~~~~~~~~ Beginning scan-analyze ~~~~~~~~~~");
post(" ");
var visited = new AllServersMap();
+
var stack = [];
var depthQueue = [0];
var currServ = Player.getCurrentServer();
@@ -1385,8 +1399,10 @@ let Terminal = {
while(stack.length != 0) {
var s = stack.pop();
var d = depthQueue.pop();
- if (visited[s.ip] || d > depth) {
- continue;
+ if (!all && s.purchasedByPlayer && s.hostname != "home") {
+ continue; //Purchased server
+ } else if (visited[s.ip] || d > depth) {
+ continue; //Already visited or out-of-depth
} else {
visited[s.ip] = 1;
}
diff --git a/src/engine.js b/src/engine.js
index dd2cf16e1..66da6f051 100644
--- a/src/engine.js
+++ b/src/engine.js
@@ -435,16 +435,30 @@ let Engine = {
displayCharacterOverviewInfo: function() {
if (Player.hp == null) {Player.hp = Player.max_hp;}
- document.getElementById("character-overview-text").innerHTML =
- ("Hp: " + Player.hp + " / " + Player.max_hp + "
" +
- "Money: " + numeral(Player.money.toNumber()).format('($0.000a)') + "
" +
- "Hack: " + (Player.hacking_skill).toLocaleString() + "
" +
- "Str: " + (Player.strength).toLocaleString() + "
" +
- "Def: " + (Player.defense).toLocaleString() + "
" +
- "Dex: " + (Player.dexterity).toLocaleString() + "
" +
- "Agi: " + (Player.agility).toLocaleString() + "
" +
- "Cha: " + (Player.charisma).toLocaleString()
- ).replace( / /g, " " );
+ if (Player.intelligence >= 1) {
+ document.getElementById("character-overview-text").innerHTML =
+ ("Hp: " + Player.hp + " / " + Player.max_hp + "
" +
+ "Money: " + numeral(Player.money.toNumber()).format('($0.000a)') + "
" +
+ "Hack: " + (Player.hacking_skill).toLocaleString() + "
" +
+ "Str: " + (Player.strength).toLocaleString() + "
" +
+ "Def: " + (Player.defense).toLocaleString() + "
" +
+ "Dex: " + (Player.dexterity).toLocaleString() + "
" +
+ "Agi: " + (Player.agility).toLocaleString() + "
" +
+ "Cha: " + (Player.charisma).toLocaleString() + "
" +
+ "Int: " + (Player.intelligence).toLocaleString()
+ ).replace( / /g, " " );
+ } else {
+ document.getElementById("character-overview-text").innerHTML =
+ ("Hp: " + Player.hp + " / " + Player.max_hp + "
" +
+ "Money: " + numeral(Player.money.toNumber()).format('($0.000a)') + "
" +
+ "Hack: " + (Player.hacking_skill).toLocaleString() + "
" +
+ "Str: " + (Player.strength).toLocaleString() + "
" +
+ "Def: " + (Player.defense).toLocaleString() + "
" +
+ "Dex: " + (Player.dexterity).toLocaleString() + "
" +
+ "Agi: " + (Player.agility).toLocaleString() + "
" +
+ "Cha: " + (Player.charisma).toLocaleString()
+ ).replace( / /g, " " );
+ }
},
/* Display character info */
@@ -930,7 +944,11 @@ let Engine = {
if (Engine.Counters.messages <= 0) {
checkForMessagesToSend();
- Engine.Counters.messages = 150;
+ if (Augmentations[AugmentationNames.TheRedPill].owned) {
+ Engine.Counters.messages = 600; //2 minutes for Red pill message
+ } else {
+ Engine.Counters.messages = 150;
+ }
}
if (Engine.Counters.stockTick <= 0) {
diff --git a/utils/DialogBox.js b/utils/DialogBox.js
index 1f09e8532..3f38a95fa 100644
--- a/utils/DialogBox.js
+++ b/utils/DialogBox.js
@@ -61,4 +61,4 @@ function dialogBoxCreate(txt) {
}, 400);
}
-export {dialogBoxCreate};
+export {dialogBoxCreate, dialogBoxOpened};
diff --git a/utils/LogBox.js b/utils/LogBox.js
index 4cc62a672..be6b14e2b 100644
--- a/utils/LogBox.js
+++ b/utils/LogBox.js
@@ -39,13 +39,15 @@ var logBoxCurrentScript = null;
function logBoxCreate(script) {
logBoxCurrentScript = script;
logBoxOpen();
+ document.getElementById("log-box-text-header").innerHTML =
+ logBoxCurrentScript.filename + " " + printArray(logBoxCurrentScript.args) + ":
";
logBoxUpdateText();
}
function logBoxUpdateText() {
var txt = document.getElementById("log-box-text");
if (logBoxCurrentScript && logBoxOpened && txt) {
- txt.innerHTML = logBoxCurrentScript.filename + printArray(logBoxCurrentScript.args) + ":
";
+ txt.innerHTML = "";
for (var i = 0; i < logBoxCurrentScript.logs.length; ++i) {
txt.innerHTML += logBoxCurrentScript.logs[i];
txt.innerHTML += "
";